From 5d6d845ebf97bcda93929890cf576a6ef7bf2fa2 Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Thu, 1 Oct 2026 05:38:21 +0000 Subject: [PATCH] 456 files --- .ha_run.lock | 2 +- .storage/lovelace_resources | 79 +- custom_components/cafe/manifest.json | 2 +- .../{main-CCZArAkW.js => main-Dmz6EiZM.js} | 6 +- custom_components/ha_mcp_tools/__init__.py | 37 +- custom_components/ha_mcp_tools/config_flow.py | 94 +- custom_components/ha_mcp_tools/const.py | 18 +- .../ha_mcp_tools/embedded_server.py | 17 +- custom_components/ha_mcp_tools/manifest.json | 2 +- custom_components/ha_mcp_tools/strings.json | 4 + .../ha_mcp_tools/translations/az.json | 172 + .../ha_mcp_tools/translations/cs.json | 4 + .../ha_mcp_tools/translations/de.json | 4 + .../ha_mcp_tools/translations/en.json | 4 + .../ha_mcp_tools/translations/eo.json | 4 + .../ha_mcp_tools/translations/es.json | 4 + .../ha_mcp_tools/translations/fr.json | 4 + .../ha_mcp_tools/translations/it.json | 4 + .../ha_mcp_tools/translations/ko.json | 4 + .../ha_mcp_tools/translations/nl.json | 4 + .../ha_mcp_tools/translations/pl.json | 4 + .../ha_mcp_tools/translations/ru.json | 4 + .../ha_mcp_tools/translations/sv.json | 4 + .../ha_mcp_tools/translations/zh-Hans.json | 4 + .../ha_mcp_tools/translations/zh-Hant.json | 4 + .../ha_mcp_tools/websocket_api.py | 141 +- .../maintenance_supporter/__init__.py | 13 +- .../maintenance_supporter/calendar.py | 2 +- .../config_flow_helpers.py | 1 + .../config_flow_options_global.py | 5 +- .../config_flow_trigger.py | 7 +- .../maintenance_supporter/const.py | 7 + .../maintenance_supporter/coordinator.py | 10 +- .../data/regions/README.md | 3 + .../data/regions/names_i18n.json | 110 + .../maintenance_supporter/export.py | 3 + .../__tests__/dashboard-kpi-chips.test.ts | 12 +- .../__tests__/settings-view-print-qr.test.ts | 5 +- .../components/budget-section-card.ts | 2 +- .../components/groups-section-card.ts | 2 +- .../frontend-src/components/qr-dialog.ts | 58 +- .../frontend-src/components/settings-view.ts | 57 +- .../components/suggested-setups-dialog.ts | 110 +- .../frontend-src/components/task-dialog.ts | 32 +- .../components/vacation-section-card.ts | 2 +- .../frontend-src/helpers/report.ts | 6 +- .../frontend-src/helpers/storage-keys.ts | 2 + .../frontend-src/locales/cs.json | 97 + .../frontend-src/locales/da.json | 97 + .../frontend-src/locales/de.json | 97 + .../frontend-src/locales/en.json | 97 + .../frontend-src/locales/es.json | 97 + .../frontend-src/locales/fi.json | 97 + .../frontend-src/locales/fr.json | 97 + .../frontend-src/locales/hi.json | 97 + .../frontend-src/locales/hu.json | 97 + .../frontend-src/locales/it.json | 97 + .../frontend-src/locales/ja.json | 97 + .../frontend-src/locales/ko.json | 97 + .../frontend-src/locales/nb.json | 97 + .../frontend-src/locales/nl.json | 97 + .../frontend-src/locales/pl.json | 97 + .../frontend-src/locales/pt-br.json | 97 + .../frontend-src/locales/pt.json | 97 + .../frontend-src/locales/ru.json | 97 + .../frontend-src/locales/sv.json | 97 + .../frontend-src/locales/tr.json | 97 + .../frontend-src/locales/uk.json | 97 + .../frontend-src/locales/zh.json | 97 + .../frontend-src/maintenance-card.ts | 3 + .../maintenance-dashboard-strategy.ts | 161 +- .../frontend-src/maintenance-panel.ts | 199 +- .../frontend-src/panel-styles.ts | 68 + .../frontend-src/renderers/history.ts | 11 +- .../frontend-src/renderers/progress.ts | 12 + .../frontend-src/styles.ts | 135 +- .../frontend-src/types.ts | 4 + .../frontend-src/ws-errors.ts | 27 +- .../frontend/locales/cs.json | 97 + .../frontend/locales/da.json | 97 + .../frontend/locales/de.json | 97 + .../frontend/locales/en.json | 97 + .../frontend/locales/es.json | 97 + .../frontend/locales/fi.json | 97 + .../frontend/locales/fr.json | 97 + .../frontend/locales/hi.json | 97 + .../frontend/locales/hu.json | 97 + .../frontend/locales/it.json | 97 + .../frontend/locales/ja.json | 97 + .../frontend/locales/ko.json | 97 + .../frontend/locales/nb.json | 97 + .../frontend/locales/nl.json | 97 + .../frontend/locales/pl.json | 97 + .../frontend/locales/pt-br.json | 97 + .../frontend/locales/pt.json | 97 + .../frontend/locales/ru.json | 97 + .../frontend/locales/sv.json | 97 + .../frontend/locales/tr.json | 97 + .../frontend/locales/uk.json | 97 + .../frontend/locales/zh.json | 97 + .../frontend/maintenance-calendar-card.js | 444 +- .../frontend/maintenance-card.js | 1466 ++--- .../frontend/maintenance-panel.js | 1650 ++--- .../frontend/maintenance-strategy-shim.js | 4 +- .../adopt-problem-sensors-dialog-G6OMYHFP.js | 301 + .../panel-chunks/area-view-DOCESFOL.js | 277 + .../panel-chunks/areas-view-EIIITWEQ.js | 54 + .../frontend/panel-chunks/chunk-2SARE4MS.js | 1470 +++++ .../frontend/panel-chunks/chunk-3WM7WAL2.js | 153 + .../frontend/panel-chunks/chunk-45NFFEKB.js | 2 + .../frontend/panel-chunks/chunk-4XNVTWGC.js | 1301 ++++ .../frontend/panel-chunks/chunk-AHDRR46D.js | 234 + .../frontend/panel-chunks/chunk-APJICCRG.js | 2 + .../frontend/panel-chunks/chunk-E7KPGZZO.js | 2 + .../frontend/panel-chunks/chunk-FQOUX6W2.js | 79 + .../frontend/panel-chunks/chunk-GGJ6YWZO.js | 2 + .../frontend/panel-chunks/chunk-GTEFDN23.js | 478 ++ .../frontend/panel-chunks/chunk-JEWIFUZC.js | 2 + .../frontend/panel-chunks/chunk-LEWJHPDY.js | 2 + .../frontend/panel-chunks/chunk-ODPGZXCU.js | 2 + .../frontend/panel-chunks/chunk-S7ZP4PVX.js | 2 + .../frontend/panel-chunks/chunk-SCLV5YEV.js | 2 + .../frontend/panel-chunks/chunk-UJICOAU3.js | 2 + .../frontend/panel-chunks/chunk-UN244A6U.js | 969 +++ .../frontend/panel-chunks/chunk-UVBHIULM.js | 88 + .../frontend/panel-chunks/chunk-WUMSAU4G.js | 2 + .../frontend/panel-chunks/chunk-XCDM7D5I.js | 2 + .../frontend/panel-chunks/chunk-XSFV5MUM.js | 2 + .../frontend/panel-chunks/chunk-YKVD2DJ5.js | 2 + .../frontend/panel-chunks/chunk-YQT7IJJB.js | 2 + .../frontend/panel-chunks/chunk-ZCC7RQPW.js | 2 + .../panel-chunks/complete-dialog-C2KNLAXY.js | 2 + .../panel-chunks/dialog-mount-OI2EBUCS.js | 2 + .../panel-chunks/object-dialog-LYW4YDC6.js | 2 + .../panel-chunks/qr-dialog-VLMVLZ4U.js | 2 + .../panel-chunks/settings-view-YNCYESZH.js | 1428 +++++ .../suggested-setups-dialog-DV6WXAWB.js | 184 + .../panel-chunks/task-dialog-2CVAHRCG.js | 2 + .../chunks/budget-section-card-FYYZR3LV.js | 127 + .../strategy/chunks/chunk-2ARNLSF6.js | 1301 ++++ .../strategy/chunks/chunk-3MSNNIFG.js | 2 + .../strategy/chunks/chunk-4JW6SHXP.js | 2 + .../strategy/chunks/chunk-6BHUADHJ.js | 66 + .../strategy/chunks/chunk-C275ZO4V.js | 2 + .../strategy/chunks/chunk-IWH6LGYJ.js | 60 + .../strategy/chunks/chunk-N5LSMQW7.js | 88 + .../strategy/chunks/dialog-mount-BY7EKQPS.js | 3290 ++++++++++ .../chunks/groups-section-card-DLDUVDMS.js | 137 + .../chunks/vacation-section-card-R3FY4AUU.js | 134 + .../maintenance-dashboard-strategy.js | 12 +- .../helpers/action_listener.py | 114 +- .../helpers/global_options.py | 20 +- .../helpers/notification_manager.py | 64 +- .../maintenance_supporter/helpers/sanitize.py | 5 + .../helpers/signatures/_discovery.py | 81 +- .../helpers/signatures/_model.py | 26 +- .../helpers/signatures/air.py | 260 +- .../helpers/signatures/cars.py | 76 +- .../helpers/signatures/garden.py | 251 +- .../helpers/signatures/heating.py | 149 +- .../helpers/signatures/kitchen.py | 335 +- .../helpers/signatures/personal.py | 45 +- .../helpers/signatures/pets.py | 115 +- .../helpers/signatures/printers.py | 70 +- .../helpers/signatures/transports.py | 73 +- .../helpers/signatures/vacuums.py | 353 +- .../helpers/signatures/xiaomi.py | 36 +- .../maintenance_supporter/manifest.json | 2 +- .../maintenance_supporter/strings.json | 102 + .../maintenance_supporter/templates.py | 4 + .../maintenance_supporter/templates_i18n.py | 208 + .../translations/cs.json | 102 + .../translations/da.json | 102 + .../translations/de.json | 102 + .../translations/en.json | 102 + .../translations/es.json | 102 + .../translations/fi.json | 102 + .../translations/fr.json | 102 + .../translations/hi.json | 102 + .../translations/hu.json | 102 + .../translations/it.json | 102 + .../translations/ja.json | 102 + .../translations/ko.json | 102 + .../translations/nb.json | 102 + .../translations/nl.json | 102 + .../translations/pl.json | 102 + .../translations/pt-BR.json | 102 + .../translations/pt.json | 102 + .../translations/ru.json | 102 + .../translations/sv.json | 102 + .../translations/tr.json | 102 + .../translations/uk.json | 102 + .../translations/zh-Hans.json | 102 + .../websocket/__init__.py | 7 +- .../websocket/battery_fleet.py | 13 +- .../websocket/dashboard.py | 8 +- .../websocket/documents.py | 3 +- .../maintenance_supporter/websocket/groups.py | 5 +- .../websocket/integration_setups.py | 202 +- .../maintenance_supporter/websocket/io.py | 93 +- .../websocket/objects.py | 19 +- .../maintenance_supporter/websocket/parts.py | 3 +- .../websocket/problem_sensors.py | 190 +- .../websocket/saved_views.py | 3 +- .../websocket/tasks_actions.py | 15 +- .../websocket/tasks_crud.py | 29 +- .../websocket/tasks_persist.py | 9 +- .../websocket/vacation.py | 3 +- .../__pycache__/__init__.cpython-314.pyc | Bin 6582 -> 6582 bytes .../__pycache__/binary_sensor.cpython-314.pyc | Bin 1199 -> 1199 bytes .../spook/__pycache__/button.cpython-314.pyc | Bin 1176 -> 1176 bytes .../__pycache__/config_flow.cpython-314.pyc | Bin 6379 -> 6379 bytes .../spook/__pycache__/const.cpython-314.pyc | Bin 1092 -> 1092 bytes .../spook/__pycache__/entity.cpython-314.pyc | Bin 1596 -> 1596 bytes .../entity_filtering.cpython-314.pyc | Bin 31764 -> 31764 bytes .../spook/__pycache__/event.cpython-314.pyc | Bin 1173 -> 1173 bytes .../integration_linking.cpython-314.pyc | Bin 2933 -> 2933 bytes .../__pycache__/listeners.cpython-314.pyc | Bin 2862 -> 2862 bytes .../spook/__pycache__/number.cpython-314.pyc | Bin 1176 -> 1176 bytes .../spook/__pycache__/repairs.cpython-314.pyc | Bin 68989 -> 71588 bytes .../spook/__pycache__/select.cpython-314.pyc | Bin 1176 -> 1176 bytes .../spook/__pycache__/sensor.cpython-314.pyc | Bin 1176 -> 1176 bytes .../__pycache__/services.cpython-314.pyc | Bin 28759 -> 28793 bytes .../__pycache__/setup_helpers.cpython-314.pyc | Bin 7347 -> 7347 bytes .../spook/__pycache__/switch.cpython-314.pyc | Bin 1177 -> 1177 bytes .../spook/__pycache__/time.cpython-314.pyc | Bin 1170 -> 1170 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 187 -> 187 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 198 -> 198 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 197 -> 197 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 206 -> 206 bytes .../__pycache__/importer.cpython-314.pyc | Bin 3825 -> 3825 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../cloud/__pycache__/entity.cpython-314.pyc | Bin 2571 -> 2571 bytes .../cloud/__pycache__/switch.cpython-314.pyc | Bin 9098 -> 9098 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 201 -> 201 bytes .../__pycache__/button.cpython-314.pyc | Bin 4139 -> 4139 bytes .../__pycache__/device.cpython-314.pyc | Bin 4566 -> 4566 bytes .../__pycache__/entity.cpython-314.pyc | Bin 1754 -> 1754 bytes .../__pycache__/sensor.cpython-314.pyc | Bin 32394 -> 32394 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 2298 -> 2298 bytes .../add_alias_to_area.cpython-314.pyc | Bin 2471 -> 2471 bytes .../add_alias_to_floor.cpython-314.pyc | Bin 2482 -> 2482 bytes .../add_area_to_floor.cpython-314.pyc | Bin 2495 -> 2495 bytes .../add_device_to_area.cpython-314.pyc | Bin 2526 -> 2526 bytes .../add_entity_to_area.cpython-314.pyc | Bin 2500 -> 2500 bytes .../add_label_to_area.cpython-314.pyc | Bin 2656 -> 2770 bytes .../add_label_to_device.cpython-314.pyc | Bin 2695 -> 2810 bytes .../add_label_to_entity.cpython-314.pyc | Bin 2669 -> 2784 bytes .../__pycache__/create_area.cpython-314.pyc | Bin 2103 -> 2103 bytes .../__pycache__/create_floor.cpython-314.pyc | Bin 2296 -> 2296 bytes .../__pycache__/create_label.cpython-314.pyc | Bin 2692 -> 2692 bytes ...lete_all_orphaned_entities.cpython-314.pyc | Bin 2083 -> 2083 bytes .../__pycache__/delete_area.cpython-314.pyc | Bin 1744 -> 1744 bytes .../__pycache__/delete_floor.cpython-314.pyc | Bin 1750 -> 1750 bytes .../__pycache__/delete_label.cpython-314.pyc | Bin 1744 -> 1744 bytes .../disable_config_entry.cpython-314.pyc | Bin 2050 -> 2050 bytes .../disable_device.cpython-314.pyc | Bin 1941 -> 1941 bytes .../disable_entity.cpython-314.pyc | Bin 2019 -> 2019 bytes .../disable_polling.cpython-314.pyc | Bin 2109 -> 2109 bytes .../__pycache__/disable_user.cpython-314.pyc | Bin 2386 -> 2494 bytes .../enable_config_entry.cpython-314.pyc | Bin 1929 -> 1929 bytes .../__pycache__/enable_device.cpython-314.pyc | Bin 1927 -> 1927 bytes .../__pycache__/enable_entity.cpython-314.pyc | Bin 1927 -> 1927 bytes .../enable_polling.cpython-314.pyc | Bin 2106 -> 2106 bytes .../__pycache__/enable_user.cpython-314.pyc | Bin 2382 -> 2490 bytes .../__pycache__/hide_entity.cpython-314.pyc | Bin 2022 -> 2022 bytes .../ignore_all_discovered.cpython-314.pyc | Bin 3921 -> 3921 bytes ...orphaned_database_entities.cpython-314.pyc | Bin 3335 -> 3335 bytes .../remove_alias_from_area.cpython-314.pyc | Bin 2491 -> 2491 bytes .../remove_alias_from_floor.cpython-314.pyc | Bin 2500 -> 2500 bytes .../remove_area_from_floor.cpython-314.pyc | Bin 1922 -> 1922 bytes .../remove_device_from_area.cpython-314.pyc | Bin 1961 -> 1961 bytes .../remove_entity_from_area.cpython-314.pyc | Bin 1936 -> 1936 bytes .../remove_label_from_area.cpython-314.pyc | Bin 2684 -> 2798 bytes .../remove_label_from_device.cpython-314.pyc | Bin 2723 -> 2838 bytes .../remove_label_from_entity.cpython-314.pyc | Bin 2697 -> 2812 bytes .../__pycache__/rename_entity.cpython-314.pyc | Bin 2049 -> 2049 bytes .../__pycache__/restart.cpython-314.pyc | Bin 2692 -> 2692 bytes .../set_area_aliases.cpython-314.pyc | Bin 2349 -> 2349 bytes .../set_floor_aliases.cpython-314.pyc | Bin 2355 -> 2355 bytes .../__pycache__/unhide_entity.cpython-314.pyc | Bin 1925 -> 1925 bytes .../update_entity_id.cpython-314.pyc | Bin 1938 -> 1938 bytes .../services/add_label_to_area.py | 7 + .../services/add_label_to_device.py | 7 + .../services/add_label_to_entity.py | 7 + .../homeassistant/services/disable_user.py | 6 + .../homeassistant/services/enable_user.py | 6 + .../services/remove_label_from_area.py | 7 + .../services/remove_label_from_device.py | 7 + .../services/remove_label_from_entity.py | 7 + .../__pycache__/__init__.cpython-314.pyc | Bin 200 -> 200 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 3883 -> 3883 bytes .../__pycache__/create.cpython-314.pyc | Bin 5344 -> 1321 bytes .../__pycache__/decrement.cpython-314.pyc | Bin 2264 -> 2264 bytes .../__pycache__/delete.cpython-314.pyc | Bin 2246 -> 725 bytes .../__pycache__/increment.cpython-314.pyc | Bin 2264 -> 2264 bytes .../services/__pycache__/max.cpython-314.pyc | Bin 1487 -> 1487 bytes .../services/__pycache__/min.cpython-314.pyc | Bin 1487 -> 1487 bytes .../input_number/services/create.py | 88 +- .../input_number/services/delete.py | 40 +- .../__pycache__/__init__.cpython-314.pyc | Bin 200 -> 200 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 209 -> 209 bytes .../__pycache__/random.cpython-314.pyc | Bin 790 -> 790 bytes .../__pycache__/shuffle.cpython-314.pyc | Bin 1674 -> 1674 bytes .../services/__pycache__/sort.cpython-314.pyc | Bin 1630 -> 1630 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 199 -> 199 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 196 -> 196 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 194 -> 194 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 1190 -> 1190 bytes .../__pycache__/decrement.cpython-314.pyc | Bin 2489 -> 2489 bytes .../__pycache__/increment.cpython-314.pyc | Bin 2489 -> 2489 bytes .../services/__pycache__/max.cpython-314.pyc | Bin 1732 -> 1732 bytes .../services/__pycache__/min.cpython-314.pyc | Bin 1732 -> 1732 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 194 -> 194 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 203 -> 203 bytes .../add_device_tracker.cpython-314.pyc | Bin 2965 -> 2965 bytes .../remove_device_tracker.cpython-314.pyc | Bin 2999 -> 2999 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 197 -> 197 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 196 -> 196 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 205 -> 205 bytes .../import_statistics.cpython-314.pyc | Bin 4221 -> 4221 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 195 -> 195 bytes .../__pycache__/button.cpython-314.pyc | Bin 3561 -> 3561 bytes .../__pycache__/entity.cpython-314.pyc | Bin 1722 -> 1722 bytes .../repairs/__pycache__/event.cpython-314.pyc | Bin 3600 -> 3600 bytes .../__pycache__/sensor.cpython-314.pyc | Bin 6516 -> 6516 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 204 -> 204 bytes .../__pycache__/create.cpython-314.pyc | Bin 2828 -> 2828 bytes .../__pycache__/ignore_all.cpython-314.pyc | Bin 1595 -> 1600 bytes .../__pycache__/remove.cpython-314.pyc | Bin 1748 -> 1748 bytes .../__pycache__/unignore_all.cpython-314.pyc | Bin 1601 -> 1606 bytes .../ectoplasms/repairs/services/ignore_all.py | 4 +- .../repairs/services/unignore_all.py | 4 +- .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 194 -> 194 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 194 -> 194 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 203 -> 203 bytes .../__pycache__/random.cpython-314.pyc | Bin 2057 -> 2057 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 202 -> 202 bytes .../services/__pycache__/boo.cpython-314.pyc | Bin 1305 -> 1305 bytes .../__pycache__/random_fail.cpython-314.pyc | Bin 1455 -> 1455 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 199 -> 199 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 202 -> 202 bytes .../__pycache__/set_duration.cpython-314.pyc | Bin 2916 -> 2916 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 193 -> 193 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 201 -> 201 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 209 -> 209 bytes .../zone/__pycache__/__init__.cpython-314.pyc | Bin 192 -> 192 bytes .../__pycache__/__init__.cpython-314.pyc | Bin 201 -> 201 bytes .../__pycache__/create.cpython-314.pyc | Bin 1901 -> 1901 bytes .../__pycache__/delete.cpython-314.pyc | Bin 2911 -> 3077 bytes .../__pycache__/update.cpython-314.pyc | Bin 3153 -> 3153 bytes .../spook/ectoplasms/zone/services/delete.py | 10 +- .../integrations/spook_inverse/manifest.json | 2 +- .../spook_inverse/translations/nb_NO.json | 28 +- .../spook_inverse/translations/nn.json | 52 +- .../spook_inverse/translations/sr.json | 52 +- custom_components/spook/manifest.json | 12 +- custom_components/spook/repairs.py | 41 + custom_components/spook/services.py | 3 + custom_components/spook/services.yaml | 752 ++- custom_components/spook/translations/de.json | 16 +- .../spook/translations/en-GB.json | 11 +- custom_components/spook/translations/en.json | 462 +- .../spook/translations/es-419.json | 11 +- custom_components/spook/translations/es.json | 11 +- custom_components/spook/translations/fi.json | 11 +- custom_components/spook/translations/fr.json | 11 +- custom_components/spook/translations/it.json | 11 +- custom_components/spook/translations/nb.json | 1589 ++++- custom_components/spook/translations/nl.json | 11 +- custom_components/spook/translations/nn.json | 1618 ++++- .../spook/translations/pt-BR.json | 11 +- custom_components/spook/translations/pt.json | 11 +- custom_components/spook/translations/sk.json | 9 +- .../spook/translations/sr-Latn.json | 32 +- custom_components/spook/translations/sr.json | 1810 +++++- custom_components/spook/translations/sv.json | 11 +- .../spook/translations/zh-Hans.json | 11 +- .../spook/translations/zh-Hant.json | 11 +- custom_components/spook/triggers.yaml | 3 - custom_components/taskmate/__init__.py | 333 +- custom_components/taskmate/button.py | 37 +- custom_components/taskmate/calendar.py | 236 +- custom_components/taskmate/const.py | 118 + .../taskmate/coord_assignments.py | 11 + custom_components/taskmate/coord_badges.py | 9 + custom_components/taskmate/coord_calendar.py | 242 +- custom_components/taskmate/coord_chores.py | 511 +- custom_components/taskmate/coord_mandatory.py | 16 +- .../taskmate/coord_notifications.py | 476 +- custom_components/taskmate/coord_points.py | 250 +- custom_components/taskmate/coord_rewards.py | 64 +- custom_components/taskmate/coord_templates.py | 14 +- custom_components/taskmate/coord_timed.py | 11 +- custom_components/taskmate/coordinator.py | 255 +- custom_components/taskmate/frontend.py | 5 + custom_components/taskmate/ics.py | 4 +- custom_components/taskmate/manifest.json | 2 +- custom_components/taskmate/models.py | 558 +- custom_components/taskmate/sensor.py | 451 +- custom_components/taskmate/services.yaml | 664 ++ custom_components/taskmate/storage.py | 364 +- custom_components/taskmate/strings.json | 491 ++ .../taskmate/translations/da.json | 1387 +++++ .../taskmate/translations/de.json | 491 ++ .../taskmate/translations/en-GB.json | 491 ++ .../taskmate/translations/en.json | 491 ++ .../taskmate/translations/fr.json | 491 ++ .../taskmate/translations/nb.json | 491 ++ .../taskmate/translations/nn.json | 491 ++ .../taskmate/translations/pt-BR.json | 491 ++ .../taskmate/translations/pt.json | 491 ++ custom_components/taskmate/websocket.py | 376 +- .../taskmate/www/locales/da.json | 2859 +++++++++ .../taskmate/www/locales/de.json | 1046 +++- .../taskmate/www/locales/en-GB.json | 1046 +++- .../taskmate/www/locales/en.json | 1046 +++- .../taskmate/www/locales/fr.json | 1046 +++- .../taskmate/www/locales/nb.json | 1046 +++- .../taskmate/www/locales/nn.json | 1046 +++- .../taskmate/www/locales/pt-BR.json | 1046 +++- .../taskmate/www/locales/pt.json | 1046 +++- .../taskmate/www/taskmate-activity-card.js | 260 +- .../taskmate/www/taskmate-approvals-card.js | 258 +- .../taskmate/www/taskmate-attr-resolver.js | 16 + .../taskmate/www/taskmate-auction-card.js | 848 +++ .../taskmate/www/taskmate-badges-card.js | 31 +- .../taskmate/www/taskmate-bounty-card.js | 804 +++ .../taskmate/www/taskmate-calendar-card.js | 46 +- .../taskmate/www/taskmate-child-card.js | 751 ++- .../taskmate/www/taskmate-design.js | 91 +- .../taskmate/www/taskmate-family-goal-card.js | 12 +- .../taskmate/www/taskmate-graph-card.js | 6 +- .../taskmate/www/taskmate-incentive-card.js | 8 +- .../taskmate/www/taskmate-kiosk-card.js | 1511 +++++ .../taskmate/www/taskmate-leaderboard-card.js | 10 +- .../taskmate/www/taskmate-overview-card.js | 31 +- .../taskmate/www/taskmate-panel.js | 5499 +++++++++++++++-- .../www/taskmate-parent-dashboard-card.js | 24 +- .../taskmate/www/taskmate-points-card.js | 20 +- .../www/taskmate-points-display-card.js | 119 +- .../taskmate/www/taskmate-recap-card.js | 1249 ++++ .../taskmate/www/taskmate-reorder-card.js | 16 +- .../www/taskmate-reward-progress-card.js | 34 +- .../taskmate/www/taskmate-rewards-card.js | 102 +- .../taskmate/www/taskmate-routine-card.js | 87 +- .../taskmate/www/taskmate-streak-card.js | 35 +- .../taskmate/www/taskmate-weekly-card.js | 2 +- .../taskmate/www/taskmate-wishlist-card.js | 973 +++ www/community/lovelace-wallpanel/wallpanel.js | 2 +- .../lovelace-wallpanel/wallpanel.js.gz | Bin 70384 -> 70387 bytes zigbee2mqtt/state.json | 36 +- 456 files changed, 64951 insertions(+), 3828 deletions(-) rename custom_components/cafe/www/assets/{main-CCZArAkW.js => main-Dmz6EiZM.js} (97%) create mode 100644 custom_components/ha_mcp_tools/translations/az.json create mode 100644 custom_components/maintenance_supporter/data/regions/names_i18n.json create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/adopt-problem-sensors-dialog-G6OMYHFP.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/area-view-DOCESFOL.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/areas-view-EIIITWEQ.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-2SARE4MS.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-3WM7WAL2.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-45NFFEKB.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-4XNVTWGC.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-AHDRR46D.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-APJICCRG.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-E7KPGZZO.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-FQOUX6W2.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-GGJ6YWZO.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-GTEFDN23.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-JEWIFUZC.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-LEWJHPDY.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-ODPGZXCU.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-S7ZP4PVX.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-SCLV5YEV.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-UJICOAU3.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-UN244A6U.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-UVBHIULM.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-WUMSAU4G.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XCDM7D5I.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XSFV5MUM.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-YKVD2DJ5.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-YQT7IJJB.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-ZCC7RQPW.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-C2KNLAXY.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-OI2EBUCS.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-LYW4YDC6.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-VLMVLZ4U.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/settings-view-YNCYESZH.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/suggested-setups-dialog-DV6WXAWB.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-2CVAHRCG.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/budget-section-card-FYYZR3LV.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-2ARNLSF6.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-3MSNNIFG.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-4JW6SHXP.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-6BHUADHJ.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-C275ZO4V.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-IWH6LGYJ.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-N5LSMQW7.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/dialog-mount-BY7EKQPS.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/groups-section-card-DLDUVDMS.js create mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/vacation-section-card-R3FY4AUU.js create mode 100644 custom_components/taskmate/translations/da.json create mode 100644 custom_components/taskmate/www/locales/da.json create mode 100644 custom_components/taskmate/www/taskmate-auction-card.js create mode 100644 custom_components/taskmate/www/taskmate-bounty-card.js create mode 100644 custom_components/taskmate/www/taskmate-kiosk-card.js create mode 100644 custom_components/taskmate/www/taskmate-recap-card.js create mode 100644 custom_components/taskmate/www/taskmate-wishlist-card.js diff --git a/.ha_run.lock b/.ha_run.lock index 06067368..eeb93823 100644 --- a/.ha_run.lock +++ b/.ha_run.lock @@ -1 +1 @@ -{"pid": 71, "version": 1, "ha_version": "2026.9.4", "start_ts": 1790606782.812434} \ No newline at end of file +{"pid": 70, "version": 1, "ha_version": "2026.9.4", "start_ts": 1790832768.8204901} \ No newline at end of file diff --git a/.storage/lovelace_resources b/.storage/lovelace_resources index 0964f2a4..6f28dd72 100644 --- a/.storage/lovelace_resources +++ b/.storage/lovelace_resources @@ -81,117 +81,117 @@ }, { "id": "88b90f2b1d6b45f0b44bee786ee1a525", - "url": "/taskmate/taskmate-attr-resolver.js?v=5.8.0", + "url": "/taskmate/taskmate-attr-resolver.js?v=6.0.0", "type": "module" }, { "id": "0796c92931dd458e81dc9c2677248274", - "url": "/taskmate/taskmate-localize.js?v=5.8.0", + "url": "/taskmate/taskmate-localize.js?v=6.0.0", "type": "module" }, { "id": "d2e281920ac7409583eafff1f1db69bd", - "url": "/taskmate/taskmate-design.js?v=5.8.0", + "url": "/taskmate/taskmate-design.js?v=6.0.0", "type": "module" }, { "id": "9eae9632f0734480be5edd784b030673", - "url": "/taskmate/taskmate-badges-card.js?v=5.8.0", + "url": "/taskmate/taskmate-badges-card.js?v=6.0.0", "type": "module" }, { "id": "5df49cd8a4eb420497b5df22cb31362c", - "url": "/taskmate/taskmate-child-card.js?v=5.8.0", + "url": "/taskmate/taskmate-child-card.js?v=6.0.0", "type": "module" }, { "id": "b44c87d0d74f468cb96c5eabc340f9ee", - "url": "/taskmate/taskmate-rewards-card.js?v=5.8.0", + "url": "/taskmate/taskmate-rewards-card.js?v=6.0.0", "type": "module" }, { "id": "787a96f9c30548708165a48457c99feb", - "url": "/taskmate/taskmate-approvals-card.js?v=5.8.0", + "url": "/taskmate/taskmate-approvals-card.js?v=6.0.0", "type": "module" }, { "id": "84031597de424ad68e7c2bc66d06b72e", - "url": "/taskmate/taskmate-points-card.js?v=5.8.0", + "url": "/taskmate/taskmate-points-card.js?v=6.0.0", "type": "module" }, { "id": "02613225844746b699bfbfac9642eca2", - "url": "/taskmate/taskmate-reorder-card.js?v=5.8.0", + "url": "/taskmate/taskmate-reorder-card.js?v=6.0.0", "type": "module" }, { "id": "7a06a07e17ba4b31b712bc91b77360b4", - "url": "/taskmate/taskmate-overview-card.js?v=5.8.0", + "url": "/taskmate/taskmate-overview-card.js?v=6.0.0", "type": "module" }, { "id": "08b42b53b33b4fa88db932455cf8d5aa", - "url": "/taskmate/taskmate-activity-card.js?v=5.8.0", + "url": "/taskmate/taskmate-activity-card.js?v=6.0.0", "type": "module" }, { "id": "15907eff51784acdba88ff694b574509", - "url": "/taskmate/taskmate-streak-card.js?v=5.8.0", + "url": "/taskmate/taskmate-streak-card.js?v=6.0.0", "type": "module" }, { "id": "1bd6bb5c0a6d4f0d916e3d82cb7fac39", - "url": "/taskmate/taskmate-weekly-card.js?v=5.8.0", + "url": "/taskmate/taskmate-weekly-card.js?v=6.0.0", "type": "module" }, { "id": "289ce5943f5a4972a593697db4c96ece", - "url": "/taskmate/taskmate-graph-card.js?v=5.8.0", + "url": "/taskmate/taskmate-graph-card.js?v=6.0.0", "type": "module" }, { "id": "d2904acee4c74a398dcc7b996c23e7e7", - "url": "/taskmate/taskmate-reward-progress-card.js?v=5.8.0", + "url": "/taskmate/taskmate-reward-progress-card.js?v=6.0.0", "type": "module" }, { "id": "46d378736fd54a26be253f2dfb27202e", - "url": "/taskmate/taskmate-leaderboard-card.js?v=5.8.0", + "url": "/taskmate/taskmate-leaderboard-card.js?v=6.0.0", "type": "module" }, { "id": "db11ae36457842fa826c7991e1d9c6f4", - "url": "/taskmate/taskmate-parent-dashboard-card.js?v=5.8.0", + "url": "/taskmate/taskmate-parent-dashboard-card.js?v=6.0.0", "type": "module" }, { "id": "ce85f301b59a412e9abfe5ffd51cb9a2", - "url": "/taskmate/taskmate-penalties-card.js?v=5.8.0", + "url": "/taskmate/taskmate-penalties-card.js?v=6.0.0", "type": "module" }, { "id": "1959e1629de2422daa8adaf87069c288", - "url": "/taskmate/taskmate-bonuses-card.js?v=5.8.0", + "url": "/taskmate/taskmate-bonuses-card.js?v=6.0.0", "type": "module" }, { "id": "2548524b269c4959bc7e0e967df943af", - "url": "/taskmate/taskmate-points-display-card.js?v=5.8.0", + "url": "/taskmate/taskmate-points-display-card.js?v=6.0.0", "type": "module" }, { "id": "36ada49368db4187a283fbbbef45454f", - "url": "/taskmate/taskmate-calendar-card.js?v=5.8.0", + "url": "/taskmate/taskmate-calendar-card.js?v=6.0.0", "type": "module" }, { "id": "67c32687acd2497b90030ef141f4b6db", - "url": "/taskmate/taskmate-photo-gallery-card.js?v=5.8.0", + "url": "/taskmate/taskmate-photo-gallery-card.js?v=6.0.0", "type": "module" }, { "id": "6f0c8348a91f4b74a9b846ab3f62621f", - "url": "/taskmate/taskmate-family-goal-card.js?v=5.8.0", + "url": "/taskmate/taskmate-family-goal-card.js?v=6.0.0", "type": "module" }, { @@ -206,7 +206,7 @@ }, { "id": "d3c3e144a91247ce8ac524814737d7f8", - "url": "/hacsfiles/lovelace-wallpanel/wallpanel.js?hacstag=3095064164671", + "url": "/hacsfiles/lovelace-wallpanel/wallpanel.js?hacstag=3095064164672", "type": "module" }, { @@ -276,7 +276,7 @@ }, { "id": "73dbd2de03de4530b451a55bfe6c46cf", - "url": "/taskmate/taskmate-routine-card.js?v=5.8.0", + "url": "/taskmate/taskmate-routine-card.js?v=6.0.0", "type": "module" }, { @@ -311,7 +311,7 @@ }, { "id": "1a4939ce1d2b47f89502176d3c5ac6e7", - "url": "/taskmate/taskmate-sounds.js?v=5.8.0", + "url": "/taskmate/taskmate-sounds.js?v=6.0.0", "type": "module" }, { @@ -330,9 +330,34 @@ "type": "module" }, { - "id": "7cc520964e2c49a9b0165fff4dca3b43", + "id": "b565f1e0ecff475cb08da3a0a882d1c2", "url": "/climate_scheduler/static/climate-scheduler-card.js?v=1.15.1", "type": "module" + }, + { + "id": "2cc757922cd142b69ce8844afc0e8410", + "url": "/taskmate/taskmate-wishlist-card.js?v=6.0.0", + "type": "module" + }, + { + "id": "107319877a72413fbbea40b7f8adb06c", + "url": "/taskmate/taskmate-kiosk-card.js?v=6.0.0", + "type": "module" + }, + { + "id": "5a2899c29e9046c78f060580ba113d9f", + "url": "/taskmate/taskmate-bounty-card.js?v=6.0.0", + "type": "module" + }, + { + "id": "a1aae7e334ba4c2d8dd3849178f780f6", + "url": "/taskmate/taskmate-auction-card.js?v=6.0.0", + "type": "module" + }, + { + "id": "464b73198b7d4fe480c09bbf386a4e5d", + "url": "/taskmate/taskmate-recap-card.js?v=6.0.0", + "type": "module" } ] } diff --git a/custom_components/cafe/manifest.json b/custom_components/cafe/manifest.json index d0378f70..2e2bd161 100644 --- a/custom_components/cafe/manifest.json +++ b/custom_components/cafe/manifest.json @@ -1,7 +1,7 @@ { "domain": "cafe", "name": "C.A.F.E.", - "version": "0.10.0", + "version": "0.10.1", "codeowners": [], "config_flow": true, "dependencies": ["frontend", "http"], diff --git a/custom_components/cafe/www/assets/main-CCZArAkW.js b/custom_components/cafe/www/assets/main-Dmz6EiZM.js similarity index 97% rename from custom_components/cafe/www/assets/main-CCZArAkW.js rename to custom_components/cafe/www/assets/main-Dmz6EiZM.js index da1a2dfd..4c497c31 100644 --- a/custom_components/cafe/www/assets/main-CCZArAkW.js +++ b/custom_components/cafe/www/assets/main-Dmz6EiZM.js @@ -564,7 +564,7 @@ trigger: action: - service: notify.mobile_app data: - message: "Light turned on!"`,className:"h-64 resize-none font-mono text-sm",disabled:b}),E&&I.jsxs(dA,{variant:"destructive",children:[I.jsx(kw,{className:"h-4 w-4"}),I.jsxs(fA,{className:"font-medium",children:[c("dialogs:importYaml.importFailed"),I.jsx("pre",{className:"mt-1 whitespace-pre-wrap font-mono text-xs",children:E})]})]}),_.length>0&&I.jsxs(dA,{children:[I.jsx(kw,{className:"h-4 w-4"}),I.jsxs(fA,{children:[I.jsx("p",{className:"mb-1 font-medium",children:c("dialogs:importYaml.warnings")}),I.jsx("ul",{className:"space-y-1 text-xs",children:_.map((B,$)=>I.jsxs("li",{children:["•"," ",B]},`warning-${$}-${B.slice(0,20)}`))})]})]}),b&&!E&&I.jsxs(dA,{children:[I.jsx(SGt,{className:"h-4 w-4"}),I.jsx(fA,{children:c("dialogs:importYaml.successLoading")})]}),I.jsx(dA,{children:I.jsxs(fA,{className:"text-xs",children:[I.jsx("strong",{children:c("dialogs:importYaml.tipLabel")})," ",c("dialogs:importYaml.tipText")]})})]}),I.jsxs("div",{className:"flex items-center justify-end gap-2 pt-4",children:[I.jsx(mi,{variant:"outline",onClick:D,disabled:b,children:c("buttons.cancel")}),I.jsxs(mi,{onClick:L,disabled:!d.trim()||b,children:[I.jsx(GPn,{className:"mr-2 h-4 w-4"}),c(b?"dialogs:importYaml.importing":"dialogs:importYaml.import")]})]})]})})}const s$t="0.10.0",BKt="4rem";function Xtr({expanded:n,isRemote:i=!1,configUrl:s,connectionError:c}){const{t:d}=jo(["common","errors","dialogs"]);return n?I.jsxs("div",{className:"flex flex-col gap-2 border-t p-4",children:[I.jsxs("div",{className:"flex items-center gap-4",children:[i&&s&&I.jsx("span",{className:"text-green-600 text-xs",children:d("status.connectedTo",{hostname:new URL(s).hostname})}),c&&I.jsx("span",{className:"text-red-600 text-xs",children:c})]}),I.jsx("div",{className:"text-muted-foreground text-xs",children:I.jsxs("span",{children:[d("titles.appName")," ",`v${s$t}`]})})]}):I.jsxs("div",{className:"flex flex-col items-center gap-2 border-t px-2 py-3",children:[i&&s&&I.jsx("span",{role:"img",title:d("status.connectedTo",{hostname:new URL(s).hostname}),"aria-label":d("status.connectedTo",{hostname:new URL(s).hostname}),children:I.jsx(IGt,{className:"h-4 w-4 text-green-600"})}),I.jsx("span",{className:"font-medium text-[10px] text-muted-foreground",children:`v${s$t}`})]})}function Ztr({expanded:n,onToggle:i,layout:s="desktop",className:c,isRemote:d=!1,configUrl:g,connectionError:b}){const{t:w}=jo(["common","errors","dialogs"]),E=s==="compact"&&!n?{width:BKt}:void 0,S=s==="compact"?nr("absolute top-0 bottom-0 left-0 z-40 flex min-h-0 flex-col border-border border-r transition-[width] duration-300",n?"w-full bg-card":"bg-card"):nr("flex h-full min-h-0 flex-col border-border border-r bg-card transition-[width] duration-300",n?"w-72":"w-20");return I.jsxs("aside",{className:nr(S,c),style:E,children:[I.jsx("div",{className:"flex h-14 items-center justify-between border-b px-4",children:n?I.jsxs(I.Fragment,{children:[I.jsx("h3",{className:"shrink-0 whitespace-nowrap font-semibold text-sm",children:w("labels.addNode")}),I.jsx(mi,{variant:"ghost",size:"icon",onClick:i,"aria-label":w("buttons.collapseMenu"),title:w("buttons.collapseMenu"),children:I.jsx(mPn,{className:"h-4 w-4"})})]}):I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"w-0"}),I.jsx(mi,{variant:"ghost",size:"icon",onClick:i,"aria-label":w("buttons.expandMenu"),title:w("buttons.expandMenu"),children:I.jsx(yPn,{className:"h-4 w-4"})})]})}),I.jsxs("div",{className:nr("min-h-0 flex-1",n?"overflow-auto":"overflow-hidden"),children:[I.jsx(XQn,{iconOnly:!n}),n&&I.jsxs("div",{className:"border-t p-4",children:[I.jsx("h4",{className:"mb-2 font-medium text-muted-foreground text-xs",children:w("labels.quickHelp")}),I.jsxs("ul",{className:"space-y-1 text-muted-foreground text-xs",children:[I.jsx("li",{children:w("help.clickNodesToAdd")}),I.jsx("li",{children:w("help.dragToConnect")}),I.jsx("li",{children:w("help.deleteToRemove")}),I.jsx("li",{children:w("help.backspaceDeleteKey")})]})]})]}),I.jsx(Xtr,{expanded:n,isRemote:d,configUrl:g,connectionError:b})]})}function H2({message:n}){return n?I.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-red-600 text-xs",children:[I.jsx(kw,{className:"h-3 w-3 flex-shrink-0"}),I.jsx("span",{children:n})]}):null}function No({label:n,required:i,description:s,children:c}){return I.jsxs("div",{className:"flex flex-col gap-2",children:[I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[n,i&&I.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),c,s&&I.jsx("p",{className:"text-muted-foreground text-xs",children:s})]})}const a$t={common:["id","alias","enabled","_conditionId"],trigger:["trigger","entity_id","to","from","for","at","event_type","event_data","event","offset","above","below","value_template","template","webhook_id","zone","topic","payload","hours","minutes","seconds","device_id","domain","type","subtype"],condition:["condition","entity_id","state","attribute","above","below","value_template","template","after","before","weekday","device_id","domain","type","subtype","zone","condition","for","conditions"],action:["service","data","target","response_variable","stop","error","entity_id","action","metadata"],delay:["delay"],wait:["wait_template","timeout","wait_for_trigger","continue_on_timeout"],set_variables:["variables"]};function c$t(n,i=[]){const s=[...a$t.common,...a$t[n]||[]];return new Set([...s,...i])}function vse(n,[i,s]){return Math.min(s,Math.max(i,n))}function u$t(n){const i=Qtr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(tnr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function Qtr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=rnr(d),w=nnr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var enr=Symbol("radix.slottable");function tnr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===enr}function nnr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function rnr(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}function Yae(n){const i=n+"CollectionProvider",[s,c]=Nw(i),[d,g]=s(i,{collectionRef:{current:null},itemMap:new Map}),b=D=>{const{scope:B,children:$}=D,P=Hn.useRef(null),j=Hn.useRef(new Map).current;return I.jsx(d,{scope:B,itemMap:j,collectionRef:P,children:$})};b.displayName=i;const w=n+"CollectionSlot",E=u$t(w),S=Hn.forwardRef((D,B)=>{const{scope:$,children:P}=D,j=g(w,$),z=ps(B,j.collectionRef);return I.jsx(E,{ref:z,children:P})});S.displayName=w;const _=n+"CollectionItemSlot",A="data-radix-collection-item",C=u$t(_),O=Hn.forwardRef((D,B)=>{const{scope:$,children:P,...j}=D,z=Hn.useRef(null),ee=ps(B,z),ne=g(_,$);return Hn.useEffect(()=>(ne.itemMap.set(z,{ref:z,...j}),()=>void ne.itemMap.delete(z))),I.jsx(C,{[A]:"",ref:ee,children:P})});O.displayName=_;function L(D){const B=g(n+"CollectionConsumer",D);return Hn.useCallback(()=>{const P=B.collectionRef.current;if(!P)return[];const j=Array.from(P.querySelectorAll(`[${A}]`));return Array.from(B.itemMap.values()).sort((ne,Q)=>j.indexOf(ne.ref.current)-j.indexOf(Q.ref.current))},[B.collectionRef,B.itemMap])}return[{Provider:b,Slot:S,ItemSlot:O},L,c]}var inr=H.createContext(void 0);function Bz(n){const i=H.useContext(inr);return n||i||"ltr"}function onr(n){const i=snr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(cnr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function snr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=lnr(d),w=unr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var anr=Symbol("radix.slottable");function cnr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===anr}function unr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function lnr(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}var UKt=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dnr="VisuallyHidden",fnr=H.forwardRef((n,i)=>I.jsx(no.span,{...n,ref:i,style:{...UKt,...n.style}}));fnr.displayName=dnr;var hnr=[" ","Enter","ArrowUp","ArrowDown"],pnr=[" ","Enter"],ER="Select",[Jae,Xae,gnr]=Yae(ER),[WM]=Nw(ER,[gnr,UM]),Zae=UM(),[bnr,xN]=WM(ER),[mnr,wnr]=WM(ER),HKt=n=>{const{__scopeSelect:i,children:s,open:c,defaultOpen:d,onOpenChange:g,value:b,defaultValue:w,onValueChange:E,dir:S,name:_,autoComplete:A,disabled:C,required:O,form:L}=n,D=Zae(i),[B,$]=H.useState(null),[P,j]=H.useState(null),[z,ee]=H.useState(!1),ne=Bz(S),[Q,ae]=G2({prop:c,defaultProp:d??!1,onChange:g,caller:ER}),[he,pe]=G2({prop:b,defaultProp:w,onChange:E,caller:ER}),ue=H.useRef(null),fe=B?L||!!B.closest("form"):!0,[K,ge]=H.useState(new Set),De=Array.from(K).map(Se=>Se.props.value).join(";");return I.jsx(aMe,{...D,children:I.jsxs(bnr,{required:O,scope:i,trigger:B,onTriggerChange:$,valueNode:P,onValueNodeChange:j,valueNodeHasChildren:z,onValueNodeHasChildrenChange:ee,contentId:Bh(),value:he,onValueChange:pe,open:Q,onOpenChange:ae,dir:ne,triggerPointerDownPosRef:ue,disabled:C,children:[I.jsx(Jae.Provider,{scope:i,children:I.jsx(mnr,{scope:n.__scopeSelect,onNativeOptionAdd:H.useCallback(Se=>{ge(Re=>new Set(Re).add(Se))},[]),onNativeOptionRemove:H.useCallback(Se=>{ge(Re=>{const Ae=new Set(Re);return Ae.delete(Se),Ae})},[]),children:s})}),fe?I.jsxs(fYt,{"aria-hidden":!0,required:O,tabIndex:-1,name:_,autoComplete:A,value:he,onChange:Se=>pe(Se.target.value),disabled:C,form:L,children:[he===void 0?I.jsx("option",{value:""}):null,Array.from(K)]},De):null]})})};HKt.displayName=ER;var zKt="SelectTrigger",GKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,disabled:c=!1,...d}=n,g=Zae(s),b=xN(zKt,s),w=b.disabled||c,E=ps(i,b.onTriggerChange),S=Xae(s),_=H.useRef("touch"),[A,C,O]=pYt(D=>{const B=S().filter(j=>!j.disabled),$=B.find(j=>j.value===b.value),P=gYt(B,D,$);P!==void 0&&b.onValueChange(P.value)}),L=D=>{w||(b.onOpenChange(!0),O()),D&&(b.triggerPointerDownPosRef.current={x:Math.round(D.pageX),y:Math.round(D.pageY)})};return I.jsx(Tae,{asChild:!0,...g,children:I.jsx(no.button,{type:"button",role:"combobox","aria-controls":b.contentId,"aria-expanded":b.open,"aria-required":b.required,"aria-autocomplete":"none",dir:b.dir,"data-state":b.open?"open":"closed",disabled:w,"data-disabled":w?"":void 0,"data-placeholder":hYt(b.value)?"":void 0,...d,ref:E,onClick:Dr(d.onClick,D=>{D.currentTarget.focus(),_.current!=="mouse"&&L(D)}),onPointerDown:Dr(d.onPointerDown,D=>{_.current=D.pointerType;const B=D.target;B.hasPointerCapture(D.pointerId)&&B.releasePointerCapture(D.pointerId),D.button===0&&D.ctrlKey===!1&&D.pointerType==="mouse"&&(L(D),D.preventDefault())}),onKeyDown:Dr(d.onKeyDown,D=>{const B=A.current!=="";!(D.ctrlKey||D.altKey||D.metaKey)&&D.key.length===1&&C(D.key),!(B&&D.key===" ")&&hnr.includes(D.key)&&(L(),D.preventDefault())})})})});GKt.displayName=zKt;var qKt="SelectValue",VKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,className:c,style:d,children:g,placeholder:b="",...w}=n,E=xN(qKt,s),{onValueNodeHasChildrenChange:S}=E,_=g!==void 0,A=ps(i,E.onValueNodeChange);return Up(()=>{S(_)},[S,_]),I.jsx(no.span,{...w,ref:A,style:{pointerEvents:"none"},children:hYt(E.value)?I.jsx(I.Fragment,{children:b}):g})});VKt.displayName=qKt;var ynr="SelectIcon",WKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,children:c,...d}=n;return I.jsx(no.span,{"aria-hidden":!0,...d,ref:i,children:c||"▼"})});WKt.displayName=ynr;var vnr="SelectPortal",KKt=n=>I.jsx(Oz,{asChild:!0,...n});KKt.displayName=vnr;var SR="SelectContent",YKt=H.forwardRef((n,i)=>{const s=xN(SR,n.__scopeSelect),[c,d]=H.useState();if(Up(()=>{d(new DocumentFragment)},[]),!s.open){const g=c;return g?xR.createPortal(I.jsx(JKt,{scope:n.__scopeSelect,children:I.jsx(Jae.Slot,{scope:n.__scopeSelect,children:I.jsx("div",{children:n.children})})}),g):null}return I.jsx(XKt,{...n,ref:i})});YKt.displayName=SR;var kv=10,[JKt,kN]=WM(SR),Enr="SelectContentImpl",Snr=onr("SelectContent.RemoveScroll"),XKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,position:c="item-aligned",onCloseAutoFocus:d,onEscapeKeyDown:g,onPointerDownOutside:b,side:w,sideOffset:E,align:S,alignOffset:_,arrowPadding:A,collisionBoundary:C,collisionPadding:O,sticky:L,hideWhenDetached:D,avoidCollisions:B,...$}=n,P=xN(SR,s),[j,z]=H.useState(null),[ee,ne]=H.useState(null),Q=ps(i,Et=>z(Et)),[ae,he]=H.useState(null),[pe,ue]=H.useState(null),fe=Xae(s),[K,ge]=H.useState(!1),De=H.useRef(!1);H.useEffect(()=>{if(j)return lae(j)},[j]),cae();const Se=H.useCallback(Et=>{const[Dt,...Yt]=fe().map(Yn=>Yn.ref.current),[Ln]=Yt.slice(-1),Zn=document.activeElement;for(const Yn of Et)if(Yn===Zn||(Yn==null||Yn.scrollIntoView({block:"nearest"}),Yn===Dt&&ee&&(ee.scrollTop=0),Yn===Ln&&ee&&(ee.scrollTop=ee.scrollHeight),Yn==null||Yn.focus(),document.activeElement!==Zn))return},[fe,ee]),Re=H.useCallback(()=>Se([ae,j]),[Se,ae,j]);H.useEffect(()=>{K&&Re()},[K,Re]);const{onOpenChange:Ae,triggerPointerDownPosRef:xe}=P;H.useEffect(()=>{if(j){let Et={x:0,y:0};const Dt=Ln=>{var Zn,Yn;Et={x:Math.abs(Math.round(Ln.pageX)-(((Zn=xe.current)==null?void 0:Zn.x)??0)),y:Math.abs(Math.round(Ln.pageY)-(((Yn=xe.current)==null?void 0:Yn.y)??0))}},Yt=Ln=>{Et.x<=10&&Et.y<=10?Ln.preventDefault():j.contains(Ln.target)||Ae(!1),document.removeEventListener("pointermove",Dt),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Dt),document.addEventListener("pointerup",Yt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Dt),document.removeEventListener("pointerup",Yt,{capture:!0})}}},[j,Ae,xe]),H.useEffect(()=>{const Et=()=>Ae(!1);return window.addEventListener("blur",Et),window.addEventListener("resize",Et),()=>{window.removeEventListener("blur",Et),window.removeEventListener("resize",Et)}},[Ae]);const[We,ut]=pYt(Et=>{const Dt=fe().filter(Zn=>!Zn.disabled),Yt=Dt.find(Zn=>Zn.ref.current===document.activeElement),Ln=gYt(Dt,Et,Yt);Ln&&setTimeout(()=>Ln.ref.current.focus())}),Be=H.useCallback((Et,Dt,Yt)=>{const Ln=!De.current&&!Yt;(P.value!==void 0&&P.value===Dt||Ln)&&(he(Et),Ln&&(De.current=!0))},[P.value]),bt=H.useCallback(()=>j==null?void 0:j.focus(),[j]),Nt=H.useCallback((Et,Dt,Yt)=>{const Ln=!De.current&&!Yt;(P.value!==void 0&&P.value===Dt||Ln)&&ue(Et)},[P.value]),pt=c==="popper"?eLe:ZKt,Kt=pt===eLe?{side:w,sideOffset:E,align:S,alignOffset:_,arrowPadding:A,collisionBoundary:C,collisionPadding:O,sticky:L,hideWhenDetached:D,avoidCollisions:B}:{};return I.jsx(JKt,{scope:s,content:j,viewport:ee,onViewportChange:ne,itemRefCallback:Be,selectedItem:ae,onItemLeave:bt,itemTextRefCallback:Nt,focusSelectedItem:Re,selectedItemText:pe,position:c,isPositioned:K,searchRef:We,children:I.jsx(Dz,{as:Snr,allowPinchZoom:!0,children:I.jsx(Rz,{asChild:!0,trapped:P.open,onMountAutoFocus:Et=>{Et.preventDefault()},onUnmountAutoFocus:Dr(d,Et=>{var Dt;(Dt=P.trigger)==null||Dt.focus({preventScroll:!0}),Et.preventDefault()}),children:I.jsx(Iz,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:Et=>Et.preventDefault(),onDismiss:()=>P.onOpenChange(!1),children:I.jsx(pt,{role:"listbox",id:P.contentId,"data-state":P.open?"open":"closed",dir:P.dir,onContextMenu:Et=>Et.preventDefault(),...$,...Kt,onPlaced:()=>ge(!0),ref:Q,style:{display:"flex",flexDirection:"column",outline:"none",...$.style},onKeyDown:Dr($.onKeyDown,Et=>{const Dt=Et.ctrlKey||Et.altKey||Et.metaKey;if(Et.key==="Tab"&&Et.preventDefault(),!Dt&&Et.key.length===1&&ut(Et.key),["ArrowUp","ArrowDown","Home","End"].includes(Et.key)){let Ln=fe().filter(Zn=>!Zn.disabled).map(Zn=>Zn.ref.current);if(["ArrowUp","End"].includes(Et.key)&&(Ln=Ln.slice().reverse()),["ArrowUp","ArrowDown"].includes(Et.key)){const Zn=Et.target,Yn=Ln.indexOf(Zn);Ln=Ln.slice(Yn+1)}setTimeout(()=>Se(Ln)),Et.preventDefault()}})})})})})})});XKt.displayName=Enr;var Tnr="SelectItemAlignedPosition",ZKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,onPlaced:c,...d}=n,g=xN(SR,s),b=kN(SR,s),[w,E]=H.useState(null),[S,_]=H.useState(null),A=ps(i,Q=>_(Q)),C=Xae(s),O=H.useRef(!1),L=H.useRef(!0),{viewport:D,selectedItem:B,selectedItemText:$,focusSelectedItem:P}=b,j=H.useCallback(()=>{if(g.trigger&&g.valueNode&&w&&S&&D&&B&&$){const Q=g.trigger.getBoundingClientRect(),ae=S.getBoundingClientRect(),he=g.valueNode.getBoundingClientRect(),pe=$.getBoundingClientRect();if(g.dir!=="rtl"){const Zn=pe.left-ae.left,Yn=he.left-Zn,Er=Q.left-Yn,Ui=Q.width+Er,Qr=Math.max(Ui,ae.width),Hi=window.innerWidth-kv,ai=vse(Yn,[kv,Math.max(kv,Hi-Qr)]);w.style.minWidth=Ui+"px",w.style.left=ai+"px"}else{const Zn=ae.right-pe.right,Yn=window.innerWidth-he.right-Zn,Er=window.innerWidth-Q.right-Yn,Ui=Q.width+Er,Qr=Math.max(Ui,ae.width),Hi=window.innerWidth-kv,ai=vse(Yn,[kv,Math.max(kv,Hi-Qr)]);w.style.minWidth=Ui+"px",w.style.right=ai+"px"}const ue=C(),fe=window.innerHeight-kv*2,K=D.scrollHeight,ge=window.getComputedStyle(S),De=parseInt(ge.borderTopWidth,10),Se=parseInt(ge.paddingTop,10),Re=parseInt(ge.borderBottomWidth,10),Ae=parseInt(ge.paddingBottom,10),xe=De+Se+K+Ae+Re,We=Math.min(B.offsetHeight*5,xe),ut=window.getComputedStyle(D),Be=parseInt(ut.paddingTop,10),bt=parseInt(ut.paddingBottom,10),Nt=Q.top+Q.height/2-kv,pt=fe-Nt,Kt=B.offsetHeight/2,Et=B.offsetTop+Kt,Dt=De+Se+Et,Yt=xe-Dt;if(Dt<=Nt){const Zn=ue.length>0&&B===ue[ue.length-1].ref.current;w.style.bottom="0px";const Yn=S.clientHeight-D.offsetTop-D.offsetHeight,Er=Math.max(pt,Kt+(Zn?bt:0)+Yn+Re),Ui=Dt+Er;w.style.height=Ui+"px"}else{const Zn=ue.length>0&&B===ue[0].ref.current;w.style.top="0px";const Er=Math.max(Nt,De+D.offsetTop+(Zn?Be:0)+Kt)+Yt;w.style.height=Er+"px",D.scrollTop=Dt-Nt+D.offsetTop}w.style.margin=`${kv}px 0`,w.style.minHeight=We+"px",w.style.maxHeight=fe+"px",c==null||c(),requestAnimationFrame(()=>O.current=!0)}},[C,g.trigger,g.valueNode,w,S,D,B,$,g.dir,c]);Up(()=>j(),[j]);const[z,ee]=H.useState();Up(()=>{S&&ee(window.getComputedStyle(S).zIndex)},[S]);const ne=H.useCallback(Q=>{Q&&L.current===!0&&(j(),P==null||P(),L.current=!1)},[j,P]);return I.jsx(_nr,{scope:s,contentWrapper:w,shouldExpandOnScrollRef:O,onScrollButtonChange:ne,children:I.jsx("div",{ref:E,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:I.jsx(no.div,{...d,ref:A,style:{boxSizing:"border-box",maxHeight:"100%",...d.style}})})})});ZKt.displayName=Tnr;var Anr="SelectPopperPosition",eLe=H.forwardRef((n,i)=>{const{__scopeSelect:s,align:c="start",collisionPadding:d=kv,...g}=n,b=Zae(s);return I.jsx(cMe,{...b,...g,ref:i,align:c,collisionPadding:d,style:{boxSizing:"border-box",...g.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});eLe.displayName=Anr;var[_nr,ZMe]=WM(SR,{}),tLe="SelectViewport",QKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,nonce:c,...d}=n,g=kN(tLe,s),b=ZMe(tLe,s),w=ps(i,g.onViewportChange),E=H.useRef(0);return I.jsxs(I.Fragment,{children:[I.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),I.jsx(Jae.Slot,{scope:s,children:I.jsx(no.div,{"data-radix-select-viewport":"",role:"presentation",...d,ref:w,style:{position:"relative",flex:1,overflow:"hidden auto",...d.style},onScroll:Dr(d.onScroll,S=>{const _=S.currentTarget,{contentWrapper:A,shouldExpandOnScrollRef:C}=b;if(C!=null&&C.current&&A){const O=Math.abs(E.current-_.scrollTop);if(O>0){const L=window.innerHeight-kv*2,D=parseFloat(A.style.minHeight),B=parseFloat(A.style.height),$=Math.max(D,B);if($0?z:0,A.style.justifyContent="flex-end")}}}E.current=_.scrollTop})})})]})});QKt.displayName=tLe;var eYt="SelectGroup",[xnr,knr]=WM(eYt),Nnr=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=Bh();return I.jsx(xnr,{scope:s,id:d,children:I.jsx(no.div,{role:"group","aria-labelledby":d,...c,ref:i})})});Nnr.displayName=eYt;var tYt="SelectLabel",nYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=knr(tYt,s);return I.jsx(no.div,{id:d.id,...c,ref:i})});nYt.displayName=tYt;var Ese="SelectItem",[Cnr,rYt]=WM(Ese),iYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,value:c,disabled:d=!1,textValue:g,...b}=n,w=xN(Ese,s),E=kN(Ese,s),S=w.value===c,[_,A]=H.useState(g??""),[C,O]=H.useState(!1),L=ps(i,P=>{var j;return(j=E.itemRefCallback)==null?void 0:j.call(E,P,c,d)}),D=Bh(),B=H.useRef("touch"),$=()=>{d||(w.onValueChange(c),w.onOpenChange(!1))};if(c==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return I.jsx(Cnr,{scope:s,value:c,disabled:d,textId:D,isSelected:S,onItemTextChange:H.useCallback(P=>{A(j=>j||((P==null?void 0:P.textContent)??"").trim())},[]),children:I.jsx(Jae.ItemSlot,{scope:s,value:c,disabled:d,textValue:_,children:I.jsx(no.div,{role:"option","aria-labelledby":D,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":d||void 0,"data-disabled":d?"":void 0,tabIndex:d?void 0:-1,...b,ref:L,onFocus:Dr(b.onFocus,()=>O(!0)),onBlur:Dr(b.onBlur,()=>O(!1)),onClick:Dr(b.onClick,()=>{B.current!=="mouse"&&$()}),onPointerUp:Dr(b.onPointerUp,()=>{B.current==="mouse"&&$()}),onPointerDown:Dr(b.onPointerDown,P=>{B.current=P.pointerType}),onPointerMove:Dr(b.onPointerMove,P=>{var j;B.current=P.pointerType,d?(j=E.onItemLeave)==null||j.call(E):B.current==="mouse"&&P.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Dr(b.onPointerLeave,P=>{var j;P.currentTarget===document.activeElement&&((j=E.onItemLeave)==null||j.call(E))}),onKeyDown:Dr(b.onKeyDown,P=>{var z;((z=E.searchRef)==null?void 0:z.current)!==""&&P.key===" "||(pnr.includes(P.key)&&$(),P.key===" "&&P.preventDefault())})})})})});iYt.displayName=Ese;var oH="SelectItemText",oYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,className:c,style:d,...g}=n,b=xN(oH,s),w=kN(oH,s),E=rYt(oH,s),S=wnr(oH,s),[_,A]=H.useState(null),C=ps(i,$=>A($),E.onItemTextChange,$=>{var P;return(P=w.itemTextRefCallback)==null?void 0:P.call(w,$,E.value,E.disabled)}),O=_==null?void 0:_.textContent,L=H.useMemo(()=>I.jsx("option",{value:E.value,disabled:E.disabled,children:O},E.value),[E.disabled,E.value,O]),{onNativeOptionAdd:D,onNativeOptionRemove:B}=S;return Up(()=>(D(L),()=>B(L)),[D,B,L]),I.jsxs(I.Fragment,{children:[I.jsx(no.span,{id:E.textId,...g,ref:C}),E.isSelected&&b.valueNode&&!b.valueNodeHasChildren?xR.createPortal(g.children,b.valueNode):null]})});oYt.displayName=oH;var sYt="SelectItemIndicator",aYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n;return rYt(sYt,s).isSelected?I.jsx(no.span,{"aria-hidden":!0,...c,ref:i}):null});aYt.displayName=sYt;var nLe="SelectScrollUpButton",cYt=H.forwardRef((n,i)=>{const s=kN(nLe,n.__scopeSelect),c=ZMe(nLe,n.__scopeSelect),[d,g]=H.useState(!1),b=ps(i,c.onScrollButtonChange);return Up(()=>{if(s.viewport&&s.isPositioned){let w=function(){const S=E.scrollTop>0;g(S)};const E=s.viewport;return w(),E.addEventListener("scroll",w),()=>E.removeEventListener("scroll",w)}},[s.viewport,s.isPositioned]),d?I.jsx(lYt,{...n,ref:b,onAutoScroll:()=>{const{viewport:w,selectedItem:E}=s;w&&E&&(w.scrollTop=w.scrollTop-E.offsetHeight)}}):null});cYt.displayName=nLe;var rLe="SelectScrollDownButton",uYt=H.forwardRef((n,i)=>{const s=kN(rLe,n.__scopeSelect),c=ZMe(rLe,n.__scopeSelect),[d,g]=H.useState(!1),b=ps(i,c.onScrollButtonChange);return Up(()=>{if(s.viewport&&s.isPositioned){let w=function(){const S=E.scrollHeight-E.clientHeight,_=Math.ceil(E.scrollTop)E.removeEventListener("scroll",w)}},[s.viewport,s.isPositioned]),d?I.jsx(lYt,{...n,ref:b,onAutoScroll:()=>{const{viewport:w,selectedItem:E}=s;w&&E&&(w.scrollTop=w.scrollTop+E.offsetHeight)}}):null});uYt.displayName=rLe;var lYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,onAutoScroll:c,...d}=n,g=kN("SelectScrollButton",s),b=H.useRef(null),w=Xae(s),E=H.useCallback(()=>{b.current!==null&&(window.clearInterval(b.current),b.current=null)},[]);return H.useEffect(()=>()=>E(),[E]),Up(()=>{var _;const S=w().find(A=>A.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[w]),I.jsx(no.div,{"aria-hidden":!0,...d,ref:i,style:{flexShrink:0,...d.style},onPointerDown:Dr(d.onPointerDown,()=>{b.current===null&&(b.current=window.setInterval(c,50))}),onPointerMove:Dr(d.onPointerMove,()=>{var S;(S=g.onItemLeave)==null||S.call(g),b.current===null&&(b.current=window.setInterval(c,50))}),onPointerLeave:Dr(d.onPointerLeave,()=>{E()})})}),Inr="SelectSeparator",dYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n;return I.jsx(no.div,{"aria-hidden":!0,...c,ref:i})});dYt.displayName=Inr;var iLe="SelectArrow",Rnr=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=Zae(s),g=xN(iLe,s),b=kN(iLe,s);return g.open&&b.position==="popper"?I.jsx(uMe,{...d,...c,ref:i}):null});Rnr.displayName=iLe;var Onr="SelectBubbleInput",fYt=H.forwardRef(({__scopeSelect:n,value:i,...s},c)=>{const d=H.useRef(null),g=ps(c,d),b=Vae(i);return H.useEffect(()=>{const w=d.current;if(!w)return;const E=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(E,"value").set;if(b!==i&&_){const A=new Event("change",{bubbles:!0});_.call(w,i),w.dispatchEvent(A)}},[b,i]),I.jsx(no.select,{...s,style:{...UKt,...s.style},ref:g,defaultValue:i})});fYt.displayName=Onr;function hYt(n){return n===""||n===void 0}function pYt(n){const i=q2(n),s=H.useRef(""),c=H.useRef(0),d=H.useCallback(b=>{const w=s.current+b;i(w),function E(S){s.current=S,window.clearTimeout(c.current),S!==""&&(c.current=window.setTimeout(()=>E(""),1e3))}(w)},[i]),g=H.useCallback(()=>{s.current="",window.clearTimeout(c.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(c.current),[]),[s,d,g]}function gYt(n,i,s){const d=i.length>1&&Array.from(i).every(S=>S===i[0])?i[0]:i,g=s?n.indexOf(s):-1;let b=Dnr(n,Math.max(g,0));d.length===1&&(b=b.filter(S=>S!==s));const E=b.find(S=>S.textValue.toLowerCase().startsWith(d.toLowerCase()));return E!==s?E:void 0}function Dnr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}var Lnr=HKt,bYt=GKt,Mnr=VKt,Pnr=WKt,jnr=KKt,mYt=YKt,Fnr=QKt,wYt=nYt,yYt=iYt,$nr=oYt,Bnr=aYt,vYt=cYt,EYt=uYt,SYt=dYt;const zp=Lnr,Gp=Mnr,zh=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(bYt,{ref:c,className:nr("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",n),...s,children:[i,I.jsx(Pnr,{asChild:!0,children:I.jsx(oae,{className:"h-4 w-4 opacity-50"})})]}));zh.displayName=bYt.displayName;const TYt=H.forwardRef(({className:n,...i},s)=>I.jsx(vYt,{ref:s,className:nr("flex cursor-default items-center justify-center py-1",n),...i,children:I.jsx(R8n,{className:"h-4 w-4"})}));TYt.displayName=vYt.displayName;const AYt=H.forwardRef(({className:n,...i},s)=>I.jsx(EYt,{ref:s,className:nr("flex cursor-default items-center justify-center py-1",n),...i,children:I.jsx(oae,{className:"h-4 w-4"})}));AYt.displayName=EYt.displayName;const Gh=H.forwardRef(({className:n,children:i,position:s="popper",container:c,...d},g)=>I.jsx(jnr,{container:c,children:I.jsxs(mYt,{ref:g,className:nr("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in",s==="popper"&&"data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",n),position:s,...d,children:[I.jsx(TYt,{}),I.jsx(Fnr,{className:nr("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),I.jsx(AYt,{})]})}));Gh.displayName=mYt.displayName;const Unr=H.forwardRef(({className:n,...i},s)=>I.jsx(wYt,{ref:s,className:nr("px-2 py-1.5 font-semibold text-sm",n),...i}));Unr.displayName=wYt.displayName;const eo=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(yYt,{ref:c,className:nr("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...s,children:[I.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(Bnr,{children:I.jsx(oN,{className:"h-4 w-4"})})}),I.jsx($nr,{children:i})]}));eo.displayName=yYt.displayName;const Hnr=H.forwardRef(({className:n,...i},s)=>I.jsx(SYt,{ref:s,className:nr("-mx-1 my-1 h-px bg-muted",n),...i}));Hnr.displayName=SYt.displayName;const znr=["single","restart","queued","parallel"],Gnr=["silent","warning","critical"],l$t=new Set(["queued","parallel"]);function qnr(){const{t:n}=jo("common"),i=po(C=>C.flowName),s=po(C=>C.flowDescription),c=po(C=>C.setFlowName),d=po(C=>C.setFlowDescription),g=po(C=>C.flowMetadata),b=po(C=>C.setFlowMetadata),w=g.mode??"single",E=l$t.has(w),S=C=>{const O=C,L={mode:O};l$t.has(O)||(L.max=void 0,L.max_exceeded=void 0),b(L)},_=C=>{const O=Number.parseInt(C,10);C===""||Number.isNaN(O)?b({max:void 0}):O>0&&b({max:O})},A=C=>{b(C==="none"?{max_exceeded:void 0}:{max_exceeded:C})};return I.jsxs("div",{className:"h-full flex-1 space-y-4 overflow-y-auto p-4",children:[I.jsx("h3",{className:"mt-1.5 font-semibold text-foreground text-sm",children:n("automationSettings.title")}),I.jsx(No,{label:n("labels.automationName"),children:I.jsx(Na,{type:"text",value:i,onChange:C=>c(C.target.value),placeholder:n("placeholders.enterAutomationName")})}),I.jsx(No,{label:n("automationSettings.description"),children:I.jsx(Bv,{value:s,onChange:C=>d(C.target.value),placeholder:n("placeholders.describeAutomation"),rows:3})}),I.jsx($z,{}),I.jsxs(No,{label:n("automationSettings.mode"),description:n("automationSettings.modeDescription"),children:[I.jsxs(zp,{value:w,onValueChange:S,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsx(Gh,{children:znr.map(C=>I.jsx(eo,{value:C,children:n(`automationSettings.modes.${C}`)},C))})]}),I.jsx("p",{className:"text-muted-foreground text-xs",children:n(`automationSettings.modeDescriptions.${w}`)})]}),E&&I.jsxs(I.Fragment,{children:[I.jsx(No,{label:n("automationSettings.max"),description:n("automationSettings.maxDescription"),children:I.jsx(Na,{type:"number",min:1,value:g.max??"",onChange:C=>_(C.target.value),placeholder:"10"})}),g.max!=null&&I.jsx(No,{label:n("automationSettings.maxExceeded"),description:n("automationSettings.maxExceededDescription"),children:I.jsxs(zp,{value:g.max_exceeded??"none",onValueChange:A,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"none",children:n("placeholders.none")}),Gnr.map(C=>I.jsx(eo,{value:C,children:n(`automationSettings.maxExceededOptions.${C}`)},C))]})]})})]})]})}function _Yt({options:n,value:i,onChange:s,placeholder:c,className:d,buttonClassName:g,disabled:b=!1,renderOption:w,renderValue:E,searchKeys:S=["label","value"],fuzzyOptions:_={}}){const{t:A}=jo(["common"]),[C,O]=H.useState(!1),{query:L,setQuery:D,filteredItems:B}=gVt(n,{keys:S,threshold:.4,includeScore:!0,ignoreLocation:!0,includeMatches:!0,minMatchCharLength:1,..._}),$=n.find(j=>j.value===i),P=j=>{D(j)};return I.jsxs(dMe,{open:C,onOpenChange:O,children:[I.jsx(oVt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",role:"combobox","aria-expanded":C,className:nr("flex w-full justify-between",g),disabled:b,children:[$?E?E($):$.label:c||A("combobox.select"),I.jsx(EGt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),I.jsx(_ae,{className:nr("w-[286px] p-0",d),children:I.jsxs(pae,{shouldFilter:!1,children:[I.jsx(gae,{placeholder:c||A("combobox.select"),className:"h-9",value:L,onValueChange:P}),I.jsxs(bae,{children:[I.jsx(mae,{children:A("combobox.noOptions")}),I.jsx(nz,{children:B.map(j=>I.jsxs(rz,{value:j.value,onSelect:z=>{s(z===i?"":z),O(!1),D("")},children:[w?w(j):j.label,I.jsx(oN,{className:nr("ml-auto h-4 w-4",i===j.value?"opacity-100":"opacity-0")})]},j.value))})]})]})})]})}function oLe({values:n,onChange:i,placeholder:s="Add ID...",className:c}){const[d,g]=H.useState(""),b=()=>{const S=d.trim();S&&!n.includes(S)&&(i([...n,S]),g(""))},w=S=>{i(n.filter(_=>_!==S))},E=S=>{S.key==="Enter"&&(S.preventDefault(),b())};return I.jsxs("div",{className:nr("space-y-1",c),children:[I.jsxs("div",{className:"flex gap-1",children:[I.jsx(Na,{value:d,onChange:S=>g(S.target.value),onKeyDown:E,placeholder:s,className:"flex-1 font-mono text-xs"}),I.jsx(mi,{type:"button",size:"icon",variant:"outline",onClick:b,disabled:!d.trim(),children:I.jsx(sae,{className:"h-4 w-4"})})]}),n.length>0&&I.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(S=>I.jsxs("span",{className:"inline-flex items-center rounded border bg-muted px-2 py-0.5 font-mono text-muted-foreground text-xs",children:[S,I.jsx(aae,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>w(S)})]},S))})]})}const Vnr={light:{label:"Light",color:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-800 dark:text-yellow-200"},switch:{label:"Switch",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"},sensor:{label:"Sensor",color:"bg-green-100 dark:bg-green-900/50 text-green-800 dark:text-green-200"},binary_sensor:{label:"Binary Sensor",color:"bg-purple-100 dark:bg-purple-900/50 text-purple-800 dark:text-purple-200"},climate:{label:"Climate",color:"bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-200"},cover:{label:"Cover",color:"bg-indigo-100 dark:bg-indigo-900/50 text-indigo-800 dark:text-indigo-200"},fan:{label:"Fan",color:"bg-cyan-100 dark:bg-cyan-900/50 text-cyan-800 dark:text-cyan-200"},media_player:{label:"Media",color:"bg-pink-100 dark:bg-pink-900/50 text-pink-800 dark:text-pink-200"},automation:{label:"Automation",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},script:{label:"Script",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},scene:{label:"Scene",color:"bg-violet-100 dark:bg-violet-900/50 text-violet-800 dark:text-violet-200"},input_boolean:{label:"Input Bool",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_number:{label:"Input Num",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_select:{label:"Input Select",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_text:{label:"Input Text",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_datetime:{label:"Input Time",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},person:{label:"Person",color:"bg-amber-100 dark:bg-amber-900/50 text-amber-800 dark:text-amber-200"},device_tracker:{label:"Tracker",color:"bg-amber-100 dark:bg-amber-900/50 text-amber-800 dark:text-amber-200"},zone:{label:"Zone",color:"bg-lime-100 dark:bg-lime-900/50 text-lime-800 dark:text-lime-200"},sun:{label:"Sun",color:"bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-200"},weather:{label:"Weather",color:"bg-sky-100 dark:bg-sky-900/50 text-sky-800 dark:text-sky-200"},camera:{label:"Camera",color:"bg-rose-100 dark:bg-rose-900/50 text-rose-800 dark:text-rose-200"},remote:{label:"Remote",color:"bg-gray-100 dark:bg-gray-700/50 text-gray-800 dark:text-gray-200"},vacuum:{label:"Vacuum",color:"bg-teal-100 dark:bg-teal-900/50 text-teal-800 dark:text-teal-200"},lock:{label:"Lock",color:"bg-red-100 dark:bg-red-900/50 text-red-800 dark:text-red-200"},alarm_control_panel:{label:"Alarm",color:"bg-red-100 dark:bg-red-900/50 text-red-800 dark:text-red-200"},water_heater:{label:"Water Heater",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"},humidifier:{label:"Humidifier",color:"bg-cyan-100 dark:bg-cyan-900/50 text-cyan-800 dark:text-cyan-200"},button:{label:"Button",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},number:{label:"Number",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},select:{label:"Select",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},text:{label:"Text",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},update:{label:"Update",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"}};function Wnr(n){if(!n||typeof n!="string")return{label:"Unknown",color:"bg-gray-100 dark:bg-gray-700/50 text-gray-700 dark:text-gray-300"};const i=n.split(".")[0];return Vnr[i]||{label:i,color:"bg-gray-100 dark:bg-gray-700/50 text-gray-700 dark:text-gray-300"}}function Knr(n){return n.attributes.friendly_name||n.entity_id}function Sse({value:n,onChange:i,entities:s,placeholder:c="Select entity...",className:d,domainFilter:g}){const{entities:b,getDeviceNameForEntity:w,getAreaNameForEntity:E}=Wg(),S=s??b,_=H.useMemo(()=>{if(!g)return S;const B=Array.isArray(g)?g:[g];return S.filter($=>{const P=$.entity_id.split(".")[0];return B.includes(P)})},[S,g]),A=H.useMemo(()=>_.map(B=>{const $=Wnr(B.entity_id);return{value:B.entity_id,label:Knr(B),domainLabel:$.label,domainColor:$.color,deviceLabel:w(B.entity_id)??void 0,areaLabel:E(B.entity_id)??void 0}}),[_,w,E]),C=Array.isArray(n)?n[0]:n,O=_.find(B=>B.entity_id===C),L=C&&!O,D=B=>{i(B)};return I.jsxs("div",{className:nr("relative",d),children:[I.jsx(_Yt,{options:A,value:C||"",onChange:D,placeholder:c,buttonClassName:nr(!C&&"text-muted-foreground"),disabled:A.length===0,searchKeys:["label","value","deviceLabel","areaLabel"],fuzzyOptions:{threshold:.3,minMatchCharLength:2},renderOption:B=>I.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[I.jsx("span",{children:B.label}),I.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[I.jsx("span",{className:nr("rounded px-1.5 py-0.5 font-medium text-xs",B.domainColor),children:B.domainLabel}),B.deviceLabel&&I.jsx("span",{className:"truncate text-muted-foreground text-xs",children:B.deviceLabel}),B.areaLabel&&I.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground text-xs",children:B.areaLabel})]})]}),renderValue:B=>B?I.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[I.jsx("span",{className:nr("rounded px-1.5 py-0.5 font-medium text-xs",B.domainColor),children:B.domainLabel}),I.jsx("span",{className:"truncate",children:B.label})]}):null}),L&&I.jsx("div",{className:"mt-1 truncate font-mono text-red-600",children:C})]})}function Qae({value:n,onChange:i,entities:s,placeholder:c="Select entities...",className:d}){const g=w=>{n.includes(w)||i([...n,w])},b=w=>{i(n.filter(E=>E!==w))};return I.jsxs("div",{className:nr("space-y-1",d),children:[I.jsx(Sse,{value:"",onChange:g,entities:s,placeholder:c,className:"w-full"}),I.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(w=>I.jsxs("span",{className:"inline-flex items-center rounded border bg-muted px-2 py-0.5 font-mono text-muted-foreground text-xs",children:[w,I.jsx(aae,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>b(w)})]},w))})]})}function QMe(n,i,s){const d=n.data[i];return d??s}function jh(n,i,s=""){const c=QMe(n,i,s);if(typeof c=="string")return c;if(typeof c=="object"&&c!==null&&!Array.isArray(c)){const d=c;if(typeof d.value=="string")return d.value}return s}function C5(n,i,s={}){const c=QMe(n,i,s);return typeof c=="object"&&c!==null&&!Array.isArray(c)?c:s}function Ynr({response:n,responseVariable:i,showResponseVariable:s,setShowResponseVariable:c,onChange:d,handleResponseVariableChange:g}){const{t:b}=jo(["common","nodes"]),w=I.jsxs(I.Fragment,{children:[I.jsx(Na,{type:"text",value:i??"",onChange:g,placeholder:b("nodes:responseVariableField.placeholder")}),i!==void 0&&eWt(i)&&I.jsxs(dA,{variant:"destructive",className:"mt-2 border-0 px-0",children:[I.jsx(jKt,{children:b("labels.warning")}),I.jsx(fA,{children:b("nodes:responseVariableField.currentNodeWarning")})]})]});return n.optional?I.jsxs(No,{label:b("nodes:responseVariableField.label"),description:b("nodes:responseVariableField.optionalDescription"),children:[I.jsxs("div",{className:"mb-2 flex items-center gap-3",children:[I.jsx(J2,{checked:s,onCheckedChange:E=>{c(E),E||d("response_variable",void 0)},id:"response-variable-switch"}),I.jsx("label",{htmlFor:"response-variable-switch",className:"cursor-pointer select-none text-sm",children:b("nodes:responseVariableField.useResponseVariable")})]}),s&&w]}):I.jsx(No,{label:b("nodes:responseVariableField.label"),description:b("nodes:responseVariableField.requiredDescription"),children:w})}function Jnr(n){const i=n.trim();if(i==="")return;const s=Number(i);return Number.isNaN(s)?n:s}function Xnr(n){return n==null?"":typeof n=="number"||typeof n=="string"?String(n):""}function xYt({value:n,placeholder:i,required:s,onChange:c}){return I.jsx(Na,{type:"text",inputMode:"decimal",value:Xnr(n),placeholder:i,required:s,onChange:d=>c(Jnr(d.target.value))})}function kYt(n){if(!Array.isArray(n))return[];const i=[];for(const s of n){if(typeof s=="string"||typeof s=="number"){i.push({value:String(s),label:String(s)});continue}if(Array.isArray(s)){const[c,d]=s;if(c==null)continue;i.push({value:String(c),label:String(d??c)});continue}if(s&&typeof s=="object"&&"value"in s){const{value:c,label:d}=s;if(c==null)continue;i.push({value:String(c),label:String(d??c)})}}return i}const Znr="255, 255, 255";function Qnr(n){return Array.isArray(n)?n.join(", "):n==null?"":String(n)}function err(n){const i=n.split(",").map(c=>c.trim()).filter(c=>c!=="");if(i.length===0)return"";const s=i.map(Number);return s.some(Number.isNaN)?n:s}function trr({value:n,example:i,onChange:s}){const[c,d]=H.useState(null),g=i===void 0?Znr:String(i).replace(/[[\]]/g,"");return I.jsx(Na,{type:"text",inputMode:"numeric",value:c??Qnr(n),placeholder:g,onChange:b=>{d(b.target.value),s(err(b.target.value))},onBlur:()=>d(null)})}function nrr({serviceFields:n,currentData:i,onChange:s}){const{t:c}=jo(["common","nodes"]);return Object.keys(n).length===0?null:I.jsxs("div",{className:"mt-3 flex flex-col gap-3 border-t pt-3",children:[I.jsx("h4",{className:"mb-3 font-semibold text-muted-foreground text-xs",children:c("nodes:serviceDataFields.heading")}),Object.entries(n).map(([d,g])=>{const b=g.selector||{},w=Object.keys(b)[0],E=b[w]||{},S=i[d],_=g.name||d.replace(/_/g," ").replace(/\b\w/g,A=>A.toUpperCase());if(w==="number"){const A=E;return I.jsx(No,{label:`${_}${A.unit_of_measurement?` (${A.unit_of_measurement})`:""}`,required:g.required,description:g.description,children:I.jsx(xYt,{value:i[d],required:g.required,placeholder:g.example!==void 0?String(g.example):"",onChange:C=>s(d,C??"")})},d)}if(w==="select"){const A=kYt(E.options);return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsxs(zp,{value:String(S===""?"__NONE__":S??"__NONE__"),onValueChange:C=>s(d,C==="__NONE__"?"":C),children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:c("placeholders.none")})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"__NONE__",children:c("placeholders.none")}),A.map(C=>I.jsx(eo,{value:C.value,children:C.label},C.value))]})]})},d)}if(w==="boolean")return I.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[I.jsx("input",{type:"checkbox",checked:S??!1,onChange:A=>s(d,A.target.checked),className:"rounded"}),I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[_,g.required&&I.jsx("span",{className:"ml-0.5 text-destructive",children:c("labels.requiredAsterisk")})]})]},d);if(w==="entity"){if(E.multiple===!0){const O=Array.isArray(S)?S:S?[String(S)]:[];return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Qae,{value:O,onChange:L=>s(d,L),placeholder:g.example!==void 0?String(g.example):void 0})},d)}return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Sse,{value:String(S??""),onChange:O=>s(d,O),placeholder:g.example!==void 0?String(g.example):void 0})},d)}return w==="color_rgb"||d==="rgb_color"?I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(trr,{value:i[d],example:g.example,onChange:A=>s(d,A)})},d):I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Na,{type:"text",value:S??"",onChange:A=>s(d,A.target.value),placeholder:g.example!==void 0?String(g.example):""})},d)})]})}const rrr=new Set(["homeassistant","group"]);function irr(n,i){if(!n||!n.includes("."))return i;const s=n.split(".")[0];if(rrr.has(s))return i;const c=i.filter(d=>d.entity_id.startsWith(`${s}.`));return c.length>0?c:i}function orr({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes"]),{getAllServices:d,getServiceDefinition:g}=Wg(),{getFieldError:b}=gb(n.id),w=jh(n,"service"),E=jh(n,"event"),S=n.data,_=typeof S.stop=="string"?S.stop:void 0,A=S.error===!0,C=g(w),O=(C==null?void 0:C.fields)||{},L=C5(n,"data",{}),D=jh(n,"response_variable"),[B,$]=H.useState(!!D),P=_!==void 0?"stop":E?"event":"service";H.useEffect(()=>{$(!!D)},[D]);const j=Re=>{Re==="stop"?(i("service",void 0),i("target",void 0),i("data",void 0),i("event",void 0),i("event_data",void 0),i("stop",""),i("error",void 0)):Re==="event"?(i("service",void 0),i("target",void 0),i("data",void 0),i("stop",void 0),i("error",void 0)):(i("event",void 0),i("event_data",void 0),i("stop",void 0),i("error",void 0))},z=Re=>{i("service",Re),i("data",void 0)},ee=Re=>{const xe={...C5(n,"target",{}),entity_id:Re.length>0?Re:void 0};xe.entity_id||delete xe.entity_id,i("target",Object.keys(xe).length>0?xe:void 0)},ne=Re=>{const xe={...C5(n,"target",{}),device_id:Re.length>0?Re:void 0};xe.device_id||delete xe.device_id,i("target",Object.keys(xe).length>0?xe:void 0)},Q=Re=>{const xe={...C5(n,"target",{}),area_id:Re.length>0?Re:void 0};xe.area_id||delete xe.area_id,i("target",Object.keys(xe).length>0?xe:void 0)},ae=(Re,Ae)=>{const xe={...L,[Re]:Ae===""?void 0:Ae},We=Object.fromEntries(Object.entries(xe).filter(([,ut])=>ut!==void 0&&ut!==""));i("data",Object.keys(We).length>0?We:void 0)},he=Re=>{i("response_variable",Re.target.value===""?void 0:Re.target.value)},pe=C5(n,"target",{}),ue=Re=>Re?Array.isArray(Re)?Re:[Re]:[],fe=ue(pe.entity_id),K=ue(pe.device_id),ge=ue(pe.area_id),De=K.length>0,Se=ge.length>0;return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:actions.actionTypeLabel"),required:!0,children:I.jsxs(zp,{value:P,onValueChange:j,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"service",children:c("nodes:actions.actionTypes.service")}),I.jsx(eo,{value:"event",children:c("nodes:actions.actionTypes.event")}),I.jsx(eo,{value:"stop",children:c("nodes:actions.actionTypes.stop")})]})]})}),P==="stop"?I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:actions.stopMessageLabel"),children:I.jsx(Na,{type:"text",value:_??"",onChange:Re=>i("stop",Re.target.value),placeholder:c("nodes:actions.stopMessagePlaceholder")})}),I.jsx(No,{label:c("nodes:actions.markAsError"),children:I.jsx(J2,{checked:A,onCheckedChange:Re=>i("error",Re||void 0)})})]}):P==="event"?I.jsx(I.Fragment,{children:I.jsxs(No,{label:c("nodes:actions.eventNameLabel"),required:!0,children:[I.jsx(Na,{type:"text",value:E,onChange:Re=>i("event",Re.target.value||void 0),placeholder:c("nodes:actions.eventNamePlaceholder")}),I.jsx(H2,{message:b("event")})]})}):I.jsxs(I.Fragment,{children:[I.jsxs(No,{label:c("nodes:actions.actionLabel"),required:!0,children:[I.jsx(_Yt,{options:d().map(({domain:Re,service:Ae})=>({value:`${Re}.${Ae}`,label:`${Re}.${Ae}`})),value:w,onChange:z,placeholder:c("nodes:actions.selectAction")}),I.jsx(H2,{message:b("service")})]}),((C==null?void 0:C.target)||fe.length>0)&&I.jsx(No,{label:c("nodes:actions.targetEntities"),children:I.jsx(Qae,{value:fe,onChange:ee,entities:irr(w,s),placeholder:c("nodes:actions.selectTargetEntities")})}),(De||(C==null?void 0:C.target))&&I.jsx(No,{label:c("nodes:actions.targetDevices"),description:c("nodes:actions.targetDevicesDescription"),children:I.jsx(oLe,{values:K,onChange:ne,placeholder:c("nodes:actions.addDeviceId")})}),(Se||(C==null?void 0:C.target))&&I.jsx(No,{label:c("nodes:actions.targetAreas"),description:c("nodes:actions.targetAreasDescription"),children:I.jsx(oLe,{values:ge,onChange:Q,placeholder:c("nodes:actions.addAreaId")})}),I.jsx(nrr,{serviceFields:O,currentData:L,onChange:ae}),(C==null?void 0:C.response)&&I.jsx(Ynr,{response:C.response,responseVariable:D,showResponseVariable:B,setShowResponseVariable:$,onChange:i,handleResponseVariableChange:he})]})]})}function NYt({value:n,onChange:i}){const{t:s}=jo(["common","nodes"]),c=typeof n=="string",d=!c&&typeof n=="object"&&n!==null?n:{},[g,b]=H.useState(c),w=S=>{if(b(S),S){const _=d.hours??0,A=d.minutes??0,C=d.seconds??0,O=d.milliseconds??0,L=[_,A,C].map(B=>B.toString().padStart(2,"0")).join(":"),D=O?`${L}.${O}`:L;i(D)}else if(c){const _=/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(?:\.(\d{1,3}))?$/.exec(n);if(_){const[,A,C,O,L]=_;i({hours:Number(A),minutes:Number(C),seconds:Number(O),...L?{milliseconds:Number(L)}:{}})}else i({})}},E=(S,_)=>{const A=_===""?void 0:Number(_),C={...d,[S]:Number.isNaN(A)?void 0:A};Object.keys(C).forEach(O=>{const L=C[O];L==null&&delete C[O]}),i(C)};return I.jsxs("div",{className:"flex flex-col gap-2",children:[I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:s("nodes:durationField.string")}),I.jsx(J2,{checked:g,onCheckedChange:w}),I.jsx("span",{className:"text-muted-foreground text-xs",children:s("nodes:durationField.object")})]}),g?I.jsx(Na,{type:"text",value:c?n:"",onChange:S=>i(S.target.value),placeholder:s("nodes:durationField.placeholder")}):I.jsxs("div",{className:"flex gap-2",children:[I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.hours")}),I.jsx(Na,{type:"number",min:0,value:d.hours??"",onChange:S=>E("hours",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.minutes")}),I.jsx(Na,{type:"number",min:0,value:d.minutes??"",onChange:S=>E("minutes",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.seconds")}),I.jsx(Na,{type:"number",min:0,value:d.seconds??"",onChange:S=>E("seconds",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.milliseconds")}),I.jsx(Na,{type:"number",min:0,value:d.milliseconds??"",onChange:S=>E("milliseconds",S.target.value),placeholder:"0",className:"mt-1"})]})]})]})}function CYt({label:n,description:i,value:s,onChange:c}){const{t:d}=jo(["common","nodes"]);return I.jsx(No,{label:n??d("nodes:durationField.label"),description:i||d("nodes:durationField.description"),children:I.jsx(NYt,{value:s,onChange:c})})}var YOe="rovingFocusGroup.onEntryFocus",srr={bubbles:!1,cancelable:!0},Uz="RovingFocusGroup",[sLe,IYt,arr]=Yae(Uz),[crr,ece]=Nw(Uz,[arr]),[urr,lrr]=crr(Uz),RYt=H.forwardRef((n,i)=>I.jsx(sLe.Provider,{scope:n.__scopeRovingFocusGroup,children:I.jsx(sLe.Slot,{scope:n.__scopeRovingFocusGroup,children:I.jsx(drr,{...n,ref:i})})}));RYt.displayName=Uz;var drr=H.forwardRef((n,i)=>{const{__scopeRovingFocusGroup:s,orientation:c,loop:d=!1,dir:g,currentTabStopId:b,defaultCurrentTabStopId:w,onCurrentTabStopIdChange:E,onEntryFocus:S,preventScrollOnEntryFocus:_=!1,...A}=n,C=H.useRef(null),O=ps(i,C),L=Bz(g),[D,B]=G2({prop:b,defaultProp:w??null,onChange:E,caller:Uz}),[$,P]=H.useState(!1),j=q2(S),z=IYt(s),ee=H.useRef(!1),[ne,Q]=H.useState(0);return H.useEffect(()=>{const ae=C.current;if(ae)return ae.addEventListener(YOe,j),()=>ae.removeEventListener(YOe,j)},[j]),I.jsx(urr,{scope:s,orientation:c,dir:L,loop:d,currentTabStopId:D,onItemFocus:H.useCallback(ae=>B(ae),[B]),onItemShiftTab:H.useCallback(()=>P(!0),[]),onFocusableItemAdd:H.useCallback(()=>Q(ae=>ae+1),[]),onFocusableItemRemove:H.useCallback(()=>Q(ae=>ae-1),[]),children:I.jsx(no.div,{tabIndex:$||ne===0?-1:0,"data-orientation":c,...A,ref:O,style:{outline:"none",...n.style},onMouseDown:Dr(n.onMouseDown,()=>{ee.current=!0}),onFocus:Dr(n.onFocus,ae=>{const he=!ee.current;if(ae.target===ae.currentTarget&&he&&!$){const pe=new CustomEvent(YOe,srr);if(ae.currentTarget.dispatchEvent(pe),!pe.defaultPrevented){const ue=z().filter(Se=>Se.focusable),fe=ue.find(Se=>Se.active),K=ue.find(Se=>Se.id===D),De=[fe,K,...ue].filter(Boolean).map(Se=>Se.ref.current);LYt(De,_)}}ee.current=!1}),onBlur:Dr(n.onBlur,()=>P(!1))})})}),OYt="RovingFocusGroupItem",DYt=H.forwardRef((n,i)=>{const{__scopeRovingFocusGroup:s,focusable:c=!0,active:d=!1,tabStopId:g,children:b,...w}=n,E=Bh(),S=g||E,_=lrr(OYt,s),A=_.currentTabStopId===S,C=IYt(s),{onFocusableItemAdd:O,onFocusableItemRemove:L,currentTabStopId:D}=_;return H.useEffect(()=>{if(c)return O(),()=>L()},[c,O,L]),I.jsx(sLe.ItemSlot,{scope:s,id:S,focusable:c,active:d,children:I.jsx(no.span,{tabIndex:A?0:-1,"data-orientation":_.orientation,...w,ref:i,onMouseDown:Dr(n.onMouseDown,B=>{c?_.onItemFocus(S):B.preventDefault()}),onFocus:Dr(n.onFocus,()=>_.onItemFocus(S)),onKeyDown:Dr(n.onKeyDown,B=>{if(B.key==="Tab"&&B.shiftKey){_.onItemShiftTab();return}if(B.target!==B.currentTarget)return;const $=prr(B,_.orientation,_.dir);if($!==void 0){if(B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;B.preventDefault();let j=C().filter(z=>z.focusable).map(z=>z.ref.current);if($==="last")j.reverse();else if($==="prev"||$==="next"){$==="prev"&&j.reverse();const z=j.indexOf(B.currentTarget);j=_.loop?grr(j,z+1):j.slice(z+1)}setTimeout(()=>LYt(j))}}),children:typeof b=="function"?b({isCurrentTabStop:A,hasTabStop:D!=null}):b})})});DYt.displayName=OYt;var frr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hrr(n,i){return i!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function prr(n,i,s){const c=hrr(n.key,s);if(!(i==="vertical"&&["ArrowLeft","ArrowRight"].includes(c))&&!(i==="horizontal"&&["ArrowUp","ArrowDown"].includes(c)))return frr[c]}function LYt(n,i=!1){const s=document.activeElement;for(const c of n)if(c===s||(c.focus({preventScroll:i}),document.activeElement!==s))return}function grr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}var MYt=RYt,PYt=DYt;function brr(n){const i=mrr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(yrr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function mrr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=Err(d),w=vrr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var wrr=Symbol("radix.slottable");function yrr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===wrr}function vrr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function Err(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}var aLe=["Enter"," "],Srr=["ArrowDown","PageUp","Home"],jYt=["ArrowUp","PageDown","End"],Trr=[...Srr,...jYt],Arr={ltr:[...aLe,"ArrowRight"],rtl:[...aLe,"ArrowLeft"]},_rr={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Hz="Menu",[fz,xrr,krr]=Yae(Hz),[LR,FYt]=Nw(Hz,[krr,UM,ece]),tce=UM(),$Yt=ece(),[Nrr,MR]=LR(Hz),[Crr,zz]=LR(Hz),BYt=n=>{const{__scopeMenu:i,open:s=!1,children:c,dir:d,onOpenChange:g,modal:b=!0}=n,w=tce(i),[E,S]=H.useState(null),_=H.useRef(!1),A=q2(g),C=Bz(d);return H.useEffect(()=>{const O=()=>{_.current=!0,document.addEventListener("pointerdown",L,{capture:!0,once:!0}),document.addEventListener("pointermove",L,{capture:!0,once:!0})},L=()=>_.current=!1;return document.addEventListener("keydown",O,{capture:!0}),()=>{document.removeEventListener("keydown",O,{capture:!0}),document.removeEventListener("pointerdown",L,{capture:!0}),document.removeEventListener("pointermove",L,{capture:!0})}},[]),I.jsx(aMe,{...w,children:I.jsx(Nrr,{scope:i,open:s,onOpenChange:A,content:E,onContentChange:S,children:I.jsx(Crr,{scope:i,onClose:H.useCallback(()=>A(!1),[A]),isUsingKeyboardRef:_,dir:C,modal:b,children:c})})})};BYt.displayName=Hz;var Irr="MenuAnchor",e9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n,d=tce(s);return I.jsx(Tae,{...d,...c,ref:i})});e9e.displayName=Irr;var t9e="MenuPortal",[Rrr,UYt]=LR(t9e,{forceMount:void 0}),HYt=n=>{const{__scopeMenu:i,forceMount:s,children:c,container:d}=n,g=MR(t9e,i);return I.jsx(Rrr,{scope:i,forceMount:s,children:I.jsx(Cw,{present:s||g.open,children:I.jsx(Oz,{asChild:!0,container:d,children:c})})})};HYt.displayName=t9e;var Aw="MenuContent",[Orr,n9e]=LR(Aw),zYt=H.forwardRef((n,i)=>{const s=UYt(Aw,n.__scopeMenu),{forceMount:c=s.forceMount,...d}=n,g=MR(Aw,n.__scopeMenu),b=zz(Aw,n.__scopeMenu);return I.jsx(fz.Provider,{scope:n.__scopeMenu,children:I.jsx(Cw,{present:c||g.open,children:I.jsx(fz.Slot,{scope:n.__scopeMenu,children:b.modal?I.jsx(Drr,{...d,ref:i}):I.jsx(Lrr,{...d,ref:i})})})})}),Drr=H.forwardRef((n,i)=>{const s=MR(Aw,n.__scopeMenu),c=H.useRef(null),d=ps(i,c);return H.useEffect(()=>{const g=c.current;if(g)return lae(g)},[]),I.jsx(r9e,{...n,ref:d,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:Dr(n.onFocusOutside,g=>g.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),Lrr=H.forwardRef((n,i)=>{const s=MR(Aw,n.__scopeMenu);return I.jsx(r9e,{...n,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),Mrr=brr("MenuContent.ScrollLock"),r9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,loop:c=!1,trapFocus:d,onOpenAutoFocus:g,onCloseAutoFocus:b,disableOutsidePointerEvents:w,onEntryFocus:E,onEscapeKeyDown:S,onPointerDownOutside:_,onFocusOutside:A,onInteractOutside:C,onDismiss:O,disableOutsideScroll:L,...D}=n,B=MR(Aw,s),$=zz(Aw,s),P=tce(s),j=$Yt(s),z=xrr(s),[ee,ne]=H.useState(null),Q=H.useRef(null),ae=ps(i,Q,B.onContentChange),he=H.useRef(0),pe=H.useRef(""),ue=H.useRef(0),fe=H.useRef(null),K=H.useRef("right"),ge=H.useRef(0),De=L?Dz:H.Fragment,Se=L?{as:Mrr,allowPinchZoom:!0}:void 0,Re=xe=>{var Et,Dt;const We=pe.current+xe,ut=z().filter(Yt=>!Yt.disabled),Be=document.activeElement,bt=(Et=ut.find(Yt=>Yt.ref.current===Be))==null?void 0:Et.textValue,Nt=ut.map(Yt=>Yt.textValue),pt=Wrr(Nt,We,bt),Kt=(Dt=ut.find(Yt=>Yt.textValue===pt))==null?void 0:Dt.ref.current;(function Yt(Ln){pe.current=Ln,window.clearTimeout(he.current),Ln!==""&&(he.current=window.setTimeout(()=>Yt(""),1e3))})(We),Kt&&setTimeout(()=>Kt.focus())};H.useEffect(()=>()=>window.clearTimeout(he.current),[]),cae();const Ae=H.useCallback(xe=>{var ut,Be;return K.current===((ut=fe.current)==null?void 0:ut.side)&&Yrr(xe,(Be=fe.current)==null?void 0:Be.area)},[]);return I.jsx(Orr,{scope:s,searchRef:pe,onItemEnter:H.useCallback(xe=>{Ae(xe)&&xe.preventDefault()},[Ae]),onItemLeave:H.useCallback(xe=>{var We;Ae(xe)||((We=Q.current)==null||We.focus(),ne(null))},[Ae]),onTriggerLeave:H.useCallback(xe=>{Ae(xe)&&xe.preventDefault()},[Ae]),pointerGraceTimerRef:ue,onPointerGraceIntentChange:H.useCallback(xe=>{fe.current=xe},[]),children:I.jsx(De,{...Se,children:I.jsx(Rz,{asChild:!0,trapped:d,onMountAutoFocus:Dr(g,xe=>{var We;xe.preventDefault(),(We=Q.current)==null||We.focus({preventScroll:!0})}),onUnmountAutoFocus:b,children:I.jsx(Iz,{asChild:!0,disableOutsidePointerEvents:w,onEscapeKeyDown:S,onPointerDownOutside:_,onFocusOutside:A,onInteractOutside:C,onDismiss:O,children:I.jsx(MYt,{asChild:!0,...j,dir:$.dir,orientation:"vertical",loop:c,currentTabStopId:ee,onCurrentTabStopIdChange:ne,onEntryFocus:Dr(E,xe=>{$.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:I.jsx(cMe,{role:"menu","aria-orientation":"vertical","data-state":oJt(B.open),"data-radix-menu-content":"",dir:$.dir,...P,...D,ref:ae,style:{outline:"none",...D.style},onKeyDown:Dr(D.onKeyDown,xe=>{const ut=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,Be=xe.ctrlKey||xe.altKey||xe.metaKey,bt=xe.key.length===1;ut&&(xe.key==="Tab"&&xe.preventDefault(),!Be&&bt&&Re(xe.key));const Nt=Q.current;if(xe.target!==Nt||!Trr.includes(xe.key))return;xe.preventDefault();const Kt=z().filter(Et=>!Et.disabled).map(Et=>Et.ref.current);jYt.includes(xe.key)&&Kt.reverse(),qrr(Kt)}),onBlur:Dr(n.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(he.current),pe.current="")}),onPointerMove:Dr(n.onPointerMove,hz(xe=>{const We=xe.target,ut=ge.current!==xe.clientX;if(xe.currentTarget.contains(We)&&ut){const Be=xe.clientX>ge.current?"right":"left";K.current=Be,ge.current=xe.clientX}}))})})})})})})});zYt.displayName=Aw;var Prr="MenuGroup",i9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{role:"group",...c,ref:i})});i9e.displayName=Prr;var jrr="MenuLabel",GYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{...c,ref:i})});GYt.displayName=jrr;var Tse="MenuItem",d$t="menu.itemSelect",nce=H.forwardRef((n,i)=>{const{disabled:s=!1,onSelect:c,...d}=n,g=H.useRef(null),b=zz(Tse,n.__scopeMenu),w=n9e(Tse,n.__scopeMenu),E=ps(i,g),S=H.useRef(!1),_=()=>{const A=g.current;if(!s&&A){const C=new CustomEvent(d$t,{bubbles:!0,cancelable:!0});A.addEventListener(d$t,O=>c==null?void 0:c(O),{once:!0}),DGt(A,C),C.defaultPrevented?S.current=!1:b.onClose()}};return I.jsx(qYt,{...d,ref:E,disabled:s,onClick:Dr(n.onClick,_),onPointerDown:A=>{var C;(C=n.onPointerDown)==null||C.call(n,A),S.current=!0},onPointerUp:Dr(n.onPointerUp,A=>{var C;S.current||(C=A.currentTarget)==null||C.click()}),onKeyDown:Dr(n.onKeyDown,A=>{const C=w.searchRef.current!=="";s||C&&A.key===" "||aLe.includes(A.key)&&(A.currentTarget.click(),A.preventDefault())})})});nce.displayName=Tse;var qYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,disabled:c=!1,textValue:d,...g}=n,b=n9e(Tse,s),w=$Yt(s),E=H.useRef(null),S=ps(i,E),[_,A]=H.useState(!1),[C,O]=H.useState("");return H.useEffect(()=>{const L=E.current;L&&O((L.textContent??"").trim())},[g.children]),I.jsx(fz.ItemSlot,{scope:s,disabled:c,textValue:d??C,children:I.jsx(PYt,{asChild:!0,...w,focusable:!c,children:I.jsx(no.div,{role:"menuitem","data-highlighted":_?"":void 0,"aria-disabled":c||void 0,"data-disabled":c?"":void 0,...g,ref:S,onPointerMove:Dr(n.onPointerMove,hz(L=>{c?b.onItemLeave(L):(b.onItemEnter(L),L.defaultPrevented||L.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Dr(n.onPointerLeave,hz(L=>b.onItemLeave(L))),onFocus:Dr(n.onFocus,()=>A(!0)),onBlur:Dr(n.onBlur,()=>A(!1))})})})}),Frr="MenuCheckboxItem",VYt=H.forwardRef((n,i)=>{const{checked:s=!1,onCheckedChange:c,...d}=n;return I.jsx(XYt,{scope:n.__scopeMenu,checked:s,children:I.jsx(nce,{role:"menuitemcheckbox","aria-checked":Ase(s)?"mixed":s,...d,ref:i,"data-state":s9e(s),onSelect:Dr(d.onSelect,()=>c==null?void 0:c(Ase(s)?!0:!s),{checkForDefaultPrevented:!1})})})});VYt.displayName=Frr;var WYt="MenuRadioGroup",[$rr,Brr]=LR(WYt,{value:void 0,onValueChange:()=>{}}),KYt=H.forwardRef((n,i)=>{const{value:s,onValueChange:c,...d}=n,g=q2(c);return I.jsx($rr,{scope:n.__scopeMenu,value:s,onValueChange:g,children:I.jsx(i9e,{...d,ref:i})})});KYt.displayName=WYt;var YYt="MenuRadioItem",JYt=H.forwardRef((n,i)=>{const{value:s,...c}=n,d=Brr(YYt,n.__scopeMenu),g=s===d.value;return I.jsx(XYt,{scope:n.__scopeMenu,checked:g,children:I.jsx(nce,{role:"menuitemradio","aria-checked":g,...c,ref:i,"data-state":s9e(g),onSelect:Dr(c.onSelect,()=>{var b;return(b=d.onValueChange)==null?void 0:b.call(d,s)},{checkForDefaultPrevented:!1})})})});JYt.displayName=YYt;var o9e="MenuItemIndicator",[XYt,Urr]=LR(o9e,{checked:!1}),ZYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,forceMount:c,...d}=n,g=Urr(o9e,s);return I.jsx(Cw,{present:c||Ase(g.checked)||g.checked===!0,children:I.jsx(no.span,{...d,ref:i,"data-state":s9e(g.checked)})})});ZYt.displayName=o9e;var Hrr="MenuSeparator",QYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{role:"separator","aria-orientation":"horizontal",...c,ref:i})});QYt.displayName=Hrr;var zrr="MenuArrow",eJt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n,d=tce(s);return I.jsx(uMe,{...d,...c,ref:i})});eJt.displayName=zrr;var Grr="MenuSub",[D1r,tJt]=LR(Grr),sH="MenuSubTrigger",nJt=H.forwardRef((n,i)=>{const s=MR(sH,n.__scopeMenu),c=zz(sH,n.__scopeMenu),d=tJt(sH,n.__scopeMenu),g=n9e(sH,n.__scopeMenu),b=H.useRef(null),{pointerGraceTimerRef:w,onPointerGraceIntentChange:E}=g,S={__scopeMenu:n.__scopeMenu},_=H.useCallback(()=>{b.current&&window.clearTimeout(b.current),b.current=null},[]);return H.useEffect(()=>_,[_]),H.useEffect(()=>{const A=w.current;return()=>{window.clearTimeout(A),E(null)}},[w,E]),I.jsx(e9e,{asChild:!0,...S,children:I.jsx(qYt,{id:d.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":d.contentId,"data-state":oJt(s.open),...n,ref:zg(i,d.onTriggerChange),onClick:A=>{var C;(C=n.onClick)==null||C.call(n,A),!(n.disabled||A.defaultPrevented)&&(A.currentTarget.focus(),s.open||s.onOpenChange(!0))},onPointerMove:Dr(n.onPointerMove,hz(A=>{g.onItemEnter(A),!A.defaultPrevented&&!n.disabled&&!s.open&&!b.current&&(g.onPointerGraceIntentChange(null),b.current=window.setTimeout(()=>{s.onOpenChange(!0),_()},100))})),onPointerLeave:Dr(n.onPointerLeave,hz(A=>{var O,L;_();const C=(O=s.content)==null?void 0:O.getBoundingClientRect();if(C){const D=(L=s.content)==null?void 0:L.dataset.side,B=D==="right",$=B?-5:5,P=C[B?"left":"right"],j=C[B?"right":"left"];g.onPointerGraceIntentChange({area:[{x:A.clientX+$,y:A.clientY},{x:P,y:C.top},{x:j,y:C.top},{x:j,y:C.bottom},{x:P,y:C.bottom}],side:D}),window.clearTimeout(w.current),w.current=window.setTimeout(()=>g.onPointerGraceIntentChange(null),300)}else{if(g.onTriggerLeave(A),A.defaultPrevented)return;g.onPointerGraceIntentChange(null)}})),onKeyDown:Dr(n.onKeyDown,A=>{var O;const C=g.searchRef.current!=="";n.disabled||C&&A.key===" "||Arr[c.dir].includes(A.key)&&(s.onOpenChange(!0),(O=s.content)==null||O.focus(),A.preventDefault())})})})});nJt.displayName=sH;var rJt="MenuSubContent",iJt=H.forwardRef((n,i)=>{const s=UYt(Aw,n.__scopeMenu),{forceMount:c=s.forceMount,...d}=n,g=MR(Aw,n.__scopeMenu),b=zz(Aw,n.__scopeMenu),w=tJt(rJt,n.__scopeMenu),E=H.useRef(null),S=ps(i,E);return I.jsx(fz.Provider,{scope:n.__scopeMenu,children:I.jsx(Cw,{present:c||g.open,children:I.jsx(fz.Slot,{scope:n.__scopeMenu,children:I.jsx(r9e,{id:w.contentId,"aria-labelledby":w.triggerId,...d,ref:S,align:"start",side:b.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:_=>{var A;b.isUsingKeyboardRef.current&&((A=E.current)==null||A.focus()),_.preventDefault()},onCloseAutoFocus:_=>_.preventDefault(),onFocusOutside:Dr(n.onFocusOutside,_=>{_.target!==w.trigger&&g.onOpenChange(!1)}),onEscapeKeyDown:Dr(n.onEscapeKeyDown,_=>{b.onClose(),_.preventDefault()}),onKeyDown:Dr(n.onKeyDown,_=>{var O;const A=_.currentTarget.contains(_.target),C=_rr[b.dir].includes(_.key);A&&C&&(g.onOpenChange(!1),(O=w.trigger)==null||O.focus(),_.preventDefault())})})})})})});iJt.displayName=rJt;function oJt(n){return n?"open":"closed"}function Ase(n){return n==="indeterminate"}function s9e(n){return Ase(n)?"indeterminate":n?"checked":"unchecked"}function qrr(n){const i=document.activeElement;for(const s of n)if(s===i||(s.focus(),document.activeElement!==i))return}function Vrr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}function Wrr(n,i,s){const d=i.length>1&&Array.from(i).every(S=>S===i[0])?i[0]:i,g=s?n.indexOf(s):-1;let b=Vrr(n,Math.max(g,0));d.length===1&&(b=b.filter(S=>S!==s));const E=b.find(S=>S.toLowerCase().startsWith(d.toLowerCase()));return E!==s?E:void 0}function Krr(n,i){const{x:s,y:c}=n;let d=!1;for(let g=0,b=i.length-1;gc!=C>c&&s<(A-S)*(c-_)/(C-_)+S&&(d=!d)}return d}function Yrr(n,i){if(!i)return!1;const s={x:n.clientX,y:n.clientY};return Krr(s,i)}function hz(n){return i=>i.pointerType==="mouse"?n(i):void 0}var Jrr=BYt,Xrr=e9e,Zrr=HYt,Qrr=zYt,eir=i9e,tir=GYt,nir=nce,rir=VYt,iir=KYt,oir=JYt,sir=ZYt,air=QYt,cir=eJt,uir=nJt,lir=iJt,rce="DropdownMenu",[dir]=Nw(rce,[FYt]),Kg=FYt(),[fir,sJt]=dir(rce),aJt=n=>{const{__scopeDropdownMenu:i,children:s,dir:c,open:d,defaultOpen:g,onOpenChange:b,modal:w=!0}=n,E=Kg(i),S=H.useRef(null),[_,A]=G2({prop:d,defaultProp:g??!1,onChange:b,caller:rce});return I.jsx(fir,{scope:i,triggerId:Bh(),triggerRef:S,contentId:Bh(),open:_,onOpenChange:A,onOpenToggle:H.useCallback(()=>A(C=>!C),[A]),modal:w,children:I.jsx(Jrr,{...E,open:_,onOpenChange:A,dir:c,modal:w,children:s})})};aJt.displayName=rce;var cJt="DropdownMenuTrigger",uJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,disabled:c=!1,...d}=n,g=sJt(cJt,s),b=Kg(s);return I.jsx(Xrr,{asChild:!0,...b,children:I.jsx(no.button,{type:"button",id:g.triggerId,"aria-haspopup":"menu","aria-expanded":g.open,"aria-controls":g.open?g.contentId:void 0,"data-state":g.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:zg(i,g.triggerRef),onPointerDown:Dr(n.onPointerDown,w=>{!c&&w.button===0&&w.ctrlKey===!1&&(g.onOpenToggle(),g.open||w.preventDefault())}),onKeyDown:Dr(n.onKeyDown,w=>{c||(["Enter"," "].includes(w.key)&&g.onOpenToggle(),w.key==="ArrowDown"&&g.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(w.key)&&w.preventDefault())})})})});uJt.displayName=cJt;var hir="DropdownMenuPortal",lJt=n=>{const{__scopeDropdownMenu:i,...s}=n,c=Kg(i);return I.jsx(Zrr,{...c,...s})};lJt.displayName=hir;var dJt="DropdownMenuContent",fJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=sJt(dJt,s),g=Kg(s),b=H.useRef(!1);return I.jsx(Qrr,{id:d.contentId,"aria-labelledby":d.triggerId,...g,...c,ref:i,onCloseAutoFocus:Dr(n.onCloseAutoFocus,w=>{var E;b.current||(E=d.triggerRef.current)==null||E.focus(),b.current=!1,w.preventDefault()}),onInteractOutside:Dr(n.onInteractOutside,w=>{const E=w.detail.originalEvent,S=E.button===0&&E.ctrlKey===!0,_=E.button===2||S;(!d.modal||_)&&(b.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fJt.displayName=dJt;var pir="DropdownMenuGroup",gir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(eir,{...d,...c,ref:i})});gir.displayName=pir;var bir="DropdownMenuLabel",hJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(tir,{...d,...c,ref:i})});hJt.displayName=bir;var mir="DropdownMenuItem",pJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(nir,{...d,...c,ref:i})});pJt.displayName=mir;var wir="DropdownMenuCheckboxItem",gJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(rir,{...d,...c,ref:i})});gJt.displayName=wir;var yir="DropdownMenuRadioGroup",vir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(iir,{...d,...c,ref:i})});vir.displayName=yir;var Eir="DropdownMenuRadioItem",bJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(oir,{...d,...c,ref:i})});bJt.displayName=Eir;var Sir="DropdownMenuItemIndicator",mJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(sir,{...d,...c,ref:i})});mJt.displayName=Sir;var Tir="DropdownMenuSeparator",wJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(air,{...d,...c,ref:i})});wJt.displayName=Tir;var Air="DropdownMenuArrow",_ir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(cir,{...d,...c,ref:i})});_ir.displayName=Air;var xir="DropdownMenuSubTrigger",yJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(uir,{...d,...c,ref:i})});yJt.displayName=xir;var kir="DropdownMenuSubContent",vJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(lir,{...d,...c,ref:i,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});vJt.displayName=kir;var Nir=aJt,Cir=uJt,Iir=lJt,EJt=fJt,SJt=hJt,TJt=pJt,AJt=gJt,_Jt=bJt,xJt=mJt,kJt=wJt,NJt=yJt,CJt=vJt;const IJt=Nir,RJt=Cir,Rir=H.forwardRef(({className:n,inset:i,children:s,...c},d)=>I.jsxs(NJt,{ref:d,className:nr("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",i&&"pl-8",n),...c,children:[s,I.jsx(C8n,{className:"ml-auto"})]}));Rir.displayName=NJt.displayName;const Oir=H.forwardRef(({className:n,...i},s)=>I.jsx(CJt,{ref:s,className:nr("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:animate-out data-[state=open]:animate-in",n),...i}));Oir.displayName=CJt.displayName;const a9e=H.forwardRef(({className:n,sideOffset:i=4,container:s,...c},d)=>I.jsx(Iir,{container:s,children:I.jsx(EJt,{ref:d,sideOffset:i,className:nr("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] data-[state=closed]:animate-out data-[state=open]:animate-in",n),...c})}));a9e.displayName=EJt.displayName;const cLe=H.forwardRef(({className:n,inset:i,...s},c)=>I.jsx(TJt,{ref:c,className:nr("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",i&&"pl-8",n),...s}));cLe.displayName=TJt.displayName;const OJt=H.forwardRef(({className:n,children:i,checked:s,...c},d)=>I.jsxs(AJt,{ref:d,className:nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),checked:s,...c,children:[I.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(xJt,{children:I.jsx(oN,{className:"h-4 w-4"})})}),i]}));OJt.displayName=AJt.displayName;const Dir=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(_Jt,{ref:c,className:nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...s,children:[I.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(xJt,{children:I.jsx(F8n,{className:"h-2 w-2 fill-current"})})}),i]}));Dir.displayName=_Jt.displayName;const Lir=H.forwardRef(({className:n,inset:i,...s},c)=>I.jsx(SJt,{ref:c,className:nr("px-2 py-1.5 font-semibold text-sm",i&&"pl-8",n),...s}));Lir.displayName=SJt.displayName;const Mir=H.forwardRef(({className:n,...i},s)=>I.jsx(kJt,{ref:s,className:nr("-mx-1 my-1 h-px bg-muted",n),...i}));Mir.displayName=kJt.displayName;function KM({field:n,value:i,onChange:s,entities:c,domain:d,translations:g={},error:b}){const{t:w}=jo(["common"]),E=n.name,S=n.required??!1;let _=E,A="",C="";if("label"in n)_=n.label,A=n.description||"",C=n.placeholder||"";else if(d){const P=`component.${d}.device_automation.extra_fields.${E}`,j=`component.${d}.device_automation.extra_fields_descriptions.${E}`;_=g[P]||E.split("_").map(z=>z.charAt(0).toUpperCase()+z.slice(1)).join(" "),A=g[j]||"",console.log(`Field "${E}" in domain "${d}":`),console.log(` Label key: ${P} = ${g[P]||"(not found)"}`),console.log(` Desc key: ${j} = ${g[j]||"(not found)"}`),console.log(` Final label: ${_}`),console.log(` Final description: ${A}`)}else _=E.split("_").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "),console.log(`Field "${E}" with no domain - using formatted name: ${_}`);let O=null,L={};if("type"in n&&n.type)O=n.type;else if("selector"in n&&n.selector){const P=Object.keys(n.selector);P.length>0&&(O=P[0],L=n.selector[O]||{})}const D=typeof i=="string"?i:String(i??""),B=typeof i=="boolean"?i:!!i,$=()=>{switch(O){case"text":{if("multiple"in n&&n.multiple){const j=Array.isArray(i)?i:typeof i=="string"&&i?[i]:[];return I.jsx(oLe,{values:j,onChange:s,placeholder:C||"Add value..."})}return I.jsx(Na,{type:"text",value:D,onChange:j=>s(j.target.value),placeholder:C,required:S})}case"number":return I.jsx(xYt,{value:i,placeholder:C,required:S,onChange:s});case"boolean":return I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:B,onCheckedChange:s}),I.jsx("span",{className:"text-muted-foreground text-sm",children:w(B?"dynamicField.enabled":"dynamicField.disabled")})]});case"select":{const P=kYt("options"in n&&n.options?n.options:L.options);if("multiple"in n&&n.multiple||L.multiple===!0){const z=Array.isArray(i)?i:i?[i]:[],ee=()=>{var ne;return z.length===0?C||w("dynamicField.selectItems"):z.length===1?((ne=P.find(Q=>Q.value===z[0]))==null?void 0:ne.label)||z[0]:w("dynamicField.itemsSelected",{count:z.length})};return I.jsxs(IJt,{children:[I.jsx(RJt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",className:"w-full justify-between font-normal",children:[I.jsx("span",{className:z.length===0?"text-muted-foreground":"",children:ee()}),I.jsx(oae,{className:"ml-2 h-4 w-4 opacity-50"})]})}),I.jsx(a9e,{className:"w-[var(--radix-dropdown-menu-trigger-width)]",children:P.map(ne=>{const Q=z.includes(ne.value);return I.jsx(OJt,{checked:Q,onCheckedChange:ae=>{s(ae?[...z,ne.value]:z.filter(he=>he!==ne.value))},children:ne.label},ne.value)})})]})}return I.jsxs(zp,{value:D,onValueChange:s,children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:C||"Select..."})}),I.jsx(Gh,{children:P.map(z=>I.jsx(eo,{value:z.value,children:z.label},z.value))})]})}case"entity":{if("multiple"in n&&n.multiple||L.multiple===!0){const j=Array.isArray(i)?i:typeof i=="string"&&i?i.split(",").map(z=>z.trim()):[];return I.jsx(Qae,{value:j,onChange:s,entities:c,placeholder:C||w("dynamicField.selectEntities")})}return I.jsx(Sse,{value:D,onChange:s,entities:c,placeholder:C||w("dynamicField.selectEntity")})}case"zone":return I.jsx(Sse,{value:D,onChange:s,entities:c,domainFilter:"zone",placeholder:C||w("dynamicField.selectZone")});case"template":return I.jsx(Bv,{value:D,onChange:P=>s(P.target.value),placeholder:C||w("placeholders.enterTemplate"),className:"font-mono text-sm",rows:4,required:S});case"duration":return I.jsx(NYt,{value:i??"",onChange:s});case"object":return I.jsx(Bv,{value:typeof i=="object"?JSON.stringify(i,null,2):D,onChange:P=>{try{s(JSON.parse(P.target.value))}catch{s(P.target.value)}},placeholder:C||w("placeholders.jsonExample"),className:"font-mono text-sm",rows:4,required:S});case"time":return I.jsx(Na,{type:"time",value:D,onChange:P=>s(P.target.value),required:S});case"date":return I.jsx(Na,{type:"date",value:D,onChange:P=>s(P.target.value),required:S});default:return I.jsx(Na,{type:"text",value:D,onChange:P=>s(P.target.value),placeholder:C||w("dynamicField.enterValue",{name:E}),required:S})}};return I.jsxs("div",{className:"space-y-2",children:[I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[_,S&&I.jsx("span",{className:"ml-1 text-destructive",children:w("labels.requiredAsterisk")})]}),$(),I.jsx(H2,{message:b}),A&&I.jsx("p",{className:"text-muted-foreground text-xs",children:A})]})}const Pir={state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"The entity to check"},{name:"state",label:"State",type:"text",required:!0,placeholder:"e.g., on, off, home",description:"The state value to check for"},{name:"attribute",label:"Attribute (optional)",type:"text",required:!1,placeholder:"e.g., brightness, temperature",description:"Check a specific attribute instead of the state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the condition must be true"}],numeric_state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"The sensor entity to check"},{name:"above",label:"Above (optional)",type:"number",required:!1,placeholder:"Minimum value",description:"Condition is true when value > this"},{name:"below",label:"Below (optional)",type:"number",required:!1,placeholder:"Maximum value",description:"Condition is true when value < this"},{name:"attribute",label:"Attribute (optional)",type:"text",required:!1,placeholder:"e.g., brightness, temperature",description:"Check a specific attribute instead of the state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the condition must be true"}],template:[{name:"value_template",label:"Value Template",type:"template",required:!0,placeholder:'{{ states("sensor.temperature") | float > 20 }}',description:"Template that should evaluate to true/false"}],time:[{name:"after",label:"After (optional)",type:"time",required:!1,description:"Condition is true after this time"},{name:"before",label:"Before (optional)",type:"time",required:!1,description:"Condition is true before this time"},{name:"weekday",label:"Weekday (optional)",type:"select",required:!1,multiple:!0,description:"Days of the week when condition is true",options:[{value:"mon",label:"Monday"},{value:"tue",label:"Tuesday"},{value:"wed",label:"Wednesday"},{value:"thu",label:"Thursday"},{value:"fri",label:"Friday"},{value:"sat",label:"Saturday"},{value:"sun",label:"Sunday"}]}],sun:[{name:"after",label:"After",type:"select",required:!1,description:"Condition is true after this sun event",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}]},{name:"after_offset",label:"After Offset (optional)",type:"text",required:!1,placeholder:"e.g., -00:30:00",description:"Time offset for the after event"},{name:"before",label:"Before",type:"select",required:!1,description:"Condition is true before this sun event",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}]},{name:"before_offset",label:"Before Offset (optional)",type:"text",required:!1,placeholder:"e.g., +01:00:00",description:"Time offset for the before event"}],zone:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"Person or device tracker to monitor"},{name:"zone",label:"Zone",type:"zone",required:!0,placeholder:"zone.home",description:"Zone entity to check for presence"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the entity must be in the zone"}],trigger:[{name:"id",label:"Trigger ID(s)",type:"text",required:!0,multiple:!0,placeholder:"e.g., arriving, leaving",description:"The ID(s) of the trigger(s) to match"}],device:[],and:[],or:[],not:[]};function c9e(n){return Pir[n]||[]}function DJt(n){const i=c9e(n),s={condition:n};for(const c of i)c.default!==void 0&&(s[c.name]=c.default);return u9e(n)&&(s.conditions=[]),s}function u9e(n){return n==="and"||n==="or"||n==="not"}const jir=[{value:"state",labelKey:"nodes:conditions.types.state"},{value:"numeric_state",labelKey:"nodes:conditions.types.numeric_state"},{value:"template",labelKey:"nodes:conditions.types.template"},{value:"trigger",labelKey:"nodes:conditions.types.trigger"},{value:"zone",labelKey:"nodes:conditions.types.zone"},{value:"time",labelKey:"nodes:conditions.types.time"},{value:"sun",labelKey:"nodes:conditions.types.sun"},{value:"and",labelKey:"nodes:conditions.types.and"},{value:"or",labelKey:"nodes:conditions.types.or"},{value:"not",labelKey:"nodes:conditions.types.not"}];function Fir({cond:n,onUpdate:i,entities:s}){const c=n.condition||"state",d=c9e(c);return d.length===0?null:I.jsx("div",{className:"space-y-2",children:d.map(g=>I.jsx(KM,{field:g,value:n[g.name],onChange:b=>i({...n,[g.name]:b}),entities:s},g.name))})}function $ir({cond:n,onUpdate:i,onRemove:s,entities:c,depth:d}){const g=n.condition||"state",b=u9e(g),{t:w}=jo(["common","nodes","panels"]),E=S=>{i(DJt(S))};return I.jsxs("div",{className:nr("space-y-3 rounded-md border bg-card p-3",d>0&&"bg-muted/30"),children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsxs(zp,{value:n.condition||"state",onValueChange:E,children:[I.jsx(zh,{className:"w-full max-w-[180px]",children:I.jsx(Gp,{})}),I.jsx(Gh,{children:jir.map(S=>I.jsx(eo,{value:S.value,children:w(S.labelKey)},S.value))})]}),I.jsx(mi,{size:"icon",variant:"ghost",onClick:s,className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive",children:I.jsx(jM,{className:"h-4 w-4"})})]}),b?I.jsx(LJt,{conditions:n.conditions||[],onChange:S=>i({...n,conditions:S}),parentType:n.condition,depth:d+1}):I.jsx(Fir,{cond:n,onUpdate:i,entities:c})]})}const LJt=H.memo(function({conditions:i,onChange:s,depth:c=0}){const{hass:d}=Wg(),g=d?Object.values(d.states):[],{t:b}=jo(["common","nodes","panels"]),w=()=>{s([...i,{condition:"state",entity_id:"",state:""}])},E=_=>{s(i.filter((A,C)=>C!==_))},S=(_,A)=>{s(i.map((C,O)=>O===_?A:C))};return I.jsxs("div",{className:nr("space-y-2",c>0&&"border-muted border-l-2 pl-2"),children:[i.length===0?I.jsx("p",{className:"py-2 text-muted-foreground text-xs italic",children:b("panels:conditionGroupEditor.noConditions")}):i.map((_,A)=>I.jsx($ir,{cond:_,onUpdate:C=>S(A,C),onRemove:()=>E(A),entities:g,depth:c},A)),I.jsxs(mi,{size:"sm",variant:"outline",onClick:w,className:"w-full",children:[I.jsx(sae,{className:"mr-1 h-4 w-4"}),b("panels:conditionGroupEditor.addCondition")]})]})});function MJt({value:n,onChange:i,label:s="",required:c=!1,placeholder:d=""}){const{t:g}=jo(["common"]),{hass:b}=Wg(),[w,E]=H.useState(n);H.useEffect(()=>{E(n)},[n]);const S=(b==null?void 0:b.devices)??{},_=Object.keys(S).length>0,A=n&&_&&!S[n],C=()=>{if(!n)return;const O=S[n];return O?O.name_by_user||O.name||O.id:n};return I.jsx(No,{label:s||g("labels.device"),required:c,children:_?I.jsxs(zp,{value:n,onValueChange:i,children:[I.jsx(zh,{className:A?"font-mono text-red-600":void 0,children:I.jsx(Gp,{placeholder:d||g("placeholders.selectDevice"),children:C()})}),I.jsx(Gh,{children:Object.values(S).map(O=>I.jsx(eo,{value:O.id,children:O.name_by_user||O.name||O.id},O.id))})]}):I.jsxs(I.Fragment,{children:[I.jsx(Na,{type:"text",value:w,onChange:O=>{E(O.target.value),i(O.target.value)},placeholder:g("deviceSelector.enterId")}),I.jsx("p",{className:"text-muted-foreground text-xs",children:g("deviceSelector.noDevices")})]})})}function Bir({node:n,onChange:i}){const s=jh(n,"device_id"),c=jh(n,"domain"),d=jh(n,"type");return I.jsxs(I.Fragment,{children:[I.jsx(MJt,{value:s,onChange:g=>i("device_id",g),label:"Device",required:!0,placeholder:"Select device..."}),I.jsx(No,{label:"Domain",required:!0,description:"Device integration domain",children:I.jsx(Na,{type:"text",value:c,onChange:g=>i("domain",g.target.value),placeholder:"e.g., binary_sensor, sensor"})}),I.jsx(No,{label:"Type",required:!0,description:"Device condition type",children:I.jsx(Na,{type:"text",value:d,onChange:g=>i("type",g.target.value),placeholder:"e.g., button_short_press"})})]})}function Uir({node:n,onChange:i,entities:s}){const{t:c}=jo(["common","nodes"]),{getFieldError:d}=gb(n.id),g=jh(n,"condition","state"),b=n.data,w=Array.isArray(b.conditions)&&b.conditions.length>0,E=u9e(g),S=A=>{const C=DJt(A);for(const[O,L]of Object.entries(C))i(O,L)},_=()=>g==="device"?I.jsx(Bir,{node:n,onChange:i}):E?null:c9e(g).map(C=>I.jsx(KM,{field:C,value:b[C.name],onChange:O=>i(C.name,O),entities:s,error:d(C.name)},C.name));return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:conditions.conditionLabel"),required:!0,children:I.jsxs(zp,{value:g,onValueChange:S,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"state",children:c("nodes:conditions.types.state")}),I.jsx(eo,{value:"numeric_state",children:c("nodes:conditions.types.numeric_state")}),I.jsx(eo,{value:"template",children:c("nodes:conditions.types.template")}),I.jsx(eo,{value:"time",children:c("nodes:conditions.types.time")}),I.jsx(eo,{value:"sun",children:c("nodes:conditions.types.sun")}),I.jsx(eo,{value:"zone",children:c("nodes:conditions.types.zone")}),I.jsx(eo,{value:"device",children:c("nodes:conditions.types.device")}),I.jsx(eo,{value:"trigger",children:c("nodes:conditions.types.trigger")}),I.jsx(eo,{value:"and",children:c("nodes:conditions.types.and")}),I.jsx(eo,{value:"or",children:c("nodes:conditions.types.or")}),I.jsx(eo,{value:"not",children:c("nodes:conditions.types.not")})]})]})}),_(),(E||w)&&I.jsx(No,{label:c("nodes:conditions.nestedConditions"),children:I.jsx(LJt,{conditions:b.conditions||[],onChange:A=>i("conditions",A),parentType:E?g:"and"})})]})}function Hir({node:n,onChange:i}){const{getFieldError:s}=gb(n.id);return I.jsxs(I.Fragment,{children:[I.jsx(CYt,{label:"Delay",value:n.data.delay,onChange:c=>i("delay",c)}),I.jsx(H2,{message:s("delay")})]})}function zir({node:n,onChange:i}){const{t:s}=jo(["nodes"]),{getFieldError:c}=gb(n.id),d=C5(n,"variables",{}),g=Object.entries(d),b=()=>{const _=Object.keys(d);let A="variable",C=1;for(;_.includes(A);)A=`variable_${C}`,C++;i("variables",{...d,[A]:""})},w=(_,A)=>{if(_===A)return;const C={};for(const[O,L]of Object.entries(d))O===_?C[A]=L:C[O]=L;i("variables",C)},E=(_,A)=>{i("variables",{...d,[_]:A})},S=_=>{const A={...d};delete A[_],i("variables",A)};return I.jsxs("div",{className:"space-y-4",children:[I.jsx(H2,{message:c("variables")}),g.length===0?I.jsx("p",{className:"text-muted-foreground text-sm",children:s("nodes:setVariablesFields.empty")}):g.map(([_,A],C)=>I.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:[I.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[I.jsx("span",{className:"font-medium text-muted-foreground text-xs",children:s("nodes:setVariablesFields.variableLabel",{index:C+1})}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>S(_),className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{className:"h-3.5 w-3.5"})})]}),I.jsxs("div",{className:"space-y-3",children:[I.jsx(No,{label:s("nodes:setVariablesFields.name"),children:I.jsx(Na,{value:_,onChange:O=>w(_,O.target.value),placeholder:s("nodes:setVariablesFields.namePlaceholder"),className:"font-mono text-sm"})}),I.jsx(No,{label:s("nodes:setVariablesFields.value"),description:s("nodes:setVariablesFields.valueDescription"),children:I.jsx(Bv,{value:String(A??""),onChange:O=>E(_,O.target.value),placeholder:s("nodes:setVariablesFields.valuePlaceholder"),className:"font-mono text-sm"})})]})]},`${_}-${C}`)),I.jsxs(mi,{variant:"outline",onClick:b,className:"w-full gap-2",size:"sm",children:[I.jsx(sae,{className:"h-4 w-4"}),s("nodes:setVariablesFields.addVariable")]})]})}const PJt={state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,multiple:!0,description:"The entity to monitor for state changes"},{name:"to",label:"To State",type:"text",required:!1,placeholder:"e.g., on, off, home",description:"The target state to trigger on"},{name:"from",label:"From State",type:"text",required:!1,placeholder:"e.g., off",description:"Only trigger when transitioning from this state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"State must be stable for this duration"}],numeric_state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,multiple:!0,description:"The sensor entity to monitor"},{name:"above",label:"Above",type:"number",required:!1,placeholder:"e.g., 20",description:"Trigger when value goes above this threshold"},{name:"below",label:"Below",type:"number",required:!1,placeholder:"e.g., 30",description:"Trigger when value goes below this threshold"},{name:"value_template",label:"Value Template (optional)",type:"template",required:!1,placeholder:"e.g., {{ state.attributes.temperature }}",description:"Template to extract numeric value from entity"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"Value must be stable for this duration"}],time:[{name:"at",label:"At (time)",type:"text",required:!0,placeholder:"e.g., 07:00:00 or input_datetime.wake_up",description:"Time to trigger (HH:MM:SS or entity reference)"}],time_pattern:[{name:"hours",label:"Hours",type:"text",required:!1,placeholder:"e.g., */2 (every 2 hours)",description:"Hour pattern (cron-style)"},{name:"minutes",label:"Minutes",type:"text",required:!1,placeholder:"e.g., /5 (every 5 minutes)",description:"Minute pattern (cron-style)"},{name:"seconds",label:"Seconds",type:"text",required:!1,placeholder:"e.g., 0",description:"Second pattern (cron-style)"}],event:[{name:"event_type",label:"Event Type",type:"text",required:!0,placeholder:"e.g., zha_event, call_service",description:"The type of event to listen for"},{name:"event_data",label:"Event Data (optional)",type:"object",required:!1,description:"Filter events by data fields (JSON object)"}],mqtt:[{name:"topic",label:"Topic",type:"text",required:!0,placeholder:"e.g., home/bedroom/temperature",description:"MQTT topic to subscribe to"},{name:"payload",label:"Payload (optional)",type:"text",required:!1,placeholder:"e.g., ON",description:"Only trigger on this specific payload"}],webhook:[{name:"webhook_id",label:"Webhook ID",type:"text",required:!0,placeholder:"e.g., my_webhook",description:"Unique identifier for this webhook"}],sun:[{name:"event",label:"Event",type:"select",required:!0,description:"Trigger at sunrise or sunset",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}],default:"sunset"},{name:"offset",label:"Offset (optional)",type:"text",required:!1,placeholder:"e.g., -00:30:00",description:"Time offset before (-) or after (+) the event"}],zone:[{name:"entity_id",label:"Person/Device",type:"entity",required:!0,multiple:!0,description:"The person or device tracker to monitor"},{name:"zone",label:"Zone",type:"zone",required:!0,placeholder:"e.g., zone.home",description:"The zone entity to monitor"},{name:"event",label:"Event",type:"select",required:!0,description:"Trigger on enter or leave",options:[{value:"enter",label:"Enter"},{value:"leave",label:"Leave"}],default:"enter"}],template:[{name:"value_template",label:"Value Template",type:"template",required:!0,placeholder:'e.g., {{ is_state("light.bedroom", "on") }}',description:"Template that evaluates to true/false"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"Template must be true for this duration"}],homeassistant:[{name:"event",label:"Event",type:"select",required:!0,description:"Home Assistant lifecycle event",options:[{value:"start",label:"Start"},{value:"shutdown",label:"Shutdown"}],default:"start"}],device:[]};function ice(n){return PJt[n]||[]}function Gir(n){const i=ice(n),s={trigger:n};for(const c of i)c.default!==void 0&&(s[c.name]=c.default);return s}function qir(){const{hass:n}=Wg(),i=H.useCallback(async c=>{if(!(n!=null&&n.callWS))return console.warn("callWS not available"),[];try{return await n.callWS({type:"device_automation/trigger/list",device_id:c})||[]}catch(d){throw console.error("Failed to fetch device triggers:",d),d}},[n]),s=H.useCallback(async c=>{if(!(n!=null&&n.callWS))return console.warn("callWS not available"),{extra_fields:[]};try{return await n.callWS({type:"device_automation/trigger/capabilities",trigger:c})||{extra_fields:[]}}catch(d){throw console.error("Failed to fetch trigger capabilities:",d),d}},[n]);return{getDeviceTriggers:i,getTriggerCapabilities:s}}const Vir=Sc({resources:yf(Zt(),Dc()).transform(n=>{const i={};for(const[s,c]of Object.entries(n))typeof c=="string"&&(i[s]=c);return i})});function Wir(){const{hass:n}=Wg(),[i,s]=H.useState({}),[c,d]=H.useState(!0),g=H.useMemo(()=>{const w=n==null?void 0:n.resources;if(!w||Object.keys(w).length===0)return{};const E=Object.values(w)[0];if(typeof E=="string")return w;if(typeof E=="object"&&E!==null){const S={};for(const _ of Object.values(w))typeof _=="object"&&_!==null&&Object.assign(S,_);return S}return{}},[n==null?void 0:n.resources]);return H.useEffect(()=>{if(!n){d(!1);return}(async()=>{d(!0);try{const E=await n.callWS({type:"frontend/get_translations",language:navigator.language.split("-")[0]||"en",category:"device_automation"}),S=Vir.safeParse(E);S.success&&s(S.data.resources)}catch{}finally{d(!1)}})()},[n]),{translations:H.useMemo(()=>({...g,...i}),[g,i]),isLoading:c}}function JOe(n){const i=[n.type];return n.subtype&&i.push(n.subtype),n.entity_id&&i.push(n.entity_id),i.join("::")}function Kir(n,i){const s=`component.${n.domain}.device_automation.trigger_type.${n.type}`,c=i[s]??n.type;if(n.subtype){const d=`component.${n.domain}.device_automation.trigger_subtype.${n.subtype}`,g=i[d]??n.subtype;return`${c}: ${g}`}return c}function Yir({node:n,onChange:i,entities:s}){const{t:c}=jo(["common","nodes","errors"]),{getDeviceTriggers:d,getTriggerCapabilities:g}=qir(),{translations:b}=Wir(),[w,E]=H.useState([]),[S,_]=H.useState([]),[A,C]=H.useState(!1),O=jh(n,"device_id"),L=jh(n,"type"),D=jh(n,"domain"),B=jh(n,"entity_id"),$=jh(n,"subtype"),P=(()=>{const j=[L].filter(Boolean);return $&&j.push($),B&&j.push(B),j.join("::")})();return H.useEffect(()=>{if(!O){E([]);return}C(!0),d(O).then(j=>{E(j)}).catch(j=>{console.error(c("errors:api.loadDeviceTriggersFailed"),j),E([])}).finally(()=>{C(!1)})},[O,d,c]),H.useEffect(()=>{if(!O||!L){_([]);return}const j=w.find(z=>z.type===L&&z.domain===D&&(z.subtype??"")===($??"")&&(z.entity_id??"")===(B??""));if(!j){_([]);return}g(j).then(z=>{_(z.extra_fields||[])}).catch(z=>{console.error(c("errors:api.loadTriggerCapabilitiesFailed"),z),_([])})},[O,L,$,B,D,w,g,c]),I.jsxs(I.Fragment,{children:[I.jsx(MJt,{value:O,onChange:j=>i("device_id",j),label:c("labels.device"),required:!0,placeholder:c("placeholders.selectDevice")}),O&&w.length>0?I.jsx(No,{label:c("labels.triggerType"),required:!0,children:I.jsxs(zp,{value:P,onValueChange:j=>{const z=w.find(ee=>JOe(ee)===j);z&&(i("type",z.type),i("domain",z.domain),i("subtype",z.subtype??void 0),i("entity_id",z.entity_id??void 0))},children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:c("placeholders.selectTriggerType")})}),I.jsx(Gh,{children:w.map(j=>I.jsx(eo,{value:JOe(j),children:Kir(j,b)},JOe(j)))})]})}):O&&L&&I.jsx(No,{label:"Trigger Type",children:I.jsxs("div",{className:"truncate rounded-md border bg-muted px-3 py-2 font-mono text-sm",children:[L,$&&I.jsxs("span",{className:"text-muted-foreground",children:[" · ",$]}),D&&I.jsxs("span",{className:"text-muted-foreground",children:[" ",`(${D})`]})]})}),A&&I.jsx("div",{className:"text-muted-foreground text-sm",children:c("status.loadingTriggers")}),S.map(j=>I.jsx(KM,{field:j,value:n.data[j.name],onChange:z=>i(j.name,z),entities:s,domain:D,translations:b},j.name))]})}const Jir={light:["on","off","unavailable"],switch:["on","off","unavailable"],binary_sensor:["on","off","unavailable"],input_boolean:["on","off"],cover:["open","closed","opening","closing","unavailable"],lock:["locked","unlocked","locking","unlocking","unavailable"],alarm_control_panel:["disarmed","armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass","pending","arming","disarming","triggered","unavailable"],climate:["heat","cool","heat_cool","auto","dry","fan_only","off","unavailable"],fan:["on","off","unavailable"],media_player:["playing","paused","idle","off","on","standby","buffering","unavailable"],vacuum:["cleaning","docked","paused","idle","returning","error","unavailable"],person:["home","not_home","unavailable"],device_tracker:["home","not_home","unavailable"],water_heater:["electric","gas","heat_pump","eco","performance","high_demand","off","unavailable"],humidifier:["on","off","unavailable"],update:["on","off","unavailable"]},jJt=["on","off","unavailable","unknown"];function Xir(n,i){const s=i.find(b=>b.entity_id===n),c=n.split(".")[0],d=Jir[c]??jJt,g=new Set(d);return s!=null&&s.state?[s.state,...d.filter(b=>b!==s.state)]:Array.from(g)}function f$t({value:n,onChange:i,suggestions:s,placeholder:c}){const{t:d}=jo(["common"]),[g,b]=H.useState(!1),[w,E]=H.useState(""),S=H.useMemo(()=>w?s.filter(C=>C.toLowerCase().includes(w.toLowerCase())):s,[w,s]),_=w&&!s.includes(w),A=C=>{i(C===n?"":C),b(!1),E("")};return I.jsxs(dMe,{open:g,onOpenChange:b,children:[I.jsx(oVt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",role:"combobox","aria-expanded":g,className:nr("flex w-full justify-between",!n&&"text-muted-foreground"),children:[I.jsx("span",{className:"truncate",children:n||c}),I.jsx(EGt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),I.jsx(_ae,{className:"w-[286px] p-0",children:I.jsxs(pae,{shouldFilter:!1,children:[I.jsx(gae,{placeholder:c,value:w,onValueChange:E}),I.jsxs(bae,{children:[S.length===0&&!_&&I.jsx(mae,{children:d("combobox.noOptions")}),_&&I.jsx(nz,{children:I.jsxs(rz,{value:w,onSelect:A,children:[I.jsx("span",{className:"text-muted-foreground text-xs mr-2",children:d("stateTrigger.useValue")}),I.jsx("span",{className:"font-mono",children:w}),I.jsx(oN,{className:nr("ml-auto h-4 w-4",n===w?"opacity-100":"opacity-0")})]})}),S.length>0&&I.jsx(nz,{children:S.map(C=>I.jsxs(rz,{value:C,onSelect:A,children:[I.jsx("span",{className:"font-mono",children:C}),I.jsx(oN,{className:nr("ml-auto h-4 w-4",n===C?"opacity-100":"opacity-0")})]},C))})]})]})})]})}function Zir({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes","common"]),{getFieldError:d}=gb(n.id),{entities:g}=Wg(),b=s.length>0?s:g,w=n.data.entity_id,E=Array.isArray(w)?w:typeof w=="string"&&w?[w]:[],S=jh(n,"to"),_=jh(n,"from"),A=H.useMemo(()=>{if(E.length===0)return jJt;const O=new Set;for(const L of E)for(const D of Xir(L,b))O.add(D);return Array.from(O)},[E,b]),C=ice("state").find(O=>O.name==="for");return I.jsxs(I.Fragment,{children:[I.jsxs(No,{label:c("nodes:triggers.fields.entityId"),required:!0,children:[I.jsx(Qae,{value:E,onChange:O=>i("entity_id",O),entities:b,placeholder:c("common:placeholders.selectEntity")}),I.jsx(H2,{message:d("entity_id")})]}),I.jsx(No,{label:c("nodes:triggers.fields.toState"),children:I.jsx(f$t,{value:S,onChange:O=>i("to",O||void 0),suggestions:A,placeholder:c("nodes:triggers.fields.toStatePlaceholder")})}),I.jsx(No,{label:c("nodes:triggers.fields.fromState"),children:I.jsx(f$t,{value:_,onChange:O=>i("from",O||void 0),suggestions:A,placeholder:c("nodes:triggers.fields.fromStatePlaceholder")})}),C&&I.jsx(KM,{field:C,value:n.data[C.name],onChange:O=>i(C.name,O),entities:b,error:d(C.name)})]})}function Qir({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes"]),{getFieldError:d}=gb(n.id),g=jh(n,"trigger","state"),b=jh(n,"device_id"),w=b&&g!=="device"?"device":g;H.useEffect(()=>{b&&g!=="device"&&i("trigger","device")},[b,g,i]);const E=S=>{const _=Gir(S);for(const[A,C]of Object.entries(_))i(A,C);S!=="device"&&b&&i("device_id",void 0)};return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:triggers.platformLabel"),required:!0,children:I.jsxs(zp,{value:w,onValueChange:E,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"state",children:c("nodes:triggers.platforms.state")}),I.jsx(eo,{value:"numeric_state",children:c("nodes:triggers.platforms.numeric_state")}),I.jsx(eo,{value:"time",children:c("nodes:triggers.platforms.time")}),I.jsx(eo,{value:"time_pattern",children:c("nodes:triggers.platforms.time_pattern")}),I.jsx(eo,{value:"sun",children:c("nodes:triggers.platforms.sun")}),I.jsx(eo,{value:"event",children:c("nodes:triggers.platforms.event")}),I.jsx(eo,{value:"mqtt",children:c("nodes:triggers.platforms.mqtt")}),I.jsx(eo,{value:"webhook",children:c("nodes:triggers.platforms.webhook")}),I.jsx(eo,{value:"zone",children:c("nodes:triggers.platforms.zone")}),I.jsx(eo,{value:"template",children:c("nodes:triggers.platforms.template")}),I.jsx(eo,{value:"homeassistant",children:c("nodes:triggers.platforms.homeassistant")}),I.jsx(eo,{value:"device",children:c("nodes:triggers.platforms.device")})]})]})}),I.jsx(eor,{effectiveTriggerType:w,deviceId:b,node:n,onChange:i,entities:s,getFieldError:d})]})}function eor({effectiveTriggerType:n,deviceId:i,node:s,onChange:c,entities:d,getFieldError:g}){return n==="device"||i?I.jsx(Yir,{node:s,onChange:c,entities:d}):n==="state"?I.jsx(Zir,{node:s,onChange:c,entities:d}):ice(n).map(w=>I.jsx(KM,{field:w,value:s.data[w.name],onChange:E=>c(w.name,E),entities:d,error:g(w.name)},w.name))}function tor({node:n,onChange:i}){const{t:s}=jo(["nodes"]),{getFieldError:c,getRootError:d}=gb(n.id),g=po(L=>L.addWaitTimeoutBranch),b=jh(n,"wait_template"),w=QMe(n,"wait_for_trigger"),E=w!==void 0?"trigger":"template",S=d(),_=L=>{L==="template"?(i("wait_for_trigger",void 0),i("wait_template","")):(i("wait_template",void 0),i("wait_for_trigger",[{trigger:"state"}]))},A=(L,D,B)=>{if(!w)return;const $=[...w];$[L]={...$[L],[D]:B},i("wait_for_trigger",$)},C=()=>{const L=[...w||[],{trigger:"state"}];i("wait_for_trigger",L)},O=L=>{if(!w)return;const D=w.filter((B,$)=>$!==L);i("wait_for_trigger",D)};return I.jsxs(I.Fragment,{children:[I.jsx(H2,{message:S}),I.jsx(No,{label:s("nodes:wait.waitType"),description:s("nodes:wait.waitTypeDescription"),children:I.jsxs(zp,{value:E,onValueChange:_,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"template",children:s("nodes:wait.types.template")}),I.jsx(eo,{value:"trigger",children:s("nodes:wait.types.triggers")})]})]})}),E==="template"&&I.jsxs(No,{label:s("nodes:wait.waitTemplate"),required:!0,description:s("nodes:wait.waitTemplateDescription"),children:[I.jsx(Bv,{value:b||"",onChange:L=>i("wait_template",L.target.value),className:"font-mono",rows:3,placeholder:s("nodes:placeholders.waitTemplate")}),I.jsx(H2,{message:c("wait_template")})]}),E==="trigger"&&I.jsxs("div",{className:"space-y-4",children:[I.jsx(H2,{message:c("wait_for_trigger")}),I.jsxs("div",{className:"space-y-2",children:[I.jsx("h3",{className:"font-medium",children:s("nodes:wait.triggersHeading")}),w==null?void 0:w.map((L,D)=>I.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx("p",{className:"font-semibold text-sm capitalize",children:s("nodes:wait.triggerLabel",{index:D+1,platform:L.trigger})}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>O(D),className:"h-8 w-8 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{})})]}),I.jsx(No,{label:s("nodes:wait.triggerPlatformLabel","Platform"),children:I.jsxs(zp,{value:L.trigger,onValueChange:B=>A(D,"trigger",B),children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsx(Gh,{children:Object.keys(PJt).map(B=>I.jsx(eo,{value:B,children:B},B))})]})}),ice(L.trigger).map(B=>I.jsx(KM,{field:B,value:L[B.name],onChange:$=>A(D,B.name,$)},B.name))]},D))]}),I.jsx(mi,{onClick:C,variant:"outline",size:"sm",children:s("nodes:wait.addTrigger")})]}),I.jsx(CYt,{label:s("nodes:wait.timeoutLabel"),description:s("nodes:wait.timeoutDescription"),value:n.data.timeout??"",onChange:L=>i("timeout",L||void 0)}),n.data.timeout&&I.jsxs(I.Fragment,{children:[I.jsx(No,{label:s("nodes:wait.continueOnTimeout"),description:s("nodes:wait.continueOnTimeoutDescription"),children:I.jsx(J2,{checked:n.data.continue_on_timeout??!0,onCheckedChange:L=>i("continue_on_timeout",L)})}),I.jsx(No,{label:s("nodes:wait.branchOnTimeout"),description:s("nodes:wait.branchOnTimeoutDescription"),children:I.jsxs(mi,{variant:"outline",size:"sm",onClick:()=>g(n.id),className:"gap-2",children:[I.jsx(G5e,{className:"h-4 w-4"}),s("nodes:wait.addTimeoutBranch")]})})]})]})}function nor({node:n,onChange:i,entities:s}){switch(n.type){case"trigger":return I.jsx(Qir,{node:n,onChange:i,entities:s});case"condition":return I.jsx(Uir,{node:n,onChange:i,entities:s});case"action":return I.jsx(orr,{node:n,onChange:i,entities:s});case"delay":return I.jsx(Hir,{node:n,onChange:i});case"wait":return I.jsx(tor,{node:n,onChange:i});case"set_variables":return I.jsx(zir,{node:n,onChange:i});default:return null}}const uLe={key:"",value:"",type:"string",isAdding:!1};function ror(n,i){switch(i.type){case"setKey":return{...n,key:i.payload};case"setValue":return{...n,value:i.payload};case"setType":return{...n,type:i.payload};case"startAdding":return{...n,isAdding:!0};case"cancelAdding":return{...uLe};case"reset":return{...uLe};default:return n}}function ior(n,i){switch(i){case"number":{const s=Number(n);if(Number.isNaN(s))throw new Error("Invalid number value");return s}case"boolean":return n.toLowerCase()==="true";case"array":try{const s=JSON.parse(n);if(!Array.isArray(s))throw new Error("Not an array");return s}catch{throw new Error("Invalid JSON array format")}default:return n}}function oor(n){const[i,s]=H.useReducer(ror,uLe);return{state:i,setKey:d=>s({type:"setKey",payload:d}),setValue:d=>s({type:"setValue",payload:d}),setType:d=>s({type:"setType",payload:d}),startAdding:()=>s({type:"startAdding"}),cancelAdding:()=>s({type:"cancelAdding"}),handleAdd:()=>{if(!i.key.trim())throw new Error("Property name is required");const d=ior(i.value,i.type);n(i.key,d),s({type:"reset"})}}}function sor({node:n,handledProperties:i,onChange:s,onDelete:c}){const{t:d}=jo(["common","nodes","errors"]),b=oor((_,A)=>{s(_,A)}),w=n.data,E=Object.entries(w).filter(([_,A])=>!i.has(_)&&!jDe(_)&&A!==void 0&&A!==null&&A!=="");if(E.length===0&&!b.state.isAdding)return null;const S=()=>{try{b.handleAdd()}catch(_){alert(_ instanceof Error?_.message:d("errors:properties.addFailed"))}};return I.jsxs("div",{className:"space-y-3",children:[I.jsx("div",{className:"border-t pt-3",children:I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{className:"font-medium text-muted-foreground text-xs",children:d("nodes:panel.additionalProperties")}),I.jsxs(mi,{variant:"ghost",size:"sm",onClick:b.startAdding,className:"h-6 px-2 text-xs",children:[I.jsx(sae,{className:"mr-1 h-3 w-3"}),d("buttons.add")]})]})}),b.state.isAdding&&I.jsxs("div",{className:"space-y-2 rounded border p-3",children:[I.jsx(No,{label:d("nodes:panel.propertyName"),required:!0,children:I.jsx(Na,{type:"text",value:b.state.key,onChange:_=>b.setKey(_.target.value),placeholder:d("nodes:placeholders.customProperty")})}),I.jsx(No,{label:d("nodes:panel.type"),children:I.jsxs(zp,{value:b.state.type,onValueChange:_=>b.setType(_),children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"string",children:d("nodes:triggers.dataTypes.string")}),I.jsx(eo,{value:"number",children:d("nodes:triggers.dataTypes.number")}),I.jsx(eo,{value:"boolean",children:d("nodes:triggers.dataTypes.boolean")}),I.jsx(eo,{value:"array",children:d("nodes:triggers.dataTypes.json")})]})]})}),I.jsx(No,{label:d("nodes:panel.value"),children:b.state.type==="boolean"?I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:b.state.value==="true",onCheckedChange:_=>b.setValue(_?"true":"false")}),I.jsx(ll,{className:"text-sm",children:b.state.value==="true"?d("boolean.true"):d("boolean.false")})]}):b.state.type==="array"?I.jsx(Bv,{value:b.state.value,onChange:_=>b.setValue(_.target.value),placeholder:d("nodes:placeholders.jsonArray"),className:"font-mono",rows:2}):I.jsx(Na,{type:b.state.type==="number"?"number":"text",value:b.state.value,onChange:_=>b.setValue(_.target.value),placeholder:b.state.type==="number"?d("nodes:placeholders.number"):d("nodes:placeholders.enterValue")})}),I.jsxs("div",{className:"flex justify-end gap-2",children:[I.jsx(mi,{variant:"ghost",size:"sm",onClick:b.cancelAdding,children:d("buttons.cancel")}),I.jsx(mi,{size:"sm",onClick:S,children:d("nodes:panel.addProperty")})]})]}),E.map(([_,A])=>I.jsx(aor,{name:_,value:A,onChange:C=>s(_,C),onDelete:()=>c(_)},_))]})}function aor({name:n,value:i,onChange:s,onDelete:c}){const{t:d}=jo(["common","nodes"]);return I.jsxs("div",{className:"space-y-2",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{className:"font-medium text-muted-foreground text-xs capitalize",children:n.replace(/_/g," ")}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:c,className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10",children:I.jsx(jM,{className:"h-3 w-3"})})]}),typeof i=="boolean"?I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:i,onCheckedChange:g=>s(g)}),I.jsx(ll,{className:"text-sm",children:d(i?"boolean.true":"boolean.false")})]}):Array.isArray(i)?I.jsx(Bv,{value:JSON.stringify(i,null,2),onChange:g=>{try{const b=JSON.parse(g.target.value);s(b)}catch{}},className:"font-mono",rows:Math.min(i.length+1,4),placeholder:d("nodes:placeholders.jsonArray")}):typeof i=="object"?I.jsx(Bv,{value:JSON.stringify(i,null,2),onChange:g=>{try{const b=JSON.parse(g.target.value);s(b)}catch{}},className:"font-mono",rows:4,placeholder:d("nodes:placeholders.jsonObject")}):I.jsx(Na,{type:"text",value:String(i),onChange:g=>{const b=g.target.value;if(typeof i=="number"){const w=Number(b);Number.isNaN(w)||s(w)}else s(b)},placeholder:d("nodes:placeholders.enterType",{type:typeof i})})]})}function cor(){const{t:n}=jo(["common","nodes"]),i=po(O=>O.selectedNodeId),s=po(O=>O.nodes),c=po(O=>O.updateNodeData),d=po(O=>O.removeNode),{hass:g,entities:b}=Wg(),w=H.useMemo(()=>g!=null&&g.states&&Object.keys(g.states).length>0?Object.values(g.states).map(O=>({entity_id:O.entity_id,state:O.state,attributes:O.attributes||{},last_changed:O.last_changed||"",last_updated:O.last_updated||"",context:O.context})):b,[g,b]),E=H.useMemo(()=>s.find(O=>O.id===i),[s,i]),S=H.useMemo(()=>{if(!E)return c$t("trigger",[]);const O=c$t(E.type||"trigger",[]),L=E.data,D=typeof L.trigger=="string"?L.trigger:"",B=typeof L.device_id=="string"?L.device_id:"";if((D==="device"||B)&&(E.type==="trigger"||E.type==="condition")){const P=Object.keys(L);return new Set([...O,...P])}return O},[E]),{getFieldError:_}=gb((E==null?void 0:E.id)??"");if(!E)return I.jsx(qnr,{});const A=(O,L)=>{c(E.id,{[O]:L})},C=O=>{c(E.id,{[O]:void 0})};return I.jsxs("div",{className:"h-full flex-1 space-y-4 overflow-y-auto p-4",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsxs("h3",{className:"font-semibold text-foreground text-sm",children:[E.type?n(`nodes:types.${E.type}`):n("nodes:types.node")," ",n("nodes:panel.properties")]}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>d(E.id),className:"h-8 w-8 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{className:"h-4 w-4"})})]}),I.jsx(No,{label:n("labels.alias"),children:I.jsx(Na,{type:"text",value:typeof E.data.alias=="string"?E.data.alias:"",onChange:O=>A("alias",O.target.value),placeholder:n("placeholders.optionalDisplayName")})}),E.type==="trigger"&&I.jsxs(No,{label:n("labels.id"),children:[I.jsx(Na,{type:"text",value:typeof E.data.id=="string"?E.data.id:"",onChange:O=>A("id",O.target.value||void 0),placeholder:n("placeholders.optionalUniqueId"),className:"font-mono"}),I.jsx(H2,{message:_("id")})]}),I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{htmlFor:"node-enabled",className:"text-sm",children:n("labels.enabled")}),I.jsx(J2,{id:"node-enabled",checked:E.data.enabled!==!1,onCheckedChange:O=>A("enabled",O?void 0:!1)})]}),I.jsx($z,{}),I.jsx(nor,{node:E,onChange:A,entities:w}),I.jsx(sor,{node:E,handledProperties:S,onChange:A,onDelete:C}),I.jsx("div",{className:"pt-2 text-muted-foreground text-xs",children:n("nodes:panel.nodeId",{id:E.id})})]})}function uor(n){const i=document.createElement("textarea");i.value=n,document.body.appendChild(i),i.focus(),i.select();try{document.execCommand("copy")}catch(s){console.error("Unable to copy to clipboard",s)}document.body.removeChild(i)}async function lor(n){return navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(n):uor(n)}function Hk(){return Hk=Object.assign?Object.assign.bind():function(n){for(var i=1;i4&&s.slice(0,4)==="data"&&bor.test(i)){if(i.charAt(4)==="-"){const g=i.slice(5).replace(p$t,wor);c="data"+g.charAt(0).toUpperCase()+g.slice(1)}else{const g=i.slice(4);if(!p$t.test(g)){let b=g.replace(gor,mor);b.charAt(0)!=="-"&&(b="-"+b),i="data"+b}}d=l9e}return new d(c,i)}function mor(n){return"-"+n.toLowerCase()}function wor(n){return n.charAt(1).toUpperCase()}const oce=$Jt([BJt,hor,zJt,GJt,qJt],"html"),qz=$Jt([BJt,por,zJt,GJt,qJt],"svg");function _se(n){const i=[],s=String(n||"");let c=s.indexOf(","),d=0,g=!1;for(;!g;){c===-1&&(c=s.length,g=!0);const b=s.slice(d,c).trim();(b||!g)&&i.push(b),d=c+1,c=s.indexOf(",",d)}return i}function yor(n,i){const s=i||{};return(n[n.length-1]===""?[...n,""]:n).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const g$t=/[#.]/g;function vor(n,i){const s=n||"",c={};let d=0,g,b;for(;d-1&&g<=i.length){let b=0;for(;;){let w=s[b];if(w===void 0){const E=m$t(i,s[b-1]);w=E===-1?i.length+1:E+1,s[b]=w}if(w>g)return{line:b+1,column:g-(b>0?s[b-1]:0)+1,offset:g};b++}}}function d(g){if(g&&typeof g.line=="number"&&typeof g.column=="number"&&!Number.isNaN(g.line)&&!Number.isNaN(g.column)){for(;s.length1?s[g.line-2]:0)+g.column-1;if(b0&&I.jsxs(dA,{children:[I.jsx(kw,{className:"h-4 w-4"}),I.jsxs(fA,{children:[I.jsx("p",{className:"mb-1 font-medium",children:c("dialogs:importYaml.warnings")}),I.jsx("ul",{className:"space-y-1 text-xs",children:_.map((B,$)=>I.jsxs("li",{children:["•"," ",B]},`warning-${$}-${B.slice(0,20)}`))})]})]}),b&&!E&&I.jsxs(dA,{children:[I.jsx(SGt,{className:"h-4 w-4"}),I.jsx(fA,{children:c("dialogs:importYaml.successLoading")})]}),I.jsx(dA,{children:I.jsxs(fA,{className:"text-xs",children:[I.jsx("strong",{children:c("dialogs:importYaml.tipLabel")})," ",c("dialogs:importYaml.tipText")]})})]}),I.jsxs("div",{className:"flex items-center justify-end gap-2 pt-4",children:[I.jsx(mi,{variant:"outline",onClick:D,disabled:b,children:c("buttons.cancel")}),I.jsxs(mi,{onClick:L,disabled:!d.trim()||b,children:[I.jsx(GPn,{className:"mr-2 h-4 w-4"}),c(b?"dialogs:importYaml.importing":"dialogs:importYaml.import")]})]})]})})}const s$t="0.10.1",BKt="4rem";function Xtr({expanded:n,isRemote:i=!1,configUrl:s,connectionError:c}){const{t:d}=jo(["common","errors","dialogs"]);return n?I.jsxs("div",{className:"flex flex-col gap-2 border-t p-4",children:[I.jsxs("div",{className:"flex items-center gap-4",children:[i&&s&&I.jsx("span",{className:"text-green-600 text-xs",children:d("status.connectedTo",{hostname:new URL(s).hostname})}),c&&I.jsx("span",{className:"text-red-600 text-xs",children:c})]}),I.jsx("div",{className:"text-muted-foreground text-xs",children:I.jsxs("span",{children:[d("titles.appName")," ",`v${s$t}`]})})]}):I.jsxs("div",{className:"flex flex-col items-center gap-2 border-t px-2 py-3",children:[i&&s&&I.jsx("span",{role:"img",title:d("status.connectedTo",{hostname:new URL(s).hostname}),"aria-label":d("status.connectedTo",{hostname:new URL(s).hostname}),children:I.jsx(IGt,{className:"h-4 w-4 text-green-600"})}),I.jsx("span",{className:"font-medium text-[10px] text-muted-foreground",children:`v${s$t}`})]})}function Ztr({expanded:n,onToggle:i,layout:s="desktop",className:c,isRemote:d=!1,configUrl:g,connectionError:b}){const{t:w}=jo(["common","errors","dialogs"]),E=s==="compact"&&!n?{width:BKt}:void 0,S=s==="compact"?nr("absolute top-0 bottom-0 left-0 z-40 flex min-h-0 flex-col border-border border-r transition-[width] duration-300",n?"w-full bg-card":"bg-card"):nr("flex h-full min-h-0 flex-col border-border border-r bg-card transition-[width] duration-300",n?"w-72":"w-20");return I.jsxs("aside",{className:nr(S,c),style:E,children:[I.jsx("div",{className:"flex h-14 items-center justify-between border-b px-4",children:n?I.jsxs(I.Fragment,{children:[I.jsx("h3",{className:"shrink-0 whitespace-nowrap font-semibold text-sm",children:w("labels.addNode")}),I.jsx(mi,{variant:"ghost",size:"icon",onClick:i,"aria-label":w("buttons.collapseMenu"),title:w("buttons.collapseMenu"),children:I.jsx(mPn,{className:"h-4 w-4"})})]}):I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"w-0"}),I.jsx(mi,{variant:"ghost",size:"icon",onClick:i,"aria-label":w("buttons.expandMenu"),title:w("buttons.expandMenu"),children:I.jsx(yPn,{className:"h-4 w-4"})})]})}),I.jsxs("div",{className:nr("min-h-0 flex-1",n?"overflow-auto":"overflow-hidden"),children:[I.jsx(XQn,{iconOnly:!n}),n&&I.jsxs("div",{className:"border-t p-4",children:[I.jsx("h4",{className:"mb-2 font-medium text-muted-foreground text-xs",children:w("labels.quickHelp")}),I.jsxs("ul",{className:"space-y-1 text-muted-foreground text-xs",children:[I.jsx("li",{children:w("help.clickNodesToAdd")}),I.jsx("li",{children:w("help.dragToConnect")}),I.jsx("li",{children:w("help.deleteToRemove")}),I.jsx("li",{children:w("help.backspaceDeleteKey")})]})]})]}),I.jsx(Xtr,{expanded:n,isRemote:d,configUrl:g,connectionError:b})]})}function H2({message:n}){return n?I.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-red-600 text-xs",children:[I.jsx(kw,{className:"h-3 w-3 flex-shrink-0"}),I.jsx("span",{children:n})]}):null}function No({label:n,required:i,description:s,children:c}){return I.jsxs("div",{className:"flex flex-col gap-2",children:[I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[n,i&&I.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),c,s&&I.jsx("p",{className:"text-muted-foreground text-xs",children:s})]})}const a$t={common:["id","alias","enabled","_conditionId"],trigger:["trigger","entity_id","to","from","for","at","event_type","event_data","event","offset","above","below","value_template","template","webhook_id","zone","topic","payload","hours","minutes","seconds","device_id","domain","type","subtype"],condition:["condition","entity_id","state","attribute","above","below","value_template","template","after","before","weekday","device_id","domain","type","subtype","zone","condition","for","conditions"],action:["service","data","target","response_variable","stop","error","entity_id","action","metadata"],delay:["delay"],wait:["wait_template","timeout","wait_for_trigger","continue_on_timeout"],set_variables:["variables"]};function c$t(n,i=[]){const s=[...a$t.common,...a$t[n]||[]];return new Set([...s,...i])}function vse(n,[i,s]){return Math.min(s,Math.max(i,n))}function u$t(n){const i=Qtr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(tnr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function Qtr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=rnr(d),w=nnr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var enr=Symbol("radix.slottable");function tnr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===enr}function nnr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function rnr(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}function Yae(n){const i=n+"CollectionProvider",[s,c]=Nw(i),[d,g]=s(i,{collectionRef:{current:null},itemMap:new Map}),b=D=>{const{scope:B,children:$}=D,P=Hn.useRef(null),j=Hn.useRef(new Map).current;return I.jsx(d,{scope:B,itemMap:j,collectionRef:P,children:$})};b.displayName=i;const w=n+"CollectionSlot",E=u$t(w),S=Hn.forwardRef((D,B)=>{const{scope:$,children:P}=D,j=g(w,$),z=ps(B,j.collectionRef);return I.jsx(E,{ref:z,children:P})});S.displayName=w;const _=n+"CollectionItemSlot",A="data-radix-collection-item",C=u$t(_),O=Hn.forwardRef((D,B)=>{const{scope:$,children:P,...j}=D,z=Hn.useRef(null),ee=ps(B,z),ne=g(_,$);return Hn.useEffect(()=>(ne.itemMap.set(z,{ref:z,...j}),()=>void ne.itemMap.delete(z))),I.jsx(C,{[A]:"",ref:ee,children:P})});O.displayName=_;function L(D){const B=g(n+"CollectionConsumer",D);return Hn.useCallback(()=>{const P=B.collectionRef.current;if(!P)return[];const j=Array.from(P.querySelectorAll(`[${A}]`));return Array.from(B.itemMap.values()).sort((ne,Q)=>j.indexOf(ne.ref.current)-j.indexOf(Q.ref.current))},[B.collectionRef,B.itemMap])}return[{Provider:b,Slot:S,ItemSlot:O},L,c]}var inr=H.createContext(void 0);function Bz(n){const i=H.useContext(inr);return n||i||"ltr"}function onr(n){const i=snr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(cnr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function snr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=lnr(d),w=unr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var anr=Symbol("radix.slottable");function cnr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===anr}function unr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function lnr(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}var UKt=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dnr="VisuallyHidden",fnr=H.forwardRef((n,i)=>I.jsx(no.span,{...n,ref:i,style:{...UKt,...n.style}}));fnr.displayName=dnr;var hnr=[" ","Enter","ArrowUp","ArrowDown"],pnr=[" ","Enter"],ER="Select",[Jae,Xae,gnr]=Yae(ER),[WM]=Nw(ER,[gnr,UM]),Zae=UM(),[bnr,xN]=WM(ER),[mnr,wnr]=WM(ER),HKt=n=>{const{__scopeSelect:i,children:s,open:c,defaultOpen:d,onOpenChange:g,value:b,defaultValue:w,onValueChange:E,dir:S,name:_,autoComplete:A,disabled:C,required:O,form:L}=n,D=Zae(i),[B,$]=H.useState(null),[P,j]=H.useState(null),[z,ee]=H.useState(!1),ne=Bz(S),[Q,ae]=G2({prop:c,defaultProp:d??!1,onChange:g,caller:ER}),[he,pe]=G2({prop:b,defaultProp:w,onChange:E,caller:ER}),ue=H.useRef(null),fe=B?L||!!B.closest("form"):!0,[K,ge]=H.useState(new Set),De=Array.from(K).map(Se=>Se.props.value).join(";");return I.jsx(aMe,{...D,children:I.jsxs(bnr,{required:O,scope:i,trigger:B,onTriggerChange:$,valueNode:P,onValueNodeChange:j,valueNodeHasChildren:z,onValueNodeHasChildrenChange:ee,contentId:Bh(),value:he,onValueChange:pe,open:Q,onOpenChange:ae,dir:ne,triggerPointerDownPosRef:ue,disabled:C,children:[I.jsx(Jae.Provider,{scope:i,children:I.jsx(mnr,{scope:n.__scopeSelect,onNativeOptionAdd:H.useCallback(Se=>{ge(Re=>new Set(Re).add(Se))},[]),onNativeOptionRemove:H.useCallback(Se=>{ge(Re=>{const Ae=new Set(Re);return Ae.delete(Se),Ae})},[]),children:s})}),fe?I.jsxs(fYt,{"aria-hidden":!0,required:O,tabIndex:-1,name:_,autoComplete:A,value:he,onChange:Se=>pe(Se.target.value),disabled:C,form:L,children:[he===void 0?I.jsx("option",{value:""}):null,Array.from(K)]},De):null]})})};HKt.displayName=ER;var zKt="SelectTrigger",GKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,disabled:c=!1,...d}=n,g=Zae(s),b=xN(zKt,s),w=b.disabled||c,E=ps(i,b.onTriggerChange),S=Xae(s),_=H.useRef("touch"),[A,C,O]=pYt(D=>{const B=S().filter(j=>!j.disabled),$=B.find(j=>j.value===b.value),P=gYt(B,D,$);P!==void 0&&b.onValueChange(P.value)}),L=D=>{w||(b.onOpenChange(!0),O()),D&&(b.triggerPointerDownPosRef.current={x:Math.round(D.pageX),y:Math.round(D.pageY)})};return I.jsx(Tae,{asChild:!0,...g,children:I.jsx(no.button,{type:"button",role:"combobox","aria-controls":b.contentId,"aria-expanded":b.open,"aria-required":b.required,"aria-autocomplete":"none",dir:b.dir,"data-state":b.open?"open":"closed",disabled:w,"data-disabled":w?"":void 0,"data-placeholder":hYt(b.value)?"":void 0,...d,ref:E,onClick:Dr(d.onClick,D=>{D.currentTarget.focus(),_.current!=="mouse"&&L(D)}),onPointerDown:Dr(d.onPointerDown,D=>{_.current=D.pointerType;const B=D.target;B.hasPointerCapture(D.pointerId)&&B.releasePointerCapture(D.pointerId),D.button===0&&D.ctrlKey===!1&&D.pointerType==="mouse"&&(L(D),D.preventDefault())}),onKeyDown:Dr(d.onKeyDown,D=>{const B=A.current!=="";!(D.ctrlKey||D.altKey||D.metaKey)&&D.key.length===1&&C(D.key),!(B&&D.key===" ")&&hnr.includes(D.key)&&(L(),D.preventDefault())})})})});GKt.displayName=zKt;var qKt="SelectValue",VKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,className:c,style:d,children:g,placeholder:b="",...w}=n,E=xN(qKt,s),{onValueNodeHasChildrenChange:S}=E,_=g!==void 0,A=ps(i,E.onValueNodeChange);return Up(()=>{S(_)},[S,_]),I.jsx(no.span,{...w,ref:A,style:{pointerEvents:"none"},children:hYt(E.value)?I.jsx(I.Fragment,{children:b}):g})});VKt.displayName=qKt;var ynr="SelectIcon",WKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,children:c,...d}=n;return I.jsx(no.span,{"aria-hidden":!0,...d,ref:i,children:c||"▼"})});WKt.displayName=ynr;var vnr="SelectPortal",KKt=n=>I.jsx(Oz,{asChild:!0,...n});KKt.displayName=vnr;var SR="SelectContent",YKt=H.forwardRef((n,i)=>{const s=xN(SR,n.__scopeSelect),[c,d]=H.useState();if(Up(()=>{d(new DocumentFragment)},[]),!s.open){const g=c;return g?xR.createPortal(I.jsx(JKt,{scope:n.__scopeSelect,children:I.jsx(Jae.Slot,{scope:n.__scopeSelect,children:I.jsx("div",{children:n.children})})}),g):null}return I.jsx(XKt,{...n,ref:i})});YKt.displayName=SR;var kv=10,[JKt,kN]=WM(SR),Enr="SelectContentImpl",Snr=onr("SelectContent.RemoveScroll"),XKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,position:c="item-aligned",onCloseAutoFocus:d,onEscapeKeyDown:g,onPointerDownOutside:b,side:w,sideOffset:E,align:S,alignOffset:_,arrowPadding:A,collisionBoundary:C,collisionPadding:O,sticky:L,hideWhenDetached:D,avoidCollisions:B,...$}=n,P=xN(SR,s),[j,z]=H.useState(null),[ee,ne]=H.useState(null),Q=ps(i,Et=>z(Et)),[ae,he]=H.useState(null),[pe,ue]=H.useState(null),fe=Xae(s),[K,ge]=H.useState(!1),De=H.useRef(!1);H.useEffect(()=>{if(j)return lae(j)},[j]),cae();const Se=H.useCallback(Et=>{const[Dt,...Yt]=fe().map(Yn=>Yn.ref.current),[Ln]=Yt.slice(-1),Zn=document.activeElement;for(const Yn of Et)if(Yn===Zn||(Yn==null||Yn.scrollIntoView({block:"nearest"}),Yn===Dt&&ee&&(ee.scrollTop=0),Yn===Ln&&ee&&(ee.scrollTop=ee.scrollHeight),Yn==null||Yn.focus(),document.activeElement!==Zn))return},[fe,ee]),Re=H.useCallback(()=>Se([ae,j]),[Se,ae,j]);H.useEffect(()=>{K&&Re()},[K,Re]);const{onOpenChange:Ae,triggerPointerDownPosRef:xe}=P;H.useEffect(()=>{if(j){let Et={x:0,y:0};const Dt=Ln=>{var Zn,Yn;Et={x:Math.abs(Math.round(Ln.pageX)-(((Zn=xe.current)==null?void 0:Zn.x)??0)),y:Math.abs(Math.round(Ln.pageY)-(((Yn=xe.current)==null?void 0:Yn.y)??0))}},Yt=Ln=>{Et.x<=10&&Et.y<=10?Ln.preventDefault():j.contains(Ln.target)||Ae(!1),document.removeEventListener("pointermove",Dt),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Dt),document.addEventListener("pointerup",Yt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Dt),document.removeEventListener("pointerup",Yt,{capture:!0})}}},[j,Ae,xe]),H.useEffect(()=>{const Et=()=>Ae(!1);return window.addEventListener("blur",Et),window.addEventListener("resize",Et),()=>{window.removeEventListener("blur",Et),window.removeEventListener("resize",Et)}},[Ae]);const[We,ut]=pYt(Et=>{const Dt=fe().filter(Zn=>!Zn.disabled),Yt=Dt.find(Zn=>Zn.ref.current===document.activeElement),Ln=gYt(Dt,Et,Yt);Ln&&setTimeout(()=>Ln.ref.current.focus())}),Be=H.useCallback((Et,Dt,Yt)=>{const Ln=!De.current&&!Yt;(P.value!==void 0&&P.value===Dt||Ln)&&(he(Et),Ln&&(De.current=!0))},[P.value]),bt=H.useCallback(()=>j==null?void 0:j.focus(),[j]),Nt=H.useCallback((Et,Dt,Yt)=>{const Ln=!De.current&&!Yt;(P.value!==void 0&&P.value===Dt||Ln)&&ue(Et)},[P.value]),pt=c==="popper"?eLe:ZKt,Kt=pt===eLe?{side:w,sideOffset:E,align:S,alignOffset:_,arrowPadding:A,collisionBoundary:C,collisionPadding:O,sticky:L,hideWhenDetached:D,avoidCollisions:B}:{};return I.jsx(JKt,{scope:s,content:j,viewport:ee,onViewportChange:ne,itemRefCallback:Be,selectedItem:ae,onItemLeave:bt,itemTextRefCallback:Nt,focusSelectedItem:Re,selectedItemText:pe,position:c,isPositioned:K,searchRef:We,children:I.jsx(Dz,{as:Snr,allowPinchZoom:!0,children:I.jsx(Rz,{asChild:!0,trapped:P.open,onMountAutoFocus:Et=>{Et.preventDefault()},onUnmountAutoFocus:Dr(d,Et=>{var Dt;(Dt=P.trigger)==null||Dt.focus({preventScroll:!0}),Et.preventDefault()}),children:I.jsx(Iz,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:Et=>Et.preventDefault(),onDismiss:()=>P.onOpenChange(!1),children:I.jsx(pt,{role:"listbox",id:P.contentId,"data-state":P.open?"open":"closed",dir:P.dir,onContextMenu:Et=>Et.preventDefault(),...$,...Kt,onPlaced:()=>ge(!0),ref:Q,style:{display:"flex",flexDirection:"column",outline:"none",...$.style},onKeyDown:Dr($.onKeyDown,Et=>{const Dt=Et.ctrlKey||Et.altKey||Et.metaKey;if(Et.key==="Tab"&&Et.preventDefault(),!Dt&&Et.key.length===1&&ut(Et.key),["ArrowUp","ArrowDown","Home","End"].includes(Et.key)){let Ln=fe().filter(Zn=>!Zn.disabled).map(Zn=>Zn.ref.current);if(["ArrowUp","End"].includes(Et.key)&&(Ln=Ln.slice().reverse()),["ArrowUp","ArrowDown"].includes(Et.key)){const Zn=Et.target,Yn=Ln.indexOf(Zn);Ln=Ln.slice(Yn+1)}setTimeout(()=>Se(Ln)),Et.preventDefault()}})})})})})})});XKt.displayName=Enr;var Tnr="SelectItemAlignedPosition",ZKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,onPlaced:c,...d}=n,g=xN(SR,s),b=kN(SR,s),[w,E]=H.useState(null),[S,_]=H.useState(null),A=ps(i,Q=>_(Q)),C=Xae(s),O=H.useRef(!1),L=H.useRef(!0),{viewport:D,selectedItem:B,selectedItemText:$,focusSelectedItem:P}=b,j=H.useCallback(()=>{if(g.trigger&&g.valueNode&&w&&S&&D&&B&&$){const Q=g.trigger.getBoundingClientRect(),ae=S.getBoundingClientRect(),he=g.valueNode.getBoundingClientRect(),pe=$.getBoundingClientRect();if(g.dir!=="rtl"){const Zn=pe.left-ae.left,Yn=he.left-Zn,Er=Q.left-Yn,Ui=Q.width+Er,Qr=Math.max(Ui,ae.width),Hi=window.innerWidth-kv,ai=vse(Yn,[kv,Math.max(kv,Hi-Qr)]);w.style.minWidth=Ui+"px",w.style.left=ai+"px"}else{const Zn=ae.right-pe.right,Yn=window.innerWidth-he.right-Zn,Er=window.innerWidth-Q.right-Yn,Ui=Q.width+Er,Qr=Math.max(Ui,ae.width),Hi=window.innerWidth-kv,ai=vse(Yn,[kv,Math.max(kv,Hi-Qr)]);w.style.minWidth=Ui+"px",w.style.right=ai+"px"}const ue=C(),fe=window.innerHeight-kv*2,K=D.scrollHeight,ge=window.getComputedStyle(S),De=parseInt(ge.borderTopWidth,10),Se=parseInt(ge.paddingTop,10),Re=parseInt(ge.borderBottomWidth,10),Ae=parseInt(ge.paddingBottom,10),xe=De+Se+K+Ae+Re,We=Math.min(B.offsetHeight*5,xe),ut=window.getComputedStyle(D),Be=parseInt(ut.paddingTop,10),bt=parseInt(ut.paddingBottom,10),Nt=Q.top+Q.height/2-kv,pt=fe-Nt,Kt=B.offsetHeight/2,Et=B.offsetTop+Kt,Dt=De+Se+Et,Yt=xe-Dt;if(Dt<=Nt){const Zn=ue.length>0&&B===ue[ue.length-1].ref.current;w.style.bottom="0px";const Yn=S.clientHeight-D.offsetTop-D.offsetHeight,Er=Math.max(pt,Kt+(Zn?bt:0)+Yn+Re),Ui=Dt+Er;w.style.height=Ui+"px"}else{const Zn=ue.length>0&&B===ue[0].ref.current;w.style.top="0px";const Er=Math.max(Nt,De+D.offsetTop+(Zn?Be:0)+Kt)+Yt;w.style.height=Er+"px",D.scrollTop=Dt-Nt+D.offsetTop}w.style.margin=`${kv}px 0`,w.style.minHeight=We+"px",w.style.maxHeight=fe+"px",c==null||c(),requestAnimationFrame(()=>O.current=!0)}},[C,g.trigger,g.valueNode,w,S,D,B,$,g.dir,c]);Up(()=>j(),[j]);const[z,ee]=H.useState();Up(()=>{S&&ee(window.getComputedStyle(S).zIndex)},[S]);const ne=H.useCallback(Q=>{Q&&L.current===!0&&(j(),P==null||P(),L.current=!1)},[j,P]);return I.jsx(_nr,{scope:s,contentWrapper:w,shouldExpandOnScrollRef:O,onScrollButtonChange:ne,children:I.jsx("div",{ref:E,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:I.jsx(no.div,{...d,ref:A,style:{boxSizing:"border-box",maxHeight:"100%",...d.style}})})})});ZKt.displayName=Tnr;var Anr="SelectPopperPosition",eLe=H.forwardRef((n,i)=>{const{__scopeSelect:s,align:c="start",collisionPadding:d=kv,...g}=n,b=Zae(s);return I.jsx(cMe,{...b,...g,ref:i,align:c,collisionPadding:d,style:{boxSizing:"border-box",...g.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});eLe.displayName=Anr;var[_nr,ZMe]=WM(SR,{}),tLe="SelectViewport",QKt=H.forwardRef((n,i)=>{const{__scopeSelect:s,nonce:c,...d}=n,g=kN(tLe,s),b=ZMe(tLe,s),w=ps(i,g.onViewportChange),E=H.useRef(0);return I.jsxs(I.Fragment,{children:[I.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),I.jsx(Jae.Slot,{scope:s,children:I.jsx(no.div,{"data-radix-select-viewport":"",role:"presentation",...d,ref:w,style:{position:"relative",flex:1,overflow:"hidden auto",...d.style},onScroll:Dr(d.onScroll,S=>{const _=S.currentTarget,{contentWrapper:A,shouldExpandOnScrollRef:C}=b;if(C!=null&&C.current&&A){const O=Math.abs(E.current-_.scrollTop);if(O>0){const L=window.innerHeight-kv*2,D=parseFloat(A.style.minHeight),B=parseFloat(A.style.height),$=Math.max(D,B);if($0?z:0,A.style.justifyContent="flex-end")}}}E.current=_.scrollTop})})})]})});QKt.displayName=tLe;var eYt="SelectGroup",[xnr,knr]=WM(eYt),Nnr=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=Bh();return I.jsx(xnr,{scope:s,id:d,children:I.jsx(no.div,{role:"group","aria-labelledby":d,...c,ref:i})})});Nnr.displayName=eYt;var tYt="SelectLabel",nYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=knr(tYt,s);return I.jsx(no.div,{id:d.id,...c,ref:i})});nYt.displayName=tYt;var Ese="SelectItem",[Cnr,rYt]=WM(Ese),iYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,value:c,disabled:d=!1,textValue:g,...b}=n,w=xN(Ese,s),E=kN(Ese,s),S=w.value===c,[_,A]=H.useState(g??""),[C,O]=H.useState(!1),L=ps(i,P=>{var j;return(j=E.itemRefCallback)==null?void 0:j.call(E,P,c,d)}),D=Bh(),B=H.useRef("touch"),$=()=>{d||(w.onValueChange(c),w.onOpenChange(!1))};if(c==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return I.jsx(Cnr,{scope:s,value:c,disabled:d,textId:D,isSelected:S,onItemTextChange:H.useCallback(P=>{A(j=>j||((P==null?void 0:P.textContent)??"").trim())},[]),children:I.jsx(Jae.ItemSlot,{scope:s,value:c,disabled:d,textValue:_,children:I.jsx(no.div,{role:"option","aria-labelledby":D,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":d||void 0,"data-disabled":d?"":void 0,tabIndex:d?void 0:-1,...b,ref:L,onFocus:Dr(b.onFocus,()=>O(!0)),onBlur:Dr(b.onBlur,()=>O(!1)),onClick:Dr(b.onClick,()=>{B.current!=="mouse"&&$()}),onPointerUp:Dr(b.onPointerUp,()=>{B.current==="mouse"&&$()}),onPointerDown:Dr(b.onPointerDown,P=>{B.current=P.pointerType}),onPointerMove:Dr(b.onPointerMove,P=>{var j;B.current=P.pointerType,d?(j=E.onItemLeave)==null||j.call(E):B.current==="mouse"&&P.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Dr(b.onPointerLeave,P=>{var j;P.currentTarget===document.activeElement&&((j=E.onItemLeave)==null||j.call(E))}),onKeyDown:Dr(b.onKeyDown,P=>{var z;((z=E.searchRef)==null?void 0:z.current)!==""&&P.key===" "||(pnr.includes(P.key)&&$(),P.key===" "&&P.preventDefault())})})})})});iYt.displayName=Ese;var oH="SelectItemText",oYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,className:c,style:d,...g}=n,b=xN(oH,s),w=kN(oH,s),E=rYt(oH,s),S=wnr(oH,s),[_,A]=H.useState(null),C=ps(i,$=>A($),E.onItemTextChange,$=>{var P;return(P=w.itemTextRefCallback)==null?void 0:P.call(w,$,E.value,E.disabled)}),O=_==null?void 0:_.textContent,L=H.useMemo(()=>I.jsx("option",{value:E.value,disabled:E.disabled,children:O},E.value),[E.disabled,E.value,O]),{onNativeOptionAdd:D,onNativeOptionRemove:B}=S;return Up(()=>(D(L),()=>B(L)),[D,B,L]),I.jsxs(I.Fragment,{children:[I.jsx(no.span,{id:E.textId,...g,ref:C}),E.isSelected&&b.valueNode&&!b.valueNodeHasChildren?xR.createPortal(g.children,b.valueNode):null]})});oYt.displayName=oH;var sYt="SelectItemIndicator",aYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n;return rYt(sYt,s).isSelected?I.jsx(no.span,{"aria-hidden":!0,...c,ref:i}):null});aYt.displayName=sYt;var nLe="SelectScrollUpButton",cYt=H.forwardRef((n,i)=>{const s=kN(nLe,n.__scopeSelect),c=ZMe(nLe,n.__scopeSelect),[d,g]=H.useState(!1),b=ps(i,c.onScrollButtonChange);return Up(()=>{if(s.viewport&&s.isPositioned){let w=function(){const S=E.scrollTop>0;g(S)};const E=s.viewport;return w(),E.addEventListener("scroll",w),()=>E.removeEventListener("scroll",w)}},[s.viewport,s.isPositioned]),d?I.jsx(lYt,{...n,ref:b,onAutoScroll:()=>{const{viewport:w,selectedItem:E}=s;w&&E&&(w.scrollTop=w.scrollTop-E.offsetHeight)}}):null});cYt.displayName=nLe;var rLe="SelectScrollDownButton",uYt=H.forwardRef((n,i)=>{const s=kN(rLe,n.__scopeSelect),c=ZMe(rLe,n.__scopeSelect),[d,g]=H.useState(!1),b=ps(i,c.onScrollButtonChange);return Up(()=>{if(s.viewport&&s.isPositioned){let w=function(){const S=E.scrollHeight-E.clientHeight,_=Math.ceil(E.scrollTop)E.removeEventListener("scroll",w)}},[s.viewport,s.isPositioned]),d?I.jsx(lYt,{...n,ref:b,onAutoScroll:()=>{const{viewport:w,selectedItem:E}=s;w&&E&&(w.scrollTop=w.scrollTop+E.offsetHeight)}}):null});uYt.displayName=rLe;var lYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,onAutoScroll:c,...d}=n,g=kN("SelectScrollButton",s),b=H.useRef(null),w=Xae(s),E=H.useCallback(()=>{b.current!==null&&(window.clearInterval(b.current),b.current=null)},[]);return H.useEffect(()=>()=>E(),[E]),Up(()=>{var _;const S=w().find(A=>A.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[w]),I.jsx(no.div,{"aria-hidden":!0,...d,ref:i,style:{flexShrink:0,...d.style},onPointerDown:Dr(d.onPointerDown,()=>{b.current===null&&(b.current=window.setInterval(c,50))}),onPointerMove:Dr(d.onPointerMove,()=>{var S;(S=g.onItemLeave)==null||S.call(g),b.current===null&&(b.current=window.setInterval(c,50))}),onPointerLeave:Dr(d.onPointerLeave,()=>{E()})})}),Inr="SelectSeparator",dYt=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n;return I.jsx(no.div,{"aria-hidden":!0,...c,ref:i})});dYt.displayName=Inr;var iLe="SelectArrow",Rnr=H.forwardRef((n,i)=>{const{__scopeSelect:s,...c}=n,d=Zae(s),g=xN(iLe,s),b=kN(iLe,s);return g.open&&b.position==="popper"?I.jsx(uMe,{...d,...c,ref:i}):null});Rnr.displayName=iLe;var Onr="SelectBubbleInput",fYt=H.forwardRef(({__scopeSelect:n,value:i,...s},c)=>{const d=H.useRef(null),g=ps(c,d),b=Vae(i);return H.useEffect(()=>{const w=d.current;if(!w)return;const E=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(E,"value").set;if(b!==i&&_){const A=new Event("change",{bubbles:!0});_.call(w,i),w.dispatchEvent(A)}},[b,i]),I.jsx(no.select,{...s,style:{...UKt,...s.style},ref:g,defaultValue:i})});fYt.displayName=Onr;function hYt(n){return n===""||n===void 0}function pYt(n){const i=q2(n),s=H.useRef(""),c=H.useRef(0),d=H.useCallback(b=>{const w=s.current+b;i(w),function E(S){s.current=S,window.clearTimeout(c.current),S!==""&&(c.current=window.setTimeout(()=>E(""),1e3))}(w)},[i]),g=H.useCallback(()=>{s.current="",window.clearTimeout(c.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(c.current),[]),[s,d,g]}function gYt(n,i,s){const d=i.length>1&&Array.from(i).every(S=>S===i[0])?i[0]:i,g=s?n.indexOf(s):-1;let b=Dnr(n,Math.max(g,0));d.length===1&&(b=b.filter(S=>S!==s));const E=b.find(S=>S.textValue.toLowerCase().startsWith(d.toLowerCase()));return E!==s?E:void 0}function Dnr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}var Lnr=HKt,bYt=GKt,Mnr=VKt,Pnr=WKt,jnr=KKt,mYt=YKt,Fnr=QKt,wYt=nYt,yYt=iYt,$nr=oYt,Bnr=aYt,vYt=cYt,EYt=uYt,SYt=dYt;const zp=Lnr,Gp=Mnr,zh=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(bYt,{ref:c,className:nr("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",n),...s,children:[i,I.jsx(Pnr,{asChild:!0,children:I.jsx(oae,{className:"h-4 w-4 opacity-50"})})]}));zh.displayName=bYt.displayName;const TYt=H.forwardRef(({className:n,...i},s)=>I.jsx(vYt,{ref:s,className:nr("flex cursor-default items-center justify-center py-1",n),...i,children:I.jsx(R8n,{className:"h-4 w-4"})}));TYt.displayName=vYt.displayName;const AYt=H.forwardRef(({className:n,...i},s)=>I.jsx(EYt,{ref:s,className:nr("flex cursor-default items-center justify-center py-1",n),...i,children:I.jsx(oae,{className:"h-4 w-4"})}));AYt.displayName=EYt.displayName;const Gh=H.forwardRef(({className:n,children:i,position:s="popper",container:c,...d},g)=>I.jsx(jnr,{container:c,children:I.jsxs(mYt,{ref:g,className:nr("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in",s==="popper"&&"data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",n),position:s,...d,children:[I.jsx(TYt,{}),I.jsx(Fnr,{className:nr("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),I.jsx(AYt,{})]})}));Gh.displayName=mYt.displayName;const Unr=H.forwardRef(({className:n,...i},s)=>I.jsx(wYt,{ref:s,className:nr("px-2 py-1.5 font-semibold text-sm",n),...i}));Unr.displayName=wYt.displayName;const eo=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(yYt,{ref:c,className:nr("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...s,children:[I.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(Bnr,{children:I.jsx(oN,{className:"h-4 w-4"})})}),I.jsx($nr,{children:i})]}));eo.displayName=yYt.displayName;const Hnr=H.forwardRef(({className:n,...i},s)=>I.jsx(SYt,{ref:s,className:nr("-mx-1 my-1 h-px bg-muted",n),...i}));Hnr.displayName=SYt.displayName;const znr=["single","restart","queued","parallel"],Gnr=["silent","warning","critical"],l$t=new Set(["queued","parallel"]);function qnr(){const{t:n}=jo("common"),i=po(C=>C.flowName),s=po(C=>C.flowDescription),c=po(C=>C.setFlowName),d=po(C=>C.setFlowDescription),g=po(C=>C.flowMetadata),b=po(C=>C.setFlowMetadata),w=g.mode??"single",E=l$t.has(w),S=C=>{const O=C,L={mode:O};l$t.has(O)||(L.max=void 0,L.max_exceeded=void 0),b(L)},_=C=>{const O=Number.parseInt(C,10);C===""||Number.isNaN(O)?b({max:void 0}):O>0&&b({max:O})},A=C=>{b(C==="none"?{max_exceeded:void 0}:{max_exceeded:C})};return I.jsxs("div",{className:"h-full flex-1 space-y-4 overflow-y-auto p-4",children:[I.jsx("h3",{className:"mt-1.5 font-semibold text-foreground text-sm",children:n("automationSettings.title")}),I.jsx(No,{label:n("labels.automationName"),children:I.jsx(Na,{type:"text",value:i,onChange:C=>c(C.target.value),placeholder:n("placeholders.enterAutomationName")})}),I.jsx(No,{label:n("automationSettings.description"),children:I.jsx(Bv,{value:s,onChange:C=>d(C.target.value),placeholder:n("placeholders.describeAutomation"),rows:3})}),I.jsx($z,{}),I.jsxs(No,{label:n("automationSettings.mode"),description:n("automationSettings.modeDescription"),children:[I.jsxs(zp,{value:w,onValueChange:S,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsx(Gh,{children:znr.map(C=>I.jsx(eo,{value:C,children:n(`automationSettings.modes.${C}`)},C))})]}),I.jsx("p",{className:"text-muted-foreground text-xs",children:n(`automationSettings.modeDescriptions.${w}`)})]}),E&&I.jsxs(I.Fragment,{children:[I.jsx(No,{label:n("automationSettings.max"),description:n("automationSettings.maxDescription"),children:I.jsx(Na,{type:"number",min:1,value:g.max??"",onChange:C=>_(C.target.value),placeholder:"10"})}),g.max!=null&&I.jsx(No,{label:n("automationSettings.maxExceeded"),description:n("automationSettings.maxExceededDescription"),children:I.jsxs(zp,{value:g.max_exceeded??"none",onValueChange:A,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"none",children:n("placeholders.none")}),Gnr.map(C=>I.jsx(eo,{value:C,children:n(`automationSettings.maxExceededOptions.${C}`)},C))]})]})})]})]})}function _Yt({options:n,value:i,onChange:s,placeholder:c,className:d,buttonClassName:g,disabled:b=!1,renderOption:w,renderValue:E,searchKeys:S=["label","value"],fuzzyOptions:_={}}){const{t:A}=jo(["common"]),[C,O]=H.useState(!1),{query:L,setQuery:D,filteredItems:B}=gVt(n,{keys:S,threshold:.4,includeScore:!0,ignoreLocation:!0,includeMatches:!0,minMatchCharLength:1,..._}),$=n.find(j=>j.value===i),P=j=>{D(j)};return I.jsxs(dMe,{open:C,onOpenChange:O,children:[I.jsx(oVt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",role:"combobox","aria-expanded":C,className:nr("flex w-full justify-between",g),disabled:b,children:[$?E?E($):$.label:c||A("combobox.select"),I.jsx(EGt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),I.jsx(_ae,{className:nr("w-[286px] p-0",d),children:I.jsxs(pae,{shouldFilter:!1,children:[I.jsx(gae,{placeholder:c||A("combobox.select"),className:"h-9",value:L,onValueChange:P}),I.jsxs(bae,{children:[I.jsx(mae,{children:A("combobox.noOptions")}),I.jsx(nz,{children:B.map(j=>I.jsxs(rz,{value:j.value,onSelect:z=>{s(z===i?"":z),O(!1),D("")},children:[w?w(j):j.label,I.jsx(oN,{className:nr("ml-auto h-4 w-4",i===j.value?"opacity-100":"opacity-0")})]},j.value))})]})]})})]})}function oLe({values:n,onChange:i,placeholder:s="Add ID...",className:c}){const[d,g]=H.useState(""),b=()=>{const S=d.trim();S&&!n.includes(S)&&(i([...n,S]),g(""))},w=S=>{i(n.filter(_=>_!==S))},E=S=>{S.key==="Enter"&&(S.preventDefault(),b())};return I.jsxs("div",{className:nr("space-y-1",c),children:[I.jsxs("div",{className:"flex gap-1",children:[I.jsx(Na,{value:d,onChange:S=>g(S.target.value),onKeyDown:E,placeholder:s,className:"flex-1 font-mono text-xs"}),I.jsx(mi,{type:"button",size:"icon",variant:"outline",onClick:b,disabled:!d.trim(),children:I.jsx(sae,{className:"h-4 w-4"})})]}),n.length>0&&I.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(S=>I.jsxs("span",{className:"inline-flex items-center rounded border bg-muted px-2 py-0.5 font-mono text-muted-foreground text-xs",children:[S,I.jsx(aae,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>w(S)})]},S))})]})}const Vnr={light:{label:"Light",color:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-800 dark:text-yellow-200"},switch:{label:"Switch",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"},sensor:{label:"Sensor",color:"bg-green-100 dark:bg-green-900/50 text-green-800 dark:text-green-200"},binary_sensor:{label:"Binary Sensor",color:"bg-purple-100 dark:bg-purple-900/50 text-purple-800 dark:text-purple-200"},climate:{label:"Climate",color:"bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-200"},cover:{label:"Cover",color:"bg-indigo-100 dark:bg-indigo-900/50 text-indigo-800 dark:text-indigo-200"},fan:{label:"Fan",color:"bg-cyan-100 dark:bg-cyan-900/50 text-cyan-800 dark:text-cyan-200"},media_player:{label:"Media",color:"bg-pink-100 dark:bg-pink-900/50 text-pink-800 dark:text-pink-200"},automation:{label:"Automation",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},script:{label:"Script",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},scene:{label:"Scene",color:"bg-violet-100 dark:bg-violet-900/50 text-violet-800 dark:text-violet-200"},input_boolean:{label:"Input Bool",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_number:{label:"Input Num",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_select:{label:"Input Select",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_text:{label:"Input Text",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},input_datetime:{label:"Input Time",color:"bg-emerald-100 dark:bg-emerald-900/50 text-emerald-800 dark:text-emerald-200"},person:{label:"Person",color:"bg-amber-100 dark:bg-amber-900/50 text-amber-800 dark:text-amber-200"},device_tracker:{label:"Tracker",color:"bg-amber-100 dark:bg-amber-900/50 text-amber-800 dark:text-amber-200"},zone:{label:"Zone",color:"bg-lime-100 dark:bg-lime-900/50 text-lime-800 dark:text-lime-200"},sun:{label:"Sun",color:"bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-200"},weather:{label:"Weather",color:"bg-sky-100 dark:bg-sky-900/50 text-sky-800 dark:text-sky-200"},camera:{label:"Camera",color:"bg-rose-100 dark:bg-rose-900/50 text-rose-800 dark:text-rose-200"},remote:{label:"Remote",color:"bg-gray-100 dark:bg-gray-700/50 text-gray-800 dark:text-gray-200"},vacuum:{label:"Vacuum",color:"bg-teal-100 dark:bg-teal-900/50 text-teal-800 dark:text-teal-200"},lock:{label:"Lock",color:"bg-red-100 dark:bg-red-900/50 text-red-800 dark:text-red-200"},alarm_control_panel:{label:"Alarm",color:"bg-red-100 dark:bg-red-900/50 text-red-800 dark:text-red-200"},water_heater:{label:"Water Heater",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"},humidifier:{label:"Humidifier",color:"bg-cyan-100 dark:bg-cyan-900/50 text-cyan-800 dark:text-cyan-200"},button:{label:"Button",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},number:{label:"Number",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},select:{label:"Select",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},text:{label:"Text",color:"bg-slate-100 dark:bg-slate-700/50 text-slate-800 dark:text-slate-200"},update:{label:"Update",color:"bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200"}};function Wnr(n){if(!n||typeof n!="string")return{label:"Unknown",color:"bg-gray-100 dark:bg-gray-700/50 text-gray-700 dark:text-gray-300"};const i=n.split(".")[0];return Vnr[i]||{label:i,color:"bg-gray-100 dark:bg-gray-700/50 text-gray-700 dark:text-gray-300"}}function Knr(n){return n.attributes.friendly_name||n.entity_id}function Sse({value:n,onChange:i,entities:s,placeholder:c="Select entity...",className:d,domainFilter:g}){const{entities:b,getDeviceNameForEntity:w,getAreaNameForEntity:E}=Wg(),S=s??b,_=H.useMemo(()=>{if(!g)return S;const B=Array.isArray(g)?g:[g];return S.filter($=>{const P=$.entity_id.split(".")[0];return B.includes(P)})},[S,g]),A=H.useMemo(()=>_.map(B=>{const $=Wnr(B.entity_id);return{value:B.entity_id,label:Knr(B),domainLabel:$.label,domainColor:$.color,deviceLabel:w(B.entity_id)??void 0,areaLabel:E(B.entity_id)??void 0}}),[_,w,E]),C=Array.isArray(n)?n[0]:n,O=_.find(B=>B.entity_id===C),L=C&&!O,D=B=>{i(B)};return I.jsxs("div",{className:nr("relative",d),children:[I.jsx(_Yt,{options:A,value:C||"",onChange:D,placeholder:c,buttonClassName:nr(!C&&"text-muted-foreground"),disabled:A.length===0,searchKeys:["label","value","deviceLabel","areaLabel"],fuzzyOptions:{threshold:.3,minMatchCharLength:2},renderOption:B=>I.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[I.jsx("span",{children:B.label}),I.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[I.jsx("span",{className:nr("rounded px-1.5 py-0.5 font-medium text-xs",B.domainColor),children:B.domainLabel}),B.deviceLabel&&I.jsx("span",{className:"truncate text-muted-foreground text-xs",children:B.deviceLabel}),B.areaLabel&&I.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground text-xs",children:B.areaLabel})]})]}),renderValue:B=>B?I.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[I.jsx("span",{className:nr("rounded px-1.5 py-0.5 font-medium text-xs",B.domainColor),children:B.domainLabel}),I.jsx("span",{className:"truncate",children:B.label})]}):null}),L&&I.jsx("div",{className:"mt-1 truncate font-mono text-red-600",children:C})]})}function Qae({value:n,onChange:i,entities:s,placeholder:c="Select entities...",className:d}){const g=w=>{n.includes(w)||i([...n,w])},b=w=>{i(n.filter(E=>E!==w))};return I.jsxs("div",{className:nr("space-y-1",d),children:[I.jsx(Sse,{value:"",onChange:g,entities:s,placeholder:c,className:"w-full"}),I.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(w=>I.jsxs("span",{className:"inline-flex items-center rounded border bg-muted px-2 py-0.5 font-mono text-muted-foreground text-xs",children:[w,I.jsx(aae,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>b(w)})]},w))})]})}function QMe(n,i,s){const d=n.data[i];return d??s}function jh(n,i,s=""){const c=QMe(n,i,s);if(typeof c=="string")return c;if(typeof c=="object"&&c!==null&&!Array.isArray(c)){const d=c;if(typeof d.value=="string")return d.value}return s}function C5(n,i,s={}){const c=QMe(n,i,s);return typeof c=="object"&&c!==null&&!Array.isArray(c)?c:s}function Ynr({response:n,responseVariable:i,showResponseVariable:s,setShowResponseVariable:c,onChange:d,handleResponseVariableChange:g}){const{t:b}=jo(["common","nodes"]),w=I.jsxs(I.Fragment,{children:[I.jsx(Na,{type:"text",value:i??"",onChange:g,placeholder:b("nodes:responseVariableField.placeholder")}),i!==void 0&&eWt(i)&&I.jsxs(dA,{variant:"destructive",className:"mt-2 border-0 px-0",children:[I.jsx(jKt,{children:b("labels.warning")}),I.jsx(fA,{children:b("nodes:responseVariableField.currentNodeWarning")})]})]});return n.optional?I.jsxs(No,{label:b("nodes:responseVariableField.label"),description:b("nodes:responseVariableField.optionalDescription"),children:[I.jsxs("div",{className:"mb-2 flex items-center gap-3",children:[I.jsx(J2,{checked:s,onCheckedChange:E=>{c(E),E||d("response_variable",void 0)},id:"response-variable-switch"}),I.jsx("label",{htmlFor:"response-variable-switch",className:"cursor-pointer select-none text-sm",children:b("nodes:responseVariableField.useResponseVariable")})]}),s&&w]}):I.jsx(No,{label:b("nodes:responseVariableField.label"),description:b("nodes:responseVariableField.requiredDescription"),children:w})}function Jnr(n){const i=n.trim();if(i==="")return;const s=Number(i);return Number.isNaN(s)?n:s}function Xnr(n){return n==null?"":typeof n=="number"||typeof n=="string"?String(n):""}function xYt({value:n,placeholder:i,required:s,onChange:c}){return I.jsx(Na,{type:"text",inputMode:"decimal",value:Xnr(n),placeholder:i,required:s,onChange:d=>c(Jnr(d.target.value))})}function kYt(n){if(!Array.isArray(n))return[];const i=[];for(const s of n){if(typeof s=="string"||typeof s=="number"){i.push({value:String(s),label:String(s)});continue}if(Array.isArray(s)){const[c,d]=s;if(c==null)continue;i.push({value:String(c),label:String(d??c)});continue}if(s&&typeof s=="object"&&"value"in s){const{value:c,label:d}=s;if(c==null)continue;i.push({value:String(c),label:String(d??c)})}}return i}const Znr="255, 255, 255";function Qnr(n){return Array.isArray(n)?n.join(", "):n==null?"":String(n)}function err(n){const i=n.split(",").map(c=>c.trim()).filter(c=>c!=="");if(i.length===0)return"";const s=i.map(Number);return s.some(Number.isNaN)?n:s}function trr({value:n,example:i,onChange:s}){const[c,d]=H.useState(null),g=i===void 0?Znr:String(i).replace(/[[\]]/g,"");return I.jsx(Na,{type:"text",inputMode:"numeric",value:c??Qnr(n),placeholder:g,onChange:b=>{d(b.target.value),s(err(b.target.value))},onBlur:()=>d(null)})}function nrr({serviceFields:n,currentData:i,onChange:s}){const{t:c}=jo(["common","nodes"]);return Object.keys(n).length===0?null:I.jsxs("div",{className:"mt-3 flex flex-col gap-3 border-t pt-3",children:[I.jsx("h4",{className:"mb-3 font-semibold text-muted-foreground text-xs",children:c("nodes:serviceDataFields.heading")}),Object.entries(n).map(([d,g])=>{const b=g.selector||{},w=Object.keys(b)[0],E=b[w]||{},S=i[d],_=g.name||d.replace(/_/g," ").replace(/\b\w/g,A=>A.toUpperCase());if(w==="number"){const A=E;return I.jsx(No,{label:`${_}${A.unit_of_measurement?` (${A.unit_of_measurement})`:""}`,required:g.required,description:g.description,children:I.jsx(xYt,{value:i[d],required:g.required,placeholder:g.example!==void 0?String(g.example):"",onChange:C=>s(d,C??"")})},d)}if(w==="select"){const A=kYt(E.options);return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsxs(zp,{value:String(S===""?"__NONE__":S??"__NONE__"),onValueChange:C=>s(d,C==="__NONE__"?"":C),children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:c("placeholders.none")})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"__NONE__",children:c("placeholders.none")}),A.map(C=>I.jsx(eo,{value:C.value,children:C.label},C.value))]})]})},d)}if(w==="boolean")return I.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[I.jsx("input",{type:"checkbox",checked:S??!1,onChange:A=>s(d,A.target.checked),className:"rounded"}),I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[_,g.required&&I.jsx("span",{className:"ml-0.5 text-destructive",children:c("labels.requiredAsterisk")})]})]},d);if(w==="entity"){if(E.multiple===!0){const O=Array.isArray(S)?S:S?[String(S)]:[];return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Qae,{value:O,onChange:L=>s(d,L),placeholder:g.example!==void 0?String(g.example):void 0})},d)}return I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Sse,{value:String(S??""),onChange:O=>s(d,O),placeholder:g.example!==void 0?String(g.example):void 0})},d)}return w==="color_rgb"||d==="rgb_color"?I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(trr,{value:i[d],example:g.example,onChange:A=>s(d,A)})},d):I.jsx(No,{label:_,required:g.required,description:g.description,children:I.jsx(Na,{type:"text",value:S??"",onChange:A=>s(d,A.target.value),placeholder:g.example!==void 0?String(g.example):""})},d)})]})}const rrr=new Set(["homeassistant","group"]);function irr(n,i){if(!n||!n.includes("."))return i;const s=n.split(".")[0];if(rrr.has(s))return i;const c=i.filter(d=>d.entity_id.startsWith(`${s}.`));return c.length>0?c:i}function orr({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes"]),{getAllServices:d,getServiceDefinition:g}=Wg(),{getFieldError:b}=gb(n.id),w=jh(n,"service"),E=jh(n,"event"),S=n.data,_=typeof S.stop=="string"?S.stop:void 0,A=S.error===!0,C=g(w),O=(C==null?void 0:C.fields)||{},L=C5(n,"data",{}),D=jh(n,"response_variable"),[B,$]=H.useState(!!D),P=_!==void 0?"stop":E?"event":"service";H.useEffect(()=>{$(!!D)},[D]);const j=Re=>{Re==="stop"?(i("service",void 0),i("target",void 0),i("data",void 0),i("event",void 0),i("event_data",void 0),i("stop",""),i("error",void 0)):Re==="event"?(i("service",void 0),i("target",void 0),i("data",void 0),i("stop",void 0),i("error",void 0)):(i("event",void 0),i("event_data",void 0),i("stop",void 0),i("error",void 0))},z=Re=>{i("service",Re),i("data",void 0)},ee=Re=>{const xe={...C5(n,"target",{}),entity_id:Re.length>0?Re:void 0};xe.entity_id||delete xe.entity_id,i("target",Object.keys(xe).length>0?xe:void 0)},ne=Re=>{const xe={...C5(n,"target",{}),device_id:Re.length>0?Re:void 0};xe.device_id||delete xe.device_id,i("target",Object.keys(xe).length>0?xe:void 0)},Q=Re=>{const xe={...C5(n,"target",{}),area_id:Re.length>0?Re:void 0};xe.area_id||delete xe.area_id,i("target",Object.keys(xe).length>0?xe:void 0)},ae=(Re,Ae)=>{const xe={...L,[Re]:Ae===""?void 0:Ae},We=Object.fromEntries(Object.entries(xe).filter(([,ut])=>ut!==void 0&&ut!==""));i("data",Object.keys(We).length>0?We:void 0)},he=Re=>{i("response_variable",Re.target.value===""?void 0:Re.target.value)},pe=C5(n,"target",{}),ue=Re=>Re?Array.isArray(Re)?Re:[Re]:[],fe=ue(pe.entity_id),K=ue(pe.device_id),ge=ue(pe.area_id),De=K.length>0,Se=ge.length>0;return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:actions.actionTypeLabel"),required:!0,children:I.jsxs(zp,{value:P,onValueChange:j,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"service",children:c("nodes:actions.actionTypes.service")}),I.jsx(eo,{value:"event",children:c("nodes:actions.actionTypes.event")}),I.jsx(eo,{value:"stop",children:c("nodes:actions.actionTypes.stop")})]})]})}),P==="stop"?I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:actions.stopMessageLabel"),children:I.jsx(Na,{type:"text",value:_??"",onChange:Re=>i("stop",Re.target.value),placeholder:c("nodes:actions.stopMessagePlaceholder")})}),I.jsx(No,{label:c("nodes:actions.markAsError"),children:I.jsx(J2,{checked:A,onCheckedChange:Re=>i("error",Re||void 0)})})]}):P==="event"?I.jsx(I.Fragment,{children:I.jsxs(No,{label:c("nodes:actions.eventNameLabel"),required:!0,children:[I.jsx(Na,{type:"text",value:E,onChange:Re=>i("event",Re.target.value||void 0),placeholder:c("nodes:actions.eventNamePlaceholder")}),I.jsx(H2,{message:b("event")})]})}):I.jsxs(I.Fragment,{children:[I.jsxs(No,{label:c("nodes:actions.actionLabel"),required:!0,children:[I.jsx(_Yt,{options:d().map(({domain:Re,service:Ae})=>({value:`${Re}.${Ae}`,label:`${Re}.${Ae}`})),value:w,onChange:z,placeholder:c("nodes:actions.selectAction")}),I.jsx(H2,{message:b("service")})]}),((C==null?void 0:C.target)||fe.length>0)&&I.jsx(No,{label:c("nodes:actions.targetEntities"),children:I.jsx(Qae,{value:fe,onChange:ee,entities:irr(w,s),placeholder:c("nodes:actions.selectTargetEntities")})}),(De||(C==null?void 0:C.target))&&I.jsx(No,{label:c("nodes:actions.targetDevices"),description:c("nodes:actions.targetDevicesDescription"),children:I.jsx(oLe,{values:K,onChange:ne,placeholder:c("nodes:actions.addDeviceId")})}),(Se||(C==null?void 0:C.target))&&I.jsx(No,{label:c("nodes:actions.targetAreas"),description:c("nodes:actions.targetAreasDescription"),children:I.jsx(oLe,{values:ge,onChange:Q,placeholder:c("nodes:actions.addAreaId")})}),I.jsx(nrr,{serviceFields:O,currentData:L,onChange:ae}),(C==null?void 0:C.response)&&I.jsx(Ynr,{response:C.response,responseVariable:D,showResponseVariable:B,setShowResponseVariable:$,onChange:i,handleResponseVariableChange:he})]})]})}function NYt({value:n,onChange:i}){const{t:s}=jo(["common","nodes"]),c=typeof n=="string",d=!c&&typeof n=="object"&&n!==null?n:{},[g,b]=H.useState(c),w=S=>{if(b(S),S){const _=d.hours??0,A=d.minutes??0,C=d.seconds??0,O=d.milliseconds??0,L=[_,A,C].map(B=>B.toString().padStart(2,"0")).join(":"),D=O?`${L}.${O}`:L;i(D)}else if(c){const _=/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(?:\.(\d{1,3}))?$/.exec(n);if(_){const[,A,C,O,L]=_;i({hours:Number(A),minutes:Number(C),seconds:Number(O),...L?{milliseconds:Number(L)}:{}})}else i({})}},E=(S,_)=>{const A=_===""?void 0:Number(_),C={...d,[S]:Number.isNaN(A)?void 0:A};Object.keys(C).forEach(O=>{const L=C[O];L==null&&delete C[O]}),i(C)};return I.jsxs("div",{className:"flex flex-col gap-2",children:[I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:s("nodes:durationField.string")}),I.jsx(J2,{checked:g,onCheckedChange:w}),I.jsx("span",{className:"text-muted-foreground text-xs",children:s("nodes:durationField.object")})]}),g?I.jsx(Na,{type:"text",value:c?n:"",onChange:S=>i(S.target.value),placeholder:s("nodes:durationField.placeholder")}):I.jsxs("div",{className:"flex gap-2",children:[I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.hours")}),I.jsx(Na,{type:"number",min:0,value:d.hours??"",onChange:S=>E("hours",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.minutes")}),I.jsx(Na,{type:"number",min:0,value:d.minutes??"",onChange:S=>E("minutes",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.seconds")}),I.jsx(Na,{type:"number",min:0,value:d.seconds??"",onChange:S=>E("seconds",S.target.value),placeholder:"0",className:"mt-1"})]}),I.jsxs("div",{className:"flex-1",children:[I.jsx(ll,{className:"text-muted-foreground text-xs",children:s("nodes:durationField.milliseconds")}),I.jsx(Na,{type:"number",min:0,value:d.milliseconds??"",onChange:S=>E("milliseconds",S.target.value),placeholder:"0",className:"mt-1"})]})]})]})}function CYt({label:n,description:i,value:s,onChange:c}){const{t:d}=jo(["common","nodes"]);return I.jsx(No,{label:n??d("nodes:durationField.label"),description:i||d("nodes:durationField.description"),children:I.jsx(NYt,{value:s,onChange:c})})}var YOe="rovingFocusGroup.onEntryFocus",srr={bubbles:!1,cancelable:!0},Uz="RovingFocusGroup",[sLe,IYt,arr]=Yae(Uz),[crr,ece]=Nw(Uz,[arr]),[urr,lrr]=crr(Uz),RYt=H.forwardRef((n,i)=>I.jsx(sLe.Provider,{scope:n.__scopeRovingFocusGroup,children:I.jsx(sLe.Slot,{scope:n.__scopeRovingFocusGroup,children:I.jsx(drr,{...n,ref:i})})}));RYt.displayName=Uz;var drr=H.forwardRef((n,i)=>{const{__scopeRovingFocusGroup:s,orientation:c,loop:d=!1,dir:g,currentTabStopId:b,defaultCurrentTabStopId:w,onCurrentTabStopIdChange:E,onEntryFocus:S,preventScrollOnEntryFocus:_=!1,...A}=n,C=H.useRef(null),O=ps(i,C),L=Bz(g),[D,B]=G2({prop:b,defaultProp:w??null,onChange:E,caller:Uz}),[$,P]=H.useState(!1),j=q2(S),z=IYt(s),ee=H.useRef(!1),[ne,Q]=H.useState(0);return H.useEffect(()=>{const ae=C.current;if(ae)return ae.addEventListener(YOe,j),()=>ae.removeEventListener(YOe,j)},[j]),I.jsx(urr,{scope:s,orientation:c,dir:L,loop:d,currentTabStopId:D,onItemFocus:H.useCallback(ae=>B(ae),[B]),onItemShiftTab:H.useCallback(()=>P(!0),[]),onFocusableItemAdd:H.useCallback(()=>Q(ae=>ae+1),[]),onFocusableItemRemove:H.useCallback(()=>Q(ae=>ae-1),[]),children:I.jsx(no.div,{tabIndex:$||ne===0?-1:0,"data-orientation":c,...A,ref:O,style:{outline:"none",...n.style},onMouseDown:Dr(n.onMouseDown,()=>{ee.current=!0}),onFocus:Dr(n.onFocus,ae=>{const he=!ee.current;if(ae.target===ae.currentTarget&&he&&!$){const pe=new CustomEvent(YOe,srr);if(ae.currentTarget.dispatchEvent(pe),!pe.defaultPrevented){const ue=z().filter(Se=>Se.focusable),fe=ue.find(Se=>Se.active),K=ue.find(Se=>Se.id===D),De=[fe,K,...ue].filter(Boolean).map(Se=>Se.ref.current);LYt(De,_)}}ee.current=!1}),onBlur:Dr(n.onBlur,()=>P(!1))})})}),OYt="RovingFocusGroupItem",DYt=H.forwardRef((n,i)=>{const{__scopeRovingFocusGroup:s,focusable:c=!0,active:d=!1,tabStopId:g,children:b,...w}=n,E=Bh(),S=g||E,_=lrr(OYt,s),A=_.currentTabStopId===S,C=IYt(s),{onFocusableItemAdd:O,onFocusableItemRemove:L,currentTabStopId:D}=_;return H.useEffect(()=>{if(c)return O(),()=>L()},[c,O,L]),I.jsx(sLe.ItemSlot,{scope:s,id:S,focusable:c,active:d,children:I.jsx(no.span,{tabIndex:A?0:-1,"data-orientation":_.orientation,...w,ref:i,onMouseDown:Dr(n.onMouseDown,B=>{c?_.onItemFocus(S):B.preventDefault()}),onFocus:Dr(n.onFocus,()=>_.onItemFocus(S)),onKeyDown:Dr(n.onKeyDown,B=>{if(B.key==="Tab"&&B.shiftKey){_.onItemShiftTab();return}if(B.target!==B.currentTarget)return;const $=prr(B,_.orientation,_.dir);if($!==void 0){if(B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;B.preventDefault();let j=C().filter(z=>z.focusable).map(z=>z.ref.current);if($==="last")j.reverse();else if($==="prev"||$==="next"){$==="prev"&&j.reverse();const z=j.indexOf(B.currentTarget);j=_.loop?grr(j,z+1):j.slice(z+1)}setTimeout(()=>LYt(j))}}),children:typeof b=="function"?b({isCurrentTabStop:A,hasTabStop:D!=null}):b})})});DYt.displayName=OYt;var frr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hrr(n,i){return i!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function prr(n,i,s){const c=hrr(n.key,s);if(!(i==="vertical"&&["ArrowLeft","ArrowRight"].includes(c))&&!(i==="horizontal"&&["ArrowUp","ArrowDown"].includes(c)))return frr[c]}function LYt(n,i=!1){const s=document.activeElement;for(const c of n)if(c===s||(c.focus({preventScroll:i}),document.activeElement!==s))return}function grr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}var MYt=RYt,PYt=DYt;function brr(n){const i=mrr(n),s=H.forwardRef((c,d)=>{const{children:g,...b}=c,w=H.Children.toArray(g),E=w.find(yrr);if(E){const S=E.props.children,_=w.map(A=>A===E?H.Children.count(S)>1?H.Children.only(null):H.isValidElement(S)?S.props.children:null:A);return I.jsx(i,{...b,ref:d,children:H.isValidElement(S)?H.cloneElement(S,void 0,_):null})}return I.jsx(i,{...b,ref:d,children:g})});return s.displayName=`${n}.Slot`,s}function mrr(n){const i=H.forwardRef((s,c)=>{const{children:d,...g}=s;if(H.isValidElement(d)){const b=Err(d),w=vrr(g,d.props);return d.type!==H.Fragment&&(w.ref=c?zg(c,b):b),H.cloneElement(d,w)}return H.Children.count(d)>1?H.Children.only(null):null});return i.displayName=`${n}.SlotClone`,i}var wrr=Symbol("radix.slottable");function yrr(n){return H.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===wrr}function vrr(n,i){const s={...i};for(const c in i){const d=n[c],g=i[c];/^on[A-Z]/.test(c)?d&&g?s[c]=(...w)=>{const E=g(...w);return d(...w),E}:d&&(s[c]=d):c==="style"?s[c]={...d,...g}:c==="className"&&(s[c]=[d,g].filter(Boolean).join(" "))}return{...n,...s}}function Err(n){var c,d;let i=(c=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?n.ref:(i=(d=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:d.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?n.props.ref:n.props.ref||n.ref)}var aLe=["Enter"," "],Srr=["ArrowDown","PageUp","Home"],jYt=["ArrowUp","PageDown","End"],Trr=[...Srr,...jYt],Arr={ltr:[...aLe,"ArrowRight"],rtl:[...aLe,"ArrowLeft"]},_rr={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Hz="Menu",[fz,xrr,krr]=Yae(Hz),[LR,FYt]=Nw(Hz,[krr,UM,ece]),tce=UM(),$Yt=ece(),[Nrr,MR]=LR(Hz),[Crr,zz]=LR(Hz),BYt=n=>{const{__scopeMenu:i,open:s=!1,children:c,dir:d,onOpenChange:g,modal:b=!0}=n,w=tce(i),[E,S]=H.useState(null),_=H.useRef(!1),A=q2(g),C=Bz(d);return H.useEffect(()=>{const O=()=>{_.current=!0,document.addEventListener("pointerdown",L,{capture:!0,once:!0}),document.addEventListener("pointermove",L,{capture:!0,once:!0})},L=()=>_.current=!1;return document.addEventListener("keydown",O,{capture:!0}),()=>{document.removeEventListener("keydown",O,{capture:!0}),document.removeEventListener("pointerdown",L,{capture:!0}),document.removeEventListener("pointermove",L,{capture:!0})}},[]),I.jsx(aMe,{...w,children:I.jsx(Nrr,{scope:i,open:s,onOpenChange:A,content:E,onContentChange:S,children:I.jsx(Crr,{scope:i,onClose:H.useCallback(()=>A(!1),[A]),isUsingKeyboardRef:_,dir:C,modal:b,children:c})})})};BYt.displayName=Hz;var Irr="MenuAnchor",e9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n,d=tce(s);return I.jsx(Tae,{...d,...c,ref:i})});e9e.displayName=Irr;var t9e="MenuPortal",[Rrr,UYt]=LR(t9e,{forceMount:void 0}),HYt=n=>{const{__scopeMenu:i,forceMount:s,children:c,container:d}=n,g=MR(t9e,i);return I.jsx(Rrr,{scope:i,forceMount:s,children:I.jsx(Cw,{present:s||g.open,children:I.jsx(Oz,{asChild:!0,container:d,children:c})})})};HYt.displayName=t9e;var Aw="MenuContent",[Orr,n9e]=LR(Aw),zYt=H.forwardRef((n,i)=>{const s=UYt(Aw,n.__scopeMenu),{forceMount:c=s.forceMount,...d}=n,g=MR(Aw,n.__scopeMenu),b=zz(Aw,n.__scopeMenu);return I.jsx(fz.Provider,{scope:n.__scopeMenu,children:I.jsx(Cw,{present:c||g.open,children:I.jsx(fz.Slot,{scope:n.__scopeMenu,children:b.modal?I.jsx(Drr,{...d,ref:i}):I.jsx(Lrr,{...d,ref:i})})})})}),Drr=H.forwardRef((n,i)=>{const s=MR(Aw,n.__scopeMenu),c=H.useRef(null),d=ps(i,c);return H.useEffect(()=>{const g=c.current;if(g)return lae(g)},[]),I.jsx(r9e,{...n,ref:d,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:Dr(n.onFocusOutside,g=>g.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),Lrr=H.forwardRef((n,i)=>{const s=MR(Aw,n.__scopeMenu);return I.jsx(r9e,{...n,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),Mrr=brr("MenuContent.ScrollLock"),r9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,loop:c=!1,trapFocus:d,onOpenAutoFocus:g,onCloseAutoFocus:b,disableOutsidePointerEvents:w,onEntryFocus:E,onEscapeKeyDown:S,onPointerDownOutside:_,onFocusOutside:A,onInteractOutside:C,onDismiss:O,disableOutsideScroll:L,...D}=n,B=MR(Aw,s),$=zz(Aw,s),P=tce(s),j=$Yt(s),z=xrr(s),[ee,ne]=H.useState(null),Q=H.useRef(null),ae=ps(i,Q,B.onContentChange),he=H.useRef(0),pe=H.useRef(""),ue=H.useRef(0),fe=H.useRef(null),K=H.useRef("right"),ge=H.useRef(0),De=L?Dz:H.Fragment,Se=L?{as:Mrr,allowPinchZoom:!0}:void 0,Re=xe=>{var Et,Dt;const We=pe.current+xe,ut=z().filter(Yt=>!Yt.disabled),Be=document.activeElement,bt=(Et=ut.find(Yt=>Yt.ref.current===Be))==null?void 0:Et.textValue,Nt=ut.map(Yt=>Yt.textValue),pt=Wrr(Nt,We,bt),Kt=(Dt=ut.find(Yt=>Yt.textValue===pt))==null?void 0:Dt.ref.current;(function Yt(Ln){pe.current=Ln,window.clearTimeout(he.current),Ln!==""&&(he.current=window.setTimeout(()=>Yt(""),1e3))})(We),Kt&&setTimeout(()=>Kt.focus())};H.useEffect(()=>()=>window.clearTimeout(he.current),[]),cae();const Ae=H.useCallback(xe=>{var ut,Be;return K.current===((ut=fe.current)==null?void 0:ut.side)&&Yrr(xe,(Be=fe.current)==null?void 0:Be.area)},[]);return I.jsx(Orr,{scope:s,searchRef:pe,onItemEnter:H.useCallback(xe=>{Ae(xe)&&xe.preventDefault()},[Ae]),onItemLeave:H.useCallback(xe=>{var We;Ae(xe)||((We=Q.current)==null||We.focus(),ne(null))},[Ae]),onTriggerLeave:H.useCallback(xe=>{Ae(xe)&&xe.preventDefault()},[Ae]),pointerGraceTimerRef:ue,onPointerGraceIntentChange:H.useCallback(xe=>{fe.current=xe},[]),children:I.jsx(De,{...Se,children:I.jsx(Rz,{asChild:!0,trapped:d,onMountAutoFocus:Dr(g,xe=>{var We;xe.preventDefault(),(We=Q.current)==null||We.focus({preventScroll:!0})}),onUnmountAutoFocus:b,children:I.jsx(Iz,{asChild:!0,disableOutsidePointerEvents:w,onEscapeKeyDown:S,onPointerDownOutside:_,onFocusOutside:A,onInteractOutside:C,onDismiss:O,children:I.jsx(MYt,{asChild:!0,...j,dir:$.dir,orientation:"vertical",loop:c,currentTabStopId:ee,onCurrentTabStopIdChange:ne,onEntryFocus:Dr(E,xe=>{$.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:I.jsx(cMe,{role:"menu","aria-orientation":"vertical","data-state":oJt(B.open),"data-radix-menu-content":"",dir:$.dir,...P,...D,ref:ae,style:{outline:"none",...D.style},onKeyDown:Dr(D.onKeyDown,xe=>{const ut=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,Be=xe.ctrlKey||xe.altKey||xe.metaKey,bt=xe.key.length===1;ut&&(xe.key==="Tab"&&xe.preventDefault(),!Be&&bt&&Re(xe.key));const Nt=Q.current;if(xe.target!==Nt||!Trr.includes(xe.key))return;xe.preventDefault();const Kt=z().filter(Et=>!Et.disabled).map(Et=>Et.ref.current);jYt.includes(xe.key)&&Kt.reverse(),qrr(Kt)}),onBlur:Dr(n.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(he.current),pe.current="")}),onPointerMove:Dr(n.onPointerMove,hz(xe=>{const We=xe.target,ut=ge.current!==xe.clientX;if(xe.currentTarget.contains(We)&&ut){const Be=xe.clientX>ge.current?"right":"left";K.current=Be,ge.current=xe.clientX}}))})})})})})})});zYt.displayName=Aw;var Prr="MenuGroup",i9e=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{role:"group",...c,ref:i})});i9e.displayName=Prr;var jrr="MenuLabel",GYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{...c,ref:i})});GYt.displayName=jrr;var Tse="MenuItem",d$t="menu.itemSelect",nce=H.forwardRef((n,i)=>{const{disabled:s=!1,onSelect:c,...d}=n,g=H.useRef(null),b=zz(Tse,n.__scopeMenu),w=n9e(Tse,n.__scopeMenu),E=ps(i,g),S=H.useRef(!1),_=()=>{const A=g.current;if(!s&&A){const C=new CustomEvent(d$t,{bubbles:!0,cancelable:!0});A.addEventListener(d$t,O=>c==null?void 0:c(O),{once:!0}),DGt(A,C),C.defaultPrevented?S.current=!1:b.onClose()}};return I.jsx(qYt,{...d,ref:E,disabled:s,onClick:Dr(n.onClick,_),onPointerDown:A=>{var C;(C=n.onPointerDown)==null||C.call(n,A),S.current=!0},onPointerUp:Dr(n.onPointerUp,A=>{var C;S.current||(C=A.currentTarget)==null||C.click()}),onKeyDown:Dr(n.onKeyDown,A=>{const C=w.searchRef.current!=="";s||C&&A.key===" "||aLe.includes(A.key)&&(A.currentTarget.click(),A.preventDefault())})})});nce.displayName=Tse;var qYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,disabled:c=!1,textValue:d,...g}=n,b=n9e(Tse,s),w=$Yt(s),E=H.useRef(null),S=ps(i,E),[_,A]=H.useState(!1),[C,O]=H.useState("");return H.useEffect(()=>{const L=E.current;L&&O((L.textContent??"").trim())},[g.children]),I.jsx(fz.ItemSlot,{scope:s,disabled:c,textValue:d??C,children:I.jsx(PYt,{asChild:!0,...w,focusable:!c,children:I.jsx(no.div,{role:"menuitem","data-highlighted":_?"":void 0,"aria-disabled":c||void 0,"data-disabled":c?"":void 0,...g,ref:S,onPointerMove:Dr(n.onPointerMove,hz(L=>{c?b.onItemLeave(L):(b.onItemEnter(L),L.defaultPrevented||L.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Dr(n.onPointerLeave,hz(L=>b.onItemLeave(L))),onFocus:Dr(n.onFocus,()=>A(!0)),onBlur:Dr(n.onBlur,()=>A(!1))})})})}),Frr="MenuCheckboxItem",VYt=H.forwardRef((n,i)=>{const{checked:s=!1,onCheckedChange:c,...d}=n;return I.jsx(XYt,{scope:n.__scopeMenu,checked:s,children:I.jsx(nce,{role:"menuitemcheckbox","aria-checked":Ase(s)?"mixed":s,...d,ref:i,"data-state":s9e(s),onSelect:Dr(d.onSelect,()=>c==null?void 0:c(Ase(s)?!0:!s),{checkForDefaultPrevented:!1})})})});VYt.displayName=Frr;var WYt="MenuRadioGroup",[$rr,Brr]=LR(WYt,{value:void 0,onValueChange:()=>{}}),KYt=H.forwardRef((n,i)=>{const{value:s,onValueChange:c,...d}=n,g=q2(c);return I.jsx($rr,{scope:n.__scopeMenu,value:s,onValueChange:g,children:I.jsx(i9e,{...d,ref:i})})});KYt.displayName=WYt;var YYt="MenuRadioItem",JYt=H.forwardRef((n,i)=>{const{value:s,...c}=n,d=Brr(YYt,n.__scopeMenu),g=s===d.value;return I.jsx(XYt,{scope:n.__scopeMenu,checked:g,children:I.jsx(nce,{role:"menuitemradio","aria-checked":g,...c,ref:i,"data-state":s9e(g),onSelect:Dr(c.onSelect,()=>{var b;return(b=d.onValueChange)==null?void 0:b.call(d,s)},{checkForDefaultPrevented:!1})})})});JYt.displayName=YYt;var o9e="MenuItemIndicator",[XYt,Urr]=LR(o9e,{checked:!1}),ZYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,forceMount:c,...d}=n,g=Urr(o9e,s);return I.jsx(Cw,{present:c||Ase(g.checked)||g.checked===!0,children:I.jsx(no.span,{...d,ref:i,"data-state":s9e(g.checked)})})});ZYt.displayName=o9e;var Hrr="MenuSeparator",QYt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n;return I.jsx(no.div,{role:"separator","aria-orientation":"horizontal",...c,ref:i})});QYt.displayName=Hrr;var zrr="MenuArrow",eJt=H.forwardRef((n,i)=>{const{__scopeMenu:s,...c}=n,d=tce(s);return I.jsx(uMe,{...d,...c,ref:i})});eJt.displayName=zrr;var Grr="MenuSub",[D1r,tJt]=LR(Grr),sH="MenuSubTrigger",nJt=H.forwardRef((n,i)=>{const s=MR(sH,n.__scopeMenu),c=zz(sH,n.__scopeMenu),d=tJt(sH,n.__scopeMenu),g=n9e(sH,n.__scopeMenu),b=H.useRef(null),{pointerGraceTimerRef:w,onPointerGraceIntentChange:E}=g,S={__scopeMenu:n.__scopeMenu},_=H.useCallback(()=>{b.current&&window.clearTimeout(b.current),b.current=null},[]);return H.useEffect(()=>_,[_]),H.useEffect(()=>{const A=w.current;return()=>{window.clearTimeout(A),E(null)}},[w,E]),I.jsx(e9e,{asChild:!0,...S,children:I.jsx(qYt,{id:d.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":d.contentId,"data-state":oJt(s.open),...n,ref:zg(i,d.onTriggerChange),onClick:A=>{var C;(C=n.onClick)==null||C.call(n,A),!(n.disabled||A.defaultPrevented)&&(A.currentTarget.focus(),s.open||s.onOpenChange(!0))},onPointerMove:Dr(n.onPointerMove,hz(A=>{g.onItemEnter(A),!A.defaultPrevented&&!n.disabled&&!s.open&&!b.current&&(g.onPointerGraceIntentChange(null),b.current=window.setTimeout(()=>{s.onOpenChange(!0),_()},100))})),onPointerLeave:Dr(n.onPointerLeave,hz(A=>{var O,L;_();const C=(O=s.content)==null?void 0:O.getBoundingClientRect();if(C){const D=(L=s.content)==null?void 0:L.dataset.side,B=D==="right",$=B?-5:5,P=C[B?"left":"right"],j=C[B?"right":"left"];g.onPointerGraceIntentChange({area:[{x:A.clientX+$,y:A.clientY},{x:P,y:C.top},{x:j,y:C.top},{x:j,y:C.bottom},{x:P,y:C.bottom}],side:D}),window.clearTimeout(w.current),w.current=window.setTimeout(()=>g.onPointerGraceIntentChange(null),300)}else{if(g.onTriggerLeave(A),A.defaultPrevented)return;g.onPointerGraceIntentChange(null)}})),onKeyDown:Dr(n.onKeyDown,A=>{var O;const C=g.searchRef.current!=="";n.disabled||C&&A.key===" "||Arr[c.dir].includes(A.key)&&(s.onOpenChange(!0),(O=s.content)==null||O.focus(),A.preventDefault())})})})});nJt.displayName=sH;var rJt="MenuSubContent",iJt=H.forwardRef((n,i)=>{const s=UYt(Aw,n.__scopeMenu),{forceMount:c=s.forceMount,...d}=n,g=MR(Aw,n.__scopeMenu),b=zz(Aw,n.__scopeMenu),w=tJt(rJt,n.__scopeMenu),E=H.useRef(null),S=ps(i,E);return I.jsx(fz.Provider,{scope:n.__scopeMenu,children:I.jsx(Cw,{present:c||g.open,children:I.jsx(fz.Slot,{scope:n.__scopeMenu,children:I.jsx(r9e,{id:w.contentId,"aria-labelledby":w.triggerId,...d,ref:S,align:"start",side:b.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:_=>{var A;b.isUsingKeyboardRef.current&&((A=E.current)==null||A.focus()),_.preventDefault()},onCloseAutoFocus:_=>_.preventDefault(),onFocusOutside:Dr(n.onFocusOutside,_=>{_.target!==w.trigger&&g.onOpenChange(!1)}),onEscapeKeyDown:Dr(n.onEscapeKeyDown,_=>{b.onClose(),_.preventDefault()}),onKeyDown:Dr(n.onKeyDown,_=>{var O;const A=_.currentTarget.contains(_.target),C=_rr[b.dir].includes(_.key);A&&C&&(g.onOpenChange(!1),(O=w.trigger)==null||O.focus(),_.preventDefault())})})})})})});iJt.displayName=rJt;function oJt(n){return n?"open":"closed"}function Ase(n){return n==="indeterminate"}function s9e(n){return Ase(n)?"indeterminate":n?"checked":"unchecked"}function qrr(n){const i=document.activeElement;for(const s of n)if(s===i||(s.focus(),document.activeElement!==i))return}function Vrr(n,i){return n.map((s,c)=>n[(i+c)%n.length])}function Wrr(n,i,s){const d=i.length>1&&Array.from(i).every(S=>S===i[0])?i[0]:i,g=s?n.indexOf(s):-1;let b=Vrr(n,Math.max(g,0));d.length===1&&(b=b.filter(S=>S!==s));const E=b.find(S=>S.toLowerCase().startsWith(d.toLowerCase()));return E!==s?E:void 0}function Krr(n,i){const{x:s,y:c}=n;let d=!1;for(let g=0,b=i.length-1;gc!=C>c&&s<(A-S)*(c-_)/(C-_)+S&&(d=!d)}return d}function Yrr(n,i){if(!i)return!1;const s={x:n.clientX,y:n.clientY};return Krr(s,i)}function hz(n){return i=>i.pointerType==="mouse"?n(i):void 0}var Jrr=BYt,Xrr=e9e,Zrr=HYt,Qrr=zYt,eir=i9e,tir=GYt,nir=nce,rir=VYt,iir=KYt,oir=JYt,sir=ZYt,air=QYt,cir=eJt,uir=nJt,lir=iJt,rce="DropdownMenu",[dir]=Nw(rce,[FYt]),Kg=FYt(),[fir,sJt]=dir(rce),aJt=n=>{const{__scopeDropdownMenu:i,children:s,dir:c,open:d,defaultOpen:g,onOpenChange:b,modal:w=!0}=n,E=Kg(i),S=H.useRef(null),[_,A]=G2({prop:d,defaultProp:g??!1,onChange:b,caller:rce});return I.jsx(fir,{scope:i,triggerId:Bh(),triggerRef:S,contentId:Bh(),open:_,onOpenChange:A,onOpenToggle:H.useCallback(()=>A(C=>!C),[A]),modal:w,children:I.jsx(Jrr,{...E,open:_,onOpenChange:A,dir:c,modal:w,children:s})})};aJt.displayName=rce;var cJt="DropdownMenuTrigger",uJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,disabled:c=!1,...d}=n,g=sJt(cJt,s),b=Kg(s);return I.jsx(Xrr,{asChild:!0,...b,children:I.jsx(no.button,{type:"button",id:g.triggerId,"aria-haspopup":"menu","aria-expanded":g.open,"aria-controls":g.open?g.contentId:void 0,"data-state":g.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:zg(i,g.triggerRef),onPointerDown:Dr(n.onPointerDown,w=>{!c&&w.button===0&&w.ctrlKey===!1&&(g.onOpenToggle(),g.open||w.preventDefault())}),onKeyDown:Dr(n.onKeyDown,w=>{c||(["Enter"," "].includes(w.key)&&g.onOpenToggle(),w.key==="ArrowDown"&&g.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(w.key)&&w.preventDefault())})})})});uJt.displayName=cJt;var hir="DropdownMenuPortal",lJt=n=>{const{__scopeDropdownMenu:i,...s}=n,c=Kg(i);return I.jsx(Zrr,{...c,...s})};lJt.displayName=hir;var dJt="DropdownMenuContent",fJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=sJt(dJt,s),g=Kg(s),b=H.useRef(!1);return I.jsx(Qrr,{id:d.contentId,"aria-labelledby":d.triggerId,...g,...c,ref:i,onCloseAutoFocus:Dr(n.onCloseAutoFocus,w=>{var E;b.current||(E=d.triggerRef.current)==null||E.focus(),b.current=!1,w.preventDefault()}),onInteractOutside:Dr(n.onInteractOutside,w=>{const E=w.detail.originalEvent,S=E.button===0&&E.ctrlKey===!0,_=E.button===2||S;(!d.modal||_)&&(b.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fJt.displayName=dJt;var pir="DropdownMenuGroup",gir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(eir,{...d,...c,ref:i})});gir.displayName=pir;var bir="DropdownMenuLabel",hJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(tir,{...d,...c,ref:i})});hJt.displayName=bir;var mir="DropdownMenuItem",pJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(nir,{...d,...c,ref:i})});pJt.displayName=mir;var wir="DropdownMenuCheckboxItem",gJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(rir,{...d,...c,ref:i})});gJt.displayName=wir;var yir="DropdownMenuRadioGroup",vir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(iir,{...d,...c,ref:i})});vir.displayName=yir;var Eir="DropdownMenuRadioItem",bJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(oir,{...d,...c,ref:i})});bJt.displayName=Eir;var Sir="DropdownMenuItemIndicator",mJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(sir,{...d,...c,ref:i})});mJt.displayName=Sir;var Tir="DropdownMenuSeparator",wJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(air,{...d,...c,ref:i})});wJt.displayName=Tir;var Air="DropdownMenuArrow",_ir=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(cir,{...d,...c,ref:i})});_ir.displayName=Air;var xir="DropdownMenuSubTrigger",yJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(uir,{...d,...c,ref:i})});yJt.displayName=xir;var kir="DropdownMenuSubContent",vJt=H.forwardRef((n,i)=>{const{__scopeDropdownMenu:s,...c}=n,d=Kg(s);return I.jsx(lir,{...d,...c,ref:i,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});vJt.displayName=kir;var Nir=aJt,Cir=uJt,Iir=lJt,EJt=fJt,SJt=hJt,TJt=pJt,AJt=gJt,_Jt=bJt,xJt=mJt,kJt=wJt,NJt=yJt,CJt=vJt;const IJt=Nir,RJt=Cir,Rir=H.forwardRef(({className:n,inset:i,children:s,...c},d)=>I.jsxs(NJt,{ref:d,className:nr("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",i&&"pl-8",n),...c,children:[s,I.jsx(C8n,{className:"ml-auto"})]}));Rir.displayName=NJt.displayName;const Oir=H.forwardRef(({className:n,...i},s)=>I.jsx(CJt,{ref:s,className:nr("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:animate-out data-[state=open]:animate-in",n),...i}));Oir.displayName=CJt.displayName;const a9e=H.forwardRef(({className:n,sideOffset:i=4,container:s,...c},d)=>I.jsx(Iir,{container:s,children:I.jsx(EJt,{ref:d,sideOffset:i,className:nr("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] data-[state=closed]:animate-out data-[state=open]:animate-in",n),...c})}));a9e.displayName=EJt.displayName;const cLe=H.forwardRef(({className:n,inset:i,...s},c)=>I.jsx(TJt,{ref:c,className:nr("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",i&&"pl-8",n),...s}));cLe.displayName=TJt.displayName;const OJt=H.forwardRef(({className:n,children:i,checked:s,...c},d)=>I.jsxs(AJt,{ref:d,className:nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),checked:s,...c,children:[I.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(xJt,{children:I.jsx(oN,{className:"h-4 w-4"})})}),i]}));OJt.displayName=AJt.displayName;const Dir=H.forwardRef(({className:n,children:i,...s},c)=>I.jsxs(_Jt,{ref:c,className:nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...s,children:[I.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:I.jsx(xJt,{children:I.jsx(F8n,{className:"h-2 w-2 fill-current"})})}),i]}));Dir.displayName=_Jt.displayName;const Lir=H.forwardRef(({className:n,inset:i,...s},c)=>I.jsx(SJt,{ref:c,className:nr("px-2 py-1.5 font-semibold text-sm",i&&"pl-8",n),...s}));Lir.displayName=SJt.displayName;const Mir=H.forwardRef(({className:n,...i},s)=>I.jsx(kJt,{ref:s,className:nr("-mx-1 my-1 h-px bg-muted",n),...i}));Mir.displayName=kJt.displayName;function KM({field:n,value:i,onChange:s,entities:c,domain:d,translations:g={},error:b}){const{t:w}=jo(["common"]),E=n.name,S=n.required??!1;let _=E,A="",C="";if("label"in n)_=n.label,A=n.description||"",C=n.placeholder||"";else if(d){const P=`component.${d}.device_automation.extra_fields.${E}`,j=`component.${d}.device_automation.extra_fields_descriptions.${E}`;_=g[P]||E.split("_").map(z=>z.charAt(0).toUpperCase()+z.slice(1)).join(" "),A=g[j]||"",console.log(`Field "${E}" in domain "${d}":`),console.log(` Label key: ${P} = ${g[P]||"(not found)"}`),console.log(` Desc key: ${j} = ${g[j]||"(not found)"}`),console.log(` Final label: ${_}`),console.log(` Final description: ${A}`)}else _=E.split("_").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "),console.log(`Field "${E}" with no domain - using formatted name: ${_}`);let O=null,L={};if("type"in n&&n.type)O=n.type;else if("selector"in n&&n.selector){const P=Object.keys(n.selector);P.length>0&&(O=P[0],L=n.selector[O]||{})}const D=typeof i=="string"?i:String(i??""),B=typeof i=="boolean"?i:!!i,$=()=>{switch(O){case"text":{if("multiple"in n&&n.multiple){const j=Array.isArray(i)?i:typeof i=="string"&&i?[i]:[];return I.jsx(oLe,{values:j,onChange:s,placeholder:C||"Add value..."})}return I.jsx(Na,{type:"text",value:D,onChange:j=>s(j.target.value),placeholder:C,required:S})}case"number":return I.jsx(xYt,{value:i,placeholder:C,required:S,onChange:s});case"boolean":return I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:B,onCheckedChange:s}),I.jsx("span",{className:"text-muted-foreground text-sm",children:w(B?"dynamicField.enabled":"dynamicField.disabled")})]});case"select":{const P=kYt("options"in n&&n.options?n.options:L.options);if("multiple"in n&&n.multiple||L.multiple===!0){const z=Array.isArray(i)?i:i?[i]:[],ee=()=>{var ne;return z.length===0?C||w("dynamicField.selectItems"):z.length===1?((ne=P.find(Q=>Q.value===z[0]))==null?void 0:ne.label)||z[0]:w("dynamicField.itemsSelected",{count:z.length})};return I.jsxs(IJt,{children:[I.jsx(RJt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",className:"w-full justify-between font-normal",children:[I.jsx("span",{className:z.length===0?"text-muted-foreground":"",children:ee()}),I.jsx(oae,{className:"ml-2 h-4 w-4 opacity-50"})]})}),I.jsx(a9e,{className:"w-[var(--radix-dropdown-menu-trigger-width)]",children:P.map(ne=>{const Q=z.includes(ne.value);return I.jsx(OJt,{checked:Q,onCheckedChange:ae=>{s(ae?[...z,ne.value]:z.filter(he=>he!==ne.value))},children:ne.label},ne.value)})})]})}return I.jsxs(zp,{value:D,onValueChange:s,children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:C||"Select..."})}),I.jsx(Gh,{children:P.map(z=>I.jsx(eo,{value:z.value,children:z.label},z.value))})]})}case"entity":{if("multiple"in n&&n.multiple||L.multiple===!0){const j=Array.isArray(i)?i:typeof i=="string"&&i?i.split(",").map(z=>z.trim()):[];return I.jsx(Qae,{value:j,onChange:s,entities:c,placeholder:C||w("dynamicField.selectEntities")})}return I.jsx(Sse,{value:D,onChange:s,entities:c,placeholder:C||w("dynamicField.selectEntity")})}case"zone":return I.jsx(Sse,{value:D,onChange:s,entities:c,domainFilter:"zone",placeholder:C||w("dynamicField.selectZone")});case"template":return I.jsx(Bv,{value:D,onChange:P=>s(P.target.value),placeholder:C||w("placeholders.enterTemplate"),className:"font-mono text-sm",rows:4,required:S});case"duration":return I.jsx(NYt,{value:i??"",onChange:s});case"object":return I.jsx(Bv,{value:typeof i=="object"?JSON.stringify(i,null,2):D,onChange:P=>{try{s(JSON.parse(P.target.value))}catch{s(P.target.value)}},placeholder:C||w("placeholders.jsonExample"),className:"font-mono text-sm",rows:4,required:S});case"time":return I.jsx(Na,{type:"time",value:D,onChange:P=>s(P.target.value),required:S});case"date":return I.jsx(Na,{type:"date",value:D,onChange:P=>s(P.target.value),required:S});default:return I.jsx(Na,{type:"text",value:D,onChange:P=>s(P.target.value),placeholder:C||w("dynamicField.enterValue",{name:E}),required:S})}};return I.jsxs("div",{className:"space-y-2",children:[I.jsxs(ll,{className:"font-medium text-muted-foreground text-xs",children:[_,S&&I.jsx("span",{className:"ml-1 text-destructive",children:w("labels.requiredAsterisk")})]}),$(),I.jsx(H2,{message:b}),A&&I.jsx("p",{className:"text-muted-foreground text-xs",children:A})]})}const Pir={state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"The entity to check"},{name:"state",label:"State",type:"text",required:!0,placeholder:"e.g., on, off, home",description:"The state value to check for"},{name:"attribute",label:"Attribute (optional)",type:"text",required:!1,placeholder:"e.g., brightness, temperature",description:"Check a specific attribute instead of the state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the condition must be true"}],numeric_state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"The sensor entity to check"},{name:"above",label:"Above (optional)",type:"number",required:!1,placeholder:"Minimum value",description:"Condition is true when value > this"},{name:"below",label:"Below (optional)",type:"number",required:!1,placeholder:"Maximum value",description:"Condition is true when value < this"},{name:"attribute",label:"Attribute (optional)",type:"text",required:!1,placeholder:"e.g., brightness, temperature",description:"Check a specific attribute instead of the state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the condition must be true"}],template:[{name:"value_template",label:"Value Template",type:"template",required:!0,placeholder:'{{ states("sensor.temperature") | float > 20 }}',description:"Template that should evaluate to true/false"}],time:[{name:"after",label:"After (optional)",type:"time",required:!1,description:"Condition is true after this time"},{name:"before",label:"Before (optional)",type:"time",required:!1,description:"Condition is true before this time"},{name:"weekday",label:"Weekday (optional)",type:"select",required:!1,multiple:!0,description:"Days of the week when condition is true",options:[{value:"mon",label:"Monday"},{value:"tue",label:"Tuesday"},{value:"wed",label:"Wednesday"},{value:"thu",label:"Thursday"},{value:"fri",label:"Friday"},{value:"sat",label:"Saturday"},{value:"sun",label:"Sunday"}]}],sun:[{name:"after",label:"After",type:"select",required:!1,description:"Condition is true after this sun event",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}]},{name:"after_offset",label:"After Offset (optional)",type:"text",required:!1,placeholder:"e.g., -00:30:00",description:"Time offset for the after event"},{name:"before",label:"Before",type:"select",required:!1,description:"Condition is true before this sun event",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}]},{name:"before_offset",label:"Before Offset (optional)",type:"text",required:!1,placeholder:"e.g., +01:00:00",description:"Time offset for the before event"}],zone:[{name:"entity_id",label:"Entity",type:"entity",required:!0,description:"Person or device tracker to monitor"},{name:"zone",label:"Zone",type:"zone",required:!0,placeholder:"zone.home",description:"Zone entity to check for presence"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"00:05:00",description:"How long the entity must be in the zone"}],trigger:[{name:"id",label:"Trigger ID(s)",type:"text",required:!0,multiple:!0,placeholder:"e.g., arriving, leaving",description:"The ID(s) of the trigger(s) to match"}],device:[],and:[],or:[],not:[]};function c9e(n){return Pir[n]||[]}function DJt(n){const i=c9e(n),s={condition:n};for(const c of i)c.default!==void 0&&(s[c.name]=c.default);return u9e(n)&&(s.conditions=[]),s}function u9e(n){return n==="and"||n==="or"||n==="not"}const jir=[{value:"state",labelKey:"nodes:conditions.types.state"},{value:"numeric_state",labelKey:"nodes:conditions.types.numeric_state"},{value:"template",labelKey:"nodes:conditions.types.template"},{value:"trigger",labelKey:"nodes:conditions.types.trigger"},{value:"zone",labelKey:"nodes:conditions.types.zone"},{value:"time",labelKey:"nodes:conditions.types.time"},{value:"sun",labelKey:"nodes:conditions.types.sun"},{value:"and",labelKey:"nodes:conditions.types.and"},{value:"or",labelKey:"nodes:conditions.types.or"},{value:"not",labelKey:"nodes:conditions.types.not"}];function Fir({cond:n,onUpdate:i,entities:s}){const c=n.condition||"state",d=c9e(c);return d.length===0?null:I.jsx("div",{className:"space-y-2",children:d.map(g=>I.jsx(KM,{field:g,value:n[g.name],onChange:b=>i({...n,[g.name]:b}),entities:s},g.name))})}function $ir({cond:n,onUpdate:i,onRemove:s,entities:c,depth:d}){const g=n.condition||"state",b=u9e(g),{t:w}=jo(["common","nodes","panels"]),E=S=>{i(DJt(S))};return I.jsxs("div",{className:nr("space-y-3 rounded-md border bg-card p-3",d>0&&"bg-muted/30"),children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsxs(zp,{value:n.condition||"state",onValueChange:E,children:[I.jsx(zh,{className:"w-full max-w-[180px]",children:I.jsx(Gp,{})}),I.jsx(Gh,{children:jir.map(S=>I.jsx(eo,{value:S.value,children:w(S.labelKey)},S.value))})]}),I.jsx(mi,{size:"icon",variant:"ghost",onClick:s,className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive",children:I.jsx(jM,{className:"h-4 w-4"})})]}),b?I.jsx(LJt,{conditions:n.conditions||[],onChange:S=>i({...n,conditions:S}),parentType:n.condition,depth:d+1}):I.jsx(Fir,{cond:n,onUpdate:i,entities:c})]})}const LJt=H.memo(function({conditions:i,onChange:s,depth:c=0}){const{hass:d}=Wg(),g=d?Object.values(d.states):[],{t:b}=jo(["common","nodes","panels"]),w=()=>{s([...i,{condition:"state",entity_id:"",state:""}])},E=_=>{s(i.filter((A,C)=>C!==_))},S=(_,A)=>{s(i.map((C,O)=>O===_?A:C))};return I.jsxs("div",{className:nr("space-y-2",c>0&&"border-muted border-l-2 pl-2"),children:[i.length===0?I.jsx("p",{className:"py-2 text-muted-foreground text-xs italic",children:b("panels:conditionGroupEditor.noConditions")}):i.map((_,A)=>I.jsx($ir,{cond:_,onUpdate:C=>S(A,C),onRemove:()=>E(A),entities:g,depth:c},A)),I.jsxs(mi,{size:"sm",variant:"outline",onClick:w,className:"w-full",children:[I.jsx(sae,{className:"mr-1 h-4 w-4"}),b("panels:conditionGroupEditor.addCondition")]})]})});function MJt({value:n,onChange:i,label:s="",required:c=!1,placeholder:d=""}){const{t:g}=jo(["common"]),{hass:b}=Wg(),[w,E]=H.useState(n);H.useEffect(()=>{E(n)},[n]);const S=(b==null?void 0:b.devices)??{},_=Object.keys(S).length>0,A=n&&_&&!S[n],C=()=>{if(!n)return;const O=S[n];return O?O.name_by_user||O.name||O.id:n};return I.jsx(No,{label:s||g("labels.device"),required:c,children:_?I.jsxs(zp,{value:n,onValueChange:i,children:[I.jsx(zh,{className:A?"font-mono text-red-600":void 0,children:I.jsx(Gp,{placeholder:d||g("placeholders.selectDevice"),children:C()})}),I.jsx(Gh,{children:Object.values(S).map(O=>I.jsx(eo,{value:O.id,children:O.name_by_user||O.name||O.id},O.id))})]}):I.jsxs(I.Fragment,{children:[I.jsx(Na,{type:"text",value:w,onChange:O=>{E(O.target.value),i(O.target.value)},placeholder:g("deviceSelector.enterId")}),I.jsx("p",{className:"text-muted-foreground text-xs",children:g("deviceSelector.noDevices")})]})})}function Bir({node:n,onChange:i}){const s=jh(n,"device_id"),c=jh(n,"domain"),d=jh(n,"type");return I.jsxs(I.Fragment,{children:[I.jsx(MJt,{value:s,onChange:g=>i("device_id",g),label:"Device",required:!0,placeholder:"Select device..."}),I.jsx(No,{label:"Domain",required:!0,description:"Device integration domain",children:I.jsx(Na,{type:"text",value:c,onChange:g=>i("domain",g.target.value),placeholder:"e.g., binary_sensor, sensor"})}),I.jsx(No,{label:"Type",required:!0,description:"Device condition type",children:I.jsx(Na,{type:"text",value:d,onChange:g=>i("type",g.target.value),placeholder:"e.g., button_short_press"})})]})}function Uir({node:n,onChange:i,entities:s}){const{t:c}=jo(["common","nodes"]),{getFieldError:d}=gb(n.id),g=jh(n,"condition","state"),b=n.data,w=Array.isArray(b.conditions)&&b.conditions.length>0,E=u9e(g),S=A=>{const C=DJt(A);for(const[O,L]of Object.entries(C))i(O,L)},_=()=>g==="device"?I.jsx(Bir,{node:n,onChange:i}):E?null:c9e(g).map(C=>I.jsx(KM,{field:C,value:b[C.name],onChange:O=>i(C.name,O),entities:s,error:d(C.name)},C.name));return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:conditions.conditionLabel"),required:!0,children:I.jsxs(zp,{value:g,onValueChange:S,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"state",children:c("nodes:conditions.types.state")}),I.jsx(eo,{value:"numeric_state",children:c("nodes:conditions.types.numeric_state")}),I.jsx(eo,{value:"template",children:c("nodes:conditions.types.template")}),I.jsx(eo,{value:"time",children:c("nodes:conditions.types.time")}),I.jsx(eo,{value:"sun",children:c("nodes:conditions.types.sun")}),I.jsx(eo,{value:"zone",children:c("nodes:conditions.types.zone")}),I.jsx(eo,{value:"device",children:c("nodes:conditions.types.device")}),I.jsx(eo,{value:"trigger",children:c("nodes:conditions.types.trigger")}),I.jsx(eo,{value:"and",children:c("nodes:conditions.types.and")}),I.jsx(eo,{value:"or",children:c("nodes:conditions.types.or")}),I.jsx(eo,{value:"not",children:c("nodes:conditions.types.not")})]})]})}),_(),(E||w)&&I.jsx(No,{label:c("nodes:conditions.nestedConditions"),children:I.jsx(LJt,{conditions:b.conditions||[],onChange:A=>i("conditions",A),parentType:E?g:"and"})})]})}function Hir({node:n,onChange:i}){const{getFieldError:s}=gb(n.id);return I.jsxs(I.Fragment,{children:[I.jsx(CYt,{label:"Delay",value:n.data.delay,onChange:c=>i("delay",c)}),I.jsx(H2,{message:s("delay")})]})}function zir({node:n,onChange:i}){const{t:s}=jo(["nodes"]),{getFieldError:c}=gb(n.id),d=C5(n,"variables",{}),g=Object.entries(d),b=()=>{const _=Object.keys(d);let A="variable",C=1;for(;_.includes(A);)A=`variable_${C}`,C++;i("variables",{...d,[A]:""})},w=(_,A)=>{if(_===A)return;const C={};for(const[O,L]of Object.entries(d))O===_?C[A]=L:C[O]=L;i("variables",C)},E=(_,A)=>{i("variables",{...d,[_]:A})},S=_=>{const A={...d};delete A[_],i("variables",A)};return I.jsxs("div",{className:"space-y-4",children:[I.jsx(H2,{message:c("variables")}),g.length===0?I.jsx("p",{className:"text-muted-foreground text-sm",children:s("nodes:setVariablesFields.empty")}):g.map(([_,A],C)=>I.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:[I.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[I.jsx("span",{className:"font-medium text-muted-foreground text-xs",children:s("nodes:setVariablesFields.variableLabel",{index:C+1})}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>S(_),className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{className:"h-3.5 w-3.5"})})]}),I.jsxs("div",{className:"space-y-3",children:[I.jsx(No,{label:s("nodes:setVariablesFields.name"),children:I.jsx(Na,{value:_,onChange:O=>w(_,O.target.value),placeholder:s("nodes:setVariablesFields.namePlaceholder"),className:"font-mono text-sm"})}),I.jsx(No,{label:s("nodes:setVariablesFields.value"),description:s("nodes:setVariablesFields.valueDescription"),children:I.jsx(Bv,{value:String(A??""),onChange:O=>E(_,O.target.value),placeholder:s("nodes:setVariablesFields.valuePlaceholder"),className:"font-mono text-sm"})})]})]},`${_}-${C}`)),I.jsxs(mi,{variant:"outline",onClick:b,className:"w-full gap-2",size:"sm",children:[I.jsx(sae,{className:"h-4 w-4"}),s("nodes:setVariablesFields.addVariable")]})]})}const PJt={state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,multiple:!0,description:"The entity to monitor for state changes"},{name:"to",label:"To State",type:"text",required:!1,placeholder:"e.g., on, off, home",description:"The target state to trigger on"},{name:"from",label:"From State",type:"text",required:!1,placeholder:"e.g., off",description:"Only trigger when transitioning from this state"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"State must be stable for this duration"}],numeric_state:[{name:"entity_id",label:"Entity",type:"entity",required:!0,multiple:!0,description:"The sensor entity to monitor"},{name:"above",label:"Above",type:"number",required:!1,placeholder:"e.g., 20",description:"Trigger when value goes above this threshold"},{name:"below",label:"Below",type:"number",required:!1,placeholder:"e.g., 30",description:"Trigger when value goes below this threshold"},{name:"value_template",label:"Value Template (optional)",type:"template",required:!1,placeholder:"e.g., {{ state.attributes.temperature }}",description:"Template to extract numeric value from entity"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"Value must be stable for this duration"}],time:[{name:"at",label:"At (time)",type:"text",required:!0,placeholder:"e.g., 07:00:00 or input_datetime.wake_up",description:"Time to trigger (HH:MM:SS or entity reference)"}],time_pattern:[{name:"hours",label:"Hours",type:"text",required:!1,placeholder:"e.g., */2 (every 2 hours)",description:"Hour pattern (cron-style)"},{name:"minutes",label:"Minutes",type:"text",required:!1,placeholder:"e.g., /5 (every 5 minutes)",description:"Minute pattern (cron-style)"},{name:"seconds",label:"Seconds",type:"text",required:!1,placeholder:"e.g., 0",description:"Second pattern (cron-style)"}],event:[{name:"event_type",label:"Event Type",type:"text",required:!0,placeholder:"e.g., zha_event, call_service",description:"The type of event to listen for"},{name:"event_data",label:"Event Data (optional)",type:"object",required:!1,description:"Filter events by data fields (JSON object)"}],mqtt:[{name:"topic",label:"Topic",type:"text",required:!0,placeholder:"e.g., home/bedroom/temperature",description:"MQTT topic to subscribe to"},{name:"payload",label:"Payload (optional)",type:"text",required:!1,placeholder:"e.g., ON",description:"Only trigger on this specific payload"}],webhook:[{name:"webhook_id",label:"Webhook ID",type:"text",required:!0,placeholder:"e.g., my_webhook",description:"Unique identifier for this webhook"}],sun:[{name:"event",label:"Event",type:"select",required:!0,description:"Trigger at sunrise or sunset",options:[{value:"sunrise",label:"Sunrise"},{value:"sunset",label:"Sunset"}],default:"sunset"},{name:"offset",label:"Offset (optional)",type:"text",required:!1,placeholder:"e.g., -00:30:00",description:"Time offset before (-) or after (+) the event"}],zone:[{name:"entity_id",label:"Person/Device",type:"entity",required:!0,multiple:!0,description:"The person or device tracker to monitor"},{name:"zone",label:"Zone",type:"zone",required:!0,placeholder:"e.g., zone.home",description:"The zone entity to monitor"},{name:"event",label:"Event",type:"select",required:!0,description:"Trigger on enter or leave",options:[{value:"enter",label:"Enter"},{value:"leave",label:"Leave"}],default:"enter"}],template:[{name:"value_template",label:"Value Template",type:"template",required:!0,placeholder:'e.g., {{ is_state("light.bedroom", "on") }}',description:"Template that evaluates to true/false"},{name:"for",label:"For Duration (optional)",type:"duration",required:!1,placeholder:"e.g., 00:05:00",description:"Template must be true for this duration"}],homeassistant:[{name:"event",label:"Event",type:"select",required:!0,description:"Home Assistant lifecycle event",options:[{value:"start",label:"Start"},{value:"shutdown",label:"Shutdown"}],default:"start"}],device:[]};function ice(n){return PJt[n]||[]}function Gir(n){const i=ice(n),s={trigger:n};for(const c of i)c.default!==void 0&&(s[c.name]=c.default);return s}function qir(){const{hass:n}=Wg(),i=H.useCallback(async c=>{if(!(n!=null&&n.callWS))return console.warn("callWS not available"),[];try{return await n.callWS({type:"device_automation/trigger/list",device_id:c})||[]}catch(d){throw console.error("Failed to fetch device triggers:",d),d}},[n]),s=H.useCallback(async c=>{if(!(n!=null&&n.callWS))return console.warn("callWS not available"),{extra_fields:[]};try{return await n.callWS({type:"device_automation/trigger/capabilities",trigger:c})||{extra_fields:[]}}catch(d){throw console.error("Failed to fetch trigger capabilities:",d),d}},[n]);return{getDeviceTriggers:i,getTriggerCapabilities:s}}const Vir=Sc({resources:yf(Zt(),Dc()).transform(n=>{const i={};for(const[s,c]of Object.entries(n))typeof c=="string"&&(i[s]=c);return i})});function Wir(){const{hass:n}=Wg(),[i,s]=H.useState({}),[c,d]=H.useState(!0),g=H.useMemo(()=>{const w=n==null?void 0:n.resources;if(!w||Object.keys(w).length===0)return{};const E=Object.values(w)[0];if(typeof E=="string")return w;if(typeof E=="object"&&E!==null){const S={};for(const _ of Object.values(w))typeof _=="object"&&_!==null&&Object.assign(S,_);return S}return{}},[n==null?void 0:n.resources]);return H.useEffect(()=>{if(!n){d(!1);return}(async()=>{d(!0);try{const E=await n.callWS({type:"frontend/get_translations",language:navigator.language.split("-")[0]||"en",category:"device_automation"}),S=Vir.safeParse(E);S.success&&s(S.data.resources)}catch{}finally{d(!1)}})()},[n]),{translations:H.useMemo(()=>({...g,...i}),[g,i]),isLoading:c}}function JOe(n){const i=[n.type];return n.subtype&&i.push(n.subtype),n.entity_id&&i.push(n.entity_id),i.join("::")}function Kir(n,i){const s=`component.${n.domain}.device_automation.trigger_type.${n.type}`,c=i[s]??n.type;if(n.subtype){const d=`component.${n.domain}.device_automation.trigger_subtype.${n.subtype}`,g=i[d]??n.subtype;return`${c}: ${g}`}return c}function Yir({node:n,onChange:i,entities:s}){const{t:c}=jo(["common","nodes","errors"]),{getDeviceTriggers:d,getTriggerCapabilities:g}=qir(),{translations:b}=Wir(),[w,E]=H.useState([]),[S,_]=H.useState([]),[A,C]=H.useState(!1),O=jh(n,"device_id"),L=jh(n,"type"),D=jh(n,"domain"),B=jh(n,"entity_id"),$=jh(n,"subtype"),P=(()=>{const j=[L].filter(Boolean);return $&&j.push($),B&&j.push(B),j.join("::")})();return H.useEffect(()=>{if(!O){E([]);return}C(!0),d(O).then(j=>{E(j)}).catch(j=>{console.error(c("errors:api.loadDeviceTriggersFailed"),j),E([])}).finally(()=>{C(!1)})},[O,d,c]),H.useEffect(()=>{if(!O||!L){_([]);return}const j=w.find(z=>z.type===L&&z.domain===D&&(z.subtype??"")===($??"")&&(z.entity_id??"")===(B??""));if(!j){_([]);return}g(j).then(z=>{_(z.extra_fields||[])}).catch(z=>{console.error(c("errors:api.loadTriggerCapabilitiesFailed"),z),_([])})},[O,L,$,B,D,w,g,c]),I.jsxs(I.Fragment,{children:[I.jsx(MJt,{value:O,onChange:j=>i("device_id",j),label:c("labels.device"),required:!0,placeholder:c("placeholders.selectDevice")}),O&&w.length>0?I.jsx(No,{label:c("labels.triggerType"),required:!0,children:I.jsxs(zp,{value:P,onValueChange:j=>{const z=w.find(ee=>JOe(ee)===j);z&&(i("type",z.type),i("domain",z.domain),i("subtype",z.subtype??void 0),i("entity_id",z.entity_id??void 0))},children:[I.jsx(zh,{children:I.jsx(Gp,{placeholder:c("placeholders.selectTriggerType")})}),I.jsx(Gh,{children:w.map(j=>I.jsx(eo,{value:JOe(j),children:Kir(j,b)},JOe(j)))})]})}):O&&L&&I.jsx(No,{label:"Trigger Type",children:I.jsxs("div",{className:"truncate rounded-md border bg-muted px-3 py-2 font-mono text-sm",children:[L,$&&I.jsxs("span",{className:"text-muted-foreground",children:[" · ",$]}),D&&I.jsxs("span",{className:"text-muted-foreground",children:[" ",`(${D})`]})]})}),A&&I.jsx("div",{className:"text-muted-foreground text-sm",children:c("status.loadingTriggers")}),S.map(j=>I.jsx(KM,{field:j,value:n.data[j.name],onChange:z=>i(j.name,z),entities:s,domain:D,translations:b},j.name))]})}const Jir={light:["on","off","unavailable"],switch:["on","off","unavailable"],binary_sensor:["on","off","unavailable"],input_boolean:["on","off"],cover:["open","closed","opening","closing","unavailable"],lock:["locked","unlocked","locking","unlocking","unavailable"],alarm_control_panel:["disarmed","armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass","pending","arming","disarming","triggered","unavailable"],climate:["heat","cool","heat_cool","auto","dry","fan_only","off","unavailable"],fan:["on","off","unavailable"],media_player:["playing","paused","idle","off","on","standby","buffering","unavailable"],vacuum:["cleaning","docked","paused","idle","returning","error","unavailable"],person:["home","not_home","unavailable"],device_tracker:["home","not_home","unavailable"],water_heater:["electric","gas","heat_pump","eco","performance","high_demand","off","unavailable"],humidifier:["on","off","unavailable"],update:["on","off","unavailable"]},jJt=["on","off","unavailable","unknown"];function Xir(n,i){const s=i.find(b=>b.entity_id===n),c=n.split(".")[0],d=Jir[c]??jJt,g=new Set(d);return s!=null&&s.state?[s.state,...d.filter(b=>b!==s.state)]:Array.from(g)}function f$t({value:n,onChange:i,suggestions:s,placeholder:c}){const{t:d}=jo(["common"]),[g,b]=H.useState(!1),[w,E]=H.useState(""),S=H.useMemo(()=>w?s.filter(C=>C.toLowerCase().includes(w.toLowerCase())):s,[w,s]),_=w&&!s.includes(w),A=C=>{i(C===n?"":C),b(!1),E("")};return I.jsxs(dMe,{open:g,onOpenChange:b,children:[I.jsx(oVt,{asChild:!0,children:I.jsxs(mi,{variant:"outline",role:"combobox","aria-expanded":g,className:nr("flex w-full justify-between",!n&&"text-muted-foreground"),children:[I.jsx("span",{className:"truncate",children:n||c}),I.jsx(EGt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),I.jsx(_ae,{className:"w-[286px] p-0",children:I.jsxs(pae,{shouldFilter:!1,children:[I.jsx(gae,{placeholder:c,value:w,onValueChange:E}),I.jsxs(bae,{children:[S.length===0&&!_&&I.jsx(mae,{children:d("combobox.noOptions")}),_&&I.jsx(nz,{children:I.jsxs(rz,{value:w,onSelect:A,children:[I.jsx("span",{className:"text-muted-foreground text-xs mr-2",children:d("stateTrigger.useValue")}),I.jsx("span",{className:"font-mono",children:w}),I.jsx(oN,{className:nr("ml-auto h-4 w-4",n===w?"opacity-100":"opacity-0")})]})}),S.length>0&&I.jsx(nz,{children:S.map(C=>I.jsxs(rz,{value:C,onSelect:A,children:[I.jsx("span",{className:"font-mono",children:C}),I.jsx(oN,{className:nr("ml-auto h-4 w-4",n===C?"opacity-100":"opacity-0")})]},C))})]})]})})]})}function Zir({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes","common"]),{getFieldError:d}=gb(n.id),{entities:g}=Wg(),b=s.length>0?s:g,w=n.data.entity_id,E=Array.isArray(w)?w:typeof w=="string"&&w?[w]:[],S=jh(n,"to"),_=jh(n,"from"),A=H.useMemo(()=>{if(E.length===0)return jJt;const O=new Set;for(const L of E)for(const D of Xir(L,b))O.add(D);return Array.from(O)},[E,b]),C=ice("state").find(O=>O.name==="for");return I.jsxs(I.Fragment,{children:[I.jsxs(No,{label:c("nodes:triggers.fields.entityId"),required:!0,children:[I.jsx(Qae,{value:E,onChange:O=>i("entity_id",O),entities:b,placeholder:c("common:placeholders.selectEntity")}),I.jsx(H2,{message:d("entity_id")})]}),I.jsx(No,{label:c("nodes:triggers.fields.toState"),children:I.jsx(f$t,{value:S,onChange:O=>i("to",O||void 0),suggestions:A,placeholder:c("nodes:triggers.fields.toStatePlaceholder")})}),I.jsx(No,{label:c("nodes:triggers.fields.fromState"),children:I.jsx(f$t,{value:_,onChange:O=>i("from",O||void 0),suggestions:A,placeholder:c("nodes:triggers.fields.fromStatePlaceholder")})}),C&&I.jsx(KM,{field:C,value:n.data[C.name],onChange:O=>i(C.name,O),entities:b,error:d(C.name)})]})}function Qir({node:n,onChange:i,entities:s}){const{t:c}=jo(["nodes"]),{getFieldError:d}=gb(n.id),g=jh(n,"trigger","state"),b=jh(n,"device_id"),w=b&&g!=="device"?"device":g;H.useEffect(()=>{b&&g!=="device"&&i("trigger","device")},[b,g,i]);const E=S=>{const _=Gir(S);for(const[A,C]of Object.entries(_))i(A,C);S!=="device"&&b&&i("device_id",void 0)};return I.jsxs(I.Fragment,{children:[I.jsx(No,{label:c("nodes:triggers.platformLabel"),required:!0,children:I.jsxs(zp,{value:w,onValueChange:E,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"state",children:c("nodes:triggers.platforms.state")}),I.jsx(eo,{value:"numeric_state",children:c("nodes:triggers.platforms.numeric_state")}),I.jsx(eo,{value:"time",children:c("nodes:triggers.platforms.time")}),I.jsx(eo,{value:"time_pattern",children:c("nodes:triggers.platforms.time_pattern")}),I.jsx(eo,{value:"sun",children:c("nodes:triggers.platforms.sun")}),I.jsx(eo,{value:"event",children:c("nodes:triggers.platforms.event")}),I.jsx(eo,{value:"mqtt",children:c("nodes:triggers.platforms.mqtt")}),I.jsx(eo,{value:"webhook",children:c("nodes:triggers.platforms.webhook")}),I.jsx(eo,{value:"zone",children:c("nodes:triggers.platforms.zone")}),I.jsx(eo,{value:"template",children:c("nodes:triggers.platforms.template")}),I.jsx(eo,{value:"homeassistant",children:c("nodes:triggers.platforms.homeassistant")}),I.jsx(eo,{value:"device",children:c("nodes:triggers.platforms.device")})]})]})}),I.jsx(eor,{effectiveTriggerType:w,deviceId:b,node:n,onChange:i,entities:s,getFieldError:d})]})}function eor({effectiveTriggerType:n,deviceId:i,node:s,onChange:c,entities:d,getFieldError:g}){return n==="device"||i?I.jsx(Yir,{node:s,onChange:c,entities:d}):n==="state"?I.jsx(Zir,{node:s,onChange:c,entities:d}):ice(n).map(w=>I.jsx(KM,{field:w,value:s.data[w.name],onChange:E=>c(w.name,E),entities:d,error:g(w.name)},w.name))}function tor({node:n,onChange:i}){const{t:s}=jo(["nodes"]),{getFieldError:c,getRootError:d}=gb(n.id),g=po(L=>L.addWaitTimeoutBranch),b=jh(n,"wait_template"),w=QMe(n,"wait_for_trigger"),E=w!==void 0?"trigger":"template",S=d(),_=L=>{L==="template"?(i("wait_for_trigger",void 0),i("wait_template","")):(i("wait_template",void 0),i("wait_for_trigger",[{trigger:"state"}]))},A=(L,D,B)=>{if(!w)return;const $=[...w];$[L]={...$[L],[D]:B},i("wait_for_trigger",$)},C=()=>{const L=[...w||[],{trigger:"state"}];i("wait_for_trigger",L)},O=L=>{if(!w)return;const D=w.filter((B,$)=>$!==L);i("wait_for_trigger",D)};return I.jsxs(I.Fragment,{children:[I.jsx(H2,{message:S}),I.jsx(No,{label:s("nodes:wait.waitType"),description:s("nodes:wait.waitTypeDescription"),children:I.jsxs(zp,{value:E,onValueChange:_,children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"template",children:s("nodes:wait.types.template")}),I.jsx(eo,{value:"trigger",children:s("nodes:wait.types.triggers")})]})]})}),E==="template"&&I.jsxs(No,{label:s("nodes:wait.waitTemplate"),required:!0,description:s("nodes:wait.waitTemplateDescription"),children:[I.jsx(Bv,{value:b||"",onChange:L=>i("wait_template",L.target.value),className:"font-mono",rows:3,placeholder:s("nodes:placeholders.waitTemplate")}),I.jsx(H2,{message:c("wait_template")})]}),E==="trigger"&&I.jsxs("div",{className:"space-y-4",children:[I.jsx(H2,{message:c("wait_for_trigger")}),I.jsxs("div",{className:"space-y-2",children:[I.jsx("h3",{className:"font-medium",children:s("nodes:wait.triggersHeading")}),w==null?void 0:w.map((L,D)=>I.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx("p",{className:"font-semibold text-sm capitalize",children:s("nodes:wait.triggerLabel",{index:D+1,platform:L.trigger})}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>O(D),className:"h-8 w-8 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{})})]}),I.jsx(No,{label:s("nodes:wait.triggerPlatformLabel","Platform"),children:I.jsxs(zp,{value:L.trigger,onValueChange:B=>A(D,"trigger",B),children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsx(Gh,{children:Object.keys(PJt).map(B=>I.jsx(eo,{value:B,children:B},B))})]})}),ice(L.trigger).map(B=>I.jsx(KM,{field:B,value:L[B.name],onChange:$=>A(D,B.name,$)},B.name))]},D))]}),I.jsx(mi,{onClick:C,variant:"outline",size:"sm",children:s("nodes:wait.addTrigger")})]}),I.jsx(CYt,{label:s("nodes:wait.timeoutLabel"),description:s("nodes:wait.timeoutDescription"),value:n.data.timeout??"",onChange:L=>i("timeout",L||void 0)}),n.data.timeout&&I.jsxs(I.Fragment,{children:[I.jsx(No,{label:s("nodes:wait.continueOnTimeout"),description:s("nodes:wait.continueOnTimeoutDescription"),children:I.jsx(J2,{checked:n.data.continue_on_timeout??!0,onCheckedChange:L=>i("continue_on_timeout",L)})}),I.jsx(No,{label:s("nodes:wait.branchOnTimeout"),description:s("nodes:wait.branchOnTimeoutDescription"),children:I.jsxs(mi,{variant:"outline",size:"sm",onClick:()=>g(n.id),className:"gap-2",children:[I.jsx(G5e,{className:"h-4 w-4"}),s("nodes:wait.addTimeoutBranch")]})})]})]})}function nor({node:n,onChange:i,entities:s}){switch(n.type){case"trigger":return I.jsx(Qir,{node:n,onChange:i,entities:s});case"condition":return I.jsx(Uir,{node:n,onChange:i,entities:s});case"action":return I.jsx(orr,{node:n,onChange:i,entities:s});case"delay":return I.jsx(Hir,{node:n,onChange:i});case"wait":return I.jsx(tor,{node:n,onChange:i});case"set_variables":return I.jsx(zir,{node:n,onChange:i});default:return null}}const uLe={key:"",value:"",type:"string",isAdding:!1};function ror(n,i){switch(i.type){case"setKey":return{...n,key:i.payload};case"setValue":return{...n,value:i.payload};case"setType":return{...n,type:i.payload};case"startAdding":return{...n,isAdding:!0};case"cancelAdding":return{...uLe};case"reset":return{...uLe};default:return n}}function ior(n,i){switch(i){case"number":{const s=Number(n);if(Number.isNaN(s))throw new Error("Invalid number value");return s}case"boolean":return n.toLowerCase()==="true";case"array":try{const s=JSON.parse(n);if(!Array.isArray(s))throw new Error("Not an array");return s}catch{throw new Error("Invalid JSON array format")}default:return n}}function oor(n){const[i,s]=H.useReducer(ror,uLe);return{state:i,setKey:d=>s({type:"setKey",payload:d}),setValue:d=>s({type:"setValue",payload:d}),setType:d=>s({type:"setType",payload:d}),startAdding:()=>s({type:"startAdding"}),cancelAdding:()=>s({type:"cancelAdding"}),handleAdd:()=>{if(!i.key.trim())throw new Error("Property name is required");const d=ior(i.value,i.type);n(i.key,d),s({type:"reset"})}}}function sor({node:n,handledProperties:i,onChange:s,onDelete:c}){const{t:d}=jo(["common","nodes","errors"]),b=oor((_,A)=>{s(_,A)}),w=n.data,E=Object.entries(w).filter(([_,A])=>!i.has(_)&&!jDe(_)&&A!==void 0&&A!==null&&A!=="");if(E.length===0&&!b.state.isAdding)return null;const S=()=>{try{b.handleAdd()}catch(_){alert(_ instanceof Error?_.message:d("errors:properties.addFailed"))}};return I.jsxs("div",{className:"space-y-3",children:[I.jsx("div",{className:"border-t pt-3",children:I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{className:"font-medium text-muted-foreground text-xs",children:d("nodes:panel.additionalProperties")}),I.jsxs(mi,{variant:"ghost",size:"sm",onClick:b.startAdding,className:"h-6 px-2 text-xs",children:[I.jsx(sae,{className:"mr-1 h-3 w-3"}),d("buttons.add")]})]})}),b.state.isAdding&&I.jsxs("div",{className:"space-y-2 rounded border p-3",children:[I.jsx(No,{label:d("nodes:panel.propertyName"),required:!0,children:I.jsx(Na,{type:"text",value:b.state.key,onChange:_=>b.setKey(_.target.value),placeholder:d("nodes:placeholders.customProperty")})}),I.jsx(No,{label:d("nodes:panel.type"),children:I.jsxs(zp,{value:b.state.type,onValueChange:_=>b.setType(_),children:[I.jsx(zh,{children:I.jsx(Gp,{})}),I.jsxs(Gh,{children:[I.jsx(eo,{value:"string",children:d("nodes:triggers.dataTypes.string")}),I.jsx(eo,{value:"number",children:d("nodes:triggers.dataTypes.number")}),I.jsx(eo,{value:"boolean",children:d("nodes:triggers.dataTypes.boolean")}),I.jsx(eo,{value:"array",children:d("nodes:triggers.dataTypes.json")})]})]})}),I.jsx(No,{label:d("nodes:panel.value"),children:b.state.type==="boolean"?I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:b.state.value==="true",onCheckedChange:_=>b.setValue(_?"true":"false")}),I.jsx(ll,{className:"text-sm",children:b.state.value==="true"?d("boolean.true"):d("boolean.false")})]}):b.state.type==="array"?I.jsx(Bv,{value:b.state.value,onChange:_=>b.setValue(_.target.value),placeholder:d("nodes:placeholders.jsonArray"),className:"font-mono",rows:2}):I.jsx(Na,{type:b.state.type==="number"?"number":"text",value:b.state.value,onChange:_=>b.setValue(_.target.value),placeholder:b.state.type==="number"?d("nodes:placeholders.number"):d("nodes:placeholders.enterValue")})}),I.jsxs("div",{className:"flex justify-end gap-2",children:[I.jsx(mi,{variant:"ghost",size:"sm",onClick:b.cancelAdding,children:d("buttons.cancel")}),I.jsx(mi,{size:"sm",onClick:S,children:d("nodes:panel.addProperty")})]})]}),E.map(([_,A])=>I.jsx(aor,{name:_,value:A,onChange:C=>s(_,C),onDelete:()=>c(_)},_))]})}function aor({name:n,value:i,onChange:s,onDelete:c}){const{t:d}=jo(["common","nodes"]);return I.jsxs("div",{className:"space-y-2",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{className:"font-medium text-muted-foreground text-xs capitalize",children:n.replace(/_/g," ")}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:c,className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10",children:I.jsx(jM,{className:"h-3 w-3"})})]}),typeof i=="boolean"?I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx(J2,{checked:i,onCheckedChange:g=>s(g)}),I.jsx(ll,{className:"text-sm",children:d(i?"boolean.true":"boolean.false")})]}):Array.isArray(i)?I.jsx(Bv,{value:JSON.stringify(i,null,2),onChange:g=>{try{const b=JSON.parse(g.target.value);s(b)}catch{}},className:"font-mono",rows:Math.min(i.length+1,4),placeholder:d("nodes:placeholders.jsonArray")}):typeof i=="object"?I.jsx(Bv,{value:JSON.stringify(i,null,2),onChange:g=>{try{const b=JSON.parse(g.target.value);s(b)}catch{}},className:"font-mono",rows:4,placeholder:d("nodes:placeholders.jsonObject")}):I.jsx(Na,{type:"text",value:String(i),onChange:g=>{const b=g.target.value;if(typeof i=="number"){const w=Number(b);Number.isNaN(w)||s(w)}else s(b)},placeholder:d("nodes:placeholders.enterType",{type:typeof i})})]})}function cor(){const{t:n}=jo(["common","nodes"]),i=po(O=>O.selectedNodeId),s=po(O=>O.nodes),c=po(O=>O.updateNodeData),d=po(O=>O.removeNode),{hass:g,entities:b}=Wg(),w=H.useMemo(()=>g!=null&&g.states&&Object.keys(g.states).length>0?Object.values(g.states).map(O=>({entity_id:O.entity_id,state:O.state,attributes:O.attributes||{},last_changed:O.last_changed||"",last_updated:O.last_updated||"",context:O.context})):b,[g,b]),E=H.useMemo(()=>s.find(O=>O.id===i),[s,i]),S=H.useMemo(()=>{if(!E)return c$t("trigger",[]);const O=c$t(E.type||"trigger",[]),L=E.data,D=typeof L.trigger=="string"?L.trigger:"",B=typeof L.device_id=="string"?L.device_id:"";if((D==="device"||B)&&(E.type==="trigger"||E.type==="condition")){const P=Object.keys(L);return new Set([...O,...P])}return O},[E]),{getFieldError:_}=gb((E==null?void 0:E.id)??"");if(!E)return I.jsx(qnr,{});const A=(O,L)=>{c(E.id,{[O]:L})},C=O=>{c(E.id,{[O]:void 0})};return I.jsxs("div",{className:"h-full flex-1 space-y-4 overflow-y-auto p-4",children:[I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsxs("h3",{className:"font-semibold text-foreground text-sm",children:[E.type?n(`nodes:types.${E.type}`):n("nodes:types.node")," ",n("nodes:panel.properties")]}),I.jsx(mi,{variant:"ghost",size:"sm",onClick:()=>d(E.id),className:"h-8 w-8 p-0 text-destructive hover:bg-destructive/10 hover:text-destructive",children:I.jsx(jM,{className:"h-4 w-4"})})]}),I.jsx(No,{label:n("labels.alias"),children:I.jsx(Na,{type:"text",value:typeof E.data.alias=="string"?E.data.alias:"",onChange:O=>A("alias",O.target.value),placeholder:n("placeholders.optionalDisplayName")})}),E.type==="trigger"&&I.jsxs(No,{label:n("labels.id"),children:[I.jsx(Na,{type:"text",value:typeof E.data.id=="string"?E.data.id:"",onChange:O=>A("id",O.target.value||void 0),placeholder:n("placeholders.optionalUniqueId"),className:"font-mono"}),I.jsx(H2,{message:_("id")})]}),I.jsxs("div",{className:"flex items-center justify-between",children:[I.jsx(ll,{htmlFor:"node-enabled",className:"text-sm",children:n("labels.enabled")}),I.jsx(J2,{id:"node-enabled",checked:E.data.enabled!==!1,onCheckedChange:O=>A("enabled",O?void 0:!1)})]}),I.jsx($z,{}),I.jsx(nor,{node:E,onChange:A,entities:w}),I.jsx(sor,{node:E,handledProperties:S,onChange:A,onDelete:C}),I.jsx("div",{className:"pt-2 text-muted-foreground text-xs",children:n("nodes:panel.nodeId",{id:E.id})})]})}function uor(n){const i=document.createElement("textarea");i.value=n,document.body.appendChild(i),i.focus(),i.select();try{document.execCommand("copy")}catch(s){console.error("Unable to copy to clipboard",s)}document.body.removeChild(i)}async function lor(n){return navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(n):uor(n)}function Hk(){return Hk=Object.assign?Object.assign.bind():function(n){for(var i=1;i4&&s.slice(0,4)==="data"&&bor.test(i)){if(i.charAt(4)==="-"){const g=i.slice(5).replace(p$t,wor);c="data"+g.charAt(0).toUpperCase()+g.slice(1)}else{const g=i.slice(4);if(!p$t.test(g)){let b=g.replace(gor,mor);b.charAt(0)!=="-"&&(b="-"+b),i="data"+b}}d=l9e}return new d(c,i)}function mor(n){return"-"+n.toLowerCase()}function wor(n){return n.charAt(1).toUpperCase()}const oce=$Jt([BJt,hor,zJt,GJt,qJt],"html"),qz=$Jt([BJt,por,zJt,GJt,qJt],"svg");function _se(n){const i=[],s=String(n||"");let c=s.indexOf(","),d=0,g=!1;for(;!g;){c===-1&&(c=s.length,g=!0);const b=s.slice(d,c).trim();(b||!g)&&i.push(b),d=c+1,c=s.indexOf(",",d)}return i}function yor(n,i){const s=i||{};return(n[n.length-1]===""?[...n,""]:n).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const g$t=/[#.]/g;function vor(n,i){const s=n||"",c={};let d=0,g,b;for(;d-1&&g<=i.length){let b=0;for(;;){let w=s[b];if(w===void 0){const E=m$t(i,s[b-1]);w=E===-1?i.length+1:E+1,s[b]=w}if(w>g)return{line:b+1,column:g-(b>0?s[b-1]:0)+1,offset:g};b++}}}function d(g){if(g&&typeof g.line=="number"&&typeof g.column=="number"&&!Number.isNaN(g.line)&&!Number.isNaN(g.column)){for(;s.length1?s[g.line-2]:0)+g.column-1;if(b=55296&&n<=57343}function Por(n){return n>=56320&&n<=57343}function jor(n,i){return(n-55296)*1024+9216+i}function JJt(n){return n!==32&&n!==10&&n!==13&&n!==9&&n!==12&&n>=1&&n<=31||n>=127&&n<=159}function XJt(n){return n>=64976&&n<=65007||Mor.has(n)}var sn;(function(n){n.controlCharacterInInputStream="control-character-in-input-stream",n.noncharacterInInputStream="noncharacter-in-input-stream",n.surrogateInInputStream="surrogate-in-input-stream",n.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",n.endTagWithAttributes="end-tag-with-attributes",n.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",n.unexpectedSolidusInTag="unexpected-solidus-in-tag",n.unexpectedNullCharacter="unexpected-null-character",n.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",n.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",n.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",n.missingEndTagName="missing-end-tag-name",n.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",n.unknownNamedCharacterReference="unknown-named-character-reference",n.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",n.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",n.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",n.eofBeforeTagName="eof-before-tag-name",n.eofInTag="eof-in-tag",n.missingAttributeValue="missing-attribute-value",n.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",n.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",n.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",n.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",n.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",n.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",n.missingDoctypePublicIdentifier="missing-doctype-public-identifier",n.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",n.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",n.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",n.cdataInHtmlContent="cdata-in-html-content",n.incorrectlyOpenedComment="incorrectly-opened-comment",n.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",n.eofInDoctype="eof-in-doctype",n.nestedComment="nested-comment",n.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",n.eofInComment="eof-in-comment",n.incorrectlyClosedComment="incorrectly-closed-comment",n.eofInCdata="eof-in-cdata",n.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",n.nullCharacterReference="null-character-reference",n.surrogateCharacterReference="surrogate-character-reference",n.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",n.controlCharacterReference="control-character-reference",n.noncharacterCharacterReference="noncharacter-character-reference",n.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",n.missingDoctypeName="missing-doctype-name",n.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",n.duplicateAttribute="duplicate-attribute",n.nonConformingDoctype="non-conforming-doctype",n.missingDoctype="missing-doctype",n.misplacedDoctype="misplaced-doctype",n.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",n.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",n.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",n.openElementsLeftAfterEof="open-elements-left-after-eof",n.abandonedHeadElementChild="abandoned-head-element-child",n.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",n.nestedNoscriptInHead="nested-noscript-in-head",n.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(sn||(sn={}));const For=65536;class $or{constructor(i){this.handler=i,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=For,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(i,s){const{line:c,col:d,offset:g}=this,b=d+s,w=g+s;return{code:i,startLine:c,endLine:c,startCol:b,endCol:b,startOffset:w,endOffset:w}}_err(i){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(i,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(i){if(this.pos!==this.html.length-1){const s=this.html.charCodeAt(this.pos+1);if(Por(s))return this.pos++,this._addGap(),jor(i,s)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,$e.EOF;return this._err(sn.surrogateInInputStream),i}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(i,s){this.html.length>0?this.html+=i:this.html=i,this.endOfChunkHit=!1,this.lastChunkWritten=s}insertHtmlAtCurrentPos(i){this.html=this.html.substring(0,this.pos+1)+i+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(i,s){if(this.pos+i.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(s)return this.html.startsWith(i,this.pos);for(let c=0;c=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,$e.EOF;const c=this.html.charCodeAt(s);return c===$e.CARRIAGE_RETURN?$e.LINE_FEED:c}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,$e.EOF;let i=this.html.charCodeAt(this.pos);return i===$e.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,$e.LINE_FEED):i===$e.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,YJt(i)&&(i=this._processSurrogate(i)),this.handler.onParseError===null||i>31&&i<127||i===$e.LINE_FEED||i===$e.CARRIAGE_RETURN||i>159&&i<64976||this._checkForProblematicCharacters(i),i)}_checkForProblematicCharacters(i){JJt(i)?this._err(sn.controlCharacterInInputStream):XJt(i)&&this._err(sn.noncharacterInInputStream)}retreat(i){for(this.pos-=i;this.pos=0;s--)if(n.attrs[s].name===i)return n.attrs[s].value;return null}const Bor=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(n=>n.charCodeAt(0))),Uor=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Hor(n){var i;return n>=55296&&n<=57343||n>1114111?65533:(i=Uor.get(n))!==null&&i!==void 0?i:n}var nh;(function(n){n[n.NUM=35]="NUM",n[n.SEMI=59]="SEMI",n[n.EQUALS=61]="EQUALS",n[n.ZERO=48]="ZERO",n[n.NINE=57]="NINE",n[n.LOWER_A=97]="LOWER_A",n[n.LOWER_F=102]="LOWER_F",n[n.LOWER_X=120]="LOWER_X",n[n.LOWER_Z=122]="LOWER_Z",n[n.UPPER_A=65]="UPPER_A",n[n.UPPER_F=70]="UPPER_F",n[n.UPPER_Z=90]="UPPER_Z"})(nh||(nh={}));const zor=32;var qk;(function(n){n[n.VALUE_LENGTH=49152]="VALUE_LENGTH",n[n.BRANCH_LENGTH=16256]="BRANCH_LENGTH",n[n.JUMP_TABLE=127]="JUMP_TABLE"})(qk||(qk={}));function hLe(n){return n>=nh.ZERO&&n<=nh.NINE}function Gor(n){return n>=nh.UPPER_A&&n<=nh.UPPER_F||n>=nh.LOWER_A&&n<=nh.LOWER_F}function qor(n){return n>=nh.UPPER_A&&n<=nh.UPPER_Z||n>=nh.LOWER_A&&n<=nh.LOWER_Z||hLe(n)}function Vor(n){return n===nh.EQUALS||qor(n)}var Qf;(function(n){n[n.EntityStart=0]="EntityStart",n[n.NumericStart=1]="NumericStart",n[n.NumericDecimal=2]="NumericDecimal",n[n.NumericHex=3]="NumericHex",n[n.NamedEntity=4]="NamedEntity"})(Qf||(Qf={}));var aA;(function(n){n[n.Legacy=0]="Legacy",n[n.Strict=1]="Strict",n[n.Attribute=2]="Attribute"})(aA||(aA={}));class Wor{constructor(i,s,c){this.decodeTree=i,this.emitCodePoint=s,this.errors=c,this.state=Qf.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=aA.Strict}startEntity(i){this.decodeMode=i,this.state=Qf.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(i,s){switch(this.state){case Qf.EntityStart:return i.charCodeAt(s)===nh.NUM?(this.state=Qf.NumericStart,this.consumed+=1,this.stateNumericStart(i,s+1)):(this.state=Qf.NamedEntity,this.stateNamedEntity(i,s));case Qf.NumericStart:return this.stateNumericStart(i,s);case Qf.NumericDecimal:return this.stateNumericDecimal(i,s);case Qf.NumericHex:return this.stateNumericHex(i,s);case Qf.NamedEntity:return this.stateNamedEntity(i,s)}}stateNumericStart(i,s){return s>=i.length?-1:(i.charCodeAt(s)|zor)===nh.LOWER_X?(this.state=Qf.NumericHex,this.consumed+=1,this.stateNumericHex(i,s+1)):(this.state=Qf.NumericDecimal,this.stateNumericDecimal(i,s))}addToNumericResult(i,s,c,d){if(s!==c){const g=c-s;this.result=this.result*Math.pow(d,g)+Number.parseInt(i.substr(s,g),d),this.consumed+=g}}stateNumericHex(i,s){const c=s;for(;s>14;for(;s>14,g!==0){if(b===nh.SEMI)return this.emitNamedEntityData(this.treeIndex,g,this.consumed+this.excess);this.decodeMode!==aA.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var i;const{result:s,decodeTree:c}=this,d=(c[s]&qk.VALUE_LENGTH)>>14;return this.emitNamedEntityData(s,d,this.consumed),(i=this.errors)===null||i===void 0||i.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(i,s,c){const{decodeTree:d}=this;return this.emitCodePoint(s===1?d[i]&~qk.VALUE_LENGTH:d[i+1],c),s===3&&this.emitCodePoint(d[i+2],c),c}end(){var i;switch(this.state){case Qf.NamedEntity:return this.result!==0&&(this.decodeMode!==aA.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Qf.NumericDecimal:return this.emitNumericEntity(0,2);case Qf.NumericHex:return this.emitNumericEntity(0,3);case Qf.NumericStart:return(i=this.errors)===null||i===void 0||i.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Qf.EntityStart:return 0}}}function Kor(n,i,s,c){const d=(i&qk.BRANCH_LENGTH)>>7,g=i&qk.JUMP_TABLE;if(d===0)return g!==0&&c===g?s:-1;if(g){const E=c-g;return E<0||E>=d?-1:n[s+E]-1}let b=s,w=b+d-1;for(;b<=w;){const E=b+w>>>1,S=n[E];if(Sc)w=E-1;else return n[E+d]}return-1}var Fn;(function(n){n.HTML="http://www.w3.org/1999/xhtml",n.MATHML="http://www.w3.org/1998/Math/MathML",n.SVG="http://www.w3.org/2000/svg",n.XLINK="http://www.w3.org/1999/xlink",n.XML="http://www.w3.org/XML/1998/namespace",n.XMLNS="http://www.w3.org/2000/xmlns/"})(Fn||(Fn={}));var iR;(function(n){n.TYPE="type",n.ACTION="action",n.ENCODING="encoding",n.PROMPT="prompt",n.NAME="name",n.COLOR="color",n.FACE="face",n.SIZE="size"})(iR||(iR={}));var yw;(function(n){n.NO_QUIRKS="no-quirks",n.QUIRKS="quirks",n.LIMITED_QUIRKS="limited-quirks"})(yw||(yw={}));var Pt;(function(n){n.A="a",n.ADDRESS="address",n.ANNOTATION_XML="annotation-xml",n.APPLET="applet",n.AREA="area",n.ARTICLE="article",n.ASIDE="aside",n.B="b",n.BASE="base",n.BASEFONT="basefont",n.BGSOUND="bgsound",n.BIG="big",n.BLOCKQUOTE="blockquote",n.BODY="body",n.BR="br",n.BUTTON="button",n.CAPTION="caption",n.CENTER="center",n.CODE="code",n.COL="col",n.COLGROUP="colgroup",n.DD="dd",n.DESC="desc",n.DETAILS="details",n.DIALOG="dialog",n.DIR="dir",n.DIV="div",n.DL="dl",n.DT="dt",n.EM="em",n.EMBED="embed",n.FIELDSET="fieldset",n.FIGCAPTION="figcaption",n.FIGURE="figure",n.FONT="font",n.FOOTER="footer",n.FOREIGN_OBJECT="foreignObject",n.FORM="form",n.FRAME="frame",n.FRAMESET="frameset",n.H1="h1",n.H2="h2",n.H3="h3",n.H4="h4",n.H5="h5",n.H6="h6",n.HEAD="head",n.HEADER="header",n.HGROUP="hgroup",n.HR="hr",n.HTML="html",n.I="i",n.IMG="img",n.IMAGE="image",n.INPUT="input",n.IFRAME="iframe",n.KEYGEN="keygen",n.LABEL="label",n.LI="li",n.LINK="link",n.LISTING="listing",n.MAIN="main",n.MALIGNMARK="malignmark",n.MARQUEE="marquee",n.MATH="math",n.MENU="menu",n.META="meta",n.MGLYPH="mglyph",n.MI="mi",n.MO="mo",n.MN="mn",n.MS="ms",n.MTEXT="mtext",n.NAV="nav",n.NOBR="nobr",n.NOFRAMES="noframes",n.NOEMBED="noembed",n.NOSCRIPT="noscript",n.OBJECT="object",n.OL="ol",n.OPTGROUP="optgroup",n.OPTION="option",n.P="p",n.PARAM="param",n.PLAINTEXT="plaintext",n.PRE="pre",n.RB="rb",n.RP="rp",n.RT="rt",n.RTC="rtc",n.RUBY="ruby",n.S="s",n.SCRIPT="script",n.SEARCH="search",n.SECTION="section",n.SELECT="select",n.SOURCE="source",n.SMALL="small",n.SPAN="span",n.STRIKE="strike",n.STRONG="strong",n.STYLE="style",n.SUB="sub",n.SUMMARY="summary",n.SUP="sup",n.TABLE="table",n.TBODY="tbody",n.TEMPLATE="template",n.TEXTAREA="textarea",n.TFOOT="tfoot",n.TD="td",n.TH="th",n.THEAD="thead",n.TITLE="title",n.TR="tr",n.TRACK="track",n.TT="tt",n.U="u",n.UL="ul",n.SVG="svg",n.VAR="var",n.WBR="wbr",n.XMP="xmp"})(Pt||(Pt={}));var W;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.A=1]="A",n[n.ADDRESS=2]="ADDRESS",n[n.ANNOTATION_XML=3]="ANNOTATION_XML",n[n.APPLET=4]="APPLET",n[n.AREA=5]="AREA",n[n.ARTICLE=6]="ARTICLE",n[n.ASIDE=7]="ASIDE",n[n.B=8]="B",n[n.BASE=9]="BASE",n[n.BASEFONT=10]="BASEFONT",n[n.BGSOUND=11]="BGSOUND",n[n.BIG=12]="BIG",n[n.BLOCKQUOTE=13]="BLOCKQUOTE",n[n.BODY=14]="BODY",n[n.BR=15]="BR",n[n.BUTTON=16]="BUTTON",n[n.CAPTION=17]="CAPTION",n[n.CENTER=18]="CENTER",n[n.CODE=19]="CODE",n[n.COL=20]="COL",n[n.COLGROUP=21]="COLGROUP",n[n.DD=22]="DD",n[n.DESC=23]="DESC",n[n.DETAILS=24]="DETAILS",n[n.DIALOG=25]="DIALOG",n[n.DIR=26]="DIR",n[n.DIV=27]="DIV",n[n.DL=28]="DL",n[n.DT=29]="DT",n[n.EM=30]="EM",n[n.EMBED=31]="EMBED",n[n.FIELDSET=32]="FIELDSET",n[n.FIGCAPTION=33]="FIGCAPTION",n[n.FIGURE=34]="FIGURE",n[n.FONT=35]="FONT",n[n.FOOTER=36]="FOOTER",n[n.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",n[n.FORM=38]="FORM",n[n.FRAME=39]="FRAME",n[n.FRAMESET=40]="FRAMESET",n[n.H1=41]="H1",n[n.H2=42]="H2",n[n.H3=43]="H3",n[n.H4=44]="H4",n[n.H5=45]="H5",n[n.H6=46]="H6",n[n.HEAD=47]="HEAD",n[n.HEADER=48]="HEADER",n[n.HGROUP=49]="HGROUP",n[n.HR=50]="HR",n[n.HTML=51]="HTML",n[n.I=52]="I",n[n.IMG=53]="IMG",n[n.IMAGE=54]="IMAGE",n[n.INPUT=55]="INPUT",n[n.IFRAME=56]="IFRAME",n[n.KEYGEN=57]="KEYGEN",n[n.LABEL=58]="LABEL",n[n.LI=59]="LI",n[n.LINK=60]="LINK",n[n.LISTING=61]="LISTING",n[n.MAIN=62]="MAIN",n[n.MALIGNMARK=63]="MALIGNMARK",n[n.MARQUEE=64]="MARQUEE",n[n.MATH=65]="MATH",n[n.MENU=66]="MENU",n[n.META=67]="META",n[n.MGLYPH=68]="MGLYPH",n[n.MI=69]="MI",n[n.MO=70]="MO",n[n.MN=71]="MN",n[n.MS=72]="MS",n[n.MTEXT=73]="MTEXT",n[n.NAV=74]="NAV",n[n.NOBR=75]="NOBR",n[n.NOFRAMES=76]="NOFRAMES",n[n.NOEMBED=77]="NOEMBED",n[n.NOSCRIPT=78]="NOSCRIPT",n[n.OBJECT=79]="OBJECT",n[n.OL=80]="OL",n[n.OPTGROUP=81]="OPTGROUP",n[n.OPTION=82]="OPTION",n[n.P=83]="P",n[n.PARAM=84]="PARAM",n[n.PLAINTEXT=85]="PLAINTEXT",n[n.PRE=86]="PRE",n[n.RB=87]="RB",n[n.RP=88]="RP",n[n.RT=89]="RT",n[n.RTC=90]="RTC",n[n.RUBY=91]="RUBY",n[n.S=92]="S",n[n.SCRIPT=93]="SCRIPT",n[n.SEARCH=94]="SEARCH",n[n.SECTION=95]="SECTION",n[n.SELECT=96]="SELECT",n[n.SOURCE=97]="SOURCE",n[n.SMALL=98]="SMALL",n[n.SPAN=99]="SPAN",n[n.STRIKE=100]="STRIKE",n[n.STRONG=101]="STRONG",n[n.STYLE=102]="STYLE",n[n.SUB=103]="SUB",n[n.SUMMARY=104]="SUMMARY",n[n.SUP=105]="SUP",n[n.TABLE=106]="TABLE",n[n.TBODY=107]="TBODY",n[n.TEMPLATE=108]="TEMPLATE",n[n.TEXTAREA=109]="TEXTAREA",n[n.TFOOT=110]="TFOOT",n[n.TD=111]="TD",n[n.TH=112]="TH",n[n.THEAD=113]="THEAD",n[n.TITLE=114]="TITLE",n[n.TR=115]="TR",n[n.TRACK=116]="TRACK",n[n.TT=117]="TT",n[n.U=118]="U",n[n.UL=119]="UL",n[n.SVG=120]="SVG",n[n.VAR=121]="VAR",n[n.WBR=122]="WBR",n[n.XMP=123]="XMP"})(W||(W={}));const Yor=new Map([[Pt.A,W.A],[Pt.ADDRESS,W.ADDRESS],[Pt.ANNOTATION_XML,W.ANNOTATION_XML],[Pt.APPLET,W.APPLET],[Pt.AREA,W.AREA],[Pt.ARTICLE,W.ARTICLE],[Pt.ASIDE,W.ASIDE],[Pt.B,W.B],[Pt.BASE,W.BASE],[Pt.BASEFONT,W.BASEFONT],[Pt.BGSOUND,W.BGSOUND],[Pt.BIG,W.BIG],[Pt.BLOCKQUOTE,W.BLOCKQUOTE],[Pt.BODY,W.BODY],[Pt.BR,W.BR],[Pt.BUTTON,W.BUTTON],[Pt.CAPTION,W.CAPTION],[Pt.CENTER,W.CENTER],[Pt.CODE,W.CODE],[Pt.COL,W.COL],[Pt.COLGROUP,W.COLGROUP],[Pt.DD,W.DD],[Pt.DESC,W.DESC],[Pt.DETAILS,W.DETAILS],[Pt.DIALOG,W.DIALOG],[Pt.DIR,W.DIR],[Pt.DIV,W.DIV],[Pt.DL,W.DL],[Pt.DT,W.DT],[Pt.EM,W.EM],[Pt.EMBED,W.EMBED],[Pt.FIELDSET,W.FIELDSET],[Pt.FIGCAPTION,W.FIGCAPTION],[Pt.FIGURE,W.FIGURE],[Pt.FONT,W.FONT],[Pt.FOOTER,W.FOOTER],[Pt.FOREIGN_OBJECT,W.FOREIGN_OBJECT],[Pt.FORM,W.FORM],[Pt.FRAME,W.FRAME],[Pt.FRAMESET,W.FRAMESET],[Pt.H1,W.H1],[Pt.H2,W.H2],[Pt.H3,W.H3],[Pt.H4,W.H4],[Pt.H5,W.H5],[Pt.H6,W.H6],[Pt.HEAD,W.HEAD],[Pt.HEADER,W.HEADER],[Pt.HGROUP,W.HGROUP],[Pt.HR,W.HR],[Pt.HTML,W.HTML],[Pt.I,W.I],[Pt.IMG,W.IMG],[Pt.IMAGE,W.IMAGE],[Pt.INPUT,W.INPUT],[Pt.IFRAME,W.IFRAME],[Pt.KEYGEN,W.KEYGEN],[Pt.LABEL,W.LABEL],[Pt.LI,W.LI],[Pt.LINK,W.LINK],[Pt.LISTING,W.LISTING],[Pt.MAIN,W.MAIN],[Pt.MALIGNMARK,W.MALIGNMARK],[Pt.MARQUEE,W.MARQUEE],[Pt.MATH,W.MATH],[Pt.MENU,W.MENU],[Pt.META,W.META],[Pt.MGLYPH,W.MGLYPH],[Pt.MI,W.MI],[Pt.MO,W.MO],[Pt.MN,W.MN],[Pt.MS,W.MS],[Pt.MTEXT,W.MTEXT],[Pt.NAV,W.NAV],[Pt.NOBR,W.NOBR],[Pt.NOFRAMES,W.NOFRAMES],[Pt.NOEMBED,W.NOEMBED],[Pt.NOSCRIPT,W.NOSCRIPT],[Pt.OBJECT,W.OBJECT],[Pt.OL,W.OL],[Pt.OPTGROUP,W.OPTGROUP],[Pt.OPTION,W.OPTION],[Pt.P,W.P],[Pt.PARAM,W.PARAM],[Pt.PLAINTEXT,W.PLAINTEXT],[Pt.PRE,W.PRE],[Pt.RB,W.RB],[Pt.RP,W.RP],[Pt.RT,W.RT],[Pt.RTC,W.RTC],[Pt.RUBY,W.RUBY],[Pt.S,W.S],[Pt.SCRIPT,W.SCRIPT],[Pt.SEARCH,W.SEARCH],[Pt.SECTION,W.SECTION],[Pt.SELECT,W.SELECT],[Pt.SOURCE,W.SOURCE],[Pt.SMALL,W.SMALL],[Pt.SPAN,W.SPAN],[Pt.STRIKE,W.STRIKE],[Pt.STRONG,W.STRONG],[Pt.STYLE,W.STYLE],[Pt.SUB,W.SUB],[Pt.SUMMARY,W.SUMMARY],[Pt.SUP,W.SUP],[Pt.TABLE,W.TABLE],[Pt.TBODY,W.TBODY],[Pt.TEMPLATE,W.TEMPLATE],[Pt.TEXTAREA,W.TEXTAREA],[Pt.TFOOT,W.TFOOT],[Pt.TD,W.TD],[Pt.TH,W.TH],[Pt.THEAD,W.THEAD],[Pt.TITLE,W.TITLE],[Pt.TR,W.TR],[Pt.TRACK,W.TRACK],[Pt.TT,W.TT],[Pt.U,W.U],[Pt.UL,W.UL],[Pt.SVG,W.SVG],[Pt.VAR,W.VAR],[Pt.WBR,W.WBR],[Pt.XMP,W.XMP]]);function sce(n){var i;return(i=Yor.get(n))!==null&&i!==void 0?i:W.UNKNOWN}const Xn=W,Jor={[Fn.HTML]:new Set([Xn.ADDRESS,Xn.APPLET,Xn.AREA,Xn.ARTICLE,Xn.ASIDE,Xn.BASE,Xn.BASEFONT,Xn.BGSOUND,Xn.BLOCKQUOTE,Xn.BODY,Xn.BR,Xn.BUTTON,Xn.CAPTION,Xn.CENTER,Xn.COL,Xn.COLGROUP,Xn.DD,Xn.DETAILS,Xn.DIR,Xn.DIV,Xn.DL,Xn.DT,Xn.EMBED,Xn.FIELDSET,Xn.FIGCAPTION,Xn.FIGURE,Xn.FOOTER,Xn.FORM,Xn.FRAME,Xn.FRAMESET,Xn.H1,Xn.H2,Xn.H3,Xn.H4,Xn.H5,Xn.H6,Xn.HEAD,Xn.HEADER,Xn.HGROUP,Xn.HR,Xn.HTML,Xn.IFRAME,Xn.IMG,Xn.INPUT,Xn.LI,Xn.LINK,Xn.LISTING,Xn.MAIN,Xn.MARQUEE,Xn.MENU,Xn.META,Xn.NAV,Xn.NOEMBED,Xn.NOFRAMES,Xn.NOSCRIPT,Xn.OBJECT,Xn.OL,Xn.P,Xn.PARAM,Xn.PLAINTEXT,Xn.PRE,Xn.SCRIPT,Xn.SECTION,Xn.SELECT,Xn.SOURCE,Xn.STYLE,Xn.SUMMARY,Xn.TABLE,Xn.TBODY,Xn.TD,Xn.TEMPLATE,Xn.TEXTAREA,Xn.TFOOT,Xn.TH,Xn.THEAD,Xn.TITLE,Xn.TR,Xn.TRACK,Xn.UL,Xn.WBR,Xn.XMP]),[Fn.MATHML]:new Set([Xn.MI,Xn.MO,Xn.MN,Xn.MS,Xn.MTEXT,Xn.ANNOTATION_XML]),[Fn.SVG]:new Set([Xn.TITLE,Xn.FOREIGN_OBJECT,Xn.DESC]),[Fn.XLINK]:new Set,[Fn.XML]:new Set,[Fn.XMLNS]:new Set},pLe=new Set([Xn.H1,Xn.H2,Xn.H3,Xn.H4,Xn.H5,Xn.H6]);Pt.STYLE,Pt.SCRIPT,Pt.XMP,Pt.IFRAME,Pt.NOEMBED,Pt.NOFRAMES,Pt.PLAINTEXT;var Ve;(function(n){n[n.DATA=0]="DATA",n[n.RCDATA=1]="RCDATA",n[n.RAWTEXT=2]="RAWTEXT",n[n.SCRIPT_DATA=3]="SCRIPT_DATA",n[n.PLAINTEXT=4]="PLAINTEXT",n[n.TAG_OPEN=5]="TAG_OPEN",n[n.END_TAG_OPEN=6]="END_TAG_OPEN",n[n.TAG_NAME=7]="TAG_NAME",n[n.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",n[n.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",n[n.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",n[n.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",n[n.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",n[n.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",n[n.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",n[n.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",n[n.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",n[n.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",n[n.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",n[n.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",n[n.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",n[n.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",n[n.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",n[n.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",n[n.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",n[n.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",n[n.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",n[n.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",n[n.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",n[n.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",n[n.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",n[n.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",n[n.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",n[n.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",n[n.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",n[n.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",n[n.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",n[n.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",n[n.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",n[n.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",n[n.BOGUS_COMMENT=40]="BOGUS_COMMENT",n[n.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",n[n.COMMENT_START=42]="COMMENT_START",n[n.COMMENT_START_DASH=43]="COMMENT_START_DASH",n[n.COMMENT=44]="COMMENT",n[n.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",n[n.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",n[n.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",n[n.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",n[n.COMMENT_END_DASH=49]="COMMENT_END_DASH",n[n.COMMENT_END=50]="COMMENT_END",n[n.COMMENT_END_BANG=51]="COMMENT_END_BANG",n[n.DOCTYPE=52]="DOCTYPE",n[n.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",n[n.DOCTYPE_NAME=54]="DOCTYPE_NAME",n[n.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",n[n.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",n[n.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",n[n.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",n[n.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",n[n.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",n[n.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",n[n.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",n[n.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",n[n.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",n[n.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",n[n.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",n[n.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",n[n.CDATA_SECTION=68]="CDATA_SECTION",n[n.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",n[n.CDATA_SECTION_END=70]="CDATA_SECTION_END",n[n.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",n[n.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(Ve||(Ve={}));const sb={DATA:Ve.DATA,RCDATA:Ve.RCDATA,RAWTEXT:Ve.RAWTEXT,SCRIPT_DATA:Ve.SCRIPT_DATA,PLAINTEXT:Ve.PLAINTEXT,CDATA_SECTION:Ve.CDATA_SECTION};function Xor(n){return n>=$e.DIGIT_0&&n<=$e.DIGIT_9}function aH(n){return n>=$e.LATIN_CAPITAL_A&&n<=$e.LATIN_CAPITAL_Z}function Zor(n){return n>=$e.LATIN_SMALL_A&&n<=$e.LATIN_SMALL_Z}function Lk(n){return Zor(n)||aH(n)}function y$t(n){return Lk(n)||Xor(n)}function Pie(n){return n+32}function QJt(n){return n===$e.SPACE||n===$e.LINE_FEED||n===$e.TABULATION||n===$e.FORM_FEED}function v$t(n){return QJt(n)||n===$e.SOLIDUS||n===$e.GREATER_THAN_SIGN}function Qor(n){return n===$e.NULL?sn.nullCharacterReference:n>1114111?sn.characterReferenceOutsideUnicodeRange:YJt(n)?sn.surrogateCharacterReference:XJt(n)?sn.noncharacterCharacterReference:JJt(n)||n===$e.CARRIAGE_RETURN?sn.controlCharacterReference:null}class esr{constructor(i,s){this.options=i,this.handler=s,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Ve.DATA,this.returnState=Ve.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new $or(s),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Wor(Bor,(c,d)=>{this.preprocessor.pos=this.entityStartPos+d-1,this._flushCodePointConsumedAsCharacterReference(c)},s.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(sn.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:c=>{this._err(sn.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+c)},validateNumericCharacterReference:c=>{const d=Qor(c);d&&this._err(d,1)}}:void 0)}_err(i,s=0){var c,d;(d=(c=this.handler).onParseError)===null||d===void 0||d.call(c,this.preprocessor.getError(i,s))}getCurrentLocation(i){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-i,startOffset:this.preprocessor.offset-i,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const i=this._consume();this._ensureHibernation()||this._callState(i)}this.inLoop=!1}}pause(){this.paused=!0}resume(i){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||i==null||i())}write(i,s,c){this.active=!0,this.preprocessor.write(i,s),this._runParsingLoop(),this.paused||c==null||c()}insertHtmlAtCurrentPos(i){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(i),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(i){this.consumedAfterSnapshot+=i;for(let s=0;s0&&this._err(sn.endTagWithAttributes),i.selfClosing&&this._err(sn.endTagWithTrailingSolidus),this.handler.onEndTag(i)),this.preprocessor.dropParsedChunk()}emitCurrentComment(i){this.prepareToken(i),this.handler.onComment(i),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(i){this.prepareToken(i),this.handler.onDoctype(i),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(i){if(this.currentCharacterToken){switch(i&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=i.startLine,this.currentCharacterToken.location.endCol=i.startCol,this.currentCharacterToken.location.endOffset=i.startOffset),this.currentCharacterToken.type){case ha.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case ha.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case ha.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const i=this.getCurrentLocation(0);i&&(i.endLine=i.startLine,i.endCol=i.startCol,i.endOffset=i.startOffset),this._emitCurrentCharacterToken(i),this.handler.onEof({type:ha.EOF,location:i}),this.active=!1}_appendCharToCurrentCharacterToken(i,s){if(this.currentCharacterToken)if(this.currentCharacterToken.type===i){this.currentCharacterToken.chars+=s;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(i,s)}_emitCodePoint(i){const s=QJt(i)?ha.WHITESPACE_CHARACTER:i===$e.NULL?ha.NULL_CHARACTER:ha.CHARACTER;this._appendCharToCurrentCharacterToken(s,String.fromCodePoint(i))}_emitChars(i){this._appendCharToCurrentCharacterToken(ha.CHARACTER,i)}_startCharacterReference(){this.returnState=this.state,this.state=Ve.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?aA.Attribute:aA.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Ve.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Ve.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Ve.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(i){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(i):this._emitCodePoint(i)}_callState(i){switch(this.state){case Ve.DATA:{this._stateData(i);break}case Ve.RCDATA:{this._stateRcdata(i);break}case Ve.RAWTEXT:{this._stateRawtext(i);break}case Ve.SCRIPT_DATA:{this._stateScriptData(i);break}case Ve.PLAINTEXT:{this._statePlaintext(i);break}case Ve.TAG_OPEN:{this._stateTagOpen(i);break}case Ve.END_TAG_OPEN:{this._stateEndTagOpen(i);break}case Ve.TAG_NAME:{this._stateTagName(i);break}case Ve.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(i);break}case Ve.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(i);break}case Ve.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(i);break}case Ve.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(i);break}case Ve.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(i);break}case Ve.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(i);break}case Ve.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(i);break}case Ve.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(i);break}case Ve.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(i);break}case Ve.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(i);break}case Ve.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(i);break}case Ve.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(i);break}case Ve.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(i);break}case Ve.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(i);break}case Ve.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(i);break}case Ve.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(i);break}case Ve.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(i);break}case Ve.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(i);break}case Ve.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(i);break}case Ve.ATTRIBUTE_NAME:{this._stateAttributeName(i);break}case Ve.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(i);break}case Ve.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(i);break}case Ve.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(i);break}case Ve.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(i);break}case Ve.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(i);break}case Ve.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(i);break}case Ve.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(i);break}case Ve.BOGUS_COMMENT:{this._stateBogusComment(i);break}case Ve.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(i);break}case Ve.COMMENT_START:{this._stateCommentStart(i);break}case Ve.COMMENT_START_DASH:{this._stateCommentStartDash(i);break}case Ve.COMMENT:{this._stateComment(i);break}case Ve.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(i);break}case Ve.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(i);break}case Ve.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(i);break}case Ve.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(i);break}case Ve.COMMENT_END_DASH:{this._stateCommentEndDash(i);break}case Ve.COMMENT_END:{this._stateCommentEnd(i);break}case Ve.COMMENT_END_BANG:{this._stateCommentEndBang(i);break}case Ve.DOCTYPE:{this._stateDoctype(i);break}case Ve.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(i);break}case Ve.DOCTYPE_NAME:{this._stateDoctypeName(i);break}case Ve.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(i);break}case Ve.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(i);break}case Ve.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(i);break}case Ve.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(i);break}case Ve.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(i);break}case Ve.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(i);break}case Ve.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(i);break}case Ve.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(i);break}case Ve.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(i);break}case Ve.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(i);break}case Ve.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(i);break}case Ve.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(i);break}case Ve.BOGUS_DOCTYPE:{this._stateBogusDoctype(i);break}case Ve.CDATA_SECTION:{this._stateCdataSection(i);break}case Ve.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(i);break}case Ve.CDATA_SECTION_END:{this._stateCdataSectionEnd(i);break}case Ve.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case Ve.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(i);break}default:throw new Error("Unknown state")}}_stateData(i){switch(i){case $e.LESS_THAN_SIGN:{this.state=Ve.TAG_OPEN;break}case $e.AMPERSAND:{this._startCharacterReference();break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this._emitCodePoint(i);break}case $e.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(i)}}_stateRcdata(i){switch(i){case $e.AMPERSAND:{this._startCharacterReference();break}case $e.LESS_THAN_SIGN:{this.state=Ve.RCDATA_LESS_THAN_SIGN;break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this._emitChars(Ou);break}case $e.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(i)}}_stateRawtext(i){switch(i){case $e.LESS_THAN_SIGN:{this.state=Ve.RAWTEXT_LESS_THAN_SIGN;break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this._emitChars(Ou);break}case $e.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(i)}}_stateScriptData(i){switch(i){case $e.LESS_THAN_SIGN:{this.state=Ve.SCRIPT_DATA_LESS_THAN_SIGN;break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this._emitChars(Ou);break}case $e.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(i)}}_statePlaintext(i){switch(i){case $e.NULL:{this._err(sn.unexpectedNullCharacter),this._emitChars(Ou);break}case $e.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(i)}}_stateTagOpen(i){if(Lk(i))this._createStartTagToken(),this.state=Ve.TAG_NAME,this._stateTagName(i);else switch(i){case $e.EXCLAMATION_MARK:{this.state=Ve.MARKUP_DECLARATION_OPEN;break}case $e.SOLIDUS:{this.state=Ve.END_TAG_OPEN;break}case $e.QUESTION_MARK:{this._err(sn.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Ve.BOGUS_COMMENT,this._stateBogusComment(i);break}case $e.EOF:{this._err(sn.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(sn.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Ve.DATA,this._stateData(i)}}_stateEndTagOpen(i){if(Lk(i))this._createEndTagToken(),this.state=Ve.TAG_NAME,this._stateTagName(i);else switch(i){case $e.GREATER_THAN_SIGN:{this._err(sn.missingEndTagName),this.state=Ve.DATA;break}case $e.EOF:{this._err(sn.eofBeforeTagName),this._emitChars("");break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this.state=Ve.SCRIPT_DATA_ESCAPED,this._emitChars(Ou);break}case $e.EOF:{this._err(sn.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Ve.SCRIPT_DATA_ESCAPED,this._emitCodePoint(i)}}_stateScriptDataEscapedLessThanSign(i){i===$e.SOLIDUS?this.state=Ve.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Lk(i)?(this._emitChars("<"),this.state=Ve.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(i)):(this._emitChars("<"),this.state=Ve.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(i))}_stateScriptDataEscapedEndTagOpen(i){Lk(i)?(this.state=Ve.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(i)):(this._emitChars("");break}case $e.NULL:{this._err(sn.unexpectedNullCharacter),this.state=Ve.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ou);break}case $e.EOF:{this._err(sn.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=Ve.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(i)}}_stateScriptDataDoubleEscapedLessThanSign(i){i===$e.SOLIDUS?(this.state=Ve.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Ve.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(i))}_stateScriptDataDoubleEscapeEnd(i){if(this.preprocessor.startsWith(nb.SCRIPT,!1)&&v$t(this.preprocessor.peek(nb.SCRIPT.length))){this._emitCodePoint(i);for(let s=0;s0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(i,!0)}replace(i,s){const c=this._indexOf(i);this.items[c]=s,c===this.stackTop&&(this.current=s)}insertAfter(i,s,c){const d=this._indexOf(i)+1;this.items.splice(d,0,s),this.tagIDs.splice(d,0,c),this.stackTop++,d===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,d===this.stackTop)}popUntilTagNamePopped(i){let s=this.stackTop+1;do s=this.tagIDs.lastIndexOf(i,s-1);while(s>0&&this.treeAdapter.getNamespaceURI(this.items[s])!==Fn.HTML);this.shortenToLength(Math.max(s,0))}shortenToLength(i){for(;this.stackTop>=i;){const s=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(s,this.stackTop=0;c--)if(i.has(this.tagIDs[c])&&this.treeAdapter.getNamespaceURI(this.items[c])===s)return c;return-1}clearBackTo(i,s){const c=this._indexOfTagNames(i,s);this.shortenToLength(c+1)}clearBackToTableContext(){this.clearBackTo(osr,Fn.HTML)}clearBackToTableBodyContext(){this.clearBackTo(isr,Fn.HTML)}clearBackToTableRowContext(){this.clearBackTo(rsr,Fn.HTML)}remove(i){const s=this._indexOf(i);s>=0&&(s===this.stackTop?this.pop():(this.items.splice(s,1),this.tagIDs.splice(s,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(i,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===W.BODY?this.items[1]:null}contains(i){return this._indexOf(i)>-1}getCommonAncestor(i){const s=this._indexOf(i)-1;return s>=0?this.items[s]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===W.HTML}hasInDynamicScope(i,s){for(let c=this.stackTop;c>=0;c--){const d=this.tagIDs[c];switch(this.treeAdapter.getNamespaceURI(this.items[c])){case Fn.HTML:{if(d===i)return!0;if(s.has(d))return!1;break}case Fn.SVG:{if(T$t.has(d))return!1;break}case Fn.MATHML:{if(S$t.has(d))return!1;break}}}return!0}hasInScope(i){return this.hasInDynamicScope(i,kse)}hasInListItemScope(i){return this.hasInDynamicScope(i,tsr)}hasInButtonScope(i){return this.hasInDynamicScope(i,nsr)}hasNumberedHeaderInScope(){for(let i=this.stackTop;i>=0;i--){const s=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case Fn.HTML:{if(pLe.has(s))return!0;if(kse.has(s))return!1;break}case Fn.SVG:{if(T$t.has(s))return!1;break}case Fn.MATHML:{if(S$t.has(s))return!1;break}}}return!0}hasInTableScope(i){for(let s=this.stackTop;s>=0;s--)if(this.treeAdapter.getNamespaceURI(this.items[s])===Fn.HTML)switch(this.tagIDs[s]){case i:return!0;case W.TABLE:case W.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let i=this.stackTop;i>=0;i--)if(this.treeAdapter.getNamespaceURI(this.items[i])===Fn.HTML)switch(this.tagIDs[i]){case W.TBODY:case W.THEAD:case W.TFOOT:return!0;case W.TABLE:case W.HTML:return!1}return!0}hasInSelectScope(i){for(let s=this.stackTop;s>=0;s--)if(this.treeAdapter.getNamespaceURI(this.items[s])===Fn.HTML)switch(this.tagIDs[s]){case i:return!0;case W.OPTION:case W.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&eXt.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&E$t.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(i){for(;this.currentTagId!==void 0&&this.currentTagId!==i&&E$t.has(this.currentTagId);)this.pop()}}const ZOe=3;var I2;(function(n){n[n.Marker=0]="Marker",n[n.Element=1]="Element"})(I2||(I2={}));const A$t={type:I2.Marker};class csr{constructor(i){this.treeAdapter=i,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(i,s){const c=[],d=s.length,g=this.treeAdapter.getTagName(i),b=this.treeAdapter.getNamespaceURI(i);for(let w=0;w[b.name,b.value]));let g=0;for(let b=0;bd.get(E.name)===E.value)&&(g+=1,g>=ZOe&&this.entries.splice(w.idx,1))}}insertMarker(){this.entries.unshift(A$t)}pushElement(i,s){this._ensureNoahArkCondition(i),this.entries.unshift({type:I2.Element,element:i,token:s})}insertElementAfterBookmark(i,s){const c=this.entries.indexOf(this.bookmark);this.entries.splice(c,0,{type:I2.Element,element:i,token:s})}removeEntry(i){const s=this.entries.indexOf(i);s!==-1&&this.entries.splice(s,1)}clearToLastMarker(){const i=this.entries.indexOf(A$t);i===-1?this.entries.length=0:this.entries.splice(0,i+1)}getElementEntryInScopeWithTagName(i){const s=this.entries.find(c=>c.type===I2.Marker||this.treeAdapter.getTagName(c.element)===i);return s&&s.type===I2.Element?s:null}getElementEntry(i){return this.entries.find(s=>s.type===I2.Element&&s.element===i)}}const Mk={createDocument(){return{nodeName:"#document",mode:yw.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(n,i,s){return{nodeName:n,tagName:n,attrs:s,namespaceURI:i,childNodes:[],parentNode:null}},createCommentNode(n){return{nodeName:"#comment",data:n,parentNode:null}},createTextNode(n){return{nodeName:"#text",value:n,parentNode:null}},appendChild(n,i){n.childNodes.push(i),i.parentNode=n},insertBefore(n,i,s){const c=n.childNodes.indexOf(s);n.childNodes.splice(c,0,i),i.parentNode=n},setTemplateContent(n,i){n.content=i},getTemplateContent(n){return n.content},setDocumentType(n,i,s,c){const d=n.childNodes.find(g=>g.nodeName==="#documentType");if(d)d.name=i,d.publicId=s,d.systemId=c;else{const g={nodeName:"#documentType",name:i,publicId:s,systemId:c,parentNode:null};Mk.appendChild(n,g)}},setDocumentMode(n,i){n.mode=i},getDocumentMode(n){return n.mode},detachNode(n){if(n.parentNode){const i=n.parentNode.childNodes.indexOf(n);n.parentNode.childNodes.splice(i,1),n.parentNode=null}},insertText(n,i){if(n.childNodes.length>0){const s=n.childNodes[n.childNodes.length-1];if(Mk.isTextNode(s)){s.value+=i;return}}Mk.appendChild(n,Mk.createTextNode(i))},insertTextBefore(n,i,s){const c=n.childNodes[n.childNodes.indexOf(s)-1];c&&Mk.isTextNode(c)?c.value+=i:Mk.insertBefore(n,Mk.createTextNode(i),s)},adoptAttributes(n,i){const s=new Set(n.attrs.map(c=>c.name));for(let c=0;cn.startsWith(s))}function psr(n){return n.name===tXt&&n.publicId===null&&(n.systemId===null||n.systemId===usr)}function gsr(n){if(n.name!==tXt)return yw.QUIRKS;const{systemId:i}=n;if(i&&i.toLowerCase()===lsr)return yw.QUIRKS;let{publicId:s}=n;if(s!==null){if(s=s.toLowerCase(),fsr.has(s))return yw.QUIRKS;let c=i===null?dsr:nXt;if(_$t(s,c))return yw.QUIRKS;if(c=i===null?rXt:hsr,_$t(s,c))return yw.LIMITED_QUIRKS}return yw.NO_QUIRKS}const x$t={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},bsr="definitionurl",msr="definitionURL",wsr=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(n=>[n.toLowerCase(),n])),ysr=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Fn.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Fn.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Fn.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Fn.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Fn.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Fn.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Fn.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Fn.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Fn.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Fn.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Fn.XMLNS}]]),vsr=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(n=>[n.toLowerCase(),n])),Esr=new Set([W.B,W.BIG,W.BLOCKQUOTE,W.BODY,W.BR,W.CENTER,W.CODE,W.DD,W.DIV,W.DL,W.DT,W.EM,W.EMBED,W.H1,W.H2,W.H3,W.H4,W.H5,W.H6,W.HEAD,W.HR,W.I,W.IMG,W.LI,W.LISTING,W.MENU,W.META,W.NOBR,W.OL,W.P,W.PRE,W.RUBY,W.S,W.SMALL,W.SPAN,W.STRONG,W.STRIKE,W.SUB,W.SUP,W.TABLE,W.TT,W.U,W.UL,W.VAR]);function Ssr(n){const i=n.tagID;return i===W.FONT&&n.attrs.some(({name:c})=>c===iR.COLOR||c===iR.SIZE||c===iR.FACE)||Esr.has(i)}function iXt(n){for(let i=0;i0&&this._setContextModes(i,s)}onItemPop(i,s){var c,d;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(i,this.currentToken),(d=(c=this.treeAdapter).onItemPop)===null||d===void 0||d.call(c,i,this.openElements.current),s){let g,b;this.openElements.stackTop===0&&this.fragmentContext?(g=this.fragmentContext,b=this.fragmentContextID):{current:g,currentTagId:b}=this.openElements,this._setContextModes(g,b)}}_setContextModes(i,s){const c=i===this.document||i&&this.treeAdapter.getNamespaceURI(i)===Fn.HTML;this.currentNotInHTML=!c,this.tokenizer.inForeignNode=!c&&i!==void 0&&s!==void 0&&!this._isIntegrationPoint(s,i)}_switchToTextParsing(i,s){this._insertElement(i,Fn.HTML),this.tokenizer.state=s,this.originalInsertionMode=this.insertionMode,this.insertionMode=ct.TEXT}switchToPlaintextParsing(){this.insertionMode=ct.TEXT,this.originalInsertionMode=ct.IN_BODY,this.tokenizer.state=sb.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let i=this.fragmentContext;for(;i;){if(this.treeAdapter.getTagName(i)===Pt.FORM){this.formElement=i;break}i=this.treeAdapter.getParentNode(i)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Fn.HTML))switch(this.fragmentContextID){case W.TITLE:case W.TEXTAREA:{this.tokenizer.state=sb.RCDATA;break}case W.STYLE:case W.XMP:case W.IFRAME:case W.NOEMBED:case W.NOFRAMES:case W.NOSCRIPT:{this.tokenizer.state=sb.RAWTEXT;break}case W.SCRIPT:{this.tokenizer.state=sb.SCRIPT_DATA;break}case W.PLAINTEXT:{this.tokenizer.state=sb.PLAINTEXT;break}}}_setDocumentType(i){const s=i.name||"",c=i.publicId||"",d=i.systemId||"";if(this.treeAdapter.setDocumentType(this.document,s,c,d),i.location){const b=this.treeAdapter.getChildNodes(this.document).find(w=>this.treeAdapter.isDocumentTypeNode(w));b&&this.treeAdapter.setNodeSourceCodeLocation(b,i.location)}}_attachElementToTree(i,s){if(this.options.sourceCodeLocationInfo){const c=s&&{...s,startTag:s};this.treeAdapter.setNodeSourceCodeLocation(i,c)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(i);else{const c=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(c??this.document,i)}}_appendElement(i,s){const c=this.treeAdapter.createElement(i.tagName,s,i.attrs);this._attachElementToTree(c,i.location)}_insertElement(i,s){const c=this.treeAdapter.createElement(i.tagName,s,i.attrs);this._attachElementToTree(c,i.location),this.openElements.push(c,i.tagID)}_insertFakeElement(i,s){const c=this.treeAdapter.createElement(i,Fn.HTML,[]);this._attachElementToTree(c,null),this.openElements.push(c,s)}_insertTemplate(i){const s=this.treeAdapter.createElement(i.tagName,Fn.HTML,i.attrs),c=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(s,c),this._attachElementToTree(s,i.location),this.openElements.push(s,i.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(c,null)}_insertFakeRootElement(){const i=this.treeAdapter.createElement(Pt.HTML,Fn.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null),this.treeAdapter.appendChild(this.openElements.current,i),this.openElements.push(i,W.HTML)}_appendCommentNode(i,s){const c=this.treeAdapter.createCommentNode(i.data);this.treeAdapter.appendChild(s,c),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(c,i.location)}_insertCharacters(i){let s,c;if(this._shouldFosterParentOnInsertion()?({parent:s,beforeElement:c}=this._findFosterParentingLocation(),c?this.treeAdapter.insertTextBefore(s,i.chars,c):this.treeAdapter.insertText(s,i.chars)):(s=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(s,i.chars)),!i.location)return;const d=this.treeAdapter.getChildNodes(s),g=c?d.lastIndexOf(c):d.length,b=d[g-1];if(this.treeAdapter.getNodeSourceCodeLocation(b)){const{endLine:E,endCol:S,endOffset:_}=i.location;this.treeAdapter.updateNodeSourceCodeLocation(b,{endLine:E,endCol:S,endOffset:_})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(b,i.location)}_adoptNodes(i,s){for(let c=this.treeAdapter.getFirstChild(i);c;c=this.treeAdapter.getFirstChild(i))this.treeAdapter.detachNode(c),this.treeAdapter.appendChild(s,c)}_setEndLocation(i,s){if(this.treeAdapter.getNodeSourceCodeLocation(i)&&s.location){const c=s.location,d=this.treeAdapter.getTagName(i),g=s.type===ha.END_TAG&&d===s.tagName?{endTag:{...c},endLine:c.endLine,endCol:c.endCol,endOffset:c.endOffset}:{endLine:c.startLine,endCol:c.startCol,endOffset:c.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(i,g)}}shouldProcessStartTagTokenInForeignContent(i){if(!this.currentNotInHTML)return!1;let s,c;return this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,c=this.fragmentContextID):{current:s,currentTagId:c}=this.openElements,i.tagID===W.SVG&&this.treeAdapter.getTagName(s)===Pt.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(s)===Fn.MATHML?!1:this.tokenizer.inForeignNode||(i.tagID===W.MGLYPH||i.tagID===W.MALIGNMARK)&&c!==void 0&&!this._isIntegrationPoint(c,s,Fn.HTML)}_processToken(i){switch(i.type){case ha.CHARACTER:{this.onCharacter(i);break}case ha.NULL_CHARACTER:{this.onNullCharacter(i);break}case ha.COMMENT:{this.onComment(i);break}case ha.DOCTYPE:{this.onDoctype(i);break}case ha.START_TAG:{this._processStartTag(i);break}case ha.END_TAG:{this.onEndTag(i);break}case ha.EOF:{this.onEof(i);break}case ha.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(i);break}}}_isIntegrationPoint(i,s,c){const d=this.treeAdapter.getNamespaceURI(s),g=this.treeAdapter.getAttrList(s);return xsr(i,d,g,c)}_reconstructActiveFormattingElements(){const i=this.activeFormattingElements.entries.length;if(i){const s=this.activeFormattingElements.entries.findIndex(d=>d.type===I2.Marker||this.openElements.contains(d.element)),c=s===-1?i-1:s-1;for(let d=c;d>=0;d--){const g=this.activeFormattingElements.entries[d];this._insertElement(g.token,this.treeAdapter.getNamespaceURI(g.element)),g.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ct.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(W.P),this.openElements.popUntilTagNamePopped(W.P)}_resetInsertionMode(){for(let i=this.openElements.stackTop;i>=0;i--)switch(i===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[i]){case W.TR:{this.insertionMode=ct.IN_ROW;return}case W.TBODY:case W.THEAD:case W.TFOOT:{this.insertionMode=ct.IN_TABLE_BODY;return}case W.CAPTION:{this.insertionMode=ct.IN_CAPTION;return}case W.COLGROUP:{this.insertionMode=ct.IN_COLUMN_GROUP;return}case W.TABLE:{this.insertionMode=ct.IN_TABLE;return}case W.BODY:{this.insertionMode=ct.IN_BODY;return}case W.FRAMESET:{this.insertionMode=ct.IN_FRAMESET;return}case W.SELECT:{this._resetInsertionModeForSelect(i);return}case W.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case W.HTML:{this.insertionMode=this.headElement?ct.AFTER_HEAD:ct.BEFORE_HEAD;return}case W.TD:case W.TH:{if(i>0){this.insertionMode=ct.IN_CELL;return}break}case W.HEAD:{if(i>0){this.insertionMode=ct.IN_HEAD;return}break}}this.insertionMode=ct.IN_BODY}_resetInsertionModeForSelect(i){if(i>0)for(let s=i-1;s>0;s--){const c=this.openElements.tagIDs[s];if(c===W.TEMPLATE)break;if(c===W.TABLE){this.insertionMode=ct.IN_SELECT_IN_TABLE;return}}this.insertionMode=ct.IN_SELECT}_isElementCausesFosterParenting(i){return sXt.has(i)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let i=this.openElements.stackTop;i>=0;i--){const s=this.openElements.items[i];switch(this.openElements.tagIDs[i]){case W.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(s)===Fn.HTML)return{parent:this.treeAdapter.getTemplateContent(s),beforeElement:null};break}case W.TABLE:{const c=this.treeAdapter.getParentNode(s);return c?{parent:c,beforeElement:s}:{parent:this.openElements.items[i-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(i){const s=this._findFosterParentingLocation();s.beforeElement?this.treeAdapter.insertBefore(s.parent,i,s.beforeElement):this.treeAdapter.appendChild(s.parent,i)}_isSpecialElement(i,s){const c=this.treeAdapter.getNamespaceURI(i);return Jor[c].has(s)}onCharacter(i){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){acr(this,i);return}switch(this.insertionMode){case ct.INITIAL:{qU(this,i);break}case ct.BEFORE_HTML:{EH(this,i);break}case ct.BEFORE_HEAD:{SH(this,i);break}case ct.IN_HEAD:{TH(this,i);break}case ct.IN_HEAD_NO_SCRIPT:{AH(this,i);break}case ct.AFTER_HEAD:{_H(this,i);break}case ct.IN_BODY:case ct.IN_CAPTION:case ct.IN_CELL:case ct.IN_TEMPLATE:{uXt(this,i);break}case ct.TEXT:case ct.IN_SELECT:case ct.IN_SELECT_IN_TABLE:{this._insertCharacters(i);break}case ct.IN_TABLE:case ct.IN_TABLE_BODY:case ct.IN_ROW:{QOe(this,i);break}case ct.IN_TABLE_TEXT:{gXt(this,i);break}case ct.IN_COLUMN_GROUP:{Nse(this,i);break}case ct.AFTER_BODY:{Cse(this,i);break}case ct.AFTER_AFTER_BODY:{loe(this,i);break}}}onNullCharacter(i){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){scr(this,i);return}switch(this.insertionMode){case ct.INITIAL:{qU(this,i);break}case ct.BEFORE_HTML:{EH(this,i);break}case ct.BEFORE_HEAD:{SH(this,i);break}case ct.IN_HEAD:{TH(this,i);break}case ct.IN_HEAD_NO_SCRIPT:{AH(this,i);break}case ct.AFTER_HEAD:{_H(this,i);break}case ct.TEXT:{this._insertCharacters(i);break}case ct.IN_TABLE:case ct.IN_TABLE_BODY:case ct.IN_ROW:{QOe(this,i);break}case ct.IN_COLUMN_GROUP:{Nse(this,i);break}case ct.AFTER_BODY:{Cse(this,i);break}case ct.AFTER_AFTER_BODY:{loe(this,i);break}}}onComment(i){if(this.skipNextNewLine=!1,this.currentNotInHTML){gLe(this,i);return}switch(this.insertionMode){case ct.INITIAL:case ct.BEFORE_HTML:case ct.BEFORE_HEAD:case ct.IN_HEAD:case ct.IN_HEAD_NO_SCRIPT:case ct.AFTER_HEAD:case ct.IN_BODY:case ct.IN_TABLE:case ct.IN_CAPTION:case ct.IN_COLUMN_GROUP:case ct.IN_TABLE_BODY:case ct.IN_ROW:case ct.IN_CELL:case ct.IN_SELECT:case ct.IN_SELECT_IN_TABLE:case ct.IN_TEMPLATE:case ct.IN_FRAMESET:case ct.AFTER_FRAMESET:{gLe(this,i);break}case ct.IN_TABLE_TEXT:{VU(this,i);break}case ct.AFTER_BODY:{jsr(this,i);break}case ct.AFTER_AFTER_BODY:case ct.AFTER_AFTER_FRAMESET:{Fsr(this,i);break}}}onDoctype(i){switch(this.skipNextNewLine=!1,this.insertionMode){case ct.INITIAL:{$sr(this,i);break}case ct.BEFORE_HEAD:case ct.IN_HEAD:case ct.IN_HEAD_NO_SCRIPT:case ct.AFTER_HEAD:{this._err(i,sn.misplacedDoctype);break}case ct.IN_TABLE_TEXT:{VU(this,i);break}}}onStartTag(i){this.skipNextNewLine=!1,this.currentToken=i,this._processStartTag(i),i.selfClosing&&!i.ackSelfClosing&&this._err(i,sn.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(i){this.shouldProcessStartTagTokenInForeignContent(i)?ccr(this,i):this._startTagOutsideForeignContent(i)}_startTagOutsideForeignContent(i){switch(this.insertionMode){case ct.INITIAL:{qU(this,i);break}case ct.BEFORE_HTML:{Bsr(this,i);break}case ct.BEFORE_HEAD:{Hsr(this,i);break}case ct.IN_HEAD:{zv(this,i);break}case ct.IN_HEAD_NO_SCRIPT:{qsr(this,i);break}case ct.AFTER_HEAD:{Wsr(this,i);break}case ct.IN_BODY:{Vp(this,i);break}case ct.IN_TABLE:{DM(this,i);break}case ct.IN_TABLE_TEXT:{VU(this,i);break}case ct.IN_CAPTION:{Gar(this,i);break}case ct.IN_COLUMN_GROUP:{b9e(this,i);break}case ct.IN_TABLE_BODY:{uce(this,i);break}case ct.IN_ROW:{lce(this,i);break}case ct.IN_CELL:{War(this,i);break}case ct.IN_SELECT:{wXt(this,i);break}case ct.IN_SELECT_IN_TABLE:{Yar(this,i);break}case ct.IN_TEMPLATE:{Xar(this,i);break}case ct.AFTER_BODY:{Qar(this,i);break}case ct.IN_FRAMESET:{ecr(this,i);break}case ct.AFTER_FRAMESET:{ncr(this,i);break}case ct.AFTER_AFTER_BODY:{icr(this,i);break}case ct.AFTER_AFTER_FRAMESET:{ocr(this,i);break}}}onEndTag(i){this.skipNextNewLine=!1,this.currentToken=i,this.currentNotInHTML?ucr(this,i):this._endTagOutsideForeignContent(i)}_endTagOutsideForeignContent(i){switch(this.insertionMode){case ct.INITIAL:{qU(this,i);break}case ct.BEFORE_HTML:{Usr(this,i);break}case ct.BEFORE_HEAD:{zsr(this,i);break}case ct.IN_HEAD:{Gsr(this,i);break}case ct.IN_HEAD_NO_SCRIPT:{Vsr(this,i);break}case ct.AFTER_HEAD:{Ksr(this,i);break}case ct.IN_BODY:{cce(this,i);break}case ct.TEXT:{Lar(this,i);break}case ct.IN_TABLE:{gz(this,i);break}case ct.IN_TABLE_TEXT:{VU(this,i);break}case ct.IN_CAPTION:{qar(this,i);break}case ct.IN_COLUMN_GROUP:{Var(this,i);break}case ct.IN_TABLE_BODY:{bLe(this,i);break}case ct.IN_ROW:{mXt(this,i);break}case ct.IN_CELL:{Kar(this,i);break}case ct.IN_SELECT:{yXt(this,i);break}case ct.IN_SELECT_IN_TABLE:{Jar(this,i);break}case ct.IN_TEMPLATE:{Zar(this,i);break}case ct.AFTER_BODY:{EXt(this,i);break}case ct.IN_FRAMESET:{tcr(this,i);break}case ct.AFTER_FRAMESET:{rcr(this,i);break}case ct.AFTER_AFTER_BODY:{loe(this,i);break}}}onEof(i){switch(this.insertionMode){case ct.INITIAL:{qU(this,i);break}case ct.BEFORE_HTML:{EH(this,i);break}case ct.BEFORE_HEAD:{SH(this,i);break}case ct.IN_HEAD:{TH(this,i);break}case ct.IN_HEAD_NO_SCRIPT:{AH(this,i);break}case ct.AFTER_HEAD:{_H(this,i);break}case ct.IN_BODY:case ct.IN_TABLE:case ct.IN_CAPTION:case ct.IN_COLUMN_GROUP:case ct.IN_TABLE_BODY:case ct.IN_ROW:case ct.IN_CELL:case ct.IN_SELECT:case ct.IN_SELECT_IN_TABLE:{hXt(this,i);break}case ct.TEXT:{Mar(this,i);break}case ct.IN_TABLE_TEXT:{VU(this,i);break}case ct.IN_TEMPLATE:{vXt(this,i);break}case ct.AFTER_BODY:case ct.IN_FRAMESET:case ct.AFTER_FRAMESET:case ct.AFTER_AFTER_BODY:case ct.AFTER_AFTER_FRAMESET:{g9e(this,i);break}}}onWhitespaceCharacter(i){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,i.chars.charCodeAt(0)===$e.LINE_FEED)){if(i.chars.length===1)return;i.chars=i.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(i);return}switch(this.insertionMode){case ct.IN_HEAD:case ct.IN_HEAD_NO_SCRIPT:case ct.AFTER_HEAD:case ct.TEXT:case ct.IN_COLUMN_GROUP:case ct.IN_SELECT:case ct.IN_SELECT_IN_TABLE:case ct.IN_FRAMESET:case ct.AFTER_FRAMESET:{this._insertCharacters(i);break}case ct.IN_BODY:case ct.IN_CAPTION:case ct.IN_CELL:case ct.IN_TEMPLATE:case ct.AFTER_BODY:case ct.AFTER_AFTER_BODY:case ct.AFTER_AFTER_FRAMESET:{cXt(this,i);break}case ct.IN_TABLE:case ct.IN_TABLE_BODY:case ct.IN_ROW:{QOe(this,i);break}case ct.IN_TABLE_TEXT:{pXt(this,i);break}}}}function Rsr(n,i){let s=n.activeFormattingElements.getElementEntryInScopeWithTagName(i.tagName);return s?n.openElements.contains(s.element)?n.openElements.hasInScope(i.tagID)||(s=null):(n.activeFormattingElements.removeEntry(s),s=null):fXt(n,i),s}function Osr(n,i){let s=null,c=n.openElements.stackTop;for(;c>=0;c--){const d=n.openElements.items[c];if(d===i.element)break;n._isSpecialElement(d,n.openElements.tagIDs[c])&&(s=d)}return s||(n.openElements.shortenToLength(Math.max(c,0)),n.activeFormattingElements.removeEntry(i)),s}function Dsr(n,i,s){let c=i,d=n.openElements.getCommonAncestor(i);for(let g=0,b=d;b!==s;g++,b=d){d=n.openElements.getCommonAncestor(b);const w=n.activeFormattingElements.getElementEntry(b),E=w&&g>=Csr;!w||E?(E&&n.activeFormattingElements.removeEntry(w),n.openElements.remove(b)):(b=Lsr(n,w),c===i&&(n.activeFormattingElements.bookmark=w),n.treeAdapter.detachNode(c),n.treeAdapter.appendChild(b,c),c=b)}return c}function Lsr(n,i){const s=n.treeAdapter.getNamespaceURI(i.element),c=n.treeAdapter.createElement(i.token.tagName,s,i.token.attrs);return n.openElements.replace(i.element,c),i.element=c,c}function Msr(n,i,s){const c=n.treeAdapter.getTagName(i),d=sce(c);if(n._isElementCausesFosterParenting(d))n._fosterParentElement(s);else{const g=n.treeAdapter.getNamespaceURI(i);d===W.TEMPLATE&&g===Fn.HTML&&(i=n.treeAdapter.getTemplateContent(i)),n.treeAdapter.appendChild(i,s)}}function Psr(n,i,s){const c=n.treeAdapter.getNamespaceURI(s.element),{token:d}=s,g=n.treeAdapter.createElement(d.tagName,c,d.attrs);n._adoptNodes(i,g),n.treeAdapter.appendChild(i,g),n.activeFormattingElements.insertElementAfterBookmark(g,d),n.activeFormattingElements.removeEntry(s),n.openElements.remove(s.element),n.openElements.insertAfter(i,g,d.tagID)}function p9e(n,i){for(let s=0;s=s;c--)n._setEndLocation(n.openElements.items[c],i);if(!n.fragmentContext&&n.openElements.stackTop>=0){const c=n.openElements.items[0],d=n.treeAdapter.getNodeSourceCodeLocation(c);if(d&&!d.endTag&&(n._setEndLocation(c,i),n.openElements.stackTop>=1)){const g=n.openElements.items[1],b=n.treeAdapter.getNodeSourceCodeLocation(g);b&&!b.endTag&&n._setEndLocation(g,i)}}}}function $sr(n,i){n._setDocumentType(i);const s=i.forceQuirks?yw.QUIRKS:gsr(i);psr(i)||n._err(i,sn.nonConformingDoctype),n.treeAdapter.setDocumentMode(n.document,s),n.insertionMode=ct.BEFORE_HTML}function qU(n,i){n._err(i,sn.missingDoctype,!0),n.treeAdapter.setDocumentMode(n.document,yw.QUIRKS),n.insertionMode=ct.BEFORE_HTML,n._processToken(i)}function Bsr(n,i){i.tagID===W.HTML?(n._insertElement(i,Fn.HTML),n.insertionMode=ct.BEFORE_HEAD):EH(n,i)}function Usr(n,i){const s=i.tagID;(s===W.HTML||s===W.HEAD||s===W.BODY||s===W.BR)&&EH(n,i)}function EH(n,i){n._insertFakeRootElement(),n.insertionMode=ct.BEFORE_HEAD,n._processToken(i)}function Hsr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.HEAD:{n._insertElement(i,Fn.HTML),n.headElement=n.openElements.current,n.insertionMode=ct.IN_HEAD;break}default:SH(n,i)}}function zsr(n,i){const s=i.tagID;s===W.HEAD||s===W.BODY||s===W.HTML||s===W.BR?SH(n,i):n._err(i,sn.endTagWithoutMatchingOpenElement)}function SH(n,i){n._insertFakeElement(Pt.HEAD,W.HEAD),n.headElement=n.openElements.current,n.insertionMode=ct.IN_HEAD,n._processToken(i)}function zv(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:{n._appendElement(i,Fn.HTML),i.ackSelfClosing=!0;break}case W.TITLE:{n._switchToTextParsing(i,sb.RCDATA);break}case W.NOSCRIPT:{n.options.scriptingEnabled?n._switchToTextParsing(i,sb.RAWTEXT):(n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_HEAD_NO_SCRIPT);break}case W.NOFRAMES:case W.STYLE:{n._switchToTextParsing(i,sb.RAWTEXT);break}case W.SCRIPT:{n._switchToTextParsing(i,sb.SCRIPT_DATA);break}case W.TEMPLATE:{n._insertTemplate(i),n.activeFormattingElements.insertMarker(),n.framesetOk=!1,n.insertionMode=ct.IN_TEMPLATE,n.tmplInsertionModeStack.unshift(ct.IN_TEMPLATE);break}case W.HEAD:{n._err(i,sn.misplacedStartTagForHeadElement);break}default:TH(n,i)}}function Gsr(n,i){switch(i.tagID){case W.HEAD:{n.openElements.pop(),n.insertionMode=ct.AFTER_HEAD;break}case W.BODY:case W.BR:case W.HTML:{TH(n,i);break}case W.TEMPLATE:{jR(n,i);break}default:n._err(i,sn.endTagWithoutMatchingOpenElement)}}function jR(n,i){n.openElements.tmplCount>0?(n.openElements.generateImpliedEndTagsThoroughly(),n.openElements.currentTagId!==W.TEMPLATE&&n._err(i,sn.closingOfElementWithOpenChildElements),n.openElements.popUntilTagNamePopped(W.TEMPLATE),n.activeFormattingElements.clearToLastMarker(),n.tmplInsertionModeStack.shift(),n._resetInsertionMode()):n._err(i,sn.endTagWithoutMatchingOpenElement)}function TH(n,i){n.openElements.pop(),n.insertionMode=ct.AFTER_HEAD,n._processToken(i)}function qsr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.BASEFONT:case W.BGSOUND:case W.HEAD:case W.LINK:case W.META:case W.NOFRAMES:case W.STYLE:{zv(n,i);break}case W.NOSCRIPT:{n._err(i,sn.nestedNoscriptInHead);break}default:AH(n,i)}}function Vsr(n,i){switch(i.tagID){case W.NOSCRIPT:{n.openElements.pop(),n.insertionMode=ct.IN_HEAD;break}case W.BR:{AH(n,i);break}default:n._err(i,sn.endTagWithoutMatchingOpenElement)}}function AH(n,i){const s=i.type===ha.EOF?sn.openElementsLeftAfterEof:sn.disallowedContentInNoscriptInHead;n._err(i,s),n.openElements.pop(),n.insertionMode=ct.IN_HEAD,n._processToken(i)}function Wsr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.BODY:{n._insertElement(i,Fn.HTML),n.framesetOk=!1,n.insertionMode=ct.IN_BODY;break}case W.FRAMESET:{n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_FRAMESET;break}case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:case W.NOFRAMES:case W.SCRIPT:case W.STYLE:case W.TEMPLATE:case W.TITLE:{n._err(i,sn.abandonedHeadElementChild),n.openElements.push(n.headElement,W.HEAD),zv(n,i),n.openElements.remove(n.headElement);break}case W.HEAD:{n._err(i,sn.misplacedStartTagForHeadElement);break}default:_H(n,i)}}function Ksr(n,i){switch(i.tagID){case W.BODY:case W.HTML:case W.BR:{_H(n,i);break}case W.TEMPLATE:{jR(n,i);break}default:n._err(i,sn.endTagWithoutMatchingOpenElement)}}function _H(n,i){n._insertFakeElement(Pt.BODY,W.BODY),n.insertionMode=ct.IN_BODY,ace(n,i)}function ace(n,i){switch(i.type){case ha.CHARACTER:{uXt(n,i);break}case ha.WHITESPACE_CHARACTER:{cXt(n,i);break}case ha.COMMENT:{gLe(n,i);break}case ha.START_TAG:{Vp(n,i);break}case ha.END_TAG:{cce(n,i);break}case ha.EOF:{hXt(n,i);break}}}function cXt(n,i){n._reconstructActiveFormattingElements(),n._insertCharacters(i)}function uXt(n,i){n._reconstructActiveFormattingElements(),n._insertCharacters(i),n.framesetOk=!1}function Ysr(n,i){n.openElements.tmplCount===0&&n.treeAdapter.adoptAttributes(n.openElements.items[0],i.attrs)}function Jsr(n,i){const s=n.openElements.tryPeekProperlyNestedBodyElement();s&&n.openElements.tmplCount===0&&(n.framesetOk=!1,n.treeAdapter.adoptAttributes(s,i.attrs))}function Xsr(n,i){const s=n.openElements.tryPeekProperlyNestedBodyElement();n.framesetOk&&s&&(n.treeAdapter.detachNode(s),n.openElements.popAllUpToHtmlElement(),n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_FRAMESET)}function Zsr(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML)}function Qsr(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n.openElements.currentTagId!==void 0&&pLe.has(n.openElements.currentTagId)&&n.openElements.pop(),n._insertElement(i,Fn.HTML)}function ear(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML),n.skipNextNewLine=!0,n.framesetOk=!1}function tar(n,i){const s=n.openElements.tmplCount>0;(!n.formElement||s)&&(n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML),s||(n.formElement=n.openElements.current))}function nar(n,i){n.framesetOk=!1;const s=i.tagID;for(let c=n.openElements.stackTop;c>=0;c--){const d=n.openElements.tagIDs[c];if(s===W.LI&&d===W.LI||(s===W.DD||s===W.DT)&&(d===W.DD||d===W.DT)){n.openElements.generateImpliedEndTagsWithExclusion(d),n.openElements.popUntilTagNamePopped(d);break}if(d!==W.ADDRESS&&d!==W.DIV&&d!==W.P&&n._isSpecialElement(n.openElements.items[c],d))break}n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML)}function rar(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML),n.tokenizer.state=sb.PLAINTEXT}function iar(n,i){n.openElements.hasInScope(W.BUTTON)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(W.BUTTON)),n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML),n.framesetOk=!1}function oar(n,i){const s=n.activeFormattingElements.getElementEntryInScopeWithTagName(Pt.A);s&&(p9e(n,i),n.openElements.remove(s.element),n.activeFormattingElements.removeEntry(s)),n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML),n.activeFormattingElements.pushElement(n.openElements.current,i)}function sar(n,i){n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML),n.activeFormattingElements.pushElement(n.openElements.current,i)}function aar(n,i){n._reconstructActiveFormattingElements(),n.openElements.hasInScope(W.NOBR)&&(p9e(n,i),n._reconstructActiveFormattingElements()),n._insertElement(i,Fn.HTML),n.activeFormattingElements.pushElement(n.openElements.current,i)}function car(n,i){n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML),n.activeFormattingElements.insertMarker(),n.framesetOk=!1}function uar(n,i){n.treeAdapter.getDocumentMode(n.document)!==yw.QUIRKS&&n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._insertElement(i,Fn.HTML),n.framesetOk=!1,n.insertionMode=ct.IN_TABLE}function lXt(n,i){n._reconstructActiveFormattingElements(),n._appendElement(i,Fn.HTML),n.framesetOk=!1,i.ackSelfClosing=!0}function dXt(n){const i=ZJt(n,iR.TYPE);return i!=null&&i.toLowerCase()===ksr}function lar(n,i){n._reconstructActiveFormattingElements(),n._appendElement(i,Fn.HTML),dXt(i)||(n.framesetOk=!1),i.ackSelfClosing=!0}function dar(n,i){n._appendElement(i,Fn.HTML),i.ackSelfClosing=!0}function far(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._appendElement(i,Fn.HTML),n.framesetOk=!1,i.ackSelfClosing=!0}function har(n,i){i.tagName=Pt.IMG,i.tagID=W.IMG,lXt(n,i)}function par(n,i){n._insertElement(i,Fn.HTML),n.skipNextNewLine=!0,n.tokenizer.state=sb.RCDATA,n.originalInsertionMode=n.insertionMode,n.framesetOk=!1,n.insertionMode=ct.TEXT}function gar(n,i){n.openElements.hasInButtonScope(W.P)&&n._closePElement(),n._reconstructActiveFormattingElements(),n.framesetOk=!1,n._switchToTextParsing(i,sb.RAWTEXT)}function bar(n,i){n.framesetOk=!1,n._switchToTextParsing(i,sb.RAWTEXT)}function N$t(n,i){n._switchToTextParsing(i,sb.RAWTEXT)}function mar(n,i){n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML),n.framesetOk=!1,n.insertionMode=n.insertionMode===ct.IN_TABLE||n.insertionMode===ct.IN_CAPTION||n.insertionMode===ct.IN_TABLE_BODY||n.insertionMode===ct.IN_ROW||n.insertionMode===ct.IN_CELL?ct.IN_SELECT_IN_TABLE:ct.IN_SELECT}function war(n,i){n.openElements.currentTagId===W.OPTION&&n.openElements.pop(),n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML)}function yar(n,i){n.openElements.hasInScope(W.RUBY)&&n.openElements.generateImpliedEndTags(),n._insertElement(i,Fn.HTML)}function Ear(n,i){n.openElements.hasInScope(W.RUBY)&&n.openElements.generateImpliedEndTagsWithExclusion(W.RTC),n._insertElement(i,Fn.HTML)}function Sar(n,i){n._reconstructActiveFormattingElements(),iXt(i),h9e(i),i.selfClosing?n._appendElement(i,Fn.MATHML):n._insertElement(i,Fn.MATHML),i.ackSelfClosing=!0}function Tar(n,i){n._reconstructActiveFormattingElements(),oXt(i),h9e(i),i.selfClosing?n._appendElement(i,Fn.SVG):n._insertElement(i,Fn.SVG),i.ackSelfClosing=!0}function C$t(n,i){n._reconstructActiveFormattingElements(),n._insertElement(i,Fn.HTML)}function Vp(n,i){switch(i.tagID){case W.I:case W.S:case W.B:case W.U:case W.EM:case W.TT:case W.BIG:case W.CODE:case W.FONT:case W.SMALL:case W.STRIKE:case W.STRONG:{sar(n,i);break}case W.A:{oar(n,i);break}case W.H1:case W.H2:case W.H3:case W.H4:case W.H5:case W.H6:{Qsr(n,i);break}case W.P:case W.DL:case W.OL:case W.UL:case W.DIV:case W.DIR:case W.NAV:case W.MAIN:case W.MENU:case W.ASIDE:case W.CENTER:case W.FIGURE:case W.FOOTER:case W.HEADER:case W.HGROUP:case W.DIALOG:case W.DETAILS:case W.ADDRESS:case W.ARTICLE:case W.SEARCH:case W.SECTION:case W.SUMMARY:case W.FIELDSET:case W.BLOCKQUOTE:case W.FIGCAPTION:{Zsr(n,i);break}case W.LI:case W.DD:case W.DT:{nar(n,i);break}case W.BR:case W.IMG:case W.WBR:case W.AREA:case W.EMBED:case W.KEYGEN:{lXt(n,i);break}case W.HR:{far(n,i);break}case W.RB:case W.RTC:{yar(n,i);break}case W.RT:case W.RP:{Ear(n,i);break}case W.PRE:case W.LISTING:{ear(n,i);break}case W.XMP:{gar(n,i);break}case W.SVG:{Tar(n,i);break}case W.HTML:{Ysr(n,i);break}case W.BASE:case W.LINK:case W.META:case W.STYLE:case W.TITLE:case W.SCRIPT:case W.BGSOUND:case W.BASEFONT:case W.TEMPLATE:{zv(n,i);break}case W.BODY:{Jsr(n,i);break}case W.FORM:{tar(n,i);break}case W.NOBR:{aar(n,i);break}case W.MATH:{Sar(n,i);break}case W.TABLE:{uar(n,i);break}case W.INPUT:{lar(n,i);break}case W.PARAM:case W.TRACK:case W.SOURCE:{dar(n,i);break}case W.IMAGE:{har(n,i);break}case W.BUTTON:{iar(n,i);break}case W.APPLET:case W.OBJECT:case W.MARQUEE:{car(n,i);break}case W.IFRAME:{bar(n,i);break}case W.SELECT:{mar(n,i);break}case W.OPTION:case W.OPTGROUP:{war(n,i);break}case W.NOEMBED:case W.NOFRAMES:{N$t(n,i);break}case W.FRAMESET:{Xsr(n,i);break}case W.TEXTAREA:{par(n,i);break}case W.NOSCRIPT:{n.options.scriptingEnabled?N$t(n,i):C$t(n,i);break}case W.PLAINTEXT:{rar(n,i);break}case W.COL:case W.TH:case W.TD:case W.TR:case W.HEAD:case W.FRAME:case W.TBODY:case W.TFOOT:case W.THEAD:case W.CAPTION:case W.COLGROUP:break;default:C$t(n,i)}}function Aar(n,i){if(n.openElements.hasInScope(W.BODY)&&(n.insertionMode=ct.AFTER_BODY,n.options.sourceCodeLocationInfo)){const s=n.openElements.tryPeekProperlyNestedBodyElement();s&&n._setEndLocation(s,i)}}function _ar(n,i){n.openElements.hasInScope(W.BODY)&&(n.insertionMode=ct.AFTER_BODY,EXt(n,i))}function xar(n,i){const s=i.tagID;n.openElements.hasInScope(s)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(s))}function kar(n){const i=n.openElements.tmplCount>0,{formElement:s}=n;i||(n.formElement=null),(s||i)&&n.openElements.hasInScope(W.FORM)&&(n.openElements.generateImpliedEndTags(),i?n.openElements.popUntilTagNamePopped(W.FORM):s&&n.openElements.remove(s))}function Nar(n){n.openElements.hasInButtonScope(W.P)||n._insertFakeElement(Pt.P,W.P),n._closePElement()}function Car(n){n.openElements.hasInListItemScope(W.LI)&&(n.openElements.generateImpliedEndTagsWithExclusion(W.LI),n.openElements.popUntilTagNamePopped(W.LI))}function Iar(n,i){const s=i.tagID;n.openElements.hasInScope(s)&&(n.openElements.generateImpliedEndTagsWithExclusion(s),n.openElements.popUntilTagNamePopped(s))}function Rar(n){n.openElements.hasNumberedHeaderInScope()&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilNumberedHeaderPopped())}function Oar(n,i){const s=i.tagID;n.openElements.hasInScope(s)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(s),n.activeFormattingElements.clearToLastMarker())}function Dar(n){n._reconstructActiveFormattingElements(),n._insertFakeElement(Pt.BR,W.BR),n.openElements.pop(),n.framesetOk=!1}function fXt(n,i){const s=i.tagName,c=i.tagID;for(let d=n.openElements.stackTop;d>0;d--){const g=n.openElements.items[d],b=n.openElements.tagIDs[d];if(c===b&&(c!==W.UNKNOWN||n.treeAdapter.getTagName(g)===s)){n.openElements.generateImpliedEndTagsWithExclusion(c),n.openElements.stackTop>=d&&n.openElements.shortenToLength(d);break}if(n._isSpecialElement(g,b))break}}function cce(n,i){switch(i.tagID){case W.A:case W.B:case W.I:case W.S:case W.U:case W.EM:case W.TT:case W.BIG:case W.CODE:case W.FONT:case W.NOBR:case W.SMALL:case W.STRIKE:case W.STRONG:{p9e(n,i);break}case W.P:{Nar(n);break}case W.DL:case W.UL:case W.OL:case W.DIR:case W.DIV:case W.NAV:case W.PRE:case W.MAIN:case W.MENU:case W.ASIDE:case W.BUTTON:case W.CENTER:case W.FIGURE:case W.FOOTER:case W.HEADER:case W.HGROUP:case W.DIALOG:case W.ADDRESS:case W.ARTICLE:case W.DETAILS:case W.SEARCH:case W.SECTION:case W.SUMMARY:case W.LISTING:case W.FIELDSET:case W.BLOCKQUOTE:case W.FIGCAPTION:{xar(n,i);break}case W.LI:{Car(n);break}case W.DD:case W.DT:{Iar(n,i);break}case W.H1:case W.H2:case W.H3:case W.H4:case W.H5:case W.H6:{Rar(n);break}case W.BR:{Dar(n);break}case W.BODY:{Aar(n,i);break}case W.HTML:{_ar(n,i);break}case W.FORM:{kar(n);break}case W.APPLET:case W.OBJECT:case W.MARQUEE:{Oar(n,i);break}case W.TEMPLATE:{jR(n,i);break}default:fXt(n,i)}}function hXt(n,i){n.tmplInsertionModeStack.length>0?vXt(n,i):g9e(n,i)}function Lar(n,i){var s;i.tagID===W.SCRIPT&&((s=n.scriptHandler)===null||s===void 0||s.call(n,n.openElements.current)),n.openElements.pop(),n.insertionMode=n.originalInsertionMode}function Mar(n,i){n._err(i,sn.eofInElementThatCanContainOnlyText),n.openElements.pop(),n.insertionMode=n.originalInsertionMode,n.onEof(i)}function QOe(n,i){if(n.openElements.currentTagId!==void 0&&sXt.has(n.openElements.currentTagId))switch(n.pendingCharacterTokens.length=0,n.hasNonWhitespacePendingCharacterToken=!1,n.originalInsertionMode=n.insertionMode,n.insertionMode=ct.IN_TABLE_TEXT,i.type){case ha.CHARACTER:{gXt(n,i);break}case ha.WHITESPACE_CHARACTER:{pXt(n,i);break}}else Vz(n,i)}function Par(n,i){n.openElements.clearBackToTableContext(),n.activeFormattingElements.insertMarker(),n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_CAPTION}function jar(n,i){n.openElements.clearBackToTableContext(),n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_COLUMN_GROUP}function Far(n,i){n.openElements.clearBackToTableContext(),n._insertFakeElement(Pt.COLGROUP,W.COLGROUP),n.insertionMode=ct.IN_COLUMN_GROUP,b9e(n,i)}function $ar(n,i){n.openElements.clearBackToTableContext(),n._insertElement(i,Fn.HTML),n.insertionMode=ct.IN_TABLE_BODY}function Bar(n,i){n.openElements.clearBackToTableContext(),n._insertFakeElement(Pt.TBODY,W.TBODY),n.insertionMode=ct.IN_TABLE_BODY,uce(n,i)}function Uar(n,i){n.openElements.hasInTableScope(W.TABLE)&&(n.openElements.popUntilTagNamePopped(W.TABLE),n._resetInsertionMode(),n._processStartTag(i))}function Har(n,i){dXt(i)?n._appendElement(i,Fn.HTML):Vz(n,i),i.ackSelfClosing=!0}function zar(n,i){!n.formElement&&n.openElements.tmplCount===0&&(n._insertElement(i,Fn.HTML),n.formElement=n.openElements.current,n.openElements.pop())}function DM(n,i){switch(i.tagID){case W.TD:case W.TH:case W.TR:{Bar(n,i);break}case W.STYLE:case W.SCRIPT:case W.TEMPLATE:{zv(n,i);break}case W.COL:{Far(n,i);break}case W.FORM:{zar(n,i);break}case W.TABLE:{Uar(n,i);break}case W.TBODY:case W.TFOOT:case W.THEAD:{$ar(n,i);break}case W.INPUT:{Har(n,i);break}case W.CAPTION:{Par(n,i);break}case W.COLGROUP:{jar(n,i);break}default:Vz(n,i)}}function gz(n,i){switch(i.tagID){case W.TABLE:{n.openElements.hasInTableScope(W.TABLE)&&(n.openElements.popUntilTagNamePopped(W.TABLE),n._resetInsertionMode());break}case W.TEMPLATE:{jR(n,i);break}case W.BODY:case W.CAPTION:case W.COL:case W.COLGROUP:case W.HTML:case W.TBODY:case W.TD:case W.TFOOT:case W.TH:case W.THEAD:case W.TR:break;default:Vz(n,i)}}function Vz(n,i){const s=n.fosterParentingEnabled;n.fosterParentingEnabled=!0,ace(n,i),n.fosterParentingEnabled=s}function pXt(n,i){n.pendingCharacterTokens.push(i)}function gXt(n,i){n.pendingCharacterTokens.push(i),n.hasNonWhitespacePendingCharacterToken=!0}function VU(n,i){let s=0;if(n.hasNonWhitespacePendingCharacterToken)for(;s0&&n.openElements.currentTagId===W.OPTION&&n.openElements.tagIDs[n.openElements.stackTop-1]===W.OPTGROUP&&n.openElements.pop(),n.openElements.currentTagId===W.OPTGROUP&&n.openElements.pop();break}case W.OPTION:{n.openElements.currentTagId===W.OPTION&&n.openElements.pop();break}case W.SELECT:{n.openElements.hasInSelectScope(W.SELECT)&&(n.openElements.popUntilTagNamePopped(W.SELECT),n._resetInsertionMode());break}case W.TEMPLATE:{jR(n,i);break}}}function Yar(n,i){const s=i.tagID;s===W.CAPTION||s===W.TABLE||s===W.TBODY||s===W.TFOOT||s===W.THEAD||s===W.TR||s===W.TD||s===W.TH?(n.openElements.popUntilTagNamePopped(W.SELECT),n._resetInsertionMode(),n._processStartTag(i)):wXt(n,i)}function Jar(n,i){const s=i.tagID;s===W.CAPTION||s===W.TABLE||s===W.TBODY||s===W.TFOOT||s===W.THEAD||s===W.TR||s===W.TD||s===W.TH?n.openElements.hasInTableScope(s)&&(n.openElements.popUntilTagNamePopped(W.SELECT),n._resetInsertionMode(),n.onEndTag(i)):yXt(n,i)}function Xar(n,i){switch(i.tagID){case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:case W.NOFRAMES:case W.SCRIPT:case W.STYLE:case W.TEMPLATE:case W.TITLE:{zv(n,i);break}case W.CAPTION:case W.COLGROUP:case W.TBODY:case W.TFOOT:case W.THEAD:{n.tmplInsertionModeStack[0]=ct.IN_TABLE,n.insertionMode=ct.IN_TABLE,DM(n,i);break}case W.COL:{n.tmplInsertionModeStack[0]=ct.IN_COLUMN_GROUP,n.insertionMode=ct.IN_COLUMN_GROUP,b9e(n,i);break}case W.TR:{n.tmplInsertionModeStack[0]=ct.IN_TABLE_BODY,n.insertionMode=ct.IN_TABLE_BODY,uce(n,i);break}case W.TD:case W.TH:{n.tmplInsertionModeStack[0]=ct.IN_ROW,n.insertionMode=ct.IN_ROW,lce(n,i);break}default:n.tmplInsertionModeStack[0]=ct.IN_BODY,n.insertionMode=ct.IN_BODY,Vp(n,i)}}function Zar(n,i){i.tagID===W.TEMPLATE&&jR(n,i)}function vXt(n,i){n.openElements.tmplCount>0?(n.openElements.popUntilTagNamePopped(W.TEMPLATE),n.activeFormattingElements.clearToLastMarker(),n.tmplInsertionModeStack.shift(),n._resetInsertionMode(),n.onEof(i)):g9e(n,i)}function Qar(n,i){i.tagID===W.HTML?Vp(n,i):Cse(n,i)}function EXt(n,i){var s;if(i.tagID===W.HTML){if(n.fragmentContext||(n.insertionMode=ct.AFTER_AFTER_BODY),n.options.sourceCodeLocationInfo&&n.openElements.tagIDs[0]===W.HTML){n._setEndLocation(n.openElements.items[0],i);const c=n.openElements.items[1];c&&!(!((s=n.treeAdapter.getNodeSourceCodeLocation(c))===null||s===void 0)&&s.endTag)&&n._setEndLocation(c,i)}}else Cse(n,i)}function Cse(n,i){n.insertionMode=ct.IN_BODY,ace(n,i)}function ecr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.FRAMESET:{n._insertElement(i,Fn.HTML);break}case W.FRAME:{n._appendElement(i,Fn.HTML),i.ackSelfClosing=!0;break}case W.NOFRAMES:{zv(n,i);break}}}function tcr(n,i){i.tagID===W.FRAMESET&&!n.openElements.isRootHtmlElementCurrent()&&(n.openElements.pop(),!n.fragmentContext&&n.openElements.currentTagId!==W.FRAMESET&&(n.insertionMode=ct.AFTER_FRAMESET))}function ncr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.NOFRAMES:{zv(n,i);break}}}function rcr(n,i){i.tagID===W.HTML&&(n.insertionMode=ct.AFTER_AFTER_FRAMESET)}function icr(n,i){i.tagID===W.HTML?Vp(n,i):loe(n,i)}function loe(n,i){n.insertionMode=ct.IN_BODY,ace(n,i)}function ocr(n,i){switch(i.tagID){case W.HTML:{Vp(n,i);break}case W.NOFRAMES:{zv(n,i);break}}}function scr(n,i){i.chars=Ou,n._insertCharacters(i)}function acr(n,i){n._insertCharacters(i),n.framesetOk=!1}function SXt(n){for(;n.treeAdapter.getNamespaceURI(n.openElements.current)!==Fn.HTML&&n.openElements.currentTagId!==void 0&&!n._isIntegrationPoint(n.openElements.currentTagId,n.openElements.current);)n.openElements.pop()}function ccr(n,i){if(Ssr(i))SXt(n),n._startTagOutsideForeignContent(i);else{const s=n._getAdjustedCurrentElement(),c=n.treeAdapter.getNamespaceURI(s);c===Fn.MATHML?iXt(i):c===Fn.SVG&&(Tsr(i),oXt(i)),h9e(i),i.selfClosing?n._appendElement(i,c):n._insertElement(i,c),i.ackSelfClosing=!0}}function ucr(n,i){if(i.tagID===W.P||i.tagID===W.BR){SXt(n),n._endTagOutsideForeignContent(i);return}for(let s=n.openElements.stackTop;s>0;s--){const c=n.openElements.items[s];if(n.treeAdapter.getNamespaceURI(c)===Fn.HTML){n._endTagOutsideForeignContent(i);break}const d=n.treeAdapter.getTagName(c);if(d.toLowerCase()===i.tagName){i.tagName=d,n.openElements.shortenToLength(s);break}}}Pt.AREA,Pt.BASE,Pt.BASEFONT,Pt.BGSOUND,Pt.BR,Pt.COL,Pt.EMBED,Pt.FRAME,Pt.HR,Pt.IMG,Pt.INPUT,Pt.KEYGEN,Pt.LINK,Pt.META,Pt.PARAM,Pt.SOURCE,Pt.TRACK,Pt.WBR;function lcr(n,i){return aXt.parse(n,i)}function dcr(n,i,s){typeof n=="string"&&(s=i,i=n,n=null);const c=aXt.getFragmentParser(n,s);return c.tokenizer.write(i,!0),c.getFragment()}function fcr(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?I$t(n.position):"start"in n||"end"in n?I$t(n):"line"in n||"column"in n?mLe(n):""}function mLe(n){return R$t(n&&n.line)+":"+R$t(n&&n.column)}function I$t(n){return mLe(n&&n.start)+"-"+mLe(n&&n.end)}function R$t(n){return n&&typeof n=="number"?n:1}class Yg extends Error{constructor(i,s,c){super(),typeof s=="string"&&(c=s,s=void 0);let d="",g={},b=!1;if(s&&("line"in s&&"column"in s?g={place:s}:"start"in s&&"end"in s?g={place:s}:"type"in s?g={ancestors:[s],place:s.position}:g={...s}),typeof i=="string"?d=i:!g.cause&&i&&(b=!0,d=i.message,g.cause=i),!g.ruleId&&!g.source&&typeof c=="string"){const E=c.indexOf(":");E===-1?g.ruleId=c:(g.source=c.slice(0,E),g.ruleId=c.slice(E+1))}if(!g.place&&g.ancestors&&g.ancestors){const E=g.ancestors[g.ancestors.length-1];E&&(g.place=E.position)}const w=g.place&&"start"in g.place?g.place.start:g.place;this.ancestors=g.ancestors||void 0,this.cause=g.cause||void 0,this.column=w?w.column:void 0,this.fatal=void 0,this.file="",this.message=d,this.line=w?w.line:void 0,this.name=fcr(g.place)||"1:1",this.place=g.place||void 0,this.reason=this.message,this.ruleId=g.ruleId||void 0,this.source=g.source||void 0,this.stack=b&&g.cause&&typeof g.cause.stack=="string"?g.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yg.prototype.file="";Yg.prototype.name="";Yg.prototype.reason="";Yg.prototype.message="";Yg.prototype.stack="";Yg.prototype.column=void 0;Yg.prototype.line=void 0;Yg.prototype.ancestors=void 0;Yg.prototype.cause=void 0;Yg.prototype.fatal=void 0;Yg.prototype.place=void 0;Yg.prototype.ruleId=void 0;Yg.prototype.source=void 0;const N2={basename:hcr,dirname:pcr,extname:gcr,join:bcr,sep:"/"};function hcr(n,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');Wz(n);let s=0,c=-1,d=n.length,g;if(i===void 0||i.length===0||i.length>n.length){for(;d--;)if(n.codePointAt(d)===47){if(g){s=d+1;break}}else c<0&&(g=!0,c=d+1);return c<0?"":n.slice(s,c)}if(i===n)return"";let b=-1,w=i.length-1;for(;d--;)if(n.codePointAt(d)===47){if(g){s=d+1;break}}else b<0&&(g=!0,b=d+1),w>-1&&(n.codePointAt(d)===i.codePointAt(w--)?w<0&&(c=d):(w=-1,c=b));return s===c?c=b:c<0&&(c=n.length),n.slice(s,c)}function pcr(n){if(Wz(n),n.length===0)return".";let i=-1,s=n.length,c;for(;--s;)if(n.codePointAt(s)===47){if(c){i=s;break}}else c||(c=!0);return i<0?n.codePointAt(0)===47?"/":".":i===1&&n.codePointAt(0)===47?"//":n.slice(0,i)}function gcr(n){Wz(n);let i=n.length,s=-1,c=0,d=-1,g=0,b;for(;i--;){const w=n.codePointAt(i);if(w===47){if(b){c=i+1;break}continue}s<0&&(b=!0,s=i+1),w===46?d<0?d=i:g!==1&&(g=1):d>-1&&(g=-1)}return d<0||s<0||g===0||g===1&&d===s-1&&d===c+1?"":n.slice(d,s)}function bcr(...n){let i=-1,s;for(;++i0&&n.codePointAt(n.length-1)===47&&(s+="/"),i?"/"+s:s}function wcr(n,i){let s="",c=0,d=-1,g=0,b=-1,w,E;for(;++b<=n.length;){if(b2){if(E=s.lastIndexOf("/"),E!==s.length-1){E<0?(s="",c=0):(s=s.slice(0,E),c=s.length-1-s.lastIndexOf("/")),d=b,g=0;continue}}else if(s.length>0){s="",c=0,d=b,g=0;continue}}i&&(s=s.length>0?s+"/..":"..",c=2)}else s.length>0?s+="/"+n.slice(d+1,b):s=n.slice(d+1,b),c=b-d-1;d=b,g=0}else w===46&&g>-1?g++:g=-1}return s}function Wz(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const ycr={cwd:vcr};function vcr(){return"/"}function wLe(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Ecr(n){if(typeof n=="string")n=new URL(n);else if(!wLe(n)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(n.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return Scr(n)}function Scr(n){if(n.hostname!==""){const c=new TypeError('File URL host must be "localhost" or empty on darwin');throw c.code="ERR_INVALID_FILE_URL_HOST",c}const i=n.pathname;let s=-1;for(;++s`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `` in ``",description:"Unexpected text character `%c`. Only use text in `