diff --git a/CHANGELOG.md b/CHANGELOG.md index 14be11b..57a26f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,14 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Planned - More translations. -- Finer precalculated sun data for sunrise and sunset. - Adding more calculated attributes in the sensor section. -- Sun position lock, option to lock the suns position in the view (with rotational setting) , and make to house rotate accordingly instead. +- Adding card information about sun and alignement position + ### Added - Placeholder for upcoming changes. +## [0.2.5] - 2026-03-29 +### Added +- Fixed Sun Azimuth visual mode (sun rotation lock) with scene rotation compensation, thank you @HACS-bank for the suggestion! +- Visual editor section/label for `Fixed Sun Azimuth (sun rotation)`. + +### Changed +- Save Camera View now batches integration-backed values (`camera_rotation_h`, `camera_rotation_v`, and `fixed_sun_azimuth`) in a single `sunlight_visualizer.set_options` call to reduce flicker. +- Bumped integration/card release version to `0.2.5`. + ## [0.2.3] - [0.2.4] 2026-03-08 ### Added - Card auto-size down by available width (`autoScaleWidth`, default `true`) with minimum width clamp at `250px`. diff --git a/README.md b/README.md index d939f1f..b3eca50 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Sunlight Visualizer - -[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=NoUsername10&repository=Sunlight_Visualizer&category=integration) - [![coffee_badge](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-donate-orange.svg)](https://www.buymeacoffee.com/DefaultLogin) +[](https://my.home-assistant.io/redirect/hacs_repository/?owner=NoUsername10&repository=Sunlight_Visualizer&category=integration) + +
An interactive sunlight intensity visualizer for Home Assistant. @@ -16,21 +16,22 @@ It includes: - Heat-Load HVAC Prep: Pre-cool when roof or wall sunlight rises, then relax setpoint when exposure drops. - Solar Output Insights: Compare roof sun intensity/alignment with roof power to detect underperformance. - Control blinds and awnings automatically depending on the sun’s position. -

-
- Sensor information
- -
-
+ +
+ +Sensor information:
+ + +
- A Lovelace card (`custom:sunlight-visualizer-card`) that renders a 2.5D house with accurate sun, shadows, roof/wall values, optional roof power, sky effects, and camera controls. - + GIF (on macOS Safari: right click + "Play animation"):
- + ## Instant Overview @@ -42,6 +43,7 @@ GIF (on macOS Safari: right click + "Play animation"): - Visuals: overhang, windows, door, roof panels, tree and adaptive shadows. - Day/night scene with clouds, stars, moon, twilight gradients. - Auto rotate + manual camera controls + save/restore view. +- Fixed sun position, azimuth. (Rotate scene) — Keep sun azimuth visually fixed and rotate the scene instead. - Performance adaptation for slow displays. - Test mode (if sun is down): Force Sun Fallback mode, the card displays `SUN OVERRIDE ENABLED`. @@ -115,6 +117,7 @@ These are the most important settings in integration setup/options: - House Direction preset or custom House Angle (The compass angle of the front door of your house) - Roof Direction (`front`, `left`, `back`, `right`) Slop tilt of you ceiling. - Ceiling Tilt +- Fixed sun position, azimuth. (Rotate scene) - Update Interval - Auto Rotate Speed - Roof power settings: @@ -135,6 +138,7 @@ In integration configuration/options you can tune: - Camera Rotation H / V (default view) - House Direction preset - Roof Direction +- Fixed sun position, azimuth. (Rotate scene) - Update Interval - Auto rotate speed - Force Sun Fallback: @@ -169,6 +173,7 @@ You can also configure common card behavior visually: - Auto rotation speed - Auto-scale Width (auto downscale to fit narrow cards / devices) - Camera controls +- Fixed sun position, azimuth. (Rotate scene) - House/roof orientation values @@ -186,7 +191,7 @@ You can still override entities in YAML when needed. ## Validation -- Current release: `0.2.3` (validated for HACS + Hassfest). +- Current release: `0.2.5` (validated for HACS + Hassfest). - HACS approved repository and installable as an Integration category repo. - HACS validation workflow: `.github/workflows/hacs.yaml` - Hassfest validation workflow: `.github/workflows/hassfest.yaml` @@ -227,6 +232,9 @@ You can still override entities in YAML when needed. - `select.house_direction` - `select.roof_direction` +### Switch entities +- `switch.fixed_sun_azimuth_rotate_scene` + @@ -246,6 +254,8 @@ siSourceValue: sunlight_visualizer rotationHEntity: number.house_camera_rotation_h rotationVEntity: number.house_camera_rotation_v houseAngleEntity: number.house_angle +fixedSunRotationEnabled: false +fixedSunAzimuthDeg: 225 wallFrontPctEntity: sensor.sun_wall_intensity_front wallRightPctEntity: sensor.sun_wall_intensity_right diff --git a/custom_components/sunlight_visualizer/__init__.py b/custom_components/sunlight_visualizer/__init__.py index 3ca07cb..005360d 100644 --- a/custom_components/sunlight_visualizer/__init__.py +++ b/custom_components/sunlight_visualizer/__init__.py @@ -23,6 +23,8 @@ CONF_CAMERA_ROT_H, CONF_CAMERA_ROT_V, CONF_AUTO_ROTATE_SPEED, + CONF_FIXED_SUN_AZIMUTH, + CONF_FIXED_SUN_ROTATION_ENABLED, CONF_ROOF_POWER_ENTITY, CONF_ROOF_POWER_ENABLED, CONF_ROOF_POWER_INVERT, @@ -40,7 +42,8 @@ PLATFORMS: list[Platform] = [ Platform.SENSOR, Platform.NUMBER, - Platform.SELECT, + Platform.SELECT, + Platform.SWITCH, ] # Local resource URL for the bundled card @@ -59,6 +62,8 @@ vol.Optional(CONF_CAMERA_ROT_H): vol.All(vol.Coerce(int), vol.Range(min=0, max=359)), vol.Optional(CONF_CAMERA_ROT_V): vol.All(vol.Coerce(int), vol.Range(min=0, max=90)), vol.Optional(CONF_AUTO_ROTATE_SPEED): vol.All(vol.Coerce(float), vol.Range(min=1, max=90)), + vol.Optional(CONF_FIXED_SUN_AZIMUTH): vol.All(vol.Coerce(int), vol.Range(min=0, max=359)), + vol.Optional(CONF_FIXED_SUN_ROTATION_ENABLED): bool, vol.Optional(CONF_ROOF_POWER_ENTITY): vol.Any(None, str), vol.Optional(CONF_ROOF_POWER_ENABLED): bool, vol.Optional(CONF_ROOF_POWER_INVERT): bool, @@ -72,6 +77,8 @@ CONF_CAMERA_ROT_H, CONF_CAMERA_ROT_V, CONF_AUTO_ROTATE_SPEED, + CONF_FIXED_SUN_AZIMUTH, + CONF_FIXED_SUN_ROTATION_ENABLED, CONF_ROOF_POWER_ENTITY, CONF_ROOF_POWER_ENABLED, CONF_ROOF_POWER_INVERT, diff --git a/custom_components/sunlight_visualizer/config_flow.py b/custom_components/sunlight_visualizer/config_flow.py index 6233bcb..dfb7448 100644 --- a/custom_components/sunlight_visualizer/config_flow.py +++ b/custom_components/sunlight_visualizer/config_flow.py @@ -28,6 +28,7 @@ CONF_FORCE_SUN_FALLBACK, CONF_FORCE_SUN_AZIMUTH, CONF_FORCE_SUN_ELEVATION, + CONF_FIXED_SUN_ROTATION_ENABLED, DIRECTIONS, ROOF_DIRECTIONS, DEFAULT_UPDATE_INTERVAL, @@ -43,6 +44,7 @@ DEFAULT_FORCE_SUN_FALLBACK, DEFAULT_FORCE_SUN_AZIMUTH, DEFAULT_FORCE_SUN_ELEVATION, + DEFAULT_FIXED_SUN_ROTATION_ENABLED, ) @@ -220,14 +222,9 @@ async def async_step_user( vol.Range(min=1, max=90) ), vol.Required( - CONF_ROOF_POWER_ENABLED, - default=DEFAULT_ROOF_POWER_ENABLED, - description="Enable roof power label" - ): bool, - vol.Required( - CONF_ROOF_POWER_INVERT, - default=DEFAULT_ROOF_POWER_INVERT, - description="Invert roof power value (show positive)" + CONF_FIXED_SUN_ROTATION_ENABLED, + default=DEFAULT_FIXED_SUN_ROTATION_ENABLED, + description="Keep sun azimuth visually fixed and rotate the scene instead" ): bool, }) @@ -243,6 +240,19 @@ async def async_step_user( description="Optional solar power sensor (W) for roof label" )] = roof_power_selector + schema_dict.update({ + vol.Required( + CONF_ROOF_POWER_ENABLED, + default=DEFAULT_ROOF_POWER_ENABLED, + description="Enable roof power label" + ): bool, + vol.Required( + CONF_ROOF_POWER_INVERT, + default=DEFAULT_ROOF_POWER_INVERT, + description="Invert roof power value (show positive)" + ): bool, + }) + return self.async_show_form( step_id="user", data_schema=vol.Schema(schema_dict), @@ -373,6 +383,10 @@ async def async_step_init( current_force_sun = current_config.get(CONF_FORCE_SUN_FALLBACK, DEFAULT_FORCE_SUN_FALLBACK) current_force_sun_az = current_config.get(CONF_FORCE_SUN_AZIMUTH, DEFAULT_FORCE_SUN_AZIMUTH) current_force_sun_el = current_config.get(CONF_FORCE_SUN_ELEVATION, DEFAULT_FORCE_SUN_ELEVATION) + current_fixed_sun_rotation_enabled = current_config.get( + CONF_FIXED_SUN_ROTATION_ENABLED, + DEFAULT_FIXED_SUN_ROTATION_ENABLED, + ) # Get current location from config or HA current_latitude = current_config.get(CONF_LATITUDE, self.hass.config.latitude) @@ -443,6 +457,26 @@ async def async_step_init( vol.Coerce(float), vol.Range(min=1, max=90) ), + vol.Required( + CONF_FIXED_SUN_ROTATION_ENABLED, + default=current_fixed_sun_rotation_enabled, + description="Keep sun azimuth visually fixed and rotate the scene instead" + ): bool, + }) + + if current_roof_power: + options_schema_dict[vol.Optional( + CONF_ROOF_POWER_ENTITY, + default=current_roof_power, + description="Optional solar power sensor (W) for roof label" + )] = roof_power_selector + else: + options_schema_dict[vol.Optional( + CONF_ROOF_POWER_ENTITY, + description="Optional solar power sensor (W) for roof label" + )] = roof_power_selector + + options_schema_dict.update({ vol.Required( CONF_ROOF_POWER_ENABLED, default=current_config.get(CONF_ROOF_POWER_ENABLED, DEFAULT_ROOF_POWER_ENABLED), @@ -470,18 +504,6 @@ async def async_step_init( ): vol.All(vol.Coerce(float), vol.Range(min=-90, max=90)), }) - if current_roof_power: - options_schema_dict[vol.Optional( - CONF_ROOF_POWER_ENTITY, - default=current_roof_power, - description="Optional solar power sensor (W) for roof label" - )] = roof_power_selector - else: - options_schema_dict[vol.Optional( - CONF_ROOF_POWER_ENTITY, - description="Optional solar power sensor (W) for roof label" - )] = roof_power_selector - options_schema = vol.Schema(options_schema_dict) return self.async_show_form( diff --git a/custom_components/sunlight_visualizer/const.py b/custom_components/sunlight_visualizer/const.py index 50e05f8..315382d 100644 --- a/custom_components/sunlight_visualizer/const.py +++ b/custom_components/sunlight_visualizer/const.py @@ -21,6 +21,8 @@ CONF_FORCE_SUN_FALLBACK = "force_sun_fallback" CONF_FORCE_SUN_AZIMUTH = "force_sun_azimuth" CONF_FORCE_SUN_ELEVATION = "force_sun_elevation" +CONF_FIXED_SUN_AZIMUTH = "fixed_sun_azimuth" +CONF_FIXED_SUN_ROTATION_ENABLED = "fixed_sun_rotation_enabled" # Marker used by the SVG house card to auto-bind sensors from this integration CARD_SOURCE_ATTR = "sunlight_visualizer_source" @@ -47,6 +49,8 @@ DEFAULT_FORCE_SUN_FALLBACK = False DEFAULT_FORCE_SUN_AZIMUTH = FALLBACK_SUN_AZIMUTH DEFAULT_FORCE_SUN_ELEVATION = FALLBACK_SUN_ELEVATION +DEFAULT_FIXED_SUN_AZIMUTH = 225 +DEFAULT_FIXED_SUN_ROTATION_ENABLED = False # Wall types WALLS = ["front", "left", "back", "right", "ceiling"] diff --git a/custom_components/sunlight_visualizer/manifest.json b/custom_components/sunlight_visualizer/manifest.json index 40949bf..38cdd81 100644 --- a/custom_components/sunlight_visualizer/manifest.json +++ b/custom_components/sunlight_visualizer/manifest.json @@ -9,5 +9,5 @@ "integration_type": "service", "iot_class": "calculated", "issue_tracker": "https://github.com/NoUsername10/Sunlight_Visualizer/issues", - "version": "0.2.4" + "version": "0.2.5" } diff --git a/custom_components/sunlight_visualizer/number.py b/custom_components/sunlight_visualizer/number.py index d69e916..74f6d1c 100644 --- a/custom_components/sunlight_visualizer/number.py +++ b/custom_components/sunlight_visualizer/number.py @@ -352,3 +352,4 @@ def extra_state_attributes(self): CARD_SOURCE_ATTR: CARD_SOURCE_VALUE, "camera_rotation": "v" } + diff --git a/custom_components/sunlight_visualizer/sensor.py b/custom_components/sunlight_visualizer/sensor.py index b77ef1d..28fc875 100644 --- a/custom_components/sunlight_visualizer/sensor.py +++ b/custom_components/sunlight_visualizer/sensor.py @@ -36,6 +36,8 @@ CONF_FORCE_SUN_AZIMUTH, CONF_FORCE_SUN_ELEVATION, CONF_AUTO_ROTATE_SPEED, + CONF_FIXED_SUN_AZIMUTH, + CONF_FIXED_SUN_ROTATION_ENABLED, CONF_CEILING_TILT, CONF_UPDATE_INTERVAL, CONF_ADVANCED_MODE, @@ -46,6 +48,8 @@ DEFAULT_FORCE_SUN_AZIMUTH, DEFAULT_FORCE_SUN_ELEVATION, DEFAULT_AUTO_ROTATE_SPEED, + DEFAULT_FIXED_SUN_AZIMUTH, + DEFAULT_FIXED_SUN_ROTATION_ENABLED, WALLS, DEFAULT_UPDATE_INTERVAL, ROOF_DIRECTIONS, @@ -859,6 +863,22 @@ def extra_state_attributes(self) -> dict[str, Any]: if self._config_entry.options.get(CONF_AUTO_ROTATE_SPEED) is not None else self._config_entry.data.get(CONF_AUTO_ROTATE_SPEED, DEFAULT_AUTO_ROTATE_SPEED) ), + 'fixed_sun_azimuth': ( + self._config_entry.options.get(CONF_FIXED_SUN_AZIMUTH) + if self._config_entry.options.get(CONF_FIXED_SUN_AZIMUTH) is not None + else self._config_entry.data.get( + CONF_FIXED_SUN_AZIMUTH, + DEFAULT_FIXED_SUN_AZIMUTH, + ) + ), + 'fixed_sun_rotation_enabled': ( + self._config_entry.options.get(CONF_FIXED_SUN_ROTATION_ENABLED) + if self._config_entry.options.get(CONF_FIXED_SUN_ROTATION_ENABLED) is not None + else self._config_entry.data.get( + CONF_FIXED_SUN_ROTATION_ENABLED, + DEFAULT_FIXED_SUN_ROTATION_ENABLED + ) + ), 'wall': self._wall, 'last_updated': self.coordinator.data.get('last_updated', ''), 'calculation_count': self.coordinator.calculation_count diff --git a/custom_components/sunlight_visualizer/services.yaml b/custom_components/sunlight_visualizer/services.yaml index 122e151..e5614bd 100644 --- a/custom_components/sunlight_visualizer/services.yaml +++ b/custom_components/sunlight_visualizer/services.yaml @@ -60,6 +60,22 @@ set_options: step: 1 mode: box + fixed_sun_azimuth: + name: Fixed sun azimuth + description: Fixed sun azimuth used by card visual fixed-sun mode (0-359). + selector: + number: + min: 0 + max: 359 + step: 1 + mode: box + + fixed_sun_rotation_enabled: + name: Fixed sun position, azimuth. (Rotate scene) + description: Keep sun azimuth visually fixed and rotate the scene instead + selector: + boolean: + auto_rotate_speed: name: Auto-rotate speed description: Card auto-rotation speed in degrees per second (1-90). diff --git a/custom_components/sunlight_visualizer/strings.json b/custom_components/sunlight_visualizer/strings.json index fb615ec..948beb2 100644 --- a/custom_components/sunlight_visualizer/strings.json +++ b/custom_components/sunlight_visualizer/strings.json @@ -12,6 +12,7 @@ "roof_power_entity": "Roof power sensor (optional)", "roof_power_enabled": "Enable roof power label", "roof_power_invert": "Invert roof power (force positive)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "auto_rotate_speed": "Auto-rotate speed (deg/sec)", "house_angle": "House Angle (degrees, 0° = North-facing front)", "ceiling_tilt": "Ceiling tilt angle (0-90°, 0 = horizontal)", @@ -24,6 +25,7 @@ "roof_power_entity": "Select a power sensor to show below roof % (W/kW)", "roof_power_enabled": "Show roof power value under the roof %", "roof_power_invert": "Invert power values (useful if sensor is negative)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "auto_rotate_speed": "Default auto-rotate speed for the card (1-90 deg/sec)", "house_angle": "Angle of your house's front relative to North (0-359°)", "ceiling_tilt": "Tilt angle of ceiling/solar panels (0° = flat, 90° = vertical)", @@ -62,6 +64,7 @@ "roof_power_entity": "Roof power sensor (optional)", "roof_power_enabled": "Enable roof power label", "roof_power_invert": "Invert roof power (force positive)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "force_sun_fallback": "Force Sun Fallback", "force_sun_azimuth": "Force Sun Azimuth", "force_sun_elevation": "Force Sun Elevation", @@ -77,6 +80,7 @@ "roof_power_entity": "Select a power sensor to show below roof % (W/kW)", "roof_power_enabled": "Show roof power value under the roof %", "roof_power_invert": "Invert power values (useful if sensor is negative)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "force_sun_fallback": "Force fallback sun values (testing)", "force_sun_azimuth": "Azimuth to use when forcing fallback (0-359°)", "force_sun_elevation": "Elevation to use when forcing fallback (-90° to 90°)", @@ -117,6 +121,14 @@ "name": "Camera rotation V", "description": "Vertical camera rotation in degrees (0-90)." }, + "fixed_sun_azimuth": { + "name": "Fixed sun azimuth", + "description": "Fixed sun azimuth used by card visual fixed-sun mode (0-359)." + }, + "fixed_sun_rotation_enabled": { + "name": "Fixed sun position, azimuth. (Rotate scene)", + "description": "Keep sun azimuth visually fixed and rotate the scene instead" + }, "auto_rotate_speed": { "name": "Auto-rotate speed", "description": "Card auto-rotation speed in degrees per second (1-90)." diff --git a/custom_components/sunlight_visualizer/switch.py b/custom_components/sunlight_visualizer/switch.py new file mode 100644 index 0000000..aa3cee5 --- /dev/null +++ b/custom_components/sunlight_visualizer/switch.py @@ -0,0 +1,96 @@ +"""Switch platform for Sunlight Visualizer settings.""" +from __future__ import annotations + +from homeassistant.components.switch import SwitchEntity +from homeassistant.config_entries import ConfigEntry +from homeassistant.const import EntityCategory +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.update_coordinator import CoordinatorEntity + +from .const import ( + DOMAIN, + CONF_FIXED_SUN_ROTATION_ENABLED, + DEFAULT_FIXED_SUN_ROTATION_ENABLED, + CARD_SOURCE_ATTR, + CARD_SOURCE_VALUE, +) + + +async def async_setup_entry( + hass: HomeAssistant, + config_entry: ConfigEntry, + async_add_entities: AddEntitiesCallback, +) -> None: + """Set up switch entities for settings.""" + coordinator = hass.data[DOMAIN][config_entry.entry_id]["coordinator"] + async_add_entities([FixedSunRotationSwitch(coordinator, config_entry)]) + + +class FixedSunRotationSwitch(CoordinatorEntity, SwitchEntity): + """Switch entity for fixed sun rotation visual mode.""" + + _attr_should_poll = False + + def __init__(self, coordinator, config_entry: ConfigEntry) -> None: + """Initialize switch.""" + super().__init__(coordinator) + self._config_entry = config_entry + self._attr_unique_id = f"{config_entry.entry_id}_fixed_sun_rotation_enabled" + self._attr_name = "Fixed sun position, azimuth. (Rotate scene)" + self._attr_icon = "mdi:axis-z-rotate-clockwise" + self._attr_entity_category = EntityCategory.CONFIG + self._attr_device_info = coordinator.device_info + + async def async_added_to_hass(self) -> None: + """When entity is added to Home Assistant.""" + await super().async_added_to_hass() + self.async_write_ha_state() + + @property + def is_on(self) -> bool | None: + """Return true if the switch is on.""" + return bool( + self._config_entry.options.get( + CONF_FIXED_SUN_ROTATION_ENABLED, + self._config_entry.data.get( + CONF_FIXED_SUN_ROTATION_ENABLED, DEFAULT_FIXED_SUN_ROTATION_ENABLED + ), + ) + ) + + @property + def available(self) -> bool: + """Return if entity is available.""" + return self.coordinator.last_update_success is not False + + async def async_turn_on(self, **kwargs) -> None: + """Turn on fixed sun rotation mode.""" + self.hass.config_entries.async_update_entry( + self._config_entry, + options={ + **self._config_entry.options, + CONF_FIXED_SUN_ROTATION_ENABLED: True, + }, + ) + self.async_write_ha_state() + + async def async_turn_off(self, **kwargs) -> None: + """Turn off fixed sun rotation mode.""" + self.hass.config_entries.async_update_entry( + self._config_entry, + options={ + **self._config_entry.options, + CONF_FIXED_SUN_ROTATION_ENABLED: False, + }, + ) + self.async_write_ha_state() + + @property + def extra_state_attributes(self) -> dict: + """Return extra state attributes.""" + return { + "description": "Keep sun azimuth visually fixed and rotate the scene instead", + CARD_SOURCE_ATTR: CARD_SOURCE_VALUE, + "si_setting": "fixed_sun_rotation_enabled", + } diff --git a/custom_components/sunlight_visualizer/translations/en.json b/custom_components/sunlight_visualizer/translations/en.json index fb615ec..948beb2 100644 --- a/custom_components/sunlight_visualizer/translations/en.json +++ b/custom_components/sunlight_visualizer/translations/en.json @@ -12,6 +12,7 @@ "roof_power_entity": "Roof power sensor (optional)", "roof_power_enabled": "Enable roof power label", "roof_power_invert": "Invert roof power (force positive)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "auto_rotate_speed": "Auto-rotate speed (deg/sec)", "house_angle": "House Angle (degrees, 0° = North-facing front)", "ceiling_tilt": "Ceiling tilt angle (0-90°, 0 = horizontal)", @@ -24,6 +25,7 @@ "roof_power_entity": "Select a power sensor to show below roof % (W/kW)", "roof_power_enabled": "Show roof power value under the roof %", "roof_power_invert": "Invert power values (useful if sensor is negative)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "auto_rotate_speed": "Default auto-rotate speed for the card (1-90 deg/sec)", "house_angle": "Angle of your house's front relative to North (0-359°)", "ceiling_tilt": "Tilt angle of ceiling/solar panels (0° = flat, 90° = vertical)", @@ -62,6 +64,7 @@ "roof_power_entity": "Roof power sensor (optional)", "roof_power_enabled": "Enable roof power label", "roof_power_invert": "Invert roof power (force positive)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "force_sun_fallback": "Force Sun Fallback", "force_sun_azimuth": "Force Sun Azimuth", "force_sun_elevation": "Force Sun Elevation", @@ -77,6 +80,7 @@ "roof_power_entity": "Select a power sensor to show below roof % (W/kW)", "roof_power_enabled": "Show roof power value under the roof %", "roof_power_invert": "Invert power values (useful if sensor is negative)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "force_sun_fallback": "Force fallback sun values (testing)", "force_sun_azimuth": "Azimuth to use when forcing fallback (0-359°)", "force_sun_elevation": "Elevation to use when forcing fallback (-90° to 90°)", @@ -117,6 +121,14 @@ "name": "Camera rotation V", "description": "Vertical camera rotation in degrees (0-90)." }, + "fixed_sun_azimuth": { + "name": "Fixed sun azimuth", + "description": "Fixed sun azimuth used by card visual fixed-sun mode (0-359)." + }, + "fixed_sun_rotation_enabled": { + "name": "Fixed sun position, azimuth. (Rotate scene)", + "description": "Keep sun azimuth visually fixed and rotate the scene instead" + }, "auto_rotate_speed": { "name": "Auto-rotate speed", "description": "Card auto-rotation speed in degrees per second (1-90)." diff --git a/custom_components/sunlight_visualizer/translations/es.json b/custom_components/sunlight_visualizer/translations/es.json index 8951095..7e41e66 100644 --- a/custom_components/sunlight_visualizer/translations/es.json +++ b/custom_components/sunlight_visualizer/translations/es.json @@ -12,6 +12,7 @@ "roof_power_entity": "Sensor de potencia del techo (opcional)", "roof_power_enabled": "Activar etiqueta de potencia del techo", "roof_power_invert": "Invertir potencia del techo (forzar positivo)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "auto_rotate_speed": "Velocidad de auto-rotacion (grados/segundo)", "house_angle": "Angulo de la casa (grados, 0° = frente hacia el norte)", "ceiling_tilt": "Inclinacion del techo (0-90°, 0 = horizontal)", @@ -24,6 +25,7 @@ "roof_power_entity": "Selecciona un sensor de potencia para mostrar debajo del % del techo (W/kW)", "roof_power_enabled": "Mostrar valor de potencia del techo debajo del %", "roof_power_invert": "Invertir valores de potencia (util para sensores con valores negativos)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "auto_rotate_speed": "Velocidad predeterminada de auto-rotacion para la tarjeta (1-90 grados/seg)", "house_angle": "Angulo del frente de tu casa respecto al norte (0-359°)", "ceiling_tilt": "Angulo de inclinacion del techo/paneles solares (0° = plano, 90° = vertical)", @@ -62,6 +64,7 @@ "roof_power_entity": "Sensor de potencia del techo (opcional)", "roof_power_enabled": "Activar etiqueta de potencia del techo", "roof_power_invert": "Invertir potencia del techo (forzar positivo)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "force_sun_fallback": "Forzar sol de respaldo", "force_sun_azimuth": "Forzar azimut del sol", "force_sun_elevation": "Forzar elevacion del sol", @@ -77,6 +80,7 @@ "roof_power_entity": "Selecciona un sensor de potencia para mostrar debajo del % del techo (W/kW)", "roof_power_enabled": "Mostrar valor de potencia del techo debajo del %", "roof_power_invert": "Invertir valores de potencia (util para sensores con valores negativos)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "force_sun_fallback": "Forzar valores de sol de respaldo (pruebas)", "force_sun_azimuth": "Azimut a usar al forzar respaldo (0-359°)", "force_sun_elevation": "Elevacion a usar al forzar respaldo (-90° a 90°)", @@ -117,6 +121,14 @@ "name": "Rotacion de camara V", "description": "Rotacion vertical de la camara en grados (0-90)." }, + "fixed_sun_azimuth": { + "name": "Azimut solar fijo", + "description": "Azimut solar fijo para el modo visual de sol fijo en la tarjeta (0-359)." + }, + "fixed_sun_rotation_enabled": { + "name": "Fixed sun position, azimuth. (Rotate scene)", + "description": "Keep sun azimuth visually fixed and rotate the scene instead" + }, "auto_rotate_speed": { "name": "Velocidad de auto-rotacion", "description": "Velocidad de auto-rotacion de la tarjeta en grados por segundo (1-90)." diff --git a/custom_components/sunlight_visualizer/translations/sv.json b/custom_components/sunlight_visualizer/translations/sv.json index 8a06fd2..90d463d 100644 --- a/custom_components/sunlight_visualizer/translations/sv.json +++ b/custom_components/sunlight_visualizer/translations/sv.json @@ -12,6 +12,7 @@ "roof_power_entity": "Takets effektsensor (valfri)", "roof_power_enabled": "Aktivera takets effektvärde", "roof_power_invert": "Invertera effekt (tvinga positivt)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "auto_rotate_speed": "Auto-roteringshastighet (grader/sek)", "house_angle": "Husvinkel (grader, 0° = front mot norr)", "ceiling_tilt": "Taklutning (0–90°, 0 = horisontell)", @@ -24,6 +25,7 @@ "roof_power_entity": "Välj effektsensor som visas under takets % (W/kW)", "roof_power_enabled": "Visa effektvärde under takets %", "roof_power_invert": "Invertera effektvärden (om sensorn är negativ)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "auto_rotate_speed": "Standardhastighet för auto-rotation i kortet (1–90 grader/sek)", "house_angle": "Vinkel för husets front i förhållande till norr (0–359°)", "ceiling_tilt": "Lutningsvinkel för tak/solpaneler (0° = plant, 90° = vertikalt)", @@ -62,6 +64,7 @@ "roof_power_entity": "Takets effektsensor (valfri)", "roof_power_enabled": "Aktivera takets effektvärde", "roof_power_invert": "Invertera effekt (tvinga positivt)", + "fixed_sun_rotation_enabled": "Fixed sun position, azimuth. (Rotate scene)", "force_sun_fallback": "Tvinga sol‑fallback", "force_sun_azimuth": "Tvinga solazimut", "force_sun_elevation": "Tvinga solhöjd", @@ -77,6 +80,7 @@ "roof_power_entity": "Välj effektsensor som visas under takets % (W/kW)", "roof_power_enabled": "Visa effektvärde under takets %", "roof_power_invert": "Invertera effektvärden (om sensorn är negativ)", + "fixed_sun_rotation_enabled": "Keep sun azimuth visually fixed and rotate the scene instead", "force_sun_fallback": "Tvinga fallback‑solvärden (test)", "force_sun_azimuth": "Azimut som används vid tvingad fallback (0–359°)", "force_sun_elevation": "Höjd som används vid tvingad fallback (−90° till 90°)", @@ -117,6 +121,14 @@ "name": "Kamerarotation V", "description": "Vertikal kamerarotation i grader (0-90)." }, + "fixed_sun_azimuth": { + "name": "Fast solazimut", + "description": "Fast solazimut för kortets visuella fixed-sun-läge (0-359)." + }, + "fixed_sun_rotation_enabled": { + "name": "Fixed sun position, azimuth. (Rotate scene)", + "description": "Keep sun azimuth visually fixed and rotate the scene instead" + }, "auto_rotate_speed": { "name": "Auto-roteringshastighet", "description": "Kortets auto-roteringshastighet i grader per sekund (1-90)." diff --git a/custom_components/sunlight_visualizer/www/sunlight-visualizer-card.js b/custom_components/sunlight_visualizer/www/sunlight-visualizer-card.js index eacbd67..6e5992c 100644 --- a/custom_components/sunlight_visualizer/www/sunlight-visualizer-card.js +++ b/custom_components/sunlight_visualizer/www/sunlight-visualizer-card.js @@ -3,18 +3,18 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const $a = globalThis, Hn = $a.ShadowRoot && ($a.ShadyCSS === void 0 || $a.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Gn = Symbol(), oc = /* @__PURE__ */ new WeakMap(); -let mc = class { +const Ba = globalThis, si = Ba.ShadowRoot && (Ba.ShadyCSS === void 0 || Ba.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ai = Symbol(), mc = /* @__PURE__ */ new WeakMap(); +let Nc = class { constructor(a, c, l) { - if (this._$cssResult$ = !0, l !== Gn) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); + if (this._$cssResult$ = !0, l !== ai) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = a, this.t = c; } get styleSheet() { let a = this.o; const c = this.t; - if (Hn && a === void 0) { + if (si && a === void 0) { const l = c !== void 0 && c.length === 1; - l && (a = oc.get(c)), a === void 0 && ((this.o = a = new CSSStyleSheet()).replaceSync(this.cssText), l && oc.set(c, a)); + l && (a = mc.get(c)), a === void 0 && ((this.o = a = new CSSStyleSheet()).replaceSync(this.cssText), l && mc.set(c, a)); } return a; } @@ -22,33 +22,33 @@ let mc = class { return this.cssText; } }; -const Cf = (S) => new mc(typeof S == "string" ? S : S + "", void 0, Gn), bc = (S, ...a) => { - const c = S.length === 1 ? S[0] : a.reduce((l, o, w) => l + ((v) => { - if (v._$cssResult$ === !0) return v.cssText; - if (typeof v == "number") return v; - throw Error("Value passed to 'css' function must be a 'css' function result: " + v + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); - })(o) + S[w + 1], S[0]); - return new mc(c, S, Gn); -}, kf = (S, a) => { - if (Hn) S.adoptedStyleSheets = a.map((c) => c instanceof CSSStyleSheet ? c : c.styleSheet); +const Df = (S) => new Nc(typeof S == "string" ? S : S + "", void 0, ai), Ec = (S, ...a) => { + const c = S.length === 1 ? S[0] : a.reduce((l, o, x) => l + (($) => { + if ($._$cssResult$ === !0) return $.cssText; + if (typeof $ == "number") return $; + throw Error("Value passed to 'css' function must be a 'css' function result: " + $ + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); + })(o) + S[x + 1], S[0]); + return new Nc(c, S, ai); +}, Bf = (S, a) => { + if (si) S.adoptedStyleSheets = a.map((c) => c instanceof CSSStyleSheet ? c : c.styleSheet); else for (const c of a) { - const l = document.createElement("style"), o = $a.litNonce; + const l = document.createElement("style"), o = Ba.litNonce; o !== void 0 && l.setAttribute("nonce", o), l.textContent = c.cssText, S.appendChild(l); } -}, ec = Hn ? (S) => S : (S) => S instanceof CSSStyleSheet ? ((a) => { +}, bc = si ? (S) => S : (S) => S instanceof CSSStyleSheet ? ((a) => { let c = ""; for (const l of a.cssRules) c += l.cssText; - return Cf(c); + return Df(c); })(S) : S; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const { is: Nf, defineProperty: Ef, getOwnPropertyDescriptor: Tf, getOwnPropertyNames: Ff, getOwnPropertySymbols: Af, getPrototypeOf: Df } = Object, mo = globalThis, sc = mo.trustedTypes, Bf = sc ? sc.emptyScript : "", Bn = mo.reactiveElementPolyfillSupport, ls = (S, a) => S, Wn = { toAttribute(S, a) { +const { is: zf, defineProperty: Pf, getOwnPropertyDescriptor: Lf, getOwnPropertyNames: Wf, getOwnPropertySymbols: Of, getPrototypeOf: If } = Object, bo = globalThis, gc = bo.trustedTypes, Vf = gc ? gc.emptyScript : "", Xn = bo.reactiveElementPolyfillSupport, bs = (S, a) => S, Qn = { toAttribute(S, a) { switch (a) { case Boolean: - S = S ? Bf : null; + S = S ? Vf : null; break; case Object: case Array: @@ -73,44 +73,44 @@ const { is: Nf, defineProperty: Ef, getOwnPropertyDescriptor: Tf, getOwnProperty } } return c; -} }, gc = (S, a) => !Nf(S, a), ac = { attribute: !0, type: String, converter: Wn, reflect: !1, useDefault: !1, hasChanged: gc }; -Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), mo.litPropertyMetadata ?? (mo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); -let me = class extends HTMLElement { +} }, Fc = (S, a) => !zf(S, a), _c = { attribute: !0, type: String, converter: Qn, reflect: !1, useDefault: !1, hasChanged: Fc }; +Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), bo.litPropertyMetadata ?? (bo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); +let $e = class extends HTMLElement { static addInitializer(a) { this._$Ei(), (this.l ?? (this.l = [])).push(a); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } - static createProperty(a, c = ac) { + static createProperty(a, c = _c) { if (c.state && (c.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(a) && ((c = Object.create(c)).wrapped = !0), this.elementProperties.set(a, c), !c.noAccessor) { const l = Symbol(), o = this.getPropertyDescriptor(a, l, c); - o !== void 0 && Ef(this.prototype, a, o); + o !== void 0 && Pf(this.prototype, a, o); } } static getPropertyDescriptor(a, c, l) { - const { get: o, set: w } = Tf(this.prototype, a) ?? { get() { + const { get: o, set: x } = Lf(this.prototype, a) ?? { get() { return this[c]; - }, set(v) { - this[c] = v; + }, set($) { + this[c] = $; } }; - return { get: o, set(v) { - const P = o == null ? void 0 : o.call(this); - w == null || w.call(this, v), this.requestUpdate(a, P, l); + return { get: o, set($) { + const B = o == null ? void 0 : o.call(this); + x == null || x.call(this, $), this.requestUpdate(a, B, l); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(a) { - return this.elementProperties.get(a) ?? ac; + return this.elementProperties.get(a) ?? _c; } static _$Ei() { - if (this.hasOwnProperty(ls("elementProperties"))) return; - const a = Df(this); + if (this.hasOwnProperty(bs("elementProperties"))) return; + const a = If(this); a.finalize(), a.l !== void 0 && (this.l = [...a.l]), this.elementProperties = new Map(a.elementProperties); } static finalize() { - if (this.hasOwnProperty(ls("finalized"))) return; - if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ls("properties"))) { - const c = this.properties, l = [...Ff(c), ...Af(c)]; + if (this.hasOwnProperty(bs("finalized"))) return; + if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(bs("properties"))) { + const c = this.properties, l = [...Wf(c), ...Of(c)]; for (const o of l) this.createProperty(o, c[o]); } const a = this[Symbol.metadata]; @@ -129,8 +129,8 @@ let me = class extends HTMLElement { const c = []; if (Array.isArray(a)) { const l = new Set(a.flat(1 / 0).reverse()); - for (const o of l) c.unshift(ec(o)); - } else a !== void 0 && c.push(ec(a)); + for (const o of l) c.unshift(bc(o)); + } else a !== void 0 && c.push(bc(a)); return c; } static _$Eu(a, c) { @@ -159,7 +159,7 @@ let me = class extends HTMLElement { } createRenderRoot() { const a = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); - return kf(a, this.constructor.elementStyles), a; + return Bf(a, this.constructor.elementStyles), a; } connectedCallback() { var a; @@ -181,34 +181,34 @@ let me = class extends HTMLElement { this._$AK(a, l); } _$ET(a, c) { - var w; + var x; const l = this.constructor.elementProperties.get(a), o = this.constructor._$Eu(a, l); if (o !== void 0 && l.reflect === !0) { - const v = (((w = l.converter) == null ? void 0 : w.toAttribute) !== void 0 ? l.converter : Wn).toAttribute(c, l.type); - this._$Em = a, v == null ? this.removeAttribute(o) : this.setAttribute(o, v), this._$Em = null; + const $ = (((x = l.converter) == null ? void 0 : x.toAttribute) !== void 0 ? l.converter : Qn).toAttribute(c, l.type); + this._$Em = a, $ == null ? this.removeAttribute(o) : this.setAttribute(o, $), this._$Em = null; } } _$AK(a, c) { - var w, v; + var x, $; const l = this.constructor, o = l._$Eh.get(a); if (o !== void 0 && this._$Em !== o) { - const P = l.getPropertyOptions(o), k = typeof P.converter == "function" ? { fromAttribute: P.converter } : ((w = P.converter) == null ? void 0 : w.fromAttribute) !== void 0 ? P.converter : Wn; + const B = l.getPropertyOptions(o), k = typeof B.converter == "function" ? { fromAttribute: B.converter } : ((x = B.converter) == null ? void 0 : x.fromAttribute) !== void 0 ? B.converter : Qn; this._$Em = o; - const W = k.fromAttribute(c, P.type); - this[o] = W ?? ((v = this._$Ej) == null ? void 0 : v.get(o)) ?? W, this._$Em = null; + const O = k.fromAttribute(c, B.type); + this[o] = O ?? (($ = this._$Ej) == null ? void 0 : $.get(o)) ?? O, this._$Em = null; } } - requestUpdate(a, c, l, o = !1, w) { - var v; + requestUpdate(a, c, l, o = !1, x) { + var $; if (a !== void 0) { - const P = this.constructor; - if (o === !1 && (w = this[a]), l ?? (l = P.getPropertyOptions(a)), !((l.hasChanged ?? gc)(w, c) || l.useDefault && l.reflect && w === ((v = this._$Ej) == null ? void 0 : v.get(a)) && !this.hasAttribute(P._$Eu(a, l)))) return; + const B = this.constructor; + if (o === !1 && (x = this[a]), l ?? (l = B.getPropertyOptions(a)), !((l.hasChanged ?? Fc)(x, c) || l.useDefault && l.reflect && x === (($ = this._$Ej) == null ? void 0 : $.get(a)) && !this.hasAttribute(B._$Eu(a, l)))) return; this.C(a, c, l); } this.isUpdatePending === !1 && (this._$ES = this._$EP()); } - C(a, c, { useDefault: l, reflect: o, wrapped: w }, v) { - l && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(a) && (this._$Ej.set(a, v ?? c ?? this[a]), w !== !0 || v !== void 0) || (this._$AL.has(a) || (this.hasUpdated || l || (c = void 0), this._$AL.set(a, c)), o === !0 && this._$Em !== a && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(a)); + C(a, c, { useDefault: l, reflect: o, wrapped: x }, $) { + l && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(a) && (this._$Ej.set(a, $ ?? c ?? this[a]), x !== !0 || $ !== void 0) || (this._$AL.has(a) || (this.hasUpdated || l || (c = void 0), this._$AL.set(a, c)), o === !0 && this._$Em !== a && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(a)); } async _$EP() { this.isUpdatePending = !0; @@ -228,21 +228,21 @@ let me = class extends HTMLElement { if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { - for (const [w, v] of this._$Ep) this[w] = v; + for (const [x, $] of this._$Ep) this[x] = $; this._$Ep = void 0; } const o = this.constructor.elementProperties; - if (o.size > 0) for (const [w, v] of o) { - const { wrapped: P } = v, k = this[w]; - P !== !0 || this._$AL.has(w) || k === void 0 || this.C(w, void 0, v, k); + if (o.size > 0) for (const [x, $] of o) { + const { wrapped: B } = $, k = this[x]; + B !== !0 || this._$AL.has(x) || k === void 0 || this.C(x, void 0, $, k); } } let a = !1; const c = this._$AL; try { a = this.shouldUpdate(c), a ? (this.willUpdate(c), (l = this._$EO) == null || l.forEach((o) => { - var w; - return (w = o.hostUpdate) == null ? void 0 : w.call(o); + var x; + return (x = o.hostUpdate) == null ? void 0 : x.call(o); }), this.update(c)) : this._$EM(); } catch (o) { throw a = !1, this._$EM(), o; @@ -278,76 +278,76 @@ let me = class extends HTMLElement { firstUpdated(a) { } }; -me.elementStyles = [], me.shadowRootOptions = { mode: "open" }, me[ls("elementProperties")] = /* @__PURE__ */ new Map(), me[ls("finalized")] = /* @__PURE__ */ new Map(), Bn == null || Bn({ ReactiveElement: me }), (mo.reactiveElementVersions ?? (mo.reactiveElementVersions = [])).push("2.1.2"); +$e.elementStyles = [], $e.shadowRootOptions = { mode: "open" }, $e[bs("elementProperties")] = /* @__PURE__ */ new Map(), $e[bs("finalized")] = /* @__PURE__ */ new Map(), Xn == null || Xn({ ReactiveElement: $e }), (bo.reactiveElementVersions ?? (bo.reactiveElementVersions = [])).push("2.1.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const hs = globalThis, nc = (S) => S, _a = hs.trustedTypes, ic = _a ? _a.createPolicy("lit-html", { createHTML: (S) => S }) : void 0, yc = "$lit$", po = `lit$${Math.random().toFixed(9).slice(2)}$`, $c = "?" + po, Pf = `<${$c}>`, Io = document, us = () => Io.createComment(""), fs = (S) => S === null || typeof S != "object" && typeof S != "function", Un = Array.isArray, zf = (S) => Un(S) || typeof (S == null ? void 0 : S[Symbol.iterator]) == "function", Pn = `[ -\f\r]`, cs = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rc = /-->/g, cc = />/g, zo = RegExp(`>|${Pn}(?:([^\\s"'>=/]+)(${Pn}*=${Pn}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`, "g"), lc = /'/g, hc = /"/g, _c = /^(?:script|style|textarea|title)$/i, Lf = (S) => (a, ...c) => ({ _$litType$: S, strings: a, values: c }), Lo = Lf(1), Vo = Symbol.for("lit-noChange"), at = Symbol.for("lit-nothing"), uc = /* @__PURE__ */ new WeakMap(), Wo = Io.createTreeWalker(Io, 129); -function vc(S, a) { - if (!Un(S) || !S.hasOwnProperty("raw")) throw Error("invalid template strings array"); - return ic !== void 0 ? ic.createHTML(a) : a; +const gs = globalThis, yc = (S) => S, za = gs.trustedTypes, $c = za ? za.createPolicy("lit-html", { createHTML: (S) => S }) : void 0, Ac = "$lit$", mo = `lit$${Math.random().toFixed(9).slice(2)}$`, Tc = "?" + mo, Hf = `<${Tc}>`, Go = document, _s = () => Go.createComment(""), ys = (S) => S === null || typeof S != "object" && typeof S != "function", ni = Array.isArray, Gf = (S) => ni(S) || typeof (S == null ? void 0 : S[Symbol.iterator]) == "function", Zn = `[ +\f\r]`, ms = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, vc = /-->/g, Sc = />/g, Oo = RegExp(`>|${Zn}(?:([^\\s"'>=/]+)(${Zn}*=${Zn}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`, "g"), xc = /'/g, wc = /"/g, Dc = /^(?:script|style|textarea|title)$/i, Uf = (S) => (a, ...c) => ({ _$litType$: S, strings: a, values: c }), Io = Uf(1), Uo = Symbol.for("lit-noChange"), st = Symbol.for("lit-nothing"), Rc = /* @__PURE__ */ new WeakMap(), Vo = Go.createTreeWalker(Go, 129); +function Bc(S, a) { + if (!ni(S) || !S.hasOwnProperty("raw")) throw Error("invalid template strings array"); + return $c !== void 0 ? $c.createHTML(a) : a; } -const Wf = (S, a) => { +const jf = (S, a) => { const c = S.length - 1, l = []; - let o, w = a === 2 ? "" : a === 3 ? "" : "", v = cs; - for (let P = 0; P < c; P++) { - const k = S[P]; - let W, Y, V = -1, Q = 0; - for (; Q < k.length && (v.lastIndex = Q, Y = v.exec(k), Y !== null); ) Q = v.lastIndex, v === cs ? Y[1] === "!--" ? v = rc : Y[1] !== void 0 ? v = cc : Y[2] !== void 0 ? (_c.test(Y[2]) && (o = RegExp("" ? (v = o ?? cs, V = -1) : Y[1] === void 0 ? V = -2 : (V = v.lastIndex - Y[2].length, W = Y[1], v = Y[3] === void 0 ? zo : Y[3] === '"' ? hc : lc) : v === hc || v === lc ? v = zo : v === rc || v === cc ? v = cs : (v = zo, o = void 0); - const q = v === zo && S[P + 1].startsWith("/>") ? " " : ""; - w += v === cs ? k + Pf : V >= 0 ? (l.push(W), k.slice(0, V) + yc + k.slice(V) + po + q) : k + po + (V === -2 ? P : q); - } - return [vc(S, w + (S[c] || "") + (a === 2 ? "" : a === 3 ? "" : "")), l]; + let o, x = a === 2 ? "" : a === 3 ? "" : "", $ = ms; + for (let B = 0; B < c; B++) { + const k = S[B]; + let O, Y, L = -1, tt = 0; + for (; tt < k.length && ($.lastIndex = tt, Y = $.exec(k), Y !== null); ) tt = $.lastIndex, $ === ms ? Y[1] === "!--" ? $ = vc : Y[1] !== void 0 ? $ = Sc : Y[2] !== void 0 ? (Dc.test(Y[2]) && (o = RegExp("" ? ($ = o ?? ms, L = -1) : Y[1] === void 0 ? L = -2 : (L = $.lastIndex - Y[2].length, O = Y[1], $ = Y[3] === void 0 ? Oo : Y[3] === '"' ? wc : xc) : $ === wc || $ === xc ? $ = Oo : $ === vc || $ === Sc ? $ = ms : ($ = Oo, o = void 0); + const j = $ === Oo && S[B + 1].startsWith("/>") ? " " : ""; + x += $ === ms ? k + Hf : L >= 0 ? (l.push(O), k.slice(0, L) + Ac + k.slice(L) + mo + j) : k + mo + (L === -2 ? B : j); + } + return [Bc(S, x + (S[c] || "") + (a === 2 ? "" : a === 3 ? "" : "")), l]; }; -class ds { +class $s { constructor({ strings: a, _$litType$: c }, l) { let o; this.parts = []; - let w = 0, v = 0; - const P = a.length - 1, k = this.parts, [W, Y] = Wf(a, c); - if (this.el = ds.createElement(W, l), Wo.currentNode = this.el.content, c === 2 || c === 3) { - const V = this.el.content.firstChild; - V.replaceWith(...V.childNodes); + let x = 0, $ = 0; + const B = a.length - 1, k = this.parts, [O, Y] = jf(a, c); + if (this.el = $s.createElement(O, l), Vo.currentNode = this.el.content, c === 2 || c === 3) { + const L = this.el.content.firstChild; + L.replaceWith(...L.childNodes); } - for (; (o = Wo.nextNode()) !== null && k.length < P; ) { + for (; (o = Vo.nextNode()) !== null && k.length < B; ) { if (o.nodeType === 1) { - if (o.hasAttributes()) for (const V of o.getAttributeNames()) if (V.endsWith(yc)) { - const Q = Y[v++], q = o.getAttribute(V).split(po), O = /([.?@])?(.*)/.exec(Q); - k.push({ type: 1, index: w, name: O[2], strings: q, ctor: O[1] === "." ? If : O[1] === "?" ? Vf : O[1] === "@" ? Hf : Sa }), o.removeAttribute(V); - } else V.startsWith(po) && (k.push({ type: 6, index: w }), o.removeAttribute(V)); - if (_c.test(o.tagName)) { - const V = o.textContent.split(po), Q = V.length - 1; - if (Q > 0) { - o.textContent = _a ? _a.emptyScript : ""; - for (let q = 0; q < Q; q++) o.append(V[q], us()), Wo.nextNode(), k.push({ type: 2, index: ++w }); - o.append(V[Q], us()); + if (o.hasAttributes()) for (const L of o.getAttributeNames()) if (L.endsWith(Ac)) { + const tt = Y[$++], j = o.getAttribute(L).split(mo), z = /([.?@])?(.*)/.exec(tt); + k.push({ type: 1, index: x, name: z[2], strings: j, ctor: z[1] === "." ? Yf : z[1] === "?" ? Xf : z[1] === "@" ? Zf : La }), o.removeAttribute(L); + } else L.startsWith(mo) && (k.push({ type: 6, index: x }), o.removeAttribute(L)); + if (Dc.test(o.tagName)) { + const L = o.textContent.split(mo), tt = L.length - 1; + if (tt > 0) { + o.textContent = za ? za.emptyScript : ""; + for (let j = 0; j < tt; j++) o.append(L[j], _s()), Vo.nextNode(), k.push({ type: 2, index: ++x }); + o.append(L[tt], _s()); } } - } else if (o.nodeType === 8) if (o.data === $c) k.push({ type: 2, index: w }); + } else if (o.nodeType === 8) if (o.data === Tc) k.push({ type: 2, index: x }); else { - let V = -1; - for (; (V = o.data.indexOf(po, V + 1)) !== -1; ) k.push({ type: 7, index: w }), V += po.length - 1; + let L = -1; + for (; (L = o.data.indexOf(mo, L + 1)) !== -1; ) k.push({ type: 7, index: x }), L += mo.length - 1; } - w++; + x++; } } static createElement(a, c) { - const l = Io.createElement("template"); + const l = Go.createElement("template"); return l.innerHTML = a, l; } } -function ge(S, a, c = S, l) { - var v, P; - if (a === Vo) return a; - let o = l !== void 0 ? (v = c._$Co) == null ? void 0 : v[l] : c._$Cl; - const w = fs(a) ? void 0 : a._$litDirective$; - return (o == null ? void 0 : o.constructor) !== w && ((P = o == null ? void 0 : o._$AO) == null || P.call(o, !1), w === void 0 ? o = void 0 : (o = new w(S), o._$AT(S, c, l)), l !== void 0 ? (c._$Co ?? (c._$Co = []))[l] = o : c._$Cl = o), o !== void 0 && (a = ge(S, o._$AS(S, a.values), o, l)), a; +function Se(S, a, c = S, l) { + var $, B; + if (a === Uo) return a; + let o = l !== void 0 ? ($ = c._$Co) == null ? void 0 : $[l] : c._$Cl; + const x = ys(a) ? void 0 : a._$litDirective$; + return (o == null ? void 0 : o.constructor) !== x && ((B = o == null ? void 0 : o._$AO) == null || B.call(o, !1), x === void 0 ? o = void 0 : (o = new x(S), o._$AT(S, c, l)), l !== void 0 ? (c._$Co ?? (c._$Co = []))[l] = o : c._$Cl = o), o !== void 0 && (a = Se(S, o._$AS(S, a.values), o, l)), a; } -class Of { +class qf { constructor(a, c) { this._$AV = [], this._$AN = void 0, this._$AD = a, this._$AM = c; } @@ -358,30 +358,30 @@ class Of { return this._$AM._$AU; } u(a) { - const { el: { content: c }, parts: l } = this._$AD, o = ((a == null ? void 0 : a.creationScope) ?? Io).importNode(c, !0); - Wo.currentNode = o; - let w = Wo.nextNode(), v = 0, P = 0, k = l[0]; + const { el: { content: c }, parts: l } = this._$AD, o = ((a == null ? void 0 : a.creationScope) ?? Go).importNode(c, !0); + Vo.currentNode = o; + let x = Vo.nextNode(), $ = 0, B = 0, k = l[0]; for (; k !== void 0; ) { - if (v === k.index) { - let W; - k.type === 2 ? W = new ps(w, w.nextSibling, this, a) : k.type === 1 ? W = new k.ctor(w, k.name, k.strings, this, a) : k.type === 6 && (W = new Gf(w, this, a)), this._$AV.push(W), k = l[++P]; + if ($ === k.index) { + let O; + k.type === 2 ? O = new vs(x, x.nextSibling, this, a) : k.type === 1 ? O = new k.ctor(x, k.name, k.strings, this, a) : k.type === 6 && (O = new Kf(x, this, a)), this._$AV.push(O), k = l[++B]; } - v !== (k == null ? void 0 : k.index) && (w = Wo.nextNode(), v++); + $ !== (k == null ? void 0 : k.index) && (x = Vo.nextNode(), $++); } - return Wo.currentNode = Io, o; + return Vo.currentNode = Go, o; } p(a) { let c = 0; for (const l of this._$AV) l !== void 0 && (l.strings !== void 0 ? (l._$AI(a, l, c), c += l.strings.length - 2) : l._$AI(a[c])), c++; } } -class ps { +class vs { get _$AU() { var a; return ((a = this._$AM) == null ? void 0 : a._$AU) ?? this._$Cv; } constructor(a, c, l, o) { - this.type = 2, this._$AH = at, this._$AN = void 0, this._$AA = a, this._$AB = c, this._$AM = l, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0; + this.type = 2, this._$AH = st, this._$AN = void 0, this._$AA = a, this._$AB = c, this._$AM = l, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0; } get parentNode() { let a = this._$AA.parentNode; @@ -395,7 +395,7 @@ class ps { return this._$AB; } _$AI(a, c = this) { - a = ge(this, a, c), fs(a) ? a === at || a == null || a === "" ? (this._$AH !== at && this._$AR(), this._$AH = at) : a !== this._$AH && a !== Vo && this._(a) : a._$litType$ !== void 0 ? this.$(a) : a.nodeType !== void 0 ? this.T(a) : zf(a) ? this.k(a) : this._(a); + a = Se(this, a, c), ys(a) ? a === st || a == null || a === "" ? (this._$AH !== st && this._$AR(), this._$AH = st) : a !== this._$AH && a !== Uo && this._(a) : a._$litType$ !== void 0 ? this.$(a) : a.nodeType !== void 0 ? this.T(a) : Gf(a) ? this.k(a) : this._(a); } O(a) { return this._$AA.parentNode.insertBefore(a, this._$AB); @@ -404,33 +404,33 @@ class ps { this._$AH !== a && (this._$AR(), this._$AH = this.O(a)); } _(a) { - this._$AH !== at && fs(this._$AH) ? this._$AA.nextSibling.data = a : this.T(Io.createTextNode(a)), this._$AH = a; + this._$AH !== st && ys(this._$AH) ? this._$AA.nextSibling.data = a : this.T(Go.createTextNode(a)), this._$AH = a; } $(a) { - var w; - const { values: c, _$litType$: l } = a, o = typeof l == "number" ? this._$AC(a) : (l.el === void 0 && (l.el = ds.createElement(vc(l.h, l.h[0]), this.options)), l); - if (((w = this._$AH) == null ? void 0 : w._$AD) === o) this._$AH.p(c); + var x; + const { values: c, _$litType$: l } = a, o = typeof l == "number" ? this._$AC(a) : (l.el === void 0 && (l.el = $s.createElement(Bc(l.h, l.h[0]), this.options)), l); + if (((x = this._$AH) == null ? void 0 : x._$AD) === o) this._$AH.p(c); else { - const v = new Of(o, this), P = v.u(this.options); - v.p(c), this.T(P), this._$AH = v; + const $ = new qf(o, this), B = $.u(this.options); + $.p(c), this.T(B), this._$AH = $; } } _$AC(a) { - let c = uc.get(a.strings); - return c === void 0 && uc.set(a.strings, c = new ds(a)), c; + let c = Rc.get(a.strings); + return c === void 0 && Rc.set(a.strings, c = new $s(a)), c; } k(a) { - Un(this._$AH) || (this._$AH = [], this._$AR()); + ni(this._$AH) || (this._$AH = [], this._$AR()); const c = this._$AH; let l, o = 0; - for (const w of a) o === c.length ? c.push(l = new ps(this.O(us()), this.O(us()), this, this.options)) : l = c[o], l._$AI(w), o++; + for (const x of a) o === c.length ? c.push(l = new vs(this.O(_s()), this.O(_s()), this, this.options)) : l = c[o], l._$AI(x), o++; o < c.length && (this._$AR(l && l._$AB.nextSibling, o), c.length = o); } _$AR(a = this._$AA.nextSibling, c) { var l; for ((l = this._$AP) == null ? void 0 : l.call(this, !1, !0, c); a !== this._$AB; ) { - const o = nc(a).nextSibling; - nc(a).remove(), a = o; + const o = yc(a).nextSibling; + yc(a).remove(), a = o; } } setConnected(a) { @@ -438,62 +438,62 @@ class ps { this._$AM === void 0 && (this._$Cv = a, (c = this._$AP) == null || c.call(this, a)); } } -class Sa { +class La { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } - constructor(a, c, l, o, w) { - this.type = 1, this._$AH = at, this._$AN = void 0, this.element = a, this.name = c, this._$AM = o, this.options = w, l.length > 2 || l[0] !== "" || l[1] !== "" ? (this._$AH = Array(l.length - 1).fill(new String()), this.strings = l) : this._$AH = at; + constructor(a, c, l, o, x) { + this.type = 1, this._$AH = st, this._$AN = void 0, this.element = a, this.name = c, this._$AM = o, this.options = x, l.length > 2 || l[0] !== "" || l[1] !== "" ? (this._$AH = Array(l.length - 1).fill(new String()), this.strings = l) : this._$AH = st; } _$AI(a, c = this, l, o) { - const w = this.strings; - let v = !1; - if (w === void 0) a = ge(this, a, c, 0), v = !fs(a) || a !== this._$AH && a !== Vo, v && (this._$AH = a); + const x = this.strings; + let $ = !1; + if (x === void 0) a = Se(this, a, c, 0), $ = !ys(a) || a !== this._$AH && a !== Uo, $ && (this._$AH = a); else { - const P = a; - let k, W; - for (a = w[0], k = 0; k < w.length - 1; k++) W = ge(this, P[l + k], c, k), W === Vo && (W = this._$AH[k]), v || (v = !fs(W) || W !== this._$AH[k]), W === at ? a = at : a !== at && (a += (W ?? "") + w[k + 1]), this._$AH[k] = W; + const B = a; + let k, O; + for (a = x[0], k = 0; k < x.length - 1; k++) O = Se(this, B[l + k], c, k), O === Uo && (O = this._$AH[k]), $ || ($ = !ys(O) || O !== this._$AH[k]), O === st ? a = st : a !== st && (a += (O ?? "") + x[k + 1]), this._$AH[k] = O; } - v && !o && this.j(a); + $ && !o && this.j(a); } j(a) { - a === at ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, a ?? ""); + a === st ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, a ?? ""); } } -class If extends Sa { +class Yf extends La { constructor() { super(...arguments), this.type = 3; } j(a) { - this.element[this.name] = a === at ? void 0 : a; + this.element[this.name] = a === st ? void 0 : a; } } -class Vf extends Sa { +class Xf extends La { constructor() { super(...arguments), this.type = 4; } j(a) { - this.element.toggleAttribute(this.name, !!a && a !== at); + this.element.toggleAttribute(this.name, !!a && a !== st); } } -class Hf extends Sa { - constructor(a, c, l, o, w) { - super(a, c, l, o, w), this.type = 5; +class Zf extends La { + constructor(a, c, l, o, x) { + super(a, c, l, o, x), this.type = 5; } _$AI(a, c = this) { - if ((a = ge(this, a, c, 0) ?? at) === Vo) return; - const l = this._$AH, o = a === at && l !== at || a.capture !== l.capture || a.once !== l.once || a.passive !== l.passive, w = a !== at && (l === at || o); - o && this.element.removeEventListener(this.name, this, l), w && this.element.addEventListener(this.name, this, a), this._$AH = a; + if ((a = Se(this, a, c, 0) ?? st) === Uo) return; + const l = this._$AH, o = a === st && l !== st || a.capture !== l.capture || a.once !== l.once || a.passive !== l.passive, x = a !== st && (l === st || o); + o && this.element.removeEventListener(this.name, this, l), x && this.element.addEventListener(this.name, this, a), this._$AH = a; } handleEvent(a) { var c; typeof this._$AH == "function" ? this._$AH.call(((c = this.options) == null ? void 0 : c.host) ?? this.element, a) : this._$AH.handleEvent(a); } } -class Gf { +class Kf { constructor(a, c, l) { this.element = a, this.type = 6, this._$AN = void 0, this._$AM = c, this.options = l; } @@ -501,17 +501,17 @@ class Gf { return this._$AM._$AU; } _$AI(a) { - ge(this, a); + Se(this, a); } } -const zn = hs.litHtmlPolyfillSupport; -zn == null || zn(ds, ps), (hs.litHtmlVersions ?? (hs.litHtmlVersions = [])).push("3.3.2"); -const Uf = (S, a, c) => { +const Kn = gs.litHtmlPolyfillSupport; +Kn == null || Kn($s, vs), (gs.litHtmlVersions ?? (gs.litHtmlVersions = [])).push("3.3.2"); +const Jf = (S, a, c) => { const l = (c == null ? void 0 : c.renderBefore) ?? a; let o = l._$litPart$; if (o === void 0) { - const w = (c == null ? void 0 : c.renderBefore) ?? null; - l._$litPart$ = o = new ps(a.insertBefore(us(), w), w, void 0, c ?? {}); + const x = (c == null ? void 0 : c.renderBefore) ?? null; + l._$litPart$ = o = new vs(a.insertBefore(_s(), x), x, void 0, c ?? {}); } return o._$AI(S), o; }; @@ -520,8 +520,8 @@ const Uf = (S, a, c) => { * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const Oo = globalThis; -let be = class extends me { +const Ho = globalThis; +let ve = class extends $e { constructor() { super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; } @@ -532,7 +532,7 @@ let be = class extends me { } update(a) { const c = this.render(); - this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(a), this._$Do = Uf(c, this.renderRoot, this.renderOptions); + this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(a), this._$Do = Jf(c, this.renderRoot, this.renderOptions); } connectedCallback() { var a; @@ -543,21 +543,21 @@ let be = class extends me { super.disconnectedCallback(), (a = this._$Do) == null || a.setConnected(!1); } render() { - return Vo; + return Uo; } }; -var pc; -be._$litElement$ = !0, be.finalized = !0, (pc = Oo.litElementHydrateSupport) == null || pc.call(Oo, { LitElement: be }); -const Ln = Oo.litElementPolyfillSupport; -Ln == null || Ln({ LitElement: be }); -(Oo.litElementVersions ?? (Oo.litElementVersions = [])).push("4.2.2"); +var kc; +ve._$litElement$ = !0, ve.finalized = !0, (kc = Ho.litElementHydrateSupport) == null || kc.call(Ho, { LitElement: ve }); +const Jn = Ho.litElementPolyfillSupport; +Jn == null || Jn({ LitElement: ve }); +(Ho.litElementVersions ?? (Ho.litElementVersions = [])).push("4.2.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const jf = { CHILD: 2 }, qf = (S) => (...a) => ({ _$litDirective$: S, values: a }); -class Yf { +const Qf = { CHILD: 2 }, td = (S) => (...a) => ({ _$litDirective$: S, values: a }); +class od { constructor(a) { } get _$AU() { @@ -578,13 +578,13 @@ class Yf { * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -class On extends Yf { +class ti extends od { constructor(a) { - if (super(a), this.it = at, a.type !== jf.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings"); + if (super(a), this.it = st, a.type !== Qf.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings"); } render(a) { - if (a === at || a == null) return this._t = void 0, this.it = a; - if (a === Vo) return a; + if (a === st || a == null) return this._t = void 0, this.it = a; + if (a === Uo) return a; if (typeof a != "string") throw Error(this.constructor.directiveName + "() called with a non-string value"); if (a === this.it) return this._t; this.it = a; @@ -592,8 +592,8 @@ class On extends Yf { return c.raw = c, this._t = { _$litType$: this.constructor.resultType, strings: c, values: [] }; } } -On.directiveName = "unsafeHTML", On.resultType = 1; -const Xf = qf(On), jn = class jn extends be { +ti.directiveName = "unsafeHTML", ti.resultType = 1; +const ed = td(ti), ii = class ii extends ve { constructor() { super(...arguments), this._config = {}; } @@ -615,13 +615,13 @@ const Xf = qf(On), jn = class jn extends be { ); } _valueChanged(a) { - var w; + var x; const c = a.target, l = c == null ? void 0 : c.configValue; if (!l) return; - let o = ((w = a.detail) == null ? void 0 : w.value) ?? c.value; + let o = ((x = a.detail) == null ? void 0 : x.value) ?? c.value; if (c.checked !== void 0 && (o = c.checked), c.type === "number") { - const v = Number(o); - Number.isNaN(v) || (o = v); + const $ = Number(o); + Number.isNaN($) || (o = $); } this._setConfigValue(l, o); } @@ -635,44 +635,49 @@ const Xf = qf(On), jn = class jn extends be { this._hass && this._hass.callService("sunlight_visualizer", "set_options", a); } render() { - var mt, $o, zt, Ut, eo, bt, Lt, wt, xt, jt, _o, nt, $t, ht, Ft, _e, Uo, ms, bs, gs, ys, $s, ve, Se, wa, we, _s, jo, so, ao, qo, Wt, et, vs, Ss, vo, no, H, Yo, Xo, ws, xs, So, Rt, Rs, Ms, Cs, xe, Re, Me, Ce, Zo, ke, Ne, ks, Ns, Es, Ts, Fs, Ee, As, Ds, Te, Bs, Ps, Ko, zs, Ls, Fe, Ae, De, Be, Pe, wo, xo, ze, io, ro, Le, Ws, Os, Is, Vs; - if (!this._hass) return Lo``; + var Ft, Yt, vo, it, Ct, ht, So, _t, we, Zo, Ss, Re, Lt, xo, xs, ws, Rs, Ms, Me, Ce, Wa, ke, Cs, Ko, ao, no, Jo, mt, ot, ks, Ns, wo, io, H, Qo, te, Es, Fs, Ro, At, As, Ts, Ds, Ne, Ee, Fe, Ae, oe, Te, De, Bs, zs, Ps, Ls, Ws, Be, Os, Is, ze, Vs, Hs, ee, Gs, Us, Pe, Le, We, Oe, Ie, Mo, Co, Ve, ro, co, He, js, qs, Ys, Xs, Zs, Ks, Js, Qs, ta, oa, ea, Ge, Ue, se, sa, aa, na; + if (!this._hass) return Io``; const a = this._config || {}, c = a.siSourceAttr ?? "sunlight_visualizer_source", l = a.siSourceValue ?? "sunlight_visualizer", o = Object.entries(this._hass.states ?? {}).filter( - ([, N]) => { - var D; - return ((D = N == null ? void 0 : N.attributes) == null ? void 0 : D[c]) === l; + ([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F[c]) === l; } - ), w = (N) => { - for (const [D, X] of o) - if (N(X, D)) return D; + ), x = (w) => { + for (const [F, X] of o) + if (w(X, F)) return F; return null; - }, v = (N) => w((D) => { + }, $ = (w) => x((F) => { var X; - return ((X = D == null ? void 0 : D.attributes) == null ? void 0 : X.camera_rotation) === N; - }), P = (N) => w((D) => { + return ((X = F == null ? void 0 : F.attributes) == null ? void 0 : X.camera_rotation) === w; + }), B = (w) => x((F) => { var X; - return ((X = D == null ? void 0 : D.attributes) == null ? void 0 : X.si_setting) === N; - }), k = a.rotationHEntity ?? v("h") ?? "", W = a.rotationVEntity ?? v("v") ?? "", Y = a.houseAngleEntity ?? P("house_angle") ?? "", V = P("ceiling_tilt") ?? "", Q = P("house_direction") ?? "", q = P("roof_direction") ?? "", O = (N, D = !1) => { - if (N == null || N === "") return D; - if (typeof N == "boolean") return N; - if (typeof N == "number") return N !== 0; - if (typeof N == "string") { - const X = N.trim().toLowerCase(); + return ((X = F == null ? void 0 : F.attributes) == null ? void 0 : X.si_setting) === w; + }), k = a.rotationHEntity ?? $("h") ?? "", O = a.rotationVEntity ?? $("v") ?? "", Y = a.houseAngleEntity ?? B("house_angle") ?? "", L = B("ceiling_tilt") ?? "", tt = B("house_direction") ?? "", j = B("roof_direction") ?? "", z = (w, F = !1) => { + if (w == null || w === "") return F; + if (typeof w == "boolean") return w; + if (typeof w == "number") return w !== 0; + if (typeof w == "string") { + const X = w.trim().toLowerCase(); if (["true", "1", "yes", "on"].includes(X)) return !0; if (["false", "0", "no", "off"].includes(X)) return !1; } - return D; + return F; }; - let F = "", kt, Nt; - for (const [, N] of o) - !F && ((mt = N == null ? void 0 : N.attributes) != null && mt.roof_power_entity) && (F = N.attributes.roof_power_entity), kt === void 0 && (($o = N == null ? void 0 : N.attributes) == null ? void 0 : $o.roof_power_enabled) !== void 0 && (kt = N.attributes.roof_power_enabled), Nt === void 0 && ((zt = N == null ? void 0 : N.attributes) == null ? void 0 : zt.roof_power_invert) !== void 0 && (Nt = N.attributes.roof_power_invert); - const Bt = a.preferIntegrationSettings ?? !0, Pt = o.length > 0, Qt = Bt ? F || a.roofPowerEntity || "" : a.roofPowerEntity || F || "", J = Bt ? O(kt, O(a.roofPowerEnabled, !1)) : O(a.roofPowerEnabled, O(kt, !1)), tt = Bt ? O(Nt, O(a.roofPowerInvert, !1)) : O(a.roofPowerInvert, O(Nt, !1)), Et = Number((bt = (eo = (Ut = o.find(([, N]) => { - var D; - return ((D = N == null ? void 0 : N.attributes) == null ? void 0 : D.auto_rotate_speed) != null; - })) == null ? void 0 : Ut[1]) == null ? void 0 : eo.attributes) == null ? void 0 : bt.auto_rotate_speed), to = Bt && Number.isFinite(Et) ? Et : Number(a.autoRotateSpeed ?? (Number.isFinite(Et) ? Et : 25)); - Number(((xt = (wt = (Lt = this._hass) == null ? void 0 : Lt.states) == null ? void 0 : wt[Y]) == null ? void 0 : xt.state) ?? a.houseAngle ?? 0); - const Tt = ["North", "NE", "East", "SE", "South", "SW", "West", "NW", "Custom"], ot = ["front", "back", "left", "right"], oo = !!Q, bo = !!q, ye = oo ? (($t = (nt = (_o = (jt = this._hass) == null ? void 0 : jt.states) == null ? void 0 : _o[Q]) == null ? void 0 : nt.attributes) == null ? void 0 : $t.options) ?? Tt : Tt, Ho = bo ? ((Uo = (_e = (Ft = (ht = this._hass) == null ? void 0 : ht.states) == null ? void 0 : Ft[q]) == null ? void 0 : _e.attributes) == null ? void 0 : Uo.options) ?? ot : ot, go = oo ? ((gs = (bs = (ms = this._hass) == null ? void 0 : ms.states) == null ? void 0 : bs[Q]) == null ? void 0 : gs.state) ?? "Custom" : a.houseDirection ?? "Custom", Go = bo ? ((ve = ($s = (ys = this._hass) == null ? void 0 : ys.states) == null ? void 0 : $s[q]) == null ? void 0 : ve.state) ?? "front" : a.roofTiltFace ?? "front", $e = !!k, rt = !!W, yo = !!V; - return Lo` + let E = "", $t, vt, wt, Rt; + for (const [, w] of o) + !E && ((Ft = w == null ? void 0 : w.attributes) != null && Ft.roof_power_entity) && (E = w.attributes.roof_power_entity), $t === void 0 && ((Yt = w == null ? void 0 : w.attributes) == null ? void 0 : Yt.roof_power_enabled) !== void 0 && ($t = w.attributes.roof_power_enabled), vt === void 0 && ((vo = w == null ? void 0 : w.attributes) == null ? void 0 : vo.roof_power_invert) !== void 0 && (vt = w.attributes.roof_power_invert), wt === void 0 && ((it = w == null ? void 0 : w.attributes) == null ? void 0 : it.fixed_sun_rotation_enabled) !== void 0 && (wt = w.attributes.fixed_sun_rotation_enabled), Rt === void 0 && ((Ct = w == null ? void 0 : w.attributes) == null ? void 0 : Ct.fixed_sun_azimuth) !== void 0 && (Rt = w.attributes.fixed_sun_azimuth); + const ft = a.preferIntegrationSettings ?? !0, Z = o.length > 0, Q = ft ? E || a.roofPowerEntity || "" : a.roofPowerEntity || E || "", Bt = ft ? z($t, z(a.roofPowerEnabled, !1)) : z(a.roofPowerEnabled, z($t, !1)), zt = ft ? z(vt, z(a.roofPowerInvert, !1)) : z(a.roofPowerInvert, z(vt, !1)), dt = Number((_t = (So = (ht = o.find(([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F.auto_rotate_speed) != null; + })) == null ? void 0 : ht[1]) == null ? void 0 : So.attributes) == null ? void 0 : _t.auto_rotate_speed), at = ft && Number.isFinite(dt) ? dt : Number(a.autoRotateSpeed ?? (Number.isFinite(dt) ? dt : 25)); + Number(((Ss = (Zo = (we = this._hass) == null ? void 0 : we.states) == null ? void 0 : Zo[Y]) == null ? void 0 : Ss.state) ?? a.houseAngle ?? 0); + const go = ["North", "NE", "East", "SE", "South", "SW", "West", "NW", "Custom"], jo = ["front", "back", "left", "right"], _o = !!tt, eo = !!j, qo = _o ? ((xs = (xo = (Lt = (Re = this._hass) == null ? void 0 : Re.states) == null ? void 0 : Lt[tt]) == null ? void 0 : xo.attributes) == null ? void 0 : xs.options) ?? go : go, xe = eo ? ((Me = (Ms = (Rs = (ws = this._hass) == null ? void 0 : ws.states) == null ? void 0 : Rs[j]) == null ? void 0 : Ms.attributes) == null ? void 0 : Me.options) ?? jo : jo, Yo = _o ? ((ke = (Wa = (Ce = this._hass) == null ? void 0 : Ce.states) == null ? void 0 : Wa[tt]) == null ? void 0 : ke.state) ?? "Custom" : a.houseDirection ?? "Custom", nt = eo ? ((ao = (Ko = (Cs = this._hass) == null ? void 0 : Cs.states) == null ? void 0 : Ko[j]) == null ? void 0 : ao.state) ?? "front" : a.roofTiltFace ?? "front", yo = !!k, Mt = !!O, Xo = !!L, It = Number(ft ? Rt ?? a.fixedSunAzimuthDeg ?? 225 : a.fixedSunAzimuthDeg ?? Rt ?? 225), so = Math.min(359, Math.max(0, Number.isFinite(It) ? It : 225)), $o = ft ? z(wt, z(a.fixedSunRotationEnabled, !1)) : z(a.fixedSunRotationEnabled, z(wt, !1)), pt = Number( + (mt = (Jo = (no = o.find(([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F.sun_azimuth) != null; + })) == null ? void 0 : no[1]) == null ? void 0 : Jo.attributes) == null ? void 0 : mt.sun_azimuth + ), Vt = Number((wo = (Ns = (ks = (ot = this._hass) == null ? void 0 : ot.states) == null ? void 0 : ks["sun.sun"]) == null ? void 0 : Ns.attributes) == null ? void 0 : wo.azimuth), Pt = Number.isFinite(pt) ? pt : Number.isFinite(Vt) ? Vt : so; + return Io`
Size
@@ -691,6 +696,17 @@ const Xf = qf(On), jn = class jn extends be { @change=${this._valueChanged} >
+
+
+ Auto-scale Width + +
+
Auto-shrink by available width on small screens (minimum 250px). Never grows above configured width.
+
@@ -699,13 +715,13 @@ const Xf = qf(On), jn = class jn extends be {
House angle
{ - var D; - return this._setNumberEntityValue(Y, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Qo = (H = (io = this._hass) == null ? void 0 : io.states) == null ? void 0 : H[Y]) == null ? void 0 : Qo.state) ?? 0)} + .min=${Number(((Ro = (Fs = (Es = (te = this._hass) == null ? void 0 : te.states) == null ? void 0 : Es[Y]) == null ? void 0 : Fs.attributes) == null ? void 0 : Ro.min) ?? 0)} + .max=${Number(((Ds = (Ts = (As = (At = this._hass) == null ? void 0 : At.states) == null ? void 0 : As[Y]) == null ? void 0 : Ts.attributes) == null ? void 0 : Ds.max) ?? 359)} + .step=${Number(((Ae = (Fe = (Ee = (Ne = this._hass) == null ? void 0 : Ne.states) == null ? void 0 : Ee[Y]) == null ? void 0 : Fe.attributes) == null ? void 0 : Ae.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(Y, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} .disabled=${!Y} > @@ -714,12 +730,12 @@ const Xf = qf(On), jn = class jn extends be { { + .selector=${{ select: { options: qo, mode: "dropdown" } }} + .value=${Yo} + @value-changed=${(w) => { var X; - const D = ((X = N.detail) == null ? void 0 : X.value) ?? go; - oo ? (this._setSelectEntityOption(Q, D), this._setConfigValue("houseDirection", void 0)) : this._setConfigValue("houseDirection", D); + const F = ((X = w.detail) == null ? void 0 : X.value) ?? Yo; + _o ? (this._setSelectEntityOption(tt, F), this._setConfigValue("houseDirection", void 0)) : this._setConfigValue("houseDirection", F); }} >
Select compass direction your front door is facing.
@@ -729,27 +745,27 @@ const Xf = qf(On), jn = class jn extends be {
Ceiling tilt
{ - var D; - return this._setNumberEntityValue(V, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((De = (Te = (oe = this._hass) == null ? void 0 : oe.states) == null ? void 0 : Te[L]) == null ? void 0 : De.state) ?? 0)} + .min=${Number(((Ls = (Ps = (zs = (Bs = this._hass) == null ? void 0 : Bs.states) == null ? void 0 : zs[L]) == null ? void 0 : Ps.attributes) == null ? void 0 : Ls.min) ?? 0)} + .max=${Number(((Is = (Os = (Be = (Ws = this._hass) == null ? void 0 : Ws.states) == null ? void 0 : Be[L]) == null ? void 0 : Os.attributes) == null ? void 0 : Is.max) ?? 90)} + .step=${Number(((ee = (Hs = (Vs = (ze = this._hass) == null ? void 0 : ze.states) == null ? void 0 : Vs[L]) == null ? void 0 : Hs.attributes) == null ? void 0 : ee.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(L, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!yo} + .disabled=${!Xo} >
{ + .selector=${{ select: { options: xe, mode: "dropdown" } }} + .value=${nt} + @value-changed=${(w) => { var X; - const D = ((X = N.detail) == null ? void 0 : X.value) ?? Go; - bo ? (this._setSelectEntityOption(q, D), this._setConfigValue("roofTiltFace", void 0)) : this._setConfigValue("roofTiltFace", D); + const F = ((X = w.detail) == null ? void 0 : X.value) ?? nt; + eo ? (this._setSelectEntityOption(j, F), this._setConfigValue("roofTiltFace", void 0)) : this._setConfigValue("roofTiltFace", F); }} >
Which side the roof slopes down toward
@@ -763,35 +779,55 @@ const Xf = qf(On), jn = class jn extends be {
Camera rotation H
{ - var D; - return this._setNumberEntityValue(k, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Pe = (Us = (Gs = this._hass) == null ? void 0 : Gs.states) == null ? void 0 : Us[k]) == null ? void 0 : Pe.state) ?? 0)} + .min=${Number(((Ie = (Oe = (We = (Le = this._hass) == null ? void 0 : Le.states) == null ? void 0 : We[k]) == null ? void 0 : Oe.attributes) == null ? void 0 : Ie.min) ?? 0)} + .max=${Number(((ro = (Ve = (Co = (Mo = this._hass) == null ? void 0 : Mo.states) == null ? void 0 : Co[k]) == null ? void 0 : Ve.attributes) == null ? void 0 : ro.max) ?? 359)} + .step=${Number(((qs = (js = (He = (co = this._hass) == null ? void 0 : co.states) == null ? void 0 : He[k]) == null ? void 0 : js.attributes) == null ? void 0 : qs.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(k, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!$e} + .disabled=${!yo} >
Camera rotation V
{ - var D; - return this._setNumberEntityValue(W, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Zs = (Xs = (Ys = this._hass) == null ? void 0 : Ys.states) == null ? void 0 : Xs[O]) == null ? void 0 : Zs.state) ?? 0)} + .min=${Number(((ta = (Qs = (Js = (Ks = this._hass) == null ? void 0 : Ks.states) == null ? void 0 : Js[O]) == null ? void 0 : Qs.attributes) == null ? void 0 : ta.min) ?? 0)} + .max=${Number(((Ue = (Ge = (ea = (oa = this._hass) == null ? void 0 : oa.states) == null ? void 0 : ea[O]) == null ? void 0 : Ge.attributes) == null ? void 0 : Ue.max) ?? 90)} + .step=${Number(((na = (aa = (sa = (se = this._hass) == null ? void 0 : se.states) == null ? void 0 : sa[O]) == null ? void 0 : aa.attributes) == null ? void 0 : na.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(O, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!rt} + .disabled=${!Mt} >
${k || "Camera rotation H not found"}
-
${W || "Camera rotation V not found"}
+
${O || "Camera rotation V not found"}
+
+
+ +
+
Fixed sun position, azimuth. (Rotate scene)
+
+
+ Fixed sun position, azimuth. (Rotate scene) + { + var Xt; + const F = !!((Xt = w.target) != null && Xt.checked); + if (Z ? (this._setIntegrationOptions({ fixed_sun_rotation_enabled: F }), this._setConfigValue("fixedSunRotationEnabled", void 0)) : this._setConfigValue("fixedSunRotationEnabled", F), !F) return; + const X = Math.min(359, Math.max(0, Math.round(Pt))); + Z ? (this._setIntegrationOptions({ fixed_sun_azimuth: X }), this._setConfigValue("fixedSunAzimuthDeg", void 0)) : this._setConfigValue("fixedSunAzimuthDeg", X); + }} + > +
+
Keep sun azimuth visually fixed and rotate the scene instead
@@ -801,11 +837,11 @@ const Xf = qf(On), jn = class jn extends be { { + .value=${Q} + @value-changed=${(w) => { var X; - const D = (X = N.detail) == null ? void 0 : X.value; - Pt ? (this._setIntegrationOptions({ roof_power_entity: D || null }), this._setConfigValue("roofPowerEntity", void 0)) : this._setConfigValue("roofPowerEntity", D); + const F = (X = w.detail) == null ? void 0 : X.value; + Z ? (this._setIntegrationOptions({ roof_power_entity: F || null }), this._setConfigValue("roofPowerEntity", void 0)) : this._setConfigValue("roofPowerEntity", F); }} >
@@ -813,22 +849,22 @@ const Xf = qf(On), jn = class jn extends be {
Enable power label { + .checked=${Bt ?? !1} + @change=${(w) => { var X; - const D = !!((X = N.target) != null && X.checked); - Pt ? (this._setIntegrationOptions({ roof_power_enabled: D }), this._setConfigValue("roofPowerEnabled", void 0)) : this._setConfigValue("roofPowerEnabled", D); + const F = !!((X = w.target) != null && X.checked); + Z ? (this._setIntegrationOptions({ roof_power_enabled: F }), this._setConfigValue("roofPowerEnabled", void 0)) : this._setConfigValue("roofPowerEnabled", F); }} >
Invert power value { + .checked=${zt ?? !1} + @change=${(w) => { var X; - const D = !!((X = N.target) != null && X.checked); - Pt ? (this._setIntegrationOptions({ roof_power_invert: D }), this._setConfigValue("roofPowerInvert", void 0)) : this._setConfigValue("roofPowerInvert", D); + const F = !!((X = w.target) != null && X.checked); + Z ? (this._setIntegrationOptions({ roof_power_invert: F }), this._setConfigValue("roofPowerInvert", void 0)) : this._setConfigValue("roofPowerInvert", F); }} >
@@ -841,35 +877,24 @@ const Xf = qf(On), jn = class jn extends be { { - var Hs, Gs; - const D = ((Hs = N == null ? void 0 : N.detail) == null ? void 0 : Hs.value) ?? ((Gs = N == null ? void 0 : N.target) == null ? void 0 : Gs.value); - let X = Math.round(Number(D)); - Number.isNaN(X) || (X = Math.min(90, Math.max(1, X)), Pt ? (this._setIntegrationOptions({ auto_rotate_speed: X }), this._setConfigValue("autoRotateSpeed", void 0)) : this._setConfigValue("autoRotateSpeed", X)); + @change=${(w) => { + var Xt, ia; + const F = ((Xt = w == null ? void 0 : w.detail) == null ? void 0 : Xt.value) ?? ((ia = w == null ? void 0 : w.target) == null ? void 0 : ia.value); + let X = Math.round(Number(F)); + Number.isNaN(X) || (X = Math.min(90, Math.max(1, X)), Z ? (this._setIntegrationOptions({ auto_rotate_speed: X }), this._setConfigValue("autoRotateSpeed", void 0)) : this._setConfigValue("autoRotateSpeed", X)); }} > -
-
- Auto-scale Width - -
-
Auto-shrink by available width on small screens (minimum 250px). Never grows above configured width.
-
`; } }; -jn.styles = bc` +ii.styles = Ec` :host { display: block; padding: 16px; @@ -918,14 +943,14 @@ jn.styles = bc` margin-top: 4px; } `; -let In = jn; -const fc = "sunlight-visualizer-card-editor"; -if (!customElements.get(fc)) +let oi = ii; +const Mc = "sunlight-visualizer-card-editor"; +if (!customElements.get(Mc)) try { - customElements.define(fc, In); + customElements.define(Mc, oi); } catch { } -const qn = class qn extends be { +const ri = class ri extends ve { constructor() { super(...arguments), this._config = {}, this._resizeObserver = null, this._hostWidth = 0; } @@ -938,7 +963,9 @@ const qn = class qn extends be { cardHeight: 450, autoScaleWidth: !0, autoRotateEnabledDefault: !1, - autoRotateSpeed: 25 + autoRotateSpeed: 25, + fixedSunRotationEnabled: !1, + fixedSunAzimuthDeg: 225 }; } setConfig(a) { @@ -964,7 +991,7 @@ const qn = class qn extends be { const c = Math.max(1, Number(a.cardWidth ?? 450)), l = Math.max(1, Number(a.cardHeight ?? 450)); if (!(a.autoScaleWidth ?? !0)) return { cardW: c, cardH: l }; - const w = 250, v = Number(this._hostWidth || this.clientWidth || 0), P = v > 0 ? v : c, k = Math.min(c, Math.max(w, Math.floor(P))), W = k / c, Y = Math.max(1, Math.round(l * W)); + const x = 250, $ = Number(this._hostWidth || this.clientWidth || 0), B = $ > 0 ? $ : c, k = Math.min(c, Math.max(x, Math.floor(B))), O = k / c, Y = Math.max(1, Math.round(l * O)); return { cardW: k, cardH: Y }; } _stopManualRotate() { @@ -972,25 +999,25 @@ const qn = class qn extends be { this._manualRotateTimer && (clearInterval(this._manualRotateTimer), this._manualRotateTimer = null), this._manualRotateEnabled = !1, this._manualRotateAxis = null, this._manualRotateDir = 0, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = 0, this._manualRotateLastTick = 0, this._manualRotateIntervalMs = 0, a && (this._cssRecalibrateRequested = !0), this.requestUpdate(); } _startManualRotate(a, c) { - const l = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), o = Number(this._autoRotateSpeed || 25), w = Number(this._rotationIntervalMsFloor || this._autoRotateIntervalMs || 50), v = Math.max(1, Number(this._autoRotateTurnCount || 1)); - this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._manualRotateEnabled = !0, this._manualRotateAxis = a, this._manualRotateDir = c, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = a === "h" ? 360 * v : 0, this._manualRotateLastTick = l(), this._manualRotateIntervalMs = w, this._manualRotateVOffsetDeg || (this._manualRotateVOffsetDeg = 0), this._manualRotateTimer = setInterval(() => { - const P = l(), k = this._manualRotateLastTick || P, W = Math.max(0, P - k) / 1e3; - if (this._manualRotateLastTick = P, !this._manualRotateEnabled) return; - const Y = this._manualRotateAxis === "v" ? 0.5 : 1, V = o * Y * W * (this._manualRotateDir || 1); + const l = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), o = Number(this._autoRotateSpeed || 25), x = Number(this._rotationIntervalMsFloor || this._autoRotateIntervalMs || 50), $ = Math.max(1, Number(this._autoRotateTurnCount || 1)); + this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._manualRotateEnabled = !0, this._manualRotateAxis = a, this._manualRotateDir = c, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = a === "h" ? 360 * $ : 0, this._manualRotateLastTick = l(), this._manualRotateIntervalMs = x, this._manualRotateVOffsetDeg || (this._manualRotateVOffsetDeg = 0), this._manualRotateTimer = setInterval(() => { + const B = l(), k = this._manualRotateLastTick || B, O = Math.max(0, B - k) / 1e3; + if (this._manualRotateLastTick = B, !this._manualRotateEnabled) return; + const Y = this._manualRotateAxis === "v" ? 0.5 : 1, L = o * Y * O * (this._manualRotateDir || 1); if (this._manualRotateAxis === "h") { - if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + V, this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(V), this._manualRotateAccumDeg >= (this._manualRotateTargetDeg || 360)) { + if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + L, this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(L), this._manualRotateAccumDeg >= (this._manualRotateTargetDeg || 360)) { this._stopManualRotate(); return; } } else if (this._manualRotateAxis === "v") { - const Q = Number(this._manualRotateBaseVDeg ?? 35), q = Number(this._manualRotateVOffsetDeg || 0), O = Math.min(90, Math.max(0, Q + q)), F = Math.min(90, Math.max(0, O + V)); - if (this._manualRotateVOffsetDeg = q + (F - O), this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(F - O), F <= 1e-3 || F >= 89.999) { + const tt = Number(this._manualRotateBaseVDeg ?? 35), j = Number(this._manualRotateVOffsetDeg || 0), z = Math.min(90, Math.max(0, tt + j)), E = Math.min(90, Math.max(0, z + L)); + if (this._manualRotateVOffsetDeg = j + (E - z), this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(E - z), E <= 1e-3 || E >= 89.999) { this._stopManualRotate(); return; } } this._updateTimerMS = Date.now(), this.requestUpdate(); - }, w), this.requestUpdate(); + }, x), this.requestUpdate(); } _handleControlTap(a, c, l) { if (l.preventDefault(), l.stopPropagation(), a === "h" ? !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h") : !!(this._manualRotateEnabled && this._manualRotateAxis === "v")) { @@ -1017,64 +1044,89 @@ const qn = class qn extends be { } catch { } } + async _setIntegrationOptions(a) { + var c; + if (!((c = this._hass) != null && c.callService)) return !1; + try { + return await this._hass.callService("sunlight_visualizer", "set_options", a), !0; + } catch { + return !1; + } + } async _saveCurrentCamera(a) { + var $t, vt, wt, Rt, ft; a.preventDefault(), a.stopPropagation(), this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(); - const c = Number(this._currentCameraH ?? 0), l = Number(this._currentCameraV ?? 35), o = this._rotationHEntity, w = this._rotationVEntity; - this._cameraSavedBaseHOverride = this._normDeg(c), this._cameraSavedBaseVOverride = Math.max(0, Math.min(90, l)), this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, await this._setNumericEntityValue(o, this._normDeg(c)), await this._setNumericEntityValue(w, Math.max(0, Math.min(90, l))), this.requestUpdate(); + const c = Number(this._currentCameraH ?? 0), l = Number(this._currentCameraV ?? 35), o = this._rotationHEntity, x = this._rotationVEntity, $ = !!this._fixedSunRotationEnabled, B = this._fixedSunAzimuthEntity, k = Number(this._currentSunAzimuthReal), O = Number(this._fixedSunSceneCompDeg ?? 0), Y = $ ? this._normDeg(c + O) : this._normDeg(c), L = Math.max(0, Math.min(90, l)); + this._cameraSavedBaseHOverride = Y, this._cameraSavedBaseVOverride = L, this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, $ && Number.isFinite(k) && (this._fixedSunAzimuthOverride = this._normDeg(k)); + const tt = (($t = this._config) == null ? void 0 : $t.siSourceAttr) ?? "sunlight_visualizer_source", j = ((vt = this._config) == null ? void 0 : vt.siSourceValue) ?? "sunlight_visualizer", z = (Z) => { + var Q, Bt, zt, dt; + return Z ? ((dt = (zt = (Bt = (Q = this._hass) == null ? void 0 : Q.states) == null ? void 0 : Bt[Z]) == null ? void 0 : zt.attributes) == null ? void 0 : dt[tt]) === j : !1; + }; + if (!!((ft = (Rt = (wt = this._hass) == null ? void 0 : wt.services) == null ? void 0 : Rt.sunlight_visualizer) != null && ft.set_options) && z(o) && z(x)) { + const Z = { + camera_rotation_h: Math.round(this._normDeg(Y)), + camera_rotation_v: Math.round(L) + }; + if ($ && Number.isFinite(k) && (Z.fixed_sun_azimuth = Math.round(this._normDeg(k))), await this._setIntegrationOptions(Z)) { + this.requestUpdate(); + return; + } + } + await this._setNumericEntityValue(o, Y), await this._setNumericEntityValue(x, L), $ && B && Number.isFinite(k) && await this._setNumericEntityValue(B, this._normDeg(k)), this.requestUpdate(); } _restoreSavedCamera(a) { a.preventDefault(), a.stopPropagation(), this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, this.requestUpdate(); } render() { if (!this._hass) - return Lo``; - const a = this._config || {}, { cardW: c, cardH: l } = this._getEffectiveCardSize(a), o = Math.min(c, l), w = this.renderSvg(c, l), v = !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h"), P = !!(this._manualRotateEnabled && this._manualRotateAxis === "v"), k = this._normDeg(Number(this._currentCameraH ?? 0)), W = Math.max(0, Math.min(90, Number(this._currentCameraV ?? 35))), Y = this._normDeg(Number(this._savedCameraH ?? k)), V = Math.max(0, Math.min(90, Number(this._savedCameraV ?? W))), Q = this._degDiffAbs(k, Y) > 0.25 || Math.abs(W - V) > 0.25, q = o < 400, O = 43, F = 10, kt = 10, Nt = (rt, yo, mt) => Math.max(yo, Math.min(mt, rt)); - let Bt = !0, Pt = !0, Qt, J, tt, Et, to, Tt; - if (q) { - const mt = F + O + 8 + O + 4, $o = c - (o < 260 ? 4 : 10), zt = Math.max(0, $o - mt), Ut = o < 260 ? 2 : 8, eo = 18; - if (Bt = o >= 300 && zt >= O * 3 + Ut * 2, Bt) { - const nt = Nt((zt - O * 3) / 2, Ut, eo), $t = O * 3 + nt * 2, ht = mt + Math.max(0, (zt - $t) / 2); - Qt = ht, tt = ht + O + nt, J = tt + O + nt; + return Io``; + const a = this._config || {}, { cardW: c, cardH: l } = this._getEffectiveCardSize(a), o = Math.min(c, l), x = this.renderSvg(c, l), $ = !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h"), B = !!(this._manualRotateEnabled && this._manualRotateAxis === "v"), k = this._normDeg(Number(this._currentCameraH ?? 0)), O = Math.max(0, Math.min(90, Number(this._currentCameraV ?? 35))), Y = this._normDeg(Number(this._savedCameraH ?? k)), L = Math.max(0, Math.min(90, Number(this._savedCameraV ?? O))), tt = this._degDiffAbs(k, Y) > 0.25 || Math.abs(O - L) > 0.25, j = o < 400, z = 43, E = 10, $t = 10, vt = (nt, yo, Mt) => Math.max(yo, Math.min(Mt, nt)); + let wt = !0, Rt = !0, ft, Z, Q, Bt, zt, dt; + if (j) { + const Mt = E + z + 8 + z + 4, Xo = c - (o < 260 ? 4 : 10), It = Math.max(0, Xo - Mt), so = o < 260 ? 2 : 8, $o = 18; + if (wt = o >= 300 && It >= z * 3 + so * 2, wt) { + const it = vt((It - z * 3) / 2, so, $o), Ct = z * 3 + it * 2, ht = Mt + Math.max(0, (It - Ct) / 2); + ft = ht, Q = ht + z + it, Z = Q + z + it; } else { - const nt = Nt(zt - O * 2, Ut, eo), $t = O * 2 + nt, ht = mt + Math.max(0, (zt - $t) / 2); - Qt = ht, J = ht + O + nt; + const it = vt(It - z * 2, so, $o), Ct = z * 2 + it, ht = Mt + Math.max(0, (It - Ct) / 2); + ft = ht, Z = ht + z + it; } - const bt = l - kt - O, Lt = o < 260 ? 46 : 34, wt = bt - 8, xt = Math.max(0, wt - Lt), jt = o < 260 ? 2 : 6, _o = o < 260 ? 10 : 24; - if (Pt = o >= 300 && xt >= O * 3 + jt * 2, Pt) { - const nt = Nt((xt - O * 3) / 2, jt, _o), $t = O * 3 + nt * 2, ht = Lt + Math.max(0, (xt - $t) / 2); - Et = ht, Tt = ht + O + nt, to = Tt + O + nt; + const pt = l - $t - z, Vt = o < 260 ? 46 : 34, Pt = pt - 8, Ft = Math.max(0, Pt - Vt), Yt = o < 260 ? 2 : 6, vo = o < 260 ? 10 : 24; + if (Rt = o >= 300 && Ft >= z * 3 + Yt * 2, Rt) { + const it = vt((Ft - z * 3) / 2, Yt, vo), Ct = z * 3 + it * 2, ht = Vt + Math.max(0, (Ft - Ct) / 2); + Bt = ht, dt = ht + z + it, zt = dt + z + it; } else { - const nt = Nt(xt - O * 2, jt, 16), $t = O * 2 + nt, ht = Lt + Math.max(0, (xt - $t) / 2); - Et = ht, to = ht + O + nt; + const it = vt(Ft - z * 2, Yt, 16), Ct = z * 2 + it, ht = Vt + Math.max(0, (Ft - Ct) / 2); + Bt = ht, zt = ht + z + it; } } - const ot = q && tt != null ? tt + O * 0.5 : void 0, oo = q && Tt != null ? Tt + O * 0.5 : void 0, bo = q && Qt != null ? `left:${Qt.toFixed(1)}px; bottom:${kt}px;` : "", ye = q && J != null ? `left:${J.toFixed(1)}px; bottom:${kt}px;` : "", Ho = q && ot != null ? `left:${ot.toFixed(1)}px; bottom:${kt}px;` : "", go = q && Et != null ? `left:${F}px; top:${Et.toFixed(1)}px;` : "", Go = q && to != null ? `left:${F}px; top:${to.toFixed(1)}px;` : "", $e = q && oo != null ? `left:${F}px; top:${oo.toFixed(1)}px;` : ""; - return Lo`
+ const at = j && Q != null ? Q + z * 0.5 : void 0, go = j && dt != null ? dt + z * 0.5 : void 0, jo = j && ft != null ? `left:${ft.toFixed(1)}px; bottom:${$t}px;` : "", _o = j && Z != null ? `left:${Z.toFixed(1)}px; bottom:${$t}px;` : "", eo = j && at != null ? `left:${at.toFixed(1)}px; bottom:${$t}px;` : "", qo = j && Bt != null ? `left:${E}px; top:${Bt.toFixed(1)}px;` : "", xe = j && zt != null ? `left:${E}px; top:${zt.toFixed(1)}px;` : "", Yo = j && go != null ? `left:${E}px; top:${go.toFixed(1)}px;` : ""; + return Io`
-
${Xf(w)}
- - ${Q ? Lo`` : null} - - - - - ${Bt ? Lo`
${Math.round(k)}°
` : null} - ${Pt ? Lo`
${Math.round(W)}°
` : null} +
${ed(x)}
+ + ${tt ? Io`` : null} + + + + + ${wt ? Io`
${Math.round(k)}°
` : null} + ${Rt ? Io`
${Math.round(O)}°
` : null}
`; } renderSvg(a, c) { - var Tr, Fr, Ar, Dr, Br, Pr, zr, Lr, Wr, Or, Ir, Vr, Hr, Gr, Ur, jr; - const l = this._hass, o = this._config || {}, w = o.siSourceAttr ?? "sunlight_visualizer_source", v = o.siSourceValue ?? "sunlight_visualizer", P = Object.entries(l.states ?? {}).filter( + var Gr, Ur, jr, qr, Yr, Xr, Zr, Kr, Jr, Qr, tc, oc, ec, sc, ac, nc, ic; + const l = this._hass, o = this._config || {}, x = o.siSourceAttr ?? "sunlight_visualizer_source", $ = o.siSourceValue ?? "sunlight_visualizer", B = Object.entries(l.states ?? {}).filter( ([, t]) => { var e; - return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e[w]) === v; + return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e[x]) === $; } ), k = (t) => { - for (const [e, s] of P) + for (const [e, s] of B) if (t(s, e)) return [e, s]; return null; - }, W = (t) => { + }, O = (t) => { const e = k((s) => { var n; return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.wall) === t; @@ -1086,29 +1138,31 @@ const qn = class qn extends be { return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.camera_rotation) === t; }); return e ? e[0] : void 0; - }, V = (t) => { + }, L = (t) => { const e = k((s) => { var n; return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.si_setting) === t; }); return e ? e[0] : void 0; - }, Q = k( + }, tt = k( (t) => { var e, s; return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e.sun_azimuth) != null && ((s = t == null ? void 0 : t.attributes) == null ? void 0 : s.sun_elevation) != null; } - ), q = Q ? Q[1].attributes : null, O = k( + ), j = tt ? tt[1].attributes : null, z = k( (t) => { var e, s, n; return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e.roof_direction) != null || ((s = t == null ? void 0 : t.attributes) == null ? void 0 : s.ceiling_tilt) != null || ((n = t == null ? void 0 : t.attributes) == null ? void 0 : n.house_angle) != null; } - ), F = O ? O[1].attributes : null, kt = !!(F != null && F.force_sun_fallback), Nt = Number(a ?? o.cardWidth ?? 450), Bt = Number(c ?? o.cardHeight ?? 450), Pt = Nt, Qt = Bt, J = Pt, tt = Qt, Et = J, to = tt, Tt = J * 0.1, ot = o.floorScale ?? 2.6, oo = J * 0.5, bo = tt * 0.4, ye = o.floorColor ?? "#2f2f2f", Ho = Number(o.floorCornerRadius ?? 26), go = Number(o.floorThicknessPx ?? 7), Go = o.floorThicknessColor ?? "rgba(150,106,64,0.9)", $e = o.floorTopStrokeColor ?? "rgba(72,112,56,0.8)", rt = Number(o.floorTopStrokeWidth ?? 1.4), yo = o.floorGrassEnabled ?? !0, mt = Number(o.floorGrassOpacity ?? 0.3), $o = o.floorGrassColorA ?? "rgb(136,186,88)", zt = o.floorGrassColorB ?? "rgb(96,150,62)", Ut = o.rotationHEntity ?? Y("h") ?? "input_number.cube_rotation_h", eo = o.rotationVEntity ?? Y("v") ?? "input_number.cube_rotation_v"; - this._rotationHEntity = Ut, this._rotationVEntity = eo; - const bt = o.preferIntegrationSettings ?? !0, Lt = o.houseAngleEntity ?? null; - let wt = Number(o.houseAngle ?? 0); - const xt = V("house_angle"); - Lt && l.states[Lt] ? wt = Number(((Tr = l.states[Lt]) == null ? void 0 : Tr.state) ?? wt) : xt && l.states[xt] ? wt = Number(((Fr = l.states[xt]) == null ? void 0 : Fr.state) ?? wt) : (bt || o.houseAngle == null) && (F == null ? void 0 : F.house_angle) != null && (wt = Number(F.house_angle ?? wt)); - const jt = o.wallFrontPctEntity ?? W("front"), _o = o.wallRightPctEntity ?? W("right"), nt = o.wallBackPctEntity ?? W("back"), $t = o.wallLeftPctEntity ?? W("left"), ht = o.roofPctEntity ?? W("ceiling"), Ft = (t, e = !1) => { + ), E = z ? z[1].attributes : null, $t = !!(E != null && E.force_sun_fallback), vt = Number(a ?? o.cardWidth ?? 450), wt = Number(c ?? o.cardHeight ?? 450), Rt = vt, ft = wt, Z = Rt, Q = ft, Bt = Z, zt = Q, dt = Z * 0.1, at = o.floorScale ?? 2.6, go = Z * 0.5, jo = Q * 0.4, _o = o.floorColor ?? "#2f2f2f", eo = Number(o.floorCornerRadius ?? 26), qo = Number(o.floorThicknessPx ?? 7), xe = o.floorThicknessColor ?? "rgba(150,106,64,0.9)", Yo = o.floorTopStrokeColor ?? "rgba(72,112,56,0.8)", nt = Number(o.floorTopStrokeWidth ?? 1.4), yo = o.floorGrassEnabled ?? !0, Mt = Number(o.floorGrassOpacity ?? 0.3), Xo = o.floorGrassColorA ?? "rgb(136,186,88)", It = o.floorGrassColorB ?? "rgb(96,150,62)", so = o.rotationHEntity ?? Y("h") ?? "input_number.cube_rotation_h", $o = o.rotationVEntity ?? Y("v") ?? "input_number.cube_rotation_v"; + this._rotationHEntity = so, this._rotationVEntity = $o; + const pt = o.preferIntegrationSettings ?? !0, Vt = o.houseAngleEntity ?? null; + let Pt = Number(o.houseAngle ?? 0); + const Ft = L("house_angle"); + Vt && l.states[Vt] ? Pt = Number(((Gr = l.states[Vt]) == null ? void 0 : Gr.state) ?? Pt) : Ft && l.states[Ft] ? Pt = Number(((Ur = l.states[Ft]) == null ? void 0 : Ur.state) ?? Pt) : (pt || o.houseAngle == null) && (E == null ? void 0 : E.house_angle) != null && (Pt = Number(E.house_angle ?? Pt)); + const Yt = o.wallFrontPctEntity ?? O("front"), vo = o.wallRightPctEntity ?? O("right"), it = o.wallBackPctEntity ?? O("back"), Ct = o.wallLeftPctEntity ?? O("left"), ht = o.roofPctEntity ?? O("ceiling"), So = o.fixedSunAzimuthEntity ?? L("fixed_sun_azimuth") ?? null; + this._fixedSunAzimuthEntity = So ?? void 0; + const _t = (t, e = !1) => { if (t == null || t === "") return e; if (typeof t == "boolean") return t; if (typeof t == "number") return t !== 0; @@ -1118,91 +1172,105 @@ const qn = class qn extends be { if (["false", "0", "no", "off"].includes(s)) return !1; } return e; - }, _e = bt ? (F == null ? void 0 : F.roof_power_entity) ?? o.roofPowerEntity ?? null : o.roofPowerEntity ?? (F == null ? void 0 : F.roof_power_entity) ?? null, Uo = bt ? Ft(F == null ? void 0 : F.roof_power_enabled, Ft(o.roofPowerEnabled, !1)) : Ft(o.roofPowerEnabled, Ft(F == null ? void 0 : F.roof_power_enabled, !1)), ms = bt ? Ft(F == null ? void 0 : F.roof_power_invert, Ft(o.roofPowerInvert, !1)) : Ft(o.roofPowerInvert, Ft(F == null ? void 0 : F.roof_power_invert, !1)), bs = jt ? Number(((Ar = l.states[jt]) == null ? void 0 : Ar.state) ?? 0) : 0, gs = _o ? Number(((Dr = l.states[_o]) == null ? void 0 : Dr.state) ?? 0) : 0, ys = nt ? Number(((Br = l.states[nt]) == null ? void 0 : Br.state) ?? 0) : 0, $s = $t ? Number(((Pr = l.states[$t]) == null ? void 0 : Pr.state) ?? 0) : 0, ve = ht ? Number(((zr = l.states[ht]) == null ? void 0 : zr.state) ?? 0) : 0, Se = Uo && _e ? Number((Lr = l.states[_e]) == null ? void 0 : Lr.state) : NaN, we = Uo ? ((t) => Number.isFinite(t) ? t >= 1e3 ? `${(t / 1e3).toFixed(2)} kW` : `${Math.round(t)} W` : "0 W")(ms ? Math.abs(Se) : Se) : "", _s = o.useSunEntity ?? !1, jo = o.sunEntityId ?? "sun.sun", so = o.sunAzEntity ?? null, ao = o.sunElEntity ?? null; - let qo = Number(o.sunDistance ?? 3), Wt = Number(o.sunAz ?? 135), et = Number(o.sunEl ?? 55); - const vs = Number(o.sunVisualElevationBiasDeg ?? 6), Ss = Number(o.sunVisualElevationScale ?? 1); - so && l.states[so] && (Wt = Number(((Wr = l.states[so]) == null ? void 0 : Wr.state) ?? Wt)), ao && l.states[ao] && (et = Number(((Or = l.states[ao]) == null ? void 0 : Or.state) ?? et)), !so && bt && (q == null ? void 0 : q.sun_azimuth) != null && (Wt = Number(q.sun_azimuth ?? Wt)), !ao && bt && (q == null ? void 0 : q.sun_elevation) != null && (et = Number(q.sun_elevation ?? et)), !so && !ao && !q && _s && l.states[jo] && (Wt = Number(((Ir = l.states[jo].attributes) == null ? void 0 : Ir.azimuth) ?? Wt), et = Number(((Vr = l.states[jo].attributes) == null ? void 0 : Vr.elevation) ?? et)); - const vo = o.roofTiltEnabled ?? !0; - let no = Number(o.roofTiltDeg ?? 25), H = o.roofTiltFace ?? "front"; - const Yo = V("ceiling_tilt"), Xo = V("roof_direction"), ws = Number(o.roofTiltMax ?? 89), xs = Number(o.roofTiltOpacity ?? 1); - Yo && l.states[Yo] ? no = Number(((Hr = l.states[Yo]) == null ? void 0 : Hr.state) ?? no) : (bt || o.roofTiltDeg == null) && (F == null ? void 0 : F.ceiling_tilt) != null && (no = Number(F.ceiling_tilt ?? no)), Xo && l.states[Xo] ? H = String(((Gr = l.states[Xo]) == null ? void 0 : Gr.state) ?? H) : (bt || o.roofTiltFace == null) && (F == null ? void 0 : F.roof_direction) != null && (H = String(F.roof_direction)); - const So = o.houseStyleV2 ?? !0, Rt = o.flatRoofEnabled ?? !0, Rs = Number(o.flatRoofOverhang ?? 0.15), Ms = Number(o.flatRoofThickness ?? 0.12), Cs = Number(o.flatRoofLift ?? 0), xe = o.flatRoofTopColor ?? "#e6e8ee"; + }, we = pt ? (E == null ? void 0 : E.roof_power_entity) ?? o.roofPowerEntity ?? null : o.roofPowerEntity ?? (E == null ? void 0 : E.roof_power_entity) ?? null, Zo = pt ? _t(E == null ? void 0 : E.roof_power_enabled, _t(o.roofPowerEnabled, !1)) : _t(o.roofPowerEnabled, _t(E == null ? void 0 : E.roof_power_enabled, !1)), Ss = pt ? _t(E == null ? void 0 : E.roof_power_invert, _t(o.roofPowerInvert, !1)) : _t(o.roofPowerInvert, _t(E == null ? void 0 : E.roof_power_invert, !1)), Re = pt ? _t( + E == null ? void 0 : E.fixed_sun_rotation_enabled, + _t(o.fixedSunRotationEnabled, !1) + ) : _t( + o.fixedSunRotationEnabled, + _t(E == null ? void 0 : E.fixed_sun_rotation_enabled, !1) + ); + let Lt = Number(pt ? (E == null ? void 0 : E.fixed_sun_azimuth) ?? o.fixedSunAzimuthDeg ?? 225 : o.fixedSunAzimuthDeg ?? (E == null ? void 0 : E.fixed_sun_azimuth) ?? 225); + const xo = Number(this._fixedSunAzimuthOverride); + if (Number.isFinite(xo) && (Lt = xo), So && l.states[So]) { + const t = Number(((jr = l.states[So]) == null ? void 0 : jr.state) ?? Lt); + Number.isFinite(t) && (Number.isFinite(xo) && Math.abs((t - xo + 540) % 360 - 180) < 0.25 && (this._fixedSunAzimuthOverride = void 0), Lt = t); + } + Number.isFinite(Lt) || (Lt = 225), Lt = this._normDeg(Lt), this._fixedSunRotationEnabled = Re; + const xs = Yt ? Number(((qr = l.states[Yt]) == null ? void 0 : qr.state) ?? 0) : 0, ws = vo ? Number(((Yr = l.states[vo]) == null ? void 0 : Yr.state) ?? 0) : 0, Rs = it ? Number(((Xr = l.states[it]) == null ? void 0 : Xr.state) ?? 0) : 0, Ms = Ct ? Number(((Zr = l.states[Ct]) == null ? void 0 : Zr.state) ?? 0) : 0, Me = ht ? Number(((Kr = l.states[ht]) == null ? void 0 : Kr.state) ?? 0) : 0, Ce = Zo && we ? Number((Jr = l.states[we]) == null ? void 0 : Jr.state) : NaN, ke = Zo ? ((t) => Number.isFinite(t) ? t >= 1e3 ? `${(t / 1e3).toFixed(2)} kW` : `${Math.round(t)} W` : "0 W")(Ss ? Math.abs(Ce) : Ce) : "", Cs = o.useSunEntity ?? !1, Ko = o.sunEntityId ?? "sun.sun", ao = o.sunAzEntity ?? null, no = o.sunElEntity ?? null; + let Jo = Number(o.sunDistance ?? 3), mt = Number(o.sunAz ?? 135), ot = Number(o.sunEl ?? 55); + const ks = Number(o.sunVisualElevationBiasDeg ?? 6), Ns = Number(o.sunVisualElevationScale ?? 1); + ao && l.states[ao] && (mt = Number(((Qr = l.states[ao]) == null ? void 0 : Qr.state) ?? mt)), no && l.states[no] && (ot = Number(((tc = l.states[no]) == null ? void 0 : tc.state) ?? ot)), !ao && pt && (j == null ? void 0 : j.sun_azimuth) != null && (mt = Number(j.sun_azimuth ?? mt)), !no && pt && (j == null ? void 0 : j.sun_elevation) != null && (ot = Number(j.sun_elevation ?? ot)), !ao && !no && !j && Cs && l.states[Ko] && (mt = Number(((oc = l.states[Ko].attributes) == null ? void 0 : oc.azimuth) ?? mt), ot = Number(((ec = l.states[Ko].attributes) == null ? void 0 : ec.elevation) ?? ot)), Number.isFinite(mt) || (mt = 135), mt = this._normDeg(mt), this._currentSunAzimuthReal = mt; + const wo = o.roofTiltEnabled ?? !0; + let io = Number(o.roofTiltDeg ?? 25), H = o.roofTiltFace ?? "front"; + const Qo = L("ceiling_tilt"), te = L("roof_direction"), Es = Number(o.roofTiltMax ?? 89), Fs = Number(o.roofTiltOpacity ?? 1); + Qo && l.states[Qo] ? io = Number(((sc = l.states[Qo]) == null ? void 0 : sc.state) ?? io) : (pt || o.roofTiltDeg == null) && (E == null ? void 0 : E.ceiling_tilt) != null && (io = Number(E.ceiling_tilt ?? io)), te && l.states[te] ? H = String(((ac = l.states[te]) == null ? void 0 : ac.state) ?? H) : (pt || o.roofTiltFace == null) && (E == null ? void 0 : E.roof_direction) != null && (H = String(E.roof_direction)); + const Ro = o.houseStyleV2 ?? !0, At = o.flatRoofEnabled ?? !0, As = Number(o.flatRoofOverhang ?? 0.15), Ts = Number(o.flatRoofThickness ?? 0.12), Ds = Number(o.flatRoofLift ?? 0), Ne = o.flatRoofTopColor ?? "#e6e8ee"; o.flatRoofEdgeColor; - const Re = o.flatRoofSideColor ?? "#9ea4af", Me = Number(o.flatRoofSideShade ?? 0.4), Ce = Number(o.flatRoofTopOpacity ?? 1), Zo = Number(o.flatRoofEdgeOpacity ?? 1), ke = Number(o.flatRoofTopDepthBias ?? 0.06), Ne = Number(o.flatRoofSideDepthBias ?? 0.025), ks = Number(o.flatRoofSkirtDepthBias ?? 0.02), Ns = o.wallWindowsEnabled ?? !0, Es = o.wallWindowFrameColor ?? "rgba(221,228,236,0.98)", Ts = o.wallWindowGlassColor ?? "rgba(110,178,212,0.68)", Fs = o.wallWindowStrokeColor ?? "rgba(62,105,130,0.65)", Ee = Number(o.wallWindowStrokeWidth ?? 1), As = o.roofPanelsEnabled ?? So, Ds = o.roofPanelColor ?? "#2d3f7b", Te = o.roofPanelGridColor ?? "rgba(214,230,255,0.65)", Bs = o.roofPanelBorderColor ?? "rgba(185,204,234,0.85)", Ps = Number(o.roofPanelBorderWidth ?? 0.9), Ko = Math.max(1, Math.round(Number(o.roofPanelsCols ?? 3))), zs = M(Number(o.roofPanelsWidthFrac ?? 0.9), 0.4, 0.98), Ls = M(Number(o.roofPanelsGapFrac ?? 0.025), 0, 0.08), Fe = M(Number(o.roofPanelsT0 ?? 0.05), 0, 0.95), Ae = M(Number(o.roofPanelsT1 ?? 0.26), 0.01, 0.98), De = Math.max(1, Math.round(Number(o.roofPanelGridCols ?? 5))), Be = Math.max(1, Math.round(Number(o.roofPanelGridRows ?? 3))), Pe = o.backTreeEnabled ?? !0, wo = Number(o.backTreeX ?? -2.2), xo = Number(o.backTreeZ ?? -2.2), ze = Number(o.backTreeScale ?? 1), io = o.backTreeLeafColor ?? "#9bc94b", ro = o.backTreeTrunkColor ?? "#6f4b2a", Le = o.backTreeShadowEnabled ?? So, Ws = Number(o.backTreeShadowOpacity ?? 0.35), Os = Number(o.backTreeShadowBlur ?? 1.1), Is = Number(o.backTreeShadowLength ?? 0.015), Vs = o.plinthBandEnabled ?? So, N = Number(o.plinthBandHeight ?? 0.06), D = Number(o.plinthBandMix ?? 0.62), X = o.patioStepEnabled ?? So, Hs = Number(o.patioStepDepth ?? 0.24), Gs = Number(o.patioStepWidth ?? 1.1), Sc = Number(o.patioStepInset ?? 0.02), wc = o.patioStepColor ?? "rgba(226,230,235,0.75)", Yn = o.patioGridColor ?? "rgba(164,170,182,0.8)", Xn = Number(o.patioGridWidth ?? 1), xa = o.shadowEnabled ?? !0, xc = Number(o.shadowOpacity ?? 0.35), Rc = Number(o.shadowBlur ?? 4), Mc = Number(o.shadowContactOpacity ?? 0.12), Cc = Number(o.shadowContactBlur ?? 2.5), Jo = o.shadowColor ?? "#000000", Zn = Number(o.shadowClipInset ?? 0.02), Ra = o.baseAnchorShadowEnabled ?? !0, kc = Number(o.baseAnchorShadowOpacity ?? 0.65), Nc = Number(o.baseAnchorShadowBlur ?? 0.2), Ec = Number(o.baseAnchorShadowSpread ?? 0.05), Tc = o.baseAnchorShadowColor ?? "#000000", Ma = o.sunlightEnabled ?? !0, Ca = o.sunlightColor ?? [255, 225, 160], Kn = Number(o.sunlightOpacity ?? 0.7), Fc = Number(o.sunlightSpread ?? 0.7), Ac = Number(o.sunBeamStaticOpacity ?? 0.07), Dc = Number(o.sunBeamStaticWidth ?? 1.6), ka = o.sunBeamFlowEnabled ?? !0, Bc = o.sunBeamFlowColor ?? "rgba(255,200,50,0.85)", Pc = Number(o.sunBeamFlowOpacity ?? 0.55), zc = Number(o.sunBeamFlowWidthScale ?? 0.6), Na = Number(o.sunBeamFlowDash ?? 8), Ea = Number(o.sunBeamFlowGap ?? 50), Lc = Number(o.sunBeamFlowDuration ?? 2.5), Wc = Number(o.sunBeamFlowPhaseStep ?? 0.1), Oc = Number(o.sunBeamDepthScaleBoost ?? 1), Ic = Number(o.sunBeamDepthScaleMin ?? 0.55), Vc = Number(o.sunBeamDepthScaleMax ?? 1.2), Hc = o.sunRayAnimEnabled ?? !0, Ta = Number(o.sunRayAnimDurationMin ?? 1.8), Fa = Number(o.sunRayAnimDurationMax ?? 3), Gc = Number(o.sunRayAnimScaleMin ?? 0.5), Uc = Number(o.sunRayAnimScaleMax ?? 0.75), jc = Number(o.sunRayAnimOpacityMin ?? 0.45); + const Ee = o.flatRoofSideColor ?? "#9ea4af", Fe = Number(o.flatRoofSideShade ?? 0.4), Ae = Number(o.flatRoofTopOpacity ?? 1), oe = Number(o.flatRoofEdgeOpacity ?? 1), Te = Number(o.flatRoofTopDepthBias ?? 0.06), De = Number(o.flatRoofSideDepthBias ?? 0.025), Bs = Number(o.flatRoofSkirtDepthBias ?? 0.02), zs = o.wallWindowsEnabled ?? !0, Ps = o.wallWindowFrameColor ?? "rgba(221,228,236,0.98)", Ls = o.wallWindowGlassColor ?? "rgba(110,178,212,0.68)", Ws = o.wallWindowStrokeColor ?? "rgba(62,105,130,0.65)", Be = Number(o.wallWindowStrokeWidth ?? 1), Os = o.roofPanelsEnabled ?? Ro, Is = o.roofPanelColor ?? "#2d3f7b", ze = o.roofPanelGridColor ?? "rgba(214,230,255,0.65)", Vs = o.roofPanelBorderColor ?? "rgba(185,204,234,0.85)", Hs = Number(o.roofPanelBorderWidth ?? 0.9), ee = Math.max(1, Math.round(Number(o.roofPanelsCols ?? 3))), Gs = C(Number(o.roofPanelsWidthFrac ?? 0.9), 0.4, 0.98), Us = C(Number(o.roofPanelsGapFrac ?? 0.025), 0, 0.08), Pe = C(Number(o.roofPanelsT0 ?? 0.05), 0, 0.95), Le = C(Number(o.roofPanelsT1 ?? 0.26), 0.01, 0.98), We = Math.max(1, Math.round(Number(o.roofPanelGridCols ?? 5))), Oe = Math.max(1, Math.round(Number(o.roofPanelGridRows ?? 3))), Ie = o.backTreeEnabled ?? !0, Mo = Number(o.backTreeX ?? -2.2), Co = Number(o.backTreeZ ?? -2.2), Ve = Number(o.backTreeScale ?? 1), ro = o.backTreeLeafColor ?? "#9bc94b", co = o.backTreeTrunkColor ?? "#6f4b2a", He = o.backTreeShadowEnabled ?? Ro, js = Number(o.backTreeShadowOpacity ?? 0.35), qs = Number(o.backTreeShadowBlur ?? 1.1), Ys = Number(o.backTreeShadowLength ?? 0.015), Xs = o.plinthBandEnabled ?? Ro, Zs = Number(o.plinthBandHeight ?? 0.06), Ks = Number(o.plinthBandMix ?? 0.62), Js = o.patioStepEnabled ?? Ro, Qs = Number(o.patioStepDepth ?? 0.24), ta = Number(o.patioStepWidth ?? 1.1), oa = Number(o.patioStepInset ?? 0.02), ea = o.patioStepColor ?? "rgba(226,230,235,0.75)", Ge = o.patioGridColor ?? "rgba(164,170,182,0.8)", Ue = Number(o.patioGridWidth ?? 1), se = o.shadowEnabled ?? !0, sa = Number(o.shadowOpacity ?? 0.35), aa = Number(o.shadowBlur ?? 4), na = Number(o.shadowContactOpacity ?? 0.12), w = Number(o.shadowContactBlur ?? 2.5), F = o.shadowColor ?? "#000000", X = Number(o.shadowClipInset ?? 0.02), Xt = o.baseAnchorShadowEnabled ?? !0, ia = Number(o.baseAnchorShadowOpacity ?? 0.65), zc = Number(o.baseAnchorShadowBlur ?? 0.2), Pc = Number(o.baseAnchorShadowSpread ?? 0.05), Lc = o.baseAnchorShadowColor ?? "#000000", Oa = o.sunlightEnabled ?? !0, Ia = o.sunlightColor ?? [255, 225, 160], ci = Number(o.sunlightOpacity ?? 0.7), Wc = Number(o.sunlightSpread ?? 0.7), Oc = Number(o.sunBeamStaticOpacity ?? 0.07), Ic = Number(o.sunBeamStaticWidth ?? 1.6), Va = o.sunBeamFlowEnabled ?? !0, Vc = o.sunBeamFlowColor ?? "rgba(255,200,50,0.85)", Hc = Number(o.sunBeamFlowOpacity ?? 0.55), Gc = Number(o.sunBeamFlowWidthScale ?? 0.6), Ha = Number(o.sunBeamFlowDash ?? 8), Ga = Number(o.sunBeamFlowGap ?? 50), Uc = Number(o.sunBeamFlowDuration ?? 2.5), jc = Number(o.sunBeamFlowPhaseStep ?? 0.1), qc = Number(o.sunBeamDepthScaleBoost ?? 1), Yc = Number(o.sunBeamDepthScaleMin ?? 0.55), Xc = Number(o.sunBeamDepthScaleMax ?? 1.2), Zc = o.sunRayAnimEnabled ?? !0, Ua = Number(o.sunRayAnimDurationMin ?? 1.8), ja = Number(o.sunRayAnimDurationMax ?? 3), Kc = Number(o.sunRayAnimScaleMin ?? 0.5), Jc = Number(o.sunRayAnimScaleMax ?? 0.75), Qc = Number(o.sunRayAnimOpacityMin ?? 0.45); Number(o.sunRayAnimOpacityMax ?? 0.85); - const Jn = o.sunRayAnimColorA ?? "rgb(255,240,110)"; + const li = o.sunRayAnimColorA ?? "rgb(255,240,110)"; o.sunRayAnimColorB; - const We = o.skyCloudsEnabled ?? !0, Qn = Number(o.skyCloudOpacity ?? 0.34), qc = Number(o.skyCloudBlur ?? 3.3), Aa = Number(o.skyCloudScale ?? 1.5), Da = Number(o.skyCloudSpeed ?? 1), Yc = Number(o.skyCloudHeight ?? 0.5); + const je = o.skyCloudsEnabled ?? !0, hi = Number(o.skyCloudOpacity ?? 0.34), tl = Number(o.skyCloudBlur ?? 3.3), qa = Number(o.skyCloudScale ?? 1.5), Ya = Number(o.skyCloudSpeed ?? 1), ol = Number(o.skyCloudHeight ?? 0.5); Number(o.wallBottomMix ?? 0.01), Number(o.wallMidMix ?? 0.7), Number(o.wallTopMix ?? 1.3); - const Xc = o.facadeSunDimmingEnabled ?? !0, Zc = Number(o.facadeSunMinFactor ?? 0.2), Kc = Number(o.facadeSunNoDimAtPct ?? 90), Jc = Number(o.facadeSunCurve ?? 8), Qc = Number(o.ceilingDarkMix ?? 0.1), tl = Number(o.ceilingLightMix ?? 1.4), ti = o.horizonEnabled ?? !0, ol = Number(o.horizonBase ?? 0.55), el = Number(o.horizonTiltStrength ?? 0.65), oi = Number(o.horizonBand ?? 0.15), sl = o.horizonTopColor ?? [120, 170, 220], al = o.horizonBandColor ?? [255, 210, 150], nl = o.horizonBottomColor ?? [70, 80, 95], il = Number(o.skyTwilightRangeDeg ?? 6), rl = o.horizonNightTopColor ?? [12, 20, 42], cl = o.horizonNightBandColor ?? [32, 44, 82], ll = o.horizonNightBottomColor ?? [6, 10, 22], hl = o.horizonSunriseTopColor ?? [118, 150, 206], ul = o.horizonSunriseBandColor ?? [236, 162, 132], fl = o.horizonSunriseBottomColor ?? [84, 70, 90], dl = o.horizonSunsetTopColor ?? [98, 106, 178], pl = o.horizonSunsetBandColor ?? [255, 122, 90], ml = o.horizonSunsetBottomColor ?? [82, 48, 76], Oe = o.skyStarsEnabled ?? !0, Us = Math.max(0, Math.round(Number(o.skyStarsCount ?? 34))), bl = o.skyStarsTwinkleEnabled ?? !0, gl = Number(o.skyStarsOpacity ?? 0.9), Ba = o.skyMoonEnabled ?? !0, yl = Number(o.skyMoonX ?? 0.86), $l = Number(o.skyMoonY ?? 0.12), _l = Number(o.skyMoonSize ?? 14), vl = Number(o.skyMoonPhase ?? 0.72), Sl = Number(o.skyMoonOpacity ?? 0.92), Ie = o.moonlightEnabled ?? !0, js = o.moonlightColor ?? [178, 208, 255], wl = Number(o.moonlightOpacity ?? 0.22), xl = Number(o.moonlightSpread ?? 0.6), Rl = Number(o.moonlightWashOpacity ?? 0.08), Ml = Number(o.moonShadowElevationDeg ?? 18), Cl = Number(o.moonShadowYawDeg ?? -45), kl = Number(o.shadowSunMoonBlendDeg ?? 3), ei = o.vignetteEnabled ?? !0, Nl = Number(o.vignetteOpacity ?? 0.35), El = Number(o.vignetteRadius ?? 0.65), Tl = Number(o.vignetteInner ?? 0.85), Pa = o.vignetteColor ?? [0, 0, 0], Fl = o.roofBackEnabled ?? !0, si = Number(o.roofBackMix ?? 0.7), Al = Number(o.roofBackOpacity ?? 1); + const el = o.facadeSunDimmingEnabled ?? !0, sl = Number(o.facadeSunMinFactor ?? 0.2), al = Number(o.facadeSunNoDimAtPct ?? 90), nl = Number(o.facadeSunCurve ?? 8), il = Number(o.ceilingDarkMix ?? 0.1), rl = Number(o.ceilingLightMix ?? 1.4), ui = o.horizonEnabled ?? !0, cl = Number(o.horizonBase ?? 0.55), ll = Number(o.horizonTiltStrength ?? 0.65), fi = Number(o.horizonBand ?? 0.15), hl = o.horizonTopColor ?? [120, 170, 220], ul = o.horizonBandColor ?? [255, 210, 150], fl = o.horizonBottomColor ?? [70, 80, 95], dl = Number(o.skyTwilightRangeDeg ?? 6), pl = o.horizonNightTopColor ?? [12, 20, 42], ml = o.horizonNightBandColor ?? [32, 44, 82], bl = o.horizonNightBottomColor ?? [6, 10, 22], gl = o.horizonSunriseTopColor ?? [118, 150, 206], _l = o.horizonSunriseBandColor ?? [236, 162, 132], yl = o.horizonSunriseBottomColor ?? [84, 70, 90], $l = o.horizonSunsetTopColor ?? [98, 106, 178], vl = o.horizonSunsetBandColor ?? [255, 122, 90], Sl = o.horizonSunsetBottomColor ?? [82, 48, 76], qe = o.skyStarsEnabled ?? !0, ra = Math.max(0, Math.round(Number(o.skyStarsCount ?? 34))), xl = o.skyStarsTwinkleEnabled ?? !0, wl = Number(o.skyStarsOpacity ?? 0.9), Xa = o.skyMoonEnabled ?? !0, Rl = Number(o.skyMoonX ?? 0.86), Ml = Number(o.skyMoonY ?? 0.12), Cl = Number(o.skyMoonSize ?? 14), kl = Number(o.skyMoonPhase ?? 0.72), Nl = Number(o.skyMoonOpacity ?? 0.92), Ye = o.moonlightEnabled ?? !0, ca = o.moonlightColor ?? [178, 208, 255], El = Number(o.moonlightOpacity ?? 0.22), Fl = Number(o.moonlightSpread ?? 0.6), Al = Number(o.moonlightWashOpacity ?? 0.08), Tl = Number(o.moonShadowElevationDeg ?? 18), Dl = Number(o.moonShadowYawDeg ?? -45), Bl = Number(o.shadowSunMoonBlendDeg ?? 3), di = o.vignetteEnabled ?? !0, zl = Number(o.vignetteOpacity ?? 0.35), Pl = Number(o.vignetteRadius ?? 0.65), Ll = Number(o.vignetteInner ?? 0.85), Za = o.vignetteColor ?? [0, 0, 0], Wl = o.roofBackEnabled ?? !0, pi = Number(o.roofBackMix ?? 0.7), Ol = Number(o.roofBackOpacity ?? 1); Number(o.roofGradientDarkMix ?? 0.125), Number(o.roofGradientLightMix ?? 1.25); - const Dl = o.roofSidesEnabled ?? !0, Bl = Number(o.roofSideMix ?? 0.45), za = Number(o.roofSideOpacity ?? 1), ai = Number(o.roofSideDepthBias ?? 0.012), Pl = o.roofCapEnabled ?? !0, zl = Number(o.floorCompassStroke ?? 4), Ll = Number(o.floorCompassRingBand ?? 0.09), Wl = o.floorCompassRingMiddleColor ?? "rgba(255,255,255,0.9)", ni = o.floorCompassRingSideColor ?? "rgba(210,140,140,0.345)", ii = Number(o.floorCompassRingSideWidth ?? 3), ri = o.floorCompassTicksEnabled ?? !0, Ol = o.floorCompassTickColor ?? "rgba(0,0,0,0.75)", Il = Number(o.floorCompassTickWidth ?? 1), Vl = Number(o.floorCompassTickMajorWidth ?? 4), Hl = Number(o.floorCompassTickLength ?? -0.1), Gl = Number(o.floorCompassTickMajorLength ?? -0.2), Ul = Number(o.floorCompassLabelSize ?? 20), jl = Number(o.floorCompassLabelInset ?? -0.25), ql = Number(o.floorCompassLabelScaleBoost ?? 1.2), Yl = Number(o.floorCompassLabelScaleMin ?? 0.6), Xl = Number(o.floorCompassLabelScaleMax ?? 2), Zl = Number(o.floorCompassLabelStroke ?? 1), ci = Number(o.arrowScaleBoost ?? 0.6), li = Number(o.floorPointerScaleMin ?? 0.05), hi = Number(o.floorPointerScaleMax ?? 1), ui = Number(o.floorPointerBaseWidth ?? 3.4), Kl = Number(o.floorPointerBaseHead ?? 18), La = o.floorPointerColor ?? "gold", fi = o.floorPointerShadowEnabled ?? !0, Wa = Number(o.floorPointerShadowOpacity ?? 0.8), Jl = Number(o.floorPointerShadowBlur ?? 1.1), Ql = Number(o.floorPointerShadowOffset ?? 2.9), th = Number(o.floorWallLabelSize ?? 12), qs = Number(o.floorWallLabelOffset ?? 0.55), oh = Number(o.floorWallLabelScaleBoost ?? 1.2), eh = Number(o.floorWallLabelScaleMin ?? 0.5), sh = Number(o.floorWallLabelScaleMax ?? 1.8), ah = Number(o.floorWallLabelScreenLift ?? 6), nh = o.floorWallLabelColor ?? "rgba(255,255,255,0.9)", ih = o.floorWallLabelStroke ?? "rgba(0,0,0,0.6)", rh = Number(o.floorWallLabelStrokeWidth ?? 0.5), di = Number(o.wallLabelVisibleThreshold ?? -0.05), ch = Number(o.wallPctVisibleThreshold ?? -0.215), lh = Number(o.wallPctAreaThreshold ?? 120), hh = Number(o.wallPctVerticalPos ?? 0.66), pi = o.surfaceLabelEnabled ?? !0, Oa = Number(o.surfaceLabelSize ?? 12), uh = Number(o.surfaceLabelScaleBoost ?? 1.5), fh = Number(o.surfaceLabelScaleMin ?? 0.6), dh = Number(o.surfaceLabelScaleMax ?? 1.6), mi = o.surfaceLabelColor ?? "rgba(255,213,0,.95)", bi = o.surfaceLabelStroke ?? "rgba(0,0,0,0.5)", Ia = Number(o.surfaceLabelStrokeWidth ?? 0.5), Va = Number(o.surfaceLabelOffset ?? 0.03), ph = Number(o.roofPctLabelScale ?? 1.18), mh = Number(o.roofPowerLabelScale ?? 0.7), bh = o.roofPowerLabelColor ?? "rgba(255,255,255,0.9)", gh = o.frontDoorEnabled ?? !0, Ha = Number(o.frontDoorWidth ?? 0.55), gi = Number(o.frontDoorHeight ?? 1.1), yh = Number(o.frontDoorBottomInset ?? 0.05), $h = Number(o.frontDoorOffset ?? 0.01), _h = o.frontDoorColor ?? "rgba(0,0,0,0.55)", yi = Number(o.frontDoorOpacity ?? 0.9), vh = o.frontDoorFrameColor ?? "rgba(219,225,232,0.98)", Sh = o.frontDoorKnobColor ?? "rgba(236,198,111,0.95)", _t = o.faceColors ?? { + const Il = o.roofSidesEnabled ?? !0, Vl = Number(o.roofSideMix ?? 0.45), Ka = Number(o.roofSideOpacity ?? 1), mi = Number(o.roofSideDepthBias ?? 0.012), Hl = o.roofCapEnabled ?? !0, Gl = Number(o.floorCompassStroke ?? 4), Ul = Number(o.floorCompassRingBand ?? 0.09), jl = o.floorCompassRingMiddleColor ?? "rgba(255,255,255,0.9)", bi = o.floorCompassRingSideColor ?? "rgba(210,140,140,0.345)", gi = Number(o.floorCompassRingSideWidth ?? 3), _i = o.floorCompassTicksEnabled ?? !0, ql = o.floorCompassTickColor ?? "rgba(0,0,0,0.75)", Yl = Number(o.floorCompassTickWidth ?? 1), Xl = Number(o.floorCompassTickMajorWidth ?? 4), Zl = Number(o.floorCompassTickLength ?? -0.1), Kl = Number(o.floorCompassTickMajorLength ?? -0.2), Jl = Number(o.floorCompassLabelSize ?? 20), Ql = Number(o.floorCompassLabelInset ?? -0.25), th = Number(o.floorCompassLabelScaleBoost ?? 1.2), oh = Number(o.floorCompassLabelScaleMin ?? 0.6), eh = Number(o.floorCompassLabelScaleMax ?? 2), sh = Number(o.floorCompassLabelStroke ?? 1), yi = Number(o.arrowScaleBoost ?? 0.6), $i = Number(o.floorPointerScaleMin ?? 0.05), vi = Number(o.floorPointerScaleMax ?? 1), Si = Number(o.floorPointerBaseWidth ?? 3.4), ah = Number(o.floorPointerBaseHead ?? 18), Ja = o.floorPointerColor ?? "gold", xi = o.floorPointerShadowEnabled ?? !0, Qa = Number(o.floorPointerShadowOpacity ?? 0.8), nh = Number(o.floorPointerShadowBlur ?? 1.1), ih = Number(o.floorPointerShadowOffset ?? 2.9), rh = Number(o.floorWallLabelSize ?? 12), la = Number(o.floorWallLabelOffset ?? 0.55), ch = Number(o.floorWallLabelScaleBoost ?? 1.2), lh = Number(o.floorWallLabelScaleMin ?? 0.5), hh = Number(o.floorWallLabelScaleMax ?? 1.8), uh = Number(o.floorWallLabelScreenLift ?? 6), fh = o.floorWallLabelColor ?? "rgba(255,255,255,0.9)", dh = o.floorWallLabelStroke ?? "rgba(0,0,0,0.6)", ph = Number(o.floorWallLabelStrokeWidth ?? 0.5), wi = Number(o.wallLabelVisibleThreshold ?? -0.05), mh = Number(o.wallPctVisibleThreshold ?? -0.215), bh = Number(o.wallPctAreaThreshold ?? 120), gh = Number(o.wallPctVerticalPos ?? 0.66), Ri = o.surfaceLabelEnabled ?? !0, tn = Number(o.surfaceLabelSize ?? 12), _h = Number(o.surfaceLabelScaleBoost ?? 1.5), yh = Number(o.surfaceLabelScaleMin ?? 0.6), $h = Number(o.surfaceLabelScaleMax ?? 1.6), Mi = o.surfaceLabelColor ?? "rgba(255,213,0,.95)", Ci = o.surfaceLabelStroke ?? "rgba(0,0,0,0.5)", on = Number(o.surfaceLabelStrokeWidth ?? 0.5), en = Number(o.surfaceLabelOffset ?? 0.03), vh = Number(o.roofPctLabelScale ?? 1.18), Sh = Number(o.roofPowerLabelScale ?? 0.7), xh = o.roofPowerLabelColor ?? "rgba(255,255,255,0.9)", wh = o.frontDoorEnabled ?? !0, sn = Number(o.frontDoorWidth ?? 0.55), ki = Number(o.frontDoorHeight ?? 1.1), Rh = Number(o.frontDoorBottomInset ?? 0.05), Mh = Number(o.frontDoorOffset ?? 0.01), Ch = o.frontDoorColor ?? "rgba(0,0,0,0.55)", Ni = Number(o.frontDoorOpacity ?? 0.9), kh = o.frontDoorFrameColor ?? "rgba(219,225,232,0.98)", Nh = o.frontDoorKnobColor ?? "rgba(236,198,111,0.95)", kt = o.faceColors ?? { front: "#faf5f5ff", right: "#d8d2d2ff", top: "#13a057", back: "#d8d2d2ff", left: "#d8d2d2ff", bottom: "#d8d2d2ff" - }, wh = o.autoRotateEnabledDefault ?? !1, Ys = Number(F == null ? void 0 : F.auto_rotate_speed); - let Ve = Number(o.autoRotateSpeed ?? 25); - (bt && Number.isFinite(Ys) || (o.autoRotateSpeed === void 0 || o.autoRotateSpeed === null || o.autoRotateSpeed === "") && Number.isFinite(Ys)) && (Ve = Ys); - const Mt = Number(o.autoRotateIntervalMs ?? 50), Ga = Number(o.autoRotateTapDelayMs ?? 250), xh = o.autoRotateStopOnFullTurn ?? !0, Ua = Number(o.autoRotateTurnCount ?? 1), Rh = o.autoRotateShowFps ?? !0, Mh = Number(o.autoRotateFpsWindowMs ?? 1e3), Ch = o.autoRotateAdaptiveEnabled ?? !0, $i = Number(o.autoRotateAdaptiveMaxIntervalMs ?? 1e3), kh = Number(o.autoRotateAdaptiveStepMs ?? 10), Nh = Number(o.autoRotateAdaptiveCheckMs ?? 1e3), Eh = Number(o.autoRotateAdaptiveFpsThreshold ?? 0.8), Th = Number(o.autoRotateCalibrateMs ?? 2e3), Fh = Number(o.autoRotateCalibrateFactor ?? 0.85), _i = o.cssFpsDebugEnabled ?? !1, Ah = Number(o.cssFpsWindowMs ?? 1e3), Dh = Number(o.cssFpsUiUpdateMs ?? 500), Xs = o.cssFpsAutoLimitEnabled ?? !0, Bh = Number(o.cssFpsCalibrateMs ?? 2e3), Ph = Number(o.cssFpsLimitThreshold ?? 20), zh = Number(o.cssFpsLimitFactor ?? 0.5), Lh = Number(o.cssFpsLimitMin ?? 1), Wh = Number(o.cssFpsLimitMax ?? 30), Oh = o.cssFpsLimitTextEnabled ?? !0, vi = Number(o.cssFpsRotationStartBoost ?? 2); - this._autoRotateSpeed = Ve, this._autoRotateIntervalMs = Mt, this._autoRotateTurnCount = Ua, this._autoRotateEnabled === void 0 && (this._autoRotateEnabled = wh), this._autoRotateOffsetDeg === void 0 && (this._autoRotateOffsetDeg = 0), this._autoRotateIntervalMsDynamic === void 0 && (this._autoRotateIntervalMsDynamic = Mt), this._autoRotateFpsSamples === void 0 && (this._autoRotateFpsSamples = []), this._autoRotateFps === void 0 && (this._autoRotateFps = 0), this._autoRotateCalibrated === void 0 && (this._autoRotateCalibrated = !1), this._autoRotateAccumDeg === void 0 && (this._autoRotateAccumDeg = 0), this._autoRotateTargetDeg === void 0 && (this._autoRotateTargetDeg = 0), this._cssFps === void 0 && (this._cssFps = 0), this._cssFpsLimit === void 0 && (this._cssFpsLimit = 0), this._cssPerfLimited === void 0 && (this._cssPerfLimited = !1), this._cssFpsAutoCalibrated === void 0 && (this._cssFpsAutoCalibrated = !1), this._cssFpsMeasured === void 0 && (this._cssFpsMeasured = 0), this._cssRecalibrateRequested === void 0 && (this._cssRecalibrateRequested = !1); - const Qo = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), Si = Qo() / 1e3, Zs = (t, e = 0) => { + }, Eh = o.autoRotateEnabledDefault ?? !1, ha = Number(E == null ? void 0 : E.auto_rotate_speed); + let Xe = Number(o.autoRotateSpeed ?? 25); + (pt && Number.isFinite(ha) || (o.autoRotateSpeed === void 0 || o.autoRotateSpeed === null || o.autoRotateSpeed === "") && Number.isFinite(ha)) && (Xe = ha); + const Tt = Number(o.autoRotateIntervalMs ?? 50), an = Number(o.autoRotateTapDelayMs ?? 250), Fh = o.autoRotateStopOnFullTurn ?? !0, nn = Number(o.autoRotateTurnCount ?? 1), Ah = o.autoRotateShowFps ?? !0, Th = Number(o.autoRotateFpsWindowMs ?? 1e3), Dh = o.autoRotateAdaptiveEnabled ?? !0, Ei = Number(o.autoRotateAdaptiveMaxIntervalMs ?? 1e3), Bh = Number(o.autoRotateAdaptiveStepMs ?? 10), zh = Number(o.autoRotateAdaptiveCheckMs ?? 1e3), Ph = Number(o.autoRotateAdaptiveFpsThreshold ?? 0.8), Lh = Number(o.autoRotateCalibrateMs ?? 2e3), Wh = Number(o.autoRotateCalibrateFactor ?? 0.85), Fi = o.cssFpsDebugEnabled ?? !1, Oh = Number(o.cssFpsWindowMs ?? 1e3), Ih = Number(o.cssFpsUiUpdateMs ?? 500), ua = o.cssFpsAutoLimitEnabled ?? !0, Vh = Number(o.cssFpsCalibrateMs ?? 2e3), Hh = Number(o.cssFpsLimitThreshold ?? 20), Gh = Number(o.cssFpsLimitFactor ?? 0.5), Uh = Number(o.cssFpsLimitMin ?? 1), jh = Number(o.cssFpsLimitMax ?? 30), qh = o.cssFpsLimitTextEnabled ?? !0, Ai = Number(o.cssFpsRotationStartBoost ?? 2); + this._autoRotateSpeed = Xe, this._autoRotateIntervalMs = Tt, this._autoRotateTurnCount = nn, this._autoRotateEnabled === void 0 && (this._autoRotateEnabled = Eh), this._autoRotateOffsetDeg === void 0 && (this._autoRotateOffsetDeg = 0), this._autoRotateIntervalMsDynamic === void 0 && (this._autoRotateIntervalMsDynamic = Tt), this._autoRotateFpsSamples === void 0 && (this._autoRotateFpsSamples = []), this._autoRotateFps === void 0 && (this._autoRotateFps = 0), this._autoRotateCalibrated === void 0 && (this._autoRotateCalibrated = !1), this._autoRotateAccumDeg === void 0 && (this._autoRotateAccumDeg = 0), this._autoRotateTargetDeg === void 0 && (this._autoRotateTargetDeg = 0), this._cssFps === void 0 && (this._cssFps = 0), this._cssFpsLimit === void 0 && (this._cssFpsLimit = 0), this._cssPerfLimited === void 0 && (this._cssPerfLimited = !1), this._cssFpsAutoCalibrated === void 0 && (this._cssFpsAutoCalibrated = !1), this._cssFpsMeasured === void 0 && (this._cssFpsMeasured = 0), this._cssRecalibrateRequested === void 0 && (this._cssRecalibrateRequested = !1); + const ae = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), Ti = ae() / 1e3, fa = (t, e = 0) => { const s = Math.max(1e-3, t); - return -(((Si + e) % s + s) % s); - }, Ks = (t, e = 0) => { + return -(((Ti + e) % s + s) % s); + }, da = (t, e = 0) => { const s = Math.max(1e-3, t); return -((e % s + s) % s); - }, Js = () => { + }, pa = () => { const t = Number(this._cssFpsLimit || 0); - if (!(Xs && !!this._cssPerfLimited && t > 0)) return Mt; - const s = Math.max(1, Number.isFinite(vi) ? vi : 2), n = Math.max(1, Math.round(t * s)); - return Math.max(Mt, Math.round(1e3 / n)); + if (!(ua && !!this._cssPerfLimited && t > 0)) return Tt; + const s = Math.max(1, Number.isFinite(Ai) ? Ai : 2), n = Math.max(1, Math.round(t * s)); + return Math.max(Tt, Math.round(1e3 / n)); }; - this._cssGlobalTimeSec === void 0 && (this._cssGlobalTimeSec = Qo() / 1e3); - const wi = () => { + this._cssGlobalTimeSec === void 0 && (this._cssGlobalTimeSec = ae() / 1e3); + const Di = () => { this._cssGlobalTickTimer && (clearInterval(this._cssGlobalTickTimer), this._cssGlobalTickTimer = null), this._cssGlobalTickFps = 0; - }, Ih = (t) => { + }, Yh = (t) => { const e = Math.max(1, Math.round(t)); if (this._cssGlobalTickTimer && Number(this._cssGlobalTickFps || 0) === e) return; - wi(); + Di(); const s = Math.max(1, Math.round(1e3 / e)), n = () => { var u, d; - const i = Qo() / 1e3, r = Math.floor(i * e) / e; + const i = ae() / 1e3, r = Math.floor(i * e) / e; this._cssGlobalTimeSec = r; const h = (d = (u = this.renderRoot) == null ? void 0 : u.querySelector) == null ? void 0 : d.call(u, "svg.sv-scene"); h && h.style.setProperty("--sv-global-time", r.toFixed(3)); }; n(), this._cssGlobalTickFps = e, this._cssGlobalTickTimer = setInterval(n, s); - }, Vh = () => { + }, Xh = () => { this._cssFpsRaf && (cancelAnimationFrame(this._cssFpsRaf), this._cssFpsRaf = null), this._cssFpsSamples = [], this._cssFps = 0; - }, Hh = () => { + }, Zh = () => { if (this._cssFpsRaf) return; this._cssFpsSamples = [], this._cssFpsUiLast = 0; const t = (e) => { const s = this._cssFpsSamples || []; s.push(e); - const n = e - Ah; + const n = e - Oh; for (; s.length && s[0] < n; ) s.shift(); if (this._cssFpsSamples = s, s.length >= 2) { const r = (s[s.length - 1] - s[0]) / 1e3; this._cssFps = r > 0 ? (s.length - 1) / r : 0; } const i = this._cssFpsUiLast || 0; - e - i >= Dh && (this._cssFpsUiLast = e, this._updateTimerMS = Date.now(), this.requestUpdate()), this._cssFpsRaf = requestAnimationFrame(t); + e - i >= Ih && (this._cssFpsUiLast = e, this._updateTimerMS = Date.now(), this.requestUpdate()), this._cssFpsRaf = requestAnimationFrame(t); }; this._cssFpsRaf = requestAnimationFrame(t); - }, ja = () => { + }, rn = () => { this._cssFpsCalibRaf && (cancelAnimationFrame(this._cssFpsCalibRaf), this._cssFpsCalibRaf = null), this._cssFpsAutoCalibrating = !1; - }, Gh = () => { + }, Kh = () => { if (this._cssFpsAutoCalibrated || this._cssFpsAutoCalibrating) return; this._cssFpsAutoCalibrating = !0; const t = []; let e = 0; const s = (n) => { - if (e || (e = n), t.push(n), n - e >= Bh) { - ja(); + if (e || (e = n), t.push(n), n - e >= Vh) { + rn(); let i = 0; if (t.length >= 2) { const h = (t[t.length - 1] - t[0]) / 1e3; @@ -1210,140 +1278,142 @@ const qn = class qn extends be { } this._cssFpsMeasured = i; let r = 0; - i > 0 && i < Ph && (i < 5 ? r = 1 : (r = Math.floor(i * zh), r = Math.min(Wh, Math.max(Lh, r)))), this._cssFpsLimit = r, this._cssPerfLimited = r > 0, this._cssFpsAutoCalibrated = !0, this._updateTimerMS = Date.now(), this.requestUpdate(); + i > 0 && i < Hh && (i < 5 ? r = 1 : (r = Math.floor(i * Gh), r = Math.min(jh, Math.max(Uh, r)))), this._cssFpsLimit = r, this._cssPerfLimited = r > 0, this._cssFpsAutoCalibrated = !0, this._updateTimerMS = Date.now(), this.requestUpdate(); return; } this._cssFpsCalibRaf = requestAnimationFrame(s); }; this._cssFpsCalibRaf = requestAnimationFrame(s); - }, xi = (t) => { + }, Bi = (t) => { const e = this._autoRotateFpsSamples || []; e.push(t); - const s = t - Mh; + const s = t - Th; for (; e.length && e[0] < s; ) e.shift(); if (this._autoRotateFpsSamples = e, e.length >= 2) { const n = (e[e.length - 1] - e[0]) / 1e3; this._autoRotateFps = n > 0 ? (e.length - 1) / n : 0; } - }, Ri = (t) => { - if (!this._autoRotateCalibrated || !Ch) return; + }, zi = (t) => { + if (!this._autoRotateCalibrated || !Dh) return; const e = this._autoRotateAdaptiveLastCheck || 0; - if (t - e < Nh) return; + if (t - e < zh) return; this._autoRotateAdaptiveLastCheck = t; const s = 1e3 / this._autoRotateIntervalMsDynamic; - if (this._autoRotateFps && this._autoRotateFps < s * Eh) { + if (this._autoRotateFps && this._autoRotateFps < s * Ph) { const n = Math.min( - $i, - this._autoRotateIntervalMsDynamic + kh + Ei, + this._autoRotateIntervalMsDynamic + Bh ); n !== this._autoRotateIntervalMsDynamic && (this._autoRotateIntervalMsDynamic = n, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)); } - }, Mi = (t) => { + }, Pi = (t) => { if (this._autoRotateCalibrated) return; const e = this._autoRotateCalibrateStart || t; - if (this._autoRotateCalibrateStart = e, t - e < Th) return; + if (this._autoRotateCalibrateStart = e, t - e < Lh) return; const s = this._autoRotateFps || 0; if (s > 0) { - const i = 1e3 / (s * Fh), r = Math.min( - $i, - Math.max(Js(), Math.round(i)) + const i = 1e3 / (s * Wh), r = Math.min( + Ei, + Math.max(pa(), Math.round(i)) ); r !== this._autoRotateIntervalMsDynamic && (this._autoRotateIntervalMsDynamic = r, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)); } this._autoRotateCalibrated = !0; - }, qa = () => { - this._autoRotateEnabled && (this._autoRotateLastTick = 0, this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = 0, this._autoRotateEnabled = !1, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null), this._autoRotateIntervalMsDynamic = Mt, this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._cssRecalibrateRequested = !0, this._updateTimerMS = Date.now(), this.requestUpdate()); - }, Uh = () => { - this._autoRotateEnabled || (this._manualRotateEnabled && this._stopManualRotate(), this._autoRotateEnabled = !0, this._autoRotateLastTick = Qo(), this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = xh && Ua > 0 ? Ua * 360 : 0, this._autoRotateIntervalMsDynamic = Js(), this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._autoRotateTimer || (this._autoRotateTimer = setInterval(() => { - const t = Qo(); - xi(t), Mi(t), Ri(t); - const e = this._autoRotateLastTick || t, s = Math.max(0, t - e) / 1e3, n = Ve * s; + }, cn = () => { + this._autoRotateEnabled && (this._autoRotateLastTick = 0, this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = 0, this._autoRotateEnabled = !1, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null), this._autoRotateIntervalMsDynamic = Tt, this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._cssRecalibrateRequested = !0, this._updateTimerMS = Date.now(), this.requestUpdate()); + }, Jh = () => { + this._autoRotateEnabled || (this._manualRotateEnabled && this._stopManualRotate(), this._autoRotateEnabled = !0, this._autoRotateLastTick = ae(), this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = Fh && nn > 0 ? nn * 360 : 0, this._autoRotateIntervalMsDynamic = pa(), this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._autoRotateTimer || (this._autoRotateTimer = setInterval(() => { + const t = ae(); + Bi(t), Pi(t), zi(t); + const e = this._autoRotateLastTick || t, s = Math.max(0, t - e) / 1e3, n = Xe * s; if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + n, this._autoRotateAccumDeg = (this._autoRotateAccumDeg || 0) + n, this._autoRotateLastTick = t, this._autoRotateTargetDeg > 0 && this._autoRotateAccumDeg >= this._autoRotateTargetDeg) { - qa(); + cn(); return; } this._updateTimerMS = Date.now(), this.requestUpdate(); }, this._autoRotateIntervalMsDynamic), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic), this._updateTimerMS = Date.now(), this.requestUpdate()); }; - if (this._autoRotateStop = qa, this._autoRotateStartFn = Uh, this._autoRotateHandlers || (this._autoRotateHandlers = !0, this._autoRotateLastTap = 0, this.addEventListener("pointerup", (t) => { + if (this._autoRotateStop = cn, this._autoRotateStartFn = Jh, this._autoRotateHandlers || (this._autoRotateHandlers = !0, this._autoRotateLastTap = 0, this.addEventListener("pointerup", (t) => { var i; if ((t.composedPath ? t.composedPath() : []).some((r) => { var h, u; return (u = (h = r == null ? void 0 : r.classList) == null ? void 0 : h.contains) == null ? void 0 : u.call(h, "cam-btn"); }) || t.button !== void 0 && t.button !== 0) return; const s = Date.now(), n = this._autoRotateLastTap || 0; - if (s - n < Ga) { + if (s - n < an) { this._autoRotateLastTap = 0, this._autoRotateClickTimer && clearTimeout(this._autoRotateClickTimer), (i = this._autoRotateStartFn) == null || i.call(this); return; } this._autoRotateLastTap = s, this._autoRotateClickTimer && clearTimeout(this._autoRotateClickTimer), this._autoRotateClickTimer = setTimeout(() => { var r; - this._autoRotateLastTap && Date.now() - this._autoRotateLastTap >= Ga && (this._autoRotateLastTap = 0, (r = this._autoRotateStop) == null || r.call(this)); - }, Ga + 10); + this._autoRotateLastTap && Date.now() - this._autoRotateLastTap >= an && (this._autoRotateLastTap = 0, (r = this._autoRotateStop) == null || r.call(this)); + }, an + 10); }, { capture: !1 })), this._autoRotateEnabled) { - const t = Js(); - Number(this._autoRotateIntervalMsDynamic || Mt) < t && (this._autoRotateIntervalMsDynamic = t, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)), (!this._autoRotateTimer || this._autoRotateTimerMs !== this._autoRotateIntervalMsDynamic) && (this._autoRotateTimer && clearInterval(this._autoRotateTimer), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic, this._autoRotateTimer = setInterval(() => { - const e = Qo(); - xi(e), Mi(e), Ri(e); - const s = this._autoRotateLastTick || e, n = Math.max(0, e - s) / 1e3, i = Ve * n; + const t = pa(); + Number(this._autoRotateIntervalMsDynamic || Tt) < t && (this._autoRotateIntervalMsDynamic = t, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)), (!this._autoRotateTimer || this._autoRotateTimerMs !== this._autoRotateIntervalMsDynamic) && (this._autoRotateTimer && clearInterval(this._autoRotateTimer), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic, this._autoRotateTimer = setInterval(() => { + const e = ae(); + Bi(e), Pi(e), zi(e); + const s = this._autoRotateLastTick || e, n = Math.max(0, e - s) / 1e3, i = Xe * n; if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + i, this._autoRotateAccumDeg = (this._autoRotateAccumDeg || 0) + i, this._autoRotateLastTick = e, this._autoRotateTargetDeg > 0 && this._autoRotateAccumDeg >= this._autoRotateTargetDeg) { - qa(); + cn(); return; } this._updateTimerMS = Date.now(), this.requestUpdate(); }, this._autoRotateIntervalMsDynamic)); } else this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null); - _i ? Hh() : Vh(); - const Ci = !!(this._autoRotateEnabled || this._manualRotateEnabled); - Xs && this._cssRecalibrateRequested && !Ci && (ja(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssRecalibrateRequested = !1), Xs ? Gh() : (ja(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssFpsLimit = 0, this._cssPerfLimited = !1, this._cssRecalibrateRequested = !1); - const ut = Xs && this._cssPerfLimited && Number(this._cssFpsLimit) > 0, co = ut ? Number(this._cssFpsLimit) : 0, Qs = ut && co <= 5, Ya = Hc && !Qs, Xa = bl && !(ut && co <= 1), jh = Js(); - this._rotationIntervalMsFloor = jh; - const Za = Ci, qh = ut && Za; - ut && !Za ? Ih(co) : wi(); - const ki = Number(((Ur = l.states[Ut]) == null ? void 0 : Ur.state) || 210), Ni = Number(((jr = l.states[eo]) == null ? void 0 : jr.state) || 35); - let ta = ki, oa = Ni; - const Ka = Number(this._cameraSavedBaseHOverride), Ja = Number(this._cameraSavedBaseVOverride); - Number.isFinite(Ka) && (ta = Ka, Math.abs((ki - Ka + 540) % 360 - 180) < 0.25 && (this._cameraSavedBaseHOverride = void 0)), Number.isFinite(Ja) && (oa = Ja, Math.abs(Ni - Ja) < 0.25 && (this._cameraSavedBaseVOverride = void 0)), this._autoRotateCurrentDeg = this._autoRotateOffsetDeg || 0; - const Ei = (ta + (this._autoRotateOffsetDeg || 0)) * Math.PI / 180; - this._manualRotateBaseVDeg = oa; - const Yh = Number(this._manualRotateVOffsetDeg || 0), Ro = Math.min(Math.max(oa + Yh, 0), 90); - this._savedCameraH = this._normDeg(ta), this._savedCameraV = Math.max(0, Math.min(90, oa)), this._currentCameraH = this._normDeg(ta + Number(this._autoRotateOffsetDeg || 0)), this._currentCameraV = Ro; - const Ti = Ro * Math.PI / 180, He = 5, ea = Math.cos(Ei), sa = Math.sin(Ei), aa = Math.cos(Ti), na = -Math.sin(Ti), Fi = (wt || 0) * Math.PI / 180, Ai = Math.cos(Fi), Di = Math.sin(Fi), Xh = Math.PI * 2; - function M(t, e, s) { + Fi ? Zh() : Xh(); + const Li = !!(this._autoRotateEnabled || this._manualRotateEnabled); + ua && this._cssRecalibrateRequested && !Li && (rn(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssRecalibrateRequested = !1), ua ? Kh() : (rn(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssFpsLimit = 0, this._cssPerfLimited = !1, this._cssRecalibrateRequested = !1); + const ut = ua && this._cssPerfLimited && Number(this._cssFpsLimit) > 0, lo = ut ? Number(this._cssFpsLimit) : 0, ma = ut && lo <= 5, ln = Zc && !ma, hn = xl && !(ut && lo <= 1), Qh = pa(); + this._rotationIntervalMsFloor = Qh; + const un = Li, tu = ut && un; + ut && !un ? Yh(lo) : Di(); + const Wi = Number(((nc = l.states[so]) == null ? void 0 : nc.state) || 210), Oi = Number(((ic = l.states[$o]) == null ? void 0 : ic.state) || 35); + let ba = Wi, ga = Oi; + const fn = Number(this._cameraSavedBaseHOverride), dn = Number(this._cameraSavedBaseVOverride); + Number.isFinite(fn) && (ba = fn, Math.abs((Wi - fn + 540) % 360 - 180) < 0.25 && (this._cameraSavedBaseHOverride = void 0)), Number.isFinite(dn) && (ga = dn, Math.abs(Oi - dn) < 0.25 && (this._cameraSavedBaseVOverride = void 0)), this._autoRotateCurrentDeg = this._autoRotateOffsetDeg || 0; + const Ii = Number(this._autoRotateOffsetDeg || 0), Vi = Re ? (mt - Lt + 540) % 360 - 180 : 0; + this._fixedSunSceneCompDeg = Vi; + const Hi = (ba + Ii + Vi) * Math.PI / 180; + this._manualRotateBaseVDeg = ga; + const ou = Number(this._manualRotateVOffsetDeg || 0), ko = Math.min(Math.max(ga + ou, 0), 90); + this._savedCameraH = this._normDeg(ba), this._savedCameraV = Math.max(0, Math.min(90, ga)), this._currentCameraH = this._normDeg(ba + Ii), this._currentCameraV = ko; + const Gi = ko * Math.PI / 180, Ze = 5, _a = Math.cos(Hi), ya = Math.sin(Hi), $a = Math.cos(Gi), va = -Math.sin(Gi), Ui = (Pt || 0) * Math.PI / 180, ji = Math.cos(Ui), qi = Math.sin(Ui), eu = Math.PI * 2; + function C(t, e, s) { return Math.min(s, Math.max(e, t)); } - function gt(t) { + function St(t) { const e = Math.hypot(...t); return e > 0 ? t.map((s) => s / e) : [0, 0, 0]; } - function Zh(t, e) { + function su(t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]; } function G(t) { - const e = t[0], s = t[1], n = t[2], i = e * ea - n * sa, r = e * sa + n * ea, h = s * aa - r * na, u = s * na + r * aa; + const e = t[0], s = t[1], n = t[2], i = e * _a - n * ya, r = e * ya + n * _a, h = s * $a - r * va, u = s * va + r * $a; return [i, h, u]; } - function Bi(t) { - const e = t[0], s = t[1], n = t[2], i = s * aa + n * na, r = -s * na + n * aa, h = e * ea + r * sa, u = -e * sa + r * ea; + function Yi(t) { + const e = t[0], s = t[1], n = t[2], i = s * $a + n * va, r = -s * va + n * $a, h = e * _a + r * ya, u = -e * ya + r * _a; return [h, i, u]; } - function ft(t) { - const e = t[0], s = t[1], n = t[2], i = e * Ai + n * Di, r = -e * Di + n * Ai; + function bt(t) { + const e = t[0], s = t[1], n = t[2], i = e * ji + n * qi, r = -e * qi + n * ji; return [i, s, r]; } - function ia(t) { - return G(ft(t)); + function Sa(t) { + return G(bt(t)); } function U(t) { - const e = t[0], s = t[1], n = t[2], i = He / (He + n); - return [oo + e * Tt * i, bo - s * Tt * i, n, i]; + const e = t[0], s = t[1], n = t[2], i = Ze / (Ze + n); + return [go + e * dt * i, jo - s * dt * i, n, i]; } - function Ct(t, e) { + function Dt(t, e) { const s = parseInt(t.substr(1, 2), 16), n = parseInt(t.substr(3, 2), 16), i = parseInt(t.substr(5, 2), 16), r = Math.min(255, Math.max(0, Math.round(s * e))), h = Math.min(255, Math.max(0, Math.round(n * e))), u = Math.min(255, Math.max(0, Math.round(i * e))); return `rgb(${r},${h},${u})`; } - function ra(t, e, s, n) { - const i = gt([s[0] - e[0], s[1] - e[1], s[2] - e[2]]), r = [t[0] - e[0], t[1] - e[1], t[2] - e[2]], h = Math.cos(n), u = Math.sin(n), d = [ + function xa(t, e, s, n) { + const i = St([s[0] - e[0], s[1] - e[1], s[2] - e[2]]), r = [t[0] - e[0], t[1] - e[1], t[2] - e[2]], h = Math.cos(n), u = Math.sin(n), d = [ i[1] * r[2] - i[2] * r[1], i[2] * r[0] - i[0] * r[2], i[0] * r[1] - i[1] * r[0] @@ -1354,22 +1424,22 @@ const qn = class qn extends be { ]; return [e[0] + p[0], e[1] + p[1], e[2] + p[2]]; } - function Kh(t, e, s) { + function au(t, e, s) { const n = [e[0] - t[0], e[1] - t[1], e[2] - t[2]], i = [s[0] - t[0], s[1] - t[1], s[2] - t[2]]; - return gt([ + return St([ n[1] * i[2] - n[2] * i[1], n[2] * i[0] - n[0] * i[2], n[0] * i[1] - n[1] * i[0] ]); } - function Mo(t) { + function No(t) { return t.reduce((e, s) => e + s[2], 0) / t.length; } - function Pi(t) { + function Xi(t) { const e = Number(t); return Number.isFinite(e) ? `${Math.round(e)}%` : "0%"; } - function Qa(t) { + function pn(t) { let e = 0; for (let s = 0; s < t.length; s++) { const n = (s + 1) % t.length; @@ -1377,35 +1447,35 @@ const qn = class qn extends be { } return e; } - function Jh(t, e) { + function nu(t, e) { if (!t.length || e.length < 3) return []; - const n = Qa(e) > 0, i = (u, d, f) => { + const n = pn(e) > 0, i = (u, d, f) => { const p = (f[0] - d[0]) * (u[1] - d[1]) - (f[1] - d[1]) * (u[0] - d[0]); return n ? p >= 0 : p <= 0; }, r = (u, d, f, p) => { - const m = u[0], b = u[1], g = d[0], y = d[1], x = f[0], E = f[1], T = p[0], B = p[1], z = (m - g) * (E - B) - (b - y) * (x - T); - if (Math.abs(z) < 1e-6) return d; - const I = ((m * y - b * g) * (x - T) - (m - g) * (x * B - E * T)) / z, C = ((m * y - b * g) * (E - B) - (b - y) * (x * B - E * T)) / z; - return [I, C]; + const m = u[0], b = u[1], g = d[0], _ = d[1], R = f[0], A = f[1], T = p[0], P = p[1], W = (m - g) * (A - P) - (b - _) * (R - T); + if (Math.abs(W) < 1e-6) return d; + const V = ((m * _ - b * g) * (R - T) - (m - g) * (R * P - A * T)) / W, N = ((m * _ - b * g) * (A - P) - (b - _) * (R * P - A * T)) / W; + return [V, N]; }; let h = t.slice(); for (let u = 0; u < e.length; u++) { const d = e[u], f = e[(u + 1) % e.length], p = h.slice(); if (h = [], !p.length) break; for (let m = 0; m < p.length; m++) { - const b = p[m], g = p[(m - 1 + p.length) % p.length], y = i(b, d, f), x = i(g, d, f); - y ? (x || h.push(r(g, b, d, f)), h.push(b)) : x && h.push(r(g, b, d, f)); + const b = p[m], g = p[(m - 1 + p.length) % p.length], _ = i(b, d, f), R = i(g, d, f); + _ ? (R || h.push(r(g, b, d, f)), h.push(b)) : R && h.push(r(g, b, d, f)); } } return h; } - function zi(t, e, s, n) { + function Zi(t, e, s, n) { return n > 0 && (t = -t, e = -e, s = -s, n = -n), t * n - e * s < 0 && (t = -t, e = -e), t < 0 && (t = -t, e = -e, s = -s, n = -n), { bx: t, by: e, ux: s, uy: n }; } - function Li(t, e, s, n) { + function Ki(t, e, s, n) { return t * n - e * s < 0 && (s = -s, n = -n), { bx: t, by: e, ux: s, uy: n }; } - function Wi(t, e, s, n, i = !0) { + function Ji(t, e, s, n, i = !0) { const r = U(G(t)), h = U(G([ t[0] + e[0], t[1] + e[1], @@ -1420,33 +1490,33 @@ const qn = class qn extends be { d /= p, f /= p; let m = u[0] - r[0], b = u[1] - r[1], g = Math.hypot(m, b); g < 1e-6 ? (m = -f, b = d, g = Math.hypot(m, b)) : (m /= g, b /= g); - let y = i ? zi(d, f, m, b) : Li(d, f, m, b); + let _ = i ? Zi(d, f, m, b) : Ki(d, f, m, b); if (n) { - const x = U(G([ + const R = U(G([ t[0] + n[0], t[1] + n[1], t[2] + n[2] ])); - let E = x[0] - r[0], T = x[1] - r[1], B = Math.hypot(E, T); - B > 1e-6 && (E /= B, T /= B, y.bx * E + y.by * T < 0 && (y = i ? zi(-y.bx, -y.by, -y.ux, -y.uy) : Li(-y.bx, -y.by, -y.ux, -y.uy))); + let A = R[0] - r[0], T = R[1] - r[1], P = Math.hypot(A, T); + P > 1e-6 && (A /= P, T /= P, _.bx * A + _.by * T < 0 && (_ = i ? Zi(-_.bx, -_.by, -_.ux, -_.uy) : Ki(-_.bx, -_.by, -_.ux, -_.uy))); } - return { basis: y, centerScr: r }; + return { basis: _, centerScr: r }; } - function Qh(t, e) { - const s = t[0][0], n = t[0][1], i = t[1][0], r = t[1][1], h = t[2][0], u = t[2][1], d = e[0][0], f = e[0][1], p = e[1][0], m = e[1][1], b = e[2][0], g = e[2][1], y = s * (r - u) + i * (u - n) + h * (n - r); - if (Math.abs(y) < 1e-6) return null; - const x = (d * (r - u) + p * (u - n) + b * (n - r)) / y, E = (f * (r - u) + m * (u - n) + g * (n - r)) / y, T = (d * (h - i) + p * (s - h) + b * (i - s)) / y, B = (f * (h - i) + m * (s - h) + g * (i - s)) / y, z = (d * (i * u - h * r) + p * (h * n - s * u) + b * (s * r - i * n)) / y, I = (f * (i * u - h * r) + m * (h * n - s * u) + g * (s * r - i * n)) / y; - return { a: x, b: E, c: T, d: B, e: z, f: I }; + function iu(t, e) { + const s = t[0][0], n = t[0][1], i = t[1][0], r = t[1][1], h = t[2][0], u = t[2][1], d = e[0][0], f = e[0][1], p = e[1][0], m = e[1][1], b = e[2][0], g = e[2][1], _ = s * (r - u) + i * (u - n) + h * (n - r); + if (Math.abs(_) < 1e-6) return null; + const R = (d * (r - u) + p * (u - n) + b * (n - r)) / _, A = (f * (r - u) + m * (u - n) + g * (n - r)) / _, T = (d * (h - i) + p * (s - h) + b * (i - s)) / _, P = (f * (h - i) + m * (s - h) + g * (i - s)) / _, W = (d * (i * u - h * r) + p * (h * n - s * u) + b * (s * r - i * n)) / _, V = (f * (i * u - h * r) + m * (h * n - s * u) + g * (s * r - i * n)) / _; + return { a: R, b: A, c: T, d: P, e: W, f: V }; } - function tu(t) { + function ru(t) { const e = [0, 1, 0], s = [ e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0] ]; - return gt(s); + return St(s); } - function Oi(t) { + function Qi(t) { if (t.length <= 1) return t.slice(); const e = t.slice().sort((r, h) => r.x === h.x ? r.z - h.z : r.x - h.x), s = (r, h, u) => (h.x - r.x) * (u.z - r.z) - (h.z - r.z) * (u.x - r.x), n = []; for (const r of e) { @@ -1463,13 +1533,13 @@ const qn = class qn extends be { } return i.pop(), n.pop(), n.concat(i); } - function ou(t, e, s, n, i) { + function cu(t, e, s, n, i) { if (t.length === 0) return t; const r = (f, p, m) => { const b = []; for (let g = 0; g < f.length; g++) { - const y = f[g], x = f[(g + 1) % f.length], E = p(y), T = p(x); - E && T ? b.push(x) : E && !T ? b.push(m(y, x)) : !E && T && (b.push(m(y, x)), b.push(x)); + const _ = f[g], R = f[(g + 1) % f.length], A = p(_), T = p(R); + A && T ? b.push(R) : A && !T ? b.push(m(_, R)) : !A && T && (b.push(m(_, R)), b.push(R)); } return b; }, h = (f, p, m) => { @@ -1486,7 +1556,7 @@ const qn = class qn extends be { let d = t.slice(); return d = r(d, (f) => f.x >= e, (f, p) => h(f, p, e)), d = r(d, (f) => f.x <= s, (f, p) => h(f, p, s)), d = r(d, (f) => f.z >= n, (f, p) => u(f, p, n)), d = r(d, (f) => f.z <= i, (f, p) => u(f, p, i)), d; } - function eu(t) { + function lu(t) { if (t.length <= 1) return t.slice(); const e = t.slice().sort((r, h) => r.x === h.x ? r.y - h.y : r.x - h.x), s = (r, h, u) => (h.x - r.x) * (u.y - r.y) - (h.y - r.y) * (u.x - r.x), n = []; for (const r of e) { @@ -1501,17 +1571,17 @@ const qn = class qn extends be { } return i.pop(), n.pop(), n.concat(i); } - const te = Wt * Math.PI / 180, tn = et * Math.PI / 180, Ot = gt([ - Math.cos(tn) * Math.sin(te), - Math.sin(tn), - Math.cos(tn) * Math.cos(te) - ]), on = M(et * Ss + vs, -89.9, 89.9) * Math.PI / 180, en = gt([ - Math.cos(on) * Math.sin(te), - Math.sin(on), - Math.cos(on) * Math.cos(te) + const ne = mt * Math.PI / 180, mn = ot * Math.PI / 180, Ht = St([ + Math.cos(mn) * Math.sin(ne), + Math.sin(mn), + Math.cos(mn) * Math.cos(ne) + ]), bn = C(ot * Ns + ks, -89.9, 89.9) * Math.PI / 180, gn = St([ + Math.cos(bn) * Math.sin(ne), + Math.sin(bn), + Math.cos(bn) * Math.cos(ne) ]); - G(Ot); - const vt = Ot[1] > 0.01, Ii = [ + G(Ht); + const Nt = Ht[1] > 0.01, tr = [ [-1, -1, -1], [1, -1, -1], [1, 1, -1], @@ -1520,37 +1590,37 @@ const qn = class qn extends be { [1, -1, 1], [1, 1, 1], [-1, 1, 1] - ], qt = Ii.map(ft), Ge = qt.map(G), Yt = Ge.map(U), su = [ - { id: "front", i: [4, 5, 6, 7], c: _t.front }, - { id: "right", i: [1, 5, 6, 2], c: _t.right }, - { id: "back", i: [0, 1, 2, 3], c: _t.back }, - { id: "left", i: [0, 4, 7, 3], c: _t.left }, - { id: "bottom", i: [0, 1, 5, 4], c: _t.bottom } - ], sn = { + ], Zt = tr.map(bt), Ke = Zt.map(G), Kt = Ke.map(U), hu = [ + { id: "front", i: [4, 5, 6, 7], c: kt.front }, + { id: "right", i: [1, 5, 6, 2], c: kt.right }, + { id: "back", i: [0, 1, 2, 3], c: kt.back }, + { id: "left", i: [0, 4, 7, 3], c: kt.left }, + { id: "bottom", i: [0, 1, 5, 4], c: kt.bottom } + ], _n = { front: { indices: [4, 5, 6, 7], edge: [4, 5] }, right: { indices: [1, 5, 6, 2], edge: [1, 5] }, back: { indices: [0, 1, 2, 3], edge: [0, 1] }, left: { indices: [0, 4, 7, 3], edge: [0, 4] } - }, Vi = { + }, or = { front: [0, 0, 1], right: [1, 0, 0], back: [0, 0, -1], left: [-1, 0, 0] - }, Ue = { - front: bs, - right: gs, - back: ys, - left: $s - }, je = (t) => { - if (!Xc) return 1; - const e = M(Zc, 0, 1), s = M(Kc, 1, 100), i = M(Number.isFinite(t) ? t : 0, 0, s) / s, r = Math.max(1e-3, Jc), h = Math.log(1 + r * i) / Math.log(1 + r); + }, Je = { + front: xs, + right: ws, + back: Rs, + left: Ms + }, Qe = (t) => { + if (!el) return 1; + const e = C(sl, 0, 1), s = C(al, 1, 100), i = C(Number.isFinite(t) ? t : 0, 0, s) / s, r = Math.max(1e-3, nl), h = Math.log(1 + r * i) / Math.log(1 + r); return e + (1 - e) * h; - }, lo = { - front: je(Ue.front), - right: je(Ue.right), - back: je(Ue.back), - left: je(Ue.left) - }, At = je(ve), au = { + }, ho = { + front: Qe(Je.front), + right: Qe(Je.right), + back: Qe(Je.back), + left: Qe(Je.left) + }, Wt = Qe(Me), uu = { front: [1, 0, 0], back: [1, 0, 0], right: [0, 0, 1], @@ -1560,27 +1630,27 @@ const qn = class qn extends be { [1, 1, -1], [1, 1, 1], [-1, 1, 1] - ], an = M(no, 0, ws), Co = vo && an > 0.01; - let K = ct; - if (Co) { - const t = an * Math.PI / 180; + ], yn = C(io, 0, Es), Eo = wo && yn > 0.01; + let J = ct; + if (Eo) { + const t = yn * Math.PI / 180; let e = [-1, 1, 1], s = [1, 1, 1], n = 1; H === "front" && (e = [-1, 1, 1], s = [1, 1, 1], n = 1), H === "back" && (e = [-1, 1, -1], s = [1, 1, -1], n = -1), H === "left" && (e = [-1, 1, -1], s = [-1, 1, 1], n = 1), H === "right" && (e = [1, 1, -1], s = [1, 1, 1], n = -1); const i = t * n; - K = ct.map((r) => ra(r, e, s, i)); - } - const qe = K.map(ft), Hi = qe.map(G), ca = Hi.map(U); - let nn = Kh(K[0], K[1], K[2]); - nn[1] < 0 && (nn = nn.map((t) => -t)); - const Gi = Qa(ca), la = Gi < 0; - Rt ? this._roofWindingFront = la : this._roofWindingFront === void 0 ? this._roofWindingFront = la : Math.abs(Gi) > 20 && (this._roofWindingFront = la); - const ho = Rt ? la : this._roofWindingFront; - let rn = null; - const Ye = (t, e) => /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t) ? Ct(t, e) : t; - let Ui = !1, cn = !0, ha = !1; - const Xt = []; - if (Rt) { - const t = Math.max(0, Rs), e = Math.max(0, Cs), s = Math.max(0.01, Ms), n = 1 + e, i = n + s; + J = ct.map((r) => xa(r, e, s, i)); + } + const ts = J.map(bt), er = ts.map(G), wa = er.map(U); + let $n = au(J[0], J[1], J[2]); + $n[1] < 0 && ($n = $n.map((t) => -t)); + const sr = pn(wa), Ra = sr < 0; + At ? this._roofWindingFront = Ra : this._roofWindingFront === void 0 ? this._roofWindingFront = Ra : Math.abs(sr) > 20 && (this._roofWindingFront = Ra); + const uo = At ? Ra : this._roofWindingFront; + let vn = null; + const os = (t, e) => /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t) ? Dt(t, e) : t; + let ar = !1, Sn = !0, Ma = !1; + const Jt = []; + if (At) { + const t = Math.max(0, As), e = Math.max(0, Ds), s = Math.max(0.01, Ts), n = 1 + e, i = n + s; let r = [ [-1 - t, i, -1 - t], [1 + t, i, -1 - t], @@ -1597,26 +1667,26 @@ const qn = class qn extends be { [1, n, 1], [-1, n, 1] ]; - if (Co) { - const C = an * Math.PI / 180; - let _ = [-1, n, 1], R = [1, n, 1], L = 1; - H === "front" && (_ = [-1, n, 1], R = [1, n, 1], L = 1), H === "back" && (_ = [-1, n, -1], R = [1, n, -1], L = -1), H === "left" && (_ = [-1, n, -1], R = [-1, n, 1], L = 1), H === "right" && (_ = [1, n, -1], R = [1, n, 1], L = -1); - const A = C * L; - r = r.map((j) => ra(j, _, R, A)), h = h.map((j) => ra(j, _, R, A)), u = u.map((j) => ra(j, _, R, A)); + if (Eo) { + const N = yn * Math.PI / 180; + let v = [-1, n, 1], M = [1, n, 1], I = 1; + H === "front" && (v = [-1, n, 1], M = [1, n, 1], I = 1), H === "back" && (v = [-1, n, -1], M = [1, n, -1], I = -1), H === "left" && (v = [-1, n, -1], M = [-1, n, 1], I = 1), H === "right" && (v = [1, n, -1], M = [1, n, 1], I = -1); + const D = N * I; + r = r.map((q) => xa(q, v, M, D)), h = h.map((q) => xa(q, v, M, D)), u = u.map((q) => xa(q, v, M, D)); } - const d = r.map(ft), f = h.map(ft); - rn = d; - const p = d.map((C) => G(C)), m = f.map((C) => G(C)), b = p.map((C) => U(C)), g = m.map((C) => U(C)), y = Mo(g) - Mo(b); - this._flatRoofBottomCloser === void 0 ? this._flatRoofBottomCloser = y < 0 : y < -0.01 ? this._flatRoofBottomCloser = !0 : y > 0.01 && (this._flatRoofBottomCloser = !1), Ui = !!this._flatRoofBottomCloser; - const x = Ye(xe, At); - Xt.push({ + const d = r.map(bt), f = h.map(bt); + vn = d; + const p = d.map((N) => G(N)), m = f.map((N) => G(N)), b = p.map((N) => U(N)), g = m.map((N) => U(N)), _ = No(g) - No(b); + this._flatRoofBottomCloser === void 0 ? this._flatRoofBottomCloser = _ < 0 : _ < -0.01 ? this._flatRoofBottomCloser = !0 : _ > 0.01 && (this._flatRoofBottomCloser = !1), ar = !!this._flatRoofBottomCloser; + const R = os(Ne, Wt); + Jt.push({ type: "flatRoofTop", pts: b, - z: Mo(b) - ke, - fill: x, - opacity: Ce + z: No(b) - Te, + fill: R, + opacity: Ae }); - const E = [ + const A = [ { id: "front", pts: [b[3], b[2], g[2], g[3]], @@ -1637,263 +1707,263 @@ const qn = class qn extends be { pts: [b[0], b[3], g[3], g[0]], cam: [p[0], p[3], m[3], m[0]] } - ], T = [...p, ...m].reduce((C, _) => [C[0] + _[0], C[1] + _[1], C[2] + _[2]], [0, 0, 0]).map((C) => C / 8); - E.forEach((C) => { - const _ = lo[C.id] ?? At, R = M(_, 0.2, 1), L = Math.min(...C.pts.map((lt) => lt[2])), A = C.cam.reduce((lt, Gt) => [lt[0] + Gt[0], lt[1] + Gt[1], lt[2] + Gt[2]], [0, 0, 0]).map((lt) => lt / 4), j = gt([A[0] - T[0], A[1] - T[1], A[2] - T[2]]), st = gt([-A[0], -A[1], -He - A[2]]); - Zh(j, st) > -0.02 && Xt.push({ - type: `flatRoofEdge-${C.id}`, - pts: C.pts, - z: L - Ne, - fill: Ye(xe, R), - opacity: Zo + ], T = [...p, ...m].reduce((N, v) => [N[0] + v[0], N[1] + v[1], N[2] + v[2]], [0, 0, 0]).map((N) => N / 8); + A.forEach((N) => { + const v = ho[N.id] ?? Wt, M = C(v, 0.2, 1), I = Math.min(...N.pts.map((lt) => lt[2])), D = N.cam.reduce((lt, qt) => [lt[0] + qt[0], lt[1] + qt[1], lt[2] + qt[2]], [0, 0, 0]).map((lt) => lt / 4), q = St([D[0] - T[0], D[1] - T[1], D[2] - T[2]]), et = St([-D[0], -D[1], -Ze - D[2]]); + su(q, et) > -0.02 && Jt.push({ + type: `flatRoofEdge-${N.id}`, + pts: N.pts, + z: I - De, + fill: os(Ne, M), + opacity: oe }); }); - const B = lo[H] ?? At; - if (Xt.push({ + const P = ho[H] ?? Wt; + if (Jt.push({ type: "flatRoofBottom", pts: g, - z: Mo(g), - fill: Ye(Re, Math.max(0.2, B * Me * si)), - opacity: Zo - }), Co) { - const _ = u.map(ft).map((j) => U(G(j))), R = [Yt[3], Yt[2], Yt[6], Yt[7]], L = (j) => { - const st = lo[j] ?? 1; - return Ye(Re, M(st * Me, 0.2, 1)); - }, A = (j, st, pt) => { - const lt = Math.max(...st.map((Gt) => Gt[2])); - Xt.push({ - type: pt, - pts: st, + z: No(g), + fill: os(Ee, Math.max(0.2, P * Fe * pi)), + opacity: oe + }), Eo) { + const v = u.map(bt).map((q) => U(G(q))), M = [Kt[3], Kt[2], Kt[6], Kt[7]], I = (q) => { + const et = ho[q] ?? 1; + return os(Ee, C(et * Fe, 0.2, 1)); + }, D = (q, et, yt) => { + const lt = Math.max(...et.map((qt) => qt[2])); + Jt.push({ + type: yt, + pts: et, // Keep connector skirts behind the roof overhang edges at corner views. - z: lt + Math.max(ks, 0.02), - fill: L(j), - opacity: za + z: lt + Math.max(Bs, 0.02), + fill: I(q), + opacity: Ka }); }; - H === "front" ? (A("left", [_[0], R[0], _[3]], "flatRoofSkirt-left"), A("right", [_[1], R[1], _[2]], "flatRoofSkirt-right"), A("back", [_[0], _[1], R[1], R[0]], "flatRoofSkirt-back")) : H === "back" ? (A("left", [_[3], R[3], _[0]], "flatRoofSkirt-left"), A("right", [_[2], R[2], _[1]], "flatRoofSkirt-right"), A("front", [_[2], _[3], R[3], R[2]], "flatRoofSkirt-front")) : H === "left" ? (A("front", [_[2], R[2], _[3]], "flatRoofSkirt-front"), A("back", [_[1], R[1], _[0]], "flatRoofSkirt-back"), A("right", [_[1], _[2], R[2], R[1]], "flatRoofSkirt-right")) : H === "right" && (A("front", [_[3], R[3], _[2]], "flatRoofSkirt-front"), A("back", [_[0], R[0], _[1]], "flatRoofSkirt-back"), A("left", [_[0], _[3], R[3], R[0]], "flatRoofSkirt-left")), e > 1e-3 && (H === "front" ? A("front", [_[3], _[2], R[2], R[3]], "flatRoofSkirt-front-low") : H === "back" ? A("back", [_[0], _[1], R[1], R[0]], "flatRoofSkirt-back-low") : H === "left" ? A("left", [_[0], _[3], R[3], R[0]], "flatRoofSkirt-left-low") : H === "right" && A("right", [_[1], _[2], R[2], R[1]], "flatRoofSkirt-right-low")); + H === "front" ? (D("left", [v[0], M[0], v[3]], "flatRoofSkirt-left"), D("right", [v[1], M[1], v[2]], "flatRoofSkirt-right"), D("back", [v[0], v[1], M[1], M[0]], "flatRoofSkirt-back")) : H === "back" ? (D("left", [v[3], M[3], v[0]], "flatRoofSkirt-left"), D("right", [v[2], M[2], v[1]], "flatRoofSkirt-right"), D("front", [v[2], v[3], M[3], M[2]], "flatRoofSkirt-front")) : H === "left" ? (D("front", [v[2], M[2], v[3]], "flatRoofSkirt-front"), D("back", [v[1], M[1], v[0]], "flatRoofSkirt-back"), D("right", [v[1], v[2], M[2], M[1]], "flatRoofSkirt-right")) : H === "right" && (D("front", [v[3], M[3], v[2]], "flatRoofSkirt-front"), D("back", [v[0], M[0], v[1]], "flatRoofSkirt-back"), D("left", [v[0], v[3], M[3], M[0]], "flatRoofSkirt-left")), e > 1e-3 && (H === "front" ? D("front", [v[3], v[2], M[2], M[3]], "flatRoofSkirt-front-low") : H === "back" ? D("back", [v[0], v[1], M[1], M[0]], "flatRoofSkirt-back-low") : H === "left" ? D("left", [v[0], v[3], M[3], M[0]], "flatRoofSkirt-left-low") : H === "right" && D("right", [v[1], v[2], M[2], M[1]], "flatRoofSkirt-right-low")); } - const z = Xt.find((C) => C.type === "flatRoofTop"), I = Xt.find((C) => C.type === "flatRoofBottom"); - if (ha = Ui || !ho, cn = !ha, z && I && (ha ? (z.opacity = 0, I.opacity = Zo) : (z.opacity = Ce, I.opacity = 0)), z && cn) { - const C = Xt.filter((_) => _ !== z); - if (C.length) { - const _ = Math.min(...C.map((R) => R.z)); - z.z = Math.min(z.z, _ - Math.max(0.015, ke)); + const W = Jt.find((N) => N.type === "flatRoofTop"), V = Jt.find((N) => N.type === "flatRoofBottom"); + if (Ma = ar || !uo, Sn = !Ma, W && V && (Ma ? (W.opacity = 0, V.opacity = oe) : (W.opacity = Ae, V.opacity = 0)), W && Sn) { + const N = Jt.filter((v) => v !== W); + if (N.length) { + const v = Math.min(...N.map((M) => M.z)); + W.z = Math.min(W.z, v - Math.max(0.015, Te)); } } - if (I && ha) { - const C = Xt.filter((_) => _ !== I); - if (C.length) { - const _ = Math.max(...C.map((R) => R.z)); - I.z = Math.max(I.z, _ + Math.max(0.02, Ne)); + if (V && Ma) { + const N = Jt.filter((v) => v !== V); + if (N.length) { + const v = Math.max(...N.map((M) => M.z)); + V.z = Math.max(V.z, v + Math.max(0.02, De)); } } } - const ln = Rt ? cn : ho; - let Xe = []; - Co && Dl && (H === "front" ? Xe = [ - { tri: [K[0], ct[0], K[3]], wall: "left" }, - { tri: [K[1], ct[1], K[2]], wall: "right" } - ] : H === "back" ? Xe = [ - { tri: [K[3], ct[3], K[0]], wall: "left" }, - { tri: [K[2], ct[2], K[1]], wall: "right" } - ] : H === "left" ? Xe = [ - { tri: [K[2], ct[2], K[3]], wall: "front" }, - { tri: [K[1], ct[1], K[0]], wall: "back" } - ] : H === "right" && (Xe = [ - { tri: [K[3], ct[3], K[2]], wall: "front" }, - { tri: [K[0], ct[0], K[1]], wall: "back" } + const xn = At ? Sn : uo; + let es = []; + Eo && Il && (H === "front" ? es = [ + { tri: [J[0], ct[0], J[3]], wall: "left" }, + { tri: [J[1], ct[1], J[2]], wall: "right" } + ] : H === "back" ? es = [ + { tri: [J[3], ct[3], J[0]], wall: "left" }, + { tri: [J[2], ct[2], J[1]], wall: "right" } + ] : H === "left" ? es = [ + { tri: [J[2], ct[2], J[3]], wall: "front" }, + { tri: [J[1], ct[1], J[0]], wall: "back" } + ] : H === "right" && (es = [ + { tri: [J[3], ct[3], J[2]], wall: "front" }, + { tri: [J[0], ct[0], J[1]], wall: "back" } ])); - const nu = Xe.map((t) => ({ - pts: t.tri.map((e) => U(ia(e))), + const fu = es.map((t) => ({ + pts: t.tri.map((e) => U(Sa(e))), wall: t.wall - })), hn = (t) => { - const e = lo[t] ?? At, s = _t[t] ?? _t.top; - return Ct(s, Bl * e); - }, iu = lo[H] ?? At, ru = _t[H] ?? _t.top, cu = Ct(ru, si * iu), lu = Ct(_t.top, At); - let oe = null, ee = null; - Co && Pl && (H === "front" ? (oe = [K[0], K[1], ct[1], ct[0]], ee = "back") : H === "back" ? (oe = [K[2], K[3], ct[3], ct[2]], ee = "front") : H === "left" ? (oe = [K[1], K[2], ct[2], ct[1]], ee = "right") : H === "right" && (oe = [K[0], K[3], ct[3], ct[0]], ee = "left")); - const un = oe ? oe.map((t) => U(ia(t))) : null, hu = hn(ee || H); - let It = [0, 0, -1]; - H === "front" && (It = [0, 0, -1]), H === "back" && (It = [0, 0, 1]), H === "left" && (It = [1, 0, 0]), H === "right" && (It = [-1, 0, 0]); - const se = K.reduce((t, e) => [t[0] + e[0], t[1] + e[1], t[2] + e[2]], [0, 0, 0]).map((t) => t / 4), ae = 2.2; - U(ia([ - se[0] - It[0] * ae, - se[1] - It[1] * ae, - se[2] - It[2] * ae - ])), U(ia([ - se[0] + It[0] * ae, - se[1] + It[1] * ae, - se[2] + It[2] * ae + })), wn = (t) => { + const e = ho[t] ?? Wt, s = kt[t] ?? kt.top; + return Dt(s, Vl * e); + }, du = ho[H] ?? Wt, pu = kt[H] ?? kt.top, mu = Dt(pu, pi * du), bu = Dt(kt.top, Wt); + let ie = null, re = null; + Eo && Hl && (H === "front" ? (ie = [J[0], J[1], ct[1], ct[0]], re = "back") : H === "back" ? (ie = [J[2], J[3], ct[3], ct[2]], re = "front") : H === "left" ? (ie = [J[1], J[2], ct[2], ct[1]], re = "right") : H === "right" && (ie = [J[0], J[3], ct[3], ct[0]], re = "left")); + const Rn = ie ? ie.map((t) => U(Sa(t))) : null, gu = wn(re || H); + let Gt = [0, 0, -1]; + H === "front" && (Gt = [0, 0, -1]), H === "back" && (Gt = [0, 0, 1]), H === "left" && (Gt = [1, 0, 0]), H === "right" && (Gt = [-1, 0, 0]); + const ce = J.reduce((t, e) => [t[0] + e[0], t[1] + e[1], t[2] + e[2]], [0, 0, 0]).map((t) => t / 4), le = 2.2; + U(Sa([ + ce[0] - Gt[0] * le, + ce[1] - Gt[1] * le, + ce[2] - Gt[2] * le + ])), U(Sa([ + ce[0] + Gt[0] * le, + ce[1] + Gt[1] * le, + ce[2] + Gt[2] * le ])); - const Z = -1, fn = -1, ji = [ - [-ot, Z, -ot], - [ot, Z, -ot], - [ot, Z, ot], - [-ot, Z, ot] + const K = -1, Mn = -1, nr = [ + [-at, K, -at], + [at, K, -at], + [at, K, at], + [-at, K, at] ].map(G).map(U); - let dn = null; - if (Ra) { - const t = 1 + Math.max(0, Ec); - dn = [0, 1, 5, 4].map((i) => { - const r = qt[i]; - return [r[0] * t, Z, r[2] * t]; + let Cn = null; + if (Xt) { + const t = 1 + Math.max(0, Pc); + Cn = [0, 1, 5, 4].map((i) => { + const r = Zt[i]; + return [r[0] * t, K, r[2] * t]; }).map((i) => U(G(i))).map((i) => i[0] + "," + i[1]).join(" "); } - const uu = Math.min(...ji.map((t) => t[1])), qi = M(uu - 6, tt * 0.32, tt * 0.82); - this._skyClipBottom === void 0 || this._skyClipCardW !== J || this._skyClipCardH !== tt ? (this._skyClipBottom = qi, this._skyClipVertDeg = Ro, this._skyClipCardW = J, this._skyClipCardH = tt) : Math.abs(Ro - (this._skyClipVertDeg ?? Ro)) > 0.15 && (this._skyClipBottom = qi, this._skyClipVertDeg = Ro); - const Ze = Number(this._skyClipBottom), ko = [ - en[0] * qo, - en[1] * qo, - en[2] * qo - ], Yi = G(ko), it = U(Yi), fu = Ge.reduce((t, e) => t + e[2], 0) / Ge.length, du = Yi[2] > fu + 0.02, No = it[3], pu = Math.max(4, 12 * No), mu = Math.max(3, 8 * No), pn = M(ol - Ro / 90 * el, 0.1, 0.9), bu = M(pn - oi, 0, 1), gu = M(pn, 0, 1), yu = M(pn + oi, 0, 1), Zt = (t, e) => { + const _u = Math.min(...nr.map((t) => t[1])), ir = C(_u - 6, Q * 0.32, Q * 0.82); + this._skyClipBottom === void 0 || this._skyClipCardW !== Z || this._skyClipCardH !== Q ? (this._skyClipBottom = ir, this._skyClipVertDeg = ko, this._skyClipCardW = Z, this._skyClipCardH = Q) : Math.abs(ko - (this._skyClipVertDeg ?? ko)) > 0.15 && (this._skyClipBottom = ir, this._skyClipVertDeg = ko); + const ss = Number(this._skyClipBottom), Fo = [ + gn[0] * Jo, + gn[1] * Jo, + gn[2] * Jo + ], rr = G(Fo), rt = U(rr), yu = Ke.reduce((t, e) => t + e[2], 0) / Ke.length, $u = rr[2] > yu + 0.02, Ao = rt[3], vu = Math.max(4, 12 * Ao), Su = Math.max(3, 8 * Ao), kn = C(cl - ko / 90 * ll, 0.1, 0.9), xu = C(kn - fi, 0, 1), wu = C(kn, 0, 1), Ru = C(kn + fi, 0, 1), Qt = (t, e) => { const s = Array.isArray(t) ? t : e; return [ - M(Number((s == null ? void 0 : s[0]) ?? e[0]), 0, 255), - M(Number((s == null ? void 0 : s[1]) ?? e[1]), 0, 255), - M(Number((s == null ? void 0 : s[2]) ?? e[2]), 0, 255) + C(Number((s == null ? void 0 : s[0]) ?? e[0]), 0, 255), + C(Number((s == null ? void 0 : s[1]) ?? e[1]), 0, 255), + C(Number((s == null ? void 0 : s[2]) ?? e[2]), 0, 255) ]; - }, ne = (t, e, s) => [ + }, he = (t, e, s) => [ Math.round(t[0] + (e[0] - t[0]) * s), Math.round(t[1] + (e[1] - t[1]) * s), Math.round(t[2] + (e[2] - t[2]) * s) - ], Xi = Number(this._prevSunEl); - let ie = Number(this._skyTrend); - if (Number.isFinite(ie) || (ie = -1), Number.isFinite(Xi)) { - const t = et - Xi; - t < -0.03 ? ie = -1 : t > 0.03 && (ie = 1); - } - this._prevSunEl = et, this._skyTrend = ie; - const mn = ie < 0, re = Math.max(1, il), bn = M((et + re) / (2 * re), 0, 1), $u = M(1 - Math.abs(et) / re, 0, 1), gn = Math.pow($u, 0.85), Ke = M((-et + 1.5) / (re + 5), 0, 1), ua = Oe ? M((-et - 1.2) / (re + 3), 0, 1) : 0, uo = Ba ? M((-et + 0.2) / (re + 2), 0, 1) : 0, _u = M(yl, 0.05, 0.95), vu = M($l, 0.05, 0.95), Eo = _u * J, To = vu * tt, Vt = M(_l, 6, 44), Su = M(vl, 0, 1), ce = M(uo * Sl, 0, 1), wu = M(Ml, 0.5, 89.5), Zi = (Cl + 180) * Math.PI / 180, yn = wu * Math.PI / 180, xu = gt([ - Math.sin(Zi) * Math.cos(yn), - Math.sin(yn), - -Math.cos(Zi) * Math.cos(yn) + ], cr = Number(this._prevSunEl); + let ue = Number(this._skyTrend); + if (Number.isFinite(ue) || (ue = -1), Number.isFinite(cr)) { + const t = ot - cr; + t < -0.03 ? ue = -1 : t > 0.03 && (ue = 1); + } + this._prevSunEl = ot, this._skyTrend = ue; + const Nn = ue < 0, fe = Math.max(1, dl), En = C((ot + fe) / (2 * fe), 0, 1), Mu = C(1 - Math.abs(ot) / fe, 0, 1), Fn = Math.pow(Mu, 0.85), as = C((-ot + 1.5) / (fe + 5), 0, 1), Ca = qe ? C((-ot - 1.2) / (fe + 3), 0, 1) : 0, fo = Xa ? C((-ot + 0.2) / (fe + 2), 0, 1) : 0, Cu = C(Rl, 0.05, 0.95), ku = C(Ml, 0.05, 0.95), To = Cu * Z, Do = ku * Q, Ut = C(Cl, 6, 44), Nu = C(kl, 0, 1), de = C(fo * Nl, 0, 1), Eu = C(Tl, 0.5, 89.5), lr = (Dl + 180) * Math.PI / 180, An = Eu * Math.PI / 180, Fu = St([ + Math.sin(lr) * Math.cos(An), + Math.sin(An), + -Math.cos(lr) * Math.cos(An) ]); - let Ht = gt(Bi(xu)); - Ht[1] < 0.06 && (Ht = gt([Ht[0], 0.06, Ht[2]])); - const Ru = Zt(sl, [120, 170, 220]), Mu = Zt(al, [255, 210, 150]), Cu = Zt(nl, [70, 80, 95]), ku = Zt(rl, [12, 20, 42]), Nu = Zt(cl, [32, 44, 82]), Eu = Zt(ll, [6, 10, 22]), Tu = Zt(mn ? dl : hl, [108, 128, 188]), Fu = Zt(mn ? pl : ul, [246, 146, 112]), Au = Zt(mn ? ml : fl, [84, 62, 84]), Du = ne(ku, Ru, bn), Bu = ne(Nu, Mu, bn), Pu = ne(Eu, Cu, bn), $n = ne(Du, Tu, gn * 0.82), zu = ne(Bu, Fu, gn * 0.95), Ki = ne(Pu, Au, gn * 0.68), St = ot * (1 - 0.05), fa = 64; - let le = this._ringUnit; - (!le || le.length !== fa) && (le = Array.from({ length: fa }, (t, e) => { - const s = e / fa * Xh; + let jt = St(Yi(Fu)); + jt[1] < 0.06 && (jt = St([jt[0], 0.06, jt[2]])); + const Au = Qt(hl, [120, 170, 220]), Tu = Qt(ul, [255, 210, 150]), Du = Qt(fl, [70, 80, 95]), Bu = Qt(pl, [12, 20, 42]), zu = Qt(ml, [32, 44, 82]), Pu = Qt(bl, [6, 10, 22]), Lu = Qt(Nn ? $l : gl, [108, 128, 188]), Wu = Qt(Nn ? vl : _l, [246, 146, 112]), Ou = Qt(Nn ? Sl : yl, [84, 62, 84]), Iu = he(Bu, Au, En), Vu = he(zu, Tu, En), Hu = he(Pu, Du, En), Tn = he(Iu, Lu, Fn * 0.82), Gu = he(Vu, Wu, Fn * 0.95), hr = he(Hu, Ou, Fn * 0.68), Et = at * (1 - 0.05), ka = 64; + let pe = this._ringUnit; + (!pe || pe.length !== ka) && (pe = Array.from({ length: ka }, (t, e) => { + const s = e / ka * eu; return [Math.sin(s), Math.cos(s)]; - }), this._ringUnit = le); - const Ji = Math.min(Ll, St * 0.3), Qi = St - Ji, Lu = St + Ji; - function _n(t) { - return le.map(([e, s]) => { - const n = G([t * e, Z, t * s]), i = U(n); + }), this._ringUnit = pe); + const ur = Math.min(Ul, Et * 0.3), fr = Et - ur, Uu = Et + ur; + function Dn(t) { + return pe.map(([e, s]) => { + const n = G([t * e, K, t * s]), i = U(n); return i[0] + "," + i[1]; }); } - const Wu = _n(Qi), Ou = _n(St), Iu = _n(Lu); - let tr = []; - ri && (tr = le.map(([t, e], s) => { - const n = s % (fa / 4) === 0, i = n ? Gl : Hl, r = Qi, h = r - i, u = U(G([h * t, Z, h * e])), d = U(G([r * t, Z, r * e])); + const ju = Dn(fr), qu = Dn(Et), Yu = Dn(Uu); + let dr = []; + _i && (dr = pe.map(([t, e], s) => { + const n = s % (ka / 4) === 0, i = n ? Kl : Zl, r = fr, h = r - i, u = U(G([h * t, K, h * e])), d = U(G([r * t, K, r * e])); return { pIn: u, pOut: d, isMajor: n }; })); - const Vu = [["N", 0], ["E", Math.PI / 2], ["S", Math.PI], ["W", 3 * Math.PI / 2]], or = St * (1 - jl), Hu = Vu.map(([t, e]) => { - const s = G([or * Math.sin(e), Z, or * Math.cos(e)]), n = U(s), i = M(n[3] * ql, Yl, Xl); + const Xu = [["N", 0], ["E", Math.PI / 2], ["S", Math.PI], ["W", 3 * Math.PI / 2]], pr = Et * (1 - Ql), Zu = Xu.map(([t, e]) => { + const s = G([pr * Math.sin(e), K, pr * Math.cos(e)]), n = U(s), i = C(n[3] * th, oh, eh); return { t, x: n[0], y: n[1], scale: i }; - }), fo = gt([Math.sin(te), 0, Math.cos(te)]), da = gt([Ht[0], 0, Ht[2]]), Gu = G([fo[0] * St * 0.25, Z, fo[2] * St * 0.25]), Uu = G([fo[0] * St * 0.95, Z, fo[2] * St * 0.95]), Fo = U(Gu), Ao = U(Uu), ju = M(Fo[3] * ci, li, hi), vn = M(Ao[3] * ci, li, hi), qu = ui * ju, Yu = ui * vn, Do = Kl * vn, er = [ - { id: "front", label: "Front", normal: [0, 0, 1], pos: [0, Z, 1 + qs] }, - { id: "back", label: "Back", normal: [0, 0, -1], pos: [0, Z, -1 - qs] }, - { id: "right", label: "Right", normal: [1, 0, 0], pos: [1 + qs, Z, 0] }, - { id: "left", label: "Left", normal: [-1, 0, 0], pos: [-1 - qs, Z, 0] } - ], Sn = {}, wn = {}; - er.forEach((t) => { - const e = G(ft(t.normal)); - Sn[t.id] = e[2] < di; - const s = sn[t.id]; + }), po = St([Math.sin(ne), 0, Math.cos(ne)]), Na = St([jt[0], 0, jt[2]]), Ku = G([po[0] * Et * 0.25, K, po[2] * Et * 0.25]), Ju = G([po[0] * Et * 0.95, K, po[2] * Et * 0.95]), Bo = U(Ku), zo = U(Ju), Qu = C(Bo[3] * yi, $i, vi), Bn = C(zo[3] * yi, $i, vi), tf = Si * Qu, of = Si * Bn, Po = ah * Bn, mr = [ + { id: "front", label: "Front", normal: [0, 0, 1], pos: [0, K, 1 + la] }, + { id: "back", label: "Back", normal: [0, 0, -1], pos: [0, K, -1 - la] }, + { id: "right", label: "Right", normal: [1, 0, 0], pos: [1 + la, K, 0] }, + { id: "left", label: "Left", normal: [-1, 0, 0], pos: [-1 - la, K, 0] } + ], zn = {}, Pn = {}; + mr.forEach((t) => { + const e = G(bt(t.normal)); + zn[t.id] = e[2] < wi; + const s = _n[t.id]; if (s) { - const n = s.indices.map((r) => Yt[r]), i = Math.abs(Qa(n)); - wn[t.id] = e[2] < ch && i > lh; + const n = s.indices.map((r) => Kt[r]), i = Math.abs(pn(n)); + Pn[t.id] = e[2] < mh && i > bh; } else - wn[t.id] = Sn[t.id]; + Pn[t.id] = zn[t.id]; }); - let Je = null; - const xn = Math.max(0.1, kl), sr = M((et + xn) / (2 * xn), 0, 1), Rn = Ot[1] > 0.01 ? Ot : gt([Ot[0], 0.01, Ot[2]]), Xu = et > -xn ? 1 : 0, Zu = Ie && uo > 0.03 && Ht[1] > 0.01 ? 1 : 0, ar = sr * Xu, nr = (1 - sr) * Zu, pa = ar + nr, Qe = pa > 1e-6 ? ar / pa : 0, he = pa > 1e-6 ? nr / pa : 0, Mn = Qe > 0 || he > 0 ? gt([ - Rn[0] * Qe + Ht[0] * he, - Rn[1] * Qe + Ht[1] * he, - Rn[2] * Qe + Ht[2] * he - ]) : Ot; - if (xa && (Qe > 0 || he > 0)) { - const t = [-Mn[0], -Mn[1], -Mn[2]]; + let ns = null; + const Ln = Math.max(0.1, Bl), br = C((ot + Ln) / (2 * Ln), 0, 1), Wn = Ht[1] > 0.01 ? Ht : St([Ht[0], 0.01, Ht[2]]), ef = ot > -Ln ? 1 : 0, sf = Ye && fo > 0.03 && jt[1] > 0.01 ? 1 : 0, gr = br * ef, _r = (1 - br) * sf, Ea = gr + _r, is = Ea > 1e-6 ? gr / Ea : 0, me = Ea > 1e-6 ? _r / Ea : 0, On = is > 0 || me > 0 ? St([ + Wn[0] * is + jt[0] * me, + Wn[1] * is + jt[1] * me, + Wn[2] * is + jt[2] * me + ]) : Ht; + if (se && (is > 0 || me > 0)) { + const t = [-On[0], -On[1], -On[2]]; if (Math.abs(t[1]) > 1e-6) { - const e = [], s = Co ? qt.concat(qe) : qt; + const e = [], s = Eo ? Zt.concat(ts) : Zt; for (const i of s) { - const r = (fn - i[1]) / t[1]; + const r = (Mn - i[1]) / t[1]; r >= 0 && e.push({ x: i[0] + t[0] * r, z: i[2] + t[2] * r }); } - const n = Oi(e); + const n = Qi(e); if (n.length >= 3) { - const i = M(Zn, 0, 0.2), r = ot * (1 - i), h = ou(n, -r, r, -r, r); - h.length >= 3 && (Je = h.map((u) => U(G([u.x, fn, u.z])))); + const i = C(X, 0, 0.2), r = at * (1 - i), h = cu(n, -r, r, -r, r); + h.length >= 3 && (ns = h.map((u) => U(G([u.x, Mn, u.z])))); } } } - const ir = Je ? Je.map((t) => t[0] + "," + t[1]).join(" ") : null; - let ts = null, os = null; - if (Ma && vt) { - const e = Math.hypot(ot * 2, ot * 2) * Fc, s = [fo[0] * St * 0.95, Z, fo[2] * St * 0.95], n = [ - s[0] - fo[0] * e, - Z, - s[2] - fo[2] * e + const yr = ns ? ns.map((t) => t[0] + "," + t[1]).join(" ") : null; + let rs = null, cs = null; + if (Oa && Nt) { + const e = Math.hypot(at * 2, at * 2) * Wc, s = [po[0] * Et * 0.95, K, po[2] * Et * 0.95], n = [ + s[0] - po[0] * e, + K, + s[2] - po[2] * e ], i = G(s), r = G(n); - ts = U(i), os = U(r); - } - let es = null, ss = null; - if (Ie && !vt && uo > 0.03) { - const e = Math.hypot(ot * 2, ot * 2) * xl, s = [da[0] * St * 0.9, Z, da[2] * St * 0.9], n = [ - s[0] - da[0] * e, - Z, - s[2] - da[2] * e + rs = U(i), cs = U(r); + } + let ls = null, hs = null; + if (Ye && !Nt && fo > 0.03) { + const e = Math.hypot(at * 2, at * 2) * Fl, s = [Na[0] * Et * 0.9, K, Na[2] * Et * 0.9], n = [ + s[0] - Na[0] * e, + K, + s[2] - Na[2] * e ]; - es = U(G(s)), ss = U(G(n)); + ls = U(G(s)), hs = U(G(n)); } - const rr = `sv-beam-flow-${Math.round((Na + Ea) * 10)}`, cr = `sv-sun-ray-${Math.round((Ta + Fa) * 10)}`, lr = `sv-cloud-drift-${Math.round(J)}-${Math.round(tt)}`, Ku = Number(o.sunBeamRaySpacingPx ?? 40), Ju = Number(o.sunBeamRayMinSepPx ?? 16), Qu = Number(o.sunBeamSilhouetteMinRays ?? 3), tf = Number(o.sunBeamSilhouetteMaxRays ?? 7), hr = Co ? qt.concat(qe) : qt, ur = hr.map((t, e) => { + const $r = `sv-beam-flow-${Math.round((Ha + Ga) * 10)}`, vr = `sv-sun-ray-${Math.round((Ua + ja) * 10)}`, Sr = `sv-cloud-drift-${Math.round(Z)}-${Math.round(Q)}`, af = Number(o.sunBeamRaySpacingPx ?? 40), nf = Number(o.sunBeamRayMinSepPx ?? 16), rf = Number(o.sunBeamSilhouetteMinRays ?? 3), cf = Number(o.sunBeamSilhouetteMaxRays ?? 7), xr = Eo ? Zt.concat(ts) : Zt, wr = xr.map((t, e) => { const s = G(t), n = U(s); return { sourceIdx: e, x: n[0], y: n[1], zCam: s[2], world: t }; - }), yt = eu( - ur - ), ue = [], ma = (t, e, s, n = -1, i = [0, 0, 0]) => { - const r = Math.max(1, Ju) ** 2; - for (const h of ue) { + }), xt = lu( + wr + ), be = [], Fa = (t, e, s, n = -1, i = [0, 0, 0]) => { + const r = Math.max(1, nf) ** 2; + for (const h of be) { const u = h.x - t, d = h.y - e; if (u * u + d * d < r) return; } - ue.push({ x: t, y: e, zCam: s, sourceIdx: n, world: i }); + be.push({ x: t, y: e, zCam: s, sourceIdx: n, world: i }); }; - if (yt.length >= 2) { + if (xt.length >= 2) { let t = 0; - for (let s = 0; s < yt.length; s++) { - const n = (s + 1) % yt.length; - t += yt[s].x * yt[n].y - yt[n].x * yt[s].y; + for (let s = 0; s < xt.length; s++) { + const n = (s + 1) % xt.length; + t += xt[s].x * xt[n].y - xt[n].x * xt[s].y; } const e = t > 0; - for (let s = 0; s < yt.length; s++) { - const n = yt[s], i = yt[(s + 1) % yt.length], r = i.x - n.x, h = i.y - n.y, u = Math.hypot(r, h); + for (let s = 0; s < xt.length; s++) { + const n = xt[s], i = xt[(s + 1) % xt.length], r = i.x - n.x, h = i.y - n.y, u = Math.hypot(r, h); if (u < 1e-3) continue; const d = (n.x + i.x) * 0.5, f = (n.y + i.y) * 0.5; let p = e ? h : -h, m = e ? -r : r; const b = Math.hypot(p, m) || 1; p /= b, m /= b; - const g = it[0] - d, y = it[1] - f; - if (!(p * g + m * y > 0)) continue; - ma(n.x, n.y, n.zCam, n.sourceIdx, n.world), ma(i.x, i.y, i.zCam, i.sourceIdx, i.world); - const E = Math.max(8, Ku), T = Math.max(1, Math.min(4, Math.round(u / E))); - for (let B = 0; B < T; B++) { - const z = (B + 1) / (T + 1), I = [ - n.world[0] + (i.world[0] - n.world[0]) * z, - n.world[1] + (i.world[1] - n.world[1]) * z, - n.world[2] + (i.world[2] - n.world[2]) * z - ], C = G(I), _ = U(C); - ma(_[0], _[1], C[2], -1, I); + const g = rt[0] - d, _ = rt[1] - f; + if (!(p * g + m * _ > 0)) continue; + Fa(n.x, n.y, n.zCam, n.sourceIdx, n.world), Fa(i.x, i.y, i.zCam, i.sourceIdx, i.world); + const A = Math.max(8, af), T = Math.max(1, Math.min(4, Math.round(u / A))); + for (let P = 0; P < T; P++) { + const W = (P + 1) / (T + 1), V = [ + n.world[0] + (i.world[0] - n.world[0]) * W, + n.world[1] + (i.world[1] - n.world[1]) * W, + n.world[2] + (i.world[2] - n.world[2]) * W + ], N = G(V), v = U(N); + Fa(v[0], v[1], N[2], -1, V); } } } - !ue.length && yt.length && yt.forEach((t) => ma(t.x, t.y, t.zCam, t.sourceIdx, t.world)), ue.length > 1 && ue.sort((t, e) => { - const s = Math.atan2(t.y - it[1], t.x - it[0]), n = Math.atan2(e.y - it[1], e.x - it[0]); + !be.length && xt.length && xt.forEach((t) => Fa(t.x, t.y, t.zCam, t.sourceIdx, t.world)), be.length > 1 && be.sort((t, e) => { + const s = Math.atan2(t.y - rt[1], t.x - rt[0]), n = Math.atan2(e.y - rt[1], e.x - rt[0]); return s - n; }); - const fr = (t, e) => { + const Rr = (t, e) => { if (t.length <= e) return t.slice(); if (e <= 1) return [t[Math.floor(t.length / 2)]]; const s = []; @@ -1902,182 +1972,182 @@ const qn = class qn extends be { s.push(t[i]); } return s; - }, as = Math.max(1, Math.floor(Qu)), dr = Math.max(as, Math.floor(tf)); - let Dt = ue.slice(); - if (Dt.length > dr && (Dt = fr(Dt, dr)), Dt.length < as) { - const t = yt.map((e) => ({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world })); - if (t.length >= as) - Dt = fr(t, as); + }, us = Math.max(1, Math.floor(rf)), Mr = Math.max(us, Math.floor(cf)); + let Ot = be.slice(); + if (Ot.length > Mr && (Ot = Rr(Ot, Mr)), Ot.length < us) { + const t = xt.map((e) => ({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world })); + if (t.length >= us) + Ot = Rr(t, us); else if (t.length > 0) - for (; Dt.length < as; ) { - const e = t[Dt.length % t.length]; - Dt.push({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world }); + for (; Ot.length < us; ) { + const e = t[Ot.length % t.length]; + Ot.push({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world }); } } - Dt.length || [2, 3, 6, 7].forEach((t) => { - const e = Yt[t], s = Ge[t]; - Dt.push({ x: e[0], y: e[1], zCam: s[2], sourceIdx: t, world: qt[t] }); + Ot.length || [2, 3, 6, 7].forEach((t) => { + const e = Kt[t], s = Ke[t]; + Ot.push({ x: e[0], y: e[1], zCam: s[2], sourceIdx: t, world: Zt[t] }); }); - const Cn = /* @__PURE__ */ new Set(); - if (vt) { - const t = [-Ot[0], -Ot[1], -Ot[2]]; + const In = /* @__PURE__ */ new Set(); + if (Nt) { + const t = [-Ht[0], -Ht[1], -Ht[2]]; if (Math.abs(t[1]) > 1e-6) { - const e = hr.map((s, n) => { - const i = (fn - s[1]) / t[1]; + const e = xr.map((s, n) => { + const i = (Mn - s[1]) / t[1]; return i < 0 ? null : { sourceIdx: n, x: s[0] + t[0] * i, z: s[2] + t[2] * i }; }).filter((s) => !!s); if (e.length >= 3) { - const s = Oi(e.map((i) => ({ x: i.x, z: i.z }))), n = 1e-4; + const s = Qi(e.map((i) => ({ x: i.x, z: i.z }))), n = 1e-4; e.forEach((i) => { - s.some((r) => Math.abs(r.x - i.x) <= n && Math.abs(r.z - i.z) <= n) && Cn.add(i.sourceIdx); + s.some((r) => Math.abs(r.x - i.x) <= n && Math.abs(r.z - i.z) <= n) && In.add(i.sourceIdx); }); } } } - const pr = ((t) => { + const Cr = ((t) => { const e = [], s = /* @__PURE__ */ new Set(); return t.forEach((n) => { const i = `${Math.round(n.x)},${Math.round(n.y)}`; s.has(i) || (s.add(i), e.push(n)); }), e; })( - ur.filter((t) => Cn.has(t.sourceIdx)).map((t) => ({ x: t.x, y: t.y, zCam: t.zCam, sourceIdx: t.sourceIdx, world: t.world })) - ), kn = pr.length ? pr : Dt, Nn = /* @__PURE__ */ new Map(), mr = (t, e, s, n, i) => { + wr.filter((t) => In.has(t.sourceIdx)).map((t) => ({ x: t.x, y: t.y, zCam: t.zCam, sourceIdx: t.sourceIdx, world: t.world })) + ), Vn = Cr.length ? Cr : Ot, Hn = /* @__PURE__ */ new Map(), kr = (t, e, s, n, i) => { const r = `${Math.round(e)},${Math.round(s)}`; - Nn.has(r) || Nn.set(r, { x: e, y: s, zCam: n, sourceIdx: t, world: i }); + Hn.has(r) || Hn.set(r, { x: e, y: s, zCam: n, sourceIdx: t, world: i }); }; - Object.entries(sn).forEach(([t, e]) => { - G(ft(Vi[t]))[2] >= di || e.indices.forEach((n) => { - mr(n, Yt[n][0], Yt[n][1], Ge[n][2], qt[n]); + Object.entries(_n).forEach(([t, e]) => { + G(bt(or[t]))[2] >= wi || e.indices.forEach((n) => { + kr(n, Kt[n][0], Kt[n][1], Ke[n][2], Zt[n]); }); - }), ho && ca.forEach((t, e) => { - const s = qt.length + e; - mr(s, t[0], t[1], Hi[e][2], qe[e]); + }), uo && wa.forEach((t, e) => { + const s = Zt.length + e; + kr(s, t[0], t[1], er[e][2], ts[e]); }); - let En = Array.from(Nn.values()).filter( - (t) => Cn.has(t.sourceIdx) + let Gn = Array.from(Hn.values()).filter( + (t) => In.has(t.sourceIdx) ); - if (!En.length && kn.length) { - const t = kn.slice().sort((e, s) => e.zCam - s.zCam); - En = t.slice(0, Math.min(3, t.length)); + if (!Gn.length && Vn.length) { + const t = Vn.slice().sort((e, s) => e.zCam - s.zCam); + Gn = t.slice(0, Math.min(3, t.length)); } - function of(t, e) { + function lf(t, e) { const s = t.length; if (s < 3) return ""; let n = ""; for (let i = 0; i < s; i++) { const r = t[(i - 1 + s) % s], h = t[i], u = t[(i + 1) % s], d = [r[0] - h[0], r[1] - h[1]], f = [u[0] - h[0], u[1] - h[1]], p = Math.hypot(d[0], d[1]), m = Math.hypot(f[0], f[1]); if (p === 0 || m === 0) continue; - const b = Math.min(e, p / 2, m / 2), g = [d[0] / p, d[1] / p], y = [f[0] / m, f[1] / m], x = [h[0] + g[0] * b, h[1] + g[1] * b], E = [h[0] + y[0] * b, h[1] + y[1] * b]; - i === 0 ? n += `M ${x[0]} ${x[1]}` : n += ` L ${x[0]} ${x[1]}`, n += ` Q ${h[0]} ${h[1]} ${E[0]} ${E[1]}`; + const b = Math.min(e, p / 2, m / 2), g = [d[0] / p, d[1] / p], _ = [f[0] / m, f[1] / m], R = [h[0] + g[0] * b, h[1] + g[1] * b], A = [h[0] + _[0] * b, h[1] + _[1] * b]; + i === 0 ? n += `M ${R[0]} ${R[1]}` : n += ` L ${R[0]} ${R[1]}`, n += ` Q ${h[0]} ${h[1]} ${A[0]} ${A[1]}`; } return n + " Z"; } - const fe = ji.map((t) => [t[0], t[1]]), ba = of(fe, Ho); - function ef(t, e, s = 8) { + const ge = nr.map((t) => [t[0], t[1]]), Aa = lf(ge, eo); + function hf(t, e, s = 8) { const n = t.length; if (n < 3) return t.slice(); const i = []; for (let r = 0; r < n; r++) { const h = t[(r - 1 + n) % n], u = t[r], d = t[(r + 1) % n], f = [h[0] - u[0], h[1] - u[1]], p = [d[0] - u[0], d[1] - u[1]], m = Math.hypot(f[0], f[1]), b = Math.hypot(p[0], p[1]); if (m === 0 || b === 0) continue; - const g = Math.min(e, m / 2, b / 2), y = [f[0] / m, f[1] / m], x = [p[0] / b, p[1] / b], E = [u[0] + y[0] * g, u[1] + y[1] * g], T = [u[0] + x[0] * g, u[1] + x[1] * g]; - i.length, i.push(E); - for (let B = 1; B <= s; B++) { - const z = B / s, I = 1 - z; + const g = Math.min(e, m / 2, b / 2), _ = [f[0] / m, f[1] / m], R = [p[0] / b, p[1] / b], A = [u[0] + _[0] * g, u[1] + _[1] * g], T = [u[0] + R[0] * g, u[1] + R[1] * g]; + i.length, i.push(A); + for (let P = 1; P <= s; P++) { + const W = P / s, V = 1 - W; i.push([ - I * I * E[0] + 2 * I * z * u[0] + z * z * T[0], - I * I * E[1] + 2 * I * z * u[1] + z * z * T[1] + V * V * A[0] + 2 * V * W * u[0] + W * W * T[0], + V * V * A[1] + 2 * V * W * u[1] + W * W * T[1] ]); } } return i; } - const ns = ef(fe, Ho, 8), br = ns.map((t) => [t[0], t[1] + go]), gr = []; - for (let t = 0; t < ns.length; t++) { - const e = (t + 1) % ns.length; - gr.push([ - ns[t], - ns[e], - br[e], - br[t] + const fs = hf(ge, eo, 8), Nr = fs.map((t) => [t[0], t[1] + qo]), Er = []; + for (let t = 0; t < fs.length; t++) { + const e = (t + 1) % fs.length; + Er.push([ + fs[t], + fs[e], + Nr[e], + Nr[t] ]); } - const Tn = M(Zn, 0, 0.2), ga = fe.reduce((t, e) => [t[0] + e[0], t[1] + e[1]], [0, 0]).map((t) => t / fe.length), sf = Tn > 0 ? fe.map((t) => [ - ga[0] + (t[0] - ga[0]) * (1 - Tn), - ga[1] + (t[1] - ga[1]) * (1 - Tn) - ]) : fe, dt = []; - if (ti && dt.push(` - - - - - - `), (We || Oe && ua > 0.01 || Ba && uo > 0.03) && dt.push(``), We && dt.push(` - - `), dt.push(` + const Un = C(X, 0, 0.2), Ta = ge.reduce((t, e) => [t[0] + e[0], t[1] + e[1]], [0, 0]).map((t) => t / ge.length), uf = Un > 0 ? ge.map((t) => [ + Ta[0] + (t[0] - Ta[0]) * (1 - Un), + Ta[1] + (t[1] - Ta[1]) * (1 - Un) + ]) : ge, gt = []; + if (ui && gt.push(` + + + + + + `), (je || qe && Ca > 0.01 || Xa && fo > 0.03) && gt.push(``), je && gt.push(` + + `), gt.push(` - `), dt.push(` - - - `), yo && mt > 1e-3 && dt.push(` - - - - `), xa && ir && (dt.push(` - - `), dt.push(` - - `)), Ra && dt.push(` - - `), fi && dt.push(` - - `), Le && dt.push(` - - `), Ma && vt && ts && os && dt.push(` - - - - `), Ie && !vt && es && ss) { - const t = Array.isArray(js) ? js : [178, 208, 255], e = M(wl * uo, 0, 1); - dt.push(` + `), gt.push(` + + + `), yo && Mt > 1e-3 && gt.push(` + + + + `), se && yr && (gt.push(` + + `), gt.push(` + + `)), Xt && gt.push(` + + `), xi && gt.push(` + + `), He && gt.push(` + + `), Oa && Nt && rs && cs && gt.push(` + + + + `), Ye && !Nt && ls && hs) { + const t = Array.isArray(ca) ? ca : [178, 208, 255], e = C(El * fo, 0, 1); + gt.push(` `); } - ei && dt.push(` - - - + di && gt.push(` + + + `); - const Bo = []; - if (ka && vt && Bo.push(` - @keyframes ${rr} { + const Lo = []; + if (Va && Nt && Lo.push(` + @keyframes ${$r} { from { stroke-dashoffset: 0; } - to { stroke-dashoffset: -${Na + Ea}; } + to { stroke-dashoffset: -${Ha + Ga}; } } .sv-beam-flow { - animation-name: ${rr}; + animation-name: ${$r}; animation-timing-function: linear; animation-iteration-count: infinite; } .sv-css-limit .sv-beam-flow { animation-timing-function: steps(var(--sv-steps, 1), end); } - `), We) { - const e = J + 140; - Bo.push(` - @keyframes ${lr} { + `), je) { + const e = Z + 140; + Lo.push(` + @keyframes ${Sr} { 0% { transform: translateX(-140px); } 100% { transform: translateX(${e}px); } } .sv-sky-cloud { - animation-name: ${lr}; + animation-name: ${Sr}; animation-timing-function: linear; animation-iteration-count: infinite; will-change: transform; @@ -2087,13 +2157,13 @@ const qn = class qn extends be { } `); } - Ya && Bo.push(` - @keyframes ${cr} { + ln && Lo.push(` + @keyframes ${vr} { 0%, 100% { transform: scaleX(var(--ray-min-scale, 0.45)); } 50% { transform: scaleX(var(--ray-max-scale, 1.0)); } } .sv-sun-ray { - animation-name: ${cr}; + animation-name: ${vr}; animation-timing-function: ease-in-out; animation-iteration-count: infinite; transform-origin: 0px 0px; @@ -2103,21 +2173,21 @@ const qn = class qn extends be { animation-timing-function: steps(var(--sv-steps, 1), end); } `); - const yr = `sv-star-twinkle-${Math.round(J)}-${Math.round(tt)}`; - Oe && Xa && Bo.push(` - @keyframes ${yr} { + const Fr = `sv-star-twinkle-${Math.round(Z)}-${Math.round(Q)}`; + qe && hn && Lo.push(` + @keyframes ${Fr} { 0%, 100% { opacity: calc(var(--star-op, 0.7) * 0.22); } 50% { opacity: var(--star-op, 0.7); } } .sv-star { - animation-name: ${yr}; + animation-name: ${Fr}; animation-timing-function: ease-in-out; animation-iteration-count: infinite; } .sv-css-limit .sv-star { animation-timing-function: steps(var(--sv-steps, 1), end); } - `), (ka || We || Ya || Oe && Xa) && Bo.push(` + `), (Va || je || ln || qe && hn) && Lo.push(` .sv-css-global .sv-beam-flow, .sv-css-global .sv-sun-ray, .sv-css-global .sv-sky-cloud, @@ -2131,20 +2201,20 @@ const qn = class qn extends be { .sv-css-pause .sv-star { animation-play-state: paused !important; } - `), Bo.length && dt.push(``); - const $ = [], af = `${ut ? "sv-css-limit sv-css-global " : ""}${qh ? "sv-css-pause " : ""}sv-scene`.trim(), nf = Number(this._cssGlobalTimeSec || 0); - if ($.push(`${dt.join("")}`), ti && $.push(``), Oe && ua > 0.01 && Us > 0) { + const y = [], ff = `${ut ? "sv-css-limit sv-css-global " : ""}${tu ? "sv-css-pause " : ""}sv-scene`.trim(), df = Number(this._cssGlobalTimeSec || 0); + if (y.push(`${gt.join("")}`), ui && y.push(``), qe && Ca > 0.01 && ra > 0) { let t = this._skyStars; - if (!Array.isArray(t) || t.length !== Us) { - let s = 2166136261 ^ Math.round(J * 13 + tt * 17 + Us * 31); + if (!Array.isArray(t) || t.length !== ra) { + let s = 2166136261 ^ Math.round(Z * 13 + Q * 17 + ra * 31); const n = () => (s ^= s << 13, s >>>= 0, s ^= s >> 17, s >>>= 0, s ^= s << 5, s >>>= 0, (s >>> 0) / 4294967295); - t = Array.from({ length: Us }, () => ({ + t = Array.from({ length: ra }, () => ({ x: 0.04 + n() * 0.92, y: 0.06 + n() * 0.86, r: 0.55 + n() * 1.25, @@ -2153,289 +2223,289 @@ const qn = class qn extends be { phase: n() * 2.2 })), this._skyStars = t; } - const e = Ze * 0.97; - $.push(''), t.forEach((s) => { - const n = s.x * J, i = s.y * e, r = s.r * (0.85 + ua * 0.35), h = M(ua * gl * s.a, 0, 1); - if (Xa) { - const u = Math.max(1.2, Number(s.dur)), d = Number(s.phase) || 0, f = ut ? Ks(u, d) : Zs(u, d), p = ut ? Math.max(1, Math.round(u * co)) : 0; - $.push(`'), t.forEach((s) => { + const n = s.x * Z, i = s.y * e, r = s.r * (0.85 + Ca * 0.35), h = C(Ca * wl * s.a, 0, 1); + if (hn) { + const u = Math.max(1.2, Number(s.dur)), d = Number(s.phase) || 0, f = ut ? da(u, d) : fa(u, d), p = ut ? Math.max(1, Math.round(u * lo)) : 0; + y.push(``); } else - $.push(``); - }), $.push(""); - } - if (Ba && uo > 0.03) { - const t = Vt * (Su * 2), e = `rgb(${$n.join(",")})`, s = `moon-disc-clip-${Math.round(Eo)}-${Math.round(To)}-${Math.round(Vt)}`; - $.push(``), $.push(``), $.push(``), $.push(``), $.push(``); - const n = Eo - Vt * 0.34, i = To + Vt * 0.3, r = Vt * 0.24; - $.push(``), $.push(``), $.push(""), $.push(``); - } - if (We) { - const t = M(Yc, 0, 1), e = [0.3, 0.42, 0.24], s = [0.46, 0.6, 0.38], n = [ - { y: Ze * (e[0] + (s[0] - e[0]) * t), s: 0.76 * Aa, dur: 38 / Math.max(0.2, Da), phase: 0.12 }, - { y: Ze * (e[1] + (s[1] - e[1]) * t), s: 1 * Aa, dur: 56 / Math.max(0.2, Da), phase: 0.48 }, - { y: Ze * (e[2] + (s[2] - e[2]) * t), s: 0.66 * Aa, dur: 76 / Math.max(0.2, Da), phase: 0.78 } + y.push(``); + }), y.push(""); + } + if (Xa && fo > 0.03) { + const t = Ut * (Nu * 2), e = `rgb(${Tn.join(",")})`, s = `moon-disc-clip-${Math.round(To)}-${Math.round(Do)}-${Math.round(Ut)}`; + y.push(``), y.push(``), y.push(``), y.push(``), y.push(``); + const n = To - Ut * 0.34, i = Do + Ut * 0.3, r = Ut * 0.24; + y.push(``), y.push(``), y.push(""), y.push(``); + } + if (je) { + const t = C(ol, 0, 1), e = [0.3, 0.42, 0.24], s = [0.46, 0.6, 0.38], n = [ + { y: ss * (e[0] + (s[0] - e[0]) * t), s: 0.76 * qa, dur: 38 / Math.max(0.2, Ya), phase: 0.12 }, + { y: ss * (e[1] + (s[1] - e[1]) * t), s: 1 * qa, dur: 56 / Math.max(0.2, Ya), phase: 0.48 }, + { y: ss * (e[2] + (s[2] - e[2]) * t), s: 0.66 * qa, dur: 76 / Math.max(0.2, Ya), phase: 0.78 } ]; - $.push(''), n.forEach((i) => { - const r = 1 - 0.35 * Ke, h = M(Qn * r, 0, 1), u = M(Qn * 0.75 * r, 0, 1); + y.push(''), n.forEach((i) => { + const r = 1 - 0.35 * as, h = C(hi * r, 0, 1), u = C(hi * 0.75 * r, 0, 1); [-(i.phase * i.dur), -((i.phase + 0.5) * i.dur)].forEach((f) => { - $.push(``); - const p = Qs ? 6 : ut ? 3 : 1, m = i.dur * p, b = ut ? Math.max(1, Math.round(m * co)) : 0, g = -f, y = ut ? Ks(m, g) : Zs(m, g); - $.push(``), $.push(''), $.push(``), $.push(``), $.push(``), $.push(``), $.push(""), $.push(""), $.push(""); + y.push(``); + const p = ma ? 6 : ut ? 3 : 1, m = i.dur * p, b = ut ? Math.max(1, Math.round(m * lo)) : 0, g = -f, _ = ut ? da(m, g) : fa(m, g); + y.push(``), y.push(''), y.push(``), y.push(``), y.push(``), y.push(``), y.push(""), y.push(""), y.push(""); }); - }), $.push(""); + }), y.push(""); } - const rf = () => { - const t = Ao[0] - Fo[0], e = Ao[1] - Fo[1], s = Math.hypot(t, e); + const pf = () => { + const t = zo[0] - Bo[0], e = zo[1] - Bo[1], s = Math.hypot(t, e); if (s <= 1e-3) return; - const n = -e / s, i = t / s, r = t / s, h = e / s, u = Ao[0] - r * Do, d = Ao[1] - h * Do, f = [u + n * Do * 0.62, d + i * Do * 0.62], p = [u - n * Do * 0.62, d - i * Do * 0.62], m = Math.max(0.8, qu * 0.55 + Yu * 0.75), b = [ - [Ao[0], Ao[1]], + const n = -e / s, i = t / s, r = t / s, h = e / s, u = zo[0] - r * Po, d = zo[1] - h * Po, f = [u + n * Po * 0.62, d + i * Po * 0.62], p = [u - n * Po * 0.62, d - i * Po * 0.62], m = Math.max(0.8, tf * 0.55 + of * 0.75), b = [ + [zo[0], zo[1]], [p[0], p[1]], [f[0], f[1]] - ], g = b.map((x) => `${x[0]},${x[1]}`).join(" "), y = Math.max(1.1, Do * 0.16); - if (fi) { - const x = Ql * vn, E = x * 0.55, T = x * 0.75, z = b.map((I) => [I[0] + E, I[1] + T]).map((I) => `${I[0]},${I[1]}`).join(" "); - $.push(``), $.push(``); + ], g = b.map((R) => `${R[0]},${R[1]}`).join(" "), _ = Math.max(1.1, Po * 0.16); + if (xi) { + const R = ih * Bn, A = R * 0.55, T = R * 0.75, W = b.map((V) => [V[0] + A, V[1] + T]).map((V) => `${V[0]},${V[1]}`).join(" "); + y.push(``), y.push(``); } - $.push(``), $.push(``); - }, cf = () => { - if (!X) return; - const t = M(Gs, 0.8, 1.9), e = Math.max(0.08, Hs), s = 1 + Sc, n = s + e, i = Z + 5e-4, r = (g) => U(G(ft(g))), h = r([-t / 2, i, s]), u = r([t / 2, i, s]), d = r([t / 2, i, n]), f = r([-t / 2, i, n]); - $.push(``); - const p = (g, y, x) => [g[0] + (y[0] - g[0]) * x, g[1] + (y[1] - g[1]) * x]; + y.push(``), y.push(``); + }, mf = () => { + if (!Js) return; + const t = C(ta, 0.8, 1.9), e = Math.max(0.08, Qs), s = 1 + oa, n = s + e, i = K + 5e-4, r = (g) => U(G(bt(g))), h = r([-t / 2, i, s]), u = r([t / 2, i, s]), d = r([t / 2, i, n]), f = r([-t / 2, i, n]); + y.push(``); + const p = (g, _, R) => [g[0] + (_[0] - g[0]) * R, g[1] + (_[1] - g[1]) * R]; [0.25, 0.5, 0.75].forEach((g) => { - const y = p(h, u, g), x = p(f, d, g); - $.push(``); + const _ = p(h, u, g), R = p(f, d, g); + y.push(``); }); const m = p(h, f, 0.5), b = p(u, d, 0.5); - $.push(``); + y.push(``); }; - if (go > 0.1 && gr.forEach((t, e) => { - const s = t.map((i) => `${i[0]},${i[1]}`).join(" "), n = M(0.86 - e * 0.08, 0.62, 0.9); - $.push(``); - }), $.push(``), yo && mt > 1e-3 && $.push(``), cf(), Ma && vt && ts && os && $.push(``), Ie && !vt && es && ss && $.push(``), xa && ir) { - const t = Je ? Je.map((s) => [s[0], s[1]]) : [], e = Jh(t, sf); + if (qo > 0.1 && Er.forEach((t, e) => { + const s = t.map((i) => `${i[0]},${i[1]}`).join(" "), n = C(0.86 - e * 0.08, 0.62, 0.9); + y.push(``); + }), y.push(``), yo && Mt > 1e-3 && y.push(``), mf(), Oa && Nt && rs && cs && y.push(``), Ye && !Nt && ls && hs && y.push(``), se && yr) { + const t = ns ? ns.map((s) => [s[0], s[1]]) : [], e = nu(t, uf); if (e.length >= 3) { - const s = e.map((i) => i[0] + "," + i[1]).join(" "), n = 1 - 0.4 * he; - $.push(``), $.push(``); + const s = e.map((i) => i[0] + "," + i[1]).join(" "), n = 1 - 0.4 * me; + y.push(``), y.push(``); } } - rf(), Ra && dn && $.push(``), $.push(``), $.push(``), $.push(``), ri && tr.forEach((t) => { - const e = t.isMajor ? Vl : Il; - $.push(``); - }), Hu.forEach((t) => { - $.push(``), y.push(``), y.push(``), y.push(``), _i && dr.forEach((t) => { + const e = t.isMajor ? Xl : Yl; + y.push(``); + }), Zu.forEach((t) => { + y.push(`${t.t}`); }); - const lf = { + const bf = { front: [1, 0, 0], back: [1, 0, 0], right: [0, 0, 1], left: [0, 0, 1] }; - er.forEach((t) => { - const e = lf[t.id]; + mr.forEach((t) => { + const e = bf[t.id]; if (!e) return; - const s = ft(e), n = ft(t.pos), i = t.id === "front" || t.id === "left" ? e.map((g) => -g) : e, r = ft(i), h = Wi(n, s, tu(s), r, !1); + const s = bt(e), n = bt(t.pos), i = t.id === "front" || t.id === "left" ? e.map((g) => -g) : e, r = bt(i), h = Ji(n, s, ru(s), r, !1); if (!h) return; - const { basis: u, centerScr: d } = h, f = M(d[3] * oh, eh, sh), p = th * f, m = rh * f, b = d[1] - ah * f; - $.push(`${t.label}`); }); - const hf = Number(this._cssGlobalTimeSec || Si), uf = Math.floor(hf / 1.6); - let $r = Qs ? 1 : 0; - const _r = (t, e = 1, s = 1) => { - const n = t.length > 0 ? (uf % t.length + t.length) % t.length : -1; + const gf = Number(this._cssGlobalTimeSec || Ti), _f = Math.floor(gf / 1.6); + let Ar = ma ? 1 : 0; + const Tr = (t, e = 1, s = 1) => { + const n = t.length > 0 ? (_f % t.length + t.length) % t.length : -1; t.forEach((i, r) => { - const h = M( - He / (He + i.zCam) * Oc, - Ic, - Vc - ), u = Math.max(0.7, Dc * No * h), d = M(Ac * s * h, 0, 1); - $.push(``); let f = !1; - if (Qs) - f = $r > 0 && r === n, f && ($r -= 1); + if (ma) + f = Ar > 0 && r === n, f && (Ar -= 1); else { const p = r % 3 !== 2, m = !ut || r % 2 === 0; f = p && m; } - if (ka && vt && f) { - const p = Math.max(0.6, u * zc), m = Math.max(0.2, Lc), b = r * Wc, g = ut ? Ks(m, b) : Zs(m, b), y = M(Pc * e * h, 0, 1), x = ut ? Math.max(1, Math.round(m * co)) : 0; - $.push(``); + style="animation-duration:${m}s;--sv-phase-delay:${g.toFixed(3)}s;animation-delay:${g.toFixed(3)}s;--sv-steps:${R}" + stroke="${Vc}" stroke-opacity="${_}" stroke-width="${p}" + stroke-linecap="round" stroke-dasharray="${Ha} ${Ga}" stroke-dashoffset="0"/>`); } }); }; - vt && _r(kn); - const ff = su.map((t) => { - const e = t.i.map((i) => Yt[i]), s = lo[t.id] ?? 1, n = Ct(t.c, s); - return { type: "cube", id: t.id, pts: e, z: Mo(e), fill: n, opacity: 1 }; - }), de = []; - Rt || (nu.forEach((t) => { + Nt && Tr(Vn); + const yf = hu.map((t) => { + const e = t.i.map((i) => Kt[i]), s = ho[t.id] ?? 1, n = Dt(t.c, s); + return { type: "cube", id: t.id, pts: e, z: No(e), fill: n, opacity: 1 }; + }), _e = []; + At || (fu.forEach((t) => { const e = Math.min(...t.pts.map((s) => s[2])); - de.push({ + _e.push({ type: "roofSide", pts: t.pts, // Use nearest point depth so side panels do not fall behind adjacent wall triangles. - z: e - ai, - fill: hn(t.wall), - opacity: za + z: e - mi, + fill: wn(t.wall), + opacity: Ka }); - }), un && de.push({ + }), Rn && _e.push({ type: "roofCap", - pts: un, - z: Mo(un) + ai * 0.35, - fill: hu, - opacity: za + pts: Rn, + z: No(Rn) + mi * 0.35, + fill: gu, + opacity: Ka })); - let pe = Mo(ca); - if (de.length) { - const t = Math.min(...de.map((s) => s.z)), e = Math.max(...de.map((s) => s.z)); - ho ? pe = Math.min(pe, t - 0.02) : pe = Math.max(pe, e + 0.02); + let ye = No(wa); + if (_e.length) { + const t = Math.min(..._e.map((s) => s.z)), e = Math.max(..._e.map((s) => s.z)); + uo ? ye = Math.min(ye, t - 0.02) : ye = Math.max(ye, e + 0.02); } else - pe += ho ? -1e-3 : 1e-3; - const vr = !Rt && vo && (ho || Fl) ? { + ye += uo ? -1e-3 : 1e-3; + const Dr = !At && wo && (uo || Wl) ? { type: "roofPlane", - pts: ca, - z: pe, - fill: ho ? lu : cu, - opacity: ho ? xs : Al - } : null, Sr = ff.concat(de).concat(Xt).concat(vr ? [vr] : []).sort((t, e) => { + pts: wa, + z: ye, + fill: uo ? bu : mu, + opacity: uo ? Fs : Ol + } : null, Br = yf.concat(_e).concat(Jt).concat(Dr ? [Dr] : []).sort((t, e) => { const s = e.z - t.z, n = String((t == null ? void 0 : t.type) || ""), i = String((e == null ? void 0 : e.type) || ""), r = n.startsWith("flatRoofEdge-"), h = i.startsWith("flatRoofEdge-"), u = n.startsWith("flatRoofSkirt-"), d = i.startsWith("flatRoofSkirt-"); if (r && h || u && d || (n === "roofSide" || n === "roofCap") && (i === "roofSide" || i === "roofCap")) { if (Math.abs(s) > 1e-6) return s; } else if (Math.abs(s) > 0.015) return s; const m = (g) => { - const y = String((g == null ? void 0 : g.type) || ""); - return y.startsWith("flatRoofSkirt-") ? 0.7 : y === "roofCap" ? 0.9 : y === "flatRoofTop" || y === "roofPlane" ? 1 : y === "cube" ? 1.4 : y === "roofSide" ? 1.55 : y.startsWith("flatRoofEdge-") ? 1.8 : y === "flatRoofBottom" ? 3 : 1; + const _ = String((g == null ? void 0 : g.type) || ""); + return _.startsWith("flatRoofSkirt-") ? 0.7 : _ === "roofCap" ? 0.9 : _ === "flatRoofTop" || _ === "roofPlane" ? 1 : _ === "cube" ? 1.4 : _ === "roofSide" ? 1.55 : _.startsWith("flatRoofEdge-") ? 1.8 : _ === "flatRoofBottom" ? 3 : 1; }, b = m(t) - m(e); return Math.abs(b) > 1e-6 ? b : s; - }), df = (t, e) => { - if (!Vs || !(t === "front" || t === "right" || t === "back" || t === "left") || !e || e.length < 4) return; - const s = e[0], n = e[1], i = e[2], r = e[3], h = (m, b, g) => [m[0] + (b[0] - m[0]) * g, m[1] + (b[1] - m[1]) * g], u = M(N, 0.015, 0.22), d = h(s, r, u), f = h(n, i, u), p = Ct(_t[t], (lo[t] ?? 1) * M(D, 0.2, 1.2)); - $.push(` { + if (!Xs || !(t === "front" || t === "right" || t === "back" || t === "left") || !e || e.length < 4) return; + const s = e[0], n = e[1], i = e[2], r = e[3], h = (m, b, g) => [m[0] + (b[0] - m[0]) * g, m[1] + (b[1] - m[1]) * g], u = C(Zs, 0.015, 0.22), d = h(s, r, u), f = h(n, i, u), p = Dt(kt[t], (ho[t] ?? 1) * C(Ks, 0.2, 1.2)); + y.push(``); - }, pf = (t) => { - if (!pi || !wn[t]) return; - const e = au[t], s = Vi[t]; + }, vf = (t) => { + if (!Ri || !Pn[t]) return; + const e = uu[t], s = or[t]; if (!e || !s) return; const n = t === "front" || t === "left" ? e.map((T) => -T) : e; let i = 0, r = 0, h = 0; - sn[t].indices.forEach((T) => { - const B = Ii[T]; - i += B[0], r += B[1], h += B[2]; - }), i /= 4, r /= 4, h /= 4, r = M(hh, -0.9, 0.9); + _n[t].indices.forEach((T) => { + const P = tr[T]; + i += P[0], r += P[1], h += P[2]; + }), i /= 4, r /= 4, h /= 4, r = C(gh, -0.9, 0.9); const u = [ - i + s[0] * Va, - r + s[1] * Va, - h + s[2] * Va - ], d = ft(u), f = ft(e), p = ft(n), m = Wi(d, f, [0, 1, 0], p, !1); + i + s[0] * en, + r + s[1] * en, + h + s[2] * en + ], d = bt(u), f = bt(e), p = bt(n), m = Ji(d, f, [0, 1, 0], p, !1); if (!m) return; - const { basis: b, centerScr: g } = m, y = M(g[3] * uh, fh, dh), x = Oa * y, E = Ia * y; - $.push(`${Pi(Ue[t])}`); - }, mf = () => { - if (!gh || !Sn.front) return; - const t = -Ha / 2, e = Ha / 2, s = M(-1 + yh, -1, 1), n = M(s + gi, -1, 1), i = 1 + $h, r = (T) => U(G(ft(T))), d = [ + transform="matrix(${b.bx} ${b.by} ${b.ux} ${b.uy} ${g[0]} ${g[1]})">${Xi(Je[t])}`); + }, Sf = () => { + if (!wh || !zn.front) return; + const t = -sn / 2, e = sn / 2, s = C(-1 + Rh, -1, 1), n = C(s + ki, -1, 1), i = 1 + Mh, r = (T) => U(G(bt(T))), d = [ [t, s, i], [e, s, i], [e, n, i], [t, n, i] ].map(r).map((T) => `${T[0]},${T[1]}`).join(","); - $.push(``); - const f = Math.min(0.08, Math.max(0.04, Ha * 0.14)), p = Math.min(0.08, Math.max(0.04, gi * 0.1)), g = [ + y.push(``); + const f = Math.min(0.08, Math.max(0.04, sn * 0.14)), p = Math.min(0.08, Math.max(0.04, ki * 0.1)), g = [ [t + f, s + p, i + 3e-3], [e - f, s + p, i + 3e-3], [e - f, n - p, i + 3e-3], [t + f, n - p, i + 3e-3] ].map(r).map((T) => `${T[0]},${T[1]}`).join(","); - $.push(``); - const y = [e - f - 0.05, s + (n - s) * 0.45, i + 6e-3], x = r(y), E = Math.max(0.6, x[3]); - $.push(``); - }, bf = (t, e) => { - if (!Ns || !(t === "left" || t === "right" || t === "back") || !e || e.length < 4) return; - const s = M(lo[t] ?? 1, 0.2, 1), n = e[0], i = e[1], r = e[2], h = e[3], u = (R, L, A) => [R[0] + (L[0] - R[0]) * A, R[1] + (L[1] - R[1]) * A], d = (R, L) => { - const A = u(n, h, L), j = u(i, r, L); - return u(A, j, R); - }, f = t === "back" ? 0.2 : 0.24, p = t === "back" ? 0.8 : 0.76, m = 0.2, b = m + (0.74 - m) * 0.75, y = [ + y.push(``); + const _ = [e - f - 0.05, s + (n - s) * 0.45, i + 6e-3], R = r(_), A = Math.max(0.6, R[3]); + y.push(``); + }, xf = (t, e) => { + if (!zs || !(t === "left" || t === "right" || t === "back") || !e || e.length < 4) return; + const s = C(ho[t] ?? 1, 0.2, 1), n = e[0], i = e[1], r = e[2], h = e[3], u = (M, I, D) => [M[0] + (I[0] - M[0]) * D, M[1] + (I[1] - M[1]) * D], d = (M, I) => { + const D = u(n, h, I), q = u(i, r, I); + return u(D, q, M); + }, f = t === "back" ? 0.2 : 0.24, p = t === "back" ? 0.8 : 0.76, m = 0.2, b = m + (0.74 - m) * 0.75, _ = [ d(f, m), d(p, m), d(p, b), d(f, b) - ].map((R) => `${R[0]},${R[1]}`).join(","); - $.push(``); - const x = 0.035, E = 0.05, B = [ - d(f + x, m + E), - d(p - x, m + E), - d(p - x, b - E), - d(f + x, b - E) - ].map((R) => `${R[0]},${R[1]}`).join(","); - $.push(``); - const z = d((f + p) * 0.5, m + E), I = d((f + p) * 0.5, b - E); - $.push(``); - const C = d(f + x * 1.4, m + E * 1.2), _ = d(p - x * 1.6, b - E * 1.3); - $.push(``); - }, ya = Bi([0, 0, -1]), wr = Math.hypot(wo, xo), xr = Math.hypot(ya[0], ya[2]), Fn = wr > 1e-6 && xr > 1e-6 && (wo * ya[0] + xo * ya[2]) / (wr * xr) < 0; - function Rr(t, e) { - if (!Pe || !Le) return; - const s = (E) => U(G(E)), n = wo, i = xo, r = M(ze, 0.4, 2.5), h = [n, Z + 0.35 * r, i]; + ].map((M) => `${M[0]},${M[1]}`).join(","); + y.push(``); + const R = 0.035, A = 0.05, P = [ + d(f + R, m + A), + d(p - R, m + A), + d(p - R, b - A), + d(f + R, b - A) + ].map((M) => `${M[0]},${M[1]}`).join(","); + y.push(``); + const W = d((f + p) * 0.5, m + A), V = d((f + p) * 0.5, b - A); + y.push(``); + const N = d(f + R * 1.4, m + A * 1.2), v = d(p - R * 1.6, b - A * 1.3); + y.push(``); + }, Da = Yi([0, 0, -1]), zr = Math.hypot(Mo, Co), Pr = Math.hypot(Da[0], Da[2]), jn = zr > 1e-6 && Pr > 1e-6 && (Mo * Da[0] + Co * Da[2]) / (zr * Pr) < 0; + function Lr(t, e) { + if (!Ie || !He) return; + const s = (A) => U(G(A)), n = Mo, i = Co, r = C(Ve, 0.4, 2.5), h = [n, K + 0.35 * r, i]; let u = !0; - if (Fn) + if (jn) u = !1; else if (e) { - const E = G(h), T = U(E), B = e(T[0], T[1]); - u = B == null || E[2] <= B - 8e-3; + const A = G(h), T = U(A), P = e(T[0], T[1]); + u = P == null || A[2] <= P - 8e-3; } if (t === "front" !== u) return; - const d = s([n, Z, i]), f = s([n, Z + 0.86 * r, i]), p = Math.max(2.6, 8.5 * f[3] * r), m = M(1 + Is * 10, 0.6, 2.5), b = Math.max(2.2, p * 0.62 * m), g = Math.max(1.1, p * 0.24 * m), y = d[0], x = d[1] + g * 0.28; - $.push(``); - } - function Mr(t, e) { - if (!Pe) return; - const s = (C) => U(G(C)), n = (C) => { - if (Fn) return !1; + const d = s([n, K, i]), f = s([n, K + 0.86 * r, i]), p = Math.max(2.6, 8.5 * f[3] * r), m = C(1 + Ys * 10, 0.6, 2.5), b = Math.max(2.2, p * 0.62 * m), g = Math.max(1.1, p * 0.24 * m), _ = d[0], R = d[1] + g * 0.28; + y.push(``); + } + function Wr(t, e) { + if (!Ie) return; + const s = (N) => U(G(N)), n = (N) => { + if (jn) return !1; if (!e) return !0; - const _ = G(C), R = U(_), L = e(R[0], R[1]); - return L == null || _[2] <= L - 8e-3; - }, i = (C, _, R, L) => { - if (Fn) return !1; + const v = G(N), M = U(v), I = e(M[0], M[1]); + return I == null || v[2] <= I - 8e-3; + }, i = (N, v, M, I) => { + if (jn) return !1; if (!e) return !0; - const A = [ + const D = [ [0.92, 0], [-0.92, 0], [0, 0.92], @@ -2445,39 +2515,39 @@ const qn = class qn extends be { [0.66, -0.66], [-0.66, -0.66] ]; - let j = 0; - for (const [pt, lt] of A) { - const Gt = e(_ + pt * L, R + lt * L); - (Gt == null || C <= Gt - 8e-3) && j++; + let q = 0; + for (const [yt, lt] of D) { + const qt = e(v + yt * I, M + lt * I); + (qt == null || N <= qt - 8e-3) && q++; } - return j / A.length >= 0.4; - }, r = wo, h = xo, u = M(ze, 0.4, 2.5), d = M(1 - 0.55 * Ke, 0.35, 1), f = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(io) ? Ct(io, 0.72 * d) : io, p = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(io) ? Ct(io, 1.18 - 0.4 * Ke) : "rgba(255,255,255,0.30)", m = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Ct(ro, 0.72 * d) : ro, b = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Ct(ro, 1.2 - 0.45 * Ke) : "rgba(255,255,255,0.25)", g = M(1 - 0.3 * Ke, 0.55, 1), y = s([r, Z, h]), x = s([r, Z + 0.86 * u, h]), E = Math.max(2.6, 8.5 * x[3] * u), T = [ - [r, Z + 0.22 * u, h], - [r, Z + 0.45 * u, h], - [r, Z + 0.72 * u, h] + return q / D.length >= 0.4; + }, r = Mo, h = Co, u = C(Ve, 0.4, 2.5), d = C(1 - 0.55 * as, 0.35, 1), f = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Dt(ro, 0.72 * d) : ro, p = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Dt(ro, 1.18 - 0.4 * as) : "rgba(255,255,255,0.30)", m = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(co) ? Dt(co, 0.72 * d) : co, b = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(co) ? Dt(co, 1.2 - 0.45 * as) : "rgba(255,255,255,0.25)", g = C(1 - 0.3 * as, 0.55, 1), _ = s([r, K, h]), R = s([r, K + 0.86 * u, h]), A = Math.max(2.6, 8.5 * R[3] * u), T = [ + [r, K + 0.22 * u, h], + [r, K + 0.45 * u, h], + [r, K + 0.72 * u, h] ]; - let B = 0; - T.forEach((C) => { - n(C) && B++; + let P = 0; + T.forEach((N) => { + n(N) && P++; }); - const z = B / T.length >= 0.4; - if (t === "front" === z) { - const C = x[0] - y[0], _ = x[1] - y[1], R = Math.max(1e-3, Math.hypot(C, _)), L = -_ / R, A = C / R, j = Math.max(0.35, E * 0.12); - $.push(``), $.push(``); + const W = P / T.length >= 0.4; + if (t === "front" === W) { + const N = R[0] - _[0], v = R[1] - _[1], M = Math.max(1e-3, Math.hypot(N, v)), I = -v / M, D = N / M, q = Math.max(0.35, A * 0.12); + y.push(``), y.push(``); } [ - [r, Z + 1.02 * u, h, 0.28], - [r - 0.18 * u, Z + 0.9 * u, h + 0.06 * u, 0.22], - [r + 0.2 * u, Z + 0.86 * u, h - 0.07 * u, 0.2] - ].forEach((C) => { - const _ = s([C[0], C[1], C[2]]), R = G([C[0], C[1], C[2]]), L = Math.max(6, Tt * C[3] * _[3] * 0.95), A = i(R[2], _[0], _[1], L * 0.92); - t === "front" === A && ($.push(``), $.push(``), $.push(``)); + [r, K + 1.02 * u, h, 0.28], + [r - 0.18 * u, K + 0.9 * u, h + 0.06 * u, 0.22], + [r + 0.2 * u, K + 0.86 * u, h - 0.07 * u, 0.2] + ].forEach((N) => { + const v = s([N[0], N[1], N[2]]), M = G([N[0], N[1], N[2]]), I = Math.max(6, dt * N[3] * v[3] * 0.95), D = i(M[2], v[0], v[1], I * 0.92); + t === "front" === D && (y.push(``), y.push(``), y.push(``)); }); } - const Cr = () => { - const t = Rt && rn ? rn : qe, e = { + const Or = () => { + const t = At && vn ? vn : ts, e = { front: { low: [3, 2], high: [0, 1] }, back: { low: [0, 1], high: [3, 2] }, left: { low: [0, 3], high: [1, 2] }, @@ -2500,138 +2570,138 @@ const qn = class qn extends be { } const u = Math.hypot(i[0] - n[0], i[1] - n[1], i[2] - n[2]), d = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2, (n[2] + i[2]) / 2], f = [(r[0] + h[0]) / 2, (r[1] + h[1]) / 2, (r[2] + h[2]) / 2], p = Math.hypot(f[0] - d[0], f[1] - d[1], f[2] - d[2]); return !isFinite(u) || !isFinite(p) || u <= 1e-6 || p <= 1e-6 ? null : { lowA: n, lowB: i, highA: r, highB: h, worldEdgeLen: u, roofHeightWorld: p }; - }, gf = () => { - if (!As || !vo || !ln) return; - const t = Cr(); + }, wf = () => { + if (!Os || !wo || !xn) return; + const t = Or(); if (!t) return; - const { lowA: e, lowB: s, highA: n, highB: i } = t, r = Math.min(Fe, Ae), h = Math.max(Fe, Ae), u = zs, d = Ls, f = (1 - u) / 2, p = u, m = d * Math.max(0, Ko - 1), b = (p - m) / Ko; + const { lowA: e, lowB: s, highA: n, highB: i } = t, r = Math.min(Pe, Le), h = Math.max(Pe, Le), u = Gs, d = Us, f = (1 - u) / 2, p = u, m = d * Math.max(0, ee - 1), b = (p - m) / ee; if (!isFinite(b) || b <= 0.01) return; - const g = (B, z, I) => [B[0] + (z[0] - B[0]) * I, B[1] + (z[1] - B[1]) * I, B[2] + (z[2] - B[2]) * I], y = (B, z) => { - const I = g(e, n, z), C = g(s, i, z), _ = g(I, C, B); - return U(G(_)); - }, x = Ye(Ds, M(At, 0.2, 1)), E = 0.55 + 0.4 * M(At, 0, 1), T = 0.3 + 0.5 * M(At, 0, 1); - for (let B = 0; B < Ko; B++) { - const z = f + B * (b + d), I = z + b, C = y(z, r), _ = y(I, r), R = y(I, h), L = y(z, h); - $.push(``); - const A = (j, st, pt) => [j[0] + (st[0] - j[0]) * pt, j[1] + (st[1] - j[1]) * pt]; - for (let j = 1; j < De; j++) { - const st = j / De, pt = A(C, _, st), lt = A(L, R, st); - $.push(``); + const g = (P, W, V) => [P[0] + (W[0] - P[0]) * V, P[1] + (W[1] - P[1]) * V, P[2] + (W[2] - P[2]) * V], _ = (P, W) => { + const V = g(e, n, W), N = g(s, i, W), v = g(V, N, P); + return U(G(v)); + }, R = os(Is, C(Wt, 0.2, 1)), A = 0.55 + 0.4 * C(Wt, 0, 1), T = 0.3 + 0.5 * C(Wt, 0, 1); + for (let P = 0; P < ee; P++) { + const W = f + P * (b + d), V = W + b, N = _(W, r), v = _(V, r), M = _(V, h), I = _(W, h); + y.push(``); + const D = (q, et, yt) => [q[0] + (et[0] - q[0]) * yt, q[1] + (et[1] - q[1]) * yt]; + for (let q = 1; q < We; q++) { + const et = q / We, yt = D(N, v, et), lt = D(I, M, et); + y.push(``); } - for (let j = 1; j < Be; j++) { - const st = j / Be, pt = A(C, L, st), lt = A(_, R, st); - $.push(``); + for (let q = 1; q < Oe; q++) { + const et = q / Oe, yt = D(N, I, et), lt = D(v, M, et); + y.push(``); } } - }, kr = () => { - if (!pi || !vo || !ln) return; - const t = Cr(); + }, Ir = () => { + if (!Ri || !wo || !xn) return; + const t = Or(); if (!t) return; - const { lowA: e, lowB: s, highA: n, highB: i, worldEdgeLen: r, roofHeightWorld: h } = t, u = Pi(ve); + const { lowA: e, lowB: s, highA: n, highB: i, worldEdgeLen: r, roofHeightWorld: h } = t, u = Xi(Me); let d = -h * (1 / 3), f = -h * (2 / 3); - const p = 1 / 6, m = r * (1 - 2 * p), b = "100%", g = "9.99 kW", y = Math.max(u.length, b.length); - Math.max((we || "").length, g.length); - const x = h * 0.36, E = Math.min(m / (0.6 * y), x), T = Math.min(E * ph, x * 1.05), B = Ia / Oa * T, z = Math.min(T * mh, x * 0.85), I = Ia / Oa * z; + const p = 1 / 6, m = r * (1 - 2 * p), b = "100%", g = "9.99 kW", _ = Math.max(u.length, b.length); + Math.max((ke || "").length, g.length); + const R = h * 0.36, A = Math.min(m / (0.6 * _), R), T = Math.min(A * vh, R * 1.05), P = on / tn * T, W = Math.min(T * Sh, R * 0.85), V = on / tn * W; this._roofStripSeed = (this._roofStripSeed || 0) + 1; - const C = (R, L, A) => [R[0] + (L[0] - R[0]) * A, R[1] + (L[1] - R[1]) * A, R[2] + (L[2] - R[2]) * A], _ = (R, L, A, j, st, pt, lt) => { - if (!R) return; - const Gt = Math.max(L * pt, h * 0.08), Dn = st, qr = st - Gt, Yr = M(-Dn / h, 0, 1), wf = M(-qr / h, 0, 1), xf = C(e, n, Yr), Rf = C(s, i, Yr), Mf = C(e, n, wf), Xr = U(G(xf)), Zr = U(G(Rf)), Kr = U(G(Mf)), Kt = [[0, Dn], [r, Dn], [0, qr]], Jt = [[Xr[0], Xr[1]], [Zr[0], Zr[1]], [Kr[0], Kr[1]]], Po = Qh(Kt, Jt); - if (!Po) return; - const Jr = Math.sign((Kt[1][0] - Kt[0][0]) * (Kt[2][1] - Kt[0][1]) - (Kt[1][1] - Kt[0][1]) * (Kt[2][0] - Kt[0][0])), Qr = Math.sign((Jt[1][0] - Jt[0][0]) * (Jt[2][1] - Jt[0][1]) - (Jt[1][1] - Jt[0][1]) * (Jt[2][0] - Jt[0][0])), tc = Jr !== 0 && Qr !== 0 && Jr !== Qr; - $.push(``), tc && $.push(``), $.push(`${R}`), tc && $.push(""), $.push(""); + const N = (M, I, D) => [M[0] + (I[0] - M[0]) * D, M[1] + (I[1] - M[1]) * D, M[2] + (I[2] - M[2]) * D], v = (M, I, D, q, et, yt, lt) => { + if (!M) return; + const qt = Math.max(I * yt, h * 0.08), Yn = et, rc = et - qt, cc = C(-Yn / h, 0, 1), Ef = C(-rc / h, 0, 1), Ff = N(e, n, cc), Af = N(s, i, cc), Tf = N(e, n, Ef), lc = U(G(Ff)), hc = U(G(Af)), uc = U(G(Tf)), to = [[0, Yn], [r, Yn], [0, rc]], oo = [[lc[0], lc[1]], [hc[0], hc[1]], [uc[0], uc[1]]], Wo = iu(to, oo); + if (!Wo) return; + const fc = Math.sign((to[1][0] - to[0][0]) * (to[2][1] - to[0][1]) - (to[1][1] - to[0][1]) * (to[2][0] - to[0][0])), dc = Math.sign((oo[1][0] - oo[0][0]) * (oo[2][1] - oo[0][1]) - (oo[1][1] - oo[0][1]) * (oo[2][0] - oo[0][0])), pc = fc !== 0 && dc !== 0 && fc !== dc; + y.push(``), pc && y.push(``), y.push(`${M}`), pc && y.push(""), y.push(""); }; - Uo && _(we, z, I, bh, d, 1.6), _(u, T, B, mi, f, 1.6); - }, An = []; - Sr.forEach((t) => { + Zo && v(ke, W, V, xh, d, 1.6), v(u, T, P, Mi, f, 1.6); + }, qn = []; + Br.forEach((t) => { const e = t.pts || []; if (!(e.length < 3)) if (e.length === 3) - An.push([e[0], e[1], e[2]]); + qn.push([e[0], e[1], e[2]]); else for (let s = 1; s < e.length - 1; s++) - An.push([e[0], e[s], e[s + 1]]); + qn.push([e[0], e[s], e[s + 1]]); }); - const yf = (t, e, s, n, i) => { - const r = s[0], h = s[1], u = s[2], d = n[0], f = n[1], p = n[2], m = i[0], b = i[1], g = i[2], y = (f - b) * (r - m) + (m - d) * (h - b); - if (Math.abs(y) < 1e-6) return null; - const x = ((f - b) * (t - m) + (m - d) * (e - b)) / y, E = ((b - h) * (t - m) + (r - m) * (e - b)) / y, T = 1 - x - E; - return x < -1e-4 || E < -1e-4 || T < -1e-4 ? null : x * u + E * p + T * g; - }, is = (t, e) => { + const Rf = (t, e, s, n, i) => { + const r = s[0], h = s[1], u = s[2], d = n[0], f = n[1], p = n[2], m = i[0], b = i[1], g = i[2], _ = (f - b) * (r - m) + (m - d) * (h - b); + if (Math.abs(_) < 1e-6) return null; + const R = ((f - b) * (t - m) + (m - d) * (e - b)) / _, A = ((b - h) * (t - m) + (r - m) * (e - b)) / _, T = 1 - R - A; + return R < -1e-4 || A < -1e-4 || T < -1e-4 ? null : R * u + A * p + T * g; + }, ds = (t, e) => { let s = 1 / 0; - return An.forEach(([n, i, r]) => { - const h = yf(t, e, n, i, r); + return qn.forEach(([n, i, r]) => { + const h = Rf(t, e, n, i, r); h != null && h < s && (s = h); }), Number.isFinite(s) ? s : null; }; - Rr("back", is), Mr("back", is), Sr.forEach((t) => { + Lr("back", ds), Wr("back", ds), Br.forEach((t) => { const e = t.pts.map((r) => r[0] + "," + r[1]).join(","), n = typeof t.type == "string" && t.type.startsWith("flatRoof") ? t.fill : "#000"; - $.push(``), t.type === "cube" && df(t.id, t.pts), t.type === "cube" && t.id === "front" && mf(), t.type === "cube" && bf(t.id, t.pts), t.type === "cube" && pf(t.id), (t.type === "roofPlane" || t.type === "flatRoofTop") && gf(), t.type === "roofPlane" && !Rt && kr(); - }), Rt && ln && kr(); - const $f = (t) => { + y.push(``), t.type === "cube" && $f(t.id, t.pts), t.type === "cube" && t.id === "front" && Sf(), t.type === "cube" && xf(t.id, t.pts), t.type === "cube" && vf(t.id), (t.type === "roofPlane" || t.type === "flatRoofTop") && wf(), t.type === "roofPlane" && !At && Ir(); + }), At && xn && Ir(); + const Mf = (t) => { const e = [0.14, 0.24, 0.34, 0.44, 0.54, 0.64, 0.74, 0.84, 0.92]; let s = 0, n = 0; for (const i of e) { const r = [ - ko[0] + (t.world[0] - ko[0]) * i, - ko[1] + (t.world[1] - ko[1]) * i, - ko[2] + (t.world[2] - ko[2]) * i - ], h = G(r), u = U(h), d = is(u[0], u[1]); + Fo[0] + (t.world[0] - Fo[0]) * i, + Fo[1] + (t.world[1] - Fo[1]) * i, + Fo[2] + (t.world[2] - Fo[2]) * i + ], h = G(r), u = U(h), d = ds(u[0], u[1]); n++, (d == null || h[2] <= d - 5e-3) && s++; } return n > 0 && s >= Math.ceil(n * 0.67); - }, Nr = En.filter((t) => $f(t)); - if (vt && !du && Nr.length && _r(Nr, 1, 0.85), Rr("front", is), Mr("front", is), vt) { - $.push(``), $.push(``); - const t = Math.min(Ta, Fa), e = Math.max(Ta, Fa); + }, Vr = Gn.filter((t) => Mf(t)); + if (Nt && !$u && Vr.length && Tr(Vr, 1, 0.85), Lr("front", ds), Wr("front", ds), Nt) { + y.push(``), y.push(``); + const t = Math.min(Ua, ja), e = Math.max(Ua, ja); for (let s = 0; s < 8; s++) { - const n = s * 360 / 8, i = 20 * No; - if (Ya) { - const r = t + (e - t) * (0.5 + 0.5 * Math.sin(s * 1.71)), h = 0.18 * s + 0.07 * Math.cos(s * 2.13), u = ut ? Ks(r, h) : Zs(r, h), d = M(Gc + 0.015 * Math.sin(s * 0.93), 0.2, 1), f = M(Uc - 0.02 * Math.cos(s * 1.27), 0.25, 1), p = M(jc + 0.04 * Math.cos(s * 1.37), 0.05, 1); - $.push(``); - const m = ut ? Math.max(1, Math.round(r * co)) : 0; - $.push(``); + const m = ut ? Math.max(1, Math.round(r * lo)) : 0; + y.push(``), $.push(""); + stroke="${li}" stroke-width="${1.5 * Ao}" stroke-linecap="round" opacity="${p.toFixed(3)}"/>`), y.push(""); } else - $.push(``), $.push(``), $.push(""); + y.push(``), y.push(``), y.push(""); } } - if (Ie && !vt && uo > 0.03) { - const t = Array.isArray(js) ? js : [178, 208, 255], e = M(Rl * uo, 0, 1); - $.push(` 0.03) { + const t = Array.isArray(ca) ? ca : [178, 208, 255], e = C(Al * fo, 0, 1); + y.push(``); } - const _f = kt ? ["SUN OVERRIDE ENABLED", "Solar alignment % is disabled"] : []; - ei && $.push(``); - const Er = this._autoRotateEnabled ? Number(this._autoRotateIntervalMsDynamic || Mt) : this._manualRotateEnabled ? Number(this._manualRotateIntervalMs || this._rotationIntervalMsFloor || Mt) : Mt, vf = Za && Er > Mt; - let Sf = 0; - const rs = () => 18 + Sf++ * 16; - if (Rh && this._autoRotateEnabled) { - const t = Number.isFinite(this._autoRotateFps) ? this._autoRotateFps : 0, e = this._autoRotateIntervalMsDynamic || Mt, s = e > Mt ? " LIMIT" : ""; - $.push(`FPS ${t.toFixed(1)} | ${Math.round(e)}ms${s}`); + const Cf = $t ? ["SUN OVERRIDE ENABLED", "Solar alignment % is disabled"] : []; + di && y.push(``); + const Hr = this._autoRotateEnabled ? Number(this._autoRotateIntervalMsDynamic || Tt) : this._manualRotateEnabled ? Number(this._manualRotateIntervalMs || this._rotationIntervalMsFloor || Tt) : Tt, kf = un && Hr > Tt; + let Nf = 0; + const ps = () => 18 + Nf++ * 16; + if (Ah && this._autoRotateEnabled) { + const t = Number.isFinite(this._autoRotateFps) ? this._autoRotateFps : 0, e = this._autoRotateIntervalMsDynamic || Tt, s = e > Tt ? " LIMIT" : ""; + y.push(`FPS ${t.toFixed(1)} | ${Math.round(e)}ms${s}`); } - if (_i) { + if (Fi) { const t = Number.isFinite(this._cssFps) ? this._cssFps : 0; - $.push(`CSS FPS ${t.toFixed(1)}`); + y.push(`CSS FPS ${t.toFixed(1)}`); } - if (Oh && ut && $.push(`CSS LIMIT ${co} FPS`), vf) { - const t = Math.max(1, Math.round(1e3 / Er)); - $.push(`ROT LIMIT ${t} FPS`); + if (qh && ut && y.push(`CSS LIMIT ${lo} FPS`), kf) { + const t = Math.max(1, Math.round(1e3 / Hr)); + y.push(`ROT LIMIT ${t} FPS`); } - return _f.forEach((t, e) => { - const s = rs(), n = e === 0 ? 12 : 11; - $.push(`${t}`); - }), $.push(""), $.join(""); + return Cf.forEach((t, e) => { + const s = ps(), n = e === 0 ? 12 : 11; + y.push(`${t}`); + }), y.push(""), y.join(""); } }; -qn.styles = bc` +ri.styles = Ec` :host { display: block; --cam-control-size: 43px; @@ -2735,16 +2805,16 @@ qn.styles = bc` .cam-btn-save { left: 10px; bottom: 10px; } .cam-btn-restore { left: calc(10px + var(--cam-control-size) + 10px); bottom: 10px; } `; -let Vn = qn; -const va = "sunlight-visualizer-card"; -if (!customElements.get(va)) +let ei = ri; +const Pa = "sunlight-visualizer-card"; +if (!customElements.get(Pa)) try { - customElements.define(va, Vn); + customElements.define(Pa, ei); } catch { } -const dc = window.customCards ?? (window.customCards = []); -dc.some((S) => S.type === va) || dc.push({ - type: va, +const Cc = window.customCards ?? (window.customCards = []); +Cc.some((S) => S.type === Pa) || Cc.push({ + type: Pa, name: "Sunlight Visualizer Card", description: "2.5D sunlight visualizer house card with auto-bound integration entities.", preview: !0, diff --git a/dist/sunlight-visualizer-card.js b/dist/sunlight-visualizer-card.js index eacbd67..6e5992c 100644 --- a/dist/sunlight-visualizer-card.js +++ b/dist/sunlight-visualizer-card.js @@ -3,18 +3,18 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const $a = globalThis, Hn = $a.ShadowRoot && ($a.ShadyCSS === void 0 || $a.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Gn = Symbol(), oc = /* @__PURE__ */ new WeakMap(); -let mc = class { +const Ba = globalThis, si = Ba.ShadowRoot && (Ba.ShadyCSS === void 0 || Ba.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ai = Symbol(), mc = /* @__PURE__ */ new WeakMap(); +let Nc = class { constructor(a, c, l) { - if (this._$cssResult$ = !0, l !== Gn) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); + if (this._$cssResult$ = !0, l !== ai) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = a, this.t = c; } get styleSheet() { let a = this.o; const c = this.t; - if (Hn && a === void 0) { + if (si && a === void 0) { const l = c !== void 0 && c.length === 1; - l && (a = oc.get(c)), a === void 0 && ((this.o = a = new CSSStyleSheet()).replaceSync(this.cssText), l && oc.set(c, a)); + l && (a = mc.get(c)), a === void 0 && ((this.o = a = new CSSStyleSheet()).replaceSync(this.cssText), l && mc.set(c, a)); } return a; } @@ -22,33 +22,33 @@ let mc = class { return this.cssText; } }; -const Cf = (S) => new mc(typeof S == "string" ? S : S + "", void 0, Gn), bc = (S, ...a) => { - const c = S.length === 1 ? S[0] : a.reduce((l, o, w) => l + ((v) => { - if (v._$cssResult$ === !0) return v.cssText; - if (typeof v == "number") return v; - throw Error("Value passed to 'css' function must be a 'css' function result: " + v + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); - })(o) + S[w + 1], S[0]); - return new mc(c, S, Gn); -}, kf = (S, a) => { - if (Hn) S.adoptedStyleSheets = a.map((c) => c instanceof CSSStyleSheet ? c : c.styleSheet); +const Df = (S) => new Nc(typeof S == "string" ? S : S + "", void 0, ai), Ec = (S, ...a) => { + const c = S.length === 1 ? S[0] : a.reduce((l, o, x) => l + (($) => { + if ($._$cssResult$ === !0) return $.cssText; + if (typeof $ == "number") return $; + throw Error("Value passed to 'css' function must be a 'css' function result: " + $ + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); + })(o) + S[x + 1], S[0]); + return new Nc(c, S, ai); +}, Bf = (S, a) => { + if (si) S.adoptedStyleSheets = a.map((c) => c instanceof CSSStyleSheet ? c : c.styleSheet); else for (const c of a) { - const l = document.createElement("style"), o = $a.litNonce; + const l = document.createElement("style"), o = Ba.litNonce; o !== void 0 && l.setAttribute("nonce", o), l.textContent = c.cssText, S.appendChild(l); } -}, ec = Hn ? (S) => S : (S) => S instanceof CSSStyleSheet ? ((a) => { +}, bc = si ? (S) => S : (S) => S instanceof CSSStyleSheet ? ((a) => { let c = ""; for (const l of a.cssRules) c += l.cssText; - return Cf(c); + return Df(c); })(S) : S; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const { is: Nf, defineProperty: Ef, getOwnPropertyDescriptor: Tf, getOwnPropertyNames: Ff, getOwnPropertySymbols: Af, getPrototypeOf: Df } = Object, mo = globalThis, sc = mo.trustedTypes, Bf = sc ? sc.emptyScript : "", Bn = mo.reactiveElementPolyfillSupport, ls = (S, a) => S, Wn = { toAttribute(S, a) { +const { is: zf, defineProperty: Pf, getOwnPropertyDescriptor: Lf, getOwnPropertyNames: Wf, getOwnPropertySymbols: Of, getPrototypeOf: If } = Object, bo = globalThis, gc = bo.trustedTypes, Vf = gc ? gc.emptyScript : "", Xn = bo.reactiveElementPolyfillSupport, bs = (S, a) => S, Qn = { toAttribute(S, a) { switch (a) { case Boolean: - S = S ? Bf : null; + S = S ? Vf : null; break; case Object: case Array: @@ -73,44 +73,44 @@ const { is: Nf, defineProperty: Ef, getOwnPropertyDescriptor: Tf, getOwnProperty } } return c; -} }, gc = (S, a) => !Nf(S, a), ac = { attribute: !0, type: String, converter: Wn, reflect: !1, useDefault: !1, hasChanged: gc }; -Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), mo.litPropertyMetadata ?? (mo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); -let me = class extends HTMLElement { +} }, Fc = (S, a) => !zf(S, a), _c = { attribute: !0, type: String, converter: Qn, reflect: !1, useDefault: !1, hasChanged: Fc }; +Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), bo.litPropertyMetadata ?? (bo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); +let $e = class extends HTMLElement { static addInitializer(a) { this._$Ei(), (this.l ?? (this.l = [])).push(a); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } - static createProperty(a, c = ac) { + static createProperty(a, c = _c) { if (c.state && (c.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(a) && ((c = Object.create(c)).wrapped = !0), this.elementProperties.set(a, c), !c.noAccessor) { const l = Symbol(), o = this.getPropertyDescriptor(a, l, c); - o !== void 0 && Ef(this.prototype, a, o); + o !== void 0 && Pf(this.prototype, a, o); } } static getPropertyDescriptor(a, c, l) { - const { get: o, set: w } = Tf(this.prototype, a) ?? { get() { + const { get: o, set: x } = Lf(this.prototype, a) ?? { get() { return this[c]; - }, set(v) { - this[c] = v; + }, set($) { + this[c] = $; } }; - return { get: o, set(v) { - const P = o == null ? void 0 : o.call(this); - w == null || w.call(this, v), this.requestUpdate(a, P, l); + return { get: o, set($) { + const B = o == null ? void 0 : o.call(this); + x == null || x.call(this, $), this.requestUpdate(a, B, l); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(a) { - return this.elementProperties.get(a) ?? ac; + return this.elementProperties.get(a) ?? _c; } static _$Ei() { - if (this.hasOwnProperty(ls("elementProperties"))) return; - const a = Df(this); + if (this.hasOwnProperty(bs("elementProperties"))) return; + const a = If(this); a.finalize(), a.l !== void 0 && (this.l = [...a.l]), this.elementProperties = new Map(a.elementProperties); } static finalize() { - if (this.hasOwnProperty(ls("finalized"))) return; - if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ls("properties"))) { - const c = this.properties, l = [...Ff(c), ...Af(c)]; + if (this.hasOwnProperty(bs("finalized"))) return; + if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(bs("properties"))) { + const c = this.properties, l = [...Wf(c), ...Of(c)]; for (const o of l) this.createProperty(o, c[o]); } const a = this[Symbol.metadata]; @@ -129,8 +129,8 @@ let me = class extends HTMLElement { const c = []; if (Array.isArray(a)) { const l = new Set(a.flat(1 / 0).reverse()); - for (const o of l) c.unshift(ec(o)); - } else a !== void 0 && c.push(ec(a)); + for (const o of l) c.unshift(bc(o)); + } else a !== void 0 && c.push(bc(a)); return c; } static _$Eu(a, c) { @@ -159,7 +159,7 @@ let me = class extends HTMLElement { } createRenderRoot() { const a = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); - return kf(a, this.constructor.elementStyles), a; + return Bf(a, this.constructor.elementStyles), a; } connectedCallback() { var a; @@ -181,34 +181,34 @@ let me = class extends HTMLElement { this._$AK(a, l); } _$ET(a, c) { - var w; + var x; const l = this.constructor.elementProperties.get(a), o = this.constructor._$Eu(a, l); if (o !== void 0 && l.reflect === !0) { - const v = (((w = l.converter) == null ? void 0 : w.toAttribute) !== void 0 ? l.converter : Wn).toAttribute(c, l.type); - this._$Em = a, v == null ? this.removeAttribute(o) : this.setAttribute(o, v), this._$Em = null; + const $ = (((x = l.converter) == null ? void 0 : x.toAttribute) !== void 0 ? l.converter : Qn).toAttribute(c, l.type); + this._$Em = a, $ == null ? this.removeAttribute(o) : this.setAttribute(o, $), this._$Em = null; } } _$AK(a, c) { - var w, v; + var x, $; const l = this.constructor, o = l._$Eh.get(a); if (o !== void 0 && this._$Em !== o) { - const P = l.getPropertyOptions(o), k = typeof P.converter == "function" ? { fromAttribute: P.converter } : ((w = P.converter) == null ? void 0 : w.fromAttribute) !== void 0 ? P.converter : Wn; + const B = l.getPropertyOptions(o), k = typeof B.converter == "function" ? { fromAttribute: B.converter } : ((x = B.converter) == null ? void 0 : x.fromAttribute) !== void 0 ? B.converter : Qn; this._$Em = o; - const W = k.fromAttribute(c, P.type); - this[o] = W ?? ((v = this._$Ej) == null ? void 0 : v.get(o)) ?? W, this._$Em = null; + const O = k.fromAttribute(c, B.type); + this[o] = O ?? (($ = this._$Ej) == null ? void 0 : $.get(o)) ?? O, this._$Em = null; } } - requestUpdate(a, c, l, o = !1, w) { - var v; + requestUpdate(a, c, l, o = !1, x) { + var $; if (a !== void 0) { - const P = this.constructor; - if (o === !1 && (w = this[a]), l ?? (l = P.getPropertyOptions(a)), !((l.hasChanged ?? gc)(w, c) || l.useDefault && l.reflect && w === ((v = this._$Ej) == null ? void 0 : v.get(a)) && !this.hasAttribute(P._$Eu(a, l)))) return; + const B = this.constructor; + if (o === !1 && (x = this[a]), l ?? (l = B.getPropertyOptions(a)), !((l.hasChanged ?? Fc)(x, c) || l.useDefault && l.reflect && x === (($ = this._$Ej) == null ? void 0 : $.get(a)) && !this.hasAttribute(B._$Eu(a, l)))) return; this.C(a, c, l); } this.isUpdatePending === !1 && (this._$ES = this._$EP()); } - C(a, c, { useDefault: l, reflect: o, wrapped: w }, v) { - l && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(a) && (this._$Ej.set(a, v ?? c ?? this[a]), w !== !0 || v !== void 0) || (this._$AL.has(a) || (this.hasUpdated || l || (c = void 0), this._$AL.set(a, c)), o === !0 && this._$Em !== a && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(a)); + C(a, c, { useDefault: l, reflect: o, wrapped: x }, $) { + l && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(a) && (this._$Ej.set(a, $ ?? c ?? this[a]), x !== !0 || $ !== void 0) || (this._$AL.has(a) || (this.hasUpdated || l || (c = void 0), this._$AL.set(a, c)), o === !0 && this._$Em !== a && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(a)); } async _$EP() { this.isUpdatePending = !0; @@ -228,21 +228,21 @@ let me = class extends HTMLElement { if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { - for (const [w, v] of this._$Ep) this[w] = v; + for (const [x, $] of this._$Ep) this[x] = $; this._$Ep = void 0; } const o = this.constructor.elementProperties; - if (o.size > 0) for (const [w, v] of o) { - const { wrapped: P } = v, k = this[w]; - P !== !0 || this._$AL.has(w) || k === void 0 || this.C(w, void 0, v, k); + if (o.size > 0) for (const [x, $] of o) { + const { wrapped: B } = $, k = this[x]; + B !== !0 || this._$AL.has(x) || k === void 0 || this.C(x, void 0, $, k); } } let a = !1; const c = this._$AL; try { a = this.shouldUpdate(c), a ? (this.willUpdate(c), (l = this._$EO) == null || l.forEach((o) => { - var w; - return (w = o.hostUpdate) == null ? void 0 : w.call(o); + var x; + return (x = o.hostUpdate) == null ? void 0 : x.call(o); }), this.update(c)) : this._$EM(); } catch (o) { throw a = !1, this._$EM(), o; @@ -278,76 +278,76 @@ let me = class extends HTMLElement { firstUpdated(a) { } }; -me.elementStyles = [], me.shadowRootOptions = { mode: "open" }, me[ls("elementProperties")] = /* @__PURE__ */ new Map(), me[ls("finalized")] = /* @__PURE__ */ new Map(), Bn == null || Bn({ ReactiveElement: me }), (mo.reactiveElementVersions ?? (mo.reactiveElementVersions = [])).push("2.1.2"); +$e.elementStyles = [], $e.shadowRootOptions = { mode: "open" }, $e[bs("elementProperties")] = /* @__PURE__ */ new Map(), $e[bs("finalized")] = /* @__PURE__ */ new Map(), Xn == null || Xn({ ReactiveElement: $e }), (bo.reactiveElementVersions ?? (bo.reactiveElementVersions = [])).push("2.1.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const hs = globalThis, nc = (S) => S, _a = hs.trustedTypes, ic = _a ? _a.createPolicy("lit-html", { createHTML: (S) => S }) : void 0, yc = "$lit$", po = `lit$${Math.random().toFixed(9).slice(2)}$`, $c = "?" + po, Pf = `<${$c}>`, Io = document, us = () => Io.createComment(""), fs = (S) => S === null || typeof S != "object" && typeof S != "function", Un = Array.isArray, zf = (S) => Un(S) || typeof (S == null ? void 0 : S[Symbol.iterator]) == "function", Pn = `[ -\f\r]`, cs = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rc = /-->/g, cc = />/g, zo = RegExp(`>|${Pn}(?:([^\\s"'>=/]+)(${Pn}*=${Pn}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`, "g"), lc = /'/g, hc = /"/g, _c = /^(?:script|style|textarea|title)$/i, Lf = (S) => (a, ...c) => ({ _$litType$: S, strings: a, values: c }), Lo = Lf(1), Vo = Symbol.for("lit-noChange"), at = Symbol.for("lit-nothing"), uc = /* @__PURE__ */ new WeakMap(), Wo = Io.createTreeWalker(Io, 129); -function vc(S, a) { - if (!Un(S) || !S.hasOwnProperty("raw")) throw Error("invalid template strings array"); - return ic !== void 0 ? ic.createHTML(a) : a; +const gs = globalThis, yc = (S) => S, za = gs.trustedTypes, $c = za ? za.createPolicy("lit-html", { createHTML: (S) => S }) : void 0, Ac = "$lit$", mo = `lit$${Math.random().toFixed(9).slice(2)}$`, Tc = "?" + mo, Hf = `<${Tc}>`, Go = document, _s = () => Go.createComment(""), ys = (S) => S === null || typeof S != "object" && typeof S != "function", ni = Array.isArray, Gf = (S) => ni(S) || typeof (S == null ? void 0 : S[Symbol.iterator]) == "function", Zn = `[ +\f\r]`, ms = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, vc = /-->/g, Sc = />/g, Oo = RegExp(`>|${Zn}(?:([^\\s"'>=/]+)(${Zn}*=${Zn}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`, "g"), xc = /'/g, wc = /"/g, Dc = /^(?:script|style|textarea|title)$/i, Uf = (S) => (a, ...c) => ({ _$litType$: S, strings: a, values: c }), Io = Uf(1), Uo = Symbol.for("lit-noChange"), st = Symbol.for("lit-nothing"), Rc = /* @__PURE__ */ new WeakMap(), Vo = Go.createTreeWalker(Go, 129); +function Bc(S, a) { + if (!ni(S) || !S.hasOwnProperty("raw")) throw Error("invalid template strings array"); + return $c !== void 0 ? $c.createHTML(a) : a; } -const Wf = (S, a) => { +const jf = (S, a) => { const c = S.length - 1, l = []; - let o, w = a === 2 ? "" : a === 3 ? "" : "", v = cs; - for (let P = 0; P < c; P++) { - const k = S[P]; - let W, Y, V = -1, Q = 0; - for (; Q < k.length && (v.lastIndex = Q, Y = v.exec(k), Y !== null); ) Q = v.lastIndex, v === cs ? Y[1] === "!--" ? v = rc : Y[1] !== void 0 ? v = cc : Y[2] !== void 0 ? (_c.test(Y[2]) && (o = RegExp("" ? (v = o ?? cs, V = -1) : Y[1] === void 0 ? V = -2 : (V = v.lastIndex - Y[2].length, W = Y[1], v = Y[3] === void 0 ? zo : Y[3] === '"' ? hc : lc) : v === hc || v === lc ? v = zo : v === rc || v === cc ? v = cs : (v = zo, o = void 0); - const q = v === zo && S[P + 1].startsWith("/>") ? " " : ""; - w += v === cs ? k + Pf : V >= 0 ? (l.push(W), k.slice(0, V) + yc + k.slice(V) + po + q) : k + po + (V === -2 ? P : q); - } - return [vc(S, w + (S[c] || "") + (a === 2 ? "" : a === 3 ? "" : "")), l]; + let o, x = a === 2 ? "" : a === 3 ? "" : "", $ = ms; + for (let B = 0; B < c; B++) { + const k = S[B]; + let O, Y, L = -1, tt = 0; + for (; tt < k.length && ($.lastIndex = tt, Y = $.exec(k), Y !== null); ) tt = $.lastIndex, $ === ms ? Y[1] === "!--" ? $ = vc : Y[1] !== void 0 ? $ = Sc : Y[2] !== void 0 ? (Dc.test(Y[2]) && (o = RegExp("" ? ($ = o ?? ms, L = -1) : Y[1] === void 0 ? L = -2 : (L = $.lastIndex - Y[2].length, O = Y[1], $ = Y[3] === void 0 ? Oo : Y[3] === '"' ? wc : xc) : $ === wc || $ === xc ? $ = Oo : $ === vc || $ === Sc ? $ = ms : ($ = Oo, o = void 0); + const j = $ === Oo && S[B + 1].startsWith("/>") ? " " : ""; + x += $ === ms ? k + Hf : L >= 0 ? (l.push(O), k.slice(0, L) + Ac + k.slice(L) + mo + j) : k + mo + (L === -2 ? B : j); + } + return [Bc(S, x + (S[c] || "") + (a === 2 ? "" : a === 3 ? "" : "")), l]; }; -class ds { +class $s { constructor({ strings: a, _$litType$: c }, l) { let o; this.parts = []; - let w = 0, v = 0; - const P = a.length - 1, k = this.parts, [W, Y] = Wf(a, c); - if (this.el = ds.createElement(W, l), Wo.currentNode = this.el.content, c === 2 || c === 3) { - const V = this.el.content.firstChild; - V.replaceWith(...V.childNodes); + let x = 0, $ = 0; + const B = a.length - 1, k = this.parts, [O, Y] = jf(a, c); + if (this.el = $s.createElement(O, l), Vo.currentNode = this.el.content, c === 2 || c === 3) { + const L = this.el.content.firstChild; + L.replaceWith(...L.childNodes); } - for (; (o = Wo.nextNode()) !== null && k.length < P; ) { + for (; (o = Vo.nextNode()) !== null && k.length < B; ) { if (o.nodeType === 1) { - if (o.hasAttributes()) for (const V of o.getAttributeNames()) if (V.endsWith(yc)) { - const Q = Y[v++], q = o.getAttribute(V).split(po), O = /([.?@])?(.*)/.exec(Q); - k.push({ type: 1, index: w, name: O[2], strings: q, ctor: O[1] === "." ? If : O[1] === "?" ? Vf : O[1] === "@" ? Hf : Sa }), o.removeAttribute(V); - } else V.startsWith(po) && (k.push({ type: 6, index: w }), o.removeAttribute(V)); - if (_c.test(o.tagName)) { - const V = o.textContent.split(po), Q = V.length - 1; - if (Q > 0) { - o.textContent = _a ? _a.emptyScript : ""; - for (let q = 0; q < Q; q++) o.append(V[q], us()), Wo.nextNode(), k.push({ type: 2, index: ++w }); - o.append(V[Q], us()); + if (o.hasAttributes()) for (const L of o.getAttributeNames()) if (L.endsWith(Ac)) { + const tt = Y[$++], j = o.getAttribute(L).split(mo), z = /([.?@])?(.*)/.exec(tt); + k.push({ type: 1, index: x, name: z[2], strings: j, ctor: z[1] === "." ? Yf : z[1] === "?" ? Xf : z[1] === "@" ? Zf : La }), o.removeAttribute(L); + } else L.startsWith(mo) && (k.push({ type: 6, index: x }), o.removeAttribute(L)); + if (Dc.test(o.tagName)) { + const L = o.textContent.split(mo), tt = L.length - 1; + if (tt > 0) { + o.textContent = za ? za.emptyScript : ""; + for (let j = 0; j < tt; j++) o.append(L[j], _s()), Vo.nextNode(), k.push({ type: 2, index: ++x }); + o.append(L[tt], _s()); } } - } else if (o.nodeType === 8) if (o.data === $c) k.push({ type: 2, index: w }); + } else if (o.nodeType === 8) if (o.data === Tc) k.push({ type: 2, index: x }); else { - let V = -1; - for (; (V = o.data.indexOf(po, V + 1)) !== -1; ) k.push({ type: 7, index: w }), V += po.length - 1; + let L = -1; + for (; (L = o.data.indexOf(mo, L + 1)) !== -1; ) k.push({ type: 7, index: x }), L += mo.length - 1; } - w++; + x++; } } static createElement(a, c) { - const l = Io.createElement("template"); + const l = Go.createElement("template"); return l.innerHTML = a, l; } } -function ge(S, a, c = S, l) { - var v, P; - if (a === Vo) return a; - let o = l !== void 0 ? (v = c._$Co) == null ? void 0 : v[l] : c._$Cl; - const w = fs(a) ? void 0 : a._$litDirective$; - return (o == null ? void 0 : o.constructor) !== w && ((P = o == null ? void 0 : o._$AO) == null || P.call(o, !1), w === void 0 ? o = void 0 : (o = new w(S), o._$AT(S, c, l)), l !== void 0 ? (c._$Co ?? (c._$Co = []))[l] = o : c._$Cl = o), o !== void 0 && (a = ge(S, o._$AS(S, a.values), o, l)), a; +function Se(S, a, c = S, l) { + var $, B; + if (a === Uo) return a; + let o = l !== void 0 ? ($ = c._$Co) == null ? void 0 : $[l] : c._$Cl; + const x = ys(a) ? void 0 : a._$litDirective$; + return (o == null ? void 0 : o.constructor) !== x && ((B = o == null ? void 0 : o._$AO) == null || B.call(o, !1), x === void 0 ? o = void 0 : (o = new x(S), o._$AT(S, c, l)), l !== void 0 ? (c._$Co ?? (c._$Co = []))[l] = o : c._$Cl = o), o !== void 0 && (a = Se(S, o._$AS(S, a.values), o, l)), a; } -class Of { +class qf { constructor(a, c) { this._$AV = [], this._$AN = void 0, this._$AD = a, this._$AM = c; } @@ -358,30 +358,30 @@ class Of { return this._$AM._$AU; } u(a) { - const { el: { content: c }, parts: l } = this._$AD, o = ((a == null ? void 0 : a.creationScope) ?? Io).importNode(c, !0); - Wo.currentNode = o; - let w = Wo.nextNode(), v = 0, P = 0, k = l[0]; + const { el: { content: c }, parts: l } = this._$AD, o = ((a == null ? void 0 : a.creationScope) ?? Go).importNode(c, !0); + Vo.currentNode = o; + let x = Vo.nextNode(), $ = 0, B = 0, k = l[0]; for (; k !== void 0; ) { - if (v === k.index) { - let W; - k.type === 2 ? W = new ps(w, w.nextSibling, this, a) : k.type === 1 ? W = new k.ctor(w, k.name, k.strings, this, a) : k.type === 6 && (W = new Gf(w, this, a)), this._$AV.push(W), k = l[++P]; + if ($ === k.index) { + let O; + k.type === 2 ? O = new vs(x, x.nextSibling, this, a) : k.type === 1 ? O = new k.ctor(x, k.name, k.strings, this, a) : k.type === 6 && (O = new Kf(x, this, a)), this._$AV.push(O), k = l[++B]; } - v !== (k == null ? void 0 : k.index) && (w = Wo.nextNode(), v++); + $ !== (k == null ? void 0 : k.index) && (x = Vo.nextNode(), $++); } - return Wo.currentNode = Io, o; + return Vo.currentNode = Go, o; } p(a) { let c = 0; for (const l of this._$AV) l !== void 0 && (l.strings !== void 0 ? (l._$AI(a, l, c), c += l.strings.length - 2) : l._$AI(a[c])), c++; } } -class ps { +class vs { get _$AU() { var a; return ((a = this._$AM) == null ? void 0 : a._$AU) ?? this._$Cv; } constructor(a, c, l, o) { - this.type = 2, this._$AH = at, this._$AN = void 0, this._$AA = a, this._$AB = c, this._$AM = l, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0; + this.type = 2, this._$AH = st, this._$AN = void 0, this._$AA = a, this._$AB = c, this._$AM = l, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0; } get parentNode() { let a = this._$AA.parentNode; @@ -395,7 +395,7 @@ class ps { return this._$AB; } _$AI(a, c = this) { - a = ge(this, a, c), fs(a) ? a === at || a == null || a === "" ? (this._$AH !== at && this._$AR(), this._$AH = at) : a !== this._$AH && a !== Vo && this._(a) : a._$litType$ !== void 0 ? this.$(a) : a.nodeType !== void 0 ? this.T(a) : zf(a) ? this.k(a) : this._(a); + a = Se(this, a, c), ys(a) ? a === st || a == null || a === "" ? (this._$AH !== st && this._$AR(), this._$AH = st) : a !== this._$AH && a !== Uo && this._(a) : a._$litType$ !== void 0 ? this.$(a) : a.nodeType !== void 0 ? this.T(a) : Gf(a) ? this.k(a) : this._(a); } O(a) { return this._$AA.parentNode.insertBefore(a, this._$AB); @@ -404,33 +404,33 @@ class ps { this._$AH !== a && (this._$AR(), this._$AH = this.O(a)); } _(a) { - this._$AH !== at && fs(this._$AH) ? this._$AA.nextSibling.data = a : this.T(Io.createTextNode(a)), this._$AH = a; + this._$AH !== st && ys(this._$AH) ? this._$AA.nextSibling.data = a : this.T(Go.createTextNode(a)), this._$AH = a; } $(a) { - var w; - const { values: c, _$litType$: l } = a, o = typeof l == "number" ? this._$AC(a) : (l.el === void 0 && (l.el = ds.createElement(vc(l.h, l.h[0]), this.options)), l); - if (((w = this._$AH) == null ? void 0 : w._$AD) === o) this._$AH.p(c); + var x; + const { values: c, _$litType$: l } = a, o = typeof l == "number" ? this._$AC(a) : (l.el === void 0 && (l.el = $s.createElement(Bc(l.h, l.h[0]), this.options)), l); + if (((x = this._$AH) == null ? void 0 : x._$AD) === o) this._$AH.p(c); else { - const v = new Of(o, this), P = v.u(this.options); - v.p(c), this.T(P), this._$AH = v; + const $ = new qf(o, this), B = $.u(this.options); + $.p(c), this.T(B), this._$AH = $; } } _$AC(a) { - let c = uc.get(a.strings); - return c === void 0 && uc.set(a.strings, c = new ds(a)), c; + let c = Rc.get(a.strings); + return c === void 0 && Rc.set(a.strings, c = new $s(a)), c; } k(a) { - Un(this._$AH) || (this._$AH = [], this._$AR()); + ni(this._$AH) || (this._$AH = [], this._$AR()); const c = this._$AH; let l, o = 0; - for (const w of a) o === c.length ? c.push(l = new ps(this.O(us()), this.O(us()), this, this.options)) : l = c[o], l._$AI(w), o++; + for (const x of a) o === c.length ? c.push(l = new vs(this.O(_s()), this.O(_s()), this, this.options)) : l = c[o], l._$AI(x), o++; o < c.length && (this._$AR(l && l._$AB.nextSibling, o), c.length = o); } _$AR(a = this._$AA.nextSibling, c) { var l; for ((l = this._$AP) == null ? void 0 : l.call(this, !1, !0, c); a !== this._$AB; ) { - const o = nc(a).nextSibling; - nc(a).remove(), a = o; + const o = yc(a).nextSibling; + yc(a).remove(), a = o; } } setConnected(a) { @@ -438,62 +438,62 @@ class ps { this._$AM === void 0 && (this._$Cv = a, (c = this._$AP) == null || c.call(this, a)); } } -class Sa { +class La { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } - constructor(a, c, l, o, w) { - this.type = 1, this._$AH = at, this._$AN = void 0, this.element = a, this.name = c, this._$AM = o, this.options = w, l.length > 2 || l[0] !== "" || l[1] !== "" ? (this._$AH = Array(l.length - 1).fill(new String()), this.strings = l) : this._$AH = at; + constructor(a, c, l, o, x) { + this.type = 1, this._$AH = st, this._$AN = void 0, this.element = a, this.name = c, this._$AM = o, this.options = x, l.length > 2 || l[0] !== "" || l[1] !== "" ? (this._$AH = Array(l.length - 1).fill(new String()), this.strings = l) : this._$AH = st; } _$AI(a, c = this, l, o) { - const w = this.strings; - let v = !1; - if (w === void 0) a = ge(this, a, c, 0), v = !fs(a) || a !== this._$AH && a !== Vo, v && (this._$AH = a); + const x = this.strings; + let $ = !1; + if (x === void 0) a = Se(this, a, c, 0), $ = !ys(a) || a !== this._$AH && a !== Uo, $ && (this._$AH = a); else { - const P = a; - let k, W; - for (a = w[0], k = 0; k < w.length - 1; k++) W = ge(this, P[l + k], c, k), W === Vo && (W = this._$AH[k]), v || (v = !fs(W) || W !== this._$AH[k]), W === at ? a = at : a !== at && (a += (W ?? "") + w[k + 1]), this._$AH[k] = W; + const B = a; + let k, O; + for (a = x[0], k = 0; k < x.length - 1; k++) O = Se(this, B[l + k], c, k), O === Uo && (O = this._$AH[k]), $ || ($ = !ys(O) || O !== this._$AH[k]), O === st ? a = st : a !== st && (a += (O ?? "") + x[k + 1]), this._$AH[k] = O; } - v && !o && this.j(a); + $ && !o && this.j(a); } j(a) { - a === at ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, a ?? ""); + a === st ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, a ?? ""); } } -class If extends Sa { +class Yf extends La { constructor() { super(...arguments), this.type = 3; } j(a) { - this.element[this.name] = a === at ? void 0 : a; + this.element[this.name] = a === st ? void 0 : a; } } -class Vf extends Sa { +class Xf extends La { constructor() { super(...arguments), this.type = 4; } j(a) { - this.element.toggleAttribute(this.name, !!a && a !== at); + this.element.toggleAttribute(this.name, !!a && a !== st); } } -class Hf extends Sa { - constructor(a, c, l, o, w) { - super(a, c, l, o, w), this.type = 5; +class Zf extends La { + constructor(a, c, l, o, x) { + super(a, c, l, o, x), this.type = 5; } _$AI(a, c = this) { - if ((a = ge(this, a, c, 0) ?? at) === Vo) return; - const l = this._$AH, o = a === at && l !== at || a.capture !== l.capture || a.once !== l.once || a.passive !== l.passive, w = a !== at && (l === at || o); - o && this.element.removeEventListener(this.name, this, l), w && this.element.addEventListener(this.name, this, a), this._$AH = a; + if ((a = Se(this, a, c, 0) ?? st) === Uo) return; + const l = this._$AH, o = a === st && l !== st || a.capture !== l.capture || a.once !== l.once || a.passive !== l.passive, x = a !== st && (l === st || o); + o && this.element.removeEventListener(this.name, this, l), x && this.element.addEventListener(this.name, this, a), this._$AH = a; } handleEvent(a) { var c; typeof this._$AH == "function" ? this._$AH.call(((c = this.options) == null ? void 0 : c.host) ?? this.element, a) : this._$AH.handleEvent(a); } } -class Gf { +class Kf { constructor(a, c, l) { this.element = a, this.type = 6, this._$AN = void 0, this._$AM = c, this.options = l; } @@ -501,17 +501,17 @@ class Gf { return this._$AM._$AU; } _$AI(a) { - ge(this, a); + Se(this, a); } } -const zn = hs.litHtmlPolyfillSupport; -zn == null || zn(ds, ps), (hs.litHtmlVersions ?? (hs.litHtmlVersions = [])).push("3.3.2"); -const Uf = (S, a, c) => { +const Kn = gs.litHtmlPolyfillSupport; +Kn == null || Kn($s, vs), (gs.litHtmlVersions ?? (gs.litHtmlVersions = [])).push("3.3.2"); +const Jf = (S, a, c) => { const l = (c == null ? void 0 : c.renderBefore) ?? a; let o = l._$litPart$; if (o === void 0) { - const w = (c == null ? void 0 : c.renderBefore) ?? null; - l._$litPart$ = o = new ps(a.insertBefore(us(), w), w, void 0, c ?? {}); + const x = (c == null ? void 0 : c.renderBefore) ?? null; + l._$litPart$ = o = new vs(a.insertBefore(_s(), x), x, void 0, c ?? {}); } return o._$AI(S), o; }; @@ -520,8 +520,8 @@ const Uf = (S, a, c) => { * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const Oo = globalThis; -let be = class extends me { +const Ho = globalThis; +let ve = class extends $e { constructor() { super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; } @@ -532,7 +532,7 @@ let be = class extends me { } update(a) { const c = this.render(); - this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(a), this._$Do = Uf(c, this.renderRoot, this.renderOptions); + this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(a), this._$Do = Jf(c, this.renderRoot, this.renderOptions); } connectedCallback() { var a; @@ -543,21 +543,21 @@ let be = class extends me { super.disconnectedCallback(), (a = this._$Do) == null || a.setConnected(!1); } render() { - return Vo; + return Uo; } }; -var pc; -be._$litElement$ = !0, be.finalized = !0, (pc = Oo.litElementHydrateSupport) == null || pc.call(Oo, { LitElement: be }); -const Ln = Oo.litElementPolyfillSupport; -Ln == null || Ln({ LitElement: be }); -(Oo.litElementVersions ?? (Oo.litElementVersions = [])).push("4.2.2"); +var kc; +ve._$litElement$ = !0, ve.finalized = !0, (kc = Ho.litElementHydrateSupport) == null || kc.call(Ho, { LitElement: ve }); +const Jn = Ho.litElementPolyfillSupport; +Jn == null || Jn({ LitElement: ve }); +(Ho.litElementVersions ?? (Ho.litElementVersions = [])).push("4.2.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const jf = { CHILD: 2 }, qf = (S) => (...a) => ({ _$litDirective$: S, values: a }); -class Yf { +const Qf = { CHILD: 2 }, td = (S) => (...a) => ({ _$litDirective$: S, values: a }); +class od { constructor(a) { } get _$AU() { @@ -578,13 +578,13 @@ class Yf { * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -class On extends Yf { +class ti extends od { constructor(a) { - if (super(a), this.it = at, a.type !== jf.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings"); + if (super(a), this.it = st, a.type !== Qf.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings"); } render(a) { - if (a === at || a == null) return this._t = void 0, this.it = a; - if (a === Vo) return a; + if (a === st || a == null) return this._t = void 0, this.it = a; + if (a === Uo) return a; if (typeof a != "string") throw Error(this.constructor.directiveName + "() called with a non-string value"); if (a === this.it) return this._t; this.it = a; @@ -592,8 +592,8 @@ class On extends Yf { return c.raw = c, this._t = { _$litType$: this.constructor.resultType, strings: c, values: [] }; } } -On.directiveName = "unsafeHTML", On.resultType = 1; -const Xf = qf(On), jn = class jn extends be { +ti.directiveName = "unsafeHTML", ti.resultType = 1; +const ed = td(ti), ii = class ii extends ve { constructor() { super(...arguments), this._config = {}; } @@ -615,13 +615,13 @@ const Xf = qf(On), jn = class jn extends be { ); } _valueChanged(a) { - var w; + var x; const c = a.target, l = c == null ? void 0 : c.configValue; if (!l) return; - let o = ((w = a.detail) == null ? void 0 : w.value) ?? c.value; + let o = ((x = a.detail) == null ? void 0 : x.value) ?? c.value; if (c.checked !== void 0 && (o = c.checked), c.type === "number") { - const v = Number(o); - Number.isNaN(v) || (o = v); + const $ = Number(o); + Number.isNaN($) || (o = $); } this._setConfigValue(l, o); } @@ -635,44 +635,49 @@ const Xf = qf(On), jn = class jn extends be { this._hass && this._hass.callService("sunlight_visualizer", "set_options", a); } render() { - var mt, $o, zt, Ut, eo, bt, Lt, wt, xt, jt, _o, nt, $t, ht, Ft, _e, Uo, ms, bs, gs, ys, $s, ve, Se, wa, we, _s, jo, so, ao, qo, Wt, et, vs, Ss, vo, no, H, Yo, Xo, ws, xs, So, Rt, Rs, Ms, Cs, xe, Re, Me, Ce, Zo, ke, Ne, ks, Ns, Es, Ts, Fs, Ee, As, Ds, Te, Bs, Ps, Ko, zs, Ls, Fe, Ae, De, Be, Pe, wo, xo, ze, io, ro, Le, Ws, Os, Is, Vs; - if (!this._hass) return Lo``; + var Ft, Yt, vo, it, Ct, ht, So, _t, we, Zo, Ss, Re, Lt, xo, xs, ws, Rs, Ms, Me, Ce, Wa, ke, Cs, Ko, ao, no, Jo, mt, ot, ks, Ns, wo, io, H, Qo, te, Es, Fs, Ro, At, As, Ts, Ds, Ne, Ee, Fe, Ae, oe, Te, De, Bs, zs, Ps, Ls, Ws, Be, Os, Is, ze, Vs, Hs, ee, Gs, Us, Pe, Le, We, Oe, Ie, Mo, Co, Ve, ro, co, He, js, qs, Ys, Xs, Zs, Ks, Js, Qs, ta, oa, ea, Ge, Ue, se, sa, aa, na; + if (!this._hass) return Io``; const a = this._config || {}, c = a.siSourceAttr ?? "sunlight_visualizer_source", l = a.siSourceValue ?? "sunlight_visualizer", o = Object.entries(this._hass.states ?? {}).filter( - ([, N]) => { - var D; - return ((D = N == null ? void 0 : N.attributes) == null ? void 0 : D[c]) === l; + ([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F[c]) === l; } - ), w = (N) => { - for (const [D, X] of o) - if (N(X, D)) return D; + ), x = (w) => { + for (const [F, X] of o) + if (w(X, F)) return F; return null; - }, v = (N) => w((D) => { + }, $ = (w) => x((F) => { var X; - return ((X = D == null ? void 0 : D.attributes) == null ? void 0 : X.camera_rotation) === N; - }), P = (N) => w((D) => { + return ((X = F == null ? void 0 : F.attributes) == null ? void 0 : X.camera_rotation) === w; + }), B = (w) => x((F) => { var X; - return ((X = D == null ? void 0 : D.attributes) == null ? void 0 : X.si_setting) === N; - }), k = a.rotationHEntity ?? v("h") ?? "", W = a.rotationVEntity ?? v("v") ?? "", Y = a.houseAngleEntity ?? P("house_angle") ?? "", V = P("ceiling_tilt") ?? "", Q = P("house_direction") ?? "", q = P("roof_direction") ?? "", O = (N, D = !1) => { - if (N == null || N === "") return D; - if (typeof N == "boolean") return N; - if (typeof N == "number") return N !== 0; - if (typeof N == "string") { - const X = N.trim().toLowerCase(); + return ((X = F == null ? void 0 : F.attributes) == null ? void 0 : X.si_setting) === w; + }), k = a.rotationHEntity ?? $("h") ?? "", O = a.rotationVEntity ?? $("v") ?? "", Y = a.houseAngleEntity ?? B("house_angle") ?? "", L = B("ceiling_tilt") ?? "", tt = B("house_direction") ?? "", j = B("roof_direction") ?? "", z = (w, F = !1) => { + if (w == null || w === "") return F; + if (typeof w == "boolean") return w; + if (typeof w == "number") return w !== 0; + if (typeof w == "string") { + const X = w.trim().toLowerCase(); if (["true", "1", "yes", "on"].includes(X)) return !0; if (["false", "0", "no", "off"].includes(X)) return !1; } - return D; + return F; }; - let F = "", kt, Nt; - for (const [, N] of o) - !F && ((mt = N == null ? void 0 : N.attributes) != null && mt.roof_power_entity) && (F = N.attributes.roof_power_entity), kt === void 0 && (($o = N == null ? void 0 : N.attributes) == null ? void 0 : $o.roof_power_enabled) !== void 0 && (kt = N.attributes.roof_power_enabled), Nt === void 0 && ((zt = N == null ? void 0 : N.attributes) == null ? void 0 : zt.roof_power_invert) !== void 0 && (Nt = N.attributes.roof_power_invert); - const Bt = a.preferIntegrationSettings ?? !0, Pt = o.length > 0, Qt = Bt ? F || a.roofPowerEntity || "" : a.roofPowerEntity || F || "", J = Bt ? O(kt, O(a.roofPowerEnabled, !1)) : O(a.roofPowerEnabled, O(kt, !1)), tt = Bt ? O(Nt, O(a.roofPowerInvert, !1)) : O(a.roofPowerInvert, O(Nt, !1)), Et = Number((bt = (eo = (Ut = o.find(([, N]) => { - var D; - return ((D = N == null ? void 0 : N.attributes) == null ? void 0 : D.auto_rotate_speed) != null; - })) == null ? void 0 : Ut[1]) == null ? void 0 : eo.attributes) == null ? void 0 : bt.auto_rotate_speed), to = Bt && Number.isFinite(Et) ? Et : Number(a.autoRotateSpeed ?? (Number.isFinite(Et) ? Et : 25)); - Number(((xt = (wt = (Lt = this._hass) == null ? void 0 : Lt.states) == null ? void 0 : wt[Y]) == null ? void 0 : xt.state) ?? a.houseAngle ?? 0); - const Tt = ["North", "NE", "East", "SE", "South", "SW", "West", "NW", "Custom"], ot = ["front", "back", "left", "right"], oo = !!Q, bo = !!q, ye = oo ? (($t = (nt = (_o = (jt = this._hass) == null ? void 0 : jt.states) == null ? void 0 : _o[Q]) == null ? void 0 : nt.attributes) == null ? void 0 : $t.options) ?? Tt : Tt, Ho = bo ? ((Uo = (_e = (Ft = (ht = this._hass) == null ? void 0 : ht.states) == null ? void 0 : Ft[q]) == null ? void 0 : _e.attributes) == null ? void 0 : Uo.options) ?? ot : ot, go = oo ? ((gs = (bs = (ms = this._hass) == null ? void 0 : ms.states) == null ? void 0 : bs[Q]) == null ? void 0 : gs.state) ?? "Custom" : a.houseDirection ?? "Custom", Go = bo ? ((ve = ($s = (ys = this._hass) == null ? void 0 : ys.states) == null ? void 0 : $s[q]) == null ? void 0 : ve.state) ?? "front" : a.roofTiltFace ?? "front", $e = !!k, rt = !!W, yo = !!V; - return Lo` + let E = "", $t, vt, wt, Rt; + for (const [, w] of o) + !E && ((Ft = w == null ? void 0 : w.attributes) != null && Ft.roof_power_entity) && (E = w.attributes.roof_power_entity), $t === void 0 && ((Yt = w == null ? void 0 : w.attributes) == null ? void 0 : Yt.roof_power_enabled) !== void 0 && ($t = w.attributes.roof_power_enabled), vt === void 0 && ((vo = w == null ? void 0 : w.attributes) == null ? void 0 : vo.roof_power_invert) !== void 0 && (vt = w.attributes.roof_power_invert), wt === void 0 && ((it = w == null ? void 0 : w.attributes) == null ? void 0 : it.fixed_sun_rotation_enabled) !== void 0 && (wt = w.attributes.fixed_sun_rotation_enabled), Rt === void 0 && ((Ct = w == null ? void 0 : w.attributes) == null ? void 0 : Ct.fixed_sun_azimuth) !== void 0 && (Rt = w.attributes.fixed_sun_azimuth); + const ft = a.preferIntegrationSettings ?? !0, Z = o.length > 0, Q = ft ? E || a.roofPowerEntity || "" : a.roofPowerEntity || E || "", Bt = ft ? z($t, z(a.roofPowerEnabled, !1)) : z(a.roofPowerEnabled, z($t, !1)), zt = ft ? z(vt, z(a.roofPowerInvert, !1)) : z(a.roofPowerInvert, z(vt, !1)), dt = Number((_t = (So = (ht = o.find(([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F.auto_rotate_speed) != null; + })) == null ? void 0 : ht[1]) == null ? void 0 : So.attributes) == null ? void 0 : _t.auto_rotate_speed), at = ft && Number.isFinite(dt) ? dt : Number(a.autoRotateSpeed ?? (Number.isFinite(dt) ? dt : 25)); + Number(((Ss = (Zo = (we = this._hass) == null ? void 0 : we.states) == null ? void 0 : Zo[Y]) == null ? void 0 : Ss.state) ?? a.houseAngle ?? 0); + const go = ["North", "NE", "East", "SE", "South", "SW", "West", "NW", "Custom"], jo = ["front", "back", "left", "right"], _o = !!tt, eo = !!j, qo = _o ? ((xs = (xo = (Lt = (Re = this._hass) == null ? void 0 : Re.states) == null ? void 0 : Lt[tt]) == null ? void 0 : xo.attributes) == null ? void 0 : xs.options) ?? go : go, xe = eo ? ((Me = (Ms = (Rs = (ws = this._hass) == null ? void 0 : ws.states) == null ? void 0 : Rs[j]) == null ? void 0 : Ms.attributes) == null ? void 0 : Me.options) ?? jo : jo, Yo = _o ? ((ke = (Wa = (Ce = this._hass) == null ? void 0 : Ce.states) == null ? void 0 : Wa[tt]) == null ? void 0 : ke.state) ?? "Custom" : a.houseDirection ?? "Custom", nt = eo ? ((ao = (Ko = (Cs = this._hass) == null ? void 0 : Cs.states) == null ? void 0 : Ko[j]) == null ? void 0 : ao.state) ?? "front" : a.roofTiltFace ?? "front", yo = !!k, Mt = !!O, Xo = !!L, It = Number(ft ? Rt ?? a.fixedSunAzimuthDeg ?? 225 : a.fixedSunAzimuthDeg ?? Rt ?? 225), so = Math.min(359, Math.max(0, Number.isFinite(It) ? It : 225)), $o = ft ? z(wt, z(a.fixedSunRotationEnabled, !1)) : z(a.fixedSunRotationEnabled, z(wt, !1)), pt = Number( + (mt = (Jo = (no = o.find(([, w]) => { + var F; + return ((F = w == null ? void 0 : w.attributes) == null ? void 0 : F.sun_azimuth) != null; + })) == null ? void 0 : no[1]) == null ? void 0 : Jo.attributes) == null ? void 0 : mt.sun_azimuth + ), Vt = Number((wo = (Ns = (ks = (ot = this._hass) == null ? void 0 : ot.states) == null ? void 0 : ks["sun.sun"]) == null ? void 0 : Ns.attributes) == null ? void 0 : wo.azimuth), Pt = Number.isFinite(pt) ? pt : Number.isFinite(Vt) ? Vt : so; + return Io`
Size
@@ -691,6 +696,17 @@ const Xf = qf(On), jn = class jn extends be { @change=${this._valueChanged} >
+
+
+ Auto-scale Width + +
+
Auto-shrink by available width on small screens (minimum 250px). Never grows above configured width.
+
@@ -699,13 +715,13 @@ const Xf = qf(On), jn = class jn extends be {
House angle
{ - var D; - return this._setNumberEntityValue(Y, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Qo = (H = (io = this._hass) == null ? void 0 : io.states) == null ? void 0 : H[Y]) == null ? void 0 : Qo.state) ?? 0)} + .min=${Number(((Ro = (Fs = (Es = (te = this._hass) == null ? void 0 : te.states) == null ? void 0 : Es[Y]) == null ? void 0 : Fs.attributes) == null ? void 0 : Ro.min) ?? 0)} + .max=${Number(((Ds = (Ts = (As = (At = this._hass) == null ? void 0 : At.states) == null ? void 0 : As[Y]) == null ? void 0 : Ts.attributes) == null ? void 0 : Ds.max) ?? 359)} + .step=${Number(((Ae = (Fe = (Ee = (Ne = this._hass) == null ? void 0 : Ne.states) == null ? void 0 : Ee[Y]) == null ? void 0 : Fe.attributes) == null ? void 0 : Ae.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(Y, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} .disabled=${!Y} > @@ -714,12 +730,12 @@ const Xf = qf(On), jn = class jn extends be { { + .selector=${{ select: { options: qo, mode: "dropdown" } }} + .value=${Yo} + @value-changed=${(w) => { var X; - const D = ((X = N.detail) == null ? void 0 : X.value) ?? go; - oo ? (this._setSelectEntityOption(Q, D), this._setConfigValue("houseDirection", void 0)) : this._setConfigValue("houseDirection", D); + const F = ((X = w.detail) == null ? void 0 : X.value) ?? Yo; + _o ? (this._setSelectEntityOption(tt, F), this._setConfigValue("houseDirection", void 0)) : this._setConfigValue("houseDirection", F); }} >
Select compass direction your front door is facing.
@@ -729,27 +745,27 @@ const Xf = qf(On), jn = class jn extends be {
Ceiling tilt
{ - var D; - return this._setNumberEntityValue(V, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((De = (Te = (oe = this._hass) == null ? void 0 : oe.states) == null ? void 0 : Te[L]) == null ? void 0 : De.state) ?? 0)} + .min=${Number(((Ls = (Ps = (zs = (Bs = this._hass) == null ? void 0 : Bs.states) == null ? void 0 : zs[L]) == null ? void 0 : Ps.attributes) == null ? void 0 : Ls.min) ?? 0)} + .max=${Number(((Is = (Os = (Be = (Ws = this._hass) == null ? void 0 : Ws.states) == null ? void 0 : Be[L]) == null ? void 0 : Os.attributes) == null ? void 0 : Is.max) ?? 90)} + .step=${Number(((ee = (Hs = (Vs = (ze = this._hass) == null ? void 0 : ze.states) == null ? void 0 : Vs[L]) == null ? void 0 : Hs.attributes) == null ? void 0 : ee.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(L, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!yo} + .disabled=${!Xo} >
{ + .selector=${{ select: { options: xe, mode: "dropdown" } }} + .value=${nt} + @value-changed=${(w) => { var X; - const D = ((X = N.detail) == null ? void 0 : X.value) ?? Go; - bo ? (this._setSelectEntityOption(q, D), this._setConfigValue("roofTiltFace", void 0)) : this._setConfigValue("roofTiltFace", D); + const F = ((X = w.detail) == null ? void 0 : X.value) ?? nt; + eo ? (this._setSelectEntityOption(j, F), this._setConfigValue("roofTiltFace", void 0)) : this._setConfigValue("roofTiltFace", F); }} >
Which side the roof slopes down toward
@@ -763,35 +779,55 @@ const Xf = qf(On), jn = class jn extends be {
Camera rotation H
{ - var D; - return this._setNumberEntityValue(k, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Pe = (Us = (Gs = this._hass) == null ? void 0 : Gs.states) == null ? void 0 : Us[k]) == null ? void 0 : Pe.state) ?? 0)} + .min=${Number(((Ie = (Oe = (We = (Le = this._hass) == null ? void 0 : Le.states) == null ? void 0 : We[k]) == null ? void 0 : Oe.attributes) == null ? void 0 : Ie.min) ?? 0)} + .max=${Number(((ro = (Ve = (Co = (Mo = this._hass) == null ? void 0 : Mo.states) == null ? void 0 : Co[k]) == null ? void 0 : Ve.attributes) == null ? void 0 : ro.max) ?? 359)} + .step=${Number(((qs = (js = (He = (co = this._hass) == null ? void 0 : co.states) == null ? void 0 : He[k]) == null ? void 0 : js.attributes) == null ? void 0 : qs.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(k, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!$e} + .disabled=${!yo} >
Camera rotation V
{ - var D; - return this._setNumberEntityValue(W, Number(((D = N.target) == null ? void 0 : D.value) ?? 0)); + .value=${Number(((Zs = (Xs = (Ys = this._hass) == null ? void 0 : Ys.states) == null ? void 0 : Xs[O]) == null ? void 0 : Zs.state) ?? 0)} + .min=${Number(((ta = (Qs = (Js = (Ks = this._hass) == null ? void 0 : Ks.states) == null ? void 0 : Js[O]) == null ? void 0 : Qs.attributes) == null ? void 0 : ta.min) ?? 0)} + .max=${Number(((Ue = (Ge = (ea = (oa = this._hass) == null ? void 0 : oa.states) == null ? void 0 : ea[O]) == null ? void 0 : Ge.attributes) == null ? void 0 : Ue.max) ?? 90)} + .step=${Number(((na = (aa = (sa = (se = this._hass) == null ? void 0 : se.states) == null ? void 0 : sa[O]) == null ? void 0 : aa.attributes) == null ? void 0 : na.step) ?? 1)} + @change=${(w) => { + var F; + return this._setNumberEntityValue(O, Number(((F = w.target) == null ? void 0 : F.value) ?? 0)); }} - .disabled=${!rt} + .disabled=${!Mt} >
${k || "Camera rotation H not found"}
-
${W || "Camera rotation V not found"}
+
${O || "Camera rotation V not found"}
+
+
+ +
+
Fixed sun position, azimuth. (Rotate scene)
+
+
+ Fixed sun position, azimuth. (Rotate scene) + { + var Xt; + const F = !!((Xt = w.target) != null && Xt.checked); + if (Z ? (this._setIntegrationOptions({ fixed_sun_rotation_enabled: F }), this._setConfigValue("fixedSunRotationEnabled", void 0)) : this._setConfigValue("fixedSunRotationEnabled", F), !F) return; + const X = Math.min(359, Math.max(0, Math.round(Pt))); + Z ? (this._setIntegrationOptions({ fixed_sun_azimuth: X }), this._setConfigValue("fixedSunAzimuthDeg", void 0)) : this._setConfigValue("fixedSunAzimuthDeg", X); + }} + > +
+
Keep sun azimuth visually fixed and rotate the scene instead
@@ -801,11 +837,11 @@ const Xf = qf(On), jn = class jn extends be { { + .value=${Q} + @value-changed=${(w) => { var X; - const D = (X = N.detail) == null ? void 0 : X.value; - Pt ? (this._setIntegrationOptions({ roof_power_entity: D || null }), this._setConfigValue("roofPowerEntity", void 0)) : this._setConfigValue("roofPowerEntity", D); + const F = (X = w.detail) == null ? void 0 : X.value; + Z ? (this._setIntegrationOptions({ roof_power_entity: F || null }), this._setConfigValue("roofPowerEntity", void 0)) : this._setConfigValue("roofPowerEntity", F); }} >
@@ -813,22 +849,22 @@ const Xf = qf(On), jn = class jn extends be {
Enable power label { + .checked=${Bt ?? !1} + @change=${(w) => { var X; - const D = !!((X = N.target) != null && X.checked); - Pt ? (this._setIntegrationOptions({ roof_power_enabled: D }), this._setConfigValue("roofPowerEnabled", void 0)) : this._setConfigValue("roofPowerEnabled", D); + const F = !!((X = w.target) != null && X.checked); + Z ? (this._setIntegrationOptions({ roof_power_enabled: F }), this._setConfigValue("roofPowerEnabled", void 0)) : this._setConfigValue("roofPowerEnabled", F); }} >
Invert power value { + .checked=${zt ?? !1} + @change=${(w) => { var X; - const D = !!((X = N.target) != null && X.checked); - Pt ? (this._setIntegrationOptions({ roof_power_invert: D }), this._setConfigValue("roofPowerInvert", void 0)) : this._setConfigValue("roofPowerInvert", D); + const F = !!((X = w.target) != null && X.checked); + Z ? (this._setIntegrationOptions({ roof_power_invert: F }), this._setConfigValue("roofPowerInvert", void 0)) : this._setConfigValue("roofPowerInvert", F); }} >
@@ -841,35 +877,24 @@ const Xf = qf(On), jn = class jn extends be { { - var Hs, Gs; - const D = ((Hs = N == null ? void 0 : N.detail) == null ? void 0 : Hs.value) ?? ((Gs = N == null ? void 0 : N.target) == null ? void 0 : Gs.value); - let X = Math.round(Number(D)); - Number.isNaN(X) || (X = Math.min(90, Math.max(1, X)), Pt ? (this._setIntegrationOptions({ auto_rotate_speed: X }), this._setConfigValue("autoRotateSpeed", void 0)) : this._setConfigValue("autoRotateSpeed", X)); + @change=${(w) => { + var Xt, ia; + const F = ((Xt = w == null ? void 0 : w.detail) == null ? void 0 : Xt.value) ?? ((ia = w == null ? void 0 : w.target) == null ? void 0 : ia.value); + let X = Math.round(Number(F)); + Number.isNaN(X) || (X = Math.min(90, Math.max(1, X)), Z ? (this._setIntegrationOptions({ auto_rotate_speed: X }), this._setConfigValue("autoRotateSpeed", void 0)) : this._setConfigValue("autoRotateSpeed", X)); }} >
-
-
- Auto-scale Width - -
-
Auto-shrink by available width on small screens (minimum 250px). Never grows above configured width.
-
`; } }; -jn.styles = bc` +ii.styles = Ec` :host { display: block; padding: 16px; @@ -918,14 +943,14 @@ jn.styles = bc` margin-top: 4px; } `; -let In = jn; -const fc = "sunlight-visualizer-card-editor"; -if (!customElements.get(fc)) +let oi = ii; +const Mc = "sunlight-visualizer-card-editor"; +if (!customElements.get(Mc)) try { - customElements.define(fc, In); + customElements.define(Mc, oi); } catch { } -const qn = class qn extends be { +const ri = class ri extends ve { constructor() { super(...arguments), this._config = {}, this._resizeObserver = null, this._hostWidth = 0; } @@ -938,7 +963,9 @@ const qn = class qn extends be { cardHeight: 450, autoScaleWidth: !0, autoRotateEnabledDefault: !1, - autoRotateSpeed: 25 + autoRotateSpeed: 25, + fixedSunRotationEnabled: !1, + fixedSunAzimuthDeg: 225 }; } setConfig(a) { @@ -964,7 +991,7 @@ const qn = class qn extends be { const c = Math.max(1, Number(a.cardWidth ?? 450)), l = Math.max(1, Number(a.cardHeight ?? 450)); if (!(a.autoScaleWidth ?? !0)) return { cardW: c, cardH: l }; - const w = 250, v = Number(this._hostWidth || this.clientWidth || 0), P = v > 0 ? v : c, k = Math.min(c, Math.max(w, Math.floor(P))), W = k / c, Y = Math.max(1, Math.round(l * W)); + const x = 250, $ = Number(this._hostWidth || this.clientWidth || 0), B = $ > 0 ? $ : c, k = Math.min(c, Math.max(x, Math.floor(B))), O = k / c, Y = Math.max(1, Math.round(l * O)); return { cardW: k, cardH: Y }; } _stopManualRotate() { @@ -972,25 +999,25 @@ const qn = class qn extends be { this._manualRotateTimer && (clearInterval(this._manualRotateTimer), this._manualRotateTimer = null), this._manualRotateEnabled = !1, this._manualRotateAxis = null, this._manualRotateDir = 0, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = 0, this._manualRotateLastTick = 0, this._manualRotateIntervalMs = 0, a && (this._cssRecalibrateRequested = !0), this.requestUpdate(); } _startManualRotate(a, c) { - const l = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), o = Number(this._autoRotateSpeed || 25), w = Number(this._rotationIntervalMsFloor || this._autoRotateIntervalMs || 50), v = Math.max(1, Number(this._autoRotateTurnCount || 1)); - this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._manualRotateEnabled = !0, this._manualRotateAxis = a, this._manualRotateDir = c, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = a === "h" ? 360 * v : 0, this._manualRotateLastTick = l(), this._manualRotateIntervalMs = w, this._manualRotateVOffsetDeg || (this._manualRotateVOffsetDeg = 0), this._manualRotateTimer = setInterval(() => { - const P = l(), k = this._manualRotateLastTick || P, W = Math.max(0, P - k) / 1e3; - if (this._manualRotateLastTick = P, !this._manualRotateEnabled) return; - const Y = this._manualRotateAxis === "v" ? 0.5 : 1, V = o * Y * W * (this._manualRotateDir || 1); + const l = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), o = Number(this._autoRotateSpeed || 25), x = Number(this._rotationIntervalMsFloor || this._autoRotateIntervalMs || 50), $ = Math.max(1, Number(this._autoRotateTurnCount || 1)); + this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._manualRotateEnabled = !0, this._manualRotateAxis = a, this._manualRotateDir = c, this._manualRotateAccumDeg = 0, this._manualRotateTargetDeg = a === "h" ? 360 * $ : 0, this._manualRotateLastTick = l(), this._manualRotateIntervalMs = x, this._manualRotateVOffsetDeg || (this._manualRotateVOffsetDeg = 0), this._manualRotateTimer = setInterval(() => { + const B = l(), k = this._manualRotateLastTick || B, O = Math.max(0, B - k) / 1e3; + if (this._manualRotateLastTick = B, !this._manualRotateEnabled) return; + const Y = this._manualRotateAxis === "v" ? 0.5 : 1, L = o * Y * O * (this._manualRotateDir || 1); if (this._manualRotateAxis === "h") { - if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + V, this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(V), this._manualRotateAccumDeg >= (this._manualRotateTargetDeg || 360)) { + if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + L, this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(L), this._manualRotateAccumDeg >= (this._manualRotateTargetDeg || 360)) { this._stopManualRotate(); return; } } else if (this._manualRotateAxis === "v") { - const Q = Number(this._manualRotateBaseVDeg ?? 35), q = Number(this._manualRotateVOffsetDeg || 0), O = Math.min(90, Math.max(0, Q + q)), F = Math.min(90, Math.max(0, O + V)); - if (this._manualRotateVOffsetDeg = q + (F - O), this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(F - O), F <= 1e-3 || F >= 89.999) { + const tt = Number(this._manualRotateBaseVDeg ?? 35), j = Number(this._manualRotateVOffsetDeg || 0), z = Math.min(90, Math.max(0, tt + j)), E = Math.min(90, Math.max(0, z + L)); + if (this._manualRotateVOffsetDeg = j + (E - z), this._manualRotateAccumDeg = (this._manualRotateAccumDeg || 0) + Math.abs(E - z), E <= 1e-3 || E >= 89.999) { this._stopManualRotate(); return; } } this._updateTimerMS = Date.now(), this.requestUpdate(); - }, w), this.requestUpdate(); + }, x), this.requestUpdate(); } _handleControlTap(a, c, l) { if (l.preventDefault(), l.stopPropagation(), a === "h" ? !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h") : !!(this._manualRotateEnabled && this._manualRotateAxis === "v")) { @@ -1017,64 +1044,89 @@ const qn = class qn extends be { } catch { } } + async _setIntegrationOptions(a) { + var c; + if (!((c = this._hass) != null && c.callService)) return !1; + try { + return await this._hass.callService("sunlight_visualizer", "set_options", a), !0; + } catch { + return !1; + } + } async _saveCurrentCamera(a) { + var $t, vt, wt, Rt, ft; a.preventDefault(), a.stopPropagation(), this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(); - const c = Number(this._currentCameraH ?? 0), l = Number(this._currentCameraV ?? 35), o = this._rotationHEntity, w = this._rotationVEntity; - this._cameraSavedBaseHOverride = this._normDeg(c), this._cameraSavedBaseVOverride = Math.max(0, Math.min(90, l)), this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, await this._setNumericEntityValue(o, this._normDeg(c)), await this._setNumericEntityValue(w, Math.max(0, Math.min(90, l))), this.requestUpdate(); + const c = Number(this._currentCameraH ?? 0), l = Number(this._currentCameraV ?? 35), o = this._rotationHEntity, x = this._rotationVEntity, $ = !!this._fixedSunRotationEnabled, B = this._fixedSunAzimuthEntity, k = Number(this._currentSunAzimuthReal), O = Number(this._fixedSunSceneCompDeg ?? 0), Y = $ ? this._normDeg(c + O) : this._normDeg(c), L = Math.max(0, Math.min(90, l)); + this._cameraSavedBaseHOverride = Y, this._cameraSavedBaseVOverride = L, this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, $ && Number.isFinite(k) && (this._fixedSunAzimuthOverride = this._normDeg(k)); + const tt = (($t = this._config) == null ? void 0 : $t.siSourceAttr) ?? "sunlight_visualizer_source", j = ((vt = this._config) == null ? void 0 : vt.siSourceValue) ?? "sunlight_visualizer", z = (Z) => { + var Q, Bt, zt, dt; + return Z ? ((dt = (zt = (Bt = (Q = this._hass) == null ? void 0 : Q.states) == null ? void 0 : Bt[Z]) == null ? void 0 : zt.attributes) == null ? void 0 : dt[tt]) === j : !1; + }; + if (!!((ft = (Rt = (wt = this._hass) == null ? void 0 : wt.services) == null ? void 0 : Rt.sunlight_visualizer) != null && ft.set_options) && z(o) && z(x)) { + const Z = { + camera_rotation_h: Math.round(this._normDeg(Y)), + camera_rotation_v: Math.round(L) + }; + if ($ && Number.isFinite(k) && (Z.fixed_sun_azimuth = Math.round(this._normDeg(k))), await this._setIntegrationOptions(Z)) { + this.requestUpdate(); + return; + } + } + await this._setNumericEntityValue(o, Y), await this._setNumericEntityValue(x, L), $ && B && Number.isFinite(k) && await this._setNumericEntityValue(B, this._normDeg(k)), this.requestUpdate(); } _restoreSavedCamera(a) { a.preventDefault(), a.stopPropagation(), this._autoRotateEnabled && this._autoRotateStop && this._autoRotateStop(), this._stopManualRotate(), this._autoRotateOffsetDeg = 0, this._manualRotateVOffsetDeg = 0, this.requestUpdate(); } render() { if (!this._hass) - return Lo``; - const a = this._config || {}, { cardW: c, cardH: l } = this._getEffectiveCardSize(a), o = Math.min(c, l), w = this.renderSvg(c, l), v = !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h"), P = !!(this._manualRotateEnabled && this._manualRotateAxis === "v"), k = this._normDeg(Number(this._currentCameraH ?? 0)), W = Math.max(0, Math.min(90, Number(this._currentCameraV ?? 35))), Y = this._normDeg(Number(this._savedCameraH ?? k)), V = Math.max(0, Math.min(90, Number(this._savedCameraV ?? W))), Q = this._degDiffAbs(k, Y) > 0.25 || Math.abs(W - V) > 0.25, q = o < 400, O = 43, F = 10, kt = 10, Nt = (rt, yo, mt) => Math.max(yo, Math.min(mt, rt)); - let Bt = !0, Pt = !0, Qt, J, tt, Et, to, Tt; - if (q) { - const mt = F + O + 8 + O + 4, $o = c - (o < 260 ? 4 : 10), zt = Math.max(0, $o - mt), Ut = o < 260 ? 2 : 8, eo = 18; - if (Bt = o >= 300 && zt >= O * 3 + Ut * 2, Bt) { - const nt = Nt((zt - O * 3) / 2, Ut, eo), $t = O * 3 + nt * 2, ht = mt + Math.max(0, (zt - $t) / 2); - Qt = ht, tt = ht + O + nt, J = tt + O + nt; + return Io``; + const a = this._config || {}, { cardW: c, cardH: l } = this._getEffectiveCardSize(a), o = Math.min(c, l), x = this.renderSvg(c, l), $ = !!(this._autoRotateEnabled || this._manualRotateEnabled && this._manualRotateAxis === "h"), B = !!(this._manualRotateEnabled && this._manualRotateAxis === "v"), k = this._normDeg(Number(this._currentCameraH ?? 0)), O = Math.max(0, Math.min(90, Number(this._currentCameraV ?? 35))), Y = this._normDeg(Number(this._savedCameraH ?? k)), L = Math.max(0, Math.min(90, Number(this._savedCameraV ?? O))), tt = this._degDiffAbs(k, Y) > 0.25 || Math.abs(O - L) > 0.25, j = o < 400, z = 43, E = 10, $t = 10, vt = (nt, yo, Mt) => Math.max(yo, Math.min(Mt, nt)); + let wt = !0, Rt = !0, ft, Z, Q, Bt, zt, dt; + if (j) { + const Mt = E + z + 8 + z + 4, Xo = c - (o < 260 ? 4 : 10), It = Math.max(0, Xo - Mt), so = o < 260 ? 2 : 8, $o = 18; + if (wt = o >= 300 && It >= z * 3 + so * 2, wt) { + const it = vt((It - z * 3) / 2, so, $o), Ct = z * 3 + it * 2, ht = Mt + Math.max(0, (It - Ct) / 2); + ft = ht, Q = ht + z + it, Z = Q + z + it; } else { - const nt = Nt(zt - O * 2, Ut, eo), $t = O * 2 + nt, ht = mt + Math.max(0, (zt - $t) / 2); - Qt = ht, J = ht + O + nt; + const it = vt(It - z * 2, so, $o), Ct = z * 2 + it, ht = Mt + Math.max(0, (It - Ct) / 2); + ft = ht, Z = ht + z + it; } - const bt = l - kt - O, Lt = o < 260 ? 46 : 34, wt = bt - 8, xt = Math.max(0, wt - Lt), jt = o < 260 ? 2 : 6, _o = o < 260 ? 10 : 24; - if (Pt = o >= 300 && xt >= O * 3 + jt * 2, Pt) { - const nt = Nt((xt - O * 3) / 2, jt, _o), $t = O * 3 + nt * 2, ht = Lt + Math.max(0, (xt - $t) / 2); - Et = ht, Tt = ht + O + nt, to = Tt + O + nt; + const pt = l - $t - z, Vt = o < 260 ? 46 : 34, Pt = pt - 8, Ft = Math.max(0, Pt - Vt), Yt = o < 260 ? 2 : 6, vo = o < 260 ? 10 : 24; + if (Rt = o >= 300 && Ft >= z * 3 + Yt * 2, Rt) { + const it = vt((Ft - z * 3) / 2, Yt, vo), Ct = z * 3 + it * 2, ht = Vt + Math.max(0, (Ft - Ct) / 2); + Bt = ht, dt = ht + z + it, zt = dt + z + it; } else { - const nt = Nt(xt - O * 2, jt, 16), $t = O * 2 + nt, ht = Lt + Math.max(0, (xt - $t) / 2); - Et = ht, to = ht + O + nt; + const it = vt(Ft - z * 2, Yt, 16), Ct = z * 2 + it, ht = Vt + Math.max(0, (Ft - Ct) / 2); + Bt = ht, zt = ht + z + it; } } - const ot = q && tt != null ? tt + O * 0.5 : void 0, oo = q && Tt != null ? Tt + O * 0.5 : void 0, bo = q && Qt != null ? `left:${Qt.toFixed(1)}px; bottom:${kt}px;` : "", ye = q && J != null ? `left:${J.toFixed(1)}px; bottom:${kt}px;` : "", Ho = q && ot != null ? `left:${ot.toFixed(1)}px; bottom:${kt}px;` : "", go = q && Et != null ? `left:${F}px; top:${Et.toFixed(1)}px;` : "", Go = q && to != null ? `left:${F}px; top:${to.toFixed(1)}px;` : "", $e = q && oo != null ? `left:${F}px; top:${oo.toFixed(1)}px;` : ""; - return Lo`
+ const at = j && Q != null ? Q + z * 0.5 : void 0, go = j && dt != null ? dt + z * 0.5 : void 0, jo = j && ft != null ? `left:${ft.toFixed(1)}px; bottom:${$t}px;` : "", _o = j && Z != null ? `left:${Z.toFixed(1)}px; bottom:${$t}px;` : "", eo = j && at != null ? `left:${at.toFixed(1)}px; bottom:${$t}px;` : "", qo = j && Bt != null ? `left:${E}px; top:${Bt.toFixed(1)}px;` : "", xe = j && zt != null ? `left:${E}px; top:${zt.toFixed(1)}px;` : "", Yo = j && go != null ? `left:${E}px; top:${go.toFixed(1)}px;` : ""; + return Io`
-
${Xf(w)}
- - ${Q ? Lo`` : null} - - - - - ${Bt ? Lo`
${Math.round(k)}°
` : null} - ${Pt ? Lo`
${Math.round(W)}°
` : null} +
${ed(x)}
+ + ${tt ? Io`` : null} + + + + + ${wt ? Io`
${Math.round(k)}°
` : null} + ${Rt ? Io`
${Math.round(O)}°
` : null}
`; } renderSvg(a, c) { - var Tr, Fr, Ar, Dr, Br, Pr, zr, Lr, Wr, Or, Ir, Vr, Hr, Gr, Ur, jr; - const l = this._hass, o = this._config || {}, w = o.siSourceAttr ?? "sunlight_visualizer_source", v = o.siSourceValue ?? "sunlight_visualizer", P = Object.entries(l.states ?? {}).filter( + var Gr, Ur, jr, qr, Yr, Xr, Zr, Kr, Jr, Qr, tc, oc, ec, sc, ac, nc, ic; + const l = this._hass, o = this._config || {}, x = o.siSourceAttr ?? "sunlight_visualizer_source", $ = o.siSourceValue ?? "sunlight_visualizer", B = Object.entries(l.states ?? {}).filter( ([, t]) => { var e; - return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e[w]) === v; + return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e[x]) === $; } ), k = (t) => { - for (const [e, s] of P) + for (const [e, s] of B) if (t(s, e)) return [e, s]; return null; - }, W = (t) => { + }, O = (t) => { const e = k((s) => { var n; return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.wall) === t; @@ -1086,29 +1138,31 @@ const qn = class qn extends be { return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.camera_rotation) === t; }); return e ? e[0] : void 0; - }, V = (t) => { + }, L = (t) => { const e = k((s) => { var n; return ((n = s == null ? void 0 : s.attributes) == null ? void 0 : n.si_setting) === t; }); return e ? e[0] : void 0; - }, Q = k( + }, tt = k( (t) => { var e, s; return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e.sun_azimuth) != null && ((s = t == null ? void 0 : t.attributes) == null ? void 0 : s.sun_elevation) != null; } - ), q = Q ? Q[1].attributes : null, O = k( + ), j = tt ? tt[1].attributes : null, z = k( (t) => { var e, s, n; return ((e = t == null ? void 0 : t.attributes) == null ? void 0 : e.roof_direction) != null || ((s = t == null ? void 0 : t.attributes) == null ? void 0 : s.ceiling_tilt) != null || ((n = t == null ? void 0 : t.attributes) == null ? void 0 : n.house_angle) != null; } - ), F = O ? O[1].attributes : null, kt = !!(F != null && F.force_sun_fallback), Nt = Number(a ?? o.cardWidth ?? 450), Bt = Number(c ?? o.cardHeight ?? 450), Pt = Nt, Qt = Bt, J = Pt, tt = Qt, Et = J, to = tt, Tt = J * 0.1, ot = o.floorScale ?? 2.6, oo = J * 0.5, bo = tt * 0.4, ye = o.floorColor ?? "#2f2f2f", Ho = Number(o.floorCornerRadius ?? 26), go = Number(o.floorThicknessPx ?? 7), Go = o.floorThicknessColor ?? "rgba(150,106,64,0.9)", $e = o.floorTopStrokeColor ?? "rgba(72,112,56,0.8)", rt = Number(o.floorTopStrokeWidth ?? 1.4), yo = o.floorGrassEnabled ?? !0, mt = Number(o.floorGrassOpacity ?? 0.3), $o = o.floorGrassColorA ?? "rgb(136,186,88)", zt = o.floorGrassColorB ?? "rgb(96,150,62)", Ut = o.rotationHEntity ?? Y("h") ?? "input_number.cube_rotation_h", eo = o.rotationVEntity ?? Y("v") ?? "input_number.cube_rotation_v"; - this._rotationHEntity = Ut, this._rotationVEntity = eo; - const bt = o.preferIntegrationSettings ?? !0, Lt = o.houseAngleEntity ?? null; - let wt = Number(o.houseAngle ?? 0); - const xt = V("house_angle"); - Lt && l.states[Lt] ? wt = Number(((Tr = l.states[Lt]) == null ? void 0 : Tr.state) ?? wt) : xt && l.states[xt] ? wt = Number(((Fr = l.states[xt]) == null ? void 0 : Fr.state) ?? wt) : (bt || o.houseAngle == null) && (F == null ? void 0 : F.house_angle) != null && (wt = Number(F.house_angle ?? wt)); - const jt = o.wallFrontPctEntity ?? W("front"), _o = o.wallRightPctEntity ?? W("right"), nt = o.wallBackPctEntity ?? W("back"), $t = o.wallLeftPctEntity ?? W("left"), ht = o.roofPctEntity ?? W("ceiling"), Ft = (t, e = !1) => { + ), E = z ? z[1].attributes : null, $t = !!(E != null && E.force_sun_fallback), vt = Number(a ?? o.cardWidth ?? 450), wt = Number(c ?? o.cardHeight ?? 450), Rt = vt, ft = wt, Z = Rt, Q = ft, Bt = Z, zt = Q, dt = Z * 0.1, at = o.floorScale ?? 2.6, go = Z * 0.5, jo = Q * 0.4, _o = o.floorColor ?? "#2f2f2f", eo = Number(o.floorCornerRadius ?? 26), qo = Number(o.floorThicknessPx ?? 7), xe = o.floorThicknessColor ?? "rgba(150,106,64,0.9)", Yo = o.floorTopStrokeColor ?? "rgba(72,112,56,0.8)", nt = Number(o.floorTopStrokeWidth ?? 1.4), yo = o.floorGrassEnabled ?? !0, Mt = Number(o.floorGrassOpacity ?? 0.3), Xo = o.floorGrassColorA ?? "rgb(136,186,88)", It = o.floorGrassColorB ?? "rgb(96,150,62)", so = o.rotationHEntity ?? Y("h") ?? "input_number.cube_rotation_h", $o = o.rotationVEntity ?? Y("v") ?? "input_number.cube_rotation_v"; + this._rotationHEntity = so, this._rotationVEntity = $o; + const pt = o.preferIntegrationSettings ?? !0, Vt = o.houseAngleEntity ?? null; + let Pt = Number(o.houseAngle ?? 0); + const Ft = L("house_angle"); + Vt && l.states[Vt] ? Pt = Number(((Gr = l.states[Vt]) == null ? void 0 : Gr.state) ?? Pt) : Ft && l.states[Ft] ? Pt = Number(((Ur = l.states[Ft]) == null ? void 0 : Ur.state) ?? Pt) : (pt || o.houseAngle == null) && (E == null ? void 0 : E.house_angle) != null && (Pt = Number(E.house_angle ?? Pt)); + const Yt = o.wallFrontPctEntity ?? O("front"), vo = o.wallRightPctEntity ?? O("right"), it = o.wallBackPctEntity ?? O("back"), Ct = o.wallLeftPctEntity ?? O("left"), ht = o.roofPctEntity ?? O("ceiling"), So = o.fixedSunAzimuthEntity ?? L("fixed_sun_azimuth") ?? null; + this._fixedSunAzimuthEntity = So ?? void 0; + const _t = (t, e = !1) => { if (t == null || t === "") return e; if (typeof t == "boolean") return t; if (typeof t == "number") return t !== 0; @@ -1118,91 +1172,105 @@ const qn = class qn extends be { if (["false", "0", "no", "off"].includes(s)) return !1; } return e; - }, _e = bt ? (F == null ? void 0 : F.roof_power_entity) ?? o.roofPowerEntity ?? null : o.roofPowerEntity ?? (F == null ? void 0 : F.roof_power_entity) ?? null, Uo = bt ? Ft(F == null ? void 0 : F.roof_power_enabled, Ft(o.roofPowerEnabled, !1)) : Ft(o.roofPowerEnabled, Ft(F == null ? void 0 : F.roof_power_enabled, !1)), ms = bt ? Ft(F == null ? void 0 : F.roof_power_invert, Ft(o.roofPowerInvert, !1)) : Ft(o.roofPowerInvert, Ft(F == null ? void 0 : F.roof_power_invert, !1)), bs = jt ? Number(((Ar = l.states[jt]) == null ? void 0 : Ar.state) ?? 0) : 0, gs = _o ? Number(((Dr = l.states[_o]) == null ? void 0 : Dr.state) ?? 0) : 0, ys = nt ? Number(((Br = l.states[nt]) == null ? void 0 : Br.state) ?? 0) : 0, $s = $t ? Number(((Pr = l.states[$t]) == null ? void 0 : Pr.state) ?? 0) : 0, ve = ht ? Number(((zr = l.states[ht]) == null ? void 0 : zr.state) ?? 0) : 0, Se = Uo && _e ? Number((Lr = l.states[_e]) == null ? void 0 : Lr.state) : NaN, we = Uo ? ((t) => Number.isFinite(t) ? t >= 1e3 ? `${(t / 1e3).toFixed(2)} kW` : `${Math.round(t)} W` : "0 W")(ms ? Math.abs(Se) : Se) : "", _s = o.useSunEntity ?? !1, jo = o.sunEntityId ?? "sun.sun", so = o.sunAzEntity ?? null, ao = o.sunElEntity ?? null; - let qo = Number(o.sunDistance ?? 3), Wt = Number(o.sunAz ?? 135), et = Number(o.sunEl ?? 55); - const vs = Number(o.sunVisualElevationBiasDeg ?? 6), Ss = Number(o.sunVisualElevationScale ?? 1); - so && l.states[so] && (Wt = Number(((Wr = l.states[so]) == null ? void 0 : Wr.state) ?? Wt)), ao && l.states[ao] && (et = Number(((Or = l.states[ao]) == null ? void 0 : Or.state) ?? et)), !so && bt && (q == null ? void 0 : q.sun_azimuth) != null && (Wt = Number(q.sun_azimuth ?? Wt)), !ao && bt && (q == null ? void 0 : q.sun_elevation) != null && (et = Number(q.sun_elevation ?? et)), !so && !ao && !q && _s && l.states[jo] && (Wt = Number(((Ir = l.states[jo].attributes) == null ? void 0 : Ir.azimuth) ?? Wt), et = Number(((Vr = l.states[jo].attributes) == null ? void 0 : Vr.elevation) ?? et)); - const vo = o.roofTiltEnabled ?? !0; - let no = Number(o.roofTiltDeg ?? 25), H = o.roofTiltFace ?? "front"; - const Yo = V("ceiling_tilt"), Xo = V("roof_direction"), ws = Number(o.roofTiltMax ?? 89), xs = Number(o.roofTiltOpacity ?? 1); - Yo && l.states[Yo] ? no = Number(((Hr = l.states[Yo]) == null ? void 0 : Hr.state) ?? no) : (bt || o.roofTiltDeg == null) && (F == null ? void 0 : F.ceiling_tilt) != null && (no = Number(F.ceiling_tilt ?? no)), Xo && l.states[Xo] ? H = String(((Gr = l.states[Xo]) == null ? void 0 : Gr.state) ?? H) : (bt || o.roofTiltFace == null) && (F == null ? void 0 : F.roof_direction) != null && (H = String(F.roof_direction)); - const So = o.houseStyleV2 ?? !0, Rt = o.flatRoofEnabled ?? !0, Rs = Number(o.flatRoofOverhang ?? 0.15), Ms = Number(o.flatRoofThickness ?? 0.12), Cs = Number(o.flatRoofLift ?? 0), xe = o.flatRoofTopColor ?? "#e6e8ee"; + }, we = pt ? (E == null ? void 0 : E.roof_power_entity) ?? o.roofPowerEntity ?? null : o.roofPowerEntity ?? (E == null ? void 0 : E.roof_power_entity) ?? null, Zo = pt ? _t(E == null ? void 0 : E.roof_power_enabled, _t(o.roofPowerEnabled, !1)) : _t(o.roofPowerEnabled, _t(E == null ? void 0 : E.roof_power_enabled, !1)), Ss = pt ? _t(E == null ? void 0 : E.roof_power_invert, _t(o.roofPowerInvert, !1)) : _t(o.roofPowerInvert, _t(E == null ? void 0 : E.roof_power_invert, !1)), Re = pt ? _t( + E == null ? void 0 : E.fixed_sun_rotation_enabled, + _t(o.fixedSunRotationEnabled, !1) + ) : _t( + o.fixedSunRotationEnabled, + _t(E == null ? void 0 : E.fixed_sun_rotation_enabled, !1) + ); + let Lt = Number(pt ? (E == null ? void 0 : E.fixed_sun_azimuth) ?? o.fixedSunAzimuthDeg ?? 225 : o.fixedSunAzimuthDeg ?? (E == null ? void 0 : E.fixed_sun_azimuth) ?? 225); + const xo = Number(this._fixedSunAzimuthOverride); + if (Number.isFinite(xo) && (Lt = xo), So && l.states[So]) { + const t = Number(((jr = l.states[So]) == null ? void 0 : jr.state) ?? Lt); + Number.isFinite(t) && (Number.isFinite(xo) && Math.abs((t - xo + 540) % 360 - 180) < 0.25 && (this._fixedSunAzimuthOverride = void 0), Lt = t); + } + Number.isFinite(Lt) || (Lt = 225), Lt = this._normDeg(Lt), this._fixedSunRotationEnabled = Re; + const xs = Yt ? Number(((qr = l.states[Yt]) == null ? void 0 : qr.state) ?? 0) : 0, ws = vo ? Number(((Yr = l.states[vo]) == null ? void 0 : Yr.state) ?? 0) : 0, Rs = it ? Number(((Xr = l.states[it]) == null ? void 0 : Xr.state) ?? 0) : 0, Ms = Ct ? Number(((Zr = l.states[Ct]) == null ? void 0 : Zr.state) ?? 0) : 0, Me = ht ? Number(((Kr = l.states[ht]) == null ? void 0 : Kr.state) ?? 0) : 0, Ce = Zo && we ? Number((Jr = l.states[we]) == null ? void 0 : Jr.state) : NaN, ke = Zo ? ((t) => Number.isFinite(t) ? t >= 1e3 ? `${(t / 1e3).toFixed(2)} kW` : `${Math.round(t)} W` : "0 W")(Ss ? Math.abs(Ce) : Ce) : "", Cs = o.useSunEntity ?? !1, Ko = o.sunEntityId ?? "sun.sun", ao = o.sunAzEntity ?? null, no = o.sunElEntity ?? null; + let Jo = Number(o.sunDistance ?? 3), mt = Number(o.sunAz ?? 135), ot = Number(o.sunEl ?? 55); + const ks = Number(o.sunVisualElevationBiasDeg ?? 6), Ns = Number(o.sunVisualElevationScale ?? 1); + ao && l.states[ao] && (mt = Number(((Qr = l.states[ao]) == null ? void 0 : Qr.state) ?? mt)), no && l.states[no] && (ot = Number(((tc = l.states[no]) == null ? void 0 : tc.state) ?? ot)), !ao && pt && (j == null ? void 0 : j.sun_azimuth) != null && (mt = Number(j.sun_azimuth ?? mt)), !no && pt && (j == null ? void 0 : j.sun_elevation) != null && (ot = Number(j.sun_elevation ?? ot)), !ao && !no && !j && Cs && l.states[Ko] && (mt = Number(((oc = l.states[Ko].attributes) == null ? void 0 : oc.azimuth) ?? mt), ot = Number(((ec = l.states[Ko].attributes) == null ? void 0 : ec.elevation) ?? ot)), Number.isFinite(mt) || (mt = 135), mt = this._normDeg(mt), this._currentSunAzimuthReal = mt; + const wo = o.roofTiltEnabled ?? !0; + let io = Number(o.roofTiltDeg ?? 25), H = o.roofTiltFace ?? "front"; + const Qo = L("ceiling_tilt"), te = L("roof_direction"), Es = Number(o.roofTiltMax ?? 89), Fs = Number(o.roofTiltOpacity ?? 1); + Qo && l.states[Qo] ? io = Number(((sc = l.states[Qo]) == null ? void 0 : sc.state) ?? io) : (pt || o.roofTiltDeg == null) && (E == null ? void 0 : E.ceiling_tilt) != null && (io = Number(E.ceiling_tilt ?? io)), te && l.states[te] ? H = String(((ac = l.states[te]) == null ? void 0 : ac.state) ?? H) : (pt || o.roofTiltFace == null) && (E == null ? void 0 : E.roof_direction) != null && (H = String(E.roof_direction)); + const Ro = o.houseStyleV2 ?? !0, At = o.flatRoofEnabled ?? !0, As = Number(o.flatRoofOverhang ?? 0.15), Ts = Number(o.flatRoofThickness ?? 0.12), Ds = Number(o.flatRoofLift ?? 0), Ne = o.flatRoofTopColor ?? "#e6e8ee"; o.flatRoofEdgeColor; - const Re = o.flatRoofSideColor ?? "#9ea4af", Me = Number(o.flatRoofSideShade ?? 0.4), Ce = Number(o.flatRoofTopOpacity ?? 1), Zo = Number(o.flatRoofEdgeOpacity ?? 1), ke = Number(o.flatRoofTopDepthBias ?? 0.06), Ne = Number(o.flatRoofSideDepthBias ?? 0.025), ks = Number(o.flatRoofSkirtDepthBias ?? 0.02), Ns = o.wallWindowsEnabled ?? !0, Es = o.wallWindowFrameColor ?? "rgba(221,228,236,0.98)", Ts = o.wallWindowGlassColor ?? "rgba(110,178,212,0.68)", Fs = o.wallWindowStrokeColor ?? "rgba(62,105,130,0.65)", Ee = Number(o.wallWindowStrokeWidth ?? 1), As = o.roofPanelsEnabled ?? So, Ds = o.roofPanelColor ?? "#2d3f7b", Te = o.roofPanelGridColor ?? "rgba(214,230,255,0.65)", Bs = o.roofPanelBorderColor ?? "rgba(185,204,234,0.85)", Ps = Number(o.roofPanelBorderWidth ?? 0.9), Ko = Math.max(1, Math.round(Number(o.roofPanelsCols ?? 3))), zs = M(Number(o.roofPanelsWidthFrac ?? 0.9), 0.4, 0.98), Ls = M(Number(o.roofPanelsGapFrac ?? 0.025), 0, 0.08), Fe = M(Number(o.roofPanelsT0 ?? 0.05), 0, 0.95), Ae = M(Number(o.roofPanelsT1 ?? 0.26), 0.01, 0.98), De = Math.max(1, Math.round(Number(o.roofPanelGridCols ?? 5))), Be = Math.max(1, Math.round(Number(o.roofPanelGridRows ?? 3))), Pe = o.backTreeEnabled ?? !0, wo = Number(o.backTreeX ?? -2.2), xo = Number(o.backTreeZ ?? -2.2), ze = Number(o.backTreeScale ?? 1), io = o.backTreeLeafColor ?? "#9bc94b", ro = o.backTreeTrunkColor ?? "#6f4b2a", Le = o.backTreeShadowEnabled ?? So, Ws = Number(o.backTreeShadowOpacity ?? 0.35), Os = Number(o.backTreeShadowBlur ?? 1.1), Is = Number(o.backTreeShadowLength ?? 0.015), Vs = o.plinthBandEnabled ?? So, N = Number(o.plinthBandHeight ?? 0.06), D = Number(o.plinthBandMix ?? 0.62), X = o.patioStepEnabled ?? So, Hs = Number(o.patioStepDepth ?? 0.24), Gs = Number(o.patioStepWidth ?? 1.1), Sc = Number(o.patioStepInset ?? 0.02), wc = o.patioStepColor ?? "rgba(226,230,235,0.75)", Yn = o.patioGridColor ?? "rgba(164,170,182,0.8)", Xn = Number(o.patioGridWidth ?? 1), xa = o.shadowEnabled ?? !0, xc = Number(o.shadowOpacity ?? 0.35), Rc = Number(o.shadowBlur ?? 4), Mc = Number(o.shadowContactOpacity ?? 0.12), Cc = Number(o.shadowContactBlur ?? 2.5), Jo = o.shadowColor ?? "#000000", Zn = Number(o.shadowClipInset ?? 0.02), Ra = o.baseAnchorShadowEnabled ?? !0, kc = Number(o.baseAnchorShadowOpacity ?? 0.65), Nc = Number(o.baseAnchorShadowBlur ?? 0.2), Ec = Number(o.baseAnchorShadowSpread ?? 0.05), Tc = o.baseAnchorShadowColor ?? "#000000", Ma = o.sunlightEnabled ?? !0, Ca = o.sunlightColor ?? [255, 225, 160], Kn = Number(o.sunlightOpacity ?? 0.7), Fc = Number(o.sunlightSpread ?? 0.7), Ac = Number(o.sunBeamStaticOpacity ?? 0.07), Dc = Number(o.sunBeamStaticWidth ?? 1.6), ka = o.sunBeamFlowEnabled ?? !0, Bc = o.sunBeamFlowColor ?? "rgba(255,200,50,0.85)", Pc = Number(o.sunBeamFlowOpacity ?? 0.55), zc = Number(o.sunBeamFlowWidthScale ?? 0.6), Na = Number(o.sunBeamFlowDash ?? 8), Ea = Number(o.sunBeamFlowGap ?? 50), Lc = Number(o.sunBeamFlowDuration ?? 2.5), Wc = Number(o.sunBeamFlowPhaseStep ?? 0.1), Oc = Number(o.sunBeamDepthScaleBoost ?? 1), Ic = Number(o.sunBeamDepthScaleMin ?? 0.55), Vc = Number(o.sunBeamDepthScaleMax ?? 1.2), Hc = o.sunRayAnimEnabled ?? !0, Ta = Number(o.sunRayAnimDurationMin ?? 1.8), Fa = Number(o.sunRayAnimDurationMax ?? 3), Gc = Number(o.sunRayAnimScaleMin ?? 0.5), Uc = Number(o.sunRayAnimScaleMax ?? 0.75), jc = Number(o.sunRayAnimOpacityMin ?? 0.45); + const Ee = o.flatRoofSideColor ?? "#9ea4af", Fe = Number(o.flatRoofSideShade ?? 0.4), Ae = Number(o.flatRoofTopOpacity ?? 1), oe = Number(o.flatRoofEdgeOpacity ?? 1), Te = Number(o.flatRoofTopDepthBias ?? 0.06), De = Number(o.flatRoofSideDepthBias ?? 0.025), Bs = Number(o.flatRoofSkirtDepthBias ?? 0.02), zs = o.wallWindowsEnabled ?? !0, Ps = o.wallWindowFrameColor ?? "rgba(221,228,236,0.98)", Ls = o.wallWindowGlassColor ?? "rgba(110,178,212,0.68)", Ws = o.wallWindowStrokeColor ?? "rgba(62,105,130,0.65)", Be = Number(o.wallWindowStrokeWidth ?? 1), Os = o.roofPanelsEnabled ?? Ro, Is = o.roofPanelColor ?? "#2d3f7b", ze = o.roofPanelGridColor ?? "rgba(214,230,255,0.65)", Vs = o.roofPanelBorderColor ?? "rgba(185,204,234,0.85)", Hs = Number(o.roofPanelBorderWidth ?? 0.9), ee = Math.max(1, Math.round(Number(o.roofPanelsCols ?? 3))), Gs = C(Number(o.roofPanelsWidthFrac ?? 0.9), 0.4, 0.98), Us = C(Number(o.roofPanelsGapFrac ?? 0.025), 0, 0.08), Pe = C(Number(o.roofPanelsT0 ?? 0.05), 0, 0.95), Le = C(Number(o.roofPanelsT1 ?? 0.26), 0.01, 0.98), We = Math.max(1, Math.round(Number(o.roofPanelGridCols ?? 5))), Oe = Math.max(1, Math.round(Number(o.roofPanelGridRows ?? 3))), Ie = o.backTreeEnabled ?? !0, Mo = Number(o.backTreeX ?? -2.2), Co = Number(o.backTreeZ ?? -2.2), Ve = Number(o.backTreeScale ?? 1), ro = o.backTreeLeafColor ?? "#9bc94b", co = o.backTreeTrunkColor ?? "#6f4b2a", He = o.backTreeShadowEnabled ?? Ro, js = Number(o.backTreeShadowOpacity ?? 0.35), qs = Number(o.backTreeShadowBlur ?? 1.1), Ys = Number(o.backTreeShadowLength ?? 0.015), Xs = o.plinthBandEnabled ?? Ro, Zs = Number(o.plinthBandHeight ?? 0.06), Ks = Number(o.plinthBandMix ?? 0.62), Js = o.patioStepEnabled ?? Ro, Qs = Number(o.patioStepDepth ?? 0.24), ta = Number(o.patioStepWidth ?? 1.1), oa = Number(o.patioStepInset ?? 0.02), ea = o.patioStepColor ?? "rgba(226,230,235,0.75)", Ge = o.patioGridColor ?? "rgba(164,170,182,0.8)", Ue = Number(o.patioGridWidth ?? 1), se = o.shadowEnabled ?? !0, sa = Number(o.shadowOpacity ?? 0.35), aa = Number(o.shadowBlur ?? 4), na = Number(o.shadowContactOpacity ?? 0.12), w = Number(o.shadowContactBlur ?? 2.5), F = o.shadowColor ?? "#000000", X = Number(o.shadowClipInset ?? 0.02), Xt = o.baseAnchorShadowEnabled ?? !0, ia = Number(o.baseAnchorShadowOpacity ?? 0.65), zc = Number(o.baseAnchorShadowBlur ?? 0.2), Pc = Number(o.baseAnchorShadowSpread ?? 0.05), Lc = o.baseAnchorShadowColor ?? "#000000", Oa = o.sunlightEnabled ?? !0, Ia = o.sunlightColor ?? [255, 225, 160], ci = Number(o.sunlightOpacity ?? 0.7), Wc = Number(o.sunlightSpread ?? 0.7), Oc = Number(o.sunBeamStaticOpacity ?? 0.07), Ic = Number(o.sunBeamStaticWidth ?? 1.6), Va = o.sunBeamFlowEnabled ?? !0, Vc = o.sunBeamFlowColor ?? "rgba(255,200,50,0.85)", Hc = Number(o.sunBeamFlowOpacity ?? 0.55), Gc = Number(o.sunBeamFlowWidthScale ?? 0.6), Ha = Number(o.sunBeamFlowDash ?? 8), Ga = Number(o.sunBeamFlowGap ?? 50), Uc = Number(o.sunBeamFlowDuration ?? 2.5), jc = Number(o.sunBeamFlowPhaseStep ?? 0.1), qc = Number(o.sunBeamDepthScaleBoost ?? 1), Yc = Number(o.sunBeamDepthScaleMin ?? 0.55), Xc = Number(o.sunBeamDepthScaleMax ?? 1.2), Zc = o.sunRayAnimEnabled ?? !0, Ua = Number(o.sunRayAnimDurationMin ?? 1.8), ja = Number(o.sunRayAnimDurationMax ?? 3), Kc = Number(o.sunRayAnimScaleMin ?? 0.5), Jc = Number(o.sunRayAnimScaleMax ?? 0.75), Qc = Number(o.sunRayAnimOpacityMin ?? 0.45); Number(o.sunRayAnimOpacityMax ?? 0.85); - const Jn = o.sunRayAnimColorA ?? "rgb(255,240,110)"; + const li = o.sunRayAnimColorA ?? "rgb(255,240,110)"; o.sunRayAnimColorB; - const We = o.skyCloudsEnabled ?? !0, Qn = Number(o.skyCloudOpacity ?? 0.34), qc = Number(o.skyCloudBlur ?? 3.3), Aa = Number(o.skyCloudScale ?? 1.5), Da = Number(o.skyCloudSpeed ?? 1), Yc = Number(o.skyCloudHeight ?? 0.5); + const je = o.skyCloudsEnabled ?? !0, hi = Number(o.skyCloudOpacity ?? 0.34), tl = Number(o.skyCloudBlur ?? 3.3), qa = Number(o.skyCloudScale ?? 1.5), Ya = Number(o.skyCloudSpeed ?? 1), ol = Number(o.skyCloudHeight ?? 0.5); Number(o.wallBottomMix ?? 0.01), Number(o.wallMidMix ?? 0.7), Number(o.wallTopMix ?? 1.3); - const Xc = o.facadeSunDimmingEnabled ?? !0, Zc = Number(o.facadeSunMinFactor ?? 0.2), Kc = Number(o.facadeSunNoDimAtPct ?? 90), Jc = Number(o.facadeSunCurve ?? 8), Qc = Number(o.ceilingDarkMix ?? 0.1), tl = Number(o.ceilingLightMix ?? 1.4), ti = o.horizonEnabled ?? !0, ol = Number(o.horizonBase ?? 0.55), el = Number(o.horizonTiltStrength ?? 0.65), oi = Number(o.horizonBand ?? 0.15), sl = o.horizonTopColor ?? [120, 170, 220], al = o.horizonBandColor ?? [255, 210, 150], nl = o.horizonBottomColor ?? [70, 80, 95], il = Number(o.skyTwilightRangeDeg ?? 6), rl = o.horizonNightTopColor ?? [12, 20, 42], cl = o.horizonNightBandColor ?? [32, 44, 82], ll = o.horizonNightBottomColor ?? [6, 10, 22], hl = o.horizonSunriseTopColor ?? [118, 150, 206], ul = o.horizonSunriseBandColor ?? [236, 162, 132], fl = o.horizonSunriseBottomColor ?? [84, 70, 90], dl = o.horizonSunsetTopColor ?? [98, 106, 178], pl = o.horizonSunsetBandColor ?? [255, 122, 90], ml = o.horizonSunsetBottomColor ?? [82, 48, 76], Oe = o.skyStarsEnabled ?? !0, Us = Math.max(0, Math.round(Number(o.skyStarsCount ?? 34))), bl = o.skyStarsTwinkleEnabled ?? !0, gl = Number(o.skyStarsOpacity ?? 0.9), Ba = o.skyMoonEnabled ?? !0, yl = Number(o.skyMoonX ?? 0.86), $l = Number(o.skyMoonY ?? 0.12), _l = Number(o.skyMoonSize ?? 14), vl = Number(o.skyMoonPhase ?? 0.72), Sl = Number(o.skyMoonOpacity ?? 0.92), Ie = o.moonlightEnabled ?? !0, js = o.moonlightColor ?? [178, 208, 255], wl = Number(o.moonlightOpacity ?? 0.22), xl = Number(o.moonlightSpread ?? 0.6), Rl = Number(o.moonlightWashOpacity ?? 0.08), Ml = Number(o.moonShadowElevationDeg ?? 18), Cl = Number(o.moonShadowYawDeg ?? -45), kl = Number(o.shadowSunMoonBlendDeg ?? 3), ei = o.vignetteEnabled ?? !0, Nl = Number(o.vignetteOpacity ?? 0.35), El = Number(o.vignetteRadius ?? 0.65), Tl = Number(o.vignetteInner ?? 0.85), Pa = o.vignetteColor ?? [0, 0, 0], Fl = o.roofBackEnabled ?? !0, si = Number(o.roofBackMix ?? 0.7), Al = Number(o.roofBackOpacity ?? 1); + const el = o.facadeSunDimmingEnabled ?? !0, sl = Number(o.facadeSunMinFactor ?? 0.2), al = Number(o.facadeSunNoDimAtPct ?? 90), nl = Number(o.facadeSunCurve ?? 8), il = Number(o.ceilingDarkMix ?? 0.1), rl = Number(o.ceilingLightMix ?? 1.4), ui = o.horizonEnabled ?? !0, cl = Number(o.horizonBase ?? 0.55), ll = Number(o.horizonTiltStrength ?? 0.65), fi = Number(o.horizonBand ?? 0.15), hl = o.horizonTopColor ?? [120, 170, 220], ul = o.horizonBandColor ?? [255, 210, 150], fl = o.horizonBottomColor ?? [70, 80, 95], dl = Number(o.skyTwilightRangeDeg ?? 6), pl = o.horizonNightTopColor ?? [12, 20, 42], ml = o.horizonNightBandColor ?? [32, 44, 82], bl = o.horizonNightBottomColor ?? [6, 10, 22], gl = o.horizonSunriseTopColor ?? [118, 150, 206], _l = o.horizonSunriseBandColor ?? [236, 162, 132], yl = o.horizonSunriseBottomColor ?? [84, 70, 90], $l = o.horizonSunsetTopColor ?? [98, 106, 178], vl = o.horizonSunsetBandColor ?? [255, 122, 90], Sl = o.horizonSunsetBottomColor ?? [82, 48, 76], qe = o.skyStarsEnabled ?? !0, ra = Math.max(0, Math.round(Number(o.skyStarsCount ?? 34))), xl = o.skyStarsTwinkleEnabled ?? !0, wl = Number(o.skyStarsOpacity ?? 0.9), Xa = o.skyMoonEnabled ?? !0, Rl = Number(o.skyMoonX ?? 0.86), Ml = Number(o.skyMoonY ?? 0.12), Cl = Number(o.skyMoonSize ?? 14), kl = Number(o.skyMoonPhase ?? 0.72), Nl = Number(o.skyMoonOpacity ?? 0.92), Ye = o.moonlightEnabled ?? !0, ca = o.moonlightColor ?? [178, 208, 255], El = Number(o.moonlightOpacity ?? 0.22), Fl = Number(o.moonlightSpread ?? 0.6), Al = Number(o.moonlightWashOpacity ?? 0.08), Tl = Number(o.moonShadowElevationDeg ?? 18), Dl = Number(o.moonShadowYawDeg ?? -45), Bl = Number(o.shadowSunMoonBlendDeg ?? 3), di = o.vignetteEnabled ?? !0, zl = Number(o.vignetteOpacity ?? 0.35), Pl = Number(o.vignetteRadius ?? 0.65), Ll = Number(o.vignetteInner ?? 0.85), Za = o.vignetteColor ?? [0, 0, 0], Wl = o.roofBackEnabled ?? !0, pi = Number(o.roofBackMix ?? 0.7), Ol = Number(o.roofBackOpacity ?? 1); Number(o.roofGradientDarkMix ?? 0.125), Number(o.roofGradientLightMix ?? 1.25); - const Dl = o.roofSidesEnabled ?? !0, Bl = Number(o.roofSideMix ?? 0.45), za = Number(o.roofSideOpacity ?? 1), ai = Number(o.roofSideDepthBias ?? 0.012), Pl = o.roofCapEnabled ?? !0, zl = Number(o.floorCompassStroke ?? 4), Ll = Number(o.floorCompassRingBand ?? 0.09), Wl = o.floorCompassRingMiddleColor ?? "rgba(255,255,255,0.9)", ni = o.floorCompassRingSideColor ?? "rgba(210,140,140,0.345)", ii = Number(o.floorCompassRingSideWidth ?? 3), ri = o.floorCompassTicksEnabled ?? !0, Ol = o.floorCompassTickColor ?? "rgba(0,0,0,0.75)", Il = Number(o.floorCompassTickWidth ?? 1), Vl = Number(o.floorCompassTickMajorWidth ?? 4), Hl = Number(o.floorCompassTickLength ?? -0.1), Gl = Number(o.floorCompassTickMajorLength ?? -0.2), Ul = Number(o.floorCompassLabelSize ?? 20), jl = Number(o.floorCompassLabelInset ?? -0.25), ql = Number(o.floorCompassLabelScaleBoost ?? 1.2), Yl = Number(o.floorCompassLabelScaleMin ?? 0.6), Xl = Number(o.floorCompassLabelScaleMax ?? 2), Zl = Number(o.floorCompassLabelStroke ?? 1), ci = Number(o.arrowScaleBoost ?? 0.6), li = Number(o.floorPointerScaleMin ?? 0.05), hi = Number(o.floorPointerScaleMax ?? 1), ui = Number(o.floorPointerBaseWidth ?? 3.4), Kl = Number(o.floorPointerBaseHead ?? 18), La = o.floorPointerColor ?? "gold", fi = o.floorPointerShadowEnabled ?? !0, Wa = Number(o.floorPointerShadowOpacity ?? 0.8), Jl = Number(o.floorPointerShadowBlur ?? 1.1), Ql = Number(o.floorPointerShadowOffset ?? 2.9), th = Number(o.floorWallLabelSize ?? 12), qs = Number(o.floorWallLabelOffset ?? 0.55), oh = Number(o.floorWallLabelScaleBoost ?? 1.2), eh = Number(o.floorWallLabelScaleMin ?? 0.5), sh = Number(o.floorWallLabelScaleMax ?? 1.8), ah = Number(o.floorWallLabelScreenLift ?? 6), nh = o.floorWallLabelColor ?? "rgba(255,255,255,0.9)", ih = o.floorWallLabelStroke ?? "rgba(0,0,0,0.6)", rh = Number(o.floorWallLabelStrokeWidth ?? 0.5), di = Number(o.wallLabelVisibleThreshold ?? -0.05), ch = Number(o.wallPctVisibleThreshold ?? -0.215), lh = Number(o.wallPctAreaThreshold ?? 120), hh = Number(o.wallPctVerticalPos ?? 0.66), pi = o.surfaceLabelEnabled ?? !0, Oa = Number(o.surfaceLabelSize ?? 12), uh = Number(o.surfaceLabelScaleBoost ?? 1.5), fh = Number(o.surfaceLabelScaleMin ?? 0.6), dh = Number(o.surfaceLabelScaleMax ?? 1.6), mi = o.surfaceLabelColor ?? "rgba(255,213,0,.95)", bi = o.surfaceLabelStroke ?? "rgba(0,0,0,0.5)", Ia = Number(o.surfaceLabelStrokeWidth ?? 0.5), Va = Number(o.surfaceLabelOffset ?? 0.03), ph = Number(o.roofPctLabelScale ?? 1.18), mh = Number(o.roofPowerLabelScale ?? 0.7), bh = o.roofPowerLabelColor ?? "rgba(255,255,255,0.9)", gh = o.frontDoorEnabled ?? !0, Ha = Number(o.frontDoorWidth ?? 0.55), gi = Number(o.frontDoorHeight ?? 1.1), yh = Number(o.frontDoorBottomInset ?? 0.05), $h = Number(o.frontDoorOffset ?? 0.01), _h = o.frontDoorColor ?? "rgba(0,0,0,0.55)", yi = Number(o.frontDoorOpacity ?? 0.9), vh = o.frontDoorFrameColor ?? "rgba(219,225,232,0.98)", Sh = o.frontDoorKnobColor ?? "rgba(236,198,111,0.95)", _t = o.faceColors ?? { + const Il = o.roofSidesEnabled ?? !0, Vl = Number(o.roofSideMix ?? 0.45), Ka = Number(o.roofSideOpacity ?? 1), mi = Number(o.roofSideDepthBias ?? 0.012), Hl = o.roofCapEnabled ?? !0, Gl = Number(o.floorCompassStroke ?? 4), Ul = Number(o.floorCompassRingBand ?? 0.09), jl = o.floorCompassRingMiddleColor ?? "rgba(255,255,255,0.9)", bi = o.floorCompassRingSideColor ?? "rgba(210,140,140,0.345)", gi = Number(o.floorCompassRingSideWidth ?? 3), _i = o.floorCompassTicksEnabled ?? !0, ql = o.floorCompassTickColor ?? "rgba(0,0,0,0.75)", Yl = Number(o.floorCompassTickWidth ?? 1), Xl = Number(o.floorCompassTickMajorWidth ?? 4), Zl = Number(o.floorCompassTickLength ?? -0.1), Kl = Number(o.floorCompassTickMajorLength ?? -0.2), Jl = Number(o.floorCompassLabelSize ?? 20), Ql = Number(o.floorCompassLabelInset ?? -0.25), th = Number(o.floorCompassLabelScaleBoost ?? 1.2), oh = Number(o.floorCompassLabelScaleMin ?? 0.6), eh = Number(o.floorCompassLabelScaleMax ?? 2), sh = Number(o.floorCompassLabelStroke ?? 1), yi = Number(o.arrowScaleBoost ?? 0.6), $i = Number(o.floorPointerScaleMin ?? 0.05), vi = Number(o.floorPointerScaleMax ?? 1), Si = Number(o.floorPointerBaseWidth ?? 3.4), ah = Number(o.floorPointerBaseHead ?? 18), Ja = o.floorPointerColor ?? "gold", xi = o.floorPointerShadowEnabled ?? !0, Qa = Number(o.floorPointerShadowOpacity ?? 0.8), nh = Number(o.floorPointerShadowBlur ?? 1.1), ih = Number(o.floorPointerShadowOffset ?? 2.9), rh = Number(o.floorWallLabelSize ?? 12), la = Number(o.floorWallLabelOffset ?? 0.55), ch = Number(o.floorWallLabelScaleBoost ?? 1.2), lh = Number(o.floorWallLabelScaleMin ?? 0.5), hh = Number(o.floorWallLabelScaleMax ?? 1.8), uh = Number(o.floorWallLabelScreenLift ?? 6), fh = o.floorWallLabelColor ?? "rgba(255,255,255,0.9)", dh = o.floorWallLabelStroke ?? "rgba(0,0,0,0.6)", ph = Number(o.floorWallLabelStrokeWidth ?? 0.5), wi = Number(o.wallLabelVisibleThreshold ?? -0.05), mh = Number(o.wallPctVisibleThreshold ?? -0.215), bh = Number(o.wallPctAreaThreshold ?? 120), gh = Number(o.wallPctVerticalPos ?? 0.66), Ri = o.surfaceLabelEnabled ?? !0, tn = Number(o.surfaceLabelSize ?? 12), _h = Number(o.surfaceLabelScaleBoost ?? 1.5), yh = Number(o.surfaceLabelScaleMin ?? 0.6), $h = Number(o.surfaceLabelScaleMax ?? 1.6), Mi = o.surfaceLabelColor ?? "rgba(255,213,0,.95)", Ci = o.surfaceLabelStroke ?? "rgba(0,0,0,0.5)", on = Number(o.surfaceLabelStrokeWidth ?? 0.5), en = Number(o.surfaceLabelOffset ?? 0.03), vh = Number(o.roofPctLabelScale ?? 1.18), Sh = Number(o.roofPowerLabelScale ?? 0.7), xh = o.roofPowerLabelColor ?? "rgba(255,255,255,0.9)", wh = o.frontDoorEnabled ?? !0, sn = Number(o.frontDoorWidth ?? 0.55), ki = Number(o.frontDoorHeight ?? 1.1), Rh = Number(o.frontDoorBottomInset ?? 0.05), Mh = Number(o.frontDoorOffset ?? 0.01), Ch = o.frontDoorColor ?? "rgba(0,0,0,0.55)", Ni = Number(o.frontDoorOpacity ?? 0.9), kh = o.frontDoorFrameColor ?? "rgba(219,225,232,0.98)", Nh = o.frontDoorKnobColor ?? "rgba(236,198,111,0.95)", kt = o.faceColors ?? { front: "#faf5f5ff", right: "#d8d2d2ff", top: "#13a057", back: "#d8d2d2ff", left: "#d8d2d2ff", bottom: "#d8d2d2ff" - }, wh = o.autoRotateEnabledDefault ?? !1, Ys = Number(F == null ? void 0 : F.auto_rotate_speed); - let Ve = Number(o.autoRotateSpeed ?? 25); - (bt && Number.isFinite(Ys) || (o.autoRotateSpeed === void 0 || o.autoRotateSpeed === null || o.autoRotateSpeed === "") && Number.isFinite(Ys)) && (Ve = Ys); - const Mt = Number(o.autoRotateIntervalMs ?? 50), Ga = Number(o.autoRotateTapDelayMs ?? 250), xh = o.autoRotateStopOnFullTurn ?? !0, Ua = Number(o.autoRotateTurnCount ?? 1), Rh = o.autoRotateShowFps ?? !0, Mh = Number(o.autoRotateFpsWindowMs ?? 1e3), Ch = o.autoRotateAdaptiveEnabled ?? !0, $i = Number(o.autoRotateAdaptiveMaxIntervalMs ?? 1e3), kh = Number(o.autoRotateAdaptiveStepMs ?? 10), Nh = Number(o.autoRotateAdaptiveCheckMs ?? 1e3), Eh = Number(o.autoRotateAdaptiveFpsThreshold ?? 0.8), Th = Number(o.autoRotateCalibrateMs ?? 2e3), Fh = Number(o.autoRotateCalibrateFactor ?? 0.85), _i = o.cssFpsDebugEnabled ?? !1, Ah = Number(o.cssFpsWindowMs ?? 1e3), Dh = Number(o.cssFpsUiUpdateMs ?? 500), Xs = o.cssFpsAutoLimitEnabled ?? !0, Bh = Number(o.cssFpsCalibrateMs ?? 2e3), Ph = Number(o.cssFpsLimitThreshold ?? 20), zh = Number(o.cssFpsLimitFactor ?? 0.5), Lh = Number(o.cssFpsLimitMin ?? 1), Wh = Number(o.cssFpsLimitMax ?? 30), Oh = o.cssFpsLimitTextEnabled ?? !0, vi = Number(o.cssFpsRotationStartBoost ?? 2); - this._autoRotateSpeed = Ve, this._autoRotateIntervalMs = Mt, this._autoRotateTurnCount = Ua, this._autoRotateEnabled === void 0 && (this._autoRotateEnabled = wh), this._autoRotateOffsetDeg === void 0 && (this._autoRotateOffsetDeg = 0), this._autoRotateIntervalMsDynamic === void 0 && (this._autoRotateIntervalMsDynamic = Mt), this._autoRotateFpsSamples === void 0 && (this._autoRotateFpsSamples = []), this._autoRotateFps === void 0 && (this._autoRotateFps = 0), this._autoRotateCalibrated === void 0 && (this._autoRotateCalibrated = !1), this._autoRotateAccumDeg === void 0 && (this._autoRotateAccumDeg = 0), this._autoRotateTargetDeg === void 0 && (this._autoRotateTargetDeg = 0), this._cssFps === void 0 && (this._cssFps = 0), this._cssFpsLimit === void 0 && (this._cssFpsLimit = 0), this._cssPerfLimited === void 0 && (this._cssPerfLimited = !1), this._cssFpsAutoCalibrated === void 0 && (this._cssFpsAutoCalibrated = !1), this._cssFpsMeasured === void 0 && (this._cssFpsMeasured = 0), this._cssRecalibrateRequested === void 0 && (this._cssRecalibrateRequested = !1); - const Qo = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), Si = Qo() / 1e3, Zs = (t, e = 0) => { + }, Eh = o.autoRotateEnabledDefault ?? !1, ha = Number(E == null ? void 0 : E.auto_rotate_speed); + let Xe = Number(o.autoRotateSpeed ?? 25); + (pt && Number.isFinite(ha) || (o.autoRotateSpeed === void 0 || o.autoRotateSpeed === null || o.autoRotateSpeed === "") && Number.isFinite(ha)) && (Xe = ha); + const Tt = Number(o.autoRotateIntervalMs ?? 50), an = Number(o.autoRotateTapDelayMs ?? 250), Fh = o.autoRotateStopOnFullTurn ?? !0, nn = Number(o.autoRotateTurnCount ?? 1), Ah = o.autoRotateShowFps ?? !0, Th = Number(o.autoRotateFpsWindowMs ?? 1e3), Dh = o.autoRotateAdaptiveEnabled ?? !0, Ei = Number(o.autoRotateAdaptiveMaxIntervalMs ?? 1e3), Bh = Number(o.autoRotateAdaptiveStepMs ?? 10), zh = Number(o.autoRotateAdaptiveCheckMs ?? 1e3), Ph = Number(o.autoRotateAdaptiveFpsThreshold ?? 0.8), Lh = Number(o.autoRotateCalibrateMs ?? 2e3), Wh = Number(o.autoRotateCalibrateFactor ?? 0.85), Fi = o.cssFpsDebugEnabled ?? !1, Oh = Number(o.cssFpsWindowMs ?? 1e3), Ih = Number(o.cssFpsUiUpdateMs ?? 500), ua = o.cssFpsAutoLimitEnabled ?? !0, Vh = Number(o.cssFpsCalibrateMs ?? 2e3), Hh = Number(o.cssFpsLimitThreshold ?? 20), Gh = Number(o.cssFpsLimitFactor ?? 0.5), Uh = Number(o.cssFpsLimitMin ?? 1), jh = Number(o.cssFpsLimitMax ?? 30), qh = o.cssFpsLimitTextEnabled ?? !0, Ai = Number(o.cssFpsRotationStartBoost ?? 2); + this._autoRotateSpeed = Xe, this._autoRotateIntervalMs = Tt, this._autoRotateTurnCount = nn, this._autoRotateEnabled === void 0 && (this._autoRotateEnabled = Eh), this._autoRotateOffsetDeg === void 0 && (this._autoRotateOffsetDeg = 0), this._autoRotateIntervalMsDynamic === void 0 && (this._autoRotateIntervalMsDynamic = Tt), this._autoRotateFpsSamples === void 0 && (this._autoRotateFpsSamples = []), this._autoRotateFps === void 0 && (this._autoRotateFps = 0), this._autoRotateCalibrated === void 0 && (this._autoRotateCalibrated = !1), this._autoRotateAccumDeg === void 0 && (this._autoRotateAccumDeg = 0), this._autoRotateTargetDeg === void 0 && (this._autoRotateTargetDeg = 0), this._cssFps === void 0 && (this._cssFps = 0), this._cssFpsLimit === void 0 && (this._cssFpsLimit = 0), this._cssPerfLimited === void 0 && (this._cssPerfLimited = !1), this._cssFpsAutoCalibrated === void 0 && (this._cssFpsAutoCalibrated = !1), this._cssFpsMeasured === void 0 && (this._cssFpsMeasured = 0), this._cssRecalibrateRequested === void 0 && (this._cssRecalibrateRequested = !1); + const ae = () => typeof performance < "u" && performance.now ? performance.now() : Date.now(), Ti = ae() / 1e3, fa = (t, e = 0) => { const s = Math.max(1e-3, t); - return -(((Si + e) % s + s) % s); - }, Ks = (t, e = 0) => { + return -(((Ti + e) % s + s) % s); + }, da = (t, e = 0) => { const s = Math.max(1e-3, t); return -((e % s + s) % s); - }, Js = () => { + }, pa = () => { const t = Number(this._cssFpsLimit || 0); - if (!(Xs && !!this._cssPerfLimited && t > 0)) return Mt; - const s = Math.max(1, Number.isFinite(vi) ? vi : 2), n = Math.max(1, Math.round(t * s)); - return Math.max(Mt, Math.round(1e3 / n)); + if (!(ua && !!this._cssPerfLimited && t > 0)) return Tt; + const s = Math.max(1, Number.isFinite(Ai) ? Ai : 2), n = Math.max(1, Math.round(t * s)); + return Math.max(Tt, Math.round(1e3 / n)); }; - this._cssGlobalTimeSec === void 0 && (this._cssGlobalTimeSec = Qo() / 1e3); - const wi = () => { + this._cssGlobalTimeSec === void 0 && (this._cssGlobalTimeSec = ae() / 1e3); + const Di = () => { this._cssGlobalTickTimer && (clearInterval(this._cssGlobalTickTimer), this._cssGlobalTickTimer = null), this._cssGlobalTickFps = 0; - }, Ih = (t) => { + }, Yh = (t) => { const e = Math.max(1, Math.round(t)); if (this._cssGlobalTickTimer && Number(this._cssGlobalTickFps || 0) === e) return; - wi(); + Di(); const s = Math.max(1, Math.round(1e3 / e)), n = () => { var u, d; - const i = Qo() / 1e3, r = Math.floor(i * e) / e; + const i = ae() / 1e3, r = Math.floor(i * e) / e; this._cssGlobalTimeSec = r; const h = (d = (u = this.renderRoot) == null ? void 0 : u.querySelector) == null ? void 0 : d.call(u, "svg.sv-scene"); h && h.style.setProperty("--sv-global-time", r.toFixed(3)); }; n(), this._cssGlobalTickFps = e, this._cssGlobalTickTimer = setInterval(n, s); - }, Vh = () => { + }, Xh = () => { this._cssFpsRaf && (cancelAnimationFrame(this._cssFpsRaf), this._cssFpsRaf = null), this._cssFpsSamples = [], this._cssFps = 0; - }, Hh = () => { + }, Zh = () => { if (this._cssFpsRaf) return; this._cssFpsSamples = [], this._cssFpsUiLast = 0; const t = (e) => { const s = this._cssFpsSamples || []; s.push(e); - const n = e - Ah; + const n = e - Oh; for (; s.length && s[0] < n; ) s.shift(); if (this._cssFpsSamples = s, s.length >= 2) { const r = (s[s.length - 1] - s[0]) / 1e3; this._cssFps = r > 0 ? (s.length - 1) / r : 0; } const i = this._cssFpsUiLast || 0; - e - i >= Dh && (this._cssFpsUiLast = e, this._updateTimerMS = Date.now(), this.requestUpdate()), this._cssFpsRaf = requestAnimationFrame(t); + e - i >= Ih && (this._cssFpsUiLast = e, this._updateTimerMS = Date.now(), this.requestUpdate()), this._cssFpsRaf = requestAnimationFrame(t); }; this._cssFpsRaf = requestAnimationFrame(t); - }, ja = () => { + }, rn = () => { this._cssFpsCalibRaf && (cancelAnimationFrame(this._cssFpsCalibRaf), this._cssFpsCalibRaf = null), this._cssFpsAutoCalibrating = !1; - }, Gh = () => { + }, Kh = () => { if (this._cssFpsAutoCalibrated || this._cssFpsAutoCalibrating) return; this._cssFpsAutoCalibrating = !0; const t = []; let e = 0; const s = (n) => { - if (e || (e = n), t.push(n), n - e >= Bh) { - ja(); + if (e || (e = n), t.push(n), n - e >= Vh) { + rn(); let i = 0; if (t.length >= 2) { const h = (t[t.length - 1] - t[0]) / 1e3; @@ -1210,140 +1278,142 @@ const qn = class qn extends be { } this._cssFpsMeasured = i; let r = 0; - i > 0 && i < Ph && (i < 5 ? r = 1 : (r = Math.floor(i * zh), r = Math.min(Wh, Math.max(Lh, r)))), this._cssFpsLimit = r, this._cssPerfLimited = r > 0, this._cssFpsAutoCalibrated = !0, this._updateTimerMS = Date.now(), this.requestUpdate(); + i > 0 && i < Hh && (i < 5 ? r = 1 : (r = Math.floor(i * Gh), r = Math.min(jh, Math.max(Uh, r)))), this._cssFpsLimit = r, this._cssPerfLimited = r > 0, this._cssFpsAutoCalibrated = !0, this._updateTimerMS = Date.now(), this.requestUpdate(); return; } this._cssFpsCalibRaf = requestAnimationFrame(s); }; this._cssFpsCalibRaf = requestAnimationFrame(s); - }, xi = (t) => { + }, Bi = (t) => { const e = this._autoRotateFpsSamples || []; e.push(t); - const s = t - Mh; + const s = t - Th; for (; e.length && e[0] < s; ) e.shift(); if (this._autoRotateFpsSamples = e, e.length >= 2) { const n = (e[e.length - 1] - e[0]) / 1e3; this._autoRotateFps = n > 0 ? (e.length - 1) / n : 0; } - }, Ri = (t) => { - if (!this._autoRotateCalibrated || !Ch) return; + }, zi = (t) => { + if (!this._autoRotateCalibrated || !Dh) return; const e = this._autoRotateAdaptiveLastCheck || 0; - if (t - e < Nh) return; + if (t - e < zh) return; this._autoRotateAdaptiveLastCheck = t; const s = 1e3 / this._autoRotateIntervalMsDynamic; - if (this._autoRotateFps && this._autoRotateFps < s * Eh) { + if (this._autoRotateFps && this._autoRotateFps < s * Ph) { const n = Math.min( - $i, - this._autoRotateIntervalMsDynamic + kh + Ei, + this._autoRotateIntervalMsDynamic + Bh ); n !== this._autoRotateIntervalMsDynamic && (this._autoRotateIntervalMsDynamic = n, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)); } - }, Mi = (t) => { + }, Pi = (t) => { if (this._autoRotateCalibrated) return; const e = this._autoRotateCalibrateStart || t; - if (this._autoRotateCalibrateStart = e, t - e < Th) return; + if (this._autoRotateCalibrateStart = e, t - e < Lh) return; const s = this._autoRotateFps || 0; if (s > 0) { - const i = 1e3 / (s * Fh), r = Math.min( - $i, - Math.max(Js(), Math.round(i)) + const i = 1e3 / (s * Wh), r = Math.min( + Ei, + Math.max(pa(), Math.round(i)) ); r !== this._autoRotateIntervalMsDynamic && (this._autoRotateIntervalMsDynamic = r, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)); } this._autoRotateCalibrated = !0; - }, qa = () => { - this._autoRotateEnabled && (this._autoRotateLastTick = 0, this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = 0, this._autoRotateEnabled = !1, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null), this._autoRotateIntervalMsDynamic = Mt, this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._cssRecalibrateRequested = !0, this._updateTimerMS = Date.now(), this.requestUpdate()); - }, Uh = () => { - this._autoRotateEnabled || (this._manualRotateEnabled && this._stopManualRotate(), this._autoRotateEnabled = !0, this._autoRotateLastTick = Qo(), this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = xh && Ua > 0 ? Ua * 360 : 0, this._autoRotateIntervalMsDynamic = Js(), this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._autoRotateTimer || (this._autoRotateTimer = setInterval(() => { - const t = Qo(); - xi(t), Mi(t), Ri(t); - const e = this._autoRotateLastTick || t, s = Math.max(0, t - e) / 1e3, n = Ve * s; + }, cn = () => { + this._autoRotateEnabled && (this._autoRotateLastTick = 0, this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = 0, this._autoRotateEnabled = !1, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null), this._autoRotateIntervalMsDynamic = Tt, this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._cssRecalibrateRequested = !0, this._updateTimerMS = Date.now(), this.requestUpdate()); + }, Jh = () => { + this._autoRotateEnabled || (this._manualRotateEnabled && this._stopManualRotate(), this._autoRotateEnabled = !0, this._autoRotateLastTick = ae(), this._autoRotateAccumDeg = 0, this._autoRotateTargetDeg = Fh && nn > 0 ? nn * 360 : 0, this._autoRotateIntervalMsDynamic = pa(), this._autoRotateFpsSamples = [], this._autoRotateFps = 0, this._autoRotateAdaptiveLastCheck = 0, this._autoRotateCalibrated = !1, this._autoRotateCalibrateStart = 0, this._autoRotateTimer || (this._autoRotateTimer = setInterval(() => { + const t = ae(); + Bi(t), Pi(t), zi(t); + const e = this._autoRotateLastTick || t, s = Math.max(0, t - e) / 1e3, n = Xe * s; if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + n, this._autoRotateAccumDeg = (this._autoRotateAccumDeg || 0) + n, this._autoRotateLastTick = t, this._autoRotateTargetDeg > 0 && this._autoRotateAccumDeg >= this._autoRotateTargetDeg) { - qa(); + cn(); return; } this._updateTimerMS = Date.now(), this.requestUpdate(); }, this._autoRotateIntervalMsDynamic), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic), this._updateTimerMS = Date.now(), this.requestUpdate()); }; - if (this._autoRotateStop = qa, this._autoRotateStartFn = Uh, this._autoRotateHandlers || (this._autoRotateHandlers = !0, this._autoRotateLastTap = 0, this.addEventListener("pointerup", (t) => { + if (this._autoRotateStop = cn, this._autoRotateStartFn = Jh, this._autoRotateHandlers || (this._autoRotateHandlers = !0, this._autoRotateLastTap = 0, this.addEventListener("pointerup", (t) => { var i; if ((t.composedPath ? t.composedPath() : []).some((r) => { var h, u; return (u = (h = r == null ? void 0 : r.classList) == null ? void 0 : h.contains) == null ? void 0 : u.call(h, "cam-btn"); }) || t.button !== void 0 && t.button !== 0) return; const s = Date.now(), n = this._autoRotateLastTap || 0; - if (s - n < Ga) { + if (s - n < an) { this._autoRotateLastTap = 0, this._autoRotateClickTimer && clearTimeout(this._autoRotateClickTimer), (i = this._autoRotateStartFn) == null || i.call(this); return; } this._autoRotateLastTap = s, this._autoRotateClickTimer && clearTimeout(this._autoRotateClickTimer), this._autoRotateClickTimer = setTimeout(() => { var r; - this._autoRotateLastTap && Date.now() - this._autoRotateLastTap >= Ga && (this._autoRotateLastTap = 0, (r = this._autoRotateStop) == null || r.call(this)); - }, Ga + 10); + this._autoRotateLastTap && Date.now() - this._autoRotateLastTap >= an && (this._autoRotateLastTap = 0, (r = this._autoRotateStop) == null || r.call(this)); + }, an + 10); }, { capture: !1 })), this._autoRotateEnabled) { - const t = Js(); - Number(this._autoRotateIntervalMsDynamic || Mt) < t && (this._autoRotateIntervalMsDynamic = t, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)), (!this._autoRotateTimer || this._autoRotateTimerMs !== this._autoRotateIntervalMsDynamic) && (this._autoRotateTimer && clearInterval(this._autoRotateTimer), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic, this._autoRotateTimer = setInterval(() => { - const e = Qo(); - xi(e), Mi(e), Ri(e); - const s = this._autoRotateLastTick || e, n = Math.max(0, e - s) / 1e3, i = Ve * n; + const t = pa(); + Number(this._autoRotateIntervalMsDynamic || Tt) < t && (this._autoRotateIntervalMsDynamic = t, this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null)), (!this._autoRotateTimer || this._autoRotateTimerMs !== this._autoRotateIntervalMsDynamic) && (this._autoRotateTimer && clearInterval(this._autoRotateTimer), this._autoRotateTimerMs = this._autoRotateIntervalMsDynamic, this._autoRotateTimer = setInterval(() => { + const e = ae(); + Bi(e), Pi(e), zi(e); + const s = this._autoRotateLastTick || e, n = Math.max(0, e - s) / 1e3, i = Xe * n; if (this._autoRotateOffsetDeg = (this._autoRotateOffsetDeg || 0) + i, this._autoRotateAccumDeg = (this._autoRotateAccumDeg || 0) + i, this._autoRotateLastTick = e, this._autoRotateTargetDeg > 0 && this._autoRotateAccumDeg >= this._autoRotateTargetDeg) { - qa(); + cn(); return; } this._updateTimerMS = Date.now(), this.requestUpdate(); }, this._autoRotateIntervalMsDynamic)); } else this._autoRotateTimer && (clearInterval(this._autoRotateTimer), this._autoRotateTimer = null); - _i ? Hh() : Vh(); - const Ci = !!(this._autoRotateEnabled || this._manualRotateEnabled); - Xs && this._cssRecalibrateRequested && !Ci && (ja(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssRecalibrateRequested = !1), Xs ? Gh() : (ja(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssFpsLimit = 0, this._cssPerfLimited = !1, this._cssRecalibrateRequested = !1); - const ut = Xs && this._cssPerfLimited && Number(this._cssFpsLimit) > 0, co = ut ? Number(this._cssFpsLimit) : 0, Qs = ut && co <= 5, Ya = Hc && !Qs, Xa = bl && !(ut && co <= 1), jh = Js(); - this._rotationIntervalMsFloor = jh; - const Za = Ci, qh = ut && Za; - ut && !Za ? Ih(co) : wi(); - const ki = Number(((Ur = l.states[Ut]) == null ? void 0 : Ur.state) || 210), Ni = Number(((jr = l.states[eo]) == null ? void 0 : jr.state) || 35); - let ta = ki, oa = Ni; - const Ka = Number(this._cameraSavedBaseHOverride), Ja = Number(this._cameraSavedBaseVOverride); - Number.isFinite(Ka) && (ta = Ka, Math.abs((ki - Ka + 540) % 360 - 180) < 0.25 && (this._cameraSavedBaseHOverride = void 0)), Number.isFinite(Ja) && (oa = Ja, Math.abs(Ni - Ja) < 0.25 && (this._cameraSavedBaseVOverride = void 0)), this._autoRotateCurrentDeg = this._autoRotateOffsetDeg || 0; - const Ei = (ta + (this._autoRotateOffsetDeg || 0)) * Math.PI / 180; - this._manualRotateBaseVDeg = oa; - const Yh = Number(this._manualRotateVOffsetDeg || 0), Ro = Math.min(Math.max(oa + Yh, 0), 90); - this._savedCameraH = this._normDeg(ta), this._savedCameraV = Math.max(0, Math.min(90, oa)), this._currentCameraH = this._normDeg(ta + Number(this._autoRotateOffsetDeg || 0)), this._currentCameraV = Ro; - const Ti = Ro * Math.PI / 180, He = 5, ea = Math.cos(Ei), sa = Math.sin(Ei), aa = Math.cos(Ti), na = -Math.sin(Ti), Fi = (wt || 0) * Math.PI / 180, Ai = Math.cos(Fi), Di = Math.sin(Fi), Xh = Math.PI * 2; - function M(t, e, s) { + Fi ? Zh() : Xh(); + const Li = !!(this._autoRotateEnabled || this._manualRotateEnabled); + ua && this._cssRecalibrateRequested && !Li && (rn(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssRecalibrateRequested = !1), ua ? Kh() : (rn(), this._cssFpsAutoCalibrated = !1, this._cssFpsMeasured = 0, this._cssFpsLimit = 0, this._cssPerfLimited = !1, this._cssRecalibrateRequested = !1); + const ut = ua && this._cssPerfLimited && Number(this._cssFpsLimit) > 0, lo = ut ? Number(this._cssFpsLimit) : 0, ma = ut && lo <= 5, ln = Zc && !ma, hn = xl && !(ut && lo <= 1), Qh = pa(); + this._rotationIntervalMsFloor = Qh; + const un = Li, tu = ut && un; + ut && !un ? Yh(lo) : Di(); + const Wi = Number(((nc = l.states[so]) == null ? void 0 : nc.state) || 210), Oi = Number(((ic = l.states[$o]) == null ? void 0 : ic.state) || 35); + let ba = Wi, ga = Oi; + const fn = Number(this._cameraSavedBaseHOverride), dn = Number(this._cameraSavedBaseVOverride); + Number.isFinite(fn) && (ba = fn, Math.abs((Wi - fn + 540) % 360 - 180) < 0.25 && (this._cameraSavedBaseHOverride = void 0)), Number.isFinite(dn) && (ga = dn, Math.abs(Oi - dn) < 0.25 && (this._cameraSavedBaseVOverride = void 0)), this._autoRotateCurrentDeg = this._autoRotateOffsetDeg || 0; + const Ii = Number(this._autoRotateOffsetDeg || 0), Vi = Re ? (mt - Lt + 540) % 360 - 180 : 0; + this._fixedSunSceneCompDeg = Vi; + const Hi = (ba + Ii + Vi) * Math.PI / 180; + this._manualRotateBaseVDeg = ga; + const ou = Number(this._manualRotateVOffsetDeg || 0), ko = Math.min(Math.max(ga + ou, 0), 90); + this._savedCameraH = this._normDeg(ba), this._savedCameraV = Math.max(0, Math.min(90, ga)), this._currentCameraH = this._normDeg(ba + Ii), this._currentCameraV = ko; + const Gi = ko * Math.PI / 180, Ze = 5, _a = Math.cos(Hi), ya = Math.sin(Hi), $a = Math.cos(Gi), va = -Math.sin(Gi), Ui = (Pt || 0) * Math.PI / 180, ji = Math.cos(Ui), qi = Math.sin(Ui), eu = Math.PI * 2; + function C(t, e, s) { return Math.min(s, Math.max(e, t)); } - function gt(t) { + function St(t) { const e = Math.hypot(...t); return e > 0 ? t.map((s) => s / e) : [0, 0, 0]; } - function Zh(t, e) { + function su(t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]; } function G(t) { - const e = t[0], s = t[1], n = t[2], i = e * ea - n * sa, r = e * sa + n * ea, h = s * aa - r * na, u = s * na + r * aa; + const e = t[0], s = t[1], n = t[2], i = e * _a - n * ya, r = e * ya + n * _a, h = s * $a - r * va, u = s * va + r * $a; return [i, h, u]; } - function Bi(t) { - const e = t[0], s = t[1], n = t[2], i = s * aa + n * na, r = -s * na + n * aa, h = e * ea + r * sa, u = -e * sa + r * ea; + function Yi(t) { + const e = t[0], s = t[1], n = t[2], i = s * $a + n * va, r = -s * va + n * $a, h = e * _a + r * ya, u = -e * ya + r * _a; return [h, i, u]; } - function ft(t) { - const e = t[0], s = t[1], n = t[2], i = e * Ai + n * Di, r = -e * Di + n * Ai; + function bt(t) { + const e = t[0], s = t[1], n = t[2], i = e * ji + n * qi, r = -e * qi + n * ji; return [i, s, r]; } - function ia(t) { - return G(ft(t)); + function Sa(t) { + return G(bt(t)); } function U(t) { - const e = t[0], s = t[1], n = t[2], i = He / (He + n); - return [oo + e * Tt * i, bo - s * Tt * i, n, i]; + const e = t[0], s = t[1], n = t[2], i = Ze / (Ze + n); + return [go + e * dt * i, jo - s * dt * i, n, i]; } - function Ct(t, e) { + function Dt(t, e) { const s = parseInt(t.substr(1, 2), 16), n = parseInt(t.substr(3, 2), 16), i = parseInt(t.substr(5, 2), 16), r = Math.min(255, Math.max(0, Math.round(s * e))), h = Math.min(255, Math.max(0, Math.round(n * e))), u = Math.min(255, Math.max(0, Math.round(i * e))); return `rgb(${r},${h},${u})`; } - function ra(t, e, s, n) { - const i = gt([s[0] - e[0], s[1] - e[1], s[2] - e[2]]), r = [t[0] - e[0], t[1] - e[1], t[2] - e[2]], h = Math.cos(n), u = Math.sin(n), d = [ + function xa(t, e, s, n) { + const i = St([s[0] - e[0], s[1] - e[1], s[2] - e[2]]), r = [t[0] - e[0], t[1] - e[1], t[2] - e[2]], h = Math.cos(n), u = Math.sin(n), d = [ i[1] * r[2] - i[2] * r[1], i[2] * r[0] - i[0] * r[2], i[0] * r[1] - i[1] * r[0] @@ -1354,22 +1424,22 @@ const qn = class qn extends be { ]; return [e[0] + p[0], e[1] + p[1], e[2] + p[2]]; } - function Kh(t, e, s) { + function au(t, e, s) { const n = [e[0] - t[0], e[1] - t[1], e[2] - t[2]], i = [s[0] - t[0], s[1] - t[1], s[2] - t[2]]; - return gt([ + return St([ n[1] * i[2] - n[2] * i[1], n[2] * i[0] - n[0] * i[2], n[0] * i[1] - n[1] * i[0] ]); } - function Mo(t) { + function No(t) { return t.reduce((e, s) => e + s[2], 0) / t.length; } - function Pi(t) { + function Xi(t) { const e = Number(t); return Number.isFinite(e) ? `${Math.round(e)}%` : "0%"; } - function Qa(t) { + function pn(t) { let e = 0; for (let s = 0; s < t.length; s++) { const n = (s + 1) % t.length; @@ -1377,35 +1447,35 @@ const qn = class qn extends be { } return e; } - function Jh(t, e) { + function nu(t, e) { if (!t.length || e.length < 3) return []; - const n = Qa(e) > 0, i = (u, d, f) => { + const n = pn(e) > 0, i = (u, d, f) => { const p = (f[0] - d[0]) * (u[1] - d[1]) - (f[1] - d[1]) * (u[0] - d[0]); return n ? p >= 0 : p <= 0; }, r = (u, d, f, p) => { - const m = u[0], b = u[1], g = d[0], y = d[1], x = f[0], E = f[1], T = p[0], B = p[1], z = (m - g) * (E - B) - (b - y) * (x - T); - if (Math.abs(z) < 1e-6) return d; - const I = ((m * y - b * g) * (x - T) - (m - g) * (x * B - E * T)) / z, C = ((m * y - b * g) * (E - B) - (b - y) * (x * B - E * T)) / z; - return [I, C]; + const m = u[0], b = u[1], g = d[0], _ = d[1], R = f[0], A = f[1], T = p[0], P = p[1], W = (m - g) * (A - P) - (b - _) * (R - T); + if (Math.abs(W) < 1e-6) return d; + const V = ((m * _ - b * g) * (R - T) - (m - g) * (R * P - A * T)) / W, N = ((m * _ - b * g) * (A - P) - (b - _) * (R * P - A * T)) / W; + return [V, N]; }; let h = t.slice(); for (let u = 0; u < e.length; u++) { const d = e[u], f = e[(u + 1) % e.length], p = h.slice(); if (h = [], !p.length) break; for (let m = 0; m < p.length; m++) { - const b = p[m], g = p[(m - 1 + p.length) % p.length], y = i(b, d, f), x = i(g, d, f); - y ? (x || h.push(r(g, b, d, f)), h.push(b)) : x && h.push(r(g, b, d, f)); + const b = p[m], g = p[(m - 1 + p.length) % p.length], _ = i(b, d, f), R = i(g, d, f); + _ ? (R || h.push(r(g, b, d, f)), h.push(b)) : R && h.push(r(g, b, d, f)); } } return h; } - function zi(t, e, s, n) { + function Zi(t, e, s, n) { return n > 0 && (t = -t, e = -e, s = -s, n = -n), t * n - e * s < 0 && (t = -t, e = -e), t < 0 && (t = -t, e = -e, s = -s, n = -n), { bx: t, by: e, ux: s, uy: n }; } - function Li(t, e, s, n) { + function Ki(t, e, s, n) { return t * n - e * s < 0 && (s = -s, n = -n), { bx: t, by: e, ux: s, uy: n }; } - function Wi(t, e, s, n, i = !0) { + function Ji(t, e, s, n, i = !0) { const r = U(G(t)), h = U(G([ t[0] + e[0], t[1] + e[1], @@ -1420,33 +1490,33 @@ const qn = class qn extends be { d /= p, f /= p; let m = u[0] - r[0], b = u[1] - r[1], g = Math.hypot(m, b); g < 1e-6 ? (m = -f, b = d, g = Math.hypot(m, b)) : (m /= g, b /= g); - let y = i ? zi(d, f, m, b) : Li(d, f, m, b); + let _ = i ? Zi(d, f, m, b) : Ki(d, f, m, b); if (n) { - const x = U(G([ + const R = U(G([ t[0] + n[0], t[1] + n[1], t[2] + n[2] ])); - let E = x[0] - r[0], T = x[1] - r[1], B = Math.hypot(E, T); - B > 1e-6 && (E /= B, T /= B, y.bx * E + y.by * T < 0 && (y = i ? zi(-y.bx, -y.by, -y.ux, -y.uy) : Li(-y.bx, -y.by, -y.ux, -y.uy))); + let A = R[0] - r[0], T = R[1] - r[1], P = Math.hypot(A, T); + P > 1e-6 && (A /= P, T /= P, _.bx * A + _.by * T < 0 && (_ = i ? Zi(-_.bx, -_.by, -_.ux, -_.uy) : Ki(-_.bx, -_.by, -_.ux, -_.uy))); } - return { basis: y, centerScr: r }; + return { basis: _, centerScr: r }; } - function Qh(t, e) { - const s = t[0][0], n = t[0][1], i = t[1][0], r = t[1][1], h = t[2][0], u = t[2][1], d = e[0][0], f = e[0][1], p = e[1][0], m = e[1][1], b = e[2][0], g = e[2][1], y = s * (r - u) + i * (u - n) + h * (n - r); - if (Math.abs(y) < 1e-6) return null; - const x = (d * (r - u) + p * (u - n) + b * (n - r)) / y, E = (f * (r - u) + m * (u - n) + g * (n - r)) / y, T = (d * (h - i) + p * (s - h) + b * (i - s)) / y, B = (f * (h - i) + m * (s - h) + g * (i - s)) / y, z = (d * (i * u - h * r) + p * (h * n - s * u) + b * (s * r - i * n)) / y, I = (f * (i * u - h * r) + m * (h * n - s * u) + g * (s * r - i * n)) / y; - return { a: x, b: E, c: T, d: B, e: z, f: I }; + function iu(t, e) { + const s = t[0][0], n = t[0][1], i = t[1][0], r = t[1][1], h = t[2][0], u = t[2][1], d = e[0][0], f = e[0][1], p = e[1][0], m = e[1][1], b = e[2][0], g = e[2][1], _ = s * (r - u) + i * (u - n) + h * (n - r); + if (Math.abs(_) < 1e-6) return null; + const R = (d * (r - u) + p * (u - n) + b * (n - r)) / _, A = (f * (r - u) + m * (u - n) + g * (n - r)) / _, T = (d * (h - i) + p * (s - h) + b * (i - s)) / _, P = (f * (h - i) + m * (s - h) + g * (i - s)) / _, W = (d * (i * u - h * r) + p * (h * n - s * u) + b * (s * r - i * n)) / _, V = (f * (i * u - h * r) + m * (h * n - s * u) + g * (s * r - i * n)) / _; + return { a: R, b: A, c: T, d: P, e: W, f: V }; } - function tu(t) { + function ru(t) { const e = [0, 1, 0], s = [ e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0] ]; - return gt(s); + return St(s); } - function Oi(t) { + function Qi(t) { if (t.length <= 1) return t.slice(); const e = t.slice().sort((r, h) => r.x === h.x ? r.z - h.z : r.x - h.x), s = (r, h, u) => (h.x - r.x) * (u.z - r.z) - (h.z - r.z) * (u.x - r.x), n = []; for (const r of e) { @@ -1463,13 +1533,13 @@ const qn = class qn extends be { } return i.pop(), n.pop(), n.concat(i); } - function ou(t, e, s, n, i) { + function cu(t, e, s, n, i) { if (t.length === 0) return t; const r = (f, p, m) => { const b = []; for (let g = 0; g < f.length; g++) { - const y = f[g], x = f[(g + 1) % f.length], E = p(y), T = p(x); - E && T ? b.push(x) : E && !T ? b.push(m(y, x)) : !E && T && (b.push(m(y, x)), b.push(x)); + const _ = f[g], R = f[(g + 1) % f.length], A = p(_), T = p(R); + A && T ? b.push(R) : A && !T ? b.push(m(_, R)) : !A && T && (b.push(m(_, R)), b.push(R)); } return b; }, h = (f, p, m) => { @@ -1486,7 +1556,7 @@ const qn = class qn extends be { let d = t.slice(); return d = r(d, (f) => f.x >= e, (f, p) => h(f, p, e)), d = r(d, (f) => f.x <= s, (f, p) => h(f, p, s)), d = r(d, (f) => f.z >= n, (f, p) => u(f, p, n)), d = r(d, (f) => f.z <= i, (f, p) => u(f, p, i)), d; } - function eu(t) { + function lu(t) { if (t.length <= 1) return t.slice(); const e = t.slice().sort((r, h) => r.x === h.x ? r.y - h.y : r.x - h.x), s = (r, h, u) => (h.x - r.x) * (u.y - r.y) - (h.y - r.y) * (u.x - r.x), n = []; for (const r of e) { @@ -1501,17 +1571,17 @@ const qn = class qn extends be { } return i.pop(), n.pop(), n.concat(i); } - const te = Wt * Math.PI / 180, tn = et * Math.PI / 180, Ot = gt([ - Math.cos(tn) * Math.sin(te), - Math.sin(tn), - Math.cos(tn) * Math.cos(te) - ]), on = M(et * Ss + vs, -89.9, 89.9) * Math.PI / 180, en = gt([ - Math.cos(on) * Math.sin(te), - Math.sin(on), - Math.cos(on) * Math.cos(te) + const ne = mt * Math.PI / 180, mn = ot * Math.PI / 180, Ht = St([ + Math.cos(mn) * Math.sin(ne), + Math.sin(mn), + Math.cos(mn) * Math.cos(ne) + ]), bn = C(ot * Ns + ks, -89.9, 89.9) * Math.PI / 180, gn = St([ + Math.cos(bn) * Math.sin(ne), + Math.sin(bn), + Math.cos(bn) * Math.cos(ne) ]); - G(Ot); - const vt = Ot[1] > 0.01, Ii = [ + G(Ht); + const Nt = Ht[1] > 0.01, tr = [ [-1, -1, -1], [1, -1, -1], [1, 1, -1], @@ -1520,37 +1590,37 @@ const qn = class qn extends be { [1, -1, 1], [1, 1, 1], [-1, 1, 1] - ], qt = Ii.map(ft), Ge = qt.map(G), Yt = Ge.map(U), su = [ - { id: "front", i: [4, 5, 6, 7], c: _t.front }, - { id: "right", i: [1, 5, 6, 2], c: _t.right }, - { id: "back", i: [0, 1, 2, 3], c: _t.back }, - { id: "left", i: [0, 4, 7, 3], c: _t.left }, - { id: "bottom", i: [0, 1, 5, 4], c: _t.bottom } - ], sn = { + ], Zt = tr.map(bt), Ke = Zt.map(G), Kt = Ke.map(U), hu = [ + { id: "front", i: [4, 5, 6, 7], c: kt.front }, + { id: "right", i: [1, 5, 6, 2], c: kt.right }, + { id: "back", i: [0, 1, 2, 3], c: kt.back }, + { id: "left", i: [0, 4, 7, 3], c: kt.left }, + { id: "bottom", i: [0, 1, 5, 4], c: kt.bottom } + ], _n = { front: { indices: [4, 5, 6, 7], edge: [4, 5] }, right: { indices: [1, 5, 6, 2], edge: [1, 5] }, back: { indices: [0, 1, 2, 3], edge: [0, 1] }, left: { indices: [0, 4, 7, 3], edge: [0, 4] } - }, Vi = { + }, or = { front: [0, 0, 1], right: [1, 0, 0], back: [0, 0, -1], left: [-1, 0, 0] - }, Ue = { - front: bs, - right: gs, - back: ys, - left: $s - }, je = (t) => { - if (!Xc) return 1; - const e = M(Zc, 0, 1), s = M(Kc, 1, 100), i = M(Number.isFinite(t) ? t : 0, 0, s) / s, r = Math.max(1e-3, Jc), h = Math.log(1 + r * i) / Math.log(1 + r); + }, Je = { + front: xs, + right: ws, + back: Rs, + left: Ms + }, Qe = (t) => { + if (!el) return 1; + const e = C(sl, 0, 1), s = C(al, 1, 100), i = C(Number.isFinite(t) ? t : 0, 0, s) / s, r = Math.max(1e-3, nl), h = Math.log(1 + r * i) / Math.log(1 + r); return e + (1 - e) * h; - }, lo = { - front: je(Ue.front), - right: je(Ue.right), - back: je(Ue.back), - left: je(Ue.left) - }, At = je(ve), au = { + }, ho = { + front: Qe(Je.front), + right: Qe(Je.right), + back: Qe(Je.back), + left: Qe(Je.left) + }, Wt = Qe(Me), uu = { front: [1, 0, 0], back: [1, 0, 0], right: [0, 0, 1], @@ -1560,27 +1630,27 @@ const qn = class qn extends be { [1, 1, -1], [1, 1, 1], [-1, 1, 1] - ], an = M(no, 0, ws), Co = vo && an > 0.01; - let K = ct; - if (Co) { - const t = an * Math.PI / 180; + ], yn = C(io, 0, Es), Eo = wo && yn > 0.01; + let J = ct; + if (Eo) { + const t = yn * Math.PI / 180; let e = [-1, 1, 1], s = [1, 1, 1], n = 1; H === "front" && (e = [-1, 1, 1], s = [1, 1, 1], n = 1), H === "back" && (e = [-1, 1, -1], s = [1, 1, -1], n = -1), H === "left" && (e = [-1, 1, -1], s = [-1, 1, 1], n = 1), H === "right" && (e = [1, 1, -1], s = [1, 1, 1], n = -1); const i = t * n; - K = ct.map((r) => ra(r, e, s, i)); - } - const qe = K.map(ft), Hi = qe.map(G), ca = Hi.map(U); - let nn = Kh(K[0], K[1], K[2]); - nn[1] < 0 && (nn = nn.map((t) => -t)); - const Gi = Qa(ca), la = Gi < 0; - Rt ? this._roofWindingFront = la : this._roofWindingFront === void 0 ? this._roofWindingFront = la : Math.abs(Gi) > 20 && (this._roofWindingFront = la); - const ho = Rt ? la : this._roofWindingFront; - let rn = null; - const Ye = (t, e) => /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t) ? Ct(t, e) : t; - let Ui = !1, cn = !0, ha = !1; - const Xt = []; - if (Rt) { - const t = Math.max(0, Rs), e = Math.max(0, Cs), s = Math.max(0.01, Ms), n = 1 + e, i = n + s; + J = ct.map((r) => xa(r, e, s, i)); + } + const ts = J.map(bt), er = ts.map(G), wa = er.map(U); + let $n = au(J[0], J[1], J[2]); + $n[1] < 0 && ($n = $n.map((t) => -t)); + const sr = pn(wa), Ra = sr < 0; + At ? this._roofWindingFront = Ra : this._roofWindingFront === void 0 ? this._roofWindingFront = Ra : Math.abs(sr) > 20 && (this._roofWindingFront = Ra); + const uo = At ? Ra : this._roofWindingFront; + let vn = null; + const os = (t, e) => /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t) ? Dt(t, e) : t; + let ar = !1, Sn = !0, Ma = !1; + const Jt = []; + if (At) { + const t = Math.max(0, As), e = Math.max(0, Ds), s = Math.max(0.01, Ts), n = 1 + e, i = n + s; let r = [ [-1 - t, i, -1 - t], [1 + t, i, -1 - t], @@ -1597,26 +1667,26 @@ const qn = class qn extends be { [1, n, 1], [-1, n, 1] ]; - if (Co) { - const C = an * Math.PI / 180; - let _ = [-1, n, 1], R = [1, n, 1], L = 1; - H === "front" && (_ = [-1, n, 1], R = [1, n, 1], L = 1), H === "back" && (_ = [-1, n, -1], R = [1, n, -1], L = -1), H === "left" && (_ = [-1, n, -1], R = [-1, n, 1], L = 1), H === "right" && (_ = [1, n, -1], R = [1, n, 1], L = -1); - const A = C * L; - r = r.map((j) => ra(j, _, R, A)), h = h.map((j) => ra(j, _, R, A)), u = u.map((j) => ra(j, _, R, A)); + if (Eo) { + const N = yn * Math.PI / 180; + let v = [-1, n, 1], M = [1, n, 1], I = 1; + H === "front" && (v = [-1, n, 1], M = [1, n, 1], I = 1), H === "back" && (v = [-1, n, -1], M = [1, n, -1], I = -1), H === "left" && (v = [-1, n, -1], M = [-1, n, 1], I = 1), H === "right" && (v = [1, n, -1], M = [1, n, 1], I = -1); + const D = N * I; + r = r.map((q) => xa(q, v, M, D)), h = h.map((q) => xa(q, v, M, D)), u = u.map((q) => xa(q, v, M, D)); } - const d = r.map(ft), f = h.map(ft); - rn = d; - const p = d.map((C) => G(C)), m = f.map((C) => G(C)), b = p.map((C) => U(C)), g = m.map((C) => U(C)), y = Mo(g) - Mo(b); - this._flatRoofBottomCloser === void 0 ? this._flatRoofBottomCloser = y < 0 : y < -0.01 ? this._flatRoofBottomCloser = !0 : y > 0.01 && (this._flatRoofBottomCloser = !1), Ui = !!this._flatRoofBottomCloser; - const x = Ye(xe, At); - Xt.push({ + const d = r.map(bt), f = h.map(bt); + vn = d; + const p = d.map((N) => G(N)), m = f.map((N) => G(N)), b = p.map((N) => U(N)), g = m.map((N) => U(N)), _ = No(g) - No(b); + this._flatRoofBottomCloser === void 0 ? this._flatRoofBottomCloser = _ < 0 : _ < -0.01 ? this._flatRoofBottomCloser = !0 : _ > 0.01 && (this._flatRoofBottomCloser = !1), ar = !!this._flatRoofBottomCloser; + const R = os(Ne, Wt); + Jt.push({ type: "flatRoofTop", pts: b, - z: Mo(b) - ke, - fill: x, - opacity: Ce + z: No(b) - Te, + fill: R, + opacity: Ae }); - const E = [ + const A = [ { id: "front", pts: [b[3], b[2], g[2], g[3]], @@ -1637,263 +1707,263 @@ const qn = class qn extends be { pts: [b[0], b[3], g[3], g[0]], cam: [p[0], p[3], m[3], m[0]] } - ], T = [...p, ...m].reduce((C, _) => [C[0] + _[0], C[1] + _[1], C[2] + _[2]], [0, 0, 0]).map((C) => C / 8); - E.forEach((C) => { - const _ = lo[C.id] ?? At, R = M(_, 0.2, 1), L = Math.min(...C.pts.map((lt) => lt[2])), A = C.cam.reduce((lt, Gt) => [lt[0] + Gt[0], lt[1] + Gt[1], lt[2] + Gt[2]], [0, 0, 0]).map((lt) => lt / 4), j = gt([A[0] - T[0], A[1] - T[1], A[2] - T[2]]), st = gt([-A[0], -A[1], -He - A[2]]); - Zh(j, st) > -0.02 && Xt.push({ - type: `flatRoofEdge-${C.id}`, - pts: C.pts, - z: L - Ne, - fill: Ye(xe, R), - opacity: Zo + ], T = [...p, ...m].reduce((N, v) => [N[0] + v[0], N[1] + v[1], N[2] + v[2]], [0, 0, 0]).map((N) => N / 8); + A.forEach((N) => { + const v = ho[N.id] ?? Wt, M = C(v, 0.2, 1), I = Math.min(...N.pts.map((lt) => lt[2])), D = N.cam.reduce((lt, qt) => [lt[0] + qt[0], lt[1] + qt[1], lt[2] + qt[2]], [0, 0, 0]).map((lt) => lt / 4), q = St([D[0] - T[0], D[1] - T[1], D[2] - T[2]]), et = St([-D[0], -D[1], -Ze - D[2]]); + su(q, et) > -0.02 && Jt.push({ + type: `flatRoofEdge-${N.id}`, + pts: N.pts, + z: I - De, + fill: os(Ne, M), + opacity: oe }); }); - const B = lo[H] ?? At; - if (Xt.push({ + const P = ho[H] ?? Wt; + if (Jt.push({ type: "flatRoofBottom", pts: g, - z: Mo(g), - fill: Ye(Re, Math.max(0.2, B * Me * si)), - opacity: Zo - }), Co) { - const _ = u.map(ft).map((j) => U(G(j))), R = [Yt[3], Yt[2], Yt[6], Yt[7]], L = (j) => { - const st = lo[j] ?? 1; - return Ye(Re, M(st * Me, 0.2, 1)); - }, A = (j, st, pt) => { - const lt = Math.max(...st.map((Gt) => Gt[2])); - Xt.push({ - type: pt, - pts: st, + z: No(g), + fill: os(Ee, Math.max(0.2, P * Fe * pi)), + opacity: oe + }), Eo) { + const v = u.map(bt).map((q) => U(G(q))), M = [Kt[3], Kt[2], Kt[6], Kt[7]], I = (q) => { + const et = ho[q] ?? 1; + return os(Ee, C(et * Fe, 0.2, 1)); + }, D = (q, et, yt) => { + const lt = Math.max(...et.map((qt) => qt[2])); + Jt.push({ + type: yt, + pts: et, // Keep connector skirts behind the roof overhang edges at corner views. - z: lt + Math.max(ks, 0.02), - fill: L(j), - opacity: za + z: lt + Math.max(Bs, 0.02), + fill: I(q), + opacity: Ka }); }; - H === "front" ? (A("left", [_[0], R[0], _[3]], "flatRoofSkirt-left"), A("right", [_[1], R[1], _[2]], "flatRoofSkirt-right"), A("back", [_[0], _[1], R[1], R[0]], "flatRoofSkirt-back")) : H === "back" ? (A("left", [_[3], R[3], _[0]], "flatRoofSkirt-left"), A("right", [_[2], R[2], _[1]], "flatRoofSkirt-right"), A("front", [_[2], _[3], R[3], R[2]], "flatRoofSkirt-front")) : H === "left" ? (A("front", [_[2], R[2], _[3]], "flatRoofSkirt-front"), A("back", [_[1], R[1], _[0]], "flatRoofSkirt-back"), A("right", [_[1], _[2], R[2], R[1]], "flatRoofSkirt-right")) : H === "right" && (A("front", [_[3], R[3], _[2]], "flatRoofSkirt-front"), A("back", [_[0], R[0], _[1]], "flatRoofSkirt-back"), A("left", [_[0], _[3], R[3], R[0]], "flatRoofSkirt-left")), e > 1e-3 && (H === "front" ? A("front", [_[3], _[2], R[2], R[3]], "flatRoofSkirt-front-low") : H === "back" ? A("back", [_[0], _[1], R[1], R[0]], "flatRoofSkirt-back-low") : H === "left" ? A("left", [_[0], _[3], R[3], R[0]], "flatRoofSkirt-left-low") : H === "right" && A("right", [_[1], _[2], R[2], R[1]], "flatRoofSkirt-right-low")); + H === "front" ? (D("left", [v[0], M[0], v[3]], "flatRoofSkirt-left"), D("right", [v[1], M[1], v[2]], "flatRoofSkirt-right"), D("back", [v[0], v[1], M[1], M[0]], "flatRoofSkirt-back")) : H === "back" ? (D("left", [v[3], M[3], v[0]], "flatRoofSkirt-left"), D("right", [v[2], M[2], v[1]], "flatRoofSkirt-right"), D("front", [v[2], v[3], M[3], M[2]], "flatRoofSkirt-front")) : H === "left" ? (D("front", [v[2], M[2], v[3]], "flatRoofSkirt-front"), D("back", [v[1], M[1], v[0]], "flatRoofSkirt-back"), D("right", [v[1], v[2], M[2], M[1]], "flatRoofSkirt-right")) : H === "right" && (D("front", [v[3], M[3], v[2]], "flatRoofSkirt-front"), D("back", [v[0], M[0], v[1]], "flatRoofSkirt-back"), D("left", [v[0], v[3], M[3], M[0]], "flatRoofSkirt-left")), e > 1e-3 && (H === "front" ? D("front", [v[3], v[2], M[2], M[3]], "flatRoofSkirt-front-low") : H === "back" ? D("back", [v[0], v[1], M[1], M[0]], "flatRoofSkirt-back-low") : H === "left" ? D("left", [v[0], v[3], M[3], M[0]], "flatRoofSkirt-left-low") : H === "right" && D("right", [v[1], v[2], M[2], M[1]], "flatRoofSkirt-right-low")); } - const z = Xt.find((C) => C.type === "flatRoofTop"), I = Xt.find((C) => C.type === "flatRoofBottom"); - if (ha = Ui || !ho, cn = !ha, z && I && (ha ? (z.opacity = 0, I.opacity = Zo) : (z.opacity = Ce, I.opacity = 0)), z && cn) { - const C = Xt.filter((_) => _ !== z); - if (C.length) { - const _ = Math.min(...C.map((R) => R.z)); - z.z = Math.min(z.z, _ - Math.max(0.015, ke)); + const W = Jt.find((N) => N.type === "flatRoofTop"), V = Jt.find((N) => N.type === "flatRoofBottom"); + if (Ma = ar || !uo, Sn = !Ma, W && V && (Ma ? (W.opacity = 0, V.opacity = oe) : (W.opacity = Ae, V.opacity = 0)), W && Sn) { + const N = Jt.filter((v) => v !== W); + if (N.length) { + const v = Math.min(...N.map((M) => M.z)); + W.z = Math.min(W.z, v - Math.max(0.015, Te)); } } - if (I && ha) { - const C = Xt.filter((_) => _ !== I); - if (C.length) { - const _ = Math.max(...C.map((R) => R.z)); - I.z = Math.max(I.z, _ + Math.max(0.02, Ne)); + if (V && Ma) { + const N = Jt.filter((v) => v !== V); + if (N.length) { + const v = Math.max(...N.map((M) => M.z)); + V.z = Math.max(V.z, v + Math.max(0.02, De)); } } } - const ln = Rt ? cn : ho; - let Xe = []; - Co && Dl && (H === "front" ? Xe = [ - { tri: [K[0], ct[0], K[3]], wall: "left" }, - { tri: [K[1], ct[1], K[2]], wall: "right" } - ] : H === "back" ? Xe = [ - { tri: [K[3], ct[3], K[0]], wall: "left" }, - { tri: [K[2], ct[2], K[1]], wall: "right" } - ] : H === "left" ? Xe = [ - { tri: [K[2], ct[2], K[3]], wall: "front" }, - { tri: [K[1], ct[1], K[0]], wall: "back" } - ] : H === "right" && (Xe = [ - { tri: [K[3], ct[3], K[2]], wall: "front" }, - { tri: [K[0], ct[0], K[1]], wall: "back" } + const xn = At ? Sn : uo; + let es = []; + Eo && Il && (H === "front" ? es = [ + { tri: [J[0], ct[0], J[3]], wall: "left" }, + { tri: [J[1], ct[1], J[2]], wall: "right" } + ] : H === "back" ? es = [ + { tri: [J[3], ct[3], J[0]], wall: "left" }, + { tri: [J[2], ct[2], J[1]], wall: "right" } + ] : H === "left" ? es = [ + { tri: [J[2], ct[2], J[3]], wall: "front" }, + { tri: [J[1], ct[1], J[0]], wall: "back" } + ] : H === "right" && (es = [ + { tri: [J[3], ct[3], J[2]], wall: "front" }, + { tri: [J[0], ct[0], J[1]], wall: "back" } ])); - const nu = Xe.map((t) => ({ - pts: t.tri.map((e) => U(ia(e))), + const fu = es.map((t) => ({ + pts: t.tri.map((e) => U(Sa(e))), wall: t.wall - })), hn = (t) => { - const e = lo[t] ?? At, s = _t[t] ?? _t.top; - return Ct(s, Bl * e); - }, iu = lo[H] ?? At, ru = _t[H] ?? _t.top, cu = Ct(ru, si * iu), lu = Ct(_t.top, At); - let oe = null, ee = null; - Co && Pl && (H === "front" ? (oe = [K[0], K[1], ct[1], ct[0]], ee = "back") : H === "back" ? (oe = [K[2], K[3], ct[3], ct[2]], ee = "front") : H === "left" ? (oe = [K[1], K[2], ct[2], ct[1]], ee = "right") : H === "right" && (oe = [K[0], K[3], ct[3], ct[0]], ee = "left")); - const un = oe ? oe.map((t) => U(ia(t))) : null, hu = hn(ee || H); - let It = [0, 0, -1]; - H === "front" && (It = [0, 0, -1]), H === "back" && (It = [0, 0, 1]), H === "left" && (It = [1, 0, 0]), H === "right" && (It = [-1, 0, 0]); - const se = K.reduce((t, e) => [t[0] + e[0], t[1] + e[1], t[2] + e[2]], [0, 0, 0]).map((t) => t / 4), ae = 2.2; - U(ia([ - se[0] - It[0] * ae, - se[1] - It[1] * ae, - se[2] - It[2] * ae - ])), U(ia([ - se[0] + It[0] * ae, - se[1] + It[1] * ae, - se[2] + It[2] * ae + })), wn = (t) => { + const e = ho[t] ?? Wt, s = kt[t] ?? kt.top; + return Dt(s, Vl * e); + }, du = ho[H] ?? Wt, pu = kt[H] ?? kt.top, mu = Dt(pu, pi * du), bu = Dt(kt.top, Wt); + let ie = null, re = null; + Eo && Hl && (H === "front" ? (ie = [J[0], J[1], ct[1], ct[0]], re = "back") : H === "back" ? (ie = [J[2], J[3], ct[3], ct[2]], re = "front") : H === "left" ? (ie = [J[1], J[2], ct[2], ct[1]], re = "right") : H === "right" && (ie = [J[0], J[3], ct[3], ct[0]], re = "left")); + const Rn = ie ? ie.map((t) => U(Sa(t))) : null, gu = wn(re || H); + let Gt = [0, 0, -1]; + H === "front" && (Gt = [0, 0, -1]), H === "back" && (Gt = [0, 0, 1]), H === "left" && (Gt = [1, 0, 0]), H === "right" && (Gt = [-1, 0, 0]); + const ce = J.reduce((t, e) => [t[0] + e[0], t[1] + e[1], t[2] + e[2]], [0, 0, 0]).map((t) => t / 4), le = 2.2; + U(Sa([ + ce[0] - Gt[0] * le, + ce[1] - Gt[1] * le, + ce[2] - Gt[2] * le + ])), U(Sa([ + ce[0] + Gt[0] * le, + ce[1] + Gt[1] * le, + ce[2] + Gt[2] * le ])); - const Z = -1, fn = -1, ji = [ - [-ot, Z, -ot], - [ot, Z, -ot], - [ot, Z, ot], - [-ot, Z, ot] + const K = -1, Mn = -1, nr = [ + [-at, K, -at], + [at, K, -at], + [at, K, at], + [-at, K, at] ].map(G).map(U); - let dn = null; - if (Ra) { - const t = 1 + Math.max(0, Ec); - dn = [0, 1, 5, 4].map((i) => { - const r = qt[i]; - return [r[0] * t, Z, r[2] * t]; + let Cn = null; + if (Xt) { + const t = 1 + Math.max(0, Pc); + Cn = [0, 1, 5, 4].map((i) => { + const r = Zt[i]; + return [r[0] * t, K, r[2] * t]; }).map((i) => U(G(i))).map((i) => i[0] + "," + i[1]).join(" "); } - const uu = Math.min(...ji.map((t) => t[1])), qi = M(uu - 6, tt * 0.32, tt * 0.82); - this._skyClipBottom === void 0 || this._skyClipCardW !== J || this._skyClipCardH !== tt ? (this._skyClipBottom = qi, this._skyClipVertDeg = Ro, this._skyClipCardW = J, this._skyClipCardH = tt) : Math.abs(Ro - (this._skyClipVertDeg ?? Ro)) > 0.15 && (this._skyClipBottom = qi, this._skyClipVertDeg = Ro); - const Ze = Number(this._skyClipBottom), ko = [ - en[0] * qo, - en[1] * qo, - en[2] * qo - ], Yi = G(ko), it = U(Yi), fu = Ge.reduce((t, e) => t + e[2], 0) / Ge.length, du = Yi[2] > fu + 0.02, No = it[3], pu = Math.max(4, 12 * No), mu = Math.max(3, 8 * No), pn = M(ol - Ro / 90 * el, 0.1, 0.9), bu = M(pn - oi, 0, 1), gu = M(pn, 0, 1), yu = M(pn + oi, 0, 1), Zt = (t, e) => { + const _u = Math.min(...nr.map((t) => t[1])), ir = C(_u - 6, Q * 0.32, Q * 0.82); + this._skyClipBottom === void 0 || this._skyClipCardW !== Z || this._skyClipCardH !== Q ? (this._skyClipBottom = ir, this._skyClipVertDeg = ko, this._skyClipCardW = Z, this._skyClipCardH = Q) : Math.abs(ko - (this._skyClipVertDeg ?? ko)) > 0.15 && (this._skyClipBottom = ir, this._skyClipVertDeg = ko); + const ss = Number(this._skyClipBottom), Fo = [ + gn[0] * Jo, + gn[1] * Jo, + gn[2] * Jo + ], rr = G(Fo), rt = U(rr), yu = Ke.reduce((t, e) => t + e[2], 0) / Ke.length, $u = rr[2] > yu + 0.02, Ao = rt[3], vu = Math.max(4, 12 * Ao), Su = Math.max(3, 8 * Ao), kn = C(cl - ko / 90 * ll, 0.1, 0.9), xu = C(kn - fi, 0, 1), wu = C(kn, 0, 1), Ru = C(kn + fi, 0, 1), Qt = (t, e) => { const s = Array.isArray(t) ? t : e; return [ - M(Number((s == null ? void 0 : s[0]) ?? e[0]), 0, 255), - M(Number((s == null ? void 0 : s[1]) ?? e[1]), 0, 255), - M(Number((s == null ? void 0 : s[2]) ?? e[2]), 0, 255) + C(Number((s == null ? void 0 : s[0]) ?? e[0]), 0, 255), + C(Number((s == null ? void 0 : s[1]) ?? e[1]), 0, 255), + C(Number((s == null ? void 0 : s[2]) ?? e[2]), 0, 255) ]; - }, ne = (t, e, s) => [ + }, he = (t, e, s) => [ Math.round(t[0] + (e[0] - t[0]) * s), Math.round(t[1] + (e[1] - t[1]) * s), Math.round(t[2] + (e[2] - t[2]) * s) - ], Xi = Number(this._prevSunEl); - let ie = Number(this._skyTrend); - if (Number.isFinite(ie) || (ie = -1), Number.isFinite(Xi)) { - const t = et - Xi; - t < -0.03 ? ie = -1 : t > 0.03 && (ie = 1); - } - this._prevSunEl = et, this._skyTrend = ie; - const mn = ie < 0, re = Math.max(1, il), bn = M((et + re) / (2 * re), 0, 1), $u = M(1 - Math.abs(et) / re, 0, 1), gn = Math.pow($u, 0.85), Ke = M((-et + 1.5) / (re + 5), 0, 1), ua = Oe ? M((-et - 1.2) / (re + 3), 0, 1) : 0, uo = Ba ? M((-et + 0.2) / (re + 2), 0, 1) : 0, _u = M(yl, 0.05, 0.95), vu = M($l, 0.05, 0.95), Eo = _u * J, To = vu * tt, Vt = M(_l, 6, 44), Su = M(vl, 0, 1), ce = M(uo * Sl, 0, 1), wu = M(Ml, 0.5, 89.5), Zi = (Cl + 180) * Math.PI / 180, yn = wu * Math.PI / 180, xu = gt([ - Math.sin(Zi) * Math.cos(yn), - Math.sin(yn), - -Math.cos(Zi) * Math.cos(yn) + ], cr = Number(this._prevSunEl); + let ue = Number(this._skyTrend); + if (Number.isFinite(ue) || (ue = -1), Number.isFinite(cr)) { + const t = ot - cr; + t < -0.03 ? ue = -1 : t > 0.03 && (ue = 1); + } + this._prevSunEl = ot, this._skyTrend = ue; + const Nn = ue < 0, fe = Math.max(1, dl), En = C((ot + fe) / (2 * fe), 0, 1), Mu = C(1 - Math.abs(ot) / fe, 0, 1), Fn = Math.pow(Mu, 0.85), as = C((-ot + 1.5) / (fe + 5), 0, 1), Ca = qe ? C((-ot - 1.2) / (fe + 3), 0, 1) : 0, fo = Xa ? C((-ot + 0.2) / (fe + 2), 0, 1) : 0, Cu = C(Rl, 0.05, 0.95), ku = C(Ml, 0.05, 0.95), To = Cu * Z, Do = ku * Q, Ut = C(Cl, 6, 44), Nu = C(kl, 0, 1), de = C(fo * Nl, 0, 1), Eu = C(Tl, 0.5, 89.5), lr = (Dl + 180) * Math.PI / 180, An = Eu * Math.PI / 180, Fu = St([ + Math.sin(lr) * Math.cos(An), + Math.sin(An), + -Math.cos(lr) * Math.cos(An) ]); - let Ht = gt(Bi(xu)); - Ht[1] < 0.06 && (Ht = gt([Ht[0], 0.06, Ht[2]])); - const Ru = Zt(sl, [120, 170, 220]), Mu = Zt(al, [255, 210, 150]), Cu = Zt(nl, [70, 80, 95]), ku = Zt(rl, [12, 20, 42]), Nu = Zt(cl, [32, 44, 82]), Eu = Zt(ll, [6, 10, 22]), Tu = Zt(mn ? dl : hl, [108, 128, 188]), Fu = Zt(mn ? pl : ul, [246, 146, 112]), Au = Zt(mn ? ml : fl, [84, 62, 84]), Du = ne(ku, Ru, bn), Bu = ne(Nu, Mu, bn), Pu = ne(Eu, Cu, bn), $n = ne(Du, Tu, gn * 0.82), zu = ne(Bu, Fu, gn * 0.95), Ki = ne(Pu, Au, gn * 0.68), St = ot * (1 - 0.05), fa = 64; - let le = this._ringUnit; - (!le || le.length !== fa) && (le = Array.from({ length: fa }, (t, e) => { - const s = e / fa * Xh; + let jt = St(Yi(Fu)); + jt[1] < 0.06 && (jt = St([jt[0], 0.06, jt[2]])); + const Au = Qt(hl, [120, 170, 220]), Tu = Qt(ul, [255, 210, 150]), Du = Qt(fl, [70, 80, 95]), Bu = Qt(pl, [12, 20, 42]), zu = Qt(ml, [32, 44, 82]), Pu = Qt(bl, [6, 10, 22]), Lu = Qt(Nn ? $l : gl, [108, 128, 188]), Wu = Qt(Nn ? vl : _l, [246, 146, 112]), Ou = Qt(Nn ? Sl : yl, [84, 62, 84]), Iu = he(Bu, Au, En), Vu = he(zu, Tu, En), Hu = he(Pu, Du, En), Tn = he(Iu, Lu, Fn * 0.82), Gu = he(Vu, Wu, Fn * 0.95), hr = he(Hu, Ou, Fn * 0.68), Et = at * (1 - 0.05), ka = 64; + let pe = this._ringUnit; + (!pe || pe.length !== ka) && (pe = Array.from({ length: ka }, (t, e) => { + const s = e / ka * eu; return [Math.sin(s), Math.cos(s)]; - }), this._ringUnit = le); - const Ji = Math.min(Ll, St * 0.3), Qi = St - Ji, Lu = St + Ji; - function _n(t) { - return le.map(([e, s]) => { - const n = G([t * e, Z, t * s]), i = U(n); + }), this._ringUnit = pe); + const ur = Math.min(Ul, Et * 0.3), fr = Et - ur, Uu = Et + ur; + function Dn(t) { + return pe.map(([e, s]) => { + const n = G([t * e, K, t * s]), i = U(n); return i[0] + "," + i[1]; }); } - const Wu = _n(Qi), Ou = _n(St), Iu = _n(Lu); - let tr = []; - ri && (tr = le.map(([t, e], s) => { - const n = s % (fa / 4) === 0, i = n ? Gl : Hl, r = Qi, h = r - i, u = U(G([h * t, Z, h * e])), d = U(G([r * t, Z, r * e])); + const ju = Dn(fr), qu = Dn(Et), Yu = Dn(Uu); + let dr = []; + _i && (dr = pe.map(([t, e], s) => { + const n = s % (ka / 4) === 0, i = n ? Kl : Zl, r = fr, h = r - i, u = U(G([h * t, K, h * e])), d = U(G([r * t, K, r * e])); return { pIn: u, pOut: d, isMajor: n }; })); - const Vu = [["N", 0], ["E", Math.PI / 2], ["S", Math.PI], ["W", 3 * Math.PI / 2]], or = St * (1 - jl), Hu = Vu.map(([t, e]) => { - const s = G([or * Math.sin(e), Z, or * Math.cos(e)]), n = U(s), i = M(n[3] * ql, Yl, Xl); + const Xu = [["N", 0], ["E", Math.PI / 2], ["S", Math.PI], ["W", 3 * Math.PI / 2]], pr = Et * (1 - Ql), Zu = Xu.map(([t, e]) => { + const s = G([pr * Math.sin(e), K, pr * Math.cos(e)]), n = U(s), i = C(n[3] * th, oh, eh); return { t, x: n[0], y: n[1], scale: i }; - }), fo = gt([Math.sin(te), 0, Math.cos(te)]), da = gt([Ht[0], 0, Ht[2]]), Gu = G([fo[0] * St * 0.25, Z, fo[2] * St * 0.25]), Uu = G([fo[0] * St * 0.95, Z, fo[2] * St * 0.95]), Fo = U(Gu), Ao = U(Uu), ju = M(Fo[3] * ci, li, hi), vn = M(Ao[3] * ci, li, hi), qu = ui * ju, Yu = ui * vn, Do = Kl * vn, er = [ - { id: "front", label: "Front", normal: [0, 0, 1], pos: [0, Z, 1 + qs] }, - { id: "back", label: "Back", normal: [0, 0, -1], pos: [0, Z, -1 - qs] }, - { id: "right", label: "Right", normal: [1, 0, 0], pos: [1 + qs, Z, 0] }, - { id: "left", label: "Left", normal: [-1, 0, 0], pos: [-1 - qs, Z, 0] } - ], Sn = {}, wn = {}; - er.forEach((t) => { - const e = G(ft(t.normal)); - Sn[t.id] = e[2] < di; - const s = sn[t.id]; + }), po = St([Math.sin(ne), 0, Math.cos(ne)]), Na = St([jt[0], 0, jt[2]]), Ku = G([po[0] * Et * 0.25, K, po[2] * Et * 0.25]), Ju = G([po[0] * Et * 0.95, K, po[2] * Et * 0.95]), Bo = U(Ku), zo = U(Ju), Qu = C(Bo[3] * yi, $i, vi), Bn = C(zo[3] * yi, $i, vi), tf = Si * Qu, of = Si * Bn, Po = ah * Bn, mr = [ + { id: "front", label: "Front", normal: [0, 0, 1], pos: [0, K, 1 + la] }, + { id: "back", label: "Back", normal: [0, 0, -1], pos: [0, K, -1 - la] }, + { id: "right", label: "Right", normal: [1, 0, 0], pos: [1 + la, K, 0] }, + { id: "left", label: "Left", normal: [-1, 0, 0], pos: [-1 - la, K, 0] } + ], zn = {}, Pn = {}; + mr.forEach((t) => { + const e = G(bt(t.normal)); + zn[t.id] = e[2] < wi; + const s = _n[t.id]; if (s) { - const n = s.indices.map((r) => Yt[r]), i = Math.abs(Qa(n)); - wn[t.id] = e[2] < ch && i > lh; + const n = s.indices.map((r) => Kt[r]), i = Math.abs(pn(n)); + Pn[t.id] = e[2] < mh && i > bh; } else - wn[t.id] = Sn[t.id]; + Pn[t.id] = zn[t.id]; }); - let Je = null; - const xn = Math.max(0.1, kl), sr = M((et + xn) / (2 * xn), 0, 1), Rn = Ot[1] > 0.01 ? Ot : gt([Ot[0], 0.01, Ot[2]]), Xu = et > -xn ? 1 : 0, Zu = Ie && uo > 0.03 && Ht[1] > 0.01 ? 1 : 0, ar = sr * Xu, nr = (1 - sr) * Zu, pa = ar + nr, Qe = pa > 1e-6 ? ar / pa : 0, he = pa > 1e-6 ? nr / pa : 0, Mn = Qe > 0 || he > 0 ? gt([ - Rn[0] * Qe + Ht[0] * he, - Rn[1] * Qe + Ht[1] * he, - Rn[2] * Qe + Ht[2] * he - ]) : Ot; - if (xa && (Qe > 0 || he > 0)) { - const t = [-Mn[0], -Mn[1], -Mn[2]]; + let ns = null; + const Ln = Math.max(0.1, Bl), br = C((ot + Ln) / (2 * Ln), 0, 1), Wn = Ht[1] > 0.01 ? Ht : St([Ht[0], 0.01, Ht[2]]), ef = ot > -Ln ? 1 : 0, sf = Ye && fo > 0.03 && jt[1] > 0.01 ? 1 : 0, gr = br * ef, _r = (1 - br) * sf, Ea = gr + _r, is = Ea > 1e-6 ? gr / Ea : 0, me = Ea > 1e-6 ? _r / Ea : 0, On = is > 0 || me > 0 ? St([ + Wn[0] * is + jt[0] * me, + Wn[1] * is + jt[1] * me, + Wn[2] * is + jt[2] * me + ]) : Ht; + if (se && (is > 0 || me > 0)) { + const t = [-On[0], -On[1], -On[2]]; if (Math.abs(t[1]) > 1e-6) { - const e = [], s = Co ? qt.concat(qe) : qt; + const e = [], s = Eo ? Zt.concat(ts) : Zt; for (const i of s) { - const r = (fn - i[1]) / t[1]; + const r = (Mn - i[1]) / t[1]; r >= 0 && e.push({ x: i[0] + t[0] * r, z: i[2] + t[2] * r }); } - const n = Oi(e); + const n = Qi(e); if (n.length >= 3) { - const i = M(Zn, 0, 0.2), r = ot * (1 - i), h = ou(n, -r, r, -r, r); - h.length >= 3 && (Je = h.map((u) => U(G([u.x, fn, u.z])))); + const i = C(X, 0, 0.2), r = at * (1 - i), h = cu(n, -r, r, -r, r); + h.length >= 3 && (ns = h.map((u) => U(G([u.x, Mn, u.z])))); } } } - const ir = Je ? Je.map((t) => t[0] + "," + t[1]).join(" ") : null; - let ts = null, os = null; - if (Ma && vt) { - const e = Math.hypot(ot * 2, ot * 2) * Fc, s = [fo[0] * St * 0.95, Z, fo[2] * St * 0.95], n = [ - s[0] - fo[0] * e, - Z, - s[2] - fo[2] * e + const yr = ns ? ns.map((t) => t[0] + "," + t[1]).join(" ") : null; + let rs = null, cs = null; + if (Oa && Nt) { + const e = Math.hypot(at * 2, at * 2) * Wc, s = [po[0] * Et * 0.95, K, po[2] * Et * 0.95], n = [ + s[0] - po[0] * e, + K, + s[2] - po[2] * e ], i = G(s), r = G(n); - ts = U(i), os = U(r); - } - let es = null, ss = null; - if (Ie && !vt && uo > 0.03) { - const e = Math.hypot(ot * 2, ot * 2) * xl, s = [da[0] * St * 0.9, Z, da[2] * St * 0.9], n = [ - s[0] - da[0] * e, - Z, - s[2] - da[2] * e + rs = U(i), cs = U(r); + } + let ls = null, hs = null; + if (Ye && !Nt && fo > 0.03) { + const e = Math.hypot(at * 2, at * 2) * Fl, s = [Na[0] * Et * 0.9, K, Na[2] * Et * 0.9], n = [ + s[0] - Na[0] * e, + K, + s[2] - Na[2] * e ]; - es = U(G(s)), ss = U(G(n)); + ls = U(G(s)), hs = U(G(n)); } - const rr = `sv-beam-flow-${Math.round((Na + Ea) * 10)}`, cr = `sv-sun-ray-${Math.round((Ta + Fa) * 10)}`, lr = `sv-cloud-drift-${Math.round(J)}-${Math.round(tt)}`, Ku = Number(o.sunBeamRaySpacingPx ?? 40), Ju = Number(o.sunBeamRayMinSepPx ?? 16), Qu = Number(o.sunBeamSilhouetteMinRays ?? 3), tf = Number(o.sunBeamSilhouetteMaxRays ?? 7), hr = Co ? qt.concat(qe) : qt, ur = hr.map((t, e) => { + const $r = `sv-beam-flow-${Math.round((Ha + Ga) * 10)}`, vr = `sv-sun-ray-${Math.round((Ua + ja) * 10)}`, Sr = `sv-cloud-drift-${Math.round(Z)}-${Math.round(Q)}`, af = Number(o.sunBeamRaySpacingPx ?? 40), nf = Number(o.sunBeamRayMinSepPx ?? 16), rf = Number(o.sunBeamSilhouetteMinRays ?? 3), cf = Number(o.sunBeamSilhouetteMaxRays ?? 7), xr = Eo ? Zt.concat(ts) : Zt, wr = xr.map((t, e) => { const s = G(t), n = U(s); return { sourceIdx: e, x: n[0], y: n[1], zCam: s[2], world: t }; - }), yt = eu( - ur - ), ue = [], ma = (t, e, s, n = -1, i = [0, 0, 0]) => { - const r = Math.max(1, Ju) ** 2; - for (const h of ue) { + }), xt = lu( + wr + ), be = [], Fa = (t, e, s, n = -1, i = [0, 0, 0]) => { + const r = Math.max(1, nf) ** 2; + for (const h of be) { const u = h.x - t, d = h.y - e; if (u * u + d * d < r) return; } - ue.push({ x: t, y: e, zCam: s, sourceIdx: n, world: i }); + be.push({ x: t, y: e, zCam: s, sourceIdx: n, world: i }); }; - if (yt.length >= 2) { + if (xt.length >= 2) { let t = 0; - for (let s = 0; s < yt.length; s++) { - const n = (s + 1) % yt.length; - t += yt[s].x * yt[n].y - yt[n].x * yt[s].y; + for (let s = 0; s < xt.length; s++) { + const n = (s + 1) % xt.length; + t += xt[s].x * xt[n].y - xt[n].x * xt[s].y; } const e = t > 0; - for (let s = 0; s < yt.length; s++) { - const n = yt[s], i = yt[(s + 1) % yt.length], r = i.x - n.x, h = i.y - n.y, u = Math.hypot(r, h); + for (let s = 0; s < xt.length; s++) { + const n = xt[s], i = xt[(s + 1) % xt.length], r = i.x - n.x, h = i.y - n.y, u = Math.hypot(r, h); if (u < 1e-3) continue; const d = (n.x + i.x) * 0.5, f = (n.y + i.y) * 0.5; let p = e ? h : -h, m = e ? -r : r; const b = Math.hypot(p, m) || 1; p /= b, m /= b; - const g = it[0] - d, y = it[1] - f; - if (!(p * g + m * y > 0)) continue; - ma(n.x, n.y, n.zCam, n.sourceIdx, n.world), ma(i.x, i.y, i.zCam, i.sourceIdx, i.world); - const E = Math.max(8, Ku), T = Math.max(1, Math.min(4, Math.round(u / E))); - for (let B = 0; B < T; B++) { - const z = (B + 1) / (T + 1), I = [ - n.world[0] + (i.world[0] - n.world[0]) * z, - n.world[1] + (i.world[1] - n.world[1]) * z, - n.world[2] + (i.world[2] - n.world[2]) * z - ], C = G(I), _ = U(C); - ma(_[0], _[1], C[2], -1, I); + const g = rt[0] - d, _ = rt[1] - f; + if (!(p * g + m * _ > 0)) continue; + Fa(n.x, n.y, n.zCam, n.sourceIdx, n.world), Fa(i.x, i.y, i.zCam, i.sourceIdx, i.world); + const A = Math.max(8, af), T = Math.max(1, Math.min(4, Math.round(u / A))); + for (let P = 0; P < T; P++) { + const W = (P + 1) / (T + 1), V = [ + n.world[0] + (i.world[0] - n.world[0]) * W, + n.world[1] + (i.world[1] - n.world[1]) * W, + n.world[2] + (i.world[2] - n.world[2]) * W + ], N = G(V), v = U(N); + Fa(v[0], v[1], N[2], -1, V); } } } - !ue.length && yt.length && yt.forEach((t) => ma(t.x, t.y, t.zCam, t.sourceIdx, t.world)), ue.length > 1 && ue.sort((t, e) => { - const s = Math.atan2(t.y - it[1], t.x - it[0]), n = Math.atan2(e.y - it[1], e.x - it[0]); + !be.length && xt.length && xt.forEach((t) => Fa(t.x, t.y, t.zCam, t.sourceIdx, t.world)), be.length > 1 && be.sort((t, e) => { + const s = Math.atan2(t.y - rt[1], t.x - rt[0]), n = Math.atan2(e.y - rt[1], e.x - rt[0]); return s - n; }); - const fr = (t, e) => { + const Rr = (t, e) => { if (t.length <= e) return t.slice(); if (e <= 1) return [t[Math.floor(t.length / 2)]]; const s = []; @@ -1902,182 +1972,182 @@ const qn = class qn extends be { s.push(t[i]); } return s; - }, as = Math.max(1, Math.floor(Qu)), dr = Math.max(as, Math.floor(tf)); - let Dt = ue.slice(); - if (Dt.length > dr && (Dt = fr(Dt, dr)), Dt.length < as) { - const t = yt.map((e) => ({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world })); - if (t.length >= as) - Dt = fr(t, as); + }, us = Math.max(1, Math.floor(rf)), Mr = Math.max(us, Math.floor(cf)); + let Ot = be.slice(); + if (Ot.length > Mr && (Ot = Rr(Ot, Mr)), Ot.length < us) { + const t = xt.map((e) => ({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world })); + if (t.length >= us) + Ot = Rr(t, us); else if (t.length > 0) - for (; Dt.length < as; ) { - const e = t[Dt.length % t.length]; - Dt.push({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world }); + for (; Ot.length < us; ) { + const e = t[Ot.length % t.length]; + Ot.push({ x: e.x, y: e.y, zCam: e.zCam, sourceIdx: e.sourceIdx, world: e.world }); } } - Dt.length || [2, 3, 6, 7].forEach((t) => { - const e = Yt[t], s = Ge[t]; - Dt.push({ x: e[0], y: e[1], zCam: s[2], sourceIdx: t, world: qt[t] }); + Ot.length || [2, 3, 6, 7].forEach((t) => { + const e = Kt[t], s = Ke[t]; + Ot.push({ x: e[0], y: e[1], zCam: s[2], sourceIdx: t, world: Zt[t] }); }); - const Cn = /* @__PURE__ */ new Set(); - if (vt) { - const t = [-Ot[0], -Ot[1], -Ot[2]]; + const In = /* @__PURE__ */ new Set(); + if (Nt) { + const t = [-Ht[0], -Ht[1], -Ht[2]]; if (Math.abs(t[1]) > 1e-6) { - const e = hr.map((s, n) => { - const i = (fn - s[1]) / t[1]; + const e = xr.map((s, n) => { + const i = (Mn - s[1]) / t[1]; return i < 0 ? null : { sourceIdx: n, x: s[0] + t[0] * i, z: s[2] + t[2] * i }; }).filter((s) => !!s); if (e.length >= 3) { - const s = Oi(e.map((i) => ({ x: i.x, z: i.z }))), n = 1e-4; + const s = Qi(e.map((i) => ({ x: i.x, z: i.z }))), n = 1e-4; e.forEach((i) => { - s.some((r) => Math.abs(r.x - i.x) <= n && Math.abs(r.z - i.z) <= n) && Cn.add(i.sourceIdx); + s.some((r) => Math.abs(r.x - i.x) <= n && Math.abs(r.z - i.z) <= n) && In.add(i.sourceIdx); }); } } } - const pr = ((t) => { + const Cr = ((t) => { const e = [], s = /* @__PURE__ */ new Set(); return t.forEach((n) => { const i = `${Math.round(n.x)},${Math.round(n.y)}`; s.has(i) || (s.add(i), e.push(n)); }), e; })( - ur.filter((t) => Cn.has(t.sourceIdx)).map((t) => ({ x: t.x, y: t.y, zCam: t.zCam, sourceIdx: t.sourceIdx, world: t.world })) - ), kn = pr.length ? pr : Dt, Nn = /* @__PURE__ */ new Map(), mr = (t, e, s, n, i) => { + wr.filter((t) => In.has(t.sourceIdx)).map((t) => ({ x: t.x, y: t.y, zCam: t.zCam, sourceIdx: t.sourceIdx, world: t.world })) + ), Vn = Cr.length ? Cr : Ot, Hn = /* @__PURE__ */ new Map(), kr = (t, e, s, n, i) => { const r = `${Math.round(e)},${Math.round(s)}`; - Nn.has(r) || Nn.set(r, { x: e, y: s, zCam: n, sourceIdx: t, world: i }); + Hn.has(r) || Hn.set(r, { x: e, y: s, zCam: n, sourceIdx: t, world: i }); }; - Object.entries(sn).forEach(([t, e]) => { - G(ft(Vi[t]))[2] >= di || e.indices.forEach((n) => { - mr(n, Yt[n][0], Yt[n][1], Ge[n][2], qt[n]); + Object.entries(_n).forEach(([t, e]) => { + G(bt(or[t]))[2] >= wi || e.indices.forEach((n) => { + kr(n, Kt[n][0], Kt[n][1], Ke[n][2], Zt[n]); }); - }), ho && ca.forEach((t, e) => { - const s = qt.length + e; - mr(s, t[0], t[1], Hi[e][2], qe[e]); + }), uo && wa.forEach((t, e) => { + const s = Zt.length + e; + kr(s, t[0], t[1], er[e][2], ts[e]); }); - let En = Array.from(Nn.values()).filter( - (t) => Cn.has(t.sourceIdx) + let Gn = Array.from(Hn.values()).filter( + (t) => In.has(t.sourceIdx) ); - if (!En.length && kn.length) { - const t = kn.slice().sort((e, s) => e.zCam - s.zCam); - En = t.slice(0, Math.min(3, t.length)); + if (!Gn.length && Vn.length) { + const t = Vn.slice().sort((e, s) => e.zCam - s.zCam); + Gn = t.slice(0, Math.min(3, t.length)); } - function of(t, e) { + function lf(t, e) { const s = t.length; if (s < 3) return ""; let n = ""; for (let i = 0; i < s; i++) { const r = t[(i - 1 + s) % s], h = t[i], u = t[(i + 1) % s], d = [r[0] - h[0], r[1] - h[1]], f = [u[0] - h[0], u[1] - h[1]], p = Math.hypot(d[0], d[1]), m = Math.hypot(f[0], f[1]); if (p === 0 || m === 0) continue; - const b = Math.min(e, p / 2, m / 2), g = [d[0] / p, d[1] / p], y = [f[0] / m, f[1] / m], x = [h[0] + g[0] * b, h[1] + g[1] * b], E = [h[0] + y[0] * b, h[1] + y[1] * b]; - i === 0 ? n += `M ${x[0]} ${x[1]}` : n += ` L ${x[0]} ${x[1]}`, n += ` Q ${h[0]} ${h[1]} ${E[0]} ${E[1]}`; + const b = Math.min(e, p / 2, m / 2), g = [d[0] / p, d[1] / p], _ = [f[0] / m, f[1] / m], R = [h[0] + g[0] * b, h[1] + g[1] * b], A = [h[0] + _[0] * b, h[1] + _[1] * b]; + i === 0 ? n += `M ${R[0]} ${R[1]}` : n += ` L ${R[0]} ${R[1]}`, n += ` Q ${h[0]} ${h[1]} ${A[0]} ${A[1]}`; } return n + " Z"; } - const fe = ji.map((t) => [t[0], t[1]]), ba = of(fe, Ho); - function ef(t, e, s = 8) { + const ge = nr.map((t) => [t[0], t[1]]), Aa = lf(ge, eo); + function hf(t, e, s = 8) { const n = t.length; if (n < 3) return t.slice(); const i = []; for (let r = 0; r < n; r++) { const h = t[(r - 1 + n) % n], u = t[r], d = t[(r + 1) % n], f = [h[0] - u[0], h[1] - u[1]], p = [d[0] - u[0], d[1] - u[1]], m = Math.hypot(f[0], f[1]), b = Math.hypot(p[0], p[1]); if (m === 0 || b === 0) continue; - const g = Math.min(e, m / 2, b / 2), y = [f[0] / m, f[1] / m], x = [p[0] / b, p[1] / b], E = [u[0] + y[0] * g, u[1] + y[1] * g], T = [u[0] + x[0] * g, u[1] + x[1] * g]; - i.length, i.push(E); - for (let B = 1; B <= s; B++) { - const z = B / s, I = 1 - z; + const g = Math.min(e, m / 2, b / 2), _ = [f[0] / m, f[1] / m], R = [p[0] / b, p[1] / b], A = [u[0] + _[0] * g, u[1] + _[1] * g], T = [u[0] + R[0] * g, u[1] + R[1] * g]; + i.length, i.push(A); + for (let P = 1; P <= s; P++) { + const W = P / s, V = 1 - W; i.push([ - I * I * E[0] + 2 * I * z * u[0] + z * z * T[0], - I * I * E[1] + 2 * I * z * u[1] + z * z * T[1] + V * V * A[0] + 2 * V * W * u[0] + W * W * T[0], + V * V * A[1] + 2 * V * W * u[1] + W * W * T[1] ]); } } return i; } - const ns = ef(fe, Ho, 8), br = ns.map((t) => [t[0], t[1] + go]), gr = []; - for (let t = 0; t < ns.length; t++) { - const e = (t + 1) % ns.length; - gr.push([ - ns[t], - ns[e], - br[e], - br[t] + const fs = hf(ge, eo, 8), Nr = fs.map((t) => [t[0], t[1] + qo]), Er = []; + for (let t = 0; t < fs.length; t++) { + const e = (t + 1) % fs.length; + Er.push([ + fs[t], + fs[e], + Nr[e], + Nr[t] ]); } - const Tn = M(Zn, 0, 0.2), ga = fe.reduce((t, e) => [t[0] + e[0], t[1] + e[1]], [0, 0]).map((t) => t / fe.length), sf = Tn > 0 ? fe.map((t) => [ - ga[0] + (t[0] - ga[0]) * (1 - Tn), - ga[1] + (t[1] - ga[1]) * (1 - Tn) - ]) : fe, dt = []; - if (ti && dt.push(` - - - - - - `), (We || Oe && ua > 0.01 || Ba && uo > 0.03) && dt.push(``), We && dt.push(` - - `), dt.push(` + const Un = C(X, 0, 0.2), Ta = ge.reduce((t, e) => [t[0] + e[0], t[1] + e[1]], [0, 0]).map((t) => t / ge.length), uf = Un > 0 ? ge.map((t) => [ + Ta[0] + (t[0] - Ta[0]) * (1 - Un), + Ta[1] + (t[1] - Ta[1]) * (1 - Un) + ]) : ge, gt = []; + if (ui && gt.push(` + + + + + + `), (je || qe && Ca > 0.01 || Xa && fo > 0.03) && gt.push(``), je && gt.push(` + + `), gt.push(` - `), dt.push(` - - - `), yo && mt > 1e-3 && dt.push(` - - - - `), xa && ir && (dt.push(` - - `), dt.push(` - - `)), Ra && dt.push(` - - `), fi && dt.push(` - - `), Le && dt.push(` - - `), Ma && vt && ts && os && dt.push(` - - - - `), Ie && !vt && es && ss) { - const t = Array.isArray(js) ? js : [178, 208, 255], e = M(wl * uo, 0, 1); - dt.push(` + `), gt.push(` + + + `), yo && Mt > 1e-3 && gt.push(` + + + + `), se && yr && (gt.push(` + + `), gt.push(` + + `)), Xt && gt.push(` + + `), xi && gt.push(` + + `), He && gt.push(` + + `), Oa && Nt && rs && cs && gt.push(` + + + + `), Ye && !Nt && ls && hs) { + const t = Array.isArray(ca) ? ca : [178, 208, 255], e = C(El * fo, 0, 1); + gt.push(` `); } - ei && dt.push(` - - - + di && gt.push(` + + + `); - const Bo = []; - if (ka && vt && Bo.push(` - @keyframes ${rr} { + const Lo = []; + if (Va && Nt && Lo.push(` + @keyframes ${$r} { from { stroke-dashoffset: 0; } - to { stroke-dashoffset: -${Na + Ea}; } + to { stroke-dashoffset: -${Ha + Ga}; } } .sv-beam-flow { - animation-name: ${rr}; + animation-name: ${$r}; animation-timing-function: linear; animation-iteration-count: infinite; } .sv-css-limit .sv-beam-flow { animation-timing-function: steps(var(--sv-steps, 1), end); } - `), We) { - const e = J + 140; - Bo.push(` - @keyframes ${lr} { + `), je) { + const e = Z + 140; + Lo.push(` + @keyframes ${Sr} { 0% { transform: translateX(-140px); } 100% { transform: translateX(${e}px); } } .sv-sky-cloud { - animation-name: ${lr}; + animation-name: ${Sr}; animation-timing-function: linear; animation-iteration-count: infinite; will-change: transform; @@ -2087,13 +2157,13 @@ const qn = class qn extends be { } `); } - Ya && Bo.push(` - @keyframes ${cr} { + ln && Lo.push(` + @keyframes ${vr} { 0%, 100% { transform: scaleX(var(--ray-min-scale, 0.45)); } 50% { transform: scaleX(var(--ray-max-scale, 1.0)); } } .sv-sun-ray { - animation-name: ${cr}; + animation-name: ${vr}; animation-timing-function: ease-in-out; animation-iteration-count: infinite; transform-origin: 0px 0px; @@ -2103,21 +2173,21 @@ const qn = class qn extends be { animation-timing-function: steps(var(--sv-steps, 1), end); } `); - const yr = `sv-star-twinkle-${Math.round(J)}-${Math.round(tt)}`; - Oe && Xa && Bo.push(` - @keyframes ${yr} { + const Fr = `sv-star-twinkle-${Math.round(Z)}-${Math.round(Q)}`; + qe && hn && Lo.push(` + @keyframes ${Fr} { 0%, 100% { opacity: calc(var(--star-op, 0.7) * 0.22); } 50% { opacity: var(--star-op, 0.7); } } .sv-star { - animation-name: ${yr}; + animation-name: ${Fr}; animation-timing-function: ease-in-out; animation-iteration-count: infinite; } .sv-css-limit .sv-star { animation-timing-function: steps(var(--sv-steps, 1), end); } - `), (ka || We || Ya || Oe && Xa) && Bo.push(` + `), (Va || je || ln || qe && hn) && Lo.push(` .sv-css-global .sv-beam-flow, .sv-css-global .sv-sun-ray, .sv-css-global .sv-sky-cloud, @@ -2131,20 +2201,20 @@ const qn = class qn extends be { .sv-css-pause .sv-star { animation-play-state: paused !important; } - `), Bo.length && dt.push(``); - const $ = [], af = `${ut ? "sv-css-limit sv-css-global " : ""}${qh ? "sv-css-pause " : ""}sv-scene`.trim(), nf = Number(this._cssGlobalTimeSec || 0); - if ($.push(`${dt.join("")}`), ti && $.push(``), Oe && ua > 0.01 && Us > 0) { + const y = [], ff = `${ut ? "sv-css-limit sv-css-global " : ""}${tu ? "sv-css-pause " : ""}sv-scene`.trim(), df = Number(this._cssGlobalTimeSec || 0); + if (y.push(`${gt.join("")}`), ui && y.push(``), qe && Ca > 0.01 && ra > 0) { let t = this._skyStars; - if (!Array.isArray(t) || t.length !== Us) { - let s = 2166136261 ^ Math.round(J * 13 + tt * 17 + Us * 31); + if (!Array.isArray(t) || t.length !== ra) { + let s = 2166136261 ^ Math.round(Z * 13 + Q * 17 + ra * 31); const n = () => (s ^= s << 13, s >>>= 0, s ^= s >> 17, s >>>= 0, s ^= s << 5, s >>>= 0, (s >>> 0) / 4294967295); - t = Array.from({ length: Us }, () => ({ + t = Array.from({ length: ra }, () => ({ x: 0.04 + n() * 0.92, y: 0.06 + n() * 0.86, r: 0.55 + n() * 1.25, @@ -2153,289 +2223,289 @@ const qn = class qn extends be { phase: n() * 2.2 })), this._skyStars = t; } - const e = Ze * 0.97; - $.push(''), t.forEach((s) => { - const n = s.x * J, i = s.y * e, r = s.r * (0.85 + ua * 0.35), h = M(ua * gl * s.a, 0, 1); - if (Xa) { - const u = Math.max(1.2, Number(s.dur)), d = Number(s.phase) || 0, f = ut ? Ks(u, d) : Zs(u, d), p = ut ? Math.max(1, Math.round(u * co)) : 0; - $.push(`'), t.forEach((s) => { + const n = s.x * Z, i = s.y * e, r = s.r * (0.85 + Ca * 0.35), h = C(Ca * wl * s.a, 0, 1); + if (hn) { + const u = Math.max(1.2, Number(s.dur)), d = Number(s.phase) || 0, f = ut ? da(u, d) : fa(u, d), p = ut ? Math.max(1, Math.round(u * lo)) : 0; + y.push(``); } else - $.push(``); - }), $.push(""); - } - if (Ba && uo > 0.03) { - const t = Vt * (Su * 2), e = `rgb(${$n.join(",")})`, s = `moon-disc-clip-${Math.round(Eo)}-${Math.round(To)}-${Math.round(Vt)}`; - $.push(``), $.push(``), $.push(``), $.push(``), $.push(``); - const n = Eo - Vt * 0.34, i = To + Vt * 0.3, r = Vt * 0.24; - $.push(``), $.push(``), $.push(""), $.push(``); - } - if (We) { - const t = M(Yc, 0, 1), e = [0.3, 0.42, 0.24], s = [0.46, 0.6, 0.38], n = [ - { y: Ze * (e[0] + (s[0] - e[0]) * t), s: 0.76 * Aa, dur: 38 / Math.max(0.2, Da), phase: 0.12 }, - { y: Ze * (e[1] + (s[1] - e[1]) * t), s: 1 * Aa, dur: 56 / Math.max(0.2, Da), phase: 0.48 }, - { y: Ze * (e[2] + (s[2] - e[2]) * t), s: 0.66 * Aa, dur: 76 / Math.max(0.2, Da), phase: 0.78 } + y.push(``); + }), y.push(""); + } + if (Xa && fo > 0.03) { + const t = Ut * (Nu * 2), e = `rgb(${Tn.join(",")})`, s = `moon-disc-clip-${Math.round(To)}-${Math.round(Do)}-${Math.round(Ut)}`; + y.push(``), y.push(``), y.push(``), y.push(``), y.push(``); + const n = To - Ut * 0.34, i = Do + Ut * 0.3, r = Ut * 0.24; + y.push(``), y.push(``), y.push(""), y.push(``); + } + if (je) { + const t = C(ol, 0, 1), e = [0.3, 0.42, 0.24], s = [0.46, 0.6, 0.38], n = [ + { y: ss * (e[0] + (s[0] - e[0]) * t), s: 0.76 * qa, dur: 38 / Math.max(0.2, Ya), phase: 0.12 }, + { y: ss * (e[1] + (s[1] - e[1]) * t), s: 1 * qa, dur: 56 / Math.max(0.2, Ya), phase: 0.48 }, + { y: ss * (e[2] + (s[2] - e[2]) * t), s: 0.66 * qa, dur: 76 / Math.max(0.2, Ya), phase: 0.78 } ]; - $.push(''), n.forEach((i) => { - const r = 1 - 0.35 * Ke, h = M(Qn * r, 0, 1), u = M(Qn * 0.75 * r, 0, 1); + y.push(''), n.forEach((i) => { + const r = 1 - 0.35 * as, h = C(hi * r, 0, 1), u = C(hi * 0.75 * r, 0, 1); [-(i.phase * i.dur), -((i.phase + 0.5) * i.dur)].forEach((f) => { - $.push(``); - const p = Qs ? 6 : ut ? 3 : 1, m = i.dur * p, b = ut ? Math.max(1, Math.round(m * co)) : 0, g = -f, y = ut ? Ks(m, g) : Zs(m, g); - $.push(``), $.push(''), $.push(``), $.push(``), $.push(``), $.push(``), $.push(""), $.push(""), $.push(""); + y.push(``); + const p = ma ? 6 : ut ? 3 : 1, m = i.dur * p, b = ut ? Math.max(1, Math.round(m * lo)) : 0, g = -f, _ = ut ? da(m, g) : fa(m, g); + y.push(``), y.push(''), y.push(``), y.push(``), y.push(``), y.push(``), y.push(""), y.push(""), y.push(""); }); - }), $.push(""); + }), y.push(""); } - const rf = () => { - const t = Ao[0] - Fo[0], e = Ao[1] - Fo[1], s = Math.hypot(t, e); + const pf = () => { + const t = zo[0] - Bo[0], e = zo[1] - Bo[1], s = Math.hypot(t, e); if (s <= 1e-3) return; - const n = -e / s, i = t / s, r = t / s, h = e / s, u = Ao[0] - r * Do, d = Ao[1] - h * Do, f = [u + n * Do * 0.62, d + i * Do * 0.62], p = [u - n * Do * 0.62, d - i * Do * 0.62], m = Math.max(0.8, qu * 0.55 + Yu * 0.75), b = [ - [Ao[0], Ao[1]], + const n = -e / s, i = t / s, r = t / s, h = e / s, u = zo[0] - r * Po, d = zo[1] - h * Po, f = [u + n * Po * 0.62, d + i * Po * 0.62], p = [u - n * Po * 0.62, d - i * Po * 0.62], m = Math.max(0.8, tf * 0.55 + of * 0.75), b = [ + [zo[0], zo[1]], [p[0], p[1]], [f[0], f[1]] - ], g = b.map((x) => `${x[0]},${x[1]}`).join(" "), y = Math.max(1.1, Do * 0.16); - if (fi) { - const x = Ql * vn, E = x * 0.55, T = x * 0.75, z = b.map((I) => [I[0] + E, I[1] + T]).map((I) => `${I[0]},${I[1]}`).join(" "); - $.push(``), $.push(``); + ], g = b.map((R) => `${R[0]},${R[1]}`).join(" "), _ = Math.max(1.1, Po * 0.16); + if (xi) { + const R = ih * Bn, A = R * 0.55, T = R * 0.75, W = b.map((V) => [V[0] + A, V[1] + T]).map((V) => `${V[0]},${V[1]}`).join(" "); + y.push(``), y.push(``); } - $.push(``), $.push(``); - }, cf = () => { - if (!X) return; - const t = M(Gs, 0.8, 1.9), e = Math.max(0.08, Hs), s = 1 + Sc, n = s + e, i = Z + 5e-4, r = (g) => U(G(ft(g))), h = r([-t / 2, i, s]), u = r([t / 2, i, s]), d = r([t / 2, i, n]), f = r([-t / 2, i, n]); - $.push(``); - const p = (g, y, x) => [g[0] + (y[0] - g[0]) * x, g[1] + (y[1] - g[1]) * x]; + y.push(``), y.push(``); + }, mf = () => { + if (!Js) return; + const t = C(ta, 0.8, 1.9), e = Math.max(0.08, Qs), s = 1 + oa, n = s + e, i = K + 5e-4, r = (g) => U(G(bt(g))), h = r([-t / 2, i, s]), u = r([t / 2, i, s]), d = r([t / 2, i, n]), f = r([-t / 2, i, n]); + y.push(``); + const p = (g, _, R) => [g[0] + (_[0] - g[0]) * R, g[1] + (_[1] - g[1]) * R]; [0.25, 0.5, 0.75].forEach((g) => { - const y = p(h, u, g), x = p(f, d, g); - $.push(``); + const _ = p(h, u, g), R = p(f, d, g); + y.push(``); }); const m = p(h, f, 0.5), b = p(u, d, 0.5); - $.push(``); + y.push(``); }; - if (go > 0.1 && gr.forEach((t, e) => { - const s = t.map((i) => `${i[0]},${i[1]}`).join(" "), n = M(0.86 - e * 0.08, 0.62, 0.9); - $.push(``); - }), $.push(``), yo && mt > 1e-3 && $.push(``), cf(), Ma && vt && ts && os && $.push(``), Ie && !vt && es && ss && $.push(``), xa && ir) { - const t = Je ? Je.map((s) => [s[0], s[1]]) : [], e = Jh(t, sf); + if (qo > 0.1 && Er.forEach((t, e) => { + const s = t.map((i) => `${i[0]},${i[1]}`).join(" "), n = C(0.86 - e * 0.08, 0.62, 0.9); + y.push(``); + }), y.push(``), yo && Mt > 1e-3 && y.push(``), mf(), Oa && Nt && rs && cs && y.push(``), Ye && !Nt && ls && hs && y.push(``), se && yr) { + const t = ns ? ns.map((s) => [s[0], s[1]]) : [], e = nu(t, uf); if (e.length >= 3) { - const s = e.map((i) => i[0] + "," + i[1]).join(" "), n = 1 - 0.4 * he; - $.push(``), $.push(``); + const s = e.map((i) => i[0] + "," + i[1]).join(" "), n = 1 - 0.4 * me; + y.push(``), y.push(``); } } - rf(), Ra && dn && $.push(``), $.push(``), $.push(``), $.push(``), ri && tr.forEach((t) => { - const e = t.isMajor ? Vl : Il; - $.push(``); - }), Hu.forEach((t) => { - $.push(``), y.push(``), y.push(``), y.push(``), _i && dr.forEach((t) => { + const e = t.isMajor ? Xl : Yl; + y.push(``); + }), Zu.forEach((t) => { + y.push(`${t.t}`); }); - const lf = { + const bf = { front: [1, 0, 0], back: [1, 0, 0], right: [0, 0, 1], left: [0, 0, 1] }; - er.forEach((t) => { - const e = lf[t.id]; + mr.forEach((t) => { + const e = bf[t.id]; if (!e) return; - const s = ft(e), n = ft(t.pos), i = t.id === "front" || t.id === "left" ? e.map((g) => -g) : e, r = ft(i), h = Wi(n, s, tu(s), r, !1); + const s = bt(e), n = bt(t.pos), i = t.id === "front" || t.id === "left" ? e.map((g) => -g) : e, r = bt(i), h = Ji(n, s, ru(s), r, !1); if (!h) return; - const { basis: u, centerScr: d } = h, f = M(d[3] * oh, eh, sh), p = th * f, m = rh * f, b = d[1] - ah * f; - $.push(`${t.label}`); }); - const hf = Number(this._cssGlobalTimeSec || Si), uf = Math.floor(hf / 1.6); - let $r = Qs ? 1 : 0; - const _r = (t, e = 1, s = 1) => { - const n = t.length > 0 ? (uf % t.length + t.length) % t.length : -1; + const gf = Number(this._cssGlobalTimeSec || Ti), _f = Math.floor(gf / 1.6); + let Ar = ma ? 1 : 0; + const Tr = (t, e = 1, s = 1) => { + const n = t.length > 0 ? (_f % t.length + t.length) % t.length : -1; t.forEach((i, r) => { - const h = M( - He / (He + i.zCam) * Oc, - Ic, - Vc - ), u = Math.max(0.7, Dc * No * h), d = M(Ac * s * h, 0, 1); - $.push(``); let f = !1; - if (Qs) - f = $r > 0 && r === n, f && ($r -= 1); + if (ma) + f = Ar > 0 && r === n, f && (Ar -= 1); else { const p = r % 3 !== 2, m = !ut || r % 2 === 0; f = p && m; } - if (ka && vt && f) { - const p = Math.max(0.6, u * zc), m = Math.max(0.2, Lc), b = r * Wc, g = ut ? Ks(m, b) : Zs(m, b), y = M(Pc * e * h, 0, 1), x = ut ? Math.max(1, Math.round(m * co)) : 0; - $.push(``); + style="animation-duration:${m}s;--sv-phase-delay:${g.toFixed(3)}s;animation-delay:${g.toFixed(3)}s;--sv-steps:${R}" + stroke="${Vc}" stroke-opacity="${_}" stroke-width="${p}" + stroke-linecap="round" stroke-dasharray="${Ha} ${Ga}" stroke-dashoffset="0"/>`); } }); }; - vt && _r(kn); - const ff = su.map((t) => { - const e = t.i.map((i) => Yt[i]), s = lo[t.id] ?? 1, n = Ct(t.c, s); - return { type: "cube", id: t.id, pts: e, z: Mo(e), fill: n, opacity: 1 }; - }), de = []; - Rt || (nu.forEach((t) => { + Nt && Tr(Vn); + const yf = hu.map((t) => { + const e = t.i.map((i) => Kt[i]), s = ho[t.id] ?? 1, n = Dt(t.c, s); + return { type: "cube", id: t.id, pts: e, z: No(e), fill: n, opacity: 1 }; + }), _e = []; + At || (fu.forEach((t) => { const e = Math.min(...t.pts.map((s) => s[2])); - de.push({ + _e.push({ type: "roofSide", pts: t.pts, // Use nearest point depth so side panels do not fall behind adjacent wall triangles. - z: e - ai, - fill: hn(t.wall), - opacity: za + z: e - mi, + fill: wn(t.wall), + opacity: Ka }); - }), un && de.push({ + }), Rn && _e.push({ type: "roofCap", - pts: un, - z: Mo(un) + ai * 0.35, - fill: hu, - opacity: za + pts: Rn, + z: No(Rn) + mi * 0.35, + fill: gu, + opacity: Ka })); - let pe = Mo(ca); - if (de.length) { - const t = Math.min(...de.map((s) => s.z)), e = Math.max(...de.map((s) => s.z)); - ho ? pe = Math.min(pe, t - 0.02) : pe = Math.max(pe, e + 0.02); + let ye = No(wa); + if (_e.length) { + const t = Math.min(..._e.map((s) => s.z)), e = Math.max(..._e.map((s) => s.z)); + uo ? ye = Math.min(ye, t - 0.02) : ye = Math.max(ye, e + 0.02); } else - pe += ho ? -1e-3 : 1e-3; - const vr = !Rt && vo && (ho || Fl) ? { + ye += uo ? -1e-3 : 1e-3; + const Dr = !At && wo && (uo || Wl) ? { type: "roofPlane", - pts: ca, - z: pe, - fill: ho ? lu : cu, - opacity: ho ? xs : Al - } : null, Sr = ff.concat(de).concat(Xt).concat(vr ? [vr] : []).sort((t, e) => { + pts: wa, + z: ye, + fill: uo ? bu : mu, + opacity: uo ? Fs : Ol + } : null, Br = yf.concat(_e).concat(Jt).concat(Dr ? [Dr] : []).sort((t, e) => { const s = e.z - t.z, n = String((t == null ? void 0 : t.type) || ""), i = String((e == null ? void 0 : e.type) || ""), r = n.startsWith("flatRoofEdge-"), h = i.startsWith("flatRoofEdge-"), u = n.startsWith("flatRoofSkirt-"), d = i.startsWith("flatRoofSkirt-"); if (r && h || u && d || (n === "roofSide" || n === "roofCap") && (i === "roofSide" || i === "roofCap")) { if (Math.abs(s) > 1e-6) return s; } else if (Math.abs(s) > 0.015) return s; const m = (g) => { - const y = String((g == null ? void 0 : g.type) || ""); - return y.startsWith("flatRoofSkirt-") ? 0.7 : y === "roofCap" ? 0.9 : y === "flatRoofTop" || y === "roofPlane" ? 1 : y === "cube" ? 1.4 : y === "roofSide" ? 1.55 : y.startsWith("flatRoofEdge-") ? 1.8 : y === "flatRoofBottom" ? 3 : 1; + const _ = String((g == null ? void 0 : g.type) || ""); + return _.startsWith("flatRoofSkirt-") ? 0.7 : _ === "roofCap" ? 0.9 : _ === "flatRoofTop" || _ === "roofPlane" ? 1 : _ === "cube" ? 1.4 : _ === "roofSide" ? 1.55 : _.startsWith("flatRoofEdge-") ? 1.8 : _ === "flatRoofBottom" ? 3 : 1; }, b = m(t) - m(e); return Math.abs(b) > 1e-6 ? b : s; - }), df = (t, e) => { - if (!Vs || !(t === "front" || t === "right" || t === "back" || t === "left") || !e || e.length < 4) return; - const s = e[0], n = e[1], i = e[2], r = e[3], h = (m, b, g) => [m[0] + (b[0] - m[0]) * g, m[1] + (b[1] - m[1]) * g], u = M(N, 0.015, 0.22), d = h(s, r, u), f = h(n, i, u), p = Ct(_t[t], (lo[t] ?? 1) * M(D, 0.2, 1.2)); - $.push(` { + if (!Xs || !(t === "front" || t === "right" || t === "back" || t === "left") || !e || e.length < 4) return; + const s = e[0], n = e[1], i = e[2], r = e[3], h = (m, b, g) => [m[0] + (b[0] - m[0]) * g, m[1] + (b[1] - m[1]) * g], u = C(Zs, 0.015, 0.22), d = h(s, r, u), f = h(n, i, u), p = Dt(kt[t], (ho[t] ?? 1) * C(Ks, 0.2, 1.2)); + y.push(``); - }, pf = (t) => { - if (!pi || !wn[t]) return; - const e = au[t], s = Vi[t]; + }, vf = (t) => { + if (!Ri || !Pn[t]) return; + const e = uu[t], s = or[t]; if (!e || !s) return; const n = t === "front" || t === "left" ? e.map((T) => -T) : e; let i = 0, r = 0, h = 0; - sn[t].indices.forEach((T) => { - const B = Ii[T]; - i += B[0], r += B[1], h += B[2]; - }), i /= 4, r /= 4, h /= 4, r = M(hh, -0.9, 0.9); + _n[t].indices.forEach((T) => { + const P = tr[T]; + i += P[0], r += P[1], h += P[2]; + }), i /= 4, r /= 4, h /= 4, r = C(gh, -0.9, 0.9); const u = [ - i + s[0] * Va, - r + s[1] * Va, - h + s[2] * Va - ], d = ft(u), f = ft(e), p = ft(n), m = Wi(d, f, [0, 1, 0], p, !1); + i + s[0] * en, + r + s[1] * en, + h + s[2] * en + ], d = bt(u), f = bt(e), p = bt(n), m = Ji(d, f, [0, 1, 0], p, !1); if (!m) return; - const { basis: b, centerScr: g } = m, y = M(g[3] * uh, fh, dh), x = Oa * y, E = Ia * y; - $.push(`${Pi(Ue[t])}`); - }, mf = () => { - if (!gh || !Sn.front) return; - const t = -Ha / 2, e = Ha / 2, s = M(-1 + yh, -1, 1), n = M(s + gi, -1, 1), i = 1 + $h, r = (T) => U(G(ft(T))), d = [ + transform="matrix(${b.bx} ${b.by} ${b.ux} ${b.uy} ${g[0]} ${g[1]})">${Xi(Je[t])}`); + }, Sf = () => { + if (!wh || !zn.front) return; + const t = -sn / 2, e = sn / 2, s = C(-1 + Rh, -1, 1), n = C(s + ki, -1, 1), i = 1 + Mh, r = (T) => U(G(bt(T))), d = [ [t, s, i], [e, s, i], [e, n, i], [t, n, i] ].map(r).map((T) => `${T[0]},${T[1]}`).join(","); - $.push(``); - const f = Math.min(0.08, Math.max(0.04, Ha * 0.14)), p = Math.min(0.08, Math.max(0.04, gi * 0.1)), g = [ + y.push(``); + const f = Math.min(0.08, Math.max(0.04, sn * 0.14)), p = Math.min(0.08, Math.max(0.04, ki * 0.1)), g = [ [t + f, s + p, i + 3e-3], [e - f, s + p, i + 3e-3], [e - f, n - p, i + 3e-3], [t + f, n - p, i + 3e-3] ].map(r).map((T) => `${T[0]},${T[1]}`).join(","); - $.push(``); - const y = [e - f - 0.05, s + (n - s) * 0.45, i + 6e-3], x = r(y), E = Math.max(0.6, x[3]); - $.push(``); - }, bf = (t, e) => { - if (!Ns || !(t === "left" || t === "right" || t === "back") || !e || e.length < 4) return; - const s = M(lo[t] ?? 1, 0.2, 1), n = e[0], i = e[1], r = e[2], h = e[3], u = (R, L, A) => [R[0] + (L[0] - R[0]) * A, R[1] + (L[1] - R[1]) * A], d = (R, L) => { - const A = u(n, h, L), j = u(i, r, L); - return u(A, j, R); - }, f = t === "back" ? 0.2 : 0.24, p = t === "back" ? 0.8 : 0.76, m = 0.2, b = m + (0.74 - m) * 0.75, y = [ + y.push(``); + const _ = [e - f - 0.05, s + (n - s) * 0.45, i + 6e-3], R = r(_), A = Math.max(0.6, R[3]); + y.push(``); + }, xf = (t, e) => { + if (!zs || !(t === "left" || t === "right" || t === "back") || !e || e.length < 4) return; + const s = C(ho[t] ?? 1, 0.2, 1), n = e[0], i = e[1], r = e[2], h = e[3], u = (M, I, D) => [M[0] + (I[0] - M[0]) * D, M[1] + (I[1] - M[1]) * D], d = (M, I) => { + const D = u(n, h, I), q = u(i, r, I); + return u(D, q, M); + }, f = t === "back" ? 0.2 : 0.24, p = t === "back" ? 0.8 : 0.76, m = 0.2, b = m + (0.74 - m) * 0.75, _ = [ d(f, m), d(p, m), d(p, b), d(f, b) - ].map((R) => `${R[0]},${R[1]}`).join(","); - $.push(``); - const x = 0.035, E = 0.05, B = [ - d(f + x, m + E), - d(p - x, m + E), - d(p - x, b - E), - d(f + x, b - E) - ].map((R) => `${R[0]},${R[1]}`).join(","); - $.push(``); - const z = d((f + p) * 0.5, m + E), I = d((f + p) * 0.5, b - E); - $.push(``); - const C = d(f + x * 1.4, m + E * 1.2), _ = d(p - x * 1.6, b - E * 1.3); - $.push(``); - }, ya = Bi([0, 0, -1]), wr = Math.hypot(wo, xo), xr = Math.hypot(ya[0], ya[2]), Fn = wr > 1e-6 && xr > 1e-6 && (wo * ya[0] + xo * ya[2]) / (wr * xr) < 0; - function Rr(t, e) { - if (!Pe || !Le) return; - const s = (E) => U(G(E)), n = wo, i = xo, r = M(ze, 0.4, 2.5), h = [n, Z + 0.35 * r, i]; + ].map((M) => `${M[0]},${M[1]}`).join(","); + y.push(``); + const R = 0.035, A = 0.05, P = [ + d(f + R, m + A), + d(p - R, m + A), + d(p - R, b - A), + d(f + R, b - A) + ].map((M) => `${M[0]},${M[1]}`).join(","); + y.push(``); + const W = d((f + p) * 0.5, m + A), V = d((f + p) * 0.5, b - A); + y.push(``); + const N = d(f + R * 1.4, m + A * 1.2), v = d(p - R * 1.6, b - A * 1.3); + y.push(``); + }, Da = Yi([0, 0, -1]), zr = Math.hypot(Mo, Co), Pr = Math.hypot(Da[0], Da[2]), jn = zr > 1e-6 && Pr > 1e-6 && (Mo * Da[0] + Co * Da[2]) / (zr * Pr) < 0; + function Lr(t, e) { + if (!Ie || !He) return; + const s = (A) => U(G(A)), n = Mo, i = Co, r = C(Ve, 0.4, 2.5), h = [n, K + 0.35 * r, i]; let u = !0; - if (Fn) + if (jn) u = !1; else if (e) { - const E = G(h), T = U(E), B = e(T[0], T[1]); - u = B == null || E[2] <= B - 8e-3; + const A = G(h), T = U(A), P = e(T[0], T[1]); + u = P == null || A[2] <= P - 8e-3; } if (t === "front" !== u) return; - const d = s([n, Z, i]), f = s([n, Z + 0.86 * r, i]), p = Math.max(2.6, 8.5 * f[3] * r), m = M(1 + Is * 10, 0.6, 2.5), b = Math.max(2.2, p * 0.62 * m), g = Math.max(1.1, p * 0.24 * m), y = d[0], x = d[1] + g * 0.28; - $.push(``); - } - function Mr(t, e) { - if (!Pe) return; - const s = (C) => U(G(C)), n = (C) => { - if (Fn) return !1; + const d = s([n, K, i]), f = s([n, K + 0.86 * r, i]), p = Math.max(2.6, 8.5 * f[3] * r), m = C(1 + Ys * 10, 0.6, 2.5), b = Math.max(2.2, p * 0.62 * m), g = Math.max(1.1, p * 0.24 * m), _ = d[0], R = d[1] + g * 0.28; + y.push(``); + } + function Wr(t, e) { + if (!Ie) return; + const s = (N) => U(G(N)), n = (N) => { + if (jn) return !1; if (!e) return !0; - const _ = G(C), R = U(_), L = e(R[0], R[1]); - return L == null || _[2] <= L - 8e-3; - }, i = (C, _, R, L) => { - if (Fn) return !1; + const v = G(N), M = U(v), I = e(M[0], M[1]); + return I == null || v[2] <= I - 8e-3; + }, i = (N, v, M, I) => { + if (jn) return !1; if (!e) return !0; - const A = [ + const D = [ [0.92, 0], [-0.92, 0], [0, 0.92], @@ -2445,39 +2515,39 @@ const qn = class qn extends be { [0.66, -0.66], [-0.66, -0.66] ]; - let j = 0; - for (const [pt, lt] of A) { - const Gt = e(_ + pt * L, R + lt * L); - (Gt == null || C <= Gt - 8e-3) && j++; + let q = 0; + for (const [yt, lt] of D) { + const qt = e(v + yt * I, M + lt * I); + (qt == null || N <= qt - 8e-3) && q++; } - return j / A.length >= 0.4; - }, r = wo, h = xo, u = M(ze, 0.4, 2.5), d = M(1 - 0.55 * Ke, 0.35, 1), f = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(io) ? Ct(io, 0.72 * d) : io, p = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(io) ? Ct(io, 1.18 - 0.4 * Ke) : "rgba(255,255,255,0.30)", m = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Ct(ro, 0.72 * d) : ro, b = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Ct(ro, 1.2 - 0.45 * Ke) : "rgba(255,255,255,0.25)", g = M(1 - 0.3 * Ke, 0.55, 1), y = s([r, Z, h]), x = s([r, Z + 0.86 * u, h]), E = Math.max(2.6, 8.5 * x[3] * u), T = [ - [r, Z + 0.22 * u, h], - [r, Z + 0.45 * u, h], - [r, Z + 0.72 * u, h] + return q / D.length >= 0.4; + }, r = Mo, h = Co, u = C(Ve, 0.4, 2.5), d = C(1 - 0.55 * as, 0.35, 1), f = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Dt(ro, 0.72 * d) : ro, p = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(ro) ? Dt(ro, 1.18 - 0.4 * as) : "rgba(255,255,255,0.30)", m = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(co) ? Dt(co, 0.72 * d) : co, b = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(co) ? Dt(co, 1.2 - 0.45 * as) : "rgba(255,255,255,0.25)", g = C(1 - 0.3 * as, 0.55, 1), _ = s([r, K, h]), R = s([r, K + 0.86 * u, h]), A = Math.max(2.6, 8.5 * R[3] * u), T = [ + [r, K + 0.22 * u, h], + [r, K + 0.45 * u, h], + [r, K + 0.72 * u, h] ]; - let B = 0; - T.forEach((C) => { - n(C) && B++; + let P = 0; + T.forEach((N) => { + n(N) && P++; }); - const z = B / T.length >= 0.4; - if (t === "front" === z) { - const C = x[0] - y[0], _ = x[1] - y[1], R = Math.max(1e-3, Math.hypot(C, _)), L = -_ / R, A = C / R, j = Math.max(0.35, E * 0.12); - $.push(``), $.push(``); + const W = P / T.length >= 0.4; + if (t === "front" === W) { + const N = R[0] - _[0], v = R[1] - _[1], M = Math.max(1e-3, Math.hypot(N, v)), I = -v / M, D = N / M, q = Math.max(0.35, A * 0.12); + y.push(``), y.push(``); } [ - [r, Z + 1.02 * u, h, 0.28], - [r - 0.18 * u, Z + 0.9 * u, h + 0.06 * u, 0.22], - [r + 0.2 * u, Z + 0.86 * u, h - 0.07 * u, 0.2] - ].forEach((C) => { - const _ = s([C[0], C[1], C[2]]), R = G([C[0], C[1], C[2]]), L = Math.max(6, Tt * C[3] * _[3] * 0.95), A = i(R[2], _[0], _[1], L * 0.92); - t === "front" === A && ($.push(``), $.push(``), $.push(``)); + [r, K + 1.02 * u, h, 0.28], + [r - 0.18 * u, K + 0.9 * u, h + 0.06 * u, 0.22], + [r + 0.2 * u, K + 0.86 * u, h - 0.07 * u, 0.2] + ].forEach((N) => { + const v = s([N[0], N[1], N[2]]), M = G([N[0], N[1], N[2]]), I = Math.max(6, dt * N[3] * v[3] * 0.95), D = i(M[2], v[0], v[1], I * 0.92); + t === "front" === D && (y.push(``), y.push(``), y.push(``)); }); } - const Cr = () => { - const t = Rt && rn ? rn : qe, e = { + const Or = () => { + const t = At && vn ? vn : ts, e = { front: { low: [3, 2], high: [0, 1] }, back: { low: [0, 1], high: [3, 2] }, left: { low: [0, 3], high: [1, 2] }, @@ -2500,138 +2570,138 @@ const qn = class qn extends be { } const u = Math.hypot(i[0] - n[0], i[1] - n[1], i[2] - n[2]), d = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2, (n[2] + i[2]) / 2], f = [(r[0] + h[0]) / 2, (r[1] + h[1]) / 2, (r[2] + h[2]) / 2], p = Math.hypot(f[0] - d[0], f[1] - d[1], f[2] - d[2]); return !isFinite(u) || !isFinite(p) || u <= 1e-6 || p <= 1e-6 ? null : { lowA: n, lowB: i, highA: r, highB: h, worldEdgeLen: u, roofHeightWorld: p }; - }, gf = () => { - if (!As || !vo || !ln) return; - const t = Cr(); + }, wf = () => { + if (!Os || !wo || !xn) return; + const t = Or(); if (!t) return; - const { lowA: e, lowB: s, highA: n, highB: i } = t, r = Math.min(Fe, Ae), h = Math.max(Fe, Ae), u = zs, d = Ls, f = (1 - u) / 2, p = u, m = d * Math.max(0, Ko - 1), b = (p - m) / Ko; + const { lowA: e, lowB: s, highA: n, highB: i } = t, r = Math.min(Pe, Le), h = Math.max(Pe, Le), u = Gs, d = Us, f = (1 - u) / 2, p = u, m = d * Math.max(0, ee - 1), b = (p - m) / ee; if (!isFinite(b) || b <= 0.01) return; - const g = (B, z, I) => [B[0] + (z[0] - B[0]) * I, B[1] + (z[1] - B[1]) * I, B[2] + (z[2] - B[2]) * I], y = (B, z) => { - const I = g(e, n, z), C = g(s, i, z), _ = g(I, C, B); - return U(G(_)); - }, x = Ye(Ds, M(At, 0.2, 1)), E = 0.55 + 0.4 * M(At, 0, 1), T = 0.3 + 0.5 * M(At, 0, 1); - for (let B = 0; B < Ko; B++) { - const z = f + B * (b + d), I = z + b, C = y(z, r), _ = y(I, r), R = y(I, h), L = y(z, h); - $.push(``); - const A = (j, st, pt) => [j[0] + (st[0] - j[0]) * pt, j[1] + (st[1] - j[1]) * pt]; - for (let j = 1; j < De; j++) { - const st = j / De, pt = A(C, _, st), lt = A(L, R, st); - $.push(``); + const g = (P, W, V) => [P[0] + (W[0] - P[0]) * V, P[1] + (W[1] - P[1]) * V, P[2] + (W[2] - P[2]) * V], _ = (P, W) => { + const V = g(e, n, W), N = g(s, i, W), v = g(V, N, P); + return U(G(v)); + }, R = os(Is, C(Wt, 0.2, 1)), A = 0.55 + 0.4 * C(Wt, 0, 1), T = 0.3 + 0.5 * C(Wt, 0, 1); + for (let P = 0; P < ee; P++) { + const W = f + P * (b + d), V = W + b, N = _(W, r), v = _(V, r), M = _(V, h), I = _(W, h); + y.push(``); + const D = (q, et, yt) => [q[0] + (et[0] - q[0]) * yt, q[1] + (et[1] - q[1]) * yt]; + for (let q = 1; q < We; q++) { + const et = q / We, yt = D(N, v, et), lt = D(I, M, et); + y.push(``); } - for (let j = 1; j < Be; j++) { - const st = j / Be, pt = A(C, L, st), lt = A(_, R, st); - $.push(``); + for (let q = 1; q < Oe; q++) { + const et = q / Oe, yt = D(N, I, et), lt = D(v, M, et); + y.push(``); } } - }, kr = () => { - if (!pi || !vo || !ln) return; - const t = Cr(); + }, Ir = () => { + if (!Ri || !wo || !xn) return; + const t = Or(); if (!t) return; - const { lowA: e, lowB: s, highA: n, highB: i, worldEdgeLen: r, roofHeightWorld: h } = t, u = Pi(ve); + const { lowA: e, lowB: s, highA: n, highB: i, worldEdgeLen: r, roofHeightWorld: h } = t, u = Xi(Me); let d = -h * (1 / 3), f = -h * (2 / 3); - const p = 1 / 6, m = r * (1 - 2 * p), b = "100%", g = "9.99 kW", y = Math.max(u.length, b.length); - Math.max((we || "").length, g.length); - const x = h * 0.36, E = Math.min(m / (0.6 * y), x), T = Math.min(E * ph, x * 1.05), B = Ia / Oa * T, z = Math.min(T * mh, x * 0.85), I = Ia / Oa * z; + const p = 1 / 6, m = r * (1 - 2 * p), b = "100%", g = "9.99 kW", _ = Math.max(u.length, b.length); + Math.max((ke || "").length, g.length); + const R = h * 0.36, A = Math.min(m / (0.6 * _), R), T = Math.min(A * vh, R * 1.05), P = on / tn * T, W = Math.min(T * Sh, R * 0.85), V = on / tn * W; this._roofStripSeed = (this._roofStripSeed || 0) + 1; - const C = (R, L, A) => [R[0] + (L[0] - R[0]) * A, R[1] + (L[1] - R[1]) * A, R[2] + (L[2] - R[2]) * A], _ = (R, L, A, j, st, pt, lt) => { - if (!R) return; - const Gt = Math.max(L * pt, h * 0.08), Dn = st, qr = st - Gt, Yr = M(-Dn / h, 0, 1), wf = M(-qr / h, 0, 1), xf = C(e, n, Yr), Rf = C(s, i, Yr), Mf = C(e, n, wf), Xr = U(G(xf)), Zr = U(G(Rf)), Kr = U(G(Mf)), Kt = [[0, Dn], [r, Dn], [0, qr]], Jt = [[Xr[0], Xr[1]], [Zr[0], Zr[1]], [Kr[0], Kr[1]]], Po = Qh(Kt, Jt); - if (!Po) return; - const Jr = Math.sign((Kt[1][0] - Kt[0][0]) * (Kt[2][1] - Kt[0][1]) - (Kt[1][1] - Kt[0][1]) * (Kt[2][0] - Kt[0][0])), Qr = Math.sign((Jt[1][0] - Jt[0][0]) * (Jt[2][1] - Jt[0][1]) - (Jt[1][1] - Jt[0][1]) * (Jt[2][0] - Jt[0][0])), tc = Jr !== 0 && Qr !== 0 && Jr !== Qr; - $.push(``), tc && $.push(``), $.push(`${R}`), tc && $.push(""), $.push(""); + const N = (M, I, D) => [M[0] + (I[0] - M[0]) * D, M[1] + (I[1] - M[1]) * D, M[2] + (I[2] - M[2]) * D], v = (M, I, D, q, et, yt, lt) => { + if (!M) return; + const qt = Math.max(I * yt, h * 0.08), Yn = et, rc = et - qt, cc = C(-Yn / h, 0, 1), Ef = C(-rc / h, 0, 1), Ff = N(e, n, cc), Af = N(s, i, cc), Tf = N(e, n, Ef), lc = U(G(Ff)), hc = U(G(Af)), uc = U(G(Tf)), to = [[0, Yn], [r, Yn], [0, rc]], oo = [[lc[0], lc[1]], [hc[0], hc[1]], [uc[0], uc[1]]], Wo = iu(to, oo); + if (!Wo) return; + const fc = Math.sign((to[1][0] - to[0][0]) * (to[2][1] - to[0][1]) - (to[1][1] - to[0][1]) * (to[2][0] - to[0][0])), dc = Math.sign((oo[1][0] - oo[0][0]) * (oo[2][1] - oo[0][1]) - (oo[1][1] - oo[0][1]) * (oo[2][0] - oo[0][0])), pc = fc !== 0 && dc !== 0 && fc !== dc; + y.push(``), pc && y.push(``), y.push(`${M}`), pc && y.push(""), y.push(""); }; - Uo && _(we, z, I, bh, d, 1.6), _(u, T, B, mi, f, 1.6); - }, An = []; - Sr.forEach((t) => { + Zo && v(ke, W, V, xh, d, 1.6), v(u, T, P, Mi, f, 1.6); + }, qn = []; + Br.forEach((t) => { const e = t.pts || []; if (!(e.length < 3)) if (e.length === 3) - An.push([e[0], e[1], e[2]]); + qn.push([e[0], e[1], e[2]]); else for (let s = 1; s < e.length - 1; s++) - An.push([e[0], e[s], e[s + 1]]); + qn.push([e[0], e[s], e[s + 1]]); }); - const yf = (t, e, s, n, i) => { - const r = s[0], h = s[1], u = s[2], d = n[0], f = n[1], p = n[2], m = i[0], b = i[1], g = i[2], y = (f - b) * (r - m) + (m - d) * (h - b); - if (Math.abs(y) < 1e-6) return null; - const x = ((f - b) * (t - m) + (m - d) * (e - b)) / y, E = ((b - h) * (t - m) + (r - m) * (e - b)) / y, T = 1 - x - E; - return x < -1e-4 || E < -1e-4 || T < -1e-4 ? null : x * u + E * p + T * g; - }, is = (t, e) => { + const Rf = (t, e, s, n, i) => { + const r = s[0], h = s[1], u = s[2], d = n[0], f = n[1], p = n[2], m = i[0], b = i[1], g = i[2], _ = (f - b) * (r - m) + (m - d) * (h - b); + if (Math.abs(_) < 1e-6) return null; + const R = ((f - b) * (t - m) + (m - d) * (e - b)) / _, A = ((b - h) * (t - m) + (r - m) * (e - b)) / _, T = 1 - R - A; + return R < -1e-4 || A < -1e-4 || T < -1e-4 ? null : R * u + A * p + T * g; + }, ds = (t, e) => { let s = 1 / 0; - return An.forEach(([n, i, r]) => { - const h = yf(t, e, n, i, r); + return qn.forEach(([n, i, r]) => { + const h = Rf(t, e, n, i, r); h != null && h < s && (s = h); }), Number.isFinite(s) ? s : null; }; - Rr("back", is), Mr("back", is), Sr.forEach((t) => { + Lr("back", ds), Wr("back", ds), Br.forEach((t) => { const e = t.pts.map((r) => r[0] + "," + r[1]).join(","), n = typeof t.type == "string" && t.type.startsWith("flatRoof") ? t.fill : "#000"; - $.push(``), t.type === "cube" && df(t.id, t.pts), t.type === "cube" && t.id === "front" && mf(), t.type === "cube" && bf(t.id, t.pts), t.type === "cube" && pf(t.id), (t.type === "roofPlane" || t.type === "flatRoofTop") && gf(), t.type === "roofPlane" && !Rt && kr(); - }), Rt && ln && kr(); - const $f = (t) => { + y.push(``), t.type === "cube" && $f(t.id, t.pts), t.type === "cube" && t.id === "front" && Sf(), t.type === "cube" && xf(t.id, t.pts), t.type === "cube" && vf(t.id), (t.type === "roofPlane" || t.type === "flatRoofTop") && wf(), t.type === "roofPlane" && !At && Ir(); + }), At && xn && Ir(); + const Mf = (t) => { const e = [0.14, 0.24, 0.34, 0.44, 0.54, 0.64, 0.74, 0.84, 0.92]; let s = 0, n = 0; for (const i of e) { const r = [ - ko[0] + (t.world[0] - ko[0]) * i, - ko[1] + (t.world[1] - ko[1]) * i, - ko[2] + (t.world[2] - ko[2]) * i - ], h = G(r), u = U(h), d = is(u[0], u[1]); + Fo[0] + (t.world[0] - Fo[0]) * i, + Fo[1] + (t.world[1] - Fo[1]) * i, + Fo[2] + (t.world[2] - Fo[2]) * i + ], h = G(r), u = U(h), d = ds(u[0], u[1]); n++, (d == null || h[2] <= d - 5e-3) && s++; } return n > 0 && s >= Math.ceil(n * 0.67); - }, Nr = En.filter((t) => $f(t)); - if (vt && !du && Nr.length && _r(Nr, 1, 0.85), Rr("front", is), Mr("front", is), vt) { - $.push(``), $.push(``); - const t = Math.min(Ta, Fa), e = Math.max(Ta, Fa); + }, Vr = Gn.filter((t) => Mf(t)); + if (Nt && !$u && Vr.length && Tr(Vr, 1, 0.85), Lr("front", ds), Wr("front", ds), Nt) { + y.push(``), y.push(``); + const t = Math.min(Ua, ja), e = Math.max(Ua, ja); for (let s = 0; s < 8; s++) { - const n = s * 360 / 8, i = 20 * No; - if (Ya) { - const r = t + (e - t) * (0.5 + 0.5 * Math.sin(s * 1.71)), h = 0.18 * s + 0.07 * Math.cos(s * 2.13), u = ut ? Ks(r, h) : Zs(r, h), d = M(Gc + 0.015 * Math.sin(s * 0.93), 0.2, 1), f = M(Uc - 0.02 * Math.cos(s * 1.27), 0.25, 1), p = M(jc + 0.04 * Math.cos(s * 1.37), 0.05, 1); - $.push(``); - const m = ut ? Math.max(1, Math.round(r * co)) : 0; - $.push(``); + const m = ut ? Math.max(1, Math.round(r * lo)) : 0; + y.push(``), $.push(""); + stroke="${li}" stroke-width="${1.5 * Ao}" stroke-linecap="round" opacity="${p.toFixed(3)}"/>`), y.push(""); } else - $.push(``), $.push(``), $.push(""); + y.push(``), y.push(``), y.push(""); } } - if (Ie && !vt && uo > 0.03) { - const t = Array.isArray(js) ? js : [178, 208, 255], e = M(Rl * uo, 0, 1); - $.push(` 0.03) { + const t = Array.isArray(ca) ? ca : [178, 208, 255], e = C(Al * fo, 0, 1); + y.push(``); } - const _f = kt ? ["SUN OVERRIDE ENABLED", "Solar alignment % is disabled"] : []; - ei && $.push(``); - const Er = this._autoRotateEnabled ? Number(this._autoRotateIntervalMsDynamic || Mt) : this._manualRotateEnabled ? Number(this._manualRotateIntervalMs || this._rotationIntervalMsFloor || Mt) : Mt, vf = Za && Er > Mt; - let Sf = 0; - const rs = () => 18 + Sf++ * 16; - if (Rh && this._autoRotateEnabled) { - const t = Number.isFinite(this._autoRotateFps) ? this._autoRotateFps : 0, e = this._autoRotateIntervalMsDynamic || Mt, s = e > Mt ? " LIMIT" : ""; - $.push(`FPS ${t.toFixed(1)} | ${Math.round(e)}ms${s}`); + const Cf = $t ? ["SUN OVERRIDE ENABLED", "Solar alignment % is disabled"] : []; + di && y.push(``); + const Hr = this._autoRotateEnabled ? Number(this._autoRotateIntervalMsDynamic || Tt) : this._manualRotateEnabled ? Number(this._manualRotateIntervalMs || this._rotationIntervalMsFloor || Tt) : Tt, kf = un && Hr > Tt; + let Nf = 0; + const ps = () => 18 + Nf++ * 16; + if (Ah && this._autoRotateEnabled) { + const t = Number.isFinite(this._autoRotateFps) ? this._autoRotateFps : 0, e = this._autoRotateIntervalMsDynamic || Tt, s = e > Tt ? " LIMIT" : ""; + y.push(`FPS ${t.toFixed(1)} | ${Math.round(e)}ms${s}`); } - if (_i) { + if (Fi) { const t = Number.isFinite(this._cssFps) ? this._cssFps : 0; - $.push(`CSS FPS ${t.toFixed(1)}`); + y.push(`CSS FPS ${t.toFixed(1)}`); } - if (Oh && ut && $.push(`CSS LIMIT ${co} FPS`), vf) { - const t = Math.max(1, Math.round(1e3 / Er)); - $.push(`ROT LIMIT ${t} FPS`); + if (qh && ut && y.push(`CSS LIMIT ${lo} FPS`), kf) { + const t = Math.max(1, Math.round(1e3 / Hr)); + y.push(`ROT LIMIT ${t} FPS`); } - return _f.forEach((t, e) => { - const s = rs(), n = e === 0 ? 12 : 11; - $.push(`${t}`); - }), $.push(""), $.join(""); + return Cf.forEach((t, e) => { + const s = ps(), n = e === 0 ? 12 : 11; + y.push(`${t}`); + }), y.push(""), y.join(""); } }; -qn.styles = bc` +ri.styles = Ec` :host { display: block; --cam-control-size: 43px; @@ -2735,16 +2805,16 @@ qn.styles = bc` .cam-btn-save { left: 10px; bottom: 10px; } .cam-btn-restore { left: calc(10px + var(--cam-control-size) + 10px); bottom: 10px; } `; -let Vn = qn; -const va = "sunlight-visualizer-card"; -if (!customElements.get(va)) +let ei = ri; +const Pa = "sunlight-visualizer-card"; +if (!customElements.get(Pa)) try { - customElements.define(va, Vn); + customElements.define(Pa, ei); } catch { } -const dc = window.customCards ?? (window.customCards = []); -dc.some((S) => S.type === va) || dc.push({ - type: va, +const Cc = window.customCards ?? (window.customCards = []); +Cc.some((S) => S.type === Pa) || Cc.push({ + type: Pa, name: "Sunlight Visualizer Card", description: "2.5D sunlight visualizer house card with auto-bound integration entities.", preview: !0,