From c799f557039cec9193ec8d2a9d128b86c841d186 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 6 Feb 2025 14:41:17 +0200 Subject: [PATCH 001/149] Change menu colors a bit to make clearer in web terminal --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc index 21fd218..78fba41 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc @@ -28,3 +28,6 @@ form_item_readonly_color = (BLUE,WHITE,ON) # Item help-text color itemhelp_color = (BLACK,BLUE,OFF) + +# Selected tag color (menu items) +tag_selected_color = (WHITE,BLUE,ON) From ca229397013e4400f8c35ffa888a674226b29fd2 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 6 Feb 2025 14:44:06 +0200 Subject: [PATCH 002/149] Update .dialogrc --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc index 78fba41..1774a38 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc @@ -31,3 +31,6 @@ itemhelp_color = (BLACK,BLUE,OFF) # Selected tag color (menu items) tag_selected_color = (WHITE,BLUE,ON) + +# Tag color (menu items) +tag_color = (BLACK,WHITE,OFF) From e0cb49db403fac344d8532a27a361f43aa1bdccb Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 6 Feb 2025 15:10:34 +0200 Subject: [PATCH 003/149] Tidy up install wizard --- .../usr/local/bin/femto-install-wizard.sh | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index f316916..fac8fc8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -16,25 +16,24 @@ loading() { title="Install Wizard" wizard() { - femto-set-time.sh - new_hostname=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - femto-network-config.sh -n "$new_hostname" - dialog --title "$title" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40 - fi - - dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure Wi-Fi settings?" 8 40 + dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure network settings?" 8 40 if [ $? -eq 0 ]; then #unless cancel/no + new_hostname=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then #unless cancel/no + femto-network-config.sh -n "$new_hostname" + dialog --title "$title" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40 + fi + femto-config -w fi - femto-config -l #set lora radio model - dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure Meshtastic?" 8 40 if [ $? -eq 0 ]; then #unless cancel/no - newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) + femto-config -l #set lora radio model + + newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered loading "Sending URL..." dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 @@ -70,7 +69,6 @@ wizard() { dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 fi - key=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3) if [ -n "$key" ]; then #if a URL was entered loading "Sending key..." @@ -116,7 +114,7 @@ wizard() { } dialog --title "$title" --yesno "\ -The install wizard will allow you to configure all the settings necessary to run your Femtofox.\n\ +The install wizard will allow you to configure all the basic settings necessary to run your Femtofox.\n\ \n\ Running this wizard will overwrite some current settings.\n\n\ Proceed?" 13 50 From a66a97e2a92a911d96f7ae40fff7ffbec395b5cf Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 6 Feb 2025 18:07:18 +0200 Subject: [PATCH 004/149] Disable daily unattended upgrade that somehow got disabled --- environment-setup/femtofox.chroot | 1 + 1 file changed, 1 insertion(+) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 2f51999..3acbe42 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -62,6 +62,7 @@ systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable wifi-mesh-control +systemctl disable apt-daily.timer systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu systemctl disable NetworkManager From 7ab27dabbd55ed9215905a606009ecfb3d3b0330 Mon Sep 17 00:00:00 2001 From: joshbowyer <37744796+joshbowyer@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:46:17 -0600 Subject: [PATCH 005/149] Create rv1106-luckfox-pico-ultra-ipc.dtsi Fix SPI pin conflict for Ultra W --- .../dts/rv1106-luckfox-pico-ultra-ipc.dtsi | 538 ++++++++++++++++++ 1 file changed, 538 insertions(+) create mode 100644 foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi new file mode 100644 index 0000000..4e90c76 --- /dev/null +++ b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi @@ -0,0 +1,538 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +#include "rv1106-evb.dtsi" +#include +#include + +/ { + chosen { + bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; + }; + + backlight: backlight { + status = "okay"; + compatible = "pwm-backlight"; + pwms = <&pwm1 0 100000 50000>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <255>; + }; + + panel: panel { + compatible = "simple-panel"; + backlight = <&backlight>; + + reset-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>; + reset-delay-ms = <200>; + status = "okay"; + + bus-format = ; + width-mm = <85>; + height-mm = <85>; + + display-timings { + native-mode = <&timing0>; + + timing0: timing0 { + clock-frequency = <30000000>; + hactive = <720>; + vactive = <720>; + hback-porch = <44>; + hfront-porch = <46>; + vback-porch = <18>; + vfront-porch = <16>; + hsync-len = <2>; + vsync-len = <2>; + hsync-active = <0>; + vsync-active = <0>; + de-active = <0>; + pixelclk-active = <0>; + }; + }; + + port { + panel_in_rgb: endpoint { + remote-endpoint = <&rgb_out_panel>; + }; + }; + }; + + reserved_memory: reserved-memory { + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + drm_logo: drm-logo@00000000 { + compatible = "rockchip,drm-logo"; + reg = <0x0 0x0>; + }; + linux,cma { + status = "okay"; + compatible = "shared-dma-pool"; + inactive; + reusable; + size = <0xA00000>; //10M + linux,cma-default; + }; + mmc_ecsd: mmc@3f000 { + reg = <0x3f000 0x00001000>; + }; + }; + + acodec_sound: acodec-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rv1106-acodec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&acodec>; + }; + }; + + dsm_sound: dsm-sound { + status = "disabled"; + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "rockchip,dsm-sound"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + sndcpu: simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + sndcodec: simple-audio-card,codec { + sound-dai = <&dsm>; + }; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vcc_3v3: vcc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vdd_arm: vdd-arm { + compatible = "regulator-fixed"; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1000000>; + regulator-init-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + }; + + leds: leds { + compatible = "gpio-leds"; + work_led: work{ + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "activity"; + default-state = "on"; + }; + }; +}; + +/***************************** audio ********************************/ +&i2s0_8ch { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&acodec { + #sound-dai-cells = <0>; + pa-ctl-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +/************************* FIQ_DUBUGGER ****************************/ +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/***************************** USB *********************************/ +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usbdrd { + status = "okay"; +}; + +&usbdrd_dwc3 { + extcon = <&u2phy>; + status = "okay"; +}; + +/***************************** DSM *********************************/ +&dsm { + status = "disabled"; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +/*************************** CSI *********************************/ +&csi2_dphy_hw { + status = "okay"; +}; + +&csi2_dphy0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_input0: endpoint@0 { + reg = <0>; + remote-endpoint = <&sc3336_out>; + data-lanes = <1 2>; + }; + + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_csi2_input>; + }; + }; + }; +}; + +&i2c4 { + status = "okay"; + clock-frequency = <400000>; + pinctrl-names = "default"; + // pinctrl-0 = <&i2c4m2_xfer>; + + sc3336: sc3336@30 { + compatible = "smartsens,sc3336"; + status = "okay"; + reg = <0x30>; + clocks = <&cru MCLK_REF_MIPI0>; + clock-names = "xvclk"; + reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mipi_refclk_out0>; + rockchip,camera-module-index = <0>; + rockchip,camera-module-facing = "back"; + rockchip,camera-module-name = "CMK-OT2119-PC1"; + rockchip,camera-module-lens-name = "30IRC-F16"; + port { + sc3336_out: endpoint { + remote-endpoint = <&csi_dphy_input0>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&mipi0_csi2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_input: endpoint@1 { + reg = <1>; + remote-endpoint = <&csi_dphy_output>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&cif_mipi_in>; + }; + }; + }; +}; + +&rkcif { + status = "okay"; +}; + +&rkcif_mipi_lvds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&mipi_pins>; + port { + /* MIPI CSI-2 endpoint */ + cif_mipi_in: endpoint { + remote-endpoint = <&mipi_csi2_output>; + }; + }; +}; + +&rkcif_mipi_lvds_sditf { + status = "okay"; + + port { + /* MIPI CSI-2 endpoint */ + mipi_lvds_sditf: endpoint { + remote-endpoint = <&isp_in>; + }; + }; +}; + +&rkisp { + status = "okay"; +}; + +&rkisp_vir0 { + status = "okay"; + + port@0 { + isp_in: endpoint { + remote-endpoint = <&mipi_lvds_sditf>; + }; + }; +}; + +/***************************** ADC ********************************/ +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&tsadc { + status = "okay"; +}; + +/**************************** LCD/TP ******************************/ +&pwm1 { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm1m2_pins>; +}; + +&display_subsystem { + status = "okay"; + logo-memory-region = <&drm_logo>; +}; + +&rgb { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&lcd_pins>; + + ports { + rgb_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + rgb_out_panel: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_in_rgb>; + }; + }; + }; +}; + +&rgb_in_vop { + status = "okay"; +}; + +&route_rgb { + status = "disabled"; +}; + +&vop { + status = "okay"; +}; + +&i2c3 { + clock-frequency = <100000>; + GT911:touchscreen { + compatible = "goodix,gt911"; + reg = <0x14>; + + interrupt-parent = <&gpio0>; + interrupts = ; + + reset-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + }; +}; + +/**************************** PINCTRL ******************************/ +// SPI +&spi0 { + pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "rockchip,spidev"; + spi-max-frequency = <50000000>; + reg = <0>; + }; +}; + +// I2C +&i2c1 { + pinctrl-0 = <&i2c1m1_xfer>; +}; +&i2c2 { + pinctrl-0 = <&i2c2m0_xfer>; +}; +&i2c3 { + pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer &tp_rst &tp_irq>; +}; +&i2c4 { + pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; +}; + +// UART +&uart0 { + pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; +}; +&uart1 { + pinctrl-0 = <&uart1m1_xfer>; +}; +&uart3 { + pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; +}; +&uart4 { + pinctrl-0 = <&uart4m0_xfer>; +}; +&uart5 { + pinctrl-0 = <&uart5m1_xfer>; +}; + +// PWM +&pwm0 { + pinctrl-0 = <&pwm0m1_pins>; +}; +&pwm2 { + pinctrl-0 = <&pwm2m1_pins &pwm2m2_pins>; +}; +&pwm3 { + pinctrl-0 = <&pwm3m2_pins>; +}; +&pwm4 { + pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; +}; +&pwm5 { + pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; +}; +&pwm6 { + pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; +}; +&pwm7 { + pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; +}; +&pwm8 { + pinctrl-0 = <&pwm8m1_pins>; +}; +&pwm9 { + pinctrl-0 = <&pwm9m1_pins>; +}; +&pwm10 { + pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; +}; +&pwm11 { + pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; +}; + +&pinctrl { + spi0 { + spi0m0_clk: spi0m0-clk { + rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; + }; + spi0m0_mosi: spi0m0-mosi { + rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; + }; + spi0m0_miso: spi0m0-miso { + rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; + }; + spi0m0_cs0: spi0m0-cs0 { + rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; + }; + }; + + touchscreen { + tp_rst:tp-rst { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + tp_irq:tp-irq { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; From f5a73030462a1ec4288b1a801dbbe742e98118da Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 00:59:38 +0200 Subject: [PATCH 006/149] Improve wizard and set-time UX --- .../usr/local/bin/femto-config | 72 +++++++++++-------- .../usr/local/bin/femto-install-wizard.sh | 66 +++++------------ .../usr/local/bin/femto-set-time.sh | 28 ++++---- 3 files changed, 76 insertions(+), 90 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 3f95a0f..98d52d3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -425,12 +425,48 @@ set_lora_radio() { done } +legacy_admin() { + choice="" # zero the choice before loading the submenu + while true; do + loading "Getting current legacy admin state..." + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + 1 "Enable" "" \ + 2 "Disable (default)" "" \ + " " "" "" \ + 3 "Return to previous menu" "" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "System info help" --msgbox "For Meshtastic versions 2.4.x and earlier, remote admin is achieved by creating a secondary channel named admin with a shared PSK. In this setup, messages exchanged on this channel are encrypted only with the channel's PSK, allowing any node in the channel to administer others.\n\nFor more information:\nhttps://meshtastic.org/docs/configuration/remote-admin/\n" 0 0 + else + case $choice in + 1) # enable legacy admin) + dialog --no-collapse --title "Legacy Admin" --yesno "Enable legacy admin channel?\n" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "true" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ;; + 2) # disable legacy admin) + dialog --no-collapse --title "Legacy Admin" --yesno "Disable legacy admin channel?\n" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "false" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ;; + 3) break ;; + esac + fi + done +} + # Function to handle Meshtasticd settings meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 20 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ 1 "View node info" "" \ 2 "View configuration URL & QR code" "" \ 3 "Set new configuration URL" "" \ @@ -532,33 +568,7 @@ meshtastic_settings() { fi ;; 6) # legacy admin) - choice="" # zero the choice before loading the submenu - while true; do - loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --item-help --menu "Current state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 12 40 5 \ - 1 "Enable" "" \ - 2 "Disable (default)" "" \ - " " "" "" \ - 3 "Return to previous menu" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - case $choice in - 1) # enable legacy admin) - dialog --no-collapse --title "Legacy Admin" --yesno "Enable legacy admin channel?\n" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "true" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 2) # disable legacy admin) - dialog --no-collapse --title "Legacy Admin" --yesno "Disable legacy admin channel?\n" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Legacy admin" --msgbox "$(femto-meshtasticd-config.sh -o "false" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 3) break ;; - esac - done + legacy_admin ;; 7) # return to previous menu) break @@ -715,9 +725,10 @@ help="If script is run without arguments, femto-config menu will load.\n\ Options are:\n\ -h This message\n\ -l Set LoRa radio model menu\n\ +-L Meshtastic legacy admin menu\n\ -w Set Wi-Fi config menu\ " -while getopts ":hlwL:i" opt; do +while getopts ":hlwLi" opt; do case ${opt} in h) # Option -h (help) echo -e $help @@ -725,6 +736,9 @@ while getopts ":hlwL:i" opt; do l) # Option -l (set lora radio) set_lora_radio ;; + L) # Option -L (Meshtastic legacy admin menu) + legacy_admin + ;; w) # Option -w (Wi-Fi config) wifi_config ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index fac8fc8..bebd104 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -16,29 +16,32 @@ loading() { title="Install Wizard" wizard() { + femto-set-time.sh - dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure network settings?" 8 40 + new_hostname=$(dialog --title "Hostname" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then #unless cancel/no + femto-network-config.sh -n "$new_hostname" + dialog --title "Hostname" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40 + fi + + dialog --title "$title" --cancel-label "Skip" --yesno "Configure Wi-Fi settings?" 6 40 if [ $? -eq 0 ]; then #unless cancel/no - new_hostname=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter hostname:" 8 40 $(hostname) 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - femto-network-config.sh -n "$new_hostname" - dialog --title "$title" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40 - fi - femto-config -w fi - dialog --title "$title" --cancel-label "Skip" --yesno "\nConfigure Meshtastic?" 8 40 + dialog --title "$title" --cancel-label "Skip" --yesno "Configure Meshtastic?" 6 40 if [ $? -eq 0 ]; then #unless cancel/no + femto-config -l #set lora radio model - newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered loading "Sending URL..." dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 fi + # public key loading "Getting current public key..." key=$(femto-meshtasticd-config.sh -u) if [ -n "$key" ]; then @@ -54,6 +57,7 @@ wizard() { dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 fi + # private key loading "Getting current private key..." key=$(femto-meshtasticd-config.sh -u) if [ -n "$key" ]; then @@ -69,55 +73,23 @@ wizard() { dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 fi - key=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3) + key=$(dialog --title "Meshtastic admin key" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3) if [ -n "$key" ]; then #if a URL was entered loading "Sending key..." dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 fi - dialog --no-collapse --infobox "Getting current legacy admin state..." 5 45 - state=$(sudo femto-meshtasticd-config.sh -p) - if echo "$state" | grep -q "enabled"; then # poor man's replace ansi colors - state="\Z4enabled\Zn" - elif echo "$state" | grep -q "disabled"; then - state="\Z1disabled\Zn" - elif echo "$state" | grep -q "error"; then - state="\Z1error\Zn" - fi - while true; do - choice=$(dialog --no-collapse --colors --cancel-label "Skip" --title "Meshtasticd Legacy Admin" --menu "Current state: $state" 12 40 5 \ - 1 "Enable" \ - 2 "Disable (default)" \ - "" "" \ - 3 "Skip" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - fi - case $choice in - 1) # enable legacy admin) - dialog --no-collapse --infobox "Sending command..." 5 45 - dialog --no-collapse --colors --title "$title" --msgbox "$(femto-meshtasticd-config.sh -o "true" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - break - ;; - 2) # disable legacy admin) - dialog --no-collapse --infobox "Sending command..." 5 45 - dialog --no-collapse --colors --title "$title" --msgbox "$(femto-meshtasticd-config.sh -o "false" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - break - ;; - 3) break ;; - esac - done + femto-config -L # legacy admin menu fi - dialog --title "$title" --msgbox "\nSetup wizard complete!" 8 40 + dialog --title "$title" --msgbox "Setup wizard complete!" 6 40 } dialog --title "$title" --yesno "\ -The install wizard will allow you to configure all the basic settings necessary to run your Femtofox.\n\ +The install wizard will allow you to configure all the settings necessary to run your Femtofox.\n\ \n\ -Running this wizard will overwrite some current settings.\n\n\ -Proceed?" 13 50 +The wizard takes several minutes to complete and will overwrite some current settings.\n\n\ +Proceed?" 12 60 if [ $? -eq 0 ]; then #unless cancel/no wizard fi \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index 9a94155..a734a70 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -19,15 +19,6 @@ If no argument is specified, a menu system will be used. Options are: EOF ) -log_message() { - logger $1 - if [ $arg_count -eq 0 ]; then - dialog --msgbox "$1" 12 50 - else - echo -e $1 - fi -} - set_timezone() { echo "Setting time zone..." ln -f -s /usr/share/zoneinfo/$1 /etc/localtime >/dev/null 2>&1 @@ -68,7 +59,7 @@ done if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, then load the UI. echo "Loading current time settings..." current_timezone=$(timedatectl show --property=Timezone --value) - dialog --no-collapse --title "$title" --yesno "Current system time: $(date +"%H:%M:%S")\nCurrent time zone: $current_timezone ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n$(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\nSet new time and timezone?" 10 60 + dialog --no-collapse --title "System time" --yesno "Current system time: $(date +"%H:%M:%S")\nCurrent time zone: $current_timezone ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n$(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\nSet new time and timezone?" 10 60 if [ $? -eq 1 ]; then #unless cancel/no exit 0 fi @@ -85,7 +76,7 @@ if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, th options_str=$(printf '%s\n' "${options[@]}") # Show timezone selection menu with preselection of current timezone - selected_timezone=$(dialog --title "Select Time Zone" \ + selected_timezone=$(dialog --title "Set Time Zone" \ --default-item "$current_timezone" \ --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 60 10 \ $(printf "%s " "${options[@]}") 3>&1 1>&2 2>&3) @@ -97,7 +88,7 @@ if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, th exit 1 fi - DATE=$(dialog --title "Select Date" --calendar "Current date: $(date "+%B %d, %Y") \nPress [TAB] to select." 0 0 $(date +%d) $(date +%m) $(date +%Y) 3>&1 1>&2 2>&3) + DATE=$(dialog --title "Set Date" --calendar "Current date: $(date "+%B %d, %Y") \nPress [TAB] to select." 0 0 $(date +%d) $(date +%m) $(date +%Y) 3>&1 1>&2 2>&3) if [ $? -ne 0 ]; then exit 1 fi @@ -106,7 +97,16 @@ if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, th if [ $? -eq 1 ]; then #if cancel/no exit 1 fi - log_message "$(set_timestamp $(date -d "$DATE $TIME" +%s))" - exit $? #exit status matches set_timestamp exit status + + msg="$(set_timestamp $(date -d "$DATE $TIME" +%s))" + exit_status=$? + + logger $msg + if [ $arg_count -eq 0 ]; then + dialog --msgbox "$msg" 13 50 + else + echo -e $msg + fi + exit $exit_status #exit status matches set_timestamp exit status fi \ No newline at end of file From f4167e20d3f0752fade800978ec2474fcab491cc Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 12:41:13 +0200 Subject: [PATCH 007/149] Show install status of package in software menu --- .../usr/local/bin/femto-config | 4 ++-- .../usr/local/bin/femto-software.sh | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 98d52d3..32c584e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -170,7 +170,7 @@ networking_settings() { ;; 7) # Test internet connection) loading "Testing internet connection..." - dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 8 40 + dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 9 40 ;; 8) return @@ -751,7 +751,7 @@ done # Main menu while true; do - main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ + main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --backtitle "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ 1 "Settings wizard" "" \ 2 "Networking" "" \ 3 "Meshtastic" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 865e365..0d5955b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -120,18 +120,18 @@ package_menu() { # generate menu from filenames in /usr/local/bin/packages while true; do - menu_entries=() + menu_entries=("Package name" "Installed?" "" "") index=1 for file in /usr/local/bin/packages/*.sh; do filename=$(basename "$file" .sh) [[ "$filename" == "package_template" ]] && continue # skip package_template.sh - menu_entries+=("$index" "$(/usr/local/bin/packages/"$filename".sh -N)") - ((index++)) + menu_entries+=("$(/usr/local/bin/packages/"$filename".sh -N)" "$($package_dir/$filename.sh -I && echo "✅ " || echo "❌ ")") + ((index++)) # keeping an index to determine menu window height done menu_entries+=(" " "") # add blank line and "Back to Main Menu" entry - menu_entries+=("$index" "Back to main menu") - software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((9 + index)) 50 $((index + 1)) "${menu_entries[@]}" 3>&1 1>&2 2>&3) + menu_entries+=("Back to main menu" "") + software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((11 + index)) 50 $((index + 3)) "${menu_entries[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case_block=" case \$software_option in" @@ -140,12 +140,12 @@ while true; do filename=$(basename "$file" .sh) [[ "$filename" == "package_template" ]] && continue # skip package_template.sh case_block+=" - $index) package_intro \"$filename\" ;;" + \"$(/usr/local/bin/packages/"$filename".sh -N)\") package_intro \"$filename\" ;;" ((index++)) done case_block+=" - $index) break ;; + \"Back to main menu\") break ;; esac" #add return to main menu option eval "$case_block" # Execute the generated case statement done From 0672889f8e5cb72057f7282ca4be5bab0b4ca536 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:40:17 +0200 Subject: [PATCH 008/149] Update LICENSE This changes the Foxbuntu license to GPL3 --- LICENSE | 685 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 685 insertions(+) diff --git a/LICENSE b/LICENSE index 0c1e457..4b70b42 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,10 @@ +Femtofox is comprised of two projects, with two different licenses: +1. Femtofox - the hardware, which is licensed "CC BY-NC-ND - noncommercial". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox. +2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source. + +See below for the full license texts. + + Hardware (Femtofox) license: Summary: Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes . @@ -408,3 +415,681 @@ the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. + + + + Software (Foxbuntu) license: + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 07e387f1e02301a9f7eba489c0f242cdc24b37f8 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 17:03:16 +0200 Subject: [PATCH 009/149] Change Foxbuntu license to GPL3 --- .../usr/local/bin/femto-license.sh | 33 +- .../usr/share/doc/femtofox/long_license | 694 +++++++++++++++++- 2 files changed, 708 insertions(+), 19 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh index f73c1ba..b0ed139 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh @@ -11,22 +11,19 @@ Options are: EOF ) -anykey="echo -e \"\nPress any key to continue...\n\" && read -n 1 -s -r" +pause() { + echo -e "\nPress any key to continue..." + read -n 1 -s -r +} femtofox_short_license="\ -Femtofox and Foxbuntu are published under CC BY-NC-ND - noncommercial.\n\ +Femtofox is comprised of two projects, with two different licenses:\n\ +1. Femtofox - the hardware, which is licensed \"CC BY-NC-ND - noncommercial\". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.\n\ +2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.\n\ +\n\ For more information, visit us at www.femtofox.com.\n\ \n\ -Summary:\n\ -You can share Femtofox and Foxbuntu or make modifications, but can't sell it except by arrangement (license) with us.\n\ -In this context, Foxbuntu refers to the modifications to Ubuntu made as part of the Femtofox project.\n\ -\n\ -Boilerplate:\n\ -Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.\n\ -You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.\n\ -NonCommercial — You may not use the material for commercial purposes.\n\ -NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material (for commercial purposes).\n\ -\n\ +View the long licenses for more information.\n\ Contact us to license Femtofox." meshtastic_license="\ @@ -91,7 +88,7 @@ https://www.femtofox.com\n\ u) # Option -u (Ubuntu licenses) echo "$ubuntu_license" ;; - \?) # Invalid option + \?) # Invalid option) echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 @@ -102,13 +99,13 @@ done # if no arguments, show all licenses if [ $# -eq 0 ]; then echo "$femtofox_short_license" - eval $anykey + pause echo "$(cat /usr/share/doc/femtofox/long_license)" - eval $anykey + pause echo "$meshtastic_license" - eval $anykey + pause echo "$luckfox_license" - eval $anykey + pause eval "$ubuntu_license" - eval $anykey + pause fi \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license index c2d211f..995f98e 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/femtofox/long_license @@ -1,3 +1,17 @@ +Femtofox is comprised of two projects, with two different licenses: +1. Femtofox - the hardware, which is licensed "CC BY-NC-ND - noncommercial". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox. +2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source. + +See below for the full license texts. + + Hardware (Femtofox) license: +Summary: +Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. +NonCommercial — You may not use the material for commercial purposes . +NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material. + +Contact us to license Femtofox. + The license: Attribution-NonCommercial-NoDerivatives 4.0 International @@ -400,4 +414,682 @@ understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. -Creative Commons may be contacted at creativecommons.org. \ No newline at end of file +Creative Commons may be contacted at creativecommons.org. + + + + Software (Foxbuntu) license: + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file From 038da36ccdd882f8d67e07fb2d83faf217e9f0a3 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 21:51:38 +0200 Subject: [PATCH 010/149] Refactor of parts of package manager, move ttyd to package manager, move check-service-status to utils --- .../out/rootfs_uclibc_rv1106/opt/ttyd/license | 21 -- .../usr/local/bin/femto-config | 109 +++------- .../usr/local/bin/femto-meshtasticd-config.sh | 18 +- .../usr/local/bin/femto-network-config.sh | 6 +- .../usr/local/bin/femto-runonce.sh | 2 +- .../usr/local/bin/femto-software.sh | 18 +- .../usr/local/bin/femto-utils.sh | 123 +++++++---- .../usr/local/bin/packages/meshing_around.sh | 6 +- .../bin/packages/mosquitto_mqtt_broker.sh | 6 +- .../bin/packages/mosquitto_mqtt_client.sh | 6 +- .../local/bin/packages/package_template.sh | 6 +- .../usr/local/bin/packages/samba.sh | 6 +- .../usr/local/bin/packages/tc2_bbs.sh | 6 +- .../usr/local/bin/packages/ttyd.sh | 193 ++++++++++++++++++ 14 files changed, 357 insertions(+), 169 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/license create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/license b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/license deleted file mode 100644 index 54ab6d8..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/license +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016-2025 Shuanglei Tao - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 32c584e..8636be1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -16,23 +16,6 @@ pause() { read -n 1 -s -r } -# Dialog uses a different method to display colors, and is limited to only these 8. -replace_colors() { - input="$1" - input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black - input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red - input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green - input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow - input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue - input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta - input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan - input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white - input="${input//$(echo -e '\033[7m')/\\Zr}" # invert - input="${input//$(echo -e '\033[4m')/\\Zu}" # underline - input="${input//$(echo -e '\033[0m')/\\Zn}" # reset - echo "$input" -} - loading() { dialog --no-collapse --infobox "$1" 5 45 } @@ -68,8 +51,8 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` # Read the output from femto-meshtasticd-config.sh and store output_string while IFS=':' read -r key value; do # Trim leading/trailing spaces from key and value - key=$(replace_colors "$(echo "$key" | xargs)") - value=$(replace_colors "$(echo "$value" | xargs)") + key=$(femto-utils.sh -R "$(echo "$key" | xargs)") + value=$(femto-utils.sh -R "$(echo "$value" | xargs)") if [[ -z "$key" && -z "$value" ]]; then output_string+="---\n" else @@ -170,7 +153,7 @@ networking_settings() { ;; 7) # Test internet connection) loading "Testing internet connection..." - dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 9 40 + dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40 ;; 8) return @@ -191,13 +174,12 @@ utilities() { 5 "Run USB configuration tool" "" \ 6 "Run OEM luckfox-config" "" \ 7 "Process viewer/manager" "" \ - 8 "Disable/enable web terminal" "" \ - 9 "Disable/enable logging" "" \ - 10 "Disable/enable activity LED" "" \ - 11 "Reboot" "" \ - 12 "Shutdown" "" \ + 8 "Disable/enable logging" "" \ + 9 "Disable/enable activity LED" "" \ + 10 "Reboot" "" \ + 11 "Shutdown" "" \ " " "" "" \ - 13 "Back to main menu" "" 3>&1 1>&2 2>&3) + 12 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $utilities_choice in @@ -288,40 +270,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 ;; 6) luckfox-config ;; 7) htop ;; - 8) - choice="" # zero the choice before loading the submenu - while true; do - echo "Checking web terminal status..." - ttyd_state=$(replace_colors "$(femto-utils.sh -t "check")") - [[ $ttyd_state == *"running"* ]] && ttyd_state+="\nWeb terminal available at \Zuhttps://$(hostname).local:7681\Zn" - choice=$(dialog --no-collapse --colors --title "Web Terminal" --cancel-label "Back" --help-button --default-item "$choice" --item-help --menu "Current state: $ttyd_state" 14 58 2 \ - $(if ! echo "$ttyd_state" | grep -q 'enabled and running'; then echo "Enable and start (default) x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Disable and stop x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Start/restart ttyd service x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "View detailed service status x  "; fi) \ - " " "" "" \ - "Return to previous menu" "x" "" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "Web terminal help" --msgbox "Web terminal is a browser based terminal interface, and can be used as a replacement for an SSH client such as PuTTY.\nSSL encryption is provided by keys generated during first-boot. Your browser may give a warning (net::ERR_CERT_AUTHORITY_INVALID) about the self-signed encryption certificate. This is normal. In Chromium (Chrome, Edge) click \"Advanced\" and \"Continue to femtofox.local (unsafe)\".\n\nWeb terminal is provided by ttyd.\nLicense for ttyd: \`cat /opt/ttyd/license\`.\nFor more details, see: \Zuhttps://github.com/tsl0922/ttyd\Zn\n\nWeb terminal is enabled by default on Foxbuntu." 0 0 - else - case $choice in - "Enable and start (default)") femto-utils.sh -t "enable" ;; - "Disable and stop") femto-utils.sh -t "disable" ;; - "Start/restart ttyd service") femto-utils.sh -t "start" ;; - "View detailed service status") dialog --no-collapse --title "ttyd service status" --msgbox "$(systemctl status ttyd)" 0 0 ;; - "Return to previous menu") break ;; - esac - fi - done - ;; - 9) # logging) + 8) # logging) choice="" # zero the choice before loading the submenu while true; do echo "Checking current logging status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(femto-utils.sh -l "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -l "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -334,11 +287,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 10) # activity LED) + 9) # activity LED) choice="" # zero the choice before loading the submenu while true; do echo "Checking current activity LED status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(replace_colors "$(femto-utils.sh -a "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -a "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -351,21 +304,21 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 11) # reboot) + 10) # reboot) dialog --no-collapse --title "$title" --yesno "Reboot now?\n\nTip: Reboot can also be triggered by long-pressing the BOOT button on the luckfox." 10 45 if [ $? -eq 0 ]; then #unless cancel/no loading "Rebooting..." femto-utils.sh -r fi ;; - 12) # shutdown) + 11) # shutdown) dialog --no-collapse --colors --title "$title" --yesno "Shut down now?\n\nTo power system back on, disconnect/reconnect power.\n\nThe system shutdown command prevents damage to the filesystem from power interrupts, but does not stop power consumption.\n\nTip: You can also shut down the Femtofox by pressing the BOOT button for 5 seconds or by running \`\Zusudo halt\Zn\`." 14 60 if [ $? -eq 0 ]; then #unless cancel/no loading "Shutting down...\n\nPower consumption will not stop." femto-utils.sh -s fi ;; - 13) return ;; + 12) return ;; esac done } @@ -376,15 +329,18 @@ set_lora_radio() { while true; do echo "Checking LoRa radio..." #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 19 50 10 \ - "Ebyte e22-900m30s" "(SX1262_TCXO)" "" \ + choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + "Radio name:" "Configuration:" "" \ + "" "" "" \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ "Heltec ht-ra62" "(SX1262_TCXO)" "" \ "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ - "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ - "None" "(simulated radio)" "" \ + "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ + "Simulated radio" "(none)" "" \ " " "" "" \ "Skip" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -409,9 +365,12 @@ set_lora_radio() { radio="sx1262_xtal" ;; "AI Thinker ra-01sh") - radio="sx1262_xtal" + radio="femto_sx1262_xtal" ;; - "None") + "LoRa Meshstick 1262") + radio="lora-meshstick-1262" + ;; + "Simulated radio") radio="none" ;; "Skip") @@ -429,7 +388,7 @@ legacy_admin() { choice="" # zero the choice before loading the submenu while true; do loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ 1 "Enable" "" \ 2 "Disable (default)" "" \ " " "" "" \ @@ -466,7 +425,7 @@ meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ 1 "View node info" "" \ 2 "View configuration URL & QR code" "" \ 3 "Set new configuration URL" "" \ @@ -580,14 +539,14 @@ meshtastic_settings() { dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 if [ $? -eq 0 ]; then #unless cancel/no dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 - dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(replace_colors "$(femto-meshtasticd-config.sh -w)")" 0 0 + dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0 fi ;; 7) #manage meshtasticd service) choice="" # zero the choice before loading the submenu while true; do echo "Checking Meshtasticd service state..." - local service_state="$(replace_colors "$(femto-meshtasticd-config.sh -S)")" + local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")" choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 17 52 5 \ "View detailed service status" "x" \ " " " " \ @@ -601,7 +560,7 @@ meshtastic_settings() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in "View detailed service status") - loading "Getting Meshtasticd service status..." + echo "Getting Meshtasticd service status..." dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; "Start/restart service") @@ -688,7 +647,7 @@ help_menu() { 5 "Back to Help Menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in - 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 43 68 ;; + 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 42 68 ;; 2) dialog --no-collapse --title "Femtofox Zero" --msgbox "$(femto-pinout.sh -z)" 34 48 ;; 3) dialog --no-collapse --title "Femtofox Tiny" --msgbox "$(femto-pinout.sh -t)" 38 70 ;; 4) dialog --no-collapse --title "Luckfox Pico Mini" --msgbox "$(femto-pinout.sh -l)" 23 65 ;; @@ -697,7 +656,7 @@ help_menu() { done ;; 3) #Femtofox licensing info - short) - dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 28 60 + dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 31 65 ;; 4) #Femtofox licensing info - long) clear diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index fdf196c..e915361 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -146,11 +146,15 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d systemctl restart meshtasticd + elif [ "$OPTARG" = "lora-meshstick-1262" ]; then + eval $prepare + cp /etc/meshtasticd/available.d/lora-meshstick-1262.yaml /etc/meshtasticd/config.d/femtofox_lora-meshstick-1262.yaml # ugly code for the special case of the meshstick, which is not femto. Allows it to be detected by femto scripts and removed if radio changes + systemctl restart meshtasticd elif [ "$OPTARG" = "none" ]; then eval $prepare systemctl restart meshtasticd else - echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`none\` (simradio)" + echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`lora-meshstick-1262\`, \`none\` (simradio)" fi ;; q) # Option -q (set config URL) @@ -220,17 +224,7 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do fi ;; S) # Option -S (Get Meshtasticd Service state) - if systemctl is-enabled meshtasticd &>/dev/null; then - if echo "$(systemctl status meshtasticd)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - elif echo "$(systemctl status meshtasticd)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - else - echo "unknown" - fi - else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - fi + femto-utils.sh -C "meshtasticd" # this functionality has been moved ;; t) # Option -t (stop Meshtasticd service) systemctl stop meshtasticd diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index bbd4fda..d9690c9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -151,14 +151,14 @@ $wifi_settings" hostnamectl set-hostname "$OPTARG" systemctl restart avahi-daemon echo "Regenerating web terminal ssl keys..." - femto-utils.sh -T + /usr/local/bin/packages/ttyd.sh -k ;; - \?) # Invalid option + \?) # Invalid option) echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 ;; - :) # Missing argument for option + :) # Missing argument for option) echo "Option -$OPTARG requires a setting." echo -e "$help" exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 46bdeb2..1530030 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -69,7 +69,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal SSL encryption keys. This can take a minute..." -femto-utils.sh -T +/usr/local/bin/packages/ttyd.sh -k # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 0d5955b..a8404e8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -77,7 +77,6 @@ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)" $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ -An internet connection is required for installation.\n\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 package_menu $1 # after user hits "OK", move on to package menu } @@ -87,17 +86,18 @@ package_menu() { while true; do echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --default-item "$choice" --menu "$($package_dir/$1.sh -N)" 18 45 5 \ + service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" 18 45 5 \ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Enable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'd' && $package_dir/$1.sh -I; then echo "Disable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 's' && $package_dir/$1.sh -I; then echo "Stop service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'r' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Get service status x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi) \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -112,14 +112,16 @@ package_menu() { "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; - "Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; "Back to software manager") break ;; esac done } # generate menu from filenames in /usr/local/bin/packages + while true; do + echo "Loading packages..." menu_entries=("Package name" "Installed?" "" "") index=1 for file in /usr/local/bin/packages/*.sh; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index be31bf4..4fa2b0e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -19,9 +19,9 @@ Options are: -o OS info -S Storage & RAM info -t "enable" Enable/disable/start/stop/check ttyd (web terminal). Options: "enable" "disable" "start" "stop" "check" --T Generate/overwrite ttyd encryption keys -E Generate/overwrite SSH encryption keys - +-C "service" Check if service is enabled, disabled, running +-R "command" Replace colors for dialog menus EOF ) @@ -95,7 +95,7 @@ os_info() { local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')" local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)" local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")" - local ttyd_enabled="$(ttyd "check" | sed 's/\x1b\[[0-9;]*m//g')" + local ttyd_enabled="$(femto-utils.sh -C "ttyd")" local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')" local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output @@ -201,41 +201,59 @@ logging() { fi } -ttyd() { - if [ "$1" = "disable" ]; then - systemctl disable ttyd - systemctl stop ttyd - echo "Disabled ttyd service." - exit 0 - elif [ "$1" = "enable" ]; then - systemctl enable ttyd - echo "Enabled ttyd service." - systemctl start ttyd - exit 0 - elif [ "$1" = "check" ]; then - if systemctl is-enabled ttyd &>/dev/null; then - if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - exit 1 - else - echo "unknown" - fi - else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - exit 1 - fi - elif [ "$1" = "start" ]; then - echo "Starting/restarting ttyd service..." - systemctl restart ttyd - elif [ "$1" = "stop" ]; then - echo "Stopping ttyd service..." - systemctl stop ttyd - fi +# Dialog uses a different method to display colors, and is limited to only these 8. +replace_colors() { + input="$1" + input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black + input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red + input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green + input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow + input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue + input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta + input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan + input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white + input="${input//$(echo -e '\033[7m')/\\Zr}" # invert + input="${input//$(echo -e '\033[4m')/\\Zu}" # underline + input="${input//$(echo -e '\033[0m')/\\Zn}" # reset + echo "$input" } -while getopts ":harsl:ipcnoSt:TE" opt; do +# this has been moved to /usr/local/bin/packages/ttyd.sh under the aegis of femto_software.sh +# ttyd() { +# if [ "$1" = "disable" ]; then +# systemctl disable ttyd +# systemctl stop ttyd +# echo "Disabled ttyd service." +# exit 0 +# elif [ "$1" = "enable" ]; then +# systemctl enable ttyd +# echo "Enabled ttyd service." +# systemctl start ttyd +# exit 0 +# elif [ "$1" = "check" ]; then +# if systemctl is-enabled ttyd &>/dev/null; then +# if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then +# echo -e "\033[4m\033[0;34menabled and running\033[0m" +# elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then +# echo -e "\033[4m\033[0;31menabled but not running\033[0m" +# exit 1 +# else +# echo "unknown" +# fi +# else +# echo -e "\033[4m\033[0;31mdisabled\033[0m" +# exit 1 +# fi +# elif [ "$1" = "start" ]; then +# echo "Starting/restarting ttyd service..." +# systemctl restart ttyd +# elif [ "$1" = "stop" ]; then +# echo "Stopping ttyd service..." +# systemctl stop ttyd +# fi +# } + +while getopts ":harsl:ipcnoSEC:R:" opt; do case ${opt} in h) # Option -h (help) echo -e $help @@ -260,13 +278,6 @@ while getopts ":harsl:ipcnoSt:TE" opt; do n) networking_info ;; # Option -n (Networing info) o) os_info ;; # Option -o (OS info) S) storage_info ;; # Option -S (Storage & RAM info) - t) ttyd $OPTARG ;; # Option -t (ttyd service manager) - T) # Option -T (new ttyd SSL keys) - openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout /etc/ssl/private/ttyd.key -out /etc/ssl/certs/ttyd.crt -subj "/CN=$(hostname)" -addext "subjectAltName=DNS:$(hostname)" - chmod 600 /etc/ssl/private/ttyd.key - chmod 644 /etc/ssl/certs/ttyd.crt - systemctl restart ttyd - ;; E) # Option -E (new SSH encryption keys) rm /etc/ssh/ssh_host_* ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" @@ -276,6 +287,32 @@ while getopts ":harsl:ipcnoSt:TE" opt; do chown root:root /etc/ssh/ssh_host_* systemctl restart ssh ;; + C) # Option -C (Check service) + if systemctl is-enabled $OPTARG &>/dev/null; then + if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then + echo -e "\033[4m\033[0;34menabled and running\033[0m" + exit 0 + elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then + echo -e "\033[4m\033[0;31menabled but not running\033[0m" + exit 1 + elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then + echo -e "\033[4m\033[0;31menabled but failed\033[0m" + exit 1 + elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then + echo -e "\033[4m\033[0;31menabled, activating\033[0m" + exit 2 + else + echo "unknown" + exit 2 + fi + else + echo -e "\033[4m\033[0;31mdisabled\033[0m" + exit 1 + fi + ;; + R) + replace_colors "$OPTARG" + ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index bf45a13..8755cb7 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -33,6 +33,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service name -L Get Install location -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -53,7 +54,7 @@ name="Meshing Around" # software name author="Spud" # software author - OPTIONAL description="Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features. Connectivity and utility through text-based message delivery. Whether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/SpudGunMan/meshing-around" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuagedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuagedsrNADUOSELCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mesh_bot pong_bot mesh_bot_reporting" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` @@ -166,6 +167,9 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index 2ba27e7..5a45550 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -32,6 +32,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service name -L Get install location -P Get package name -C Get Conflicts @@ -54,7 +55,7 @@ name="Mosquitto MQTT Broker" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSEPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mosquitto" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="mosquitto" # apt package name, if applicable @@ -139,6 +140,9 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index f576cf4..b9b3d37 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -32,6 +32,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service name -L Get install location -P Get package name -C Get Conflicts @@ -54,7 +55,7 @@ name="Mosquitto MQTT Client" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSEPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` @@ -137,6 +138,9 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index f3db15d..e2d2e26 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -33,6 +33,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service name -L Get install location -P Get package name -C Get Conflicts @@ -54,7 +55,7 @@ name="name" # software name author="author" # software author - OPTIONAL description="description" # software description - OPTIONAL (but strongly recommended!) URL="URL" # software URL. Can contain multiple URLs - OPTIONAL -options="hxiuagedsrlNADUOSLPCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +options="hxiuagedsrlNADUOSELPCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="/opt/package/run.sh" # command to launch software, if applicable service_name="service_name" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="apt_package" # apt package name, if applicable. Can be multiple packages separated by spaces, but if at least one is installed the package will show as "installed" even if the others aren't @@ -148,6 +149,9 @@ while getopts ":$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index 56cccc8..a5bc00b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -33,6 +33,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service nam -L Get install location -P Get package name -C Get Conflicts @@ -57,7 +58,7 @@ name="Samba File Sharing" # software name author="Software Freedom Conservancy" # software author - OPTIONAL description="Femtofox comes with Samba preinstalled but disabled. $init_instructions\n\n$user_message" # software description - OPTIONAL (but strongly recommended!) URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuagedsrNADUOSPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuagedsrNADUOSEPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="smbd nmbd" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` @@ -157,6 +158,9 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 30f7160..f56a253 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -32,6 +32,7 @@ Arguments: -U Get URL -O Get options supported by this script -S Get service status +-E Get service nam -L Get Install location -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -53,7 +54,7 @@ name="TC²-BBS" # software name author="The Comms Channel" # software author - OPTIONAL description="The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/TheCommsChannel/TC2-BBS-mesh" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSELCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="python /opt/TC2-BBS-mesh/server.py" # command to launch software, if applicable service_name="mesh-bbs" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/TC2-BBS-mesh" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` @@ -162,6 +163,9 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; + E) # Option -E (Get service name) + echo $service_name + ;; L) echo -e $location ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh new file mode 100644 index 0000000..019f319 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -0,0 +1,193 @@ +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo\`." + exit 1 +fi +if [ $# -eq 0 ]; then + echo "No arguments provided." + echo -e "$help" + exit 1 +fi + +args="$@" # arguments to this script +interactive="true" +help=$(cat </dev/null; then # if service is enabled + systemctl restart ttyd + fi +} + + +while getopts ":$options" opt; do + case ${opt} in + h) # Option -h (help) + echo -e "$help" + ;; + x) # Option -x (no user interaction available) + interaction="false" + ;; + i) # Option -i (install) + install + ;; + u) # Option -u (uninstall) + uninstall + ;; + a) # Option -a (interactive initialization) + interactive_init + ;; + g) # Option -g (upgrade) + upgrade + ;; + e) # Option -e (Enable service, if applicable) + systemctl enable $service_name + ;; + d) # Option -d (Disable service, if applicable) + systemctl disable $service_name + ;; + s) # Option -s (Stop service) + systemctl stop $service_name + ;; + r) # Option -r (Start/Restart) + systemctl restart $service_name + ;; + l) # Option -l (Run software) + echo "Launching $name..." + sudo -u ${SUDO_USER:-$(whoami)} $launch + ;; + N) echo -e $name ;; + A) echo -e $author ;; + D) echo $description ;; + U) echo -e $URL ;; + O) echo -e $options ;; + S) # Option -S (Get service status) + systemctl status $service_name + ;; + E) # Option -E (Get service name) + echo $service_name + ;; + L) echo -e $location ;; + P) echo -e $package_name ;; + C) echo -e $conflicts ;; + I) # Option -I (Check if already installed) + check + ;; + k) # Option -k (Regenerate SSL keys) + generate_keys + ;; + esac +done + +exit 0 \ No newline at end of file From e0cc5ddc6c5d7866d0d39e1f65692290075d48f8 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 22:02:44 +0200 Subject: [PATCH 011/149] Update femto-software.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index a8404e8..7fce655 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -75,6 +75,7 @@ package_intro() { $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ +$($package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 From efd5adc63e921296280d315017a672c69d727285 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 00:54:25 +0200 Subject: [PATCH 012/149] Add license button to package installer --- .../usr/local/bin/femto-software.sh | 39 +++++++++++-------- .../usr/local/bin/packages/contact_client.sh | 19 +++++++-- .../usr/local/bin/packages/meshing_around.sh | 17 ++++++-- .../bin/packages/mosquitto_mqtt_broker.sh | 13 ++++++- .../bin/packages/mosquitto_mqtt_client.sh | 13 ++++++- .../local/bin/packages/package_template.sh | 13 ++++++- .../usr/local/bin/packages/samba.sh | 24 +++++++++--- .../usr/local/bin/packages/tc2_bbs.sh | 20 ++++++++-- .../usr/local/bin/packages/ttyd.sh | 12 +++++- 9 files changed, 134 insertions(+), 36 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 7fce655..9487f90 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -88,7 +88,8 @@ package_menu() { echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" 18 45 5 \ + if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" 18 45 5 \ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ @@ -101,21 +102,27 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi) \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - # execute the actual commands - case $choice in - "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$package_dir/$1.sh -l" ;; - "Install") install $1 ;; - "Uninstall") uninstall $1 ;; - "Initialize") initialize $1 ;; - "Upgrade") upgrade $1 ;; - "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; - "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; - "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; - "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; - "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; - "Back to software manager") break ;; - esac + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 + else + # execute the actual commands + case $choice in + "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; + "Install") install $1 ;; + "Uninstall") uninstall $1 ;; + "Initialize") initialize $1 ;; + "Upgrade") upgrade $1 ;; + "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; + "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; + "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; + "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; + "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Back to software manager") break ;; + esac + fi done } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 10f8aa3..4bfebf3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -10,10 +10,11 @@ help=$(cat <&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } @@ -114,6 +116,11 @@ else fi } +# display license +license() { + echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" +} + while getopts ":h$options" opt; do case ${opt} in h) # Option -h (help) @@ -161,7 +168,12 @@ while getopts ":h$options" opt; do E) # Option -E (Get service name) echo $service_name ;; - L) echo -e $location ;; + L) # Option -L (location) + echo -e $location + ;; + G) # Option -G (Get license) + license + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index f56a253..a3f9a14 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -15,10 +15,11 @@ help=$(cat < Date: Sat, 8 Feb 2025 02:16:22 +0200 Subject: [PATCH 013/149] add pip install -r requirements.txt to meshing_around, tc2_bbs, contact --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 7 +++++-- .../usr/local/bin/packages/contact_client.sh | 3 ++- .../usr/local/bin/packages/meshing_around.sh | 3 ++- .../usr/local/bin/packages/mosquitto_mqtt_broker.sh | 4 ++-- .../usr/local/bin/packages/mosquitto_mqtt_client.sh | 2 +- .../usr/local/bin/packages/package_template.sh | 2 +- .../rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 4 +--- .../rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh | 3 ++- .../rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh | 2 +- 9 files changed, 17 insertions(+), 13 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 9487f90..2d28b36 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -89,7 +89,7 @@ package_menu() { # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" 18 45 5 \ + menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ @@ -99,7 +99,10 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" + menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ + $menu_list \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 4bfebf3..734ea70 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -73,6 +73,7 @@ install() { echo "user_message: Git clone failed. Is internet connected?" exit 1 fi + pip install -r $location/requirements.txt chown -R femto $location #give ownership of installation directory to $user git config --global --add safe.directory $location # prevents git error when updating echo "Creating \`contact\` shortcut." @@ -122,7 +123,7 @@ check() { # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 5db9264..303349c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -69,6 +69,7 @@ install() { echo "user_message: Git clone failed. Is internet connected?" exit 1 fi + pip install -r $location/requirements.txt if [ "$interactive" = "true" ]; then #interactive install interactive_init else @@ -127,7 +128,7 @@ check() { # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index 3c58bdf..12d207c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -62,7 +62,7 @@ launch="" # command to launch software, if applicable service_name="mosquitto" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="mosquitto" # apt package name, if applicable location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` -license="$location/LICENSE" # file to cat to display license +license="usr/share/doc/mosquitto/copyright" # file to cat to display license conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -104,7 +104,7 @@ fi # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index 5006bb2..c49c456 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -102,7 +102,7 @@ fi # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index 6b8cd5a..1a6338a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -110,7 +110,7 @@ check() { # display license - limit to 2000 chars license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index fb3ba7f..c77bf8a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -83,8 +83,6 @@ install() { # uninstall script uninstall() { DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty - echo "Removing unused dependencies..." - DEBIAN_FRONTEND=noninteractive apt autoremove -y $package_name 2>&1 | tee /dev/tty echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge $package_name -y\` and \`sudo apt autoremove -y\`." exit 0 # should be `exit 1` if operation failed } @@ -118,7 +116,7 @@ fi # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index a3f9a14..560742b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -70,6 +70,7 @@ install() { echo "user_message: Git clone failed. Is internet connected?" exit 1 fi + pip install -r $location/requirements.txt chown -R femto $location #give ownership of installation directory to $user git config --global --add safe.directory $location # prevents git error when updating @@ -128,7 +129,7 @@ check() { # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } while getopts ":h$options" opt; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh index 812ad31..38a588c 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -124,7 +124,7 @@ check() { # display license license() { - echo -e "Contents of $license:\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } # custom for this package From 82a980498b033a3647e1f7e02eec15513a5c74ed Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 02:21:33 +0200 Subject: [PATCH 014/149] undo --- .../usr/local/bin/femto-config | 109 +++++++++++----- .../usr/local/bin/femto-license.sh | 33 ++--- .../usr/local/bin/femto-meshtasticd-config.sh | 18 ++- .../usr/local/bin/femto-network-config.sh | 6 +- .../usr/local/bin/femto-runonce.sh | 2 +- .../usr/local/bin/femto-software.sh | 57 ++++---- .../usr/local/bin/femto-utils.sh | 123 ++++++------------ .../usr/local/bin/packages/contact_client.sh | 20 +-- .../usr/local/bin/packages/meshing_around.sh | 22 +--- .../bin/packages/mosquitto_mqtt_broker.sh | 17 +-- .../bin/packages/mosquitto_mqtt_client.sh | 17 +-- .../local/bin/packages/package_template.sh | 17 +-- .../usr/local/bin/packages/samba.sh | 28 +--- .../usr/local/bin/packages/tc2_bbs.sh | 23 +--- 14 files changed, 193 insertions(+), 299 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 8636be1..32c584e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -16,6 +16,23 @@ pause() { read -n 1 -s -r } +# Dialog uses a different method to display colors, and is limited to only these 8. +replace_colors() { + input="$1" + input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black + input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red + input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green + input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow + input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue + input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta + input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan + input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white + input="${input//$(echo -e '\033[7m')/\\Zr}" # invert + input="${input//$(echo -e '\033[4m')/\\Zu}" # underline + input="${input//$(echo -e '\033[0m')/\\Zn}" # reset + echo "$input" +} + loading() { dialog --no-collapse --infobox "$1" 5 45 } @@ -51,8 +68,8 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` # Read the output from femto-meshtasticd-config.sh and store output_string while IFS=':' read -r key value; do # Trim leading/trailing spaces from key and value - key=$(femto-utils.sh -R "$(echo "$key" | xargs)") - value=$(femto-utils.sh -R "$(echo "$value" | xargs)") + key=$(replace_colors "$(echo "$key" | xargs)") + value=$(replace_colors "$(echo "$value" | xargs)") if [[ -z "$key" && -z "$value" ]]; then output_string+="---\n" else @@ -153,7 +170,7 @@ networking_settings() { ;; 7) # Test internet connection) loading "Testing internet connection..." - dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40 + dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 9 40 ;; 8) return @@ -174,12 +191,13 @@ utilities() { 5 "Run USB configuration tool" "" \ 6 "Run OEM luckfox-config" "" \ 7 "Process viewer/manager" "" \ - 8 "Disable/enable logging" "" \ - 9 "Disable/enable activity LED" "" \ - 10 "Reboot" "" \ - 11 "Shutdown" "" \ + 8 "Disable/enable web terminal" "" \ + 9 "Disable/enable logging" "" \ + 10 "Disable/enable activity LED" "" \ + 11 "Reboot" "" \ + 12 "Shutdown" "" \ " " "" "" \ - 12 "Back to main menu" "" 3>&1 1>&2 2>&3) + 13 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $utilities_choice in @@ -270,11 +288,40 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 ;; 6) luckfox-config ;; 7) htop ;; - 8) # logging) + 8) + choice="" # zero the choice before loading the submenu + while true; do + echo "Checking web terminal status..." + ttyd_state=$(replace_colors "$(femto-utils.sh -t "check")") + [[ $ttyd_state == *"running"* ]] && ttyd_state+="\nWeb terminal available at \Zuhttps://$(hostname).local:7681\Zn" + choice=$(dialog --no-collapse --colors --title "Web Terminal" --cancel-label "Back" --help-button --default-item "$choice" --item-help --menu "Current state: $ttyd_state" 14 58 2 \ + $(if ! echo "$ttyd_state" | grep -q 'enabled and running'; then echo "Enable and start (default) x  "; fi) \ + $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Disable and stop x  "; fi) \ + $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Start/restart ttyd service x  "; fi) \ + $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "View detailed service status x  "; fi) \ + " " "" "" \ + "Return to previous menu" "x" "" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "Web terminal help" --msgbox "Web terminal is a browser based terminal interface, and can be used as a replacement for an SSH client such as PuTTY.\nSSL encryption is provided by keys generated during first-boot. Your browser may give a warning (net::ERR_CERT_AUTHORITY_INVALID) about the self-signed encryption certificate. This is normal. In Chromium (Chrome, Edge) click \"Advanced\" and \"Continue to femtofox.local (unsafe)\".\n\nWeb terminal is provided by ttyd.\nLicense for ttyd: \`cat /opt/ttyd/license\`.\nFor more details, see: \Zuhttps://github.com/tsl0922/ttyd\Zn\n\nWeb terminal is enabled by default on Foxbuntu." 0 0 + else + case $choice in + "Enable and start (default)") femto-utils.sh -t "enable" ;; + "Disable and stop") femto-utils.sh -t "disable" ;; + "Start/restart ttyd service") femto-utils.sh -t "start" ;; + "View detailed service status") dialog --no-collapse --title "ttyd service status" --msgbox "$(systemctl status ttyd)" 0 0 ;; + "Return to previous menu") break ;; + esac + fi + done + ;; + 9) # logging) choice="" # zero the choice before loading the submenu while true; do echo "Checking current logging status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -l "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(femto-utils.sh -l "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -287,11 +334,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 9) # activity LED) + 10) # activity LED) choice="" # zero the choice before loading the submenu while true; do echo "Checking current activity LED status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -a "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(replace_colors "$(femto-utils.sh -a "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -304,21 +351,21 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 10) # reboot) + 11) # reboot) dialog --no-collapse --title "$title" --yesno "Reboot now?\n\nTip: Reboot can also be triggered by long-pressing the BOOT button on the luckfox." 10 45 if [ $? -eq 0 ]; then #unless cancel/no loading "Rebooting..." femto-utils.sh -r fi ;; - 11) # shutdown) + 12) # shutdown) dialog --no-collapse --colors --title "$title" --yesno "Shut down now?\n\nTo power system back on, disconnect/reconnect power.\n\nThe system shutdown command prevents damage to the filesystem from power interrupts, but does not stop power consumption.\n\nTip: You can also shut down the Femtofox by pressing the BOOT button for 5 seconds or by running \`\Zusudo halt\Zn\`." 14 60 if [ $? -eq 0 ]; then #unless cancel/no loading "Shutting down...\n\nPower consumption will not stop." femto-utils.sh -s fi ;; - 12) return ;; + 13) return ;; esac done } @@ -329,18 +376,15 @@ set_lora_radio() { while true; do echo "Checking LoRa radio..." #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ - "Radio name:" "Configuration:" "" \ - "" "" "" \ - "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ + choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 19 50 10 \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "" \ "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ "Heltec ht-ra62" "(SX1262_TCXO)" "" \ "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ - "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "" \ "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ - "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ - "Simulated radio" "(none)" "" \ + "None" "(simulated radio)" "" \ " " "" "" \ "Skip" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -365,12 +409,9 @@ set_lora_radio() { radio="sx1262_xtal" ;; "AI Thinker ra-01sh") - radio="femto_sx1262_xtal" + radio="sx1262_xtal" ;; - "LoRa Meshstick 1262") - radio="lora-meshstick-1262" - ;; - "Simulated radio") + "None") radio="none" ;; "Skip") @@ -388,7 +429,7 @@ legacy_admin() { choice="" # zero the choice before loading the submenu while true; do loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ 1 "Enable" "" \ 2 "Disable (default)" "" \ " " "" "" \ @@ -425,7 +466,7 @@ meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ 1 "View node info" "" \ 2 "View configuration URL & QR code" "" \ 3 "Set new configuration URL" "" \ @@ -539,14 +580,14 @@ meshtastic_settings() { dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 if [ $? -eq 0 ]; then #unless cancel/no dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 - dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0 + dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(replace_colors "$(femto-meshtasticd-config.sh -w)")" 0 0 fi ;; 7) #manage meshtasticd service) choice="" # zero the choice before loading the submenu while true; do echo "Checking Meshtasticd service state..." - local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")" + local service_state="$(replace_colors "$(femto-meshtasticd-config.sh -S)")" choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 17 52 5 \ "View detailed service status" "x" \ " " " " \ @@ -560,7 +601,7 @@ meshtastic_settings() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in "View detailed service status") - echo "Getting Meshtasticd service status..." + loading "Getting Meshtasticd service status..." dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; "Start/restart service") @@ -647,7 +688,7 @@ help_menu() { 5 "Back to Help Menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in - 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 42 68 ;; + 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 43 68 ;; 2) dialog --no-collapse --title "Femtofox Zero" --msgbox "$(femto-pinout.sh -z)" 34 48 ;; 3) dialog --no-collapse --title "Femtofox Tiny" --msgbox "$(femto-pinout.sh -t)" 38 70 ;; 4) dialog --no-collapse --title "Luckfox Pico Mini" --msgbox "$(femto-pinout.sh -l)" 23 65 ;; @@ -656,7 +697,7 @@ help_menu() { done ;; 3) #Femtofox licensing info - short) - dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 31 65 + dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 28 60 ;; 4) #Femtofox licensing info - long) clear diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh index b0ed139..f73c1ba 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh @@ -11,19 +11,22 @@ Options are: EOF ) -pause() { - echo -e "\nPress any key to continue..." - read -n 1 -s -r -} +anykey="echo -e \"\nPress any key to continue...\n\" && read -n 1 -s -r" femtofox_short_license="\ -Femtofox is comprised of two projects, with two different licenses:\n\ -1. Femtofox - the hardware, which is licensed \"CC BY-NC-ND - noncommercial\". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.\n\ -2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.\n\ -\n\ +Femtofox and Foxbuntu are published under CC BY-NC-ND - noncommercial.\n\ For more information, visit us at www.femtofox.com.\n\ \n\ -View the long licenses for more information.\n\ +Summary:\n\ +You can share Femtofox and Foxbuntu or make modifications, but can't sell it except by arrangement (license) with us.\n\ +In this context, Foxbuntu refers to the modifications to Ubuntu made as part of the Femtofox project.\n\ +\n\ +Boilerplate:\n\ +Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.\n\ +You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.\n\ +NonCommercial — You may not use the material for commercial purposes.\n\ +NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material (for commercial purposes).\n\ +\n\ Contact us to license Femtofox." meshtastic_license="\ @@ -88,7 +91,7 @@ https://www.femtofox.com\n\ u) # Option -u (Ubuntu licenses) echo "$ubuntu_license" ;; - \?) # Invalid option) + \?) # Invalid option echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 @@ -99,13 +102,13 @@ done # if no arguments, show all licenses if [ $# -eq 0 ]; then echo "$femtofox_short_license" - pause + eval $anykey echo "$(cat /usr/share/doc/femtofox/long_license)" - pause + eval $anykey echo "$meshtastic_license" - pause + eval $anykey echo "$luckfox_license" - pause + eval $anykey eval "$ubuntu_license" - pause + eval $anykey fi \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index e915361..fdf196c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -146,15 +146,11 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d systemctl restart meshtasticd - elif [ "$OPTARG" = "lora-meshstick-1262" ]; then - eval $prepare - cp /etc/meshtasticd/available.d/lora-meshstick-1262.yaml /etc/meshtasticd/config.d/femtofox_lora-meshstick-1262.yaml # ugly code for the special case of the meshstick, which is not femto. Allows it to be detected by femto scripts and removed if radio changes - systemctl restart meshtasticd elif [ "$OPTARG" = "none" ]; then eval $prepare systemctl restart meshtasticd else - echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`lora-meshstick-1262\`, \`none\` (simradio)" + echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`none\` (simradio)" fi ;; q) # Option -q (set config URL) @@ -224,7 +220,17 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do fi ;; S) # Option -S (Get Meshtasticd Service state) - femto-utils.sh -C "meshtasticd" # this functionality has been moved + if systemctl is-enabled meshtasticd &>/dev/null; then + if echo "$(systemctl status meshtasticd)" | grep -q "active (running)"; then + echo -e "\033[4m\033[0;34menabled and running\033[0m" + elif echo "$(systemctl status meshtasticd)" | grep -q "inactive (dead)"; then + echo -e "\033[4m\033[0;31menabled but not running\033[0m" + else + echo "unknown" + fi + else + echo -e "\033[4m\033[0;31mdisabled\033[0m" + fi ;; t) # Option -t (stop Meshtasticd service) systemctl stop meshtasticd diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index d9690c9..bbd4fda 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -151,14 +151,14 @@ $wifi_settings" hostnamectl set-hostname "$OPTARG" systemctl restart avahi-daemon echo "Regenerating web terminal ssl keys..." - /usr/local/bin/packages/ttyd.sh -k + femto-utils.sh -T ;; - \?) # Invalid option) + \?) # Invalid option echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 ;; - :) # Missing argument for option) + :) # Missing argument for option echo "Option -$OPTARG requires a setting." echo -e "$help" exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 1530030..46bdeb2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -69,7 +69,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal SSL encryption keys. This can take a minute..." -/usr/local/bin/packages/ttyd.sh -k +femto-utils.sh -T # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 2d28b36..0d5955b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -75,9 +75,9 @@ package_intro() { $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ -$($package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ +An internet connection is required for installation.\n\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 package_menu $1 # after user hits "OK", move on to package menu } @@ -87,52 +87,39 @@ package_menu() { while true; do echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") - if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi - menu_list="\ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --default-item "$choice" --menu "$($package_dir/$1.sh -N)" 18 45 5 \ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" - menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ - $menu_list \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Enable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'd' && $package_dir/$1.sh -I; then echo "Disable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 's' && $package_dir/$1.sh -I; then echo "Stop service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'r' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Get service status x"; fi) \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 - else - # execute the actual commands - case $choice in - "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; - "Install") install $1 ;; - "Uninstall") uninstall $1 ;; - "Initialize") initialize $1 ;; - "Upgrade") upgrade $1 ;; - "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; - "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; - "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; - "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; - "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; - "Back to software manager") break ;; - esac - fi + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + # execute the actual commands + case $choice in + "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$package_dir/$1.sh -l" ;; + "Install") install $1 ;; + "Uninstall") uninstall $1 ;; + "Initialize") initialize $1 ;; + "Upgrade") upgrade $1 ;; + "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; + "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; + "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; + "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; + "Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Back to software manager") break ;; + esac done } # generate menu from filenames in /usr/local/bin/packages - while true; do - echo "Loading packages..." menu_entries=("Package name" "Installed?" "" "") index=1 for file in /usr/local/bin/packages/*.sh; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 4fa2b0e..be31bf4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -19,9 +19,9 @@ Options are: -o OS info -S Storage & RAM info -t "enable" Enable/disable/start/stop/check ttyd (web terminal). Options: "enable" "disable" "start" "stop" "check" +-T Generate/overwrite ttyd encryption keys -E Generate/overwrite SSH encryption keys --C "service" Check if service is enabled, disabled, running --R "command" Replace colors for dialog menus + EOF ) @@ -95,7 +95,7 @@ os_info() { local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')" local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)" local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")" - local ttyd_enabled="$(femto-utils.sh -C "ttyd")" + local ttyd_enabled="$(ttyd "check" | sed 's/\x1b\[[0-9;]*m//g')" local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')" local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output @@ -201,59 +201,41 @@ logging() { fi } -# Dialog uses a different method to display colors, and is limited to only these 8. -replace_colors() { - input="$1" - input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black - input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red - input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green - input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow - input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue - input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta - input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan - input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white - input="${input//$(echo -e '\033[7m')/\\Zr}" # invert - input="${input//$(echo -e '\033[4m')/\\Zu}" # underline - input="${input//$(echo -e '\033[0m')/\\Zn}" # reset - echo "$input" +ttyd() { + if [ "$1" = "disable" ]; then + systemctl disable ttyd + systemctl stop ttyd + echo "Disabled ttyd service." + exit 0 + elif [ "$1" = "enable" ]; then + systemctl enable ttyd + echo "Enabled ttyd service." + systemctl start ttyd + exit 0 + elif [ "$1" = "check" ]; then + if systemctl is-enabled ttyd &>/dev/null; then + if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then + echo -e "\033[4m\033[0;34menabled and running\033[0m" + elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then + echo -e "\033[4m\033[0;31menabled but not running\033[0m" + exit 1 + else + echo "unknown" + fi + else + echo -e "\033[4m\033[0;31mdisabled\033[0m" + exit 1 + fi + elif [ "$1" = "start" ]; then + echo "Starting/restarting ttyd service..." + systemctl restart ttyd + elif [ "$1" = "stop" ]; then + echo "Stopping ttyd service..." + systemctl stop ttyd + fi } -# this has been moved to /usr/local/bin/packages/ttyd.sh under the aegis of femto_software.sh -# ttyd() { -# if [ "$1" = "disable" ]; then -# systemctl disable ttyd -# systemctl stop ttyd -# echo "Disabled ttyd service." -# exit 0 -# elif [ "$1" = "enable" ]; then -# systemctl enable ttyd -# echo "Enabled ttyd service." -# systemctl start ttyd -# exit 0 -# elif [ "$1" = "check" ]; then -# if systemctl is-enabled ttyd &>/dev/null; then -# if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then -# echo -e "\033[4m\033[0;34menabled and running\033[0m" -# elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then -# echo -e "\033[4m\033[0;31menabled but not running\033[0m" -# exit 1 -# else -# echo "unknown" -# fi -# else -# echo -e "\033[4m\033[0;31mdisabled\033[0m" -# exit 1 -# fi -# elif [ "$1" = "start" ]; then -# echo "Starting/restarting ttyd service..." -# systemctl restart ttyd -# elif [ "$1" = "stop" ]; then -# echo "Stopping ttyd service..." -# systemctl stop ttyd -# fi -# } - -while getopts ":harsl:ipcnoSEC:R:" opt; do +while getopts ":harsl:ipcnoSt:TE" opt; do case ${opt} in h) # Option -h (help) echo -e $help @@ -278,6 +260,13 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do n) networking_info ;; # Option -n (Networing info) o) os_info ;; # Option -o (OS info) S) storage_info ;; # Option -S (Storage & RAM info) + t) ttyd $OPTARG ;; # Option -t (ttyd service manager) + T) # Option -T (new ttyd SSL keys) + openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout /etc/ssl/private/ttyd.key -out /etc/ssl/certs/ttyd.crt -subj "/CN=$(hostname)" -addext "subjectAltName=DNS:$(hostname)" + chmod 600 /etc/ssl/private/ttyd.key + chmod 644 /etc/ssl/certs/ttyd.crt + systemctl restart ttyd + ;; E) # Option -E (new SSH encryption keys) rm /etc/ssh/ssh_host_* ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" @@ -287,32 +276,6 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do chown root:root /etc/ssh/ssh_host_* systemctl restart ssh ;; - C) # Option -C (Check service) - if systemctl is-enabled $OPTARG &>/dev/null; then - if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - exit 0 - elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then - echo -e "\033[4m\033[0;31menabled but failed\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then - echo -e "\033[4m\033[0;31menabled, activating\033[0m" - exit 2 - else - echo "unknown" - exit 2 - fi - else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - exit 1 - fi - ;; - R) - replace_colors "$OPTARG" - ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 734ea70..10f8aa3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -10,11 +10,10 @@ help=$(cat <&1 | tee /dev/tty + echo "Removing unused dependencies..." + DEBIAN_FRONTEND=noninteractive apt autoremove -y $package_name 2>&1 | tee /dev/tty echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge $package_name -y\` and \`sudo apt autoremove -y\`." exit 0 # should be `exit 1` if operation failed } @@ -97,7 +96,7 @@ interactive_init() { exit 0 } -# upgrade script +#upgrade script upgrade() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } @@ -114,11 +113,6 @@ else fi } -# display license -license() { - echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" -} - while getopts ":h$options" opt; do case ${opt} in h) # Option -h (help) @@ -163,15 +157,7 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) # Option -L (location) - echo -e $location - ;; - G) # Option -G (Get license) - license - ;; + L) echo -e $location ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 560742b..30f7160 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -15,11 +15,10 @@ help=$(cat < Date: Sat, 8 Feb 2025 02:22:28 +0200 Subject: [PATCH 015/149] Delete ttyd.sh --- .../usr/local/bin/packages/ttyd.sh | 203 ------------------ 1 file changed, 203 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh deleted file mode 100644 index 38a588c..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/bash -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root. Try \`sudo\`." - exit 1 -fi -if [ $# -eq 0 ]; then - echo "No arguments provided." - echo -e "$help" - exit 1 -fi - -args="$@" # arguments to this script -interactive="true" -help=$(cat </dev/null; then # if service is enabled - systemctl restart ttyd - fi -} - - -while getopts ":$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - a) # Option -a (interactive initialization) - interactive_init - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - k) # Option -k (Regenerate SSL keys) - generate_keys - ;; - esac -done - -exit 0 \ No newline at end of file From db764c4612d5ed672cdc1b881d9bf6c0d7a89d34 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 02:23:38 +0200 Subject: [PATCH 016/149] Revamp software menu system and improve package manager --- .../usr/local/bin/femto-config | 109 +++------- .../usr/local/bin/femto-license.sh | 33 ++- .../usr/local/bin/femto-meshtasticd-config.sh | 18 +- .../usr/local/bin/femto-network-config.sh | 6 +- .../usr/local/bin/femto-runonce.sh | 2 +- .../usr/local/bin/femto-software.sh | 57 +++-- .../usr/local/bin/femto-utils.sh | 123 +++++++---- .../usr/local/bin/packages/contact_client.sh | 20 +- .../usr/local/bin/packages/meshing_around.sh | 22 +- .../bin/packages/mosquitto_mqtt_broker.sh | 17 +- .../bin/packages/mosquitto_mqtt_client.sh | 17 +- .../local/bin/packages/package_template.sh | 17 +- .../usr/local/bin/packages/samba.sh | 28 ++- .../usr/local/bin/packages/tc2_bbs.sh | 23 +- .../usr/local/bin/packages/ttyd.sh | 203 ++++++++++++++++++ 15 files changed, 502 insertions(+), 193 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 32c584e..8636be1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -16,23 +16,6 @@ pause() { read -n 1 -s -r } -# Dialog uses a different method to display colors, and is limited to only these 8. -replace_colors() { - input="$1" - input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black - input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red - input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green - input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow - input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue - input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta - input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan - input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white - input="${input//$(echo -e '\033[7m')/\\Zr}" # invert - input="${input//$(echo -e '\033[4m')/\\Zu}" # underline - input="${input//$(echo -e '\033[0m')/\\Zn}" # reset - echo "$input" -} - loading() { dialog --no-collapse --infobox "$1" 5 45 } @@ -68,8 +51,8 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` # Read the output from femto-meshtasticd-config.sh and store output_string while IFS=':' read -r key value; do # Trim leading/trailing spaces from key and value - key=$(replace_colors "$(echo "$key" | xargs)") - value=$(replace_colors "$(echo "$value" | xargs)") + key=$(femto-utils.sh -R "$(echo "$key" | xargs)") + value=$(femto-utils.sh -R "$(echo "$value" | xargs)") if [[ -z "$key" && -z "$value" ]]; then output_string+="---\n" else @@ -170,7 +153,7 @@ networking_settings() { ;; 7) # Test internet connection) loading "Testing internet connection..." - dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 9 40 + dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40 ;; 8) return @@ -191,13 +174,12 @@ utilities() { 5 "Run USB configuration tool" "" \ 6 "Run OEM luckfox-config" "" \ 7 "Process viewer/manager" "" \ - 8 "Disable/enable web terminal" "" \ - 9 "Disable/enable logging" "" \ - 10 "Disable/enable activity LED" "" \ - 11 "Reboot" "" \ - 12 "Shutdown" "" \ + 8 "Disable/enable logging" "" \ + 9 "Disable/enable activity LED" "" \ + 10 "Reboot" "" \ + 11 "Shutdown" "" \ " " "" "" \ - 13 "Back to main menu" "" 3>&1 1>&2 2>&3) + 12 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $utilities_choice in @@ -288,40 +270,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 ;; 6) luckfox-config ;; 7) htop ;; - 8) - choice="" # zero the choice before loading the submenu - while true; do - echo "Checking web terminal status..." - ttyd_state=$(replace_colors "$(femto-utils.sh -t "check")") - [[ $ttyd_state == *"running"* ]] && ttyd_state+="\nWeb terminal available at \Zuhttps://$(hostname).local:7681\Zn" - choice=$(dialog --no-collapse --colors --title "Web Terminal" --cancel-label "Back" --help-button --default-item "$choice" --item-help --menu "Current state: $ttyd_state" 14 58 2 \ - $(if ! echo "$ttyd_state" | grep -q 'enabled and running'; then echo "Enable and start (default) x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Disable and stop x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Start/restart ttyd service x  "; fi) \ - $(if echo "$ttyd_state" | grep -q 'enabled'; then echo "View detailed service status x  "; fi) \ - " " "" "" \ - "Return to previous menu" "x" "" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "Web terminal help" --msgbox "Web terminal is a browser based terminal interface, and can be used as a replacement for an SSH client such as PuTTY.\nSSL encryption is provided by keys generated during first-boot. Your browser may give a warning (net::ERR_CERT_AUTHORITY_INVALID) about the self-signed encryption certificate. This is normal. In Chromium (Chrome, Edge) click \"Advanced\" and \"Continue to femtofox.local (unsafe)\".\n\nWeb terminal is provided by ttyd.\nLicense for ttyd: \`cat /opt/ttyd/license\`.\nFor more details, see: \Zuhttps://github.com/tsl0922/ttyd\Zn\n\nWeb terminal is enabled by default on Foxbuntu." 0 0 - else - case $choice in - "Enable and start (default)") femto-utils.sh -t "enable" ;; - "Disable and stop") femto-utils.sh -t "disable" ;; - "Start/restart ttyd service") femto-utils.sh -t "start" ;; - "View detailed service status") dialog --no-collapse --title "ttyd service status" --msgbox "$(systemctl status ttyd)" 0 0 ;; - "Return to previous menu") break ;; - esac - fi - done - ;; - 9) # logging) + 8) # logging) choice="" # zero the choice before loading the submenu while true; do echo "Checking current logging status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(replace_colors "$(femto-utils.sh -l "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable logging to reduce SD card wear.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -l "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -334,11 +287,11 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 10) # activity LED) + 9) # activity LED) choice="" # zero the choice before loading the submenu while true; do echo "Checking current activity LED status..." - choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(replace_colors "$(femto-utils.sh -a "check")")" 14 50 2 \ + choice=$(dialog --no-collapse --colors --title "Logging" --cancel-label "Back" --default-item "$choice" --item-help --menu "Before deploying a Femtofox, it is advisable to disable the Activity LED to save power.\nCurrent state: $(femto-utils.sh -R "$(femto-utils.sh -a "check")")" 14 50 2 \ 1 "Enable (default)" "" \ 2 "Disable" "" \ " " "" "" \ @@ -351,21 +304,21 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 esac done ;; - 11) # reboot) + 10) # reboot) dialog --no-collapse --title "$title" --yesno "Reboot now?\n\nTip: Reboot can also be triggered by long-pressing the BOOT button on the luckfox." 10 45 if [ $? -eq 0 ]; then #unless cancel/no loading "Rebooting..." femto-utils.sh -r fi ;; - 12) # shutdown) + 11) # shutdown) dialog --no-collapse --colors --title "$title" --yesno "Shut down now?\n\nTo power system back on, disconnect/reconnect power.\n\nThe system shutdown command prevents damage to the filesystem from power interrupts, but does not stop power consumption.\n\nTip: You can also shut down the Femtofox by pressing the BOOT button for 5 seconds or by running \`\Zusudo halt\Zn\`." 14 60 if [ $? -eq 0 ]; then #unless cancel/no loading "Shutting down...\n\nPower consumption will not stop." femto-utils.sh -s fi ;; - 13) return ;; + 12) return ;; esac done } @@ -376,15 +329,18 @@ set_lora_radio() { while true; do echo "Checking LoRa radio..." #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(replace_colors "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 19 50 10 \ - "Ebyte e22-900m30s" "(SX1262_TCXO)" "" \ + choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + "Radio name:" "Configuration:" "" \ + "" "" "" \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ "Heltec ht-ra62" "(SX1262_TCXO)" "" \ "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ - "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ - "None" "(simulated radio)" "" \ + "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ + "Simulated radio" "(none)" "" \ " " "" "" \ "Skip" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -409,9 +365,12 @@ set_lora_radio() { radio="sx1262_xtal" ;; "AI Thinker ra-01sh") - radio="sx1262_xtal" + radio="femto_sx1262_xtal" ;; - "None") + "LoRa Meshstick 1262") + radio="lora-meshstick-1262" + ;; + "Simulated radio") radio="none" ;; "Skip") @@ -429,7 +388,7 @@ legacy_admin() { choice="" # zero the choice before loading the submenu while true; do loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(replace_colors "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ 1 "Enable" "" \ 2 "Disable (default)" "" \ " " "" "" \ @@ -466,7 +425,7 @@ meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(replace_colors "$(femto-meshtasticd-config.sh -S)")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ 1 "View node info" "" \ 2 "View configuration URL & QR code" "" \ 3 "Set new configuration URL" "" \ @@ -580,14 +539,14 @@ meshtastic_settings() { dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 if [ $? -eq 0 ]; then #unless cancel/no dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 - dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(replace_colors "$(femto-meshtasticd-config.sh -w)")" 0 0 + dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0 fi ;; 7) #manage meshtasticd service) choice="" # zero the choice before loading the submenu while true; do echo "Checking Meshtasticd service state..." - local service_state="$(replace_colors "$(femto-meshtasticd-config.sh -S)")" + local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")" choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 17 52 5 \ "View detailed service status" "x" \ " " " " \ @@ -601,7 +560,7 @@ meshtastic_settings() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in "View detailed service status") - loading "Getting Meshtasticd service status..." + echo "Getting Meshtasticd service status..." dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; "Start/restart service") @@ -688,7 +647,7 @@ help_menu() { 5 "Back to Help Menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in - 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 43 68 ;; + 1) dialog --no-collapse --title "Femtofox" --msgbox "$(femto-pinout.sh -f)" 42 68 ;; 2) dialog --no-collapse --title "Femtofox Zero" --msgbox "$(femto-pinout.sh -z)" 34 48 ;; 3) dialog --no-collapse --title "Femtofox Tiny" --msgbox "$(femto-pinout.sh -t)" 38 70 ;; 4) dialog --no-collapse --title "Luckfox Pico Mini" --msgbox "$(femto-pinout.sh -l)" 23 65 ;; @@ -697,7 +656,7 @@ help_menu() { done ;; 3) #Femtofox licensing info - short) - dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 28 60 + dialog --no-collapse --title "Femtofox license" --msgbox "$(femto-license.sh -f)" 31 65 ;; 4) #Femtofox licensing info - long) clear diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh index f73c1ba..b0ed139 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh @@ -11,22 +11,19 @@ Options are: EOF ) -anykey="echo -e \"\nPress any key to continue...\n\" && read -n 1 -s -r" +pause() { + echo -e "\nPress any key to continue..." + read -n 1 -s -r +} femtofox_short_license="\ -Femtofox and Foxbuntu are published under CC BY-NC-ND - noncommercial.\n\ +Femtofox is comprised of two projects, with two different licenses:\n\ +1. Femtofox - the hardware, which is licensed \"CC BY-NC-ND - noncommercial\". Summary: you may copy and share and modify the hardware files, but cannot sell them without license from Femtofox, and must give attribution to Femtofox.\n\ +2. Foxbuntu - refers to the modifications to Ubuntu made as part of the Femtofox project, which is licensed GNU GPLv3. Summary: you may use, modify and distribute (including for commercial purposes) Foxbuntu, but must give attribution to Femtofox and distribute this license with your project. Any modified version must remain open source.\n\ +\n\ For more information, visit us at www.femtofox.com.\n\ \n\ -Summary:\n\ -You can share Femtofox and Foxbuntu or make modifications, but can't sell it except by arrangement (license) with us.\n\ -In this context, Foxbuntu refers to the modifications to Ubuntu made as part of the Femtofox project.\n\ -\n\ -Boilerplate:\n\ -Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.\n\ -You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.\n\ -NonCommercial — You may not use the material for commercial purposes.\n\ -NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material (for commercial purposes).\n\ -\n\ +View the long licenses for more information.\n\ Contact us to license Femtofox." meshtastic_license="\ @@ -91,7 +88,7 @@ https://www.femtofox.com\n\ u) # Option -u (Ubuntu licenses) echo "$ubuntu_license" ;; - \?) # Invalid option + \?) # Invalid option) echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 @@ -102,13 +99,13 @@ done # if no arguments, show all licenses if [ $# -eq 0 ]; then echo "$femtofox_short_license" - eval $anykey + pause echo "$(cat /usr/share/doc/femtofox/long_license)" - eval $anykey + pause echo "$meshtastic_license" - eval $anykey + pause echo "$luckfox_license" - eval $anykey + pause eval "$ubuntu_license" - eval $anykey + pause fi \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index fdf196c..e915361 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -146,11 +146,15 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d systemctl restart meshtasticd + elif [ "$OPTARG" = "lora-meshstick-1262" ]; then + eval $prepare + cp /etc/meshtasticd/available.d/lora-meshstick-1262.yaml /etc/meshtasticd/config.d/femtofox_lora-meshstick-1262.yaml # ugly code for the special case of the meshstick, which is not femto. Allows it to be detected by femto scripts and removed if radio changes + systemctl restart meshtasticd elif [ "$OPTARG" = "none" ]; then eval $prepare systemctl restart meshtasticd else - echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`none\` (simradio)" + echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`lora-meshstick-1262\`, \`none\` (simradio)" fi ;; q) # Option -q (set config URL) @@ -220,17 +224,7 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do fi ;; S) # Option -S (Get Meshtasticd Service state) - if systemctl is-enabled meshtasticd &>/dev/null; then - if echo "$(systemctl status meshtasticd)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - elif echo "$(systemctl status meshtasticd)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - else - echo "unknown" - fi - else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - fi + femto-utils.sh -C "meshtasticd" # this functionality has been moved ;; t) # Option -t (stop Meshtasticd service) systemctl stop meshtasticd diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index bbd4fda..d9690c9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -151,14 +151,14 @@ $wifi_settings" hostnamectl set-hostname "$OPTARG" systemctl restart avahi-daemon echo "Regenerating web terminal ssl keys..." - femto-utils.sh -T + /usr/local/bin/packages/ttyd.sh -k ;; - \?) # Invalid option + \?) # Invalid option) echo "Invalid option: -$OPTARG" echo -e "$help" exit 1 ;; - :) # Missing argument for option + :) # Missing argument for option) echo "Option -$OPTARG requires a setting." echo -e "$help" exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 46bdeb2..1530030 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -69,7 +69,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal SSL encryption keys. This can take a minute..." -femto-utils.sh -T +/usr/local/bin/packages/ttyd.sh -k # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 0d5955b..2d28b36 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -75,9 +75,9 @@ package_intro() { $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ +$($package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ -An internet connection is required for installation.\n\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 package_menu $1 # after user hits "OK", move on to package menu } @@ -87,39 +87,52 @@ package_menu() { while true; do echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --default-item "$choice" --menu "$($package_dir/$1.sh -N)" 18 45 5 \ + service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") + if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi + menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Enable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'd' && $package_dir/$1.sh -I; then echo "Disable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 's' && $package_dir/$1.sh -I; then echo "Stop service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'r' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Get service status x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" + menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ + $menu_list \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - # execute the actual commands - case $choice in - "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$package_dir/$1.sh -l" ;; - "Install") install $1 ;; - "Uninstall") uninstall $1 ;; - "Initialize") initialize $1 ;; - "Upgrade") upgrade $1 ;; - "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; - "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; - "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; - "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; - "Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; - "Back to software manager") break ;; - esac + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 + else + # execute the actual commands + case $choice in + "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; + "Install") install $1 ;; + "Uninstall") uninstall $1 ;; + "Initialize") initialize $1 ;; + "Upgrade") upgrade $1 ;; + "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; + "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; + "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; + "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; + "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Back to software manager") break ;; + esac + fi done } # generate menu from filenames in /usr/local/bin/packages + while true; do + echo "Loading packages..." menu_entries=("Package name" "Installed?" "" "") index=1 for file in /usr/local/bin/packages/*.sh; do diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index be31bf4..4fa2b0e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -19,9 +19,9 @@ Options are: -o OS info -S Storage & RAM info -t "enable" Enable/disable/start/stop/check ttyd (web terminal). Options: "enable" "disable" "start" "stop" "check" --T Generate/overwrite ttyd encryption keys -E Generate/overwrite SSH encryption keys - +-C "service" Check if service is enabled, disabled, running +-R "command" Replace colors for dialog menus EOF ) @@ -95,7 +95,7 @@ os_info() { local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')" local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)" local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")" - local ttyd_enabled="$(ttyd "check" | sed 's/\x1b\[[0-9;]*m//g')" + local ttyd_enabled="$(femto-utils.sh -C "ttyd")" local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')" local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output @@ -201,41 +201,59 @@ logging() { fi } -ttyd() { - if [ "$1" = "disable" ]; then - systemctl disable ttyd - systemctl stop ttyd - echo "Disabled ttyd service." - exit 0 - elif [ "$1" = "enable" ]; then - systemctl enable ttyd - echo "Enabled ttyd service." - systemctl start ttyd - exit 0 - elif [ "$1" = "check" ]; then - if systemctl is-enabled ttyd &>/dev/null; then - if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - exit 1 - else - echo "unknown" - fi - else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - exit 1 - fi - elif [ "$1" = "start" ]; then - echo "Starting/restarting ttyd service..." - systemctl restart ttyd - elif [ "$1" = "stop" ]; then - echo "Stopping ttyd service..." - systemctl stop ttyd - fi +# Dialog uses a different method to display colors, and is limited to only these 8. +replace_colors() { + input="$1" + input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black + input="${input//$(echo -e '\033[0;31m')/\\Z1}" # red + input="${input//$(echo -e '\033[0;32m')/\\Z2}" # green + input="${input//$(echo -e '\033[0;33m')/\\Z3}" # yellow + input="${input//$(echo -e '\033[0;34m')/\\Z4}" # blue + input="${input//$(echo -e '\033[0;35m')/\\Z5}" # magenta + input="${input//$(echo -e '\033[0;36m')/\\Z6}" # cyan + input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white + input="${input//$(echo -e '\033[7m')/\\Zr}" # invert + input="${input//$(echo -e '\033[4m')/\\Zu}" # underline + input="${input//$(echo -e '\033[0m')/\\Zn}" # reset + echo "$input" } -while getopts ":harsl:ipcnoSt:TE" opt; do +# this has been moved to /usr/local/bin/packages/ttyd.sh under the aegis of femto_software.sh +# ttyd() { +# if [ "$1" = "disable" ]; then +# systemctl disable ttyd +# systemctl stop ttyd +# echo "Disabled ttyd service." +# exit 0 +# elif [ "$1" = "enable" ]; then +# systemctl enable ttyd +# echo "Enabled ttyd service." +# systemctl start ttyd +# exit 0 +# elif [ "$1" = "check" ]; then +# if systemctl is-enabled ttyd &>/dev/null; then +# if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then +# echo -e "\033[4m\033[0;34menabled and running\033[0m" +# elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then +# echo -e "\033[4m\033[0;31menabled but not running\033[0m" +# exit 1 +# else +# echo "unknown" +# fi +# else +# echo -e "\033[4m\033[0;31mdisabled\033[0m" +# exit 1 +# fi +# elif [ "$1" = "start" ]; then +# echo "Starting/restarting ttyd service..." +# systemctl restart ttyd +# elif [ "$1" = "stop" ]; then +# echo "Stopping ttyd service..." +# systemctl stop ttyd +# fi +# } + +while getopts ":harsl:ipcnoSEC:R:" opt; do case ${opt} in h) # Option -h (help) echo -e $help @@ -260,13 +278,6 @@ while getopts ":harsl:ipcnoSt:TE" opt; do n) networking_info ;; # Option -n (Networing info) o) os_info ;; # Option -o (OS info) S) storage_info ;; # Option -S (Storage & RAM info) - t) ttyd $OPTARG ;; # Option -t (ttyd service manager) - T) # Option -T (new ttyd SSL keys) - openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout /etc/ssl/private/ttyd.key -out /etc/ssl/certs/ttyd.crt -subj "/CN=$(hostname)" -addext "subjectAltName=DNS:$(hostname)" - chmod 600 /etc/ssl/private/ttyd.key - chmod 644 /etc/ssl/certs/ttyd.crt - systemctl restart ttyd - ;; E) # Option -E (new SSH encryption keys) rm /etc/ssh/ssh_host_* ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" @@ -276,6 +287,32 @@ while getopts ":harsl:ipcnoSt:TE" opt; do chown root:root /etc/ssh/ssh_host_* systemctl restart ssh ;; + C) # Option -C (Check service) + if systemctl is-enabled $OPTARG &>/dev/null; then + if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then + echo -e "\033[4m\033[0;34menabled and running\033[0m" + exit 0 + elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then + echo -e "\033[4m\033[0;31menabled but not running\033[0m" + exit 1 + elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then + echo -e "\033[4m\033[0;31menabled but failed\033[0m" + exit 1 + elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then + echo -e "\033[4m\033[0;31menabled, activating\033[0m" + exit 2 + else + echo "unknown" + exit 2 + fi + else + echo -e "\033[4m\033[0;31mdisabled\033[0m" + exit 1 + fi + ;; + R) + replace_colors "$OPTARG" + ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 10f8aa3..734ea70 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -10,10 +10,11 @@ help=$(cat <&1 | tee /dev/tty - echo "Removing unused dependencies..." - DEBIAN_FRONTEND=noninteractive apt autoremove -y $package_name 2>&1 | tee /dev/tty echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge $package_name -y\` and \`sudo apt autoremove -y\`." exit 0 # should be `exit 1` if operation failed } @@ -96,7 +97,7 @@ interactive_init() { exit 0 } -#upgrade script +# upgrade script upgrade() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } @@ -113,6 +114,11 @@ else fi } +# display license +license() { + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" +} + while getopts ":h$options" opt; do case ${opt} in h) # Option -h (help) @@ -157,7 +163,15 @@ while getopts ":h$options" opt; do S) # Option -S (Get service status) systemctl status $service_name ;; - L) echo -e $location ;; + E) # Option -E (Get service name) + echo $service_name + ;; + L) # Option -L (location) + echo -e $location + ;; + G) # Option -G (Get license) + license + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 30f7160..560742b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -15,10 +15,11 @@ help=$(cat </dev/null; then # if service is enabled + systemctl restart ttyd + fi +} + + +while getopts ":$options" opt; do + case ${opt} in + h) # Option -h (help) + echo -e "$help" + ;; + x) # Option -x (no user interaction available) + interaction="false" + ;; + i) # Option -i (install) + install + ;; + u) # Option -u (uninstall) + uninstall + ;; + a) # Option -a (interactive initialization) + interactive_init + ;; + g) # Option -g (upgrade) + upgrade + ;; + e) # Option -e (Enable service, if applicable) + systemctl enable $service_name + ;; + d) # Option -d (Disable service, if applicable) + systemctl disable $service_name + ;; + s) # Option -s (Stop service) + systemctl stop $service_name + ;; + r) # Option -r (Start/Restart) + systemctl restart $service_name + ;; + l) # Option -l (Run software) + echo "Launching $name..." + sudo -u ${SUDO_USER:-$(whoami)} $launch + ;; + N) echo -e $name ;; + A) echo -e $author ;; + D) echo $description ;; + U) echo -e $URL ;; + O) echo -e $options ;; + S) # Option -S (Get service status) + systemctl status $service_name + ;; + E) # Option -E (Get service name) + echo $service_name + ;; + L) echo -e $location ;; + G) # Option -G (Get license) + license + ;; + P) echo -e $package_name ;; + C) echo -e $conflicts ;; + I) # Option -I (Check if already installed) + check + ;; + k) # Option -k (Regenerate SSL keys) + generate_keys + ;; + esac +done + +exit 0 \ No newline at end of file From 6c2a010189cbfe0f726b522b048e1d3cf6c90bd6 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 02:38:09 +0200 Subject: [PATCH 017/149] +x --- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh old mode 100644 new mode 100755 From 921634eeb2a5452278449613ce552e915cf70126 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 03:00:27 +0200 Subject: [PATCH 018/149] add ttyd license to /opt/ttyd --- .../out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE new file mode 100644 index 0000000..54ab6d8 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/opt/ttyd/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016-2025 Shuanglei Tao + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file From d8cc314662b77365ac6fdf5222462aea171602ad Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 04:02:06 +0200 Subject: [PATCH 019/149] License button should only show for installed packages --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 2d28b36..9bdaeab 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -88,6 +88,7 @@ package_menu() { echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") + license_button="" if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ From bad1ddc204768b775d94491101393ad31926be31 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Fri, 7 Feb 2025 20:26:41 -0800 Subject: [PATCH 020/149] time-monitor service to restart meshtasticd Currently set to detect a 1 week change in time. --- environment-setup/femtofox.chroot | 1 + .../etc/systemd/system/time-monitor.service | 12 ++++ .../usr/local/bin/time_change.sh | 58 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service create mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 3acbe42..c4342c9 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -61,6 +61,7 @@ systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable wifi-mesh-control +systemctl enable time-monitor systemctl disable apt-daily.timer systemctl disable unattended-upgrades diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service new file mode 100644 index 0000000..5ffa753 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monitor time changes and restart meshtasticd +After=network.target + +[Service] +ExecStart=/usr/local/bin/time_monitor.sh +Restart=always +User=root + +[Install] +WantedBy=multi-user.target + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh new file mode 100755 index 0000000..c07fb34 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +THRESHOLD=$((7 * 24 * 60 * 60)) # 1 week in seconds +LOGFILE="/var/log/time_change.log" +LAST_TIME_FILE="/tmp/last_time" + +# Function to check time jump +check_time_jump() { + NEW_TIME=$(date +%s) + + if [ -f "$LAST_TIME_FILE" ]; then + OLD_TIME=$(cat "$LAST_TIME_FILE") + else + OLD_TIME=$NEW_TIME + fi + + TIME_DIFF=$((NEW_TIME - OLD_TIME)) + + if [ "${TIME_DIFF#-}" -ge "$THRESHOLD" ]; then + echo "$(date) - Large time change detected ($TIME_DIFF seconds), restarting meshtasticd" | tee -a "$LOGFILE" + systemctl restart meshtasticd + fi + + echo "$NEW_TIME" > "$LAST_TIME_FILE" +} + +# Monitor chronyd logs for time jumps (background) +( + journalctl -fu chronyd --no-pager | while read -r line; do + if echo "$line" | grep -q "Forward time jump detected"; then + echo "$(date) - Detected time change via chronyd logs" | tee -a "$LOGFILE" + check_time_jump + fi + done +) & + +# Monitor /etc/adjtime for manual or RTC-based time changes (background) +( + while true; do + if find /etc/adjtime -mmin -1 | grep -q .; then + echo "$(date) - Time change detected via /etc/adjtime modification" | tee -a "$LOGFILE" + check_time_jump + fi + sleep 5 + done +) & + +# Fallback: Compare timestamps every 5 seconds (if other methods fail) +( + while true; do + check_time_jump + sleep 5 + done +) & + +# Keep script running +wait + From 3b520405ff55a8943d9045902f57b38e90afd815 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 18:00:13 +0200 Subject: [PATCH 021/149] Fix femto-utils.sh help text --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 4fa2b0e..cc4e043 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -256,7 +256,7 @@ replace_colors() { while getopts ":harsl:ipcnoSEC:R:" opt; do case ${opt} in h) # Option -h (help) - echo -e $help + echo -e "$help" ;; a) # Option -a (ACT LED enable/disable/check) act_led $2 From b543a118981f2affa59883cbf90e2e7476f63a19 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 19:05:19 +0200 Subject: [PATCH 022/149] Improve service state utility in femto-utils.sh --- .../usr/local/bin/femto-config | 18 ++--- .../usr/local/bin/femto-software.sh | 4 +- .../usr/local/bin/femto-utils.sh | 77 ++++++------------- 3 files changed, 34 insertions(+), 65 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 8636be1..477a6c1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -549,13 +549,13 @@ meshtastic_settings() { local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")" choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 17 52 5 \ "View detailed service status" "x" \ - " " " " \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "Start/restart service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled and running'; then echo "Stop service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "   "; fi) \ + " " "" \ + "Start/restart service" "x" \ + $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ + " " "" \ $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ - " " " " \ + " " "" \ "Back to previous menu" "x" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in @@ -567,14 +567,14 @@ meshtastic_settings() { dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 6 45 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -s - dialog --no-collapse --msgbox "Meshtasticd service started/restarted." 6 45 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart meshtasticd\Zn\` command to system.\n\nMeshtasticd should be running." 9 50 fi ;; "Stop service") - dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtasticd will automatically restart on boot if not disabled." 11 50 + dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtasticd will automatically restart on boot service if enabled." 11 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -t - dialog --no-collapse --msgbox "Meshtasticd service stopped." 6 45 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop meshtasticd\Zn\` command to system.\n\nMeshtasticd should be stopped." 9 50 fi ;; "Enable service") @@ -588,7 +588,7 @@ meshtastic_settings() { dialog --no-collapse --colors --title "$title" --yesno "Disable Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -M "disable" - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable meshtasticd\Zn\` and \`\Zusystemctl stop meshtasticd\Zn\` commands to system.\n\nMeshtasticd is disabled and stopped." 10 50 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable meshtasticd\Zn\` and \`\Zusystemctl stop meshtasticd\Zn\` commands to system.\n\nMeshtasticd should be disabled and stopped." 10 50 fi ;; "Back to previous menu") break ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 9bdaeab..4bcd1fb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -98,8 +98,8 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]]; then echo "Stop service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index cc4e043..33b1cf0 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -214,45 +214,11 @@ replace_colors() { input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white input="${input//$(echo -e '\033[7m')/\\Zr}" # invert input="${input//$(echo -e '\033[4m')/\\Zu}" # underline - input="${input//$(echo -e '\033[0m')/\\Zn}" # reset + input="${input//$(echo -e '\e[39m')/\\Z0}" # reset colors not underline + input="${input//$(echo -e '\033[0m')/\\Zn}" # reset all echo "$input" } -# this has been moved to /usr/local/bin/packages/ttyd.sh under the aegis of femto_software.sh -# ttyd() { -# if [ "$1" = "disable" ]; then -# systemctl disable ttyd -# systemctl stop ttyd -# echo "Disabled ttyd service." -# exit 0 -# elif [ "$1" = "enable" ]; then -# systemctl enable ttyd -# echo "Enabled ttyd service." -# systemctl start ttyd -# exit 0 -# elif [ "$1" = "check" ]; then -# if systemctl is-enabled ttyd &>/dev/null; then -# if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then -# echo -e "\033[4m\033[0;34menabled and running\033[0m" -# elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then -# echo -e "\033[4m\033[0;31menabled but not running\033[0m" -# exit 1 -# else -# echo "unknown" -# fi -# else -# echo -e "\033[4m\033[0;31mdisabled\033[0m" -# exit 1 -# fi -# elif [ "$1" = "start" ]; then -# echo "Starting/restarting ttyd service..." -# systemctl restart ttyd -# elif [ "$1" = "stop" ]; then -# echo "Stopping ttyd service..." -# systemctl stop ttyd -# fi -# } - while getopts ":harsl:ipcnoSEC:R:" opt; do case ${opt} in h) # Option -h (help) @@ -289,26 +255,29 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do ;; C) # Option -C (Check service) if systemctl is-enabled $OPTARG &>/dev/null; then - if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - exit 0 - elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then - echo -e "\033[4m\033[0;31menabled but failed\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then - echo -e "\033[4m\033[0;31menabled, activating\033[0m" - exit 2 - else - echo "unknown" - exit 2 - fi + state="\033[0;34m\033[4menabled\e[39m, " else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - exit 1 + state="\033[0;31m\033[4mdisabled\e[39m, " + exit_state=1 fi + if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then + state+="\033[0;34mrunning\e[0m" + exit_state=0 + elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then + state+="\033[0;31mnot running\e[0m" + exit_state=1 + elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then + state+="\033[0;31mfailed\e[0m" + exit_state=1 + elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then + state+="activating\e[0m" + exit_state=2 + else + state+="unknown\e[0m" + exit_state=2 + fi + echo -e "$state" + exit $exit_state ;; R) replace_colors "$OPTARG" From 412065a195d47de297cd760b9c3f871734920a89 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Feb 2025 19:23:04 +0200 Subject: [PATCH 023/149] Improve granularity of service status utility in femto-utils.sh --- .../usr/local/bin/femto-config | 20 ++--- .../usr/local/bin/femto-software.sh | 5 +- .../usr/local/bin/femto-utils.sh | 80 ++++++------------- 3 files changed, 38 insertions(+), 67 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 8636be1..eaa403c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -547,15 +547,15 @@ meshtastic_settings() { while true; do echo "Checking Meshtasticd service state..." local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")" - choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 17 52 5 \ + choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtasticd Service" --default-item "$choice" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 16 52 5 \ "View detailed service status" "x" \ - " " " " \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "Start/restart service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled and running'; then echo "Stop service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "   "; fi) \ + " " "" \ + "Start/restart service" "x" \ + $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ + " " "" \ $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ - " " " " \ + " " "" \ "Back to previous menu" "x" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in @@ -567,14 +567,14 @@ meshtastic_settings() { dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 6 45 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -s - dialog --no-collapse --msgbox "Meshtasticd service started/restarted." 6 45 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart meshtasticd\Zn\` command to system.\n\nMeshtasticd should be running." 9 50 fi ;; "Stop service") - dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtasticd will automatically restart on boot if not disabled." 11 50 + dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtasticd will automatically restart on boot service if enabled." 11 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -t - dialog --no-collapse --msgbox "Meshtasticd service stopped." 6 45 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop meshtasticd\Zn\` command to system.\n\nMeshtasticd should be stopped." 9 50 fi ;; "Enable service") @@ -588,7 +588,7 @@ meshtastic_settings() { dialog --no-collapse --colors --title "$title" --yesno "Disable Meshtasticd service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -M "disable" - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable meshtasticd\Zn\` and \`\Zusystemctl stop meshtasticd\Zn\` commands to system.\n\nMeshtasticd is disabled and stopped." 10 50 + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable meshtasticd\Zn\` and \`\Zusystemctl stop meshtasticd\Zn\` commands to system.\n\nMeshtasticd should be disabled and stopped." 10 50 fi ;; "Back to previous menu") break ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 2d28b36..4bcd1fb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -88,6 +88,7 @@ package_menu() { echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") + license_button="" if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ @@ -97,8 +98,8 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "enabled" ]]; then echo "Enable service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "disabled" ]]; then echo "Disable service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]] && [[ ! $service_state =~ "disabled" ]]; then echo "Stop service x"; fi) \ - $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ $service_state =~ "enabled" ]]; then echo "Start/restart service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I && [[ ! $service_state =~ "not running" ]]; then echo "Stop service x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 4fa2b0e..d5f2ec3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -214,49 +214,15 @@ replace_colors() { input="${input//$(echo -e '\033[0;37m')/\\Z7}" # white input="${input//$(echo -e '\033[7m')/\\Zr}" # invert input="${input//$(echo -e '\033[4m')/\\Zu}" # underline - input="${input//$(echo -e '\033[0m')/\\Zn}" # reset + input="${input//$(echo -e '\e[39m')/\\Z0}" # reset colors not underline + input="${input//$(echo -e '\033[0m')/\\Zn}" # reset all echo "$input" } -# this has been moved to /usr/local/bin/packages/ttyd.sh under the aegis of femto_software.sh -# ttyd() { -# if [ "$1" = "disable" ]; then -# systemctl disable ttyd -# systemctl stop ttyd -# echo "Disabled ttyd service." -# exit 0 -# elif [ "$1" = "enable" ]; then -# systemctl enable ttyd -# echo "Enabled ttyd service." -# systemctl start ttyd -# exit 0 -# elif [ "$1" = "check" ]; then -# if systemctl is-enabled ttyd &>/dev/null; then -# if echo "$(systemctl status ttyd)" | grep -q "active (running)"; then -# echo -e "\033[4m\033[0;34menabled and running\033[0m" -# elif echo "$(systemctl status ttyd)" | grep -q "inactive (dead)"; then -# echo -e "\033[4m\033[0;31menabled but not running\033[0m" -# exit 1 -# else -# echo "unknown" -# fi -# else -# echo -e "\033[4m\033[0;31mdisabled\033[0m" -# exit 1 -# fi -# elif [ "$1" = "start" ]; then -# echo "Starting/restarting ttyd service..." -# systemctl restart ttyd -# elif [ "$1" = "stop" ]; then -# echo "Stopping ttyd service..." -# systemctl stop ttyd -# fi -# } - while getopts ":harsl:ipcnoSEC:R:" opt; do case ${opt} in h) # Option -h (help) - echo -e $help + echo -e "$help" ;; a) # Option -a (ACT LED enable/disable/check) act_led $2 @@ -289,26 +255,30 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do ;; C) # Option -C (Check service) if systemctl is-enabled $OPTARG &>/dev/null; then - if echo "$(systemctl status $OPTARG)" | grep -q "active (running)"; then - echo -e "\033[4m\033[0;34menabled and running\033[0m" - exit 0 - elif echo "$(systemctl status $OPTARG)" | grep -q "inactive (dead)"; then - echo -e "\033[4m\033[0;31menabled but not running\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "failed"; then - echo -e "\033[4m\033[0;31menabled but failed\033[0m" - exit 1 - elif echo "$(systemctl status $OPTARG)" | grep -q "activating"; then - echo -e "\033[4m\033[0;31menabled, activating\033[0m" - exit 2 - else - echo "unknown" - exit 2 - fi + state_message="\033[0;34m\033[4menabled\e[39m, " else - echo -e "\033[4m\033[0;31mdisabled\033[0m" - exit 1 + state_message="\033[0;31m\033[4mdisabled\e[39m, " + exit_state=1 fi + full_status=$(systemctl status $OPTARG) + if echo $full_status | grep -q "active (running)"; then + state_message+="\033[0;34mrunning\e[0m" + exit_state=0 + elif echo $full_status | grep -q "inactive (dead)"; then + state_message+="\033[0;31mnot running\e[0m" + exit_state=1 + elif echo $full_status | grep -q "failed"; then + state_message+="\033[0;31mfailed\e[0m" + exit_state=1 + elif echo $full_status | grep -q "activating"; then + state_message+="activating\e[0m" + exit_state=2 + else + state_message+="unknown\e[0m" + exit_state=2 + fi + echo -e "$state_message" + exit $exit_state ;; R) replace_colors "$OPTARG" From 2746e23523a3594e5c1861e44b62a4d0028298a3 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 9 Feb 2025 00:26:12 +0200 Subject: [PATCH 024/149] Update femto-utils.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index d5f2ec3..842e870 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -253,7 +253,7 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do chown root:root /etc/ssh/ssh_host_* systemctl restart ssh ;; - C) # Option -C (Check service) + C) # Option -C (Check service status) if systemctl is-enabled $OPTARG &>/dev/null; then state_message="\033[0;34m\033[4menabled\e[39m, " else From a99539977414f61372459d77815944a257091c40 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Sun, 9 Feb 2025 00:26:55 +0200 Subject: [PATCH 025/149] Revert "Update new_working from OSC" --- environment-setup/femtofox.chroot | 1 - .../etc/systemd/system/time-monitor.service | 12 - .../usr/local/bin/time_change.sh | 58 -- .../dts/rv1106-luckfox-pico-ultra-ipc.dtsi | 538 ------------------ 4 files changed, 609 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service delete mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh delete mode 100644 foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index c4342c9..3acbe42 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -61,7 +61,6 @@ systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable wifi-mesh-control -systemctl enable time-monitor systemctl disable apt-daily.timer systemctl disable unattended-upgrades diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service deleted file mode 100644 index 5ffa753..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/time-monitor.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Monitor time changes and restart meshtasticd -After=network.target - -[Service] -ExecStart=/usr/local/bin/time_monitor.sh -Restart=always -User=root - -[Install] -WantedBy=multi-user.target - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh deleted file mode 100755 index c07fb34..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/time_change.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -THRESHOLD=$((7 * 24 * 60 * 60)) # 1 week in seconds -LOGFILE="/var/log/time_change.log" -LAST_TIME_FILE="/tmp/last_time" - -# Function to check time jump -check_time_jump() { - NEW_TIME=$(date +%s) - - if [ -f "$LAST_TIME_FILE" ]; then - OLD_TIME=$(cat "$LAST_TIME_FILE") - else - OLD_TIME=$NEW_TIME - fi - - TIME_DIFF=$((NEW_TIME - OLD_TIME)) - - if [ "${TIME_DIFF#-}" -ge "$THRESHOLD" ]; then - echo "$(date) - Large time change detected ($TIME_DIFF seconds), restarting meshtasticd" | tee -a "$LOGFILE" - systemctl restart meshtasticd - fi - - echo "$NEW_TIME" > "$LAST_TIME_FILE" -} - -# Monitor chronyd logs for time jumps (background) -( - journalctl -fu chronyd --no-pager | while read -r line; do - if echo "$line" | grep -q "Forward time jump detected"; then - echo "$(date) - Detected time change via chronyd logs" | tee -a "$LOGFILE" - check_time_jump - fi - done -) & - -# Monitor /etc/adjtime for manual or RTC-based time changes (background) -( - while true; do - if find /etc/adjtime -mmin -1 | grep -q .; then - echo "$(date) - Time change detected via /etc/adjtime modification" | tee -a "$LOGFILE" - check_time_jump - fi - sleep 5 - done -) & - -# Fallback: Compare timestamps every 5 seconds (if other methods fail) -( - while true; do - check_time_jump - sleep 5 - done -) & - -# Keep script running -wait - diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi deleted file mode 100644 index 4e90c76..0000000 --- a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi +++ /dev/null @@ -1,538 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -/* - * Copyright (c) 2022 Rockchip Electronics Co., Ltd. - */ - -#include "rv1106-evb.dtsi" -#include -#include - -/ { - chosen { - bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; - }; - - backlight: backlight { - status = "okay"; - compatible = "pwm-backlight"; - pwms = <&pwm1 0 100000 50000>; - brightness-levels = < - 0 1 2 3 4 5 6 7 - 8 9 10 11 12 13 14 15 - 16 17 18 19 20 21 22 23 - 24 25 26 27 28 29 30 31 - 32 33 34 35 36 37 38 39 - 40 41 42 43 44 45 46 47 - 48 49 50 51 52 53 54 55 - 56 57 58 59 60 61 62 63 - 64 65 66 67 68 69 70 71 - 72 73 74 75 76 77 78 79 - 80 81 82 83 84 85 86 87 - 88 89 90 91 92 93 94 95 - 96 97 98 99 100 101 102 103 - 104 105 106 107 108 109 110 111 - 112 113 114 115 116 117 118 119 - 120 121 122 123 124 125 126 127 - 128 129 130 131 132 133 134 135 - 136 137 138 139 140 141 142 143 - 144 145 146 147 148 149 150 151 - 152 153 154 155 156 157 158 159 - 160 161 162 163 164 165 166 167 - 168 169 170 171 172 173 174 175 - 176 177 178 179 180 181 182 183 - 184 185 186 187 188 189 190 191 - 192 193 194 195 196 197 198 199 - 200 201 202 203 204 205 206 207 - 208 209 210 211 212 213 214 215 - 216 217 218 219 220 221 222 223 - 224 225 226 227 228 229 230 231 - 232 233 234 235 236 237 238 239 - 240 241 242 243 244 245 246 247 - 248 249 250 251 252 253 254 255>; - default-brightness-level = <255>; - }; - - panel: panel { - compatible = "simple-panel"; - backlight = <&backlight>; - - reset-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>; - reset-delay-ms = <200>; - status = "okay"; - - bus-format = ; - width-mm = <85>; - height-mm = <85>; - - display-timings { - native-mode = <&timing0>; - - timing0: timing0 { - clock-frequency = <30000000>; - hactive = <720>; - vactive = <720>; - hback-porch = <44>; - hfront-porch = <46>; - vback-porch = <18>; - vfront-porch = <16>; - hsync-len = <2>; - vsync-len = <2>; - hsync-active = <0>; - vsync-active = <0>; - de-active = <0>; - pixelclk-active = <0>; - }; - }; - - port { - panel_in_rgb: endpoint { - remote-endpoint = <&rgb_out_panel>; - }; - }; - }; - - reserved_memory: reserved-memory { - status = "okay"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - drm_logo: drm-logo@00000000 { - compatible = "rockchip,drm-logo"; - reg = <0x0 0x0>; - }; - linux,cma { - status = "okay"; - compatible = "shared-dma-pool"; - inactive; - reusable; - size = <0xA00000>; //10M - linux,cma-default; - }; - mmc_ecsd: mmc@3f000 { - reg = <0x3f000 0x00001000>; - }; - }; - - acodec_sound: acodec-sound { - compatible = "simple-audio-card"; - simple-audio-card,name = "rv1106-acodec"; - simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <256>; - simple-audio-card,cpu { - sound-dai = <&i2s0_8ch>; - }; - simple-audio-card,codec { - sound-dai = <&acodec>; - }; - }; - - dsm_sound: dsm-sound { - status = "disabled"; - compatible = "simple-audio-card"; - simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <256>; - simple-audio-card,name = "rockchip,dsm-sound"; - simple-audio-card,bitclock-master = <&sndcodec>; - simple-audio-card,frame-master = <&sndcodec>; - sndcpu: simple-audio-card,cpu { - sound-dai = <&i2s0_8ch>; - }; - sndcodec: simple-audio-card,codec { - sound-dai = <&dsm>; - }; - }; - - vcc_1v8: vcc-1v8 { - compatible = "regulator-fixed"; - regulator-name = "vcc_1v8"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - }; - - vcc_3v3: vcc-3v3 { - compatible = "regulator-fixed"; - regulator-name = "vcc_3v3"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - }; - - vdd_arm: vdd-arm { - compatible = "regulator-fixed"; - regulator-name = "vdd_arm"; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1000000>; - regulator-init-microvolt = <900000>; - regulator-always-on; - regulator-boot-on; - }; - - leds: leds { - compatible = "gpio-leds"; - work_led: work{ - gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "activity"; - default-state = "on"; - }; - }; -}; - -/***************************** audio ********************************/ -&i2s0_8ch { - #sound-dai-cells = <0>; - status = "okay"; -}; - -&acodec { - #sound-dai-cells = <0>; - pa-ctl-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; - status = "okay"; -}; - -/************************* FIQ_DUBUGGER ****************************/ -&fiq_debugger { - rockchip,irq-mode-enable = <1>; - status = "okay"; -}; - -/***************************** USB *********************************/ -&u2phy { - status = "okay"; -}; - -&u2phy_otg { - status = "okay"; -}; - -&usbdrd { - status = "okay"; -}; - -&usbdrd_dwc3 { - extcon = <&u2phy>; - status = "okay"; -}; - -/***************************** DSM *********************************/ -&dsm { - status = "disabled"; -}; - -&cpu0 { - cpu-supply = <&vdd_arm>; -}; - -/*************************** CSI *********************************/ -&csi2_dphy_hw { - status = "okay"; -}; - -&csi2_dphy0 { - status = "okay"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - #address-cells = <1>; - #size-cells = <0>; - - csi_dphy_input0: endpoint@0 { - reg = <0>; - remote-endpoint = <&sc3336_out>; - data-lanes = <1 2>; - }; - - }; - - port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - csi_dphy_output: endpoint@0 { - reg = <0>; - remote-endpoint = <&mipi_csi2_input>; - }; - }; - }; -}; - -&i2c4 { - status = "okay"; - clock-frequency = <400000>; - pinctrl-names = "default"; - // pinctrl-0 = <&i2c4m2_xfer>; - - sc3336: sc3336@30 { - compatible = "smartsens,sc3336"; - status = "okay"; - reg = <0x30>; - clocks = <&cru MCLK_REF_MIPI0>; - clock-names = "xvclk"; - reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&mipi_refclk_out0>; - rockchip,camera-module-index = <0>; - rockchip,camera-module-facing = "back"; - rockchip,camera-module-name = "CMK-OT2119-PC1"; - rockchip,camera-module-lens-name = "30IRC-F16"; - port { - sc3336_out: endpoint { - remote-endpoint = <&csi_dphy_input0>; - data-lanes = <1 2>; - }; - }; - }; -}; - -&mipi0_csi2 { - status = "okay"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - #address-cells = <1>; - #size-cells = <0>; - - mipi_csi2_input: endpoint@1 { - reg = <1>; - remote-endpoint = <&csi_dphy_output>; - }; - }; - - port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - mipi_csi2_output: endpoint@0 { - reg = <0>; - remote-endpoint = <&cif_mipi_in>; - }; - }; - }; -}; - -&rkcif { - status = "okay"; -}; - -&rkcif_mipi_lvds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&mipi_pins>; - port { - /* MIPI CSI-2 endpoint */ - cif_mipi_in: endpoint { - remote-endpoint = <&mipi_csi2_output>; - }; - }; -}; - -&rkcif_mipi_lvds_sditf { - status = "okay"; - - port { - /* MIPI CSI-2 endpoint */ - mipi_lvds_sditf: endpoint { - remote-endpoint = <&isp_in>; - }; - }; -}; - -&rkisp { - status = "okay"; -}; - -&rkisp_vir0 { - status = "okay"; - - port@0 { - isp_in: endpoint { - remote-endpoint = <&mipi_lvds_sditf>; - }; - }; -}; - -/***************************** ADC ********************************/ -&saradc { - status = "okay"; - vref-supply = <&vcc_1v8>; -}; - -&tsadc { - status = "okay"; -}; - -/**************************** LCD/TP ******************************/ -&pwm1 { - status = "okay"; - pinctrl-names = "active"; - pinctrl-0 = <&pwm1m2_pins>; -}; - -&display_subsystem { - status = "okay"; - logo-memory-region = <&drm_logo>; -}; - -&rgb { - status = "disabled"; - pinctrl-names = "default"; - pinctrl-0 = <&lcd_pins>; - - ports { - rgb_out: port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - rgb_out_panel: endpoint@0 { - reg = <0>; - remote-endpoint = <&panel_in_rgb>; - }; - }; - }; -}; - -&rgb_in_vop { - status = "okay"; -}; - -&route_rgb { - status = "disabled"; -}; - -&vop { - status = "okay"; -}; - -&i2c3 { - clock-frequency = <100000>; - GT911:touchscreen { - compatible = "goodix,gt911"; - reg = <0x14>; - - interrupt-parent = <&gpio0>; - interrupts = ; - - reset-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; - }; -}; - -/**************************** PINCTRL ******************************/ -// SPI -&spi0 { - pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; - #address-cells = <1>; - #size-cells = <0>; - spidev@0 { - compatible = "rockchip,spidev"; - spi-max-frequency = <50000000>; - reg = <0>; - }; -}; - -// I2C -&i2c1 { - pinctrl-0 = <&i2c1m1_xfer>; -}; -&i2c2 { - pinctrl-0 = <&i2c2m0_xfer>; -}; -&i2c3 { - pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer &tp_rst &tp_irq>; -}; -&i2c4 { - pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; -}; - -// UART -&uart0 { - pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; -}; -&uart1 { - pinctrl-0 = <&uart1m1_xfer>; -}; -&uart3 { - pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; -}; -&uart4 { - pinctrl-0 = <&uart4m0_xfer>; -}; -&uart5 { - pinctrl-0 = <&uart5m1_xfer>; -}; - -// PWM -&pwm0 { - pinctrl-0 = <&pwm0m1_pins>; -}; -&pwm2 { - pinctrl-0 = <&pwm2m1_pins &pwm2m2_pins>; -}; -&pwm3 { - pinctrl-0 = <&pwm3m2_pins>; -}; -&pwm4 { - pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; -}; -&pwm5 { - pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; -}; -&pwm6 { - pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; -}; -&pwm7 { - pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; -}; -&pwm8 { - pinctrl-0 = <&pwm8m1_pins>; -}; -&pwm9 { - pinctrl-0 = <&pwm9m1_pins>; -}; -&pwm10 { - pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; -}; -&pwm11 { - pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; -}; - -&pinctrl { - spi0 { - spi0m0_clk: spi0m0-clk { - rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; - }; - spi0m0_mosi: spi0m0-mosi { - rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; - }; - spi0m0_miso: spi0m0-miso { - rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; - }; - spi0m0_cs0: spi0m0-cs0 { - rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; - }; - }; - - touchscreen { - tp_rst:tp-rst { - rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; - }; - - tp_irq:tp-irq { - rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -}; From 99dcac2b66e52ed7dfeef1469a307230e3f43b55 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 9 Feb 2025 00:33:22 +0200 Subject: [PATCH 026/149] Create rv1106-luckfox-pico-ultra-ipc.dtsi --- .../dts/rv1106-luckfox-pico-ultra-ipc.dtsi | 538 ++++++++++++++++++ 1 file changed, 538 insertions(+) create mode 100644 foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi new file mode 100644 index 0000000..4e90c76 --- /dev/null +++ b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi @@ -0,0 +1,538 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +#include "rv1106-evb.dtsi" +#include +#include + +/ { + chosen { + bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; + }; + + backlight: backlight { + status = "okay"; + compatible = "pwm-backlight"; + pwms = <&pwm1 0 100000 50000>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <255>; + }; + + panel: panel { + compatible = "simple-panel"; + backlight = <&backlight>; + + reset-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>; + reset-delay-ms = <200>; + status = "okay"; + + bus-format = ; + width-mm = <85>; + height-mm = <85>; + + display-timings { + native-mode = <&timing0>; + + timing0: timing0 { + clock-frequency = <30000000>; + hactive = <720>; + vactive = <720>; + hback-porch = <44>; + hfront-porch = <46>; + vback-porch = <18>; + vfront-porch = <16>; + hsync-len = <2>; + vsync-len = <2>; + hsync-active = <0>; + vsync-active = <0>; + de-active = <0>; + pixelclk-active = <0>; + }; + }; + + port { + panel_in_rgb: endpoint { + remote-endpoint = <&rgb_out_panel>; + }; + }; + }; + + reserved_memory: reserved-memory { + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + drm_logo: drm-logo@00000000 { + compatible = "rockchip,drm-logo"; + reg = <0x0 0x0>; + }; + linux,cma { + status = "okay"; + compatible = "shared-dma-pool"; + inactive; + reusable; + size = <0xA00000>; //10M + linux,cma-default; + }; + mmc_ecsd: mmc@3f000 { + reg = <0x3f000 0x00001000>; + }; + }; + + acodec_sound: acodec-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rv1106-acodec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&acodec>; + }; + }; + + dsm_sound: dsm-sound { + status = "disabled"; + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "rockchip,dsm-sound"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + sndcpu: simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + sndcodec: simple-audio-card,codec { + sound-dai = <&dsm>; + }; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vcc_3v3: vcc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vdd_arm: vdd-arm { + compatible = "regulator-fixed"; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1000000>; + regulator-init-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + }; + + leds: leds { + compatible = "gpio-leds"; + work_led: work{ + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "activity"; + default-state = "on"; + }; + }; +}; + +/***************************** audio ********************************/ +&i2s0_8ch { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&acodec { + #sound-dai-cells = <0>; + pa-ctl-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +/************************* FIQ_DUBUGGER ****************************/ +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/***************************** USB *********************************/ +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usbdrd { + status = "okay"; +}; + +&usbdrd_dwc3 { + extcon = <&u2phy>; + status = "okay"; +}; + +/***************************** DSM *********************************/ +&dsm { + status = "disabled"; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +/*************************** CSI *********************************/ +&csi2_dphy_hw { + status = "okay"; +}; + +&csi2_dphy0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_input0: endpoint@0 { + reg = <0>; + remote-endpoint = <&sc3336_out>; + data-lanes = <1 2>; + }; + + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_csi2_input>; + }; + }; + }; +}; + +&i2c4 { + status = "okay"; + clock-frequency = <400000>; + pinctrl-names = "default"; + // pinctrl-0 = <&i2c4m2_xfer>; + + sc3336: sc3336@30 { + compatible = "smartsens,sc3336"; + status = "okay"; + reg = <0x30>; + clocks = <&cru MCLK_REF_MIPI0>; + clock-names = "xvclk"; + reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mipi_refclk_out0>; + rockchip,camera-module-index = <0>; + rockchip,camera-module-facing = "back"; + rockchip,camera-module-name = "CMK-OT2119-PC1"; + rockchip,camera-module-lens-name = "30IRC-F16"; + port { + sc3336_out: endpoint { + remote-endpoint = <&csi_dphy_input0>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&mipi0_csi2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_input: endpoint@1 { + reg = <1>; + remote-endpoint = <&csi_dphy_output>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&cif_mipi_in>; + }; + }; + }; +}; + +&rkcif { + status = "okay"; +}; + +&rkcif_mipi_lvds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&mipi_pins>; + port { + /* MIPI CSI-2 endpoint */ + cif_mipi_in: endpoint { + remote-endpoint = <&mipi_csi2_output>; + }; + }; +}; + +&rkcif_mipi_lvds_sditf { + status = "okay"; + + port { + /* MIPI CSI-2 endpoint */ + mipi_lvds_sditf: endpoint { + remote-endpoint = <&isp_in>; + }; + }; +}; + +&rkisp { + status = "okay"; +}; + +&rkisp_vir0 { + status = "okay"; + + port@0 { + isp_in: endpoint { + remote-endpoint = <&mipi_lvds_sditf>; + }; + }; +}; + +/***************************** ADC ********************************/ +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&tsadc { + status = "okay"; +}; + +/**************************** LCD/TP ******************************/ +&pwm1 { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm1m2_pins>; +}; + +&display_subsystem { + status = "okay"; + logo-memory-region = <&drm_logo>; +}; + +&rgb { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&lcd_pins>; + + ports { + rgb_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + rgb_out_panel: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_in_rgb>; + }; + }; + }; +}; + +&rgb_in_vop { + status = "okay"; +}; + +&route_rgb { + status = "disabled"; +}; + +&vop { + status = "okay"; +}; + +&i2c3 { + clock-frequency = <100000>; + GT911:touchscreen { + compatible = "goodix,gt911"; + reg = <0x14>; + + interrupt-parent = <&gpio0>; + interrupts = ; + + reset-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + }; +}; + +/**************************** PINCTRL ******************************/ +// SPI +&spi0 { + pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "rockchip,spidev"; + spi-max-frequency = <50000000>; + reg = <0>; + }; +}; + +// I2C +&i2c1 { + pinctrl-0 = <&i2c1m1_xfer>; +}; +&i2c2 { + pinctrl-0 = <&i2c2m0_xfer>; +}; +&i2c3 { + pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer &tp_rst &tp_irq>; +}; +&i2c4 { + pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; +}; + +// UART +&uart0 { + pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; +}; +&uart1 { + pinctrl-0 = <&uart1m1_xfer>; +}; +&uart3 { + pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; +}; +&uart4 { + pinctrl-0 = <&uart4m0_xfer>; +}; +&uart5 { + pinctrl-0 = <&uart5m1_xfer>; +}; + +// PWM +&pwm0 { + pinctrl-0 = <&pwm0m1_pins>; +}; +&pwm2 { + pinctrl-0 = <&pwm2m1_pins &pwm2m2_pins>; +}; +&pwm3 { + pinctrl-0 = <&pwm3m2_pins>; +}; +&pwm4 { + pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; +}; +&pwm5 { + pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; +}; +&pwm6 { + pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; +}; +&pwm7 { + pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; +}; +&pwm8 { + pinctrl-0 = <&pwm8m1_pins>; +}; +&pwm9 { + pinctrl-0 = <&pwm9m1_pins>; +}; +&pwm10 { + pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; +}; +&pwm11 { + pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; +}; + +&pinctrl { + spi0 { + spi0m0_clk: spi0m0-clk { + rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; + }; + spi0m0_mosi: spi0m0-mosi { + rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; + }; + spi0m0_miso: spi0m0-miso { + rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; + }; + spi0m0_cs0: spi0m0-cs0 { + rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; + }; + }; + + touchscreen { + tp_rst:tp-rst { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + tp_irq:tp-irq { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; From 9799a4709f982a95d1e982b4442b2c7752edc356 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Sun, 9 Feb 2025 00:30:16 +0000 Subject: [PATCH 027/149] Add SFC alias to bash_aliases at firstrun because 14 extra characters is too much. --- .../usr/local/bin/femto-runonce.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 1530030..7ffb9de 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -96,8 +96,16 @@ else echo "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" fi +# Add a cheeky alias to .bash_aliases +if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bash_aliases; then # Check if the lines are already in .bash_aliases + echo "alias sfc='sudo femto-config'" >> /home/femto/.bash_aliases + echo "alias sfc='sudo femto-config' to .bash_aliases" +else + echo "alias sfc='sudo femto-config' already present in .bash_aliases, skipping" +fi + # remove first boot flag sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf log_message "Removing first boot flag and rebooting in 5 seconds..." sleep 5 -reboot \ No newline at end of file +reboot From 48f4bec53958f8ca41df1655fcb7adeb3f409de0 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Sun, 9 Feb 2025 00:43:04 +0000 Subject: [PATCH 028/149] Update 00-header --- .../sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header index 8d10a9d..35329a2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header @@ -15,7 +15,7 @@ fi foxbuntu_version=$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) spaces=$((11 - ${#foxbuntu_version})) -printf " For settings, run \`\033[0;31msudo femto-config\033[0m\`\n" +printf " For settings, run \`\033[0;31msudo femto-config\033[0m\` or \`\033[0;31msfc\033[0m\`\n" printf " Made for Femtofox https://www.femtofox.com\n" printf " Foxbuntu v$foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)" From 7d5b8be309a724747d0465ca642d6159c365b7dd Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Sun, 9 Feb 2025 18:58:21 +0200 Subject: [PATCH 029/149] Revert "time-monitor service to restart meshtasticd" --- .../dts/rv1106-luckfox-pico-ultra-ipc.dtsi | 538 ------------------ 1 file changed, 538 deletions(-) delete mode 100644 foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi deleted file mode 100644 index 4e90c76..0000000 --- a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi +++ /dev/null @@ -1,538 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -/* - * Copyright (c) 2022 Rockchip Electronics Co., Ltd. - */ - -#include "rv1106-evb.dtsi" -#include -#include - -/ { - chosen { - bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; - }; - - backlight: backlight { - status = "okay"; - compatible = "pwm-backlight"; - pwms = <&pwm1 0 100000 50000>; - brightness-levels = < - 0 1 2 3 4 5 6 7 - 8 9 10 11 12 13 14 15 - 16 17 18 19 20 21 22 23 - 24 25 26 27 28 29 30 31 - 32 33 34 35 36 37 38 39 - 40 41 42 43 44 45 46 47 - 48 49 50 51 52 53 54 55 - 56 57 58 59 60 61 62 63 - 64 65 66 67 68 69 70 71 - 72 73 74 75 76 77 78 79 - 80 81 82 83 84 85 86 87 - 88 89 90 91 92 93 94 95 - 96 97 98 99 100 101 102 103 - 104 105 106 107 108 109 110 111 - 112 113 114 115 116 117 118 119 - 120 121 122 123 124 125 126 127 - 128 129 130 131 132 133 134 135 - 136 137 138 139 140 141 142 143 - 144 145 146 147 148 149 150 151 - 152 153 154 155 156 157 158 159 - 160 161 162 163 164 165 166 167 - 168 169 170 171 172 173 174 175 - 176 177 178 179 180 181 182 183 - 184 185 186 187 188 189 190 191 - 192 193 194 195 196 197 198 199 - 200 201 202 203 204 205 206 207 - 208 209 210 211 212 213 214 215 - 216 217 218 219 220 221 222 223 - 224 225 226 227 228 229 230 231 - 232 233 234 235 236 237 238 239 - 240 241 242 243 244 245 246 247 - 248 249 250 251 252 253 254 255>; - default-brightness-level = <255>; - }; - - panel: panel { - compatible = "simple-panel"; - backlight = <&backlight>; - - reset-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>; - reset-delay-ms = <200>; - status = "okay"; - - bus-format = ; - width-mm = <85>; - height-mm = <85>; - - display-timings { - native-mode = <&timing0>; - - timing0: timing0 { - clock-frequency = <30000000>; - hactive = <720>; - vactive = <720>; - hback-porch = <44>; - hfront-porch = <46>; - vback-porch = <18>; - vfront-porch = <16>; - hsync-len = <2>; - vsync-len = <2>; - hsync-active = <0>; - vsync-active = <0>; - de-active = <0>; - pixelclk-active = <0>; - }; - }; - - port { - panel_in_rgb: endpoint { - remote-endpoint = <&rgb_out_panel>; - }; - }; - }; - - reserved_memory: reserved-memory { - status = "okay"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - drm_logo: drm-logo@00000000 { - compatible = "rockchip,drm-logo"; - reg = <0x0 0x0>; - }; - linux,cma { - status = "okay"; - compatible = "shared-dma-pool"; - inactive; - reusable; - size = <0xA00000>; //10M - linux,cma-default; - }; - mmc_ecsd: mmc@3f000 { - reg = <0x3f000 0x00001000>; - }; - }; - - acodec_sound: acodec-sound { - compatible = "simple-audio-card"; - simple-audio-card,name = "rv1106-acodec"; - simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <256>; - simple-audio-card,cpu { - sound-dai = <&i2s0_8ch>; - }; - simple-audio-card,codec { - sound-dai = <&acodec>; - }; - }; - - dsm_sound: dsm-sound { - status = "disabled"; - compatible = "simple-audio-card"; - simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <256>; - simple-audio-card,name = "rockchip,dsm-sound"; - simple-audio-card,bitclock-master = <&sndcodec>; - simple-audio-card,frame-master = <&sndcodec>; - sndcpu: simple-audio-card,cpu { - sound-dai = <&i2s0_8ch>; - }; - sndcodec: simple-audio-card,codec { - sound-dai = <&dsm>; - }; - }; - - vcc_1v8: vcc-1v8 { - compatible = "regulator-fixed"; - regulator-name = "vcc_1v8"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - }; - - vcc_3v3: vcc-3v3 { - compatible = "regulator-fixed"; - regulator-name = "vcc_3v3"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - }; - - vdd_arm: vdd-arm { - compatible = "regulator-fixed"; - regulator-name = "vdd_arm"; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1000000>; - regulator-init-microvolt = <900000>; - regulator-always-on; - regulator-boot-on; - }; - - leds: leds { - compatible = "gpio-leds"; - work_led: work{ - gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "activity"; - default-state = "on"; - }; - }; -}; - -/***************************** audio ********************************/ -&i2s0_8ch { - #sound-dai-cells = <0>; - status = "okay"; -}; - -&acodec { - #sound-dai-cells = <0>; - pa-ctl-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; - status = "okay"; -}; - -/************************* FIQ_DUBUGGER ****************************/ -&fiq_debugger { - rockchip,irq-mode-enable = <1>; - status = "okay"; -}; - -/***************************** USB *********************************/ -&u2phy { - status = "okay"; -}; - -&u2phy_otg { - status = "okay"; -}; - -&usbdrd { - status = "okay"; -}; - -&usbdrd_dwc3 { - extcon = <&u2phy>; - status = "okay"; -}; - -/***************************** DSM *********************************/ -&dsm { - status = "disabled"; -}; - -&cpu0 { - cpu-supply = <&vdd_arm>; -}; - -/*************************** CSI *********************************/ -&csi2_dphy_hw { - status = "okay"; -}; - -&csi2_dphy0 { - status = "okay"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - #address-cells = <1>; - #size-cells = <0>; - - csi_dphy_input0: endpoint@0 { - reg = <0>; - remote-endpoint = <&sc3336_out>; - data-lanes = <1 2>; - }; - - }; - - port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - csi_dphy_output: endpoint@0 { - reg = <0>; - remote-endpoint = <&mipi_csi2_input>; - }; - }; - }; -}; - -&i2c4 { - status = "okay"; - clock-frequency = <400000>; - pinctrl-names = "default"; - // pinctrl-0 = <&i2c4m2_xfer>; - - sc3336: sc3336@30 { - compatible = "smartsens,sc3336"; - status = "okay"; - reg = <0x30>; - clocks = <&cru MCLK_REF_MIPI0>; - clock-names = "xvclk"; - reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&mipi_refclk_out0>; - rockchip,camera-module-index = <0>; - rockchip,camera-module-facing = "back"; - rockchip,camera-module-name = "CMK-OT2119-PC1"; - rockchip,camera-module-lens-name = "30IRC-F16"; - port { - sc3336_out: endpoint { - remote-endpoint = <&csi_dphy_input0>; - data-lanes = <1 2>; - }; - }; - }; -}; - -&mipi0_csi2 { - status = "okay"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - #address-cells = <1>; - #size-cells = <0>; - - mipi_csi2_input: endpoint@1 { - reg = <1>; - remote-endpoint = <&csi_dphy_output>; - }; - }; - - port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - mipi_csi2_output: endpoint@0 { - reg = <0>; - remote-endpoint = <&cif_mipi_in>; - }; - }; - }; -}; - -&rkcif { - status = "okay"; -}; - -&rkcif_mipi_lvds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&mipi_pins>; - port { - /* MIPI CSI-2 endpoint */ - cif_mipi_in: endpoint { - remote-endpoint = <&mipi_csi2_output>; - }; - }; -}; - -&rkcif_mipi_lvds_sditf { - status = "okay"; - - port { - /* MIPI CSI-2 endpoint */ - mipi_lvds_sditf: endpoint { - remote-endpoint = <&isp_in>; - }; - }; -}; - -&rkisp { - status = "okay"; -}; - -&rkisp_vir0 { - status = "okay"; - - port@0 { - isp_in: endpoint { - remote-endpoint = <&mipi_lvds_sditf>; - }; - }; -}; - -/***************************** ADC ********************************/ -&saradc { - status = "okay"; - vref-supply = <&vcc_1v8>; -}; - -&tsadc { - status = "okay"; -}; - -/**************************** LCD/TP ******************************/ -&pwm1 { - status = "okay"; - pinctrl-names = "active"; - pinctrl-0 = <&pwm1m2_pins>; -}; - -&display_subsystem { - status = "okay"; - logo-memory-region = <&drm_logo>; -}; - -&rgb { - status = "disabled"; - pinctrl-names = "default"; - pinctrl-0 = <&lcd_pins>; - - ports { - rgb_out: port@1 { - reg = <1>; - #address-cells = <1>; - #size-cells = <0>; - - rgb_out_panel: endpoint@0 { - reg = <0>; - remote-endpoint = <&panel_in_rgb>; - }; - }; - }; -}; - -&rgb_in_vop { - status = "okay"; -}; - -&route_rgb { - status = "disabled"; -}; - -&vop { - status = "okay"; -}; - -&i2c3 { - clock-frequency = <100000>; - GT911:touchscreen { - compatible = "goodix,gt911"; - reg = <0x14>; - - interrupt-parent = <&gpio0>; - interrupts = ; - - reset-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; - }; -}; - -/**************************** PINCTRL ******************************/ -// SPI -&spi0 { - pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; - #address-cells = <1>; - #size-cells = <0>; - spidev@0 { - compatible = "rockchip,spidev"; - spi-max-frequency = <50000000>; - reg = <0>; - }; -}; - -// I2C -&i2c1 { - pinctrl-0 = <&i2c1m1_xfer>; -}; -&i2c2 { - pinctrl-0 = <&i2c2m0_xfer>; -}; -&i2c3 { - pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer &tp_rst &tp_irq>; -}; -&i2c4 { - pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; -}; - -// UART -&uart0 { - pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; -}; -&uart1 { - pinctrl-0 = <&uart1m1_xfer>; -}; -&uart3 { - pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; -}; -&uart4 { - pinctrl-0 = <&uart4m0_xfer>; -}; -&uart5 { - pinctrl-0 = <&uart5m1_xfer>; -}; - -// PWM -&pwm0 { - pinctrl-0 = <&pwm0m1_pins>; -}; -&pwm2 { - pinctrl-0 = <&pwm2m1_pins &pwm2m2_pins>; -}; -&pwm3 { - pinctrl-0 = <&pwm3m2_pins>; -}; -&pwm4 { - pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; -}; -&pwm5 { - pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; -}; -&pwm6 { - pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; -}; -&pwm7 { - pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; -}; -&pwm8 { - pinctrl-0 = <&pwm8m1_pins>; -}; -&pwm9 { - pinctrl-0 = <&pwm9m1_pins>; -}; -&pwm10 { - pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; -}; -&pwm11 { - pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; -}; - -&pinctrl { - spi0 { - spi0m0_clk: spi0m0-clk { - rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; - }; - spi0m0_mosi: spi0m0-mosi { - rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; - }; - spi0m0_miso: spi0m0-miso { - rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; - }; - spi0m0_cs0: spi0m0-cs0 { - rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; - }; - }; - - touchscreen { - tp_rst:tp-rst { - rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; - }; - - tp_irq:tp-irq { - rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; -}; From 4316bd2c8890661baa02f43cc3ffe15bf0066f37 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 9 Feb 2025 19:03:39 +0200 Subject: [PATCH 030/149] Create rv1106-luckfox-pico-ultra-ipc.dtsi --- .../dts/rv1106-luckfox-pico-ultra-ipc.dtsi | 538 ++++++++++++++++++ 1 file changed, 538 insertions(+) create mode 100644 foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi new file mode 100644 index 0000000..4e90c76 --- /dev/null +++ b/foxbuntu/sysdrv/source/kernel/arch/arm/boot/dts/rv1106-luckfox-pico-ultra-ipc.dtsi @@ -0,0 +1,538 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. + */ + +#include "rv1106-evb.dtsi" +#include +#include + +/ { + chosen { + bootargs = "earlycon=uart8250,mmio32,0xff4c0000 console=ttyFIQ0 root=/dev/mmcblk0p7 rootwait snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0"; + }; + + backlight: backlight { + status = "okay"; + compatible = "pwm-backlight"; + pwms = <&pwm1 0 100000 50000>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <255>; + }; + + panel: panel { + compatible = "simple-panel"; + backlight = <&backlight>; + + reset-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>; + reset-delay-ms = <200>; + status = "okay"; + + bus-format = ; + width-mm = <85>; + height-mm = <85>; + + display-timings { + native-mode = <&timing0>; + + timing0: timing0 { + clock-frequency = <30000000>; + hactive = <720>; + vactive = <720>; + hback-porch = <44>; + hfront-porch = <46>; + vback-porch = <18>; + vfront-porch = <16>; + hsync-len = <2>; + vsync-len = <2>; + hsync-active = <0>; + vsync-active = <0>; + de-active = <0>; + pixelclk-active = <0>; + }; + }; + + port { + panel_in_rgb: endpoint { + remote-endpoint = <&rgb_out_panel>; + }; + }; + }; + + reserved_memory: reserved-memory { + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + drm_logo: drm-logo@00000000 { + compatible = "rockchip,drm-logo"; + reg = <0x0 0x0>; + }; + linux,cma { + status = "okay"; + compatible = "shared-dma-pool"; + inactive; + reusable; + size = <0xA00000>; //10M + linux,cma-default; + }; + mmc_ecsd: mmc@3f000 { + reg = <0x3f000 0x00001000>; + }; + }; + + acodec_sound: acodec-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rv1106-acodec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&acodec>; + }; + }; + + dsm_sound: dsm-sound { + status = "disabled"; + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "rockchip,dsm-sound"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + sndcpu: simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + sndcodec: simple-audio-card,codec { + sound-dai = <&dsm>; + }; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vcc_3v3: vcc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vdd_arm: vdd-arm { + compatible = "regulator-fixed"; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1000000>; + regulator-init-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + }; + + leds: leds { + compatible = "gpio-leds"; + work_led: work{ + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "activity"; + default-state = "on"; + }; + }; +}; + +/***************************** audio ********************************/ +&i2s0_8ch { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&acodec { + #sound-dai-cells = <0>; + pa-ctl-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +/************************* FIQ_DUBUGGER ****************************/ +&fiq_debugger { + rockchip,irq-mode-enable = <1>; + status = "okay"; +}; + +/***************************** USB *********************************/ +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usbdrd { + status = "okay"; +}; + +&usbdrd_dwc3 { + extcon = <&u2phy>; + status = "okay"; +}; + +/***************************** DSM *********************************/ +&dsm { + status = "disabled"; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +/*************************** CSI *********************************/ +&csi2_dphy_hw { + status = "okay"; +}; + +&csi2_dphy0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_input0: endpoint@0 { + reg = <0>; + remote-endpoint = <&sc3336_out>; + data-lanes = <1 2>; + }; + + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + csi_dphy_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&mipi_csi2_input>; + }; + }; + }; +}; + +&i2c4 { + status = "okay"; + clock-frequency = <400000>; + pinctrl-names = "default"; + // pinctrl-0 = <&i2c4m2_xfer>; + + sc3336: sc3336@30 { + compatible = "smartsens,sc3336"; + status = "okay"; + reg = <0x30>; + clocks = <&cru MCLK_REF_MIPI0>; + clock-names = "xvclk"; + reset-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&mipi_refclk_out0>; + rockchip,camera-module-index = <0>; + rockchip,camera-module-facing = "back"; + rockchip,camera-module-name = "CMK-OT2119-PC1"; + rockchip,camera-module-lens-name = "30IRC-F16"; + port { + sc3336_out: endpoint { + remote-endpoint = <&csi_dphy_input0>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&mipi0_csi2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_input: endpoint@1 { + reg = <1>; + remote-endpoint = <&csi_dphy_output>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_csi2_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&cif_mipi_in>; + }; + }; + }; +}; + +&rkcif { + status = "okay"; +}; + +&rkcif_mipi_lvds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&mipi_pins>; + port { + /* MIPI CSI-2 endpoint */ + cif_mipi_in: endpoint { + remote-endpoint = <&mipi_csi2_output>; + }; + }; +}; + +&rkcif_mipi_lvds_sditf { + status = "okay"; + + port { + /* MIPI CSI-2 endpoint */ + mipi_lvds_sditf: endpoint { + remote-endpoint = <&isp_in>; + }; + }; +}; + +&rkisp { + status = "okay"; +}; + +&rkisp_vir0 { + status = "okay"; + + port@0 { + isp_in: endpoint { + remote-endpoint = <&mipi_lvds_sditf>; + }; + }; +}; + +/***************************** ADC ********************************/ +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&tsadc { + status = "okay"; +}; + +/**************************** LCD/TP ******************************/ +&pwm1 { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm1m2_pins>; +}; + +&display_subsystem { + status = "okay"; + logo-memory-region = <&drm_logo>; +}; + +&rgb { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&lcd_pins>; + + ports { + rgb_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + rgb_out_panel: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_in_rgb>; + }; + }; + }; +}; + +&rgb_in_vop { + status = "okay"; +}; + +&route_rgb { + status = "disabled"; +}; + +&vop { + status = "okay"; +}; + +&i2c3 { + clock-frequency = <100000>; + GT911:touchscreen { + compatible = "goodix,gt911"; + reg = <0x14>; + + interrupt-parent = <&gpio0>; + interrupts = ; + + reset-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + }; +}; + +/**************************** PINCTRL ******************************/ +// SPI +&spi0 { + pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "rockchip,spidev"; + spi-max-frequency = <50000000>; + reg = <0>; + }; +}; + +// I2C +&i2c1 { + pinctrl-0 = <&i2c1m1_xfer>; +}; +&i2c2 { + pinctrl-0 = <&i2c2m0_xfer>; +}; +&i2c3 { + pinctrl-0 = <&i2c3m0_xfer &i2c3m1_xfer &i2c3m2_xfer &tp_rst &tp_irq>; +}; +&i2c4 { + pinctrl-0 = <&i2c4m0_xfer &i2c4m1_xfer &i2c4m2_xfer>; +}; + +// UART +&uart0 { + pinctrl-0 = <&uart0m0_xfer &uart0m1_xfer>; +}; +&uart1 { + pinctrl-0 = <&uart1m1_xfer>; +}; +&uart3 { + pinctrl-0 = <&uart3m0_xfer &uart3m1_xfer>; +}; +&uart4 { + pinctrl-0 = <&uart4m0_xfer>; +}; +&uart5 { + pinctrl-0 = <&uart5m1_xfer>; +}; + +// PWM +&pwm0 { + pinctrl-0 = <&pwm0m1_pins>; +}; +&pwm2 { + pinctrl-0 = <&pwm2m1_pins &pwm2m2_pins>; +}; +&pwm3 { + pinctrl-0 = <&pwm3m2_pins>; +}; +&pwm4 { + pinctrl-0 = <&pwm4m0_pins &pwm4m1_pins &pwm4m2_pins>; +}; +&pwm5 { + pinctrl-0 = <&pwm5m1_pins &pwm5m2_pins>; +}; +&pwm6 { + pinctrl-0 = <&pwm6m1_pins &pwm6m2_pins>; +}; +&pwm7 { + pinctrl-0 = <&pwm7m0_pins &pwm7m1_pins>; +}; +&pwm8 { + pinctrl-0 = <&pwm8m1_pins>; +}; +&pwm9 { + pinctrl-0 = <&pwm9m1_pins>; +}; +&pwm10 { + pinctrl-0 = <&pwm10m1_pins &pwm10m2_pins>; +}; +&pwm11 { + pinctrl-0 = <&pwm11m1_pins &pwm11m2_pins>; +}; + +&pinctrl { + spi0 { + spi0m0_clk: spi0m0-clk { + rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>; + }; + spi0m0_mosi: spi0m0-mosi { + rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>; + }; + spi0m0_miso: spi0m0-miso { + rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>; + }; + spi0m0_cs0: spi0m0-cs0 { + rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>; + }; + }; + + touchscreen { + tp_rst:tp-rst { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + tp_irq:tp-irq { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; From 3ad68460f01204e9b9d205a20421f160759fd806 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 10 Feb 2025 01:12:48 +0200 Subject: [PATCH 031/149] Fix small niggling error in sysinfo cpu --- .../usr/local/bin/femto-config | 20 +------------------ .../usr/local/bin/femto-utils.sh | 4 ++-- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index eaa403c..2d98653 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -230,25 +230,7 @@ utilities() { ;; 7) # Complete system info) loading "Loading complete system info..." - dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "\ - Femtofox - CPU: -$(ingest_data "femto-utils.sh -c" 15) - - Operating System: -$(ingest_data "femto-utils.sh -o" 15) - - Storage: -$(ingest_data "femto-utils.sh -S" 15) - - Networking (wlan0 & eth0): -$(ingest_data "femto-utils.sh -p" 15) - - Peripherals: -$(ingest_data "femto-utils.sh -n" 15) - - Meshtasticd: -$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 + dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-utils.sh -i" 15)" 0 0 ;; 8) break ;; esac diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index e2103f6..5935c4b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -61,8 +61,8 @@ act_led() { } cpu_info() { - local core="$(cat /sys/firmware/devicetree/base/model | tr -d '\0')" - local cpu_model="$(dmesg | grep "soc_id" | sed -n 's/.*soc_id: //p' | tr -d '\0')"; cpu_model="${cpu_model:-$(cat /proc/device-tree/compatible | sed 's/.*,\([^,]*\)$/\1/' | tr -d '\0')}" + local core="Luckfox Pico" + local cpu_model="$(tr -d '\0' Date: Mon, 10 Feb 2025 01:14:46 +0200 Subject: [PATCH 032/149] Update femto-config --- .../sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 2d98653..feecd37 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -230,7 +230,7 @@ utilities() { ;; 7) # Complete system info) loading "Loading complete system info..." - dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-utils.sh -i" 15)" 0 0 + dialog --no-collapse --colors --title "Complete system info" --msgbox "$(ingest_data "femto-utils.sh -i" 15)" 0 0 ;; 8) break ;; esac From 4f16844e83a9669dda493f599986aaa4bbad532c Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 10 Feb 2025 18:13:39 +0200 Subject: [PATCH 033/149] Check if meshtasticd service is running before trying to modify settings --- .../usr/local/bin/femto-config | 203 ++++++++++-------- .../usr/local/bin/femto-meshtasticd-config.sh | 4 +- .../usr/local/bin/femto-utils.sh | 2 +- 3 files changed, 117 insertions(+), 92 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index feecd37..238d9ac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -50,9 +50,8 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` local output_string="" # Read the output from femto-meshtasticd-config.sh and store output_string while IFS=':' read -r key value; do - # Trim leading/trailing spaces from key and value - key=$(femto-utils.sh -R "$(echo "$key" | xargs)") - value=$(femto-utils.sh -R "$(echo "$value" | xargs)") + key=$(femto-utils.sh -R "$(echo "$key")") + value=$(femto-utils.sh -R "$(echo "$value" | xargs)") # Trim leading/trailing spaces from value if [[ -z "$key" && -z "$value" ]]; then output_string+="---\n" else @@ -62,6 +61,18 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` echo -e "$output_string" } +check_meshtasticd_running() { + if echo $(femto-utils.sh -C "meshtasticd") | grep -q "not running"; then + dialog --no-collapse --title "Meshtasticd service" --yesno "Meshtasticd service is not running but is required.\n\nStart service?" 9 50 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -s + return 0 + else + return 1 + fi + fi +} + wifi_config() { local title2="Wi-Fi (wlan0) Settings" local config=$(dialog --no-collapse --title "$title2" --form "↑ ↓ to navigate, [ESC] to cancel." 10 45 0 \ @@ -225,8 +236,10 @@ utilities() { dialog --no-collapse --colors --title "Networking info" --msgbox "$(ingest_data "femto-utils.sh -n" 15)" 0 0 ;; 6) # Meshtastic node info) - loading "Loading Meshtastic node info..." - dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 + check_meshtasticd_running && ( + loading "Loading Meshtastic node info..." + dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 + ) ;; 7) # Complete system info) loading "Loading complete system info..." @@ -422,107 +435,119 @@ meshtastic_settings() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $meshtastic_choice in 1) # view node info) - loading "Getting node info..." - dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 + check_meshtasticd_running && ( + loading "Getting node info..." + dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 + ) ;; 2) # get current configuration URL & QR code) - loading "Getting Meshtastic QR code and URL..." - femto-meshtasticd-config.sh -g - pause + check_meshtasticd_running && ( + loading "Getting Meshtastic QR code and URL..." + femto-meshtasticd-config.sh -g + pause + ) ;; 3) # set URL) - newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) - if [ -n "$newurl" ]; then #if a URL was entered - dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + check_meshtasticd_running && ( + newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + if [ -n "$newurl" ]; then #if a URL was entered + dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi fi - fi + ) ;; 4) # set radio) - set_lora_radio + check_meshtasticd_running && ( + set_lora_radio + ) ;; 5) # remote admin) - choice="" # zero the choice before loading the submenu - while true; do - choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --item-help --menu "" 16 40 5 \ - 1 "View/change public key" "" \ - 2 "View/change private key" "" \ - " " "" "" \ - 3 "View admin keys" "" \ - 4 "Set admin key" "" \ - 5 "Clear admin keys" "" \ - 6 "Legacy admin channel" "" \ - " " "" "" \ - 7 "Return to previous menu" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - case $choice in - 1) # view/change public key) - loading "Getting current public key..." - key=$(femto-meshtasticd-config.sh -u) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + check_meshtasticd_running && ( + choice="" # zero the choice before loading the submenu + while true; do + choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --item-help --menu "" 16 40 5 \ + 1 "View/change public key" "" \ + 2 "View/change private key" "" \ + " " "" "" \ + 3 "View admin keys" "" \ + 4 "Set admin key" "" \ + 5 "Clear admin keys" "" \ + 6 "Legacy admin channel" "" \ + " " "" "" \ + 7 "Return to previous menu" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + case $choice in + 1) # view/change public key) + loading "Getting current public key..." + key=$(femto-meshtasticd-config.sh -u) + if [ -n "$key" ]; then + dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55 if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi fi + else + dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 fi - else - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 - fi - ;; - 2) # view/change private key) - loading "Getting current private key..." - key=$(femto-meshtasticd-config.sh -u) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + ;; + 2) # view/change private key) + loading "Getting current private key..." + key=$(femto-meshtasticd-config.sh -u) + if [ -n "$key" ]; then + dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55 if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi fi + else + dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 fi - else - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 - fi - ;; - 3) # view admin keys) - loading "Getting Admin Keys..." - dialog --no-collapse --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -a | tail -n 1 | sed 's/|n/\\n/g')" 0 0 - ;; - 4) # set admin key) - key=$(dialog --no-collapse --title "Admin Keys" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n\n(SHIFT+INS to paste):" 11 40 3>&1 1>&2 2>&3) - if [ -n "$key" ]; then #if a key was entered - loading "Sending command..." - dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 5) # clear admin keys) - dialog --no-collapse --title "Admin Keys" --yesno "Meshtasticd can have up to 3 admin keys. If more are added, they will be ignored.\n\nClear admin key list?\n" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -c && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 6) # legacy admin) - legacy_admin - ;; - 7) # return to previous menu) - break - ;; - esac - done + ;; + 3) # view admin keys) + loading "Getting Admin Keys..." + dialog --no-collapse --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -a | tail -n 1 | sed 's/|n/\\n/g')" 0 0 + ;; + 4) # set admin key) + key=$(dialog --no-collapse --title "Admin Keys" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n\n(SHIFT+INS to paste):" 11 40 3>&1 1>&2 2>&3) + if [ -n "$key" ]; then #if a key was entered + loading "Sending command..." + dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ;; + 5) # clear admin keys) + dialog --no-collapse --title "Admin Keys" --yesno "Meshtasticd can have up to 3 admin keys. If more are added, they will be ignored.\n\nClear admin key list?\n" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -c && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ;; + 6) # legacy admin) + legacy_admin + ;; + 7) # return to previous menu) + break + ;; + esac + done + ) ;; 6) #test mesh connectivity) - dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 - if [ $? -eq 0 ]; then #unless cancel/no - dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 - dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0 - fi + check_meshtasticd_running && ( + dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 + if [ $? -eq 0 ]; then #unless cancel/no + dialog --no-collapse --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 + dialog --no-collapse --colors --title "Meshtasticd connectivity test" --msgbox "$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -w)")" 0 0 + fi + ) ;; 7) #manage meshtasticd service) choice="" # zero the choice before loading the submenu diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index e915361..fe193b0 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -101,7 +101,7 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do output_array+=("Role=$(echo "$output" | grep -oP '"role":\s*"\K[^"]+' | head -n 1)") freq_offset=$(echo "$output" | grep -oP '"bandwidth":\s*\K\w+') if [ "$freq_offset" != 0 ]; then # only display frequency offset if not 0 - output_array+=("Override freq=$freq_offset") + output_array+=("Freq offset=$freq_offset") fi output_array+=("Region=$(echo "$output" | grep -oP '"region":\s*"\K[^"]+')") output_array+=("Hop limit=$(echo "$output" | grep -oP '"hopLimit":\s*\K\w+')") @@ -110,7 +110,7 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do freq_slot+=("Freq slot=$freq_slot") fi override_freq=$(echo "$output" | grep -oP '"overrideFrequency":\s*\K[0-9.]+') - if [ "$override_freq" != "0" ]; then # only display override frequency if not 0 + if [ "$override_freq" != "0.0" ]; then # only display override frequency if not 0.0 output_array+=("Override freq=$override_freq") fi output_array+=("Public key=$(echo "$output" | grep -oP '"publicKey":\s*"\K[^"]+' | head -n 1)") diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 5935c4b..924595d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -142,7 +142,7 @@ peripherals_info() { fi done fi - done <<< "$(echo "$(sudo i2cdetect -y 3)")" + done <<< "$(echo "$(timeout 3 i2cdetect -y 3)")" # when no i2c devices are connected, i2cdetect tries to connect for a solid 25 seconds. The timeout prevents this [[ -z "$i2c_addresses" ]] && i2c_addresses="none detected" # if no addresses found, "none detected" echo -e "LoRa radio:$lora_radio\n\ From 4926254b4064f434db891def8b1cc41bc34fd07a Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:28:42 +0000 Subject: [PATCH 034/149] Revert 00-header --- .../sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header index 35329a2..8d10a9d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header @@ -15,7 +15,7 @@ fi foxbuntu_version=$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) spaces=$((11 - ${#foxbuntu_version})) -printf " For settings, run \`\033[0;31msudo femto-config\033[0m\` or \`\033[0;31msfc\033[0m\`\n" +printf " For settings, run \`\033[0;31msudo femto-config\033[0m\`\n" printf " Made for Femtofox https://www.femtofox.com\n" printf " Foxbuntu v$foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)" From 5d1518bd911076d61a9f60fd39b1a545bd10f6fc Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:39:18 +0200 Subject: [PATCH 035/149] Update femto-runonce.sh --- .../usr/local/bin/femto-runonce.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 7ffb9de..9776b6c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -19,13 +19,14 @@ Re-running this script will:\n\ * Allocate the swap file\n\ * Replace the SSH encryption keys\n\ * Add terminal type to user femto's .bashrc\n\ +* Add a shortcut \`sfc\` to femto's .bashrc\n\ * Set the eth0 MAC to be derivative of CPU serial number\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ Re-running this script after first boot should not cause any harm, but may not work as expected.\n\ \n\ -Proceed?" 19 60 +Proceed?" 20 60 if [ $? -eq 1 ]; then #if cancel/no exit 0 fi @@ -97,11 +98,11 @@ else fi # Add a cheeky alias to .bash_aliases -if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bash_aliases; then # Check if the lines are already in .bash_aliases - echo "alias sfc='sudo femto-config'" >> /home/femto/.bash_aliases - echo "alias sfc='sudo femto-config' to .bash_aliases" +if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases + echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc + echo "Added alias sfc='sudo femto-config' to .bashrc" else - echo "alias sfc='sudo femto-config' already present in .bash_aliases, skipping" + echo "alias sfc='sudo femto-config' already present in .bashrc, skipping" fi # remove first boot flag From 5876ced494bd2d38ab5cdb12e14a055a1ed6eaa6 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Mon, 10 Feb 2025 11:26:55 -0800 Subject: [PATCH 036/149] wifi mesh control and watchclock-dog Renamed wifi-mesh-control and now checks for meshtasticd to be running. Also removed wants from service to prevent starting meshtasticd. Added femto-watchclock-dog that checks for large time changes and restarts meshtasticd if detected to prevent a state where meshtasticd is running but not responsive on api port. --- .../system/femto-watchclock-dog.service | 12 +++++ .../system/femto-wifi-mesh-control.service} | 4 +- .../usr/local/bin/femto-watchclock-dog.sh | 52 +++++++++++++++++++ ...-control.sh => femto-wifi-mesh-control.sh} | 10 ++-- 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/{lib/systemd/system/wifi-mesh-control.service => etc/systemd/system/femto-wifi-mesh-control.service} (66%) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/{wifi-mesh-control.sh => femto-wifi-mesh-control.sh} (93%) mode change 100755 => 100644 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service new file mode 100644 index 0000000..454c957 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monitor time jumps and restart meshtasticd +After=network.target + +[Service] +ExecStart=/usr/local/bin/femto-watchclock-dog.sh +Restart=always +User=root + +[Install] +WantedBy=multi-user.target + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service similarity index 66% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service index 3860f53..c01cff4 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service @@ -1,11 +1,11 @@ [Unit] Description=Meshtastic control of wifi After=meshtasticd.service -Requires=meshtasticd.service [Service] -ExecStart=/usr/local/bin/wifi-mesh-control.sh +ExecStart=/usr/local/bin/femto-wifi-mesh-control.sh Restart=always +RestartSec=5 User=root [Install] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh new file mode 100644 index 0000000..6cefdfa --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +THRESHOLD=$((7 * 24 * 60 * 60)) # 1 week in seconds +LOGFILE="/var/log/time_change.log" +LAST_TIME_FILE="/tmp/last_time" + +# Ensure the log file exists and is writable +if [ ! -f "$LOGFILE" ]; then + touch "$LOGFILE" || { echo "ERROR: Cannot create log file $LOGFILE"; exit 1; } +fi +if [ ! -w "$LOGFILE" ]; then + echo "ERROR: Log file $LOGFILE is not writable" + exit 1 +fi + +# Ensure the last time file exists and is writable +if [ ! -f "$LAST_TIME_FILE" ]; then + date +%s > "$LAST_TIME_FILE" || { echo "ERROR: Cannot create last time file $LAST_TIME_FILE"; exit 1; } +fi +if [ ! -w "$LAST_TIME_FILE" ]; then + echo "ERROR: Last time file $LAST_TIME_FILE is not writable" + exit 1 +fi + +while true; do + NEW_TIME=$(date +%s) + + # Ensure last_time file is readable before using it + if [ ! -r "$LAST_TIME_FILE" ]; then + echo "ERROR: Last time file $LAST_TIME_FILE is not readable" | tee -a "$LOGFILE" + exit 1 + fi + + OLD_TIME=$(cat "$LAST_TIME_FILE") + TIME_DIFF=$((NEW_TIME - OLD_TIME)) + + if [ "${TIME_DIFF#-}" -ge "$THRESHOLD" ]; then + echo "$(date) - Large time change detected ($TIME_DIFF seconds), restarting meshtasticd" | tee -a "$LOGFILE" + systemctl restart meshtasticd + fi + + # Ensure last_time file is writable before updating it + if [ -w "$LAST_TIME_FILE" ]; then + echo "$NEW_TIME" > "$LAST_TIME_FILE" + else + echo "ERROR: Failed to write to $LAST_TIME_FILE" | tee -a "$LOGFILE" + exit 1 + fi + + sleep 5 +done + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh old mode 100755 new mode 100644 similarity index 93% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh index 9192e03..6cfa7ba --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh @@ -17,11 +17,13 @@ get_mobile_wifi_state() { set_mobile_wifi_state() { local state="$1" local meshtastic_output + if [[ "$state" == "up" ]]; then - meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled true 2>&1) + meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled true 2>&1 || true) else - meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled false 2>&1) + meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled false 2>&1 || true) fi + log "Set Meshtastic Wi-Fi state to $state. Output: $meshtastic_output" } @@ -67,8 +69,8 @@ monitor_changes() { while true; do PID=$(ps -C meshtasticd -o pid= | tr -d ' ') - #if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID"; then - if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]]; then + #if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]]; then + if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID" && [[ -d /sys/class/net/wlan0 ]] && systemctl is-active --quiet meshtasticd; then local current_mobile_state current_wlan_state current_mobile_state=$(get_mobile_wifi_state) current_wlan_state=$(cat /sys/class/net/wlan0/operstate) From 0b64bbefa732635875f8a55c05e98da405fc20e1 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Mon, 10 Feb 2025 11:31:21 -0800 Subject: [PATCH 037/149] Missed +x oops. --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh | 0 .../rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh old mode 100644 new mode 100755 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-mesh-control.sh old mode 100644 new mode 100755 From abd6995d953ce92f2f171c3355a6eb09b83b37b0 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Mon, 10 Feb 2025 11:35:57 -0800 Subject: [PATCH 038/149] femto-wifi-mesh-control and femto-watchclock-dog enable services in chroot --- environment-setup/femtofox.chroot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 3acbe42..ebf59e2 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -60,7 +60,8 @@ systemctl enable meshtasticd systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service -systemctl enable wifi-mesh-control +systemctl enable femto-wifi-mesh-control +systemctl enable femto-watchclock-dog systemctl disable apt-daily.timer systemctl disable unattended-upgrades From 9f46e22725c2a0e39fa5037dfd2d91df672e992f Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 10 Feb 2025 22:31:55 +0200 Subject: [PATCH 039/149] Update femto-watchclock-dog.service --- .../etc/systemd/system/femto-watchclock-dog.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service index 454c957..6ef2e59 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service @@ -1,5 +1,5 @@ [Unit] -Description=Monitor time jumps and restart meshtasticd +Description=Watchclock-dog After=network.target [Service] From 8a8193a87bde54b644c9f72e207dc88af1365a25 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 10 Feb 2025 22:40:01 +0200 Subject: [PATCH 040/149] Update femto-wifi-mesh-control.service --- .../etc/systemd/system/femto-wifi-mesh-control.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service index c01cff4..4ed9800 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service @@ -1,5 +1,5 @@ [Unit] -Description=Meshtastic control of wifi +Description=Sync wifi updown with Meshtastic After=meshtasticd.service [Service] From f591a1948183c18cb9e8415d8b527f0dc7f24e2d Mon Sep 17 00:00:00 2001 From: pdxlocations Date: Mon, 10 Feb 2025 13:02:02 -0800 Subject: [PATCH 041/149] double escape special chars --- .../etc/systemd/system/meshtasticd.service.d/override.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf index 4016f36..add99ee 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf @@ -1,6 +1,6 @@ [Service] ExecStart= -ExecStart=/bin/sh -c '/usr/sbin/meshtasticd -h $(sed -n "/Serial/ s/^.*: \(.*\)$/\U\1/p" /proc/cpuinfo | bc | tail -c 9)' +ExecStart=/bin/sh -c '/usr/sbin/meshtasticd -h $(sed -n "/Serial/ s/^.*: \\(.*\\)$/\\U\\1/p" /proc/cpuinfo | bc | tail -c 9)' Nice=-20 [Unit] From a79f0750b0e79479b6b9a71f70e9d0274099846f Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 10 Feb 2025 23:37:38 +0200 Subject: [PATCH 042/149] Move all femto services to /etc/systemd/system --- .../{lib => etc}/systemd/system/button.service | 0 .../systemd/system/femto-watchclock-dog.service | 2 +- .../system/femto-wifi-mesh-control.service | 2 +- .../{lib => etc}/systemd/system/settime.service | 0 .../usr/local/bin/femto-software.sh | 17 +++++++++-------- 5 files changed, 11 insertions(+), 10 deletions(-) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/{lib => etc}/systemd/system/button.service (100%) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/{lib => etc}/systemd/system/settime.service (100%) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service index 6ef2e59..454c957 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service @@ -1,5 +1,5 @@ [Unit] -Description=Watchclock-dog +Description=Monitor time jumps and restart meshtasticd After=network.target [Service] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service index 4ed9800..c01cff4 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service @@ -1,5 +1,5 @@ [Unit] -Description=Sync wifi updown with Meshtastic +Description=Meshtastic control of wifi After=meshtasticd.service [Service] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 4bcd1fb..25ac25c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -69,16 +69,17 @@ upgrade() { package_intro() { echo "Loading package info..." # check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog - dialog --no-collapse --colors --title "$title" --msgbox "\ - $($package_dir/$1.sh -N)\n\ - $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ + dialog --no-collapse --colors --title "$title" --yes-label "Continue" --no-label "Back" --yesno "\ + $($package_dir/$1.sh -N)\n\ + $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ -$($package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ +$([ -n "$($package_dir/$1.sh -E)" ] && $package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 + [ $? -eq 1 ] && return 1 # Exit the loop if the user selects "Cancel" or closes the dialog package_menu $1 # after user hits "OK", move on to package menu } @@ -86,10 +87,10 @@ package_menu() { choice="" while true; do echo "Loading package menu..." - # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") license_button="" if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi + # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) + service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ @@ -102,13 +103,13 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" $license_button --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ $menu_list \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break + return elif [ $exit_status -eq 2 ]; then # Help ("extra") button dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 else From 8168aa56281a0698cd55f42bafcf9b1cc5ccb89d Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 10 Feb 2025 23:55:44 +0200 Subject: [PATCH 043/149] Add software license name to software description --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 1 + .../usr/local/bin/packages/contact_client.sh | 7 ++++++- .../usr/local/bin/packages/meshing_around.sh | 7 ++++++- .../usr/local/bin/packages/mosquitto_mqtt_broker.sh | 7 ++++++- .../usr/local/bin/packages/mosquitto_mqtt_client.sh | 7 ++++++- .../usr/local/bin/packages/package_template.sh | 7 ++++++- .../rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 7 ++++++- .../usr/local/bin/packages/tc2_bbs.sh | 7 ++++++- .../rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh | 9 ++++++--- 9 files changed, 49 insertions(+), 10 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 25ac25c..2c98433 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -78,6 +78,7 @@ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || $([ -n "$($package_dir/$1.sh -E)" ] && $package_dir/$1.sh -I && echo "Service status: \Zu$(femto-utils.sh -C "$($package_dir/$1.sh -E)" | sed 's/\x1b\[[0-9;]*m//g')\Zn\n")\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ +$(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: \Zu$output\Zn\n"; fi)\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 [ $? -eq 1 ] && return 1 # Exit the loop if the user selects "Cancel" or closes the dialog package_menu $1 # after user hits "OK", move on to package menu diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 734ea70..9ed3b72 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -31,6 +31,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -52,11 +53,12 @@ name="Contact" # software name author="pdxlocations" # software author - OPTIONAL description="A Text-Based Console UI for Meshtastic Nodes. Formerly called Curse Client.\nAfter install, run \`contact\` to launch." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/contact/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuglNADUOLGCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +options="xiuglNADUOLGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="python /opt/contact/main.py --host" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/contact" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string. conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" @@ -171,6 +173,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) check diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 303349c..d473fc2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -56,11 +57,12 @@ name="Meshing Around" # software name author="Spud" # software author - OPTIONAL description="Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features. Connectivity and utility through text-based message delivery. Whether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/SpudGunMan/meshing-around" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuagedsrNADUOSELGCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuagedsrNADUOSELGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mesh_bot pong_bot mesh_bot_reporting" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string conflicts="TC²-BBS, any other \"full control\" style bots" # comma delineated plain-text list of packages with which this package conflicts. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -183,6 +185,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) check diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index 12d207c..abc0bae 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -57,12 +58,13 @@ name="Mosquitto MQTT Broker" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSEGPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSEGTPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mosquitto" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="mosquitto" # apt package name, if applicable location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="usr/share/doc/mosquitto/copyright" # file to cat to display license +license_name="EPL/EDL" # license name, such as MIT, GPL3, custom, whatever. short text string conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -155,6 +157,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index c49c456..e75dc52 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -57,11 +58,12 @@ name="Mosquitto MQTT Client" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSEGPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSEGTPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="usr/share/doc/mosquitto-clients/copyright" # file to cat to display license +license_name="EPL/EDL" # license name, such as MIT, GPL3, custom, whatever. short text string package_name="mosquitto-clients" # apt package name, if applicable conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" @@ -153,6 +155,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index 1a6338a..032d2ae 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -56,13 +57,14 @@ name="name" # software name author="author" # software author - OPTIONAL description="description" # software description - OPTIONAL (but strongly recommended!) URL="URL" # software URL. Can contain multiple URLs - OPTIONAL -options="hxiuagedsrlNADUOSELGPCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +options="hxiuagedsrlNADUOSELGTPCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="/opt/package/run.sh" # command to launch software, if applicable license="/opt/package/license" # file to cat to display license service_name="service_name" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="apt_package" # apt package name, if applicable. Can be multiple packages separated by spaces, but if at least one is installed the package will show as "installed" even if the others aren't location="/opt/location" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string conflicts="package1, package2" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -164,6 +166,9 @@ while getopts ":$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index c77bf8a..d8148ae 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -59,11 +60,12 @@ name="Samba File Sharing" # software name author="Software Freedom Conservancy" # software author - OPTIONAL description="Femtofox comes with Samba preinstalled but disabled. $init_instructions\n\n$user_message" # software description - OPTIONAL (but strongly recommended!) URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuagedsrNADUOSEGPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuagedsrNADUOSEGTPCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="smbd nmbd" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="/usr/share/doc/samba/copyright" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string package_name="samba" # apt package name, if applicable conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" @@ -172,6 +174,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 560742b..b8ccc12 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -36,6 +36,7 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed @@ -57,11 +58,12 @@ name="TC²-BBS" # software name author="The Comms Channel" # software author - OPTIONAL description="The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/TheCommsChannel/TC2-BBS-mesh" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSELGCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSELGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="python /opt/TC2-BBS-mesh/server.py" # command to launch software, if applicable service_name="mesh-bbs" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/TC2-BBS-mesh" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string conflicts="Meshing Around, other \"full control\" packages" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -180,6 +182,9 @@ while getopts ":h$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) check diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh index 38a588c..6d284c9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -36,11 +36,10 @@ Arguments: -E Get service name -L Get install location -G Get license +-T Get license name -P Get package name -C Get Conflicts -I Check if installed. Returns an error if not installed - Custom for this package: --k Generate/overwrite ttyd encryption keys EOF ) @@ -58,12 +57,13 @@ name="ttyd Web Terminal" # software name author="Shuanglei Tao" # software author - OPTIONAL description="ttyd is a simple command-line tool for sharing terminal over the web.\n\nWhen running, ttyd is available at https://$(hostname).local:7681\nttyd is installed and enabled by default on Foxbuntu.\n\nSSL encryption is provided by keys generated during first-boot or during installation. Your browser may give a warning (net::ERR_CERT_AUTHORITY_INVALID) about the self-signed encryption certificate. This is normal. In Chromium (Chrome, Edge) click \"Advanced\" and \"Continue to femtofox.local (unsafe)\"" # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/tsl0922/ttyd" # software URL. Can contain multiple URLs - OPTIONAL -options="hxiugedsrNADUOSELGCIk" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +options="hxiugedsrNADUOSELGTCIk" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="" # command to launch software, if applicable service_name="ttyd" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" package_name="" # apt package name, if applicable. Can be multiple packages separated by spaces, but if at least one is installed the package will show as "installed" even if the others aren't location="/opt/ttyd" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license +license_name="MIT" # license name, such as MIT, GPL3, custom, whatever. short text string conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -189,6 +189,9 @@ while getopts ":$options" opt; do G) # Option -G (Get license) license ;; + T) # Option -T (Get license name) + echo $license_name + ;; P) echo -e $package_name ;; C) echo -e $conflicts ;; I) # Option -I (Check if already installed) From abae18a4bd4e56b49364b30af5b6d8beb6222724 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 11 Feb 2025 15:13:30 +0200 Subject: [PATCH 044/149] Tidy up runonce --- .../usr/local/bin/femto-runonce.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 9776b6c..e3470cb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -18,15 +18,16 @@ Re-running this script will:\n\ * Resize filesystem to fit the SD card\n\ * Allocate the swap file\n\ * Replace the SSH encryption keys\n\ -* Add terminal type to user femto's .bashrc\n\ -* Add a shortcut \`sfc\` to femto's .bashrc\n\ +* Replace the Web Terminal SSL encryption keys\n\ * Set the eth0 MAC to be derivative of CPU serial number\n\ +* Add terminal type to user femto's .bashrc\n\ +* Add a shortcut \`sfc\` to user femto's .bashrc\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ Re-running this script after first boot should not cause any harm, but may not work as expected.\n\ \n\ -Proceed?" 20 60 +Proceed?" 22 60 if [ $? -eq 1 ]; then #if cancel/no exit 0 fi @@ -45,7 +46,7 @@ echo -e "\e[32m******* First boot *******\e[0m" ) & # Perform filesystem resize -log_message "Resizing filesystem. This can take several minutes, depending on microSD card size and speed" +log_message "Resizing filesystem..." resize2fs /dev/mmcblk1p5 resize2fs /dev/mmcblk1p6 resize2fs /dev/mmcblk1p7 @@ -53,7 +54,7 @@ log_message "Resizing filesystem complete" # allocate swap file if [ ! -f /swapfile ]; then # check if swap file already exists - log_message "Allocating swap file. This can take up to 10 minutes, depending on microSD card speed" + log_message "Allocating swap file..." fallocate -l 1G /swapfile chmod 600 /swapfile mkswap /swapfile > /dev/null @@ -92,17 +93,17 @@ export TERM=xterm-256color export LANG=C.UTF-8" if ! grep -Fxq "$lines" /home/femto/.bashrc; then # Check if the lines are already in .bashrc echo "$lines" >> /home/femto/.bashrc - echo "Added TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc" + log_message "Added TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc" else - echo "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" + log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" fi # Add a cheeky alias to .bash_aliases if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc - echo "Added alias sfc='sudo femto-config' to .bashrc" + log_message "Added \`alias sfc='sudo femto-config'\` to .bashrc" else - echo "alias sfc='sudo femto-config' already present in .bashrc, skipping" + log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping" fi # remove first boot flag From 875b7e3f08529491b070eadd53ff4064bbe0fc0e Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 11 Feb 2025 21:06:52 +0200 Subject: [PATCH 045/149] Fix new service descriptions --- .../etc/systemd/system/femto-watchclock-dog.service | 2 +- .../etc/systemd/system/femto-wifi-mesh-control.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service index 454c957..6ef2e59 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service @@ -1,5 +1,5 @@ [Unit] -Description=Monitor time jumps and restart meshtasticd +Description=Watchclock-dog After=network.target [Service] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service index c01cff4..4ed9800 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service @@ -1,5 +1,5 @@ [Unit] -Description=Meshtastic control of wifi +Description=Sync wifi updown with Meshtastic After=meshtasticd.service [Service] From 987d56955ccff849fa23d306b73d6f6ecf8c7664 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 11 Feb 2025 23:17:33 +0200 Subject: [PATCH 046/149] Add Meshtastic wifi sync management menu in networking --- .../etc/systemd/system/settime.service | 11 ---- .../usr/local/bin/femto-config | 66 ++++++++++++++++++- 2 files changed, 64 insertions(+), 13 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service deleted file mode 100644 index 59221fc..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Run settime script at startup -Before=meshtasticd.service -After=network.target - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/settime.sh - -[Install] -WantedBy=default.target diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 238d9ac..27aff91 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -115,8 +115,9 @@ networking_settings() { 5 "Restart networking" "" \ 6 "Set hostname" "" \ 7 "Test internet connection" "" \ + 8 "Manage Meshtastic wifi sync" "" \ " " "" "" \ - 8 "Back to main menu" "" 3>&1 1>&2 2>&3) + 9 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $networking_choice in 1) # Turn Wi-Fi on/off) @@ -166,7 +167,68 @@ networking_settings() { loading "Testing internet connection..." dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40 ;; - 8) + 8) # Manage Meshtastic wifi sync) + choice="" # zero the choice before loading the submenu + while true; do + echo "Checking Meshtastic wifi sync service state..." + local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "femto-wifi-mesh-control")")" + choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "Meshtastic wifi sync Service" --default-item "$choice" --menu "Meshtastic wifi sync service is $service_state" 16 60 5 \ + "View detailed service status" "x" \ + " " "" \ + "Start/restart service" "x" \ + $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ + " " "" \ + $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ + $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ + " " "" \ + "Back to previous menu" "x" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "Meshtastic wifi sync service help" --msgbox "The Meshtastic wifi sync service synchronizes wifi settings with Meshtastic wifi settings. This allows you to use remote node administration to enable/disable Femtofox wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n" 0 0 + else + case $choice in + "View detailed service status") + echo "Getting Meshtastic wifi sync service status..." + dialog --no-collapse --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 + ;; + "Start/restart service") + dialog --no-collapse --title "$title" --yesno "Start/restart Meshtastic wifi sync service?" 7 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl restart femto-wifi-mesh-control + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart femto-wifi-mesh-control wifi sync\Zn\` command to system.\n\nMeshtastic wifi sync should be running." 10 60 + fi + ;; + "Stop service") + dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtastic wifi sync service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtastic wifi sync will automatically restart on boot service if enabled." 11 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl stop femto-wifi-mesh-control + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop femto-wifi-mesh-control\Zn\` command to system.\n\nMeshtastic wifi sync should be stopped." 9 60 + fi + ;; + "Enable service") + dialog --no-collapse --title "$title" --yesno "Enable Meshtastic wifi sync service?" 6 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl enable femto-wifi-mesh-control + systemctl start femto-wifi-mesh-control + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable femto-wifi-mesh-control\Zn\` and \`\Zusystemctl start femto-wifi-mesh-control\Zn\` commands to system.\n\nMeshtastic wifi sync should be running." 10 60 + fi + ;; + "Disable service") + dialog --no-collapse --colors --title "$title" --yesno "Disable Meshtastic wifi sync service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl disable femto-wifi-mesh-control + systemctl stop femto-wifi-mesh-control + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable femto-wifi-mesh-control\Zn\` and \`\Zusystemctl stop femto-wifi-mesh-control\Zn\` commands to system.\n\nMeshtastic wifi sync should be disabled and stopped." 10 60 + fi + ;; + "Back to previous menu") break ;; + esac + fi + done + ;; + 9) return ;; esac From 142fe6f29f1d474a18918cd5004a2b464dd66a20 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:18:57 +0200 Subject: [PATCH 047/149] Update femto-config --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 27aff91..19a7fcb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -107,7 +107,7 @@ networking_settings() { wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf" choice="" # zero the choice before loading the submenu while true; do - networking_choice=$(dialog --no-collapse --cancel-label "Back" --backtitle "IPv4 address: $(femto-network-config.sh -i)" --default-item "$networking_choice" --title "$title" --item-help --menu "" 16 40 4 \ + networking_choice=$(dialog --no-collapse --cancel-label "Back" --backtitle "IPv4 address: $(femto-network-config.sh -i)" --default-item "$networking_choice" --title "$title" --item-help --menu "" 17 40 4 \ 1 "Turn Wi-Fi on/off" "" \ 2 "View Wi-Fi settings" "" \ 3 "Change Wi-Fi settings" "" \ @@ -800,4 +800,4 @@ while true; do esac done -exit 0 \ No newline at end of file +exit 0 From 1486a39675138b9977c781de713317432fd5fb08 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 14:01:01 +0200 Subject: [PATCH 048/149] package manager modifications --- .../usr/local/bin/packages/contact_client.sh | 58 +-------- .../bin/packages/femto_argument_parse.sh | 64 +++++++++ .../bin/packages/femto_package_template.sh | 121 ++++++++++++++++++ .../usr/local/bin/packages/meshing_around.sh | 63 +-------- .../bin/packages/mosquitto_mqtt_broker.sh | 60 +-------- .../bin/packages/mosquitto_mqtt_client.sh | 60 +-------- .../usr/local/bin/packages/samba.sh | 65 +--------- .../usr/local/bin/packages/tc2_bbs.sh | 59 +-------- .../usr/local/bin/packages/ttyd.sh | 67 +--------- 9 files changed, 200 insertions(+), 417 deletions(-) create mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh create mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 9ed3b72..09de464 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -51,7 +51,7 @@ EOF name="Contact" # software name author="pdxlocations" # software author - OPTIONAL -description="A Text-Based Console UI for Meshtastic Nodes. Formerly called Curse Client.\nAfter install, run \`contact\` to launch." # software description - OPTIONAL (but strongly recommended!) +description="A Text-Based Console UI for Meshtastic Nodes. Formerly called Curses Client.\nAfter install, run \`contact\` to launch." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/contact/" # software URL. Can contain multiple URLs - OPTIONAL options="xiuglNADUOLGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="python /opt/contact/main.py --host" # command to launch software, if applicable @@ -128,59 +128,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interactive="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh new file mode 100755 index 0000000..5cedec8 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +while getopts ":$options" opt; do + case ${opt} in + h) # Option -h (help) + echo -e "$help" + ;; + x) # Option -x (no user interaction available) + interaction="false" + ;; + i) # Option -i (install) + install + ;; + u) # Option -u (uninstall) + uninstall + ;; + a) # Option -a (interactive initialization) + interactive_init + ;; + g) # Option -g (upgrade) + upgrade + ;; + e) # Option -e (Enable service, if applicable) + systemctl enable $service_name + ;; + d) # Option -d (Disable service, if applicable) + systemctl disable $service_name + ;; + s) # Option -s (Stop service) + systemctl stop $service_name + ;; + r) # Option -r (Start/Restart) + systemctl restart $service_name + ;; + l) # Option -l (Run software) + echo "Launching $name..." + sudo -u ${SUDO_USER:-$(whoami)} $launch + ;; + N) echo -e $name ;; + A) echo -e $author ;; + D) echo $description ;; + U) echo -e $URL ;; + O) echo -e $options ;; + S) # Option -S (Get service status) + systemctl status $service_name + ;; + E) # Option -E (Get service name) + echo $service_name + ;; + L) echo -e $location ;; + G) # Option -G (Get license) + license + ;; + T) # Option -T (Get license name) + echo $license_name + ;; + P) echo -e $package_name ;; + C) echo -e $conflicts ;; + I) # Option -I (Check if already installed) + check + ;; + \?) exit 1 ;; # Unknown option) + esac +done \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh new file mode 100755 index 0000000..7d4c9bd --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh @@ -0,0 +1,121 @@ +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo\`." + exit 1 +fi +if [ $# -eq 0 ]; then + echo "No arguments provided." + echo -e "$help" + exit 1 +fi + +args="$@" # arguments to this script +interactive="true" +help=$(cat <&1 | tee /dev/tty || { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty || { echo "user_message: apt install failed. Is internet connected?"; exit 1; } + echo "user_message: Exit message to user, displayed prominently in post-install" + exit 0 # should be `exit 1` if operation failed +} + +# uninstall script +uninstall() { + echo "user_message: Exit message to user, displayed prominently in post-install" + exit 0 # should be `exit 1` if operation failed +} + +# code that must be run to initialize the installation prior to use, but can only be run from terminal +interactive_init() { + exit 0 # should be `exit 1` if operation failed +} + +# upgrade script +upgrade() { + echo "user_message: Exit message to user, displayed prominently in post-install" + exit 0 # should be `exit 1` if operation failed +} + +# Check if already installed. `exit 0` if yes, `exit 1` if no +check() { + # the following works for cloned repos, but not for apt installs + if [ -d "$location" ]; then + exit 0 + else + exit 1 + fi + + # this works for apt packages + if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then + exit 0 + else + exit 1 + fi +} + +# display license - limit to 2000 chars +license() { + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" +} + +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" + +exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index d473fc2..55da5b7 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -133,66 +133,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - echo "Running in non-interactive mode" - interactive="false" - ;; - i) # Option -i (install) - install - ;; - a) # Option -a (interactive initialization) - interactive_init - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index abc0bae..73a0d10 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -109,63 +109,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index e75dc52..9c14bb4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -107,63 +107,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index d8148ae..ef70cb2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -121,68 +121,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - a) # Option -a (interactive initialization) - interactive_init - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) # Option -L (location) - echo -e $location - ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index b8ccc12..7b0f80e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -134,62 +134,7 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } -while getopts ":h$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interactive="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh index 6d284c9..7fbf869 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -137,70 +137,7 @@ generate_keys() { fi } - -while getopts ":$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - a) # Option -a (interactive initialization) - interactive_init - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - k) # Option -k (Regenerate SSL keys) - generate_keys - ;; - esac -done +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" exit 0 \ No newline at end of file From c14624fca9c56667f4b901f137a0d6fe075b5a88 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 16:31:56 +0200 Subject: [PATCH 049/149] More changes to packages --- .../usr/local/bin/femto-software.sh | 6 +- .../usr/local/bin/packages/contact_client.sh | 39 ---- .../bin/packages/femto_argument_parse.sh | 44 ++++- .../bin/packages/femto_package_template.sh | 45 ----- .../usr/local/bin/packages/meshing_around.sh | 44 ----- .../bin/packages/mosquitto_mqtt_broker.sh | 44 ----- .../bin/packages/mosquitto_mqtt_client.sh | 44 ----- .../local/bin/packages/package_template.sh | 180 ------------------ .../usr/local/bin/packages/samba.sh | 44 ----- .../usr/local/bin/packages/tc2_bbs.sh | 44 ----- .../usr/local/bin/packages/ttyd.sh | 44 ----- 11 files changed, 46 insertions(+), 532 deletions(-) delete mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 2c98433..6c342b0 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -70,7 +70,7 @@ package_intro() { echo "Loading package info..." # check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog dialog --no-collapse --colors --title "$title" --yes-label "Continue" --no-label "Back" --yesno "\ - $($package_dir/$1.sh -N)\n\ +$($package_dir/$1.sh -N)\n\ $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ @@ -79,7 +79,7 @@ $([ -n "$($package_dir/$1.sh -E)" ] && $package_dir/$1.sh -I && echo "Service st $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: \Zu$output\Zn\n"; fi)\ -$(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 +$(if $package_dir/$1.sh -O | grep -q 'U'; then echo "Website: \Zu$($package_dir/$1.sh -U)\Zn"; fi)" 0 0 [ $? -eq 1 ] && return 1 # Exit the loop if the user selects "Cancel" or closes the dialog package_menu $1 # after user hits "OK", move on to package menu } @@ -140,7 +140,7 @@ while true; do index=1 for file in /usr/local/bin/packages/*.sh; do filename=$(basename "$file" .sh) - [[ "$filename" == "package_template" ]] && continue # skip package_template.sh + [[ "$filename" == femto_* ]] && continue # skip filenames starting with femto_ menu_entries+=("$(/usr/local/bin/packages/"$filename".sh -N)" "$($package_dir/$filename.sh -I && echo "✅ " || echo "❌ ")") ((index++)) # keeping an index to determine menu window height done diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 09de464..592f8cf 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -1,48 +1,9 @@ #!/bin/bash -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`." - exit 1 -fi - -args="$@" # arguments to this script -interactive="true" -help=$(cat <&1 | tee /dev/tty || { echo "user_message: apt update failed. Is internet connected?"; exit 1; } - # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty || { echo "user_message: apt install failed. Is internet connected?"; exit 1; } - echo "user_message: Exit message to user, displayed prominently in post-install" - exit 0 # should be `exit 1` if operation failed -} - -# uninstall script -uninstall() { - echo "user_message: Exit message to user, displayed prominently in post-install" - exit 0 # should be `exit 1` if operation failed -} - -# code that must be run to initialize the installation prior to use, but can only be run from terminal -interactive_init() { - exit 0 # should be `exit 1` if operation failed -} - -# upgrade script -upgrade() { - echo "user_message: Exit message to user, displayed prominently in post-install" - exit 0 # should be `exit 1` if operation failed -} - -# Check if already installed. `exit 0` if yes, `exit 1` if no -check() { - # the following works for cloned repos, but not for apt installs - if [ -d "$location" ]; then - exit 0 - else - exit 1 - fi - - # this works for apt packages - if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then - exit 0 - else - exit 1 - fi -} - -# display license - limit to 2000 chars -license() { - echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" -} - -while getopts ":$options" opt; do - case ${opt} in - h) # Option -h (help) - echo -e "$help" - ;; - x) # Option -x (no user interaction available) - interaction="false" - ;; - i) # Option -i (install) - install - ;; - u) # Option -u (uninstall) - uninstall - ;; - a) # Option -a (interactive initialization) - interactive_init - ;; - g) # Option -g (upgrade) - upgrade - ;; - e) # Option -e (Enable service, if applicable) - systemctl enable $service_name - ;; - d) # Option -d (Disable service, if applicable) - systemctl disable $service_name - ;; - s) # Option -s (Stop service) - systemctl stop $service_name - ;; - r) # Option -r (Start/Restart) - systemctl restart $service_name - ;; - l) # Option -l (Run software) - echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch - ;; - N) echo -e $name ;; - A) echo -e $author ;; - D) echo $description ;; - U) echo -e $URL ;; - O) echo -e $options ;; - S) # Option -S (Get service status) - systemctl status $service_name - ;; - E) # Option -E (Get service name) - echo $service_name - ;; - L) echo -e $location ;; - G) # Option -G (Get license) - license - ;; - T) # Option -T (Get license name) - echo $license_name - ;; - P) echo -e $package_name ;; - C) echo -e $conflicts ;; - I) # Option -I (Check if already installed) - check - ;; - esac -done - -exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index ef70cb2..acc0243 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -1,53 +1,9 @@ #!/bin/bash -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root. Try \`sudo\`." - exit 1 -fi -if [ $# -eq 0 ]; then - echo "No arguments provided." - echo -e "$help" - exit 1 -fi - -args="$@" # arguments to this script -interactive="true" -help=$(cat < Date: Wed, 12 Feb 2025 16:44:21 +0200 Subject: [PATCH 050/149] maintainer helptext fix --- .../usr/local/bin/packages/contact_client.sh | 2 +- .../usr/local/bin/packages/femto_package_template.sh | 2 +- .../usr/local/bin/packages/meshing_around.sh | 2 +- .../usr/local/bin/packages/mosquitto_mqtt_broker.sh | 2 +- .../usr/local/bin/packages/mosquitto_mqtt_client.sh | 2 +- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 2 +- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh | 2 +- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 592f8cf..1587e6b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interactive="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh index 8e4985a..033f652 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh @@ -2,7 +2,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 3c15742..6996473 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interactive="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index 1be1ef0..6a8bb9c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index aefb94d..9814373 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index acc0243..ef04599 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 2eb5a73..3a479b4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interactive="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh index 389c219..577256b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -3,7 +3,7 @@ ### For package maintainer: # Fill the following fields and choose the options that are in use by this package # Populate the install, uninstall and upgrade functions -# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't really possible +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible # This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` From eb914176b8ec9224f03a47783906c0a68d4716d0 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 16:46:23 +0200 Subject: [PATCH 051/149] Update femto_package_template.sh --- .../bin/packages/femto_package_template.sh | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh index 033f652..5fe3e3e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh @@ -50,19 +50,19 @@ upgrade() { # Check if already installed. `exit 0` if yes, `exit 1` if no check() { - # the following works for cloned repos, but not for apt installs - if [ -d "$location" ]; then - exit 0 - else - exit 1 - fi + ## the following works for cloned repos, but not for apt installs + # if [ -d "$location" ]; then + # exit 0 + # else + # exit 1 + # fi - # this works for apt packages - if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then - exit 0 - else - exit 1 - fi + ## this works for apt packages + # if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then + # exit 0 + # else + # exit 1 + # fi } # display license - limit to 2000 chars From 83e58916455baeaba114cbb3f2614b59e8685fa9 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 17:48:06 +0200 Subject: [PATCH 052/149] Update femto-software.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 6c342b0..3b7fcf3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -91,7 +91,7 @@ package_menu() { license_button="" if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") + if $package_dir/$1.sh -I; then service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)"); fi menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ @@ -154,7 +154,7 @@ while true; do index=1 for file in /usr/local/bin/packages/*.sh; do filename=$(basename "$file" .sh) - [[ "$filename" == "package_template" ]] && continue # skip package_template.sh + [[ "$filename" == femto_* ]] && continue # skip filenames starting with femto_ case_block+=" \"$(/usr/local/bin/packages/"$filename".sh -N)\") package_intro \"$filename\" ;;" ((index++)) From d83944862a6376b058e6fcd84ea1e998d4d72d29 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 17:54:55 +0200 Subject: [PATCH 053/149] Clean up license display --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 3b7fcf3..a5fe150 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -112,7 +112,7 @@ package_menu() { if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog return elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 + dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox " \Zu$($package_dir/$1.sh -N)\Zn\n$(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: $output"; fi)\n\n$($package_dir/$1.sh -G)" 0 0 else # execute the actual commands case $choice in From e337ed62ae8b325c2a13ab1e4094fe13922c1e08 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 18:42:37 +0200 Subject: [PATCH 054/149] Switch source of meshtasticd mac address to eth0 --- environment-setup/femtofox.chroot | 2 +- .../etc/meshtasticd/config.d/femto_mac_address.yaml | 4 ++++ .../etc/meshtasticd/{config.yaml => config.yaml.bak} | 0 .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/{config.yaml => config.yaml.bak} (100%) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index ebf59e2..95496ec 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -56,7 +56,7 @@ echo "femtofox" | tee /etc/hostname > /dev/null echo "Configuring autostart of systemd services..." systemctl enable button -systemctl enable meshtasticd +#systemctl enable meshtasticd systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml new file mode 100644 index 0000000..b1f2e8a --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml @@ -0,0 +1,4 @@ +# this sets the mac address source to eth0, replacing the previous code that derived a seed from the CPU s/n. +# of course, eth0 also has its mac address derived from CPU s/n, but this way meshtastic uses the exact mac address, instead of a bastardized version converted to a 9 digit int with `| bc | tail -c -9`. +General: + MACAddressSource: eth0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index e3470cb..ccc6b41 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -22,6 +22,7 @@ Re-running this script will:\n\ * Set the eth0 MAC to be derivative of CPU serial number\n\ * Add terminal type to user femto's .bashrc\n\ * Add a shortcut \`sfc\` to user femto's .bashrc\n\ +* Enable the meshtasticd service\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ @@ -106,6 +107,9 @@ else log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping" fi +log_message "Enabling meshtasticd service" +systemctl enable meshtasticd + # remove first boot flag sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf log_message "Removing first boot flag and rebooting in 5 seconds..." From d2d2fd9cbe51b71328ae4c424774428ee06f8445 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 19:22:59 +0200 Subject: [PATCH 055/149] Update override.conf --- .../etc/systemd/system/meshtasticd.service.d/override.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf index add99ee..2af10c1 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf @@ -1,6 +1,4 @@ [Service] -ExecStart= -ExecStart=/bin/sh -c '/usr/sbin/meshtasticd -h $(sed -n "/Serial/ s/^.*: \\(.*\\)$/\\U\\1/p" /proc/cpuinfo | bc | tail -c 9)' Nice=-20 [Unit] From 85f959b1a326b851375c5681566b029489ea4774 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 20:07:45 +0200 Subject: [PATCH 056/149] Fix ssl keygen for ttyd package --- .../usr/local/bin/packages/femto_package_template.sh | 11 +++++++++++ .../usr/local/bin/packages/ttyd.sh | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh index 5fe3e3e..39cc4a8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_package_template.sh @@ -70,7 +70,18 @@ license() { echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" } +## custom getopts example for this package +# if [[ "$1" == "-k" ]]; then +# generate_keys +# fi + # parse arguments source /usr/local/bin/packages/femto_argument_parse.sh "$@" +# extra help example for this package +# if [[ "$1" == "-h" ]]; then +# echo -e "Additional argument for this package:\n\ +# -k Generate SSL keys. Must be first argument." +# fi + exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh index 577256b..9286af8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/ttyd.sh @@ -93,7 +93,18 @@ generate_keys() { fi } +# custom getopts for ttyd: generate key +if [[ "$1" == "-k" ]]; then + generate_keys +fi + # parse arguments source /usr/local/bin/packages/femto_argument_parse.sh "$@" +# extra help for this package +if [[ "$1" == "-h" ]]; then + echo -e "Additional argument for this package:\n\ +-k Generate SSL keys. Must be first argument." +fi + exit 0 \ No newline at end of file From 60f2432c69ed13fab1870bbd1a3c212ea6a0a81d Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 21:09:20 +0200 Subject: [PATCH 057/149] Update femtofox.chroot --- environment-setup/femtofox.chroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 95496ec..4fde2e5 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -56,13 +56,13 @@ echo "femtofox" | tee /etc/hostname > /dev/null echo "Configuring autostart of systemd services..." systemctl enable button -#systemctl enable meshtasticd systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable femto-wifi-mesh-control systemctl enable femto-watchclock-dog +systemctl disable meshtasticd systemctl disable apt-daily.timer systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu From 298c545cfae74720fc79ddc13e1da136e2846b3b Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 21:36:20 +0200 Subject: [PATCH 058/149] Update femto-runonce.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index ccc6b41..3a0c50d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -38,6 +38,7 @@ echo -e "\e[32m******* First boot *******\e[0m" # pulse LED during firstboot ( + echo 34 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio34/direction while true; do echo 1 > /sys/class/gpio/gpio34/value; sleep 0.5; From ed80e931de5efeca64280278d8219b421838e3b6 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Wed, 12 Feb 2025 11:38:41 -0800 Subject: [PATCH 059/149] Watchclock Dog checks if meshtasticd is running While loop checks if meshtasticd is running and if not nopes out until next loop. --- .../usr/local/bin/femto-watchclock-dog.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh index 6cefdfa..8ee51f3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh @@ -23,6 +23,12 @@ if [ ! -w "$LAST_TIME_FILE" ]; then fi while true; do + # Check if meshtasticd service is running + if ! systemctl is-active --quiet meshtasticd; then + #echo "meshtasticd service is not running. Skipping..." | tee -a "$LOGFILE" + sleep 5 + continue + fi NEW_TIME=$(date +%s) # Ensure last_time file is readable before using it From 7bf723d62dcd9ed3e5a0830c7efcc279de48ab47 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 22:09:01 +0200 Subject: [PATCH 060/149] fix a couple service Afters --- .../etc/systemd/system/femto-runonce.service | 2 +- .../etc/systemd/system/femto-usb-config-tool.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service index d5692f4..574335d 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service @@ -1,6 +1,6 @@ [Unit] Description=Foxbuntu First Boot -After=meshtasticd.service +After=rc-local.service Before=serial-getty@ttyFIQ0.service DefaultDependencies=no diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service index 679b722..8f1c5dc 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service @@ -1,6 +1,6 @@ [Unit] Description=Foxbuntu USB Configuration Tool -After=meshtasticd.service +After=rc-local.service Before=serial-getty@ttyFIQ0.service DefaultDependencies=no From 0ce3fb15354e7a972ff95c2702637051123d4392 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 12 Feb 2025 22:15:37 +0200 Subject: [PATCH 061/149] remove debug line --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 3a0c50d..ccc6b41 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -38,7 +38,6 @@ echo -e "\e[32m******* First boot *******\e[0m" # pulse LED during firstboot ( - echo 34 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio34/direction while true; do echo 1 > /sys/class/gpio/gpio34/value; sleep 0.5; From 7ed3a99ee46aaed6f86fb1bf5c635960350c481c Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 13 Feb 2025 13:42:53 +0200 Subject: [PATCH 062/149] Revamp kernel module manager --- .../usr/local/bin/femto-kernel-modules.sh | 89 ++++++++++++------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 50df6dc..3ac19f4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -1,9 +1,17 @@ #!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root." + echo "Try \`sudo femto-config\`." + exit 1 +fi + help=$(cat <> /etc/modules fi - echo "$1 has been enabled and will be started at boot." + echo -e "\033[4m$1\033[0m has been enabled and will be started at boot.\n\nSome modules are unloaded automatically when not in use." else + echo -e "Failed to enable \033[4m$1\033[0m." exit 1 fi elif [ $2 = "disable" ]; then rmmod $1 # Disable the module - if [ $? -eq 0 ]; then - sed -i "/^$1$/d" /etc/modules - echo "$1 has been disabled and removed from boot." - else - exit 1 - fi + sed -i "/^$1$/d" /etc/modules + echo -e "\033[4m$1\033[0m has been disabled and removed from boot.\n\nIt may be automatically loaded if compatible hardware is detected." else echo "Invalid argument \"$2\".\n$help" fi } # Parse options -while getopts ":hx" opt; do +while getopts ":hbax" opt; do case ${opt} in h) # Option -l (set lora radio) echo "$help" exit 0 ;; + b) # kernel modules set to start at boot) + echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "%s\033[0m \033[4m", $0}' | sed 's/\033\[0m \033\[4m$//'); [ -z "$modules" ] && echo "none" || echo "$modules")" + ;; + a) # kernel modules currently active) + echo -e "$(lsmod | awk 'NR>1 {printf "%s\033[0m \033[4m", $1}' | sed 's/\033\[0m \033\[4m$//')" + ;; x) # Option -x (Set kernel module status (enable/disable)) echo "$(module_switch $2 $3)" ;; @@ -48,42 +59,52 @@ if [ -n "$1" ]; then # if there are arguments, don't proceed to menu exit fi -dialog --infobox "Loading kernel module menu..." 5 45 -modules=() - -# Create a list of modules (filename minus the .ko) -for module in $(ls "/lib/modules/5.10.160"/*.ko); do - module_name=$(basename "$module" .ko) - modules+=("$module_name" "$(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") -done +dialog --no-collapse --colors --title "$title" --yesno "\ +Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\ +\n\ +This tool will allow you to manage kernel modules and add pre-compiled modules to Foxbuntu.\n\ +\n\ +Boot modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\Zu\Zn\n\ +Active modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\Zu\Zn\n\ +\n\ +Continue? +" 0 0 +[ ! $? -eq 0 ] && exit 1 while true; do + dialog --infobox "Loading kernel module menu..." 5 45 + modules=("Module name" "Loaded/Boot? Description" "" "") + + # Create a list of modules (filename minus the .ko) + for module in $(ls "/lib/modules/5.10.160"/*.ko); do + module_name=$(basename "$module" .ko) + modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") + done + # Create the menu options - option=$(dialog --cancel-label "Back" --title "Kernel Modules" --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) - - exit_status=$? # Check the exit status of the dialog command - - if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - fi + option=$(dialog --cancel-label "Back" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog # Get the module name from the selection selected_module=$option # Get the full modinfo for the module and process it for dialog modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - # Check if the module is currently enabled - if lsmod | grep -q "^$selected_module "; then - dialog --colors --title "Disable Module" --yesno "The module '$selected_module' is currently \Z4\Zuenabled\Zn.\n\nDo you want to disable it?\n\nFull module info:\n$modinfo_output\n\nNote: Unused dependencies will be removed automatically." 25 0 - if [ $? -eq 0 ]; then - dialog --msgbox "$(module_switch $selected_module disable)" 7 60 - fi - else - dialog --colors --title "Enable Module" --yesno "The module '$selected_module' is currently \Z1disabled\Zn.\n\nDo you want to enable it?\n\nFull module info:\n$modinfo_output\n\nNote: Dependencies will be loaded automatically." 25 0 - if [ $? -eq 0 ]; then - dialog --msgbox "$(module_switch $selected_module enable)" 7 60 - fi + dialog --colors --yes-label "Back" --no-label "Disable" --extra-button --extra-label "Enable" --title "$selected_module" --yesno "\ +Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ +\n\ +Full module info:\n\ +$modinfo_output\n\ +\n\ +Note: Dependencies are loaded/unloaded automatically." 0 0 + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 0 ]; then # "Back" button (yes) + continue + elif [ $exit_status -eq 3 ]; then # "Enable" button (no) + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 9 60 + elif [ $exit_status -eq 1 ]; then # "Disable" button (extra) + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 9 60 fi done From f689b8ba208883aa41785e3f9e2fbd8df70d595a Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:44:36 +0200 Subject: [PATCH 063/149] Update femto-kernel-modules.sh --- .../usr/local/bin/femto-kernel-modules.sh | 91 +++++++------------ 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 3ac19f4..eb1b599 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -1,17 +1,9 @@ #!/bin/bash -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root." - echo "Try \`sudo femto-config\`." - exit 1 -fi - help=$(cat <> /etc/modules fi - echo -e "\033[4m$1\033[0m has been enabled and will be started at boot.\n\nSome modules are unloaded automatically when not in use." + echo "$1 has been enabled and will be started at boot." else - echo -e "Failed to enable \033[4m$1\033[0m." exit 1 fi elif [ $2 = "disable" ]; then rmmod $1 # Disable the module - sed -i "/^$1$/d" /etc/modules - echo -e "\033[4m$1\033[0m has been disabled and removed from boot.\n\nIt may be automatically loaded if compatible hardware is detected." + if [ $? -eq 0 ]; then + sed -i "/^$1$/d" /etc/modules + echo "$1 has been disabled and removed from boot." + else + exit 1 + fi else echo "Invalid argument \"$2\".\n$help" fi } # Parse options -while getopts ":hbax" opt; do +while getopts ":hx" opt; do case ${opt} in h) # Option -l (set lora radio) echo "$help" exit 0 ;; - b) # kernel modules set to start at boot) - echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "%s\033[0m \033[4m", $0}' | sed 's/\033\[0m \033\[4m$//'); [ -z "$modules" ] && echo "none" || echo "$modules")" - ;; - a) # kernel modules currently active) - echo -e "$(lsmod | awk 'NR>1 {printf "%s\033[0m \033[4m", $1}' | sed 's/\033\[0m \033\[4m$//')" - ;; x) # Option -x (Set kernel module status (enable/disable)) echo "$(module_switch $2 $3)" ;; @@ -59,53 +48,43 @@ if [ -n "$1" ]; then # if there are arguments, don't proceed to menu exit fi +dialog --infobox "Loading kernel module menu..." 5 45 -dialog --no-collapse --colors --title "$title" --yesno "\ -Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\ -\n\ -This tool will allow you to manage kernel modules and add pre-compiled modules to Foxbuntu.\n\ -\n\ -Boot modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\Zu\Zn\n\ -Active modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\Zu\Zn\n\ -\n\ -Continue? -" 0 0 -[ ! $? -eq 0 ] && exit 1 +modules=() + +# Create a list of modules (filename minus the .ko) +for module in $(ls "/lib/modules/5.10.160"/*.ko); do + module_name=$(basename "$module" .ko) + modules+=("$module_name" "$(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") +done while true; do - dialog --infobox "Loading kernel module menu..." 5 45 - modules=("Module name" "Loaded/Boot? Description" "" "") - - # Create a list of modules (filename minus the .ko) - for module in $(ls "/lib/modules/5.10.160"/*.ko); do - module_name=$(basename "$module" .ko) - modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") - done - # Create the menu options - option=$(dialog --cancel-label "Back" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + option=$(dialog --cancel-label "Back" --title "Kernel Modules" --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + + exit_status=$? # Check the exit status of the dialog command + + if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + fi # Get the module name from the selection selected_module=$option # Get the full modinfo for the module and process it for dialog modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - dialog --colors --yes-label "Back" --no-label "Disable" --extra-button --extra-label "Enable" --title "$selected_module" --yesno "\ -Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ -\n\ -Full module info:\n\ -$modinfo_output\n\ -\n\ -Note: Dependencies are loaded/unloaded automatically." 0 0 - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 0 ]; then # "Back" button (yes) - continue - elif [ $exit_status -eq 3 ]; then # "Enable" button (no) - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 9 60 - elif [ $exit_status -eq 1 ]; then # "Disable" button (extra) - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 9 60 + # Check if the module is currently enabled + if lsmod | grep -q "^$selected_module "; then + dialog --colors --title "Disable Module" --yesno "The module '$selected_module' is currently \Z4\Zuenabled\Zn.\n\nDo you want to disable it?\n\nFull module info:\n$modinfo_output\n\nNote: Unused dependencies will be removed automatically." 25 0 + if [ $? -eq 0 ]; then + dialog --msgbox "$(module_switch $selected_module disable)" 7 60 + fi + else + dialog --colors --title "Enable Module" --yesno "The module '$selected_module' is currently \Z1disabled\Zn.\n\nDo you want to enable it?\n\nFull module info:\n$modinfo_output\n\nNote: Dependencies will be loaded automatically." 25 0 + if [ $? -eq 0 ]; then + dialog --msgbox "$(module_switch $selected_module enable)" 7 60 + fi fi done -exit 0 \ No newline at end of file +exit 0 From 3cb06aeb91117cafd26baab8989840aa916167c4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 13 Feb 2025 13:45:58 +0200 Subject: [PATCH 064/149] Revamp kernel module manager --- .../usr/local/bin/femto-config | 1 - .../usr/local/bin/femto-kernel-modules.sh | 89 ++++++++++++------- 2 files changed, 55 insertions(+), 35 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 19a7fcb..290ceff 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -314,7 +314,6 @@ utilities() { ;; 2) femto-set-time.sh ;; # set timezone 3) # Kernel modules) - dialog --no-collapse --title "$title" --msgbox "Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\nThis tool will allow you to add pre-compiled modules to the Foxbuntu kernel.\n\nModules currently autostarting at boot: $(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")\n\nCurrently active modules: $(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ')" 18 65 femto-kernel-modules.sh ;; 4) femto-runonce.sh ;; # Re-run first-boot script diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 50df6dc..3ac19f4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -1,9 +1,17 @@ #!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root." + echo "Try \`sudo femto-config\`." + exit 1 +fi + help=$(cat <> /etc/modules fi - echo "$1 has been enabled and will be started at boot." + echo -e "\033[4m$1\033[0m has been enabled and will be started at boot.\n\nSome modules are unloaded automatically when not in use." else + echo -e "Failed to enable \033[4m$1\033[0m." exit 1 fi elif [ $2 = "disable" ]; then rmmod $1 # Disable the module - if [ $? -eq 0 ]; then - sed -i "/^$1$/d" /etc/modules - echo "$1 has been disabled and removed from boot." - else - exit 1 - fi + sed -i "/^$1$/d" /etc/modules + echo -e "\033[4m$1\033[0m has been disabled and removed from boot.\n\nIt may be automatically loaded if compatible hardware is detected." else echo "Invalid argument \"$2\".\n$help" fi } # Parse options -while getopts ":hx" opt; do +while getopts ":hbax" opt; do case ${opt} in h) # Option -l (set lora radio) echo "$help" exit 0 ;; + b) # kernel modules set to start at boot) + echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "%s\033[0m \033[4m", $0}' | sed 's/\033\[0m \033\[4m$//'); [ -z "$modules" ] && echo "none" || echo "$modules")" + ;; + a) # kernel modules currently active) + echo -e "$(lsmod | awk 'NR>1 {printf "%s\033[0m \033[4m", $1}' | sed 's/\033\[0m \033\[4m$//')" + ;; x) # Option -x (Set kernel module status (enable/disable)) echo "$(module_switch $2 $3)" ;; @@ -48,42 +59,52 @@ if [ -n "$1" ]; then # if there are arguments, don't proceed to menu exit fi -dialog --infobox "Loading kernel module menu..." 5 45 -modules=() - -# Create a list of modules (filename minus the .ko) -for module in $(ls "/lib/modules/5.10.160"/*.ko); do - module_name=$(basename "$module" .ko) - modules+=("$module_name" "$(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") -done +dialog --no-collapse --colors --title "$title" --yesno "\ +Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\ +\n\ +This tool will allow you to manage kernel modules and add pre-compiled modules to Foxbuntu.\n\ +\n\ +Boot modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\Zu\Zn\n\ +Active modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\Zu\Zn\n\ +\n\ +Continue? +" 0 0 +[ ! $? -eq 0 ] && exit 1 while true; do + dialog --infobox "Loading kernel module menu..." 5 45 + modules=("Module name" "Loaded/Boot? Description" "" "") + + # Create a list of modules (filename minus the .ko) + for module in $(ls "/lib/modules/5.10.160"/*.ko); do + module_name=$(basename "$module" .ko) + modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") + done + # Create the menu options - option=$(dialog --cancel-label "Back" --title "Kernel Modules" --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) - - exit_status=$? # Check the exit status of the dialog command - - if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - fi + option=$(dialog --cancel-label "Back" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog # Get the module name from the selection selected_module=$option # Get the full modinfo for the module and process it for dialog modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - # Check if the module is currently enabled - if lsmod | grep -q "^$selected_module "; then - dialog --colors --title "Disable Module" --yesno "The module '$selected_module' is currently \Z4\Zuenabled\Zn.\n\nDo you want to disable it?\n\nFull module info:\n$modinfo_output\n\nNote: Unused dependencies will be removed automatically." 25 0 - if [ $? -eq 0 ]; then - dialog --msgbox "$(module_switch $selected_module disable)" 7 60 - fi - else - dialog --colors --title "Enable Module" --yesno "The module '$selected_module' is currently \Z1disabled\Zn.\n\nDo you want to enable it?\n\nFull module info:\n$modinfo_output\n\nNote: Dependencies will be loaded automatically." 25 0 - if [ $? -eq 0 ]; then - dialog --msgbox "$(module_switch $selected_module enable)" 7 60 - fi + dialog --colors --yes-label "Back" --no-label "Disable" --extra-button --extra-label "Enable" --title "$selected_module" --yesno "\ +Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ +\n\ +Full module info:\n\ +$modinfo_output\n\ +\n\ +Note: Dependencies are loaded/unloaded automatically." 0 0 + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 0 ]; then # "Back" button (yes) + continue + elif [ $exit_status -eq 3 ]; then # "Enable" button (no) + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 9 60 + elif [ $exit_status -eq 1 ]; then # "Disable" button (extra) + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 9 60 fi done From 70196d7134e28015e4295221793e4b330fd53326 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 13 Feb 2025 21:41:16 +0200 Subject: [PATCH 065/149] Revamp of kernel module menu, adding blacklist and better UI --- .../usr/local/bin/femto-kernel-modules.sh | 99 +++++++++++++------ 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 3ac19f4..6df8c8d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -13,6 +13,7 @@ Options are: -b List kernel modules set to load at boot -a List active kernel modules -x "kernelmodule" "enable" Set kernel module status (enable/disable) +-z "kernelmodule" "blacklist" Set kernel module blacklist status (blacklist/un-blacklist) EOF ) @@ -29,7 +30,7 @@ module_switch() { exit 1 fi elif [ $2 = "disable" ]; then - rmmod $1 # Disable the module + rmmod $1 > /dev/null 2>&1 # Unload the module sed -i "/^$1$/d" /etc/modules echo -e "\033[4m$1\033[0m has been disabled and removed from boot.\n\nIt may be automatically loaded if compatible hardware is detected." else @@ -37,28 +38,45 @@ module_switch() { fi } +module_blacklist() { + if [ $2 = "blacklist" ]; then + mv "$module_dir/$1.ko" "$module_dir/$1.ko.blacklisted" > /dev/null 2>&1 + echo -e "$1 is blacklisted." + elif [ $2 = "un-blacklist" ]; then + sudo rmmod $1 > /dev/null 2>&1 # Unload the module + mv "$module_dir/$1.ko.blacklisted" "$module_dir/$1.ko" > /dev/null 2>&1 + echo -e "$1 is un-blacklisted." + else + echo "Invalid argument \"$2\".\n$help" + fi +} + # Parse options -while getopts ":hbax" opt; do +while getopts ":hbax:z:" opt; do case ${opt} in h) # Option -l (set lora radio) echo "$help" exit 0 ;; b) # kernel modules set to start at boot) - echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "%s\033[0m \033[4m", $0}' | sed 's/\033\[0m \033\[4m$//'); [ -z "$modules" ] && echo "none" || echo "$modules")" + echo -e "$(modules=$(sed -n '6,$p' /etc/modules | awk '{printf "\033[4m%s\033[0m ", $0}'); [ -z "$modules" ] && echo "\033[4mnone\033[0m" || echo "$modules")" ;; a) # kernel modules currently active) - echo -e "$(lsmod | awk 'NR>1 {printf "%s\033[0m \033[4m", $1}' | sed 's/\033\[0m \033\[4m$//')" + echo -e "$(modules=$(lsmod | awk 'NR>1 {printf "\033[4m%s\033[0m ", $1}'); [ -z "$modules" ] && echo "none" || echo "$modules")" ;; x) # Option -x (Set kernel module status (enable/disable)) echo "$(module_switch $2 $3)" ;; + z) # Option -z (Set kernel module blacklist status (blacklist/un-blacklist)) + echo "$(module_blacklist $2 $3)" + ;; esac done if [ -n "$1" ]; then # if there are arguments, don't proceed to menu exit fi +module_dir="/lib/modules/5.10.160" dialog --no-collapse --colors --title "$title" --yesno "\ Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\ @@ -72,40 +90,65 @@ Continue? " 0 0 [ ! $? -eq 0 ] && exit 1 -while true; do - dialog --infobox "Loading kernel module menu..." 5 45 - modules=("Module name" "Loaded/Boot? Description" "" "") +load_modules() { + dialog --infobox "Loading kernel module menu...\n\nExpected load time: 35 seconds." 6 45 + modules=() # Create a list of modules (filename minus the .ko) - for module in $(ls "/lib/modules/5.10.160"/*.ko); do - module_name=$(basename "$module" .ko) - modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") + for module in $(ls $module_dir/*.ko*); do + module_name=$(basename "$module" | sed 's/\([^.]*\).*/\1/') + modules+=("$module_name" "$(lsmod | grep -q "^$module_name " && echo ✅ || echo ❌)$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$module_name" && echo ✅ || echo ❌) $(basename "$module" | grep -q "blacklisted" && echo "BLACKLISTED" || modinfo "$module_name" | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//' )") done + modules_changed="false" +} +load_modules +modules_changed="false" + +while true; do + [ $modules_changed = "true" ] && load_modules # Create the menu options - option=$(dialog --cancel-label "Back" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + selected_module=$(dialog --no-collapse --cancel-label "Back" --ok-label "Open" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "Module name Loaded/Boot? Description" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - # Get the module name from the selection - selected_module=$option + modules_changed="false" # Get the full modinfo for the module and process it for dialog - modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info + while true; do + modinfo_output=$(modinfo $selected_module 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - dialog --colors --yes-label "Back" --no-label "Disable" --extra-button --extra-label "Enable" --title "$selected_module" --yesno "\ -Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ + if [ ! -e "$module_dir/$selected_module.ko" ]; then + module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load." + else + module_info="Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ \n\ -Full module info:\n\ -$modinfo_output\n\ -\n\ -Note: Dependencies are loaded/unloaded automatically." 0 0 - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 0 ]; then # "Back" button (yes) - continue - elif [ $exit_status -eq 3 ]; then # "Enable" button (no) - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 9 60 - elif [ $exit_status -eq 1 ]; then # "Disable" button (extra) - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 9 60 - fi +Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded automatically." + fi + + dialog --colors --yes-label "Cancel" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0 + + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 0 ]; then # "Back" button + break + elif [ $exit_status -eq 3 ]; then # "Enable" button + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 0 0 + modules_changed="true" + elif [ $exit_status -eq 1 ]; then # "Disable" button + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 0 0 + modules_changed="true" + elif [ $exit_status -eq 2 ]; then # "Blacklist" button + dialog --no-collapse --colors --title "$selected_module" --yes-label "Cancel" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0 + exit_status=$? + if [ $exit_status -eq 0 ]; then + continue + elif [ $exit_status -eq 3 ]; then # blacklist + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 6 45 + modules_changed="true" + else # blacklist + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 6 45 + modules_changed="true" + fi + fi + done done exit 0 \ No newline at end of file From 4f7c392ae6315bb67093fd7165b268c4c4300551 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Thu, 13 Feb 2025 23:30:19 +0200 Subject: [PATCH 066/149] Change sleep time to 30 --- .../usr/local/bin/femto-watchclock-dog.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh index 8ee51f3..d6c56bc 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh @@ -26,7 +26,7 @@ while true; do # Check if meshtasticd service is running if ! systemctl is-active --quiet meshtasticd; then #echo "meshtasticd service is not running. Skipping..." | tee -a "$LOGFILE" - sleep 5 + sleep 30 continue fi NEW_TIME=$(date +%s) @@ -53,6 +53,6 @@ while true; do exit 1 fi - sleep 5 + sleep 30 done From 74af9894d9f5e0651bac79ef8fe7f43a8b0d3915 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Thu, 13 Feb 2025 14:03:24 -0800 Subject: [PATCH 067/149] backing up libc_nonshared.a before build. cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep Because build.sh kills it and we need it. --- environment-setup/femtofox.chroot | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index ebf59e2..872ca66 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -37,6 +37,17 @@ DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force- #DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" ./meshtasticd_2.5.11.8e2a3e5_armhf.deb #rm ./meshtasticd_2.5.11.8e2a3e5_armhf.deb +# Ensure libgcc_s.so and libc_nonshared.a exist +mkdir -p /usr/lib/gcc/arm-linux-gnueabihf/11/ +ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so +ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /lib/libgcc_s.so.1 +ln -sf /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so /usr/lib/libgcc.so + +# Add library paths +echo "/usr/lib/gcc/arm-linux-gnueabihf/11" | tee -a /etc/ld.so.conf.d/gcc.conf +ldconfig + + echo "Installing dependencies for meshing-around and meshtastic cli..." #pip config set global.extra-index-url https://www.piwheels.org/simple pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python @@ -56,13 +67,13 @@ echo "femtofox" | tee /etc/hostname > /dev/null echo "Configuring autostart of systemd services..." systemctl enable button -systemctl enable meshtasticd systemctl enable femto-runonce.service systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable femto-wifi-mesh-control systemctl enable femto-watchclock-dog +systemctl disable meshtasticd systemctl disable apt-daily.timer systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu @@ -101,5 +112,6 @@ usermod -a -G tty femto usermod -a -G dialout femto echo "Cleaning up chroot..." -apt clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c +rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c + exit From 9ad001f5e1f1b3f9108b95fe5cb51b9528c30228 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Thu, 13 Feb 2025 14:21:48 -0800 Subject: [PATCH 068/149] Backup and restore libc_nonshared.a and correct paths libgcc wasn't playing nice after build.sh got a hold of it. This preserves the compiler. --- environment-setup/femtofox.chroot | 24 ++++++++++--------- .../usr/local/bin/femto-runonce.sh | 8 +++++++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 872ca66..f3c1859 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -37,17 +37,6 @@ DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force- #DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" ./meshtasticd_2.5.11.8e2a3e5_armhf.deb #rm ./meshtasticd_2.5.11.8e2a3e5_armhf.deb -# Ensure libgcc_s.so and libc_nonshared.a exist -mkdir -p /usr/lib/gcc/arm-linux-gnueabihf/11/ -ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so -ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /lib/libgcc_s.so.1 -ln -sf /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so /usr/lib/libgcc.so - -# Add library paths -echo "/usr/lib/gcc/arm-linux-gnueabihf/11" | tee -a /etc/ld.so.conf.d/gcc.conf -ldconfig - - echo "Installing dependencies for meshing-around and meshtastic cli..." #pip config set global.extra-index-url https://www.piwheels.org/simple pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python @@ -111,6 +100,19 @@ sudo chage -d 0 femto usermod -a -G tty femto usermod -a -G dialout femto +# Ensure libgcc_s.so and libc_nonshared.a exist +mkdir -p /usr/lib/gcc/arm-linux-gnueabihf/11/ +ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so +ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /lib/libgcc_s.so.1 +ln -sf /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so /usr/lib/libgcc.so + +# Add library paths +echo "/usr/lib/gcc/arm-linux-gnueabihf/11" | tee -a /etc/ld.so.conf.d/gcc.conf +ldconfig + +# Back up libc_nonshared.a because build.sh removes it +cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep + echo "Cleaning up chroot..." rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index e3470cb..f467c0b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -22,6 +22,7 @@ Re-running this script will:\n\ * Set the eth0 MAC to be derivative of CPU serial number\n\ * Add terminal type to user femto's .bashrc\n\ * Add a shortcut \`sfc\` to user femto's .bashrc\n\ +* Enable the meshtasticd service\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ @@ -98,6 +99,10 @@ else log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" fi +# Fix Compiler +log_message "Fixing Compiler." +cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a + # Add a cheeky alias to .bash_aliases if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc @@ -106,6 +111,9 @@ else log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping" fi +log_message "Enabling meshtasticd service" +systemctl enable meshtasticd + # remove first boot flag sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf log_message "Removing first boot flag and rebooting in 5 seconds..." From a7ace1c758adc370a0b14e2893997c8739638143 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Thu, 13 Feb 2025 16:06:44 -0800 Subject: [PATCH 069/149] wrong arg in getting private key in femto-config Just a typo in the menu --- .../sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 19a7fcb..ded2559 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -560,7 +560,7 @@ meshtastic_settings() { ;; 2) # view/change private key) loading "Getting current private key..." - key=$(femto-meshtasticd-config.sh -u) + key=$(femto-meshtasticd-config.sh -r) if [ -n "$key" ]; then dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55 if [ $? -eq 0 ]; then #unless cancel/no From 989ffdbfd73e18a8a402d9aed8655b6548166534 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 10:18:41 +0200 Subject: [PATCH 070/149] Prevent login prompt from appearing until boot is complete Written by @Ruledo --- .../etc/systemd/system/serial-getty@.service.d/override.conf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf new file mode 100644 index 0000000..3509c63 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf @@ -0,0 +1,5 @@ +[Unit] +After=femto-boot-complete.service multi-user.target graphical.target + +[Service] +ExectStartPre=/bin/sleep 0.5 From 97d10e8a35859bc6faeb8ba433dd01b676561ea3 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 10:36:08 +0200 Subject: [PATCH 071/149] Tidy up runonce --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index f467c0b..62e804b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -23,6 +23,7 @@ Re-running this script will:\n\ * Add terminal type to user femto's .bashrc\n\ * Add a shortcut \`sfc\` to user femto's .bashrc\n\ * Enable the meshtasticd service\n\ +* Add compiler support\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ @@ -100,7 +101,7 @@ else fi # Fix Compiler -log_message "Fixing Compiler." +log_message "Adding compiler support..." cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a # Add a cheeky alias to .bash_aliases From af8bdab4464f9cac8debbbf9c518fe5c038eca75 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 10:37:59 +0200 Subject: [PATCH 072/149] Increment Foxbuntu release to 1.0 --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release index cc12873..3f697f5 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release @@ -1,5 +1,5 @@ -major=0 -minor=99 +major=1 +minor=0 patch=0 hotfix= From d7b822c7b1bd4f1dab3383b601a6b08ea91dbd59 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 11:23:24 +0200 Subject: [PATCH 073/149] Improve UX for blacklisting function in kernel modification manager --- .../usr/local/bin/femto-kernel-modules.sh | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 50e77d1..970df93 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -41,11 +41,11 @@ module_switch() { module_blacklist() { if [ $2 = "blacklist" ]; then mv "$module_dir/$1.ko" "$module_dir/$1.ko.blacklisted" > /dev/null 2>&1 - echo -e "$1 is blacklisted." + module_switch $1 disable > /dev/null 2>&1 # unload and disable the module + echo -e "$1 is blacklisted. A reboot is sometimes required for blacklisting to fully take effect." elif [ $2 = "un-blacklist" ]; then - sudo rmmod $1 > /dev/null 2>&1 # Unload the module mv "$module_dir/$1.ko.blacklisted" "$module_dir/$1.ko" > /dev/null 2>&1 - echo -e "$1 is un-blacklisted." + echo -e "$1 is un-blacklisted. A reboot is sometimes required for un-blacklisting to fully take effect." else echo "Invalid argument \"$2\".\n$help" fi @@ -108,7 +108,7 @@ modules_changed="false" while true; do [ $modules_changed = "true" ] && load_modules # Create the menu options - selected_module=$(dialog --no-collapse --cancel-label "Back" --ok-label "Open" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "Module name Loaded/Boot? Description" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + selected_module=$(dialog --no-collapse --cancel-label "Return" --ok-label "Open" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "Module name Loaded/Boot? Description" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog modules_changed="false" @@ -117,14 +117,16 @@ while true; do modinfo_output=$(modinfo $selected_module 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info if [ ! -e "$module_dir/$selected_module.ko" ]; then - module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load." + module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load on boot.\ + $(lsmod | grep -q "^$selected_module " && echo "\n\n$selected_module is currently \Z4\Zuloaded\Zn!\n\ +Some modules require reboot for blacklist to take effect if they're in use when blacklisted.")" else module_info="Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ \n\ Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded automatically." fi - dialog --colors --yes-label "Cancel" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0 + dialog --colors --yes-label "Return" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0 exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -eq 0 ]; then # "Back" button @@ -136,15 +138,15 @@ Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded aut dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 0 0 modules_changed="true" elif [ $exit_status -eq 2 ]; then # "Blacklist" button - dialog --no-collapse --colors --title "$selected_module" --yes-label "Cancel" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0 + dialog --no-collapse --colors --title "$selected_module" --yes-label "Return" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0 exit_status=$? if [ $exit_status -eq 0 ]; then continue elif [ $exit_status -eq 3 ]; then # blacklist - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 6 45 + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 8 50 modules_changed="true" else # blacklist - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 6 45 + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 8 50 modules_changed="true" fi fi From 104c8cf656de2492b016bc02966f35f9406db2a1 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 13:20:24 +0200 Subject: [PATCH 074/149] spit and polish --- .../usr/local/bin/femto-config | 2 +- .../usr/local/bin/femto-kernel-modules.sh | 107 ++++++++++-------- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index cd17d1c..76c005e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -242,7 +242,7 @@ utilities() { utilities_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$utilities_choice" --item-help --menu "$title" 21 50 4 \ 1 "View system info" "" \ 2 "Set system time" "" \ - 3 "Kernel modules" "" \ + 3 "Kernel module manager" "" \ 4 "Re-run first-boot script" "" \ 5 "Run USB configuration tool" "" \ 6 "Run OEM luckfox-config" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 970df93..af4f24b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -14,9 +14,13 @@ Options are: -a List active kernel modules -x "kernelmodule" "enable" Set kernel module status (enable/disable) -z "kernelmodule" "blacklist" Set kernel module blacklist status (blacklist/un-blacklist) +-y Get list of blacklisted kernel modules EOF ) +module_dir="/lib/modules/5.10.160" +title="Kernel Module Manager" + module_switch() { if [ $2 = "enable" ]; then modprobe $1 # Load the selected module @@ -39,7 +43,9 @@ module_switch() { } module_blacklist() { - if [ $2 = "blacklist" ]; then + if [ $1 = "list" ]; then + echo -e "$(ls "$module_dir"/*.blacklisted 2>/dev/null | sed -E 's|.*/([^.]*)\..*|\1|' | awk '{for(i=1;i<=NF;i++) {printf "\033[4m%s\033[0m", $i; if(i /dev/null 2>&1 module_switch $1 disable > /dev/null 2>&1 # unload and disable the module echo -e "$1 is blacklisted. A reboot is sometimes required for blacklisting to fully take effect." @@ -47,12 +53,12 @@ module_blacklist() { mv "$module_dir/$1.ko.blacklisted" "$module_dir/$1.ko" > /dev/null 2>&1 echo -e "$1 is un-blacklisted. A reboot is sometimes required for un-blacklisting to fully take effect." else - echo "Invalid argument \"$2\".\n$help" + echo "Invalid argument \"$1 $2\".\n$help" fi } # Parse options -while getopts ":hbax:z:" opt; do +while getopts ":hbax:z:y" opt; do case ${opt} in h) # Option -l (set lora radio) echo "$help" @@ -70,21 +76,23 @@ while getopts ":hbax:z:" opt; do z) # Option -z (Set kernel module blacklist status (blacklist/un-blacklist)) echo "$(module_blacklist $2 $3)" ;; + y) # Option -y (Get list of blacklisted kernel modules) + echo "$(module_blacklist "list")" + ;; esac done if [ -n "$1" ]; then # if there are arguments, don't proceed to menu exit fi -module_dir="/lib/modules/5.10.160" - dialog --no-collapse --colors --title "$title" --yesno "\ Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\ \n\ This tool will allow you to manage kernel modules and add pre-compiled modules to Foxbuntu.\n\ \n\ -Boot modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\Zu\Zn\n\ -Active modules: \Zu$(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\Zu\Zn\n\ +Boot modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -b)")\n\ +Blacklisted modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -y)")\n\ +Active modules: $(femto-utils.sh -R "$(femto-kernel-modules.sh -a)")\n\ \n\ Continue? " 0 0 @@ -92,7 +100,7 @@ Continue? load_modules() { dialog --infobox "Loading kernel module menu...\n\nExpected load time: 35 seconds." 6 45 - modules=() + modules=("Module name" "L/D Description" "" "") # Create a list of modules (filename minus the .ko) for module in $(ls $module_dir/*.ko*); do @@ -108,49 +116,56 @@ modules_changed="false" while true; do [ $modules_changed = "true" ] && load_modules # Create the menu options - selected_module=$(dialog --no-collapse --cancel-label "Return" --ok-label "Open" --title "Kernel Modules" --no-shadow --default-item "$selected_module" --menu "Module name Loaded/Boot? Description" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + selected_module=$(dialog --no-collapse --cancel-label "Return" --ok-label "Open" --title "$title" --no-shadow --default-item "$selected_module" --help-button --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + exit_status=$? + if [ $exit_status -eq 1 ]; then # "Return" button + break + elif [ $exit_status -eq 2 ]; then # "Help" button + dialog --no-collapse --colors --title "Kernel Module Manager Help" --msgbox "In the kernel module manager menu,\nL=Module is loaded\nB=Module is set to start at boot.\n\nIf module is blacklisted, \`BLACKLISTED\` will show in the description." 0 0 + else + [ "$selected_module" = "" ] || [ "$selected_module" = "Module name" ] && continue # do nothing if no valid module name is selected + modules_changed="false" + # Get the full modinfo for the module and process it for dialog + while true; do + modinfo_output=$(modinfo $selected_module 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - modules_changed="false" - # Get the full modinfo for the module and process it for dialog - while true; do - modinfo_output=$(modinfo $selected_module 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info - - if [ ! -e "$module_dir/$selected_module.ko" ]; then - module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load on boot.\ - $(lsmod | grep -q "^$selected_module " && echo "\n\n$selected_module is currently \Z4\Zuloaded\Zn!\n\ + if [ ! -e "$module_dir/$selected_module.ko" ]; then + module_info="\Z1\ZuMODULE BLACKLISTED!\Zn\n\n$selected_module has been blacklisted and will not load on boot.\ + $(lsmod | grep -q "^$selected_module " && echo "\n\n$selected_module is currently \Z4\Zuloaded\Zn!\n\ Some modules require reboot for blacklist to take effect if they're in use when blacklisted.")" - else - module_info="Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ + else + module_info="Module is currently $(lsmod | grep -q "^$selected_module " && echo "\Z4loaded\Zn" || echo "\Z1unloaded\Zn") and is set $(femto-utils.sh -R "$(femto-kernel-modules.sh -b | sed 's/\x1b\[[0-9;]*m//g' | grep -qw "$selected_module" && echo "\Z4to load at boot\Zn" || echo "\Z1not to load at boot\Zn. It may load automatically if needed")").\n\ \n\ Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded automatically." - fi - - dialog --colors --yes-label "Return" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0 - - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 0 ]; then # "Back" button - break - elif [ $exit_status -eq 3 ]; then # "Enable" button - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 0 0 - modules_changed="true" - elif [ $exit_status -eq 1 ]; then # "Disable" button - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 0 0 - modules_changed="true" - elif [ $exit_status -eq 2 ]; then # "Blacklist" button - dialog --no-collapse --colors --title "$selected_module" --yes-label "Return" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0 - exit_status=$? - if [ $exit_status -eq 0 ]; then - continue - elif [ $exit_status -eq 3 ]; then # blacklist - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 8 50 - modules_changed="true" - else # blacklist - dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 8 50 - modules_changed="true" fi - fi - done + + dialog --colors --yes-label "Return" --no-label "Disable" --extra-button --extra-label "Enable" --help-button --help-label "Blacklist" --title "$selected_module" --yesno "$module_info" 0 0 + + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 0 ]; then # "Back" button + break + elif [ $exit_status -eq 3 ]; then # "Enable" button + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module enable)")" 0 0 + modules_changed="true" + elif [ $exit_status -eq 1 ]; then # "Disable" button + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_switch $selected_module disable)")" 0 0 + modules_changed="true" + elif [ $exit_status -eq 2 ]; then # "Blacklist" button + dialog --no-collapse --colors --title "$selected_module" --yes-label "Return" --no-label "Un-blacklist" --extra-button --extra-label "Blacklist" --yesno "$selected_module is currently $([ -e "$module_dir/$selected_module.ko" ] && echo "\Z4\Zunot blacklisted\Zn" || echo "\Z1\Zublacklisted\Zn").\n\nBlacklisting prevents a kernel module from loading.\n\nWould you like to blacklist $selected_module?" 0 0 + exit_status=$? + if [ $exit_status -eq 0 ]; then + continue + elif [ $exit_status -eq 3 ]; then # blacklist + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module blacklist)")" 8 50 + modules_changed="true" + else # blacklist + dialog --colors --title "$selected_module" --msgbox "$(femto-utils.sh -R "$(module_blacklist $selected_module un-blacklist)")" 8 50 + modules_changed="true" + fi + fi + done + fi done + exit 0 From 01da3ccd365ca28454ede3a4c1b5169acbdd4234 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 13:43:28 +0200 Subject: [PATCH 075/149] Improve installation usability by allowing pip installs to display live on screen --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index a5fe150..899c9d6 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -9,7 +9,7 @@ install() { echo "Installing $($package_dir/$1.sh -N)..." # Run the installation script, capturing the output and displaying it in real time - output=$($package_dir/$1.sh -i) + output=$($package_dir/$1.sh -i | tee /dev/tty) install_status=$? # Capture the exit status of the eval command user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output From 35128e204e65a055f2ad58428052ac848be44c9f Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 13:57:12 +0200 Subject: [PATCH 076/149] Temporarily remove "Run software" from software manager package menu due to bug #326 --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 899c9d6..fcb212d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -92,8 +92,9 @@ package_menu() { if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) if $package_dir/$1.sh -I; then service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)"); fi + # Removed from menu list until can be fixed - contact does not launch. When returned to list, should be first entry + # $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ menu_list="\ - $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ From d52e26def2682b0f3cf3243d82cf405e4360293f Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 14:13:30 +0200 Subject: [PATCH 077/149] Final touches --- .../usr/local/bin/femto-software.sh | 16 ++++++++++++---- .../usr/local/bin/packages/meshing_around.sh | 10 +++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index fcb212d..21d635c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -4,14 +4,22 @@ title="Software Manager" package_dir="/usr/local/bin/packages" install() { - dialog --no-collapse --title "Install $($package_dir/$1.sh -N)" --yesno "\nInstallation requires internet connectivity.\n\nProceed?" 10 40 + dialog --no-collapse --title "Install $($package_dir/$1.sh -N)" --yesno "\nInstallation requires internet connectivity.\n\nInstall $($package_dir/$1.sh -N)?" 10 40 [ $? -eq 1 ] && return 1 #if cancel/no echo "Installing $($package_dir/$1.sh -N)..." # Run the installation script, capturing the output and displaying it in real time output=$($package_dir/$1.sh -i | tee /dev/tty) install_status=$? # Capture the exit status of the eval command + if [ ${#output} -gt 2048 ]; then # Truncate to 2048 characters and append ellipsis and note if necessary + truncated_output="${output:0:2000}...\nLOG TRUNCATED" + if [[ "$output" =~ user_message: ]]; then # preserve user_message by adding to end of string + truncated_output="$truncated_output\n$(echo "$output" | sed -n 's/.*\(user_message:.*\)/\1/p')" + fi + output="$truncated_output" + fi user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present + echo $user_message output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output if [ $install_status -eq 0 ]; then # if the installation was successful @@ -22,7 +30,7 @@ install() { } uninstall() { - dialog --no-collapse --title "Uninstall $($package_dir/$1.sh -N)" --yesno "\nReinstallation will require internet connectivity.\n\nProceed?" 10 40 + dialog --no-collapse --title "Uninstall $($package_dir/$1.sh -N)" --yesno "\nNote: reinstallation will require internet connectivity.\n\nUninstall $($package_dir/$1.sh -N)?" 10 40 [ $? -eq 1 ] && return 1 #if cancel/no echo "Uninstalling $($package_dir/$1.sh -N)..." output=$(eval "$package_dir/$1.sh -u 2>&1 | tee /dev/tty") @@ -37,7 +45,7 @@ uninstall() { } initialize() { - dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that require user interaction and so can only be run from terminal.\n\nProceed?" 13 50 + dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that require user interaction and so can only be run from terminal.\n\nInitialize $($package_dir/$1.sh -N)?" 13 50 [ $? -eq 1 ] && return 1 #if cancel/no clear echo "Initializing $($package_dir/$1.sh -N)..." @@ -50,7 +58,7 @@ initialize() { } upgrade() { - dialog --no-collapse --title "Upgrade $($package_dir/$1.sh -N)" --yesno "\nUpgrade requires internet connectivity.\n\nProceed?" 10 40 + dialog --no-collapse --title "Upgrade $($package_dir/$1.sh -N)" --yesno "\nUpgrade requires internet connectivity.\n\nUpgrade $($package_dir/$1.sh -N)?" 10 40 [ $? -eq 1 ] && return 1 #if cancel/no echo "Upgrading $($package_dir/$1.sh -N)..." output=$(eval "$package_dir/$1.sh -g 2>&1 | tee /dev/tty") diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 6996473..768932f 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -13,9 +13,9 @@ name="Meshing Around" # software name author="Spud" # software author - OPTIONAL description="Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features. Connectivity and utility through text-based message delivery. Whether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/SpudGunMan/meshing-around" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuagedsrNADUOSELGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSELGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable -service_name="mesh_bot pong_bot mesh_bot_reporting" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" +service_name="mesh_bot" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string @@ -29,7 +29,9 @@ install() { fi pip install -r $location/requirements.txt if [ "$interactive" = "true" ]; then #interactive install - interactive_init + "$location/install.sh" | tee /dev/tty + echo "user_message: To change settings, run \`sudo nano $location/config.ini\`" + exit 0 else echo "user_message: IMPORTANT: To complete installation, run \`sudo $location/install.sh\`\nTo change settings, run \`sudo nano $location/config.ini\`" exit 0 @@ -59,8 +61,6 @@ uninstall() { # code that must be run to initialize the installation prior to use, but can only be run from terminal interactive_init() { - "$location/install.sh" | tee /dev/tty - echo "user_message: To change settings, run \`sudo nano $location/config.ini\`" exit 0 } From 828f27992ee2f96baaf252e822fb33a9ddc9a6a3 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 15:54:56 +0200 Subject: [PATCH 078/149] Fix small issue with #330 --- .../etc/systemd/system/femto-boot-complete.service | 4 ++-- .../systemd/system/serial-getty@.service.d/override.conf | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service index ae450b3..85e6d55 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service @@ -1,7 +1,7 @@ [Unit] Description=Boot Complete -After=serial-getty@ttyFIQ0.service DefaultDependencies=no +After=multi-user.target [Service] ExecStart=/usr/local/bin/femto-boot-complete.sh @@ -11,4 +11,4 @@ StandardOutput=journal+console StandardError=journal+console [Install] -WantedBy=default.target \ No newline at end of file +WantedBy=default.target diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf index 3509c63..7fb660f 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/serial-getty@.service.d/override.conf @@ -1,5 +1,7 @@ [Unit] -After=femto-boot-complete.service multi-user.target graphical.target +After=femto-boot-complete.service multi-user.target +Conflicts=getty.target +Before=getty.target [Service] -ExectStartPre=/bin/sleep 0.5 +ExecStartPre=/bin/sleep 0.5 From 1ea75dd079165417d98d8a4a99290e0dac830226 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 18:02:21 +0200 Subject: [PATCH 079/149] Fix Foxbuntu version display method --- .../etc/update-motd.d/00-header | 8 +++---- .../usr/local/bin/femto-config | 22 +++++++++---------- .../usr/local/bin/femto-utils.sh | 6 ++++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header index 8d10a9d..c2a9aa4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header @@ -12,11 +12,11 @@ if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then fi [ -r /etc/lsb-release ] && . /etc/lsb-release -foxbuntu_version=$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) -spaces=$((11 - ${#foxbuntu_version})) +foxbuntu_version=$(femto-utils.sh -v) +spaces=$((21 - ${#foxbuntu_version})) printf " For settings, run \`\033[0;31msudo femto-config\033[0m\`\n" printf " Made for Femtofox https://www.femtofox.com\n" -printf " Foxbuntu v$foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)" - +printf " $foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)" +# ^ printf "IP address: $(hostname -I | sed 's/ / /g') Uptime:$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')\n" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 76c005e..572a1ae 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -261,8 +261,8 @@ utilities() { while true; do echo $sysinfo_choice sysinfo_choice=$(dialog --no-collapse --help-button --cancel-label "Back" --default-item "$sysinfo_choice" --item-help --menu "System info" 17 40 5 \ - 1 "CPU" "" \ - 2 "Operating system" "" \ + 1 "Operating system" "" \ + 2 "CPU" "" \ 3 "Storage & memory" "" \ 4 "Peripherals & devices" ""\ 5 "Networking" "" \ @@ -274,17 +274,17 @@ utilities() { if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog break elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "System info help" --msgbox "To get system info in terminal (where it can be copied), enter \`\Zusudo femto-utils.sh -i\Zn\`.\n\nWhen getting Peripherals & Devices (or Complete System Info) without an i2c device connected, it is normal to see error messages on serial console.\n" 0 0 + dialog --no-collapse --colors --title "System info help" --msgbox "To get system info in terminal (where it can be copied), enter \`\Zusudo femto-utils.sh -i\Zn\`.\n\nWhen getting Peripherals & Devices Info (or Complete System Info) without an i2c device connected, it is normal to see error messages on serial console.\n" 0 0 else case $sysinfo_choice in - 1) # CPU) - loading "Loading CPU info..." - dialog --no-collapse --colors --title "CPU info" --msgbox "$(ingest_data "femto-utils.sh -c" 15)" 0 0 - ;; - 2) # Operating system) + 1) # Operating system) loading "Loading operating system info..." dialog --no-collapse --colors --title "Operating system info" --msgbox "$(ingest_data "femto-utils.sh -o" 15)" 0 0 ;; + 2) # CPU) + loading "Loading CPU info..." + dialog --no-collapse --colors --title "CPU info" --msgbox "$(ingest_data "femto-utils.sh -c" 15)" 0 0 + ;; 3) # Storage & memory) loading "Loading storage & memory info..." dialog --no-collapse --colors --title "Storage & memory info" --msgbox "$(ingest_data "femto-utils.sh -S" 15)" 0 0 @@ -510,7 +510,7 @@ meshtastic_settings() { ;; 3) # set URL) check_meshtasticd_running && ( - newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) + newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 8 63 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 if [ $? -eq 0 ]; then #unless cancel/no @@ -701,7 +701,7 @@ help_menu() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $help_choice in 1) #About Femtofox) - dialog --no-collapse --title "About Femtofox" --default-item "$choice" --backtitle "Foxbuntu $(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" --msgbox "$(femto-license.sh -a)" 18 65 + dialog --no-collapse --title "About Femtofox" --default-item "$choice" --backtitle "$(femto-utils.sh -v)" --msgbox "$(femto-license.sh -a)" 18 65 ;; 2) #Display pinout) choice="" # zero the choice before loading the submenu @@ -778,7 +778,7 @@ done # Main menu while true; do - main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --backtitle "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ + main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --backtitle "$(femto-utils.sh -v)" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ 1 "Settings wizard" "" \ 2 "Networking" "" \ 3 "Meshtastic" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 924595d..e5e0ecb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -22,6 +22,7 @@ Options are: -E Generate/overwrite SSH encryption keys -C "service" Check if service is enabled, disabled, running -R "command" Replace colors for dialog menus +-v Get Foxbuntu version EOF ) @@ -219,7 +220,7 @@ replace_colors() { echo "$input" } -while getopts ":harsl:ipcnoSEC:R:" opt; do +while getopts ":harsl:ipcnoSEC:R:v" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -282,6 +283,9 @@ while getopts ":harsl:ipcnoSEC:R:" opt; do R) replace_colors "$OPTARG" ;; + v) # get foxbuntu version) + echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" + ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" ;; From 6d1b7ecc5bd860f52708062e26aa3a6c9a6f0e8e Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Feb 2025 20:05:59 +0200 Subject: [PATCH 080/149] Prettify the service status utility --- .../etc/update-motd.d/00-header | 2 +- .../usr/local/bin/femto-utils.sh | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header index c2a9aa4..276f003 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/update-motd.d/00-header @@ -18,5 +18,5 @@ spaces=$((21 - ${#foxbuntu_version})) printf " For settings, run \`\033[0;31msudo femto-config\033[0m\`\n" printf " Made for Femtofox https://www.femtofox.com\n" printf " $foxbuntu_version%*s%s(%s)\n\n" $spaces "" "$DISTRIB_DESCRIPTION" "$(uname -r)" -# ^ + printf "IP address: $(hostname -I | sed 's/ / /g') Uptime:$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')\n" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index e5e0ecb..ad3fe08 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -256,37 +256,37 @@ while getopts ":harsl:ipcnoSEC:R:v" opt; do ;; C) # Option -C (Check service status) if systemctl is-enabled $OPTARG &>/dev/null; then - state_message="\033[0;34m\033[4menabled\e[39m, " + state_message="\033[0;34m\033[4menabled\033[0m, " else - state_message="\033[0;31m\033[4mdisabled\e[39m, " + state_message="\033[0;31m\033[4mdisabled\033[0m, " fi full_status=$(systemctl status $OPTARG) if echo $full_status | grep -q "active (running)"; then - state_message+="\033[0;34mrunning\e[0m" + state_message+="\033[4m\033[0;34mrunning\033[0m" exit_state=0 elif echo $full_status | grep -q "inactive (dead)"; then - state_message+="\033[0;31mnot running\e[0m" + state_message+="\033[4m\033[0;31mnot running\033[0m" exit_state=1 elif echo $full_status | grep -q "failed"; then - state_message+="\033[0;31mfailed\e[0m" + state_message+="\033[4m\033[0;31mfailed\033[0m" exit_state=1 elif echo $full_status | grep -q "activating"; then - state_message+="activating\e[0m" + state_message+="\033[4mactivating\033[0m" exit_state=2 else - state_message+="unknown\e[0m" + state_message+="\033[4munknown\033[0m" exit_state=2 fi echo -e "$state_message" exit $exit_state ;; - R) + R) # replace colors) replace_colors "$OPTARG" ;; v) # get foxbuntu version) echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" ;; - \?) # Unknown option) + \?) # Unknown argument) echo -e "Unknown argument $1.\n$help" ;; esac From 083110a2641e74e081ea48e8ada2332786e512eb Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 15 Feb 2025 22:41:44 +0200 Subject: [PATCH 081/149] Overhaul of LoRa settings menus --- .../usr/local/bin/femto-config | 118 +--- .../usr/local/bin/femto-install-wizard.sh | 8 +- .../usr/local/bin/femto-meshtasticd-config.sh | 168 ++++- .../bin/femto-meshtasticd-lora-dialogs.sh | 584 ++++++++++++++++++ .../usr/local/bin/femto-software.sh | 7 +- 5 files changed, 777 insertions(+), 108 deletions(-) create mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 572a1ae..e9e6d69 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -260,7 +260,7 @@ utilities() { sysinfo_choice="" # zero the choice before loading the submenu while true; do echo $sysinfo_choice - sysinfo_choice=$(dialog --no-collapse --help-button --cancel-label "Back" --default-item "$sysinfo_choice" --item-help --menu "System info" 17 40 5 \ + sysinfo_choice=$(dialog --no-collapse --help-button --backtitle "$(femto-utils.sh -v)" --cancel-label "Back" --default-item "$sysinfo_choice" --item-help --menu "System info" 17 40 5 \ 1 "Operating system" "" \ 2 "CPU" "" \ 3 "Storage & memory" "" \ @@ -379,67 +379,6 @@ utilities() { done } -#set lora radio -set_lora_radio() { - choice="" # zero the choice before loading the submenu - while true; do - echo "Checking LoRa radio..." - #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ - "Radio name:" "Configuration:" "" \ - "" "" "" \ - "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ - "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ - "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ - "Heltec ht-ra62" "(SX1262_TCXO)" "" \ - "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ - "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ - "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ - "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ - "Simulated radio" "(none)" "" \ - " " "" "" \ - "Skip" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - local radio="" - case $choice in - "Ebyte e22-900m30s") - radio="sx1262_tcxo" - ;; - "Ebyte e22-900m22s") - radio="sx1262_tcxo" - ;; - "Ebyte e80-900m22s") - radio="sx1262_xtal" - ;; - "Heltec ht-ra62") - radio="sx1262_tcxo" - ;; - "Seeed wio-sx1262") - radio="sx1262_tcxo" - ;; - "Waveshare sx126x-xxxm") - radio="sx1262_xtal" - ;; - "AI Thinker ra-01sh") - radio="femto_sx1262_xtal" - ;; - "LoRa Meshstick 1262") - radio="lora-meshstick-1262" - ;; - "Simulated radio") - radio="none" - ;; - "Skip") - return - ;; - esac - if [ -n "$radio" ]; then #if a radio was selected - femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd - return - fi - done -} - legacy_admin() { choice="" # zero the choice before loading the submenu while true; do @@ -481,18 +420,17 @@ meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 19 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 18 50 4 \ 1 "View node info" "" \ 2 "View configuration URL & QR code" "" \ - 3 "Set new configuration URL" "" \ - 4 "Set LoRa radio" "" \ - 5 "Security settings" "" \ - 6 "Mesh connectivity test" "" \ - 7 "Manage Meshtasticd service" "" \ - 8 "Upgrade/install Meshtasticd" "" \ - 9 "Uninstall Meshtasticd" "" \ + 3 "LoRa settings" "" \ + 4 "Security settings" "" \ + 5 "Mesh connectivity test" "" \ + 6 "Manage Meshtasticd service" "" \ + 7 "Upgrade/install Meshtasticd" "" \ + 8 "Uninstall Meshtasticd" "" \ " " "" "" \ - 10 "Back to main menu" "" 3>&1 1>&2 2>&3) + 9 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $meshtastic_choice in 1) # view node info) @@ -508,24 +446,10 @@ meshtastic_settings() { pause ) ;; - 3) # set URL) - check_meshtasticd_running && ( - newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "New Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 8 63 3>&1 1>&2 2>&3) - if [ -n "$newurl" ]; then #if a URL was entered - dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - fi - ) + 3) # LoRa settings) + femto-meshtasticd-lora-dialogs.sh ;; - 4) # set radio) - check_meshtasticd_running && ( - set_lora_radio - ) - ;; - 5) # remote admin) + 4) # remote admin) check_meshtasticd_running && ( choice="" # zero the choice before loading the submenu while true; do @@ -601,7 +525,7 @@ meshtastic_settings() { done ) ;; - 6) #test mesh connectivity) + 5) #test mesh connectivity) check_meshtasticd_running && ( dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 if [ $? -eq 0 ]; then #unless cancel/no @@ -610,7 +534,7 @@ meshtastic_settings() { fi ) ;; - 7) #manage meshtasticd service) + 6) #manage meshtasticd service) choice="" # zero the choice before loading the submenu while true; do echo "Checking Meshtasticd service state..." @@ -663,21 +587,21 @@ meshtastic_settings() { esac done ;; - 8) #Upgrade meshtasticd) + 7) #Upgrade meshtasticd) dialog --no-collapse --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -z pause fi ;; - 9) #uninstall meshtasticd) + 8) #uninstall meshtasticd) dialog --no-collapse --colors --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed.\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 0 0 if [ $? -eq 0 ]; then femto-meshtasticd-config.sh -x dialog --no-collapse --colors --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`\Zusudo apt purge\Zn\`." 8 40 fi ;; - 10) + 9) return ;; esac @@ -754,14 +678,15 @@ Options are:\n\ -l Set LoRa radio model menu\n\ -L Meshtastic legacy admin menu\n\ -w Set Wi-Fi config menu\ +-c Check if Meshtasticd is running and warn the user if not\ " -while getopts ":hlwLi" opt; do +while getopts ":hlLwc" opt; do case ${opt} in h) # Option -h (help) echo -e $help ;; l) # Option -l (set lora radio) - set_lora_radio + femto-meshtasticd-lora-dialogs.sh # this function has moved ;; L) # Option -L (Meshtastic legacy admin menu) legacy_admin @@ -769,6 +694,9 @@ while getopts ":hlwLi" opt; do w) # Option -w (Wi-Fi config) wifi_config ;; + c) # Option -c (Check if Meshtasticd is running and warn the user if not) + check_meshtasticd_running + ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index bebd104..8d199ae 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -33,13 +33,7 @@ wizard() { dialog --title "$title" --cancel-label "Skip" --yesno "Configure Meshtastic?" 6 40 if [ $? -eq 0 ]; then #unless cancel/no - femto-config -l #set lora radio model - - newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) - if [ -n "$newurl" ]; then #if a URL was entered - loading "Sending URL..." - dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi + femto-meshtasticd-lora-dialogs.sh -w # public key loading "Getting current public key..." diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index fe193b0..f647dfc 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -30,6 +30,23 @@ Options are: -x Uninstall Meshtasticd -m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m \"--set security.admin_channel_enabled false\" 10 \"Disable legacy admin\"\` Will retry the \`--set security.admin_channel_enabled false\` command until successful or up to 10 times, and tag status reports with \`Disable legacy admin\` via echo and to system log. +Meshtastic LoRa settings: +-e "value" Region (frequency plan). Options are: UNSET, US, EU_433, EU_868, CN, JP, ANZ, KR, TW, RU ,IN, NZ_865, TH, LORA_24, UA_433, UA_868, MY_433, MY_919, SG_923 +-P "true" Use modem preset (true, false) +-E "value" Preset. Options are: LONG_FAST, LONG_SLOW, VERY_LONG_SLOW, MEDIUM_SLOW, MEDIUM_FAST, SHORT_SLOW, SHORT_FAST, SHORT_TURBO +-b "value" Bandwidth (only used if modem preset is disabled) +-f "value" Spread Factor (only used if modem preset is disabled) +-C "value" Coding rate (only used if modem preset is disabled) +-O "value" Frequency offset (MHz) +-H "value" Hop limit (0-7) +-T "true" TX enabled (true/false) +-X "value" TX power (dBm) +-F "value" Frequency slot +-V "false" Override duty cycle (true/false) +-B "true" SX126X RX boosted gain (true/false) +-v "value" Override frequency (MHz) (overrides frequency slot) +-G "false" Ignore MQTT (true/false) +-K "false" OK to MQTT (true/false) EOF ) @@ -45,8 +62,7 @@ meshtastic_update() { local ref="$3: " echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - local output=$(meshtastic --host $command) #>&2 lets meshtastic's output display on screen - echo $output + local output=$(meshtastic --host $command | tee /dev/tty) #>&2 lets meshtastic's output display on screen logger $output if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then if [ "$retries" -lt $attempts ]; then @@ -67,6 +83,7 @@ meshtastic_update() { fi done if [ -z "$success" ]; then + echo -e "$output" msg="${ref:+$ref}Meshtastic command FAILED." echo "$msg" logger "$msg" @@ -75,7 +92,7 @@ meshtastic_update() { } # Parse options -while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do +while getopts ":higkl:q:uU:rR:aA:cpo:sM:StwuxmP:E:b:f:C:O:e:H:T:X:F:V:B:v:G:K:" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -130,7 +147,7 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do echo $url ;; k) # Option -k (get current lora radio model) - ls /etc/meshtasticd/config.d 2>/dev/null | xargs -r -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' | grep . || echo -e "\033[0;31mnone (simulated radio)\033[0m" + ls /etc/meshtasticd/config.d 2>/dev/null | grep '^femtofox_' | xargs -r -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' | grep . || echo -e "\033[0;31mnone (simulated radio)\033[0m" ;; l) # Option -l (choose lora radio model) prepare="rm -f /etc/meshtasticd/config.d/femtofox* && echo \"Radio type $OPTARG selected.\"" @@ -241,6 +258,149 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do external="true" # set a variable so the function knows it was called by an an external script and not locally meshtastic_update "$2" $3 "$4" ;; + e) # Option -e (Set region/frequency plan) + regions="UNSET US EU_433 EU_868 CN JP ANZ KR TW RU IN NZ_865 TH LORA_24 UA_433 UA_868 MY_433 MY_919 SG_923" + if [[ ! " $regions " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $regions." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.region $OPTARG" 3 "Set region" + fi + ;; + P) # Option -P (Use modem preset: enable/disable) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.use_preset $OPTARG" 3 "Set use_preset" + fi + ;; + E) # Option -E (Preset. Options are: LONG_FAST, LONG_SLOW, VERY_LONG_SLOW, MEDIUM_SLOW, MEDIUM_FAST, SHORT_SLOW, SHORT_FAST, SHORT_TURBO) + presets="LONG_FAST LONG_SLOW VERY_LONG_SLOW MEDIUM_SLOW MEDIUM_FAST SHORT_SLOW SHORT_FAST SHORT_TURBO" + if [[ ! " $presets " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $presets." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.modem_preset $OPTARG" 3 "Set modem_preset" + fi + ;; + b) # Option -b (Set bandwidth; used if modem preset is disabled) + options="31 62 125 250 500" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.bandwidth $OPTARG" 3 "Set bandwidth" + fi + ;; + f) # Option -f (Set spread factor; used if modem preset is disabled) + options="7 8 9 10 11 12" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.spread_factor $OPTARG" 3 "Set spread_factor" + fi + ;; + C) # Option -C (Set coding rate; used if modem preset is disabled) + options="5 6 7 8" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.coding_rate $OPTARG" 3 "Set coding_rate" + fi + ;; + O) # Option -O (Set frequency offset in MHz) + if ! [[ "$OPTARG" =~ ^[0-1000000]$ ]]; then + echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 1000000." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.frequency_offset $OPTARG" 3 "Set frequency_offset" + fi + ;; + H) # Option -H (Set hop limit, range 0-7) + if ! [[ "$OPTARG" =~ ^[0-7]$ ]]; then + echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 7." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.hop_limit $OPTARG" 3 "Set hop limit" + fi + ;; + T) # Option -T (Enable/disable TX) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.tx_enabled $OPTARG" 3 "Set hop limit" + fi + ;; + X) # Option -X (Set TX power in dBm) + if ! [[ "$OPTARG" =~ ^([0-9]|1[0-9]|2[0-9]|30)$ ]]; then + echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 30." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.tx_power $OPTARG" 3 "Set tx_power" + fi + ;; + F) # Option -F (Set frequency slot) + meshtastic_update "--set lora.channel_num $OPTARG" 3 "Set frequency slot" + ;; + V) # Option -V (Enable/disable override duty cycle) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.override_duty_cycle $OPTARG" 3 "Set override_duty_cycle" + fi + ;; + B) # Option -B (Enable/disable SX126X RX boosted gain) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.sx126x_rx_boosted_gain $OPTARG" 3 "Set sx126x_rx_boosted_gain" + fi + ;; + v) # Option -v (Override frequency in MHz; overrides frequency slot) + meshtastic_update "--set lora.override_frequency $OPTARG" 3 "Set override_frequency" + ;; + G) # Option -G (enable/disable ignore MQTT) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.ignore_mqtt $OPTARG" 3 "Set ignore_mqtt" + fi + ;; + K) # Option -K (enable/disable OK to MQTT) + options="true false" + if [[ ! " $options " =~ " $OPTARG " ]]; then + echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 + echo -e "$help" + exit 1 + else + meshtastic_update "--set lora.config_ok_to_mqtt $OPTARG" 3 "Set config_ok_to_mqtt" + fi + ;; \?) # Invalid option echo "Invalid option: -$OPTARG" echo -e "$help" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh new file mode 100755 index 0000000..52a7c8f --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -0,0 +1,584 @@ +#!/bin/bash + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo femto-meshtasticd-config\`." + exit 1 +fi + +args=$@ + +loading() { + dialog --no-collapse --infobox "$1" 5 45 +} + +config_url() { + femto-config -c && ( + newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 11 63 3>&1 1>&2 2>&3) + if [ -n "$newurl" ]; then #if a URL was entered + dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 + if [ $? -eq 0 ]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + fi + return + ) +} + +#set lora radio +set_lora_radio() { + choice="" # zero the choice before loading the submenu + while true; do + echo "Checking LoRa radio..." + #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) + choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + "Radio name:" "Configuration:" "" \ + "" "" "" \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ + "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ + "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ + "Heltec ht-ra62" "(SX1262_TCXO)" "" \ + "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ + "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ + "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ + "Simulated radio" "(none)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + local radio="" + case $choice in + "Ebyte e22-900m30s") + radio="sx1262_tcxo" + ;; + "Ebyte e22-900m22s") + radio="sx1262_tcxo" + ;; + "Ebyte e80-900m22s") + radio="sx1262_xtal" + ;; + "Heltec ht-ra62") + radio="sx1262_tcxo" + ;; + "Seeed wio-sx1262") + radio="sx1262_tcxo" + ;; + "Waveshare sx126x-xxxm") + radio="sx1262_xtal" + ;; + "AI Thinker ra-01sh") + radio="femto_sx1262_xtal" + ;; + "LoRa Meshstick 1262") + radio="lora-meshstick-1262" + ;; + "Simulated radio") + radio="none" + ;; + "Skip") + return + ;; + esac + if [ -n "$radio" ]; then #if a radio was selected + femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45 + return + fi + done +} + +lora_settings_actions() { + local title="Meshtastic LoRa Settings" + + meshtastic_command_result() { + if [ $1 -eq 1 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$2")" 0 0 + elif [ $1 -eq 0 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn")" 6 45 + fi + } + + if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + set_lora_radio + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "config_url" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + choice="" # zero the choice before loading the submenu + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ + "Automatic configuration with URL" "x" "" \ + "Manual configuration" "x" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + [ "$choice" == "Manual configuration" ] && break + [ "$choice" == "Automatic configuration with URL" ] && config_url + return + done + } + fi + + if [ "$1" = "region" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + options=("UNSET" "US" "EU_433" "EU_868" "CN" "JP" "ANZ" "KR" "TW" "RU" "IN" "NZ_865" "TH" "LORA_24" "UA_433" "UA_868" "MY_433" "MY_919" "SG_923") + menu_items=() + # Create menu options from the array + for i in "${!options[@]}"; do + if [ $i -eq 0 ]; then + menu_items+=("${options[$i]}" "(default)" "") # First item with "(default)" + else + menu_items+=("${options[$i]}" "" "") # Other items without "(default)" + fi + done + menu_items+=("" "" "" "Cancel" "" "") + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Region (default: UNSET)?" 8 40 0 \ + "${menu_items[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -e $choice | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + choice="" # zero the choice before loading the submenu + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Use modem preset?" 8 40 0 \ + "True" "(default)" "" \ + "False" "" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + using_preset="$choice" + set -o pipefail + output=$(femto-meshtasticd-config.sh -P $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "wizard" ] && [ "$using_preset" = "False" ]; then + dialog --no-collapse --title "$title" --colors --msgbox "Not using preset, so skipping Preset setting." 6 50 + else + if [ "$1" = "preset" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + options=("LONG_FAST" "LONG_SLOW" "VERY_LONG_SLOW" "MEDIUM_SLOW" "MEDIUM_FAST" "SHORT_SLOW" "SHORT_FAST" "SHORT_TURBO") + menu_items=() + # Create menu options from the array + for i in "${!options[@]}"; do + if [ $i -eq 0 ]; then + menu_items+=("${options[$i]}" "(default)" "") # First item with "(default)" + else + menu_items+=("${options[$i]}" "" "") # Other items without "(default)" + fi + done + menu_items+=("" "" "" "Cancel" "" "") + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Preset?" 8 40 0 \ + "${menu_items[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -E $choice | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + fi + + if [ "$1" = "wizard" ] && [ "$using_preset" = "True" ]; then + dialog --no-collapse --title "$title" --colors --msgbox "Using preset, so skipping Bandwidth, Spread Factor and Coding Rate settings." 7 50 + else + if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + options=("31" "62" "125" "250" "500") + menu_items=() + for option in "${options[@]}"; do + menu_items+=("$option" "x" "") + done + menu_items+=("" "" "" "Cancel" "" "") + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Bandwidth (only used if modem preset is disabled)?" 8 40 0 \ + "${menu_items[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -b $choice | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + options=("7" "8" "9" "10" "11" "12") + menu_items=() + for option in "${options[@]}"; do + menu_items+=("$option" "x" "") + done + menu_items+=("" "" "" "Cancel" "" "") + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Spread factor (only used if modem preset is disabled)?" 8 40 0 \ + "${menu_items[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -f $choice | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + options=("5" "6" "7" "8") + menu_items=() + for option in "${options[@]}"; do + menu_items+=("$option" "x" "") + done + menu_items+=("" "" "" "Cancel" "" "") + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Coding rate (only used if modem preset is disabled)?" 8 40 0 \ + "${menu_items[@]}" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -C $choice | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + fi + + if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Frequency offset (default: 0)" 8 50 3>&1 1>&2 2>&3) + if [ $? -ne 1 ] && [ -n "$input" ]; then + set -o pipefail + output=$(femto-meshtasticd-config.sh -O $input | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + fi + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Hop limit (default: 3)\nExcessive hop limit increases congestion!" 9 50 3>&1 1>&2 2>&3) + if [ $? -ne 1 ] && [ -n "$input" ]; then + set -o pipefail + output=$(femto-meshtasticd-config.sh -H $input | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + fi + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + choice="" # zero the choice before loading the submenu + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enable TX?" 8 40 0 \ + "True" "(default)" "" \ + "False" "" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -T $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "\ +\Z1\ZuWARNING!\Zn\n\ +Setting a 33db radio above 8db will \Zupermanently\Zn damage it.\n\ +ERP above 27db violates EU law.\n\ +ERP above 36db violates US (unlicensed) law.\n\ +\n\ +TX power in db (default: 22)" 13 62 3>&1 1>&2 2>&3) + if [ $? -ne 1 ] && [ -n "$input" ]; then + set -o pipefail + output=$(femto-meshtasticd-config.sh -X $input | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + fi + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Frequency slot (0 for automatic)" 8 50 3>&1 1>&2 2>&3) + if [ $? -ne 1 ] && [ -n "$input" ]; then + set -o pipefail + output=$(femto-meshtasticd-config.sh -F $input | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + fi + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Override duty cycle?\nMay have legal ramifications." 9 40 0 \ + "True" "" "" \ + "False" "(default)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -V $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enable SX126X RX boosted gain?" 8 40 0 \ + "True" "(default)" "" \ + "False" "" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -B $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Override frequency in MHz (0 for none).\nOverrides frequency slot." 9 50 3>&1 1>&2 2>&3) + if [ $? -ne 1 ] && [ -n "$input" ]; then + set -o pipefail + output=$(femto-meshtasticd-config.sh -v $input | tee /dev/tty | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + fi + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Ignore MQTT?" 8 40 0 \ + "True" "" "" \ + "False" "(default)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -G $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then + femto-config -c && { + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "OK to MQTT?" 8 40 0 \ + "True" "" "" \ + "False" "(default)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue #restart loop if no choice made + set -o pipefail + output=$(femto-meshtasticd-config.sh -K $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" + break + done + } + [ "$1" != "wizard" ] && return + fi + + # if we're in wizard mode AND there are no script arguments, then display a message + [ "$1" = "wizard" ] && [ -n "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 + + [ "$1" = "wizard" ] && return # quit function if wizard +} + + +# Parse options +help="If script is run without arguments, menu will load.\n\ +Options are:\n\ +-h This message\n\ +-w Wizard mode\ +" +while getopts ":hw" opt; do + case ${opt} in + h) # Option -h (help) + echo -e $help + ;; + w) # Option -w (Wizard mode) + lora_settings_actions "wizard" + ;; + \?) # Unknown option) + echo -e "Unknown argument $1.\n$help" + ;; + esac +done +[ -n "$1" ] && exit # if there were arguments, exit before loading the menu + + +LoRa_menu_choice="" # zero the choice before loading the submenu +while true; do + LoRa_menu_choice=$(dialog --no-collapse --title "Meshtastic LoRa Settings" --default-item "$LoRa_menu_choice" --cancel-label "Back" --item-help --menu "LoRa settings can also be set automatically by entering a Meshtastic configuration URL." 30 50 20 \ + 1 "Wizard (set all)" "" \ + 2 "Set LoRa radio model" "" \ + 3 "Configure automatically with URL" "" \ + 4 "Region" "" \ + 5 "Use modem preset" "" \ + 6 "Preset" "" \ + 7 "Bandwidth" "" \ + 8 "Spread factor" "" \ + 9 "Coding rate" "" \ + 10 "Frequency offset" "" \ + 11 "Hop limit" "" \ + 12 "Enable/disable TX" "" \ + 13 "TX power" "" \ + 14 "Frequency slot" "" \ + 15 "Override duty cycle" "" \ + 16 "SX126X RX boosted gain " "" \ + 17 "Override frequency" "" \ + 18 "Ignore MQTT" "" \ + 19 "OK to MQTT" "" \ + " " "" "" \ + 20 "Back to Meshtastic Menu" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + case $LoRa_menu_choice in + 1) # Wizard (set all) + lora_settings_actions "wizard" + ;; + 2) # Set LoRa radio model) + lora_settings_actions "set_lora_radio_model" + ;; + 3) # Configure automatically with URL) + config_url + ;; + 4) # Region) + lora_settings_actions "region" + ;; + 5) # Use modem preset) + lora_settings_actions "use_modem_preset" + ;; + 6) # Preset) + lora_settings_actions "preset" + ;; + 7) # Bandwidth) + lora_settings_actions "bandwidth" + ;; + 8) # Spread factor) + lora_settings_actions "spread_factor" + ;; + 9) # Coding rate) + lora_settings_actions "coding_rate" + ;; + 10) # Frequency offset) + lora_settings_actions "frequency_offset" + ;; + 11) # Hop limit) + lora_settings_actions "hop_limit" + ;; + 12) # Enable/disable TX) + lora_settings_actions "tx_enabled" + ;; + 13) # TX power) + lora_settings_actions "tx_power" + ;; + 14) # Frequency slot) + lora_settings_actions "frequency_slot" + ;; + 15) # Override duty cycle) + lora_settings_actions "override_duty_cycle" + ;; + 16) # SX126X RX boosted gain) + lora_settings_actions "sx126x_rx_boosted_gain" + ;; + 17) # Override frequency) + lora_settings_actions "override_frequency" + ;; + 18) # Ignore MQTT) + lora_settings_actions "ignore_mqtt" + ;; + 19) # OK to MQTT) + lora_settings_actions "ok_to_mqtt" + ;; + 20) break ;; + esac +done + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 21d635c..4e0ac3d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -19,7 +19,6 @@ install() { output="$truncated_output" fi user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present - echo $user_message output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output if [ $install_status -eq 0 ]; then # if the installation was successful @@ -113,7 +112,11 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" $license_button --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ + if $package_dir/$1.sh -O | grep -q 'e' && [ "$($package_dir/$1.sh -E | wc -w)" -gt 1 ]; then + multiple_services_note="\nService will appear as \"running\" if any of the services are active." + menu_count=$((menu_count + 2)) + fi + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" $license_button --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)$multiple_services_note" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ $menu_list \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) From e585c88882622ecd8621a87c3c7ff0aedbe482d8 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 15 Feb 2025 22:41:51 +0200 Subject: [PATCH 082/149] Update .dialogrc --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc index 1774a38..0dc0ac3 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/root/.dialogrc @@ -27,7 +27,7 @@ form_text_color = (WHITE,CYAN,ON) form_item_readonly_color = (BLUE,WHITE,ON) # Item help-text color -itemhelp_color = (BLACK,BLUE,OFF) +itemhelp_color = (WHITE,BLUE,OFF) # Selected tag color (menu items) tag_selected_color = (WHITE,BLUE,ON) From 0e0316d3629117ef59d16fab49d341113bf1478f Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 15 Feb 2025 22:55:34 +0200 Subject: [PATCH 083/149] Update femto-meshtasticd-lora-dialogs.sh --- .../bin/femto-meshtasticd-lora-dialogs.sh | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 52a7c8f..0857240 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -7,20 +7,23 @@ fi args=$@ -loading() { - dialog --no-collapse --infobox "$1" 5 45 -} - config_url() { + echo "argument $1" + echo "args $args" femto-config -c && ( newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 11 63 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -q "$newurl" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + set -o pipefail + output=$(femto-meshtasticd-config.sh -q "$newurl" | tee /dev/tty) + exit_status=$? + set +o pipefail + meshtastic_command_result $exit_status "$output" fi fi + # if we're in wizard mode AND there are no script arguments, then display a message + [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 return ) } @@ -94,7 +97,7 @@ lora_settings_actions() { if [ $1 -eq 1 ]; then dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$2")" 0 0 elif [ $1 -eq 0 ]; then - dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn")" 6 45 + dialog --no-collapse --title "$title" --msgbox "$(echo -e "Command Successful!")" 6 45 fi } @@ -105,7 +108,7 @@ lora_settings_actions() { [ "$1" != "wizard" ] && return fi - if [ "$1" = "config_url" ] || [ "$1" = "wizard" ]; then + if [ "$1" = "wizard" ]; then femto-config -c && { choice="" # zero the choice before loading the submenu while true; do @@ -117,7 +120,7 @@ lora_settings_actions() { [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made [ "$choice" == "Manual configuration" ] && break - [ "$choice" == "Automatic configuration with URL" ] && config_url + [ "$choice" == "Automatic configuration with URL" ] && config_url "$1" return done } @@ -467,7 +470,7 @@ TX power in db (default: 22)" 13 62 3>&1 1>&2 2>&3) fi # if we're in wizard mode AND there are no script arguments, then display a message - [ "$1" = "wizard" ] && [ -n "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 + [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 [ "$1" = "wizard" ] && return # quit function if wizard } From d09b299875160ee6bbc66612dec5369208e41a11 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 00:01:56 +0200 Subject: [PATCH 084/149] Fix typo in legacy admin menu --- .../sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index e9e6d69..2871ba4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -383,7 +383,7 @@ legacy_admin() { choice="" # zero the choice before loading the submenu while true; do loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you need to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ 1 "Enable" "" \ 2 "Disable (default)" "" \ " " "" "" \ From 4cbc597b1f2cf9819b0322ad69ba42855fb7c9d5 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Sun, 16 Feb 2025 01:56:51 +0000 Subject: [PATCH 085/149] Update README.md --- README.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index afe523b..3c08679 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,18 @@ # Femtofox    The tiny, low power Linux Meshtastic node **Femtofox is a Linux-based mesh development platform - a Raspberry Pi sized computer with onboard LoRa radio, capable of being run with only 0.3w, making it *ideal* for solar powered nodes.** -The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compact and power efficient Linux board, running a customized version of Ubuntu. Femtofox is an expansion of the Luckfox's capabilities, utilizing a custom PCB with a 30db LoRa radio (over 6x the transmit power of a RAK Wisblock or Heltec V3) to create a power efficient, tiny and highly capable Meshtastic Linux node. +The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compact and power efficient Linux board, running Foxbuntu, our own customized version of Ubuntu. Femtofox is an expansion of the Luckfox's capabilities, utilizing a custom PCB with a 30db LoRa radio (over 6x the transmit power of a RAK Wisblock or Heltec V3) to create a power efficient, tiny and highly capable Meshtastic Linux node. -- [Features](#features) -- Specifications - coming soon +Find out more in the sections below, or in the [Wiki](https://github.com/femtofox/femtofox/wiki). + +- [Features](#features) and [Specifications](#Specification) - [Supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware) - [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started) - How to order - coming soon - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) -- [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Config-Tool) +- [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) +- [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) + ### Features * Tiny size (63x54mm for Femtofox, 65x30mm for the Smol Edition). Equivalent to a standard Raspberry Pi hat and Pi Zero respectively. @@ -23,10 +26,26 @@ The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compa * USB wifi support * RTC support for timekeeping +### Specification + +| Feature | Specification | +| ------------ | ------------------------------------------------------- | +| Processor | Rockchip RV1103, Cortex A7 \@1.1GHz | +| Memory | 64MB DDR2 | +| OS | Foxbuntu (based on Ubuntu 22.04.5 LTS Jammy) | +| Connectivity | USB 2.0 Host/Device | +| Network | RJ45 Ethernet with filtering
WiFi ready | +| GPIO | 17x GPIO pins (of which 8 are required for Lora module) | +| IO | 2x I2C JST PH | +| | 1x UART JST PH | +| Debug | 1x CH340 USB to serial adapter (Pro only) | +| Mesh | 30dB LoRa Radio 868-915MHz | +| Storage | Micro-SD slot | +| Power | 3.3-5V.dc via JST PH or USB-C | + **Accomplished:** - [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md)) - [x] WIFI over USB (see [supported hardware](supported_hardware.md)) -- [x] Ethernet over USB (see [supported hardware](supported_hardware.md)) - [x] Ethernet over pins (see *Networking* below and wiring diagram at bottom of page) - [x] UART communications with Meshtastic nodes (2 pin pairs) such as RAK Wisblock - [x] USB serial communications with Meshtastic nodes (see [supported hardware](supported_hardware.md)) From 95d20fb8ba1d72be62e8fb49d56945324a59c657 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 11:27:58 +0200 Subject: [PATCH 086/149] Change femto-runonce service to self-disable after first boot --- .../out/rootfs_uclibc_rv1106/etc/femto.conf | 1 - .../usr/local/bin/femto-boot-complete.sh | 2 +- .../usr/local/bin/femto-runonce.sh | 30 ++++++++++--------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf index c682338..6309017 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/femto.conf @@ -1,2 +1 @@ -first_boot=true act_led=enable \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh index cb15633..b7d94fa 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-boot-complete.sh @@ -1,6 +1,6 @@ #!/bin/bash if grep -qE '^first_boot=true' /etc/femto.conf; then - log_message "First boot, skipping \`boot complete\` tasks." + echo "First boot, skipping \`boot complete\` tasks." exit 0 fi diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index f467c0b..a5df75a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -3,7 +3,8 @@ log_message() { echo -e "\e[32mFirst boot\e[0m: $1" # Echo to the screen logger "First boot: $1" # Log to the system log } -if ! grep -qE '^first_boot=true' /etc/femto.conf; then # if not the first boot + +if ! systemctl is-enabled femto-runonce &>/dev/null; then # if not the first boot who | grep -q . || exit 0 # if not logged in, exit script. May not deal well with future web UI @@ -23,12 +24,13 @@ Re-running this script will:\n\ * Add terminal type to user femto's .bashrc\n\ * Add a shortcut \`sfc\` to user femto's .bashrc\n\ * Enable the meshtasticd service\n\ +* Add compiler support\n\ \n\ Finally, the Femtofox will reboot.\n\ \n\ Re-running this script after first boot should not cause any harm, but may not work as expected.\n\ \n\ -Proceed?" 22 60 +Proceed?" 24 60 if [ $? -eq 1 ]; then #if cancel/no exit 0 fi @@ -60,20 +62,12 @@ if [ ! -f /swapfile ]; then # check if swap file already exists chmod 600 /swapfile mkswap /swapfile > /dev/null swapon /swapfile > /dev/null - echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null + echo '/swapfile none swap sw 0 0' log_message "Swap file allocated." else log_message "Swap file already allocated, skipping" fi -#generate SSH keys -log_message "Generating new SSH encryption keys. This can take a minute..." -femto-utils.sh -E - -#generate ttyd SSL keys -log_message "Generating new Web Terminal SSL encryption keys. This can take a minute..." -/usr/local/bin/packages/ttyd.sh -k - # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" if ! grep -q "eth0" /etc/network/interfaces; then @@ -100,8 +94,8 @@ else fi # Fix Compiler -log_message "Fixing Compiler." cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a +log_message "Added compiler support" # Add a cheeky alias to .bash_aliases if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases @@ -114,8 +108,16 @@ fi log_message "Enabling meshtasticd service" systemctl enable meshtasticd +#generate SSH keys +log_message "Generating new SSH encryption keys. This can take a couple minutes..." +#femto-utils.sh -E + +#generate ttyd SSL keys +log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." +/usr/local/bin/packages/ttyd.sh -k + # remove first boot flag -sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf -log_message "Removing first boot flag and rebooting in 5 seconds..." +systemctl disable femto-runonce +log_message "Disabled first boot service and rebooting in 5 seconds..." sleep 5 reboot From 1e6aa868e0ad2ebfe3f46cfab7800f9d8665df1c Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 14:56:57 +0200 Subject: [PATCH 087/149] Major improvements to LoRa configuration menus --- .../usr/local/bin/femto-config | 5 +- .../usr/local/bin/femto-meshtasticd-config.sh | 4 +- .../bin/femto-meshtasticd-lora-dialogs.sh | 459 ++++++++---------- 3 files changed, 200 insertions(+), 268 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 2871ba4..3a87175 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -191,7 +191,7 @@ networking_settings() { case $choice in "View detailed service status") echo "Getting Meshtastic wifi sync service status..." - dialog --no-collapse --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 + dialog --no-collapse --no-shadow --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 ;; "Start/restart service") dialog --no-collapse --title "$title" --yesno "Start/restart Meshtastic wifi sync service?" 7 45 @@ -553,7 +553,7 @@ meshtastic_settings() { case $choice in "View detailed service status") echo "Getting Meshtasticd service status..." - dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 + dialog --no-collapse --no-shadow --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; "Start/restart service") dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 6 45 @@ -696,6 +696,7 @@ while getopts ":hlLwc" opt; do ;; c) # Option -c (Check if Meshtasticd is running and warn the user if not) check_meshtasticd_running + exit $? # relay exit status ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index f647dfc..baf5b10 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -28,7 +28,7 @@ Options are: -S Get Meshtasticd service state -z Upgrade Meshtasticd -x Uninstall Meshtasticd --m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m \"--set security.admin_channel_enabled false\" 10 \"Disable legacy admin\"\` +-m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m '--set security.admin_channel_enabled false' 10 'Disable legacy admin'\` Will retry the \`--set security.admin_channel_enabled false\` command until successful or up to 10 times, and tag status reports with \`Disable legacy admin\` via echo and to system log. Meshtastic LoRa settings: -e "value" Region (frequency plan). Options are: UNSET, US, EU_433, EU_868, CN, JP, ANZ, KR, TW, RU ,IN, NZ_865, TH, LORA_24, UA_433, UA_868, MY_433, MY_919, SG_923 @@ -67,12 +67,14 @@ meshtastic_update() { if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." + femto-meshtasticd-config.sh -s echo "$msg" logger "$msg" sleep 2 # Add a small delay before retrying fi else local success="true" + echo -e "$output" msg="${ref:+$ref}Meshtastic command successful!" echo "$msg" logger "$msg" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 0857240..c7e80e9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -5,6 +5,10 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi +export NCURSES_NO_UTF8_ACS=1 +export TERM=xterm-256color +export LANG=C.UTF-8 + args=$@ config_url() { @@ -13,14 +17,7 @@ config_url() { femto-config -c && ( newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 11 63 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered - dialog --no-collapse --title "$title" --yesno "New Meshtastic LoRa configuration URL:\n$newurl\n\nConfirm?" 15 60 - if [ $? -eq 0 ]; then #unless cancel/no - set -o pipefail - output=$(femto-meshtasticd-config.sh -q "$newurl" | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" - fi + command+="--seturl $newurl " fi # if we're in wizard mode AND there are no script arguments, then display a message [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 @@ -91,30 +88,20 @@ set_lora_radio() { } lora_settings_actions() { - local title="Meshtastic LoRa Settings" + if femto-config -c; then + local title="Meshtastic LoRa Settings" - meshtastic_command_result() { - if [ $1 -eq 1 ]; then - dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$2")" 0 0 - elif [ $1 -eq 0 ]; then - dialog --no-collapse --title "$title" --msgbox "$(echo -e "Command Successful!")" 6 45 - fi - } - - if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then set_lora_radio - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ - "Automatic configuration with URL" "x" "" \ - "Manual configuration" "x" "" \ + "Automatic configuration with URL" "" "" \ + "Manual configuration" "" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog @@ -123,11 +110,9 @@ lora_settings_actions() { [ "$choice" == "Automatic configuration with URL" ] && config_url "$1" return done - } - fi + fi - if [ "$1" = "region" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "region" ] || [ "$1" = "wizard" ]; then options=("UNSET" "US" "EU_433" "EU_868" "CN" "JP" "ANZ" "KR" "TW" "RU" "IN" "NZ_865" "TH" "LORA_24" "UA_433" "UA_868" "MY_433" "MY_919" "SG_923") menu_items=() # Create menu options from the array @@ -140,49 +125,37 @@ lora_settings_actions() { done menu_items+=("" "" "" "Cancel" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Region (default: UNSET)?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Sets the region for your node. Default is unset. As long as this is not set, the node screen will display a message and not transmit any packets.\n\nRegion (default: UNSET)?" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -e $choice | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.region $choice " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Use modem preset?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - using_preset="$choice" - set -o pipefail - output=$(femto-meshtasticd-config.sh -P $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + using_preset=$choice + command+="--set lora.use_preset $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "wizard" ] && [ "$using_preset" = "False" ]; then - dialog --no-collapse --title "$title" --colors --msgbox "Not using preset, so skipping Preset setting." 6 50 - else - if [ "$1" = "preset" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "wizard" ] && [ "$using_preset" = "False" ]; then + dialog --no-collapse --title "$title" --colors --msgbox "Not using preset, so skipping Preset setting." 6 50 + else + if [ "$1" = "preset" ] || [ "$1" = "wizard" ]; then options=("LONG_FAST" "LONG_SLOW" "VERY_LONG_SLOW" "MEDIUM_SLOW" "MEDIUM_FAST" "SHORT_SLOW" "SHORT_FAST" "SHORT_TURBO") menu_items=() # Create menu options from the array @@ -195,284 +168,226 @@ lora_settings_actions() { done menu_items+=("" "" "" "Cancel" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Preset?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset?" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -E $choice | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.modem_preset $choice " break done - } - [ "$1" != "wizard" ] && return - fi - fi - - if [ "$1" = "wizard" ] && [ "$using_preset" = "True" ]; then - dialog --no-collapse --title "$title" --colors --msgbox "Using preset, so skipping Bandwidth, Spread Factor and Coding Rate settings." 7 50 - else - if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - options=("31" "62" "125" "250" "500") - menu_items=() - for option in "${options[@]}"; do - menu_items+=("$option" "x" "") - done - menu_items+=("" "" "" "Cancel" "" "") - while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Bandwidth (only used if modem preset is disabled)?" 8 40 0 \ - "${menu_items[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - [ "$choice" == "" ] && continue # Restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -b $choice | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" - break - done - } - [ "$1" != "wizard" ] && return - fi - - if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - options=("7" "8" "9" "10" "11" "12") - menu_items=() - for option in "${options[@]}"; do - menu_items+=("$option" "x" "") - done - menu_items+=("" "" "" "Cancel" "" "") - while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Spread factor (only used if modem preset is disabled)?" 8 40 0 \ - "${menu_items[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - [ "$choice" == "" ] && continue # Restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -f $choice | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" - break - done - } - [ "$1" != "wizard" ] && return - fi - - if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - options=("5" "6" "7" "8") - menu_items=() - for option in "${options[@]}"; do - menu_items+=("$option" "x" "") - done - menu_items+=("" "" "" "Cancel" "" "") - while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --menu "Coding rate (only used if modem preset is disabled)?" 8 40 0 \ - "${menu_items[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - [ "$choice" == "" ] && continue # Restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -C $choice | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" - break - done - } - [ "$1" != "wizard" ] && return - fi - fi - - if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Frequency offset (default: 0)" 8 50 3>&1 1>&2 2>&3) - if [ $? -ne 1 ] && [ -n "$input" ]; then - set -o pipefail - output=$(femto-meshtasticd-config.sh -O $input | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + [ "$1" != "wizard" ] && return fi - } - [ "$1" != "wizard" ] && return - fi - - if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Hop limit (default: 3)\nExcessive hop limit increases congestion!" 9 50 3>&1 1>&2 2>&3) - if [ $? -ne 1 ] && [ -n "$input" ]; then - set -o pipefail - output=$(femto-meshtasticd-config.sh -H $input | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + fi + + if [ "$1" = "wizard" ] && [ "$using_preset" = "True" ]; then + dialog --no-collapse --title "$title" --colors --msgbox "Using preset, so skipping Bandwidth, Spread Factor and Coding Rate settings." 7 50 + else + if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 250 --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth?" 0 0 0 \ + 31 "" "" \ + 62 "" "" \ + 125 "" "" \ + 250 "(default)" "" \ + 500 "" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + command+="--set lora.bandwidth $choice " + break + done + [ "$1" != "wizard" ] && return fi - } - [ "$1" != "wizard" ] && return - fi - if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 12 --menu "Indicates the number of chirps per symbol.\n\nSpread factor (only used if modem preset is disabled)?" 0 0 0 \ + 7 "" "" \ + 8 "" "" \ + 9 "" "" \ + 10 "" "" \ + 11 "" "" \ + 12 "(default)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + command+="--set lora.spread_factor $choice " + break + done + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 8 --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)?" 0 0 0 \ + 5 "" "" \ + 6 "" "" \ + 7 "" "" \ + 8 "(default)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ "$choice" == "" ] && continue # Restart loop if no choice made + command+="--set lora.coding_rate $choice " + break + done + [ "$1" != "wizard" ] && return + fi + fi + + if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then + while true; do + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 3>&1 1>&2 2>&3) + [[ -z $input || ($input =~ ^([0-9]{1,6})(\.[0-9]+)?$ && $(echo "$input <= 1000000" | bc -l) -eq 1) ]] && break # exit loop if user input a number between 0 and 1000000. Decimals allowed + dialog --no-collapse --title "$title" --msgbox "Must be between 0-1000000. Decimals allowed." 6 50 + done + if [ $? -ne 1 ] && [ -n "$input" ]; then + command+="--set lora.frequency_offset $input " + fi + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then + while true; do + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 3>&1 1>&2 2>&3) + [[ -z $input || ($input =~ ^[0-7]$) ]] && break # exit loop if user input an integer between 0 and 7 + dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 7." 6 50 + done + if [ $? -ne 1 ] && [ -n "$input" ]; then + command+="--set lora.hop_limit $input " + fi + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enable TX?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -T $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.tx_enabled $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "\ + if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then + while true; do + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "\ \Z1\ZuWARNING!\Zn\n\ Setting a 33db radio above 8db will \Zupermanently\Zn damage it.\n\ ERP above 27db violates EU law.\n\ ERP above 36db violates US (unlicensed) law.\n\ \n\ -TX power in db (default: 22)" 13 62 3>&1 1>&2 2>&3) +If 0, will use the maximum continuous power legal in your region. +\n\ +\n\ +TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) + [[ -z $input || ($input =~ ^[0-30]$) ]] && break # exit loop if user input an integer between 0 and 30 + dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 30." 6 50 + done if [ $? -ne 1 ] && [ -n "$input" ]; then - set -o pipefail - output=$(femto-meshtasticd-config.sh -X $input | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.tx_power $input " fi - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Frequency slot (0 for automatic)" 8 50 3>&1 1>&2 2>&3) - if [ $? -ne 1 ] && [ -n "$input" ]; then - set -o pipefail - output=$(femto-meshtasticd-config.sh -F $input | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" - fi - } - [ "$1" != "wizard" ] && return - fi - - if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Override duty cycle?\nMay have legal ramifications." 9 40 0 \ + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 3>&1 1>&2 2>&3) + [[ -z $input || ($input =~ ^[0-9]+$) ]] && break # exit loop if user input an integer 0 or higher + dialog --no-collapse --title "$title" --msgbox "Must be an integer 0 or higher." 6 50 + done + if [ $? -ne 1 ] && [ -n "$input" ]; then + command+="--set lora.channel_num $input " + fi + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then + while true; do + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -V $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.override_duty_cycle $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enable SX126X RX boosted gain?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -B $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.sx126x_rx_boosted_gain $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi + + if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then + while true; do + input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 3>&1 1>&2 2>&3) + [[ -z $input || ($input =~ ^[0-9]+(\.[0-9]+)?$) ]] && break # exit loop if user input a number 0 or higher (decimals allowed) + dialog --no-collapse --title "$title" --msgbox "Must be a number 0 or higher. Decimals allowed." 6 53 + done - if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then - femto-config -c && { - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Override frequency in MHz (0 for none).\nOverrides frequency slot." 9 50 3>&1 1>&2 2>&3) if [ $? -ne 1 ] && [ -n "$input" ]; then - set -o pipefail - output=$(femto-meshtasticd-config.sh -v $input | tee /dev/tty | tee /dev/tty) - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.override_frequency $input " fi - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Ignore MQTT?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -G $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.ignore_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return - fi + [ "$1" != "wizard" ] && return + fi - if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then - femto-config -c && { + if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "OK to MQTT?" 8 40 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ "Cancel" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made - set -o pipefail - output=$(femto-meshtasticd-config.sh -K $(echo "$choice" | tr '[:upper:]' '[:lower:]') | tee /dev/tty) # make lower case - exit_status=$? - set +o pipefail - meshtastic_command_result $exit_status "$output" + command+="--set lora.config_ok_to_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - } - [ "$1" != "wizard" ] && return + [ "$1" != "wizard" ] && return + fi + + # if we're in wizard mode AND there are no script arguments, then display a message + [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 + + [ "$1" = "wizard" ] && return # quit function if wizard fi - - # if we're in wizard mode AND there are no script arguments, then display a message - [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 - - [ "$1" = "wizard" ] && return # quit function if wizard } @@ -497,9 +412,10 @@ while getopts ":hw" opt; do done [ -n "$1" ] && exit # if there were arguments, exit before loading the menu - +command="" # initialize command LoRa_menu_choice="" # zero the choice before loading the submenu while true; do + command="" # initialize command LoRa_menu_choice=$(dialog --no-collapse --title "Meshtastic LoRa Settings" --default-item "$LoRa_menu_choice" --cancel-label "Back" --item-help --menu "LoRa settings can also be set automatically by entering a Meshtastic configuration URL." 30 50 20 \ 1 "Wizard (set all)" "" \ 2 "Set LoRa radio model" "" \ @@ -583,5 +499,18 @@ while true; do ;; 20) break ;; esac + + if [ -n "$command" ]; then + set -o pipefail + echo "meshtastic --host $command" + output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save LoRa settings'" | tee /dev/tty) + exit_status=$? + set +o pipefail + if [ $exit_status -eq 1 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$output")" 0 0 + elif [ $exit_status -eq 0 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0 + fi + fi done From ef7a938f7696f7e7556f5a231d09eb381d0ea87a Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 15:04:05 +0200 Subject: [PATCH 088/149] Fix compatibility with install wizard --- .../bin/femto-meshtasticd-lora-dialogs.sh | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index c7e80e9..0d3d803 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -9,11 +9,25 @@ export NCURSES_NO_UTF8_ACS=1 export TERM=xterm-256color export LANG=C.UTF-8 +title="Meshtastic LoRa Settings" args=$@ +send_settings() { + if [ -n "$command" ]; then + set -o pipefail + echo "meshtastic --host $command" + output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save LoRa settings'" | tee /dev/tty) + exit_status=$? + set +o pipefail + if [ $exit_status -eq 1 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$output")" 0 0 + elif [ $exit_status -eq 0 ]; then + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0 + fi + fi +} + config_url() { - echo "argument $1" - echo "args $args" femto-config -c && ( newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 11 63 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered @@ -21,7 +35,7 @@ config_url() { fi # if we're in wizard mode AND there are no script arguments, then display a message [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 - return + send_settings ) } @@ -89,7 +103,6 @@ set_lora_radio() { lora_settings_actions() { if femto-config -c; then - local title="Meshtastic LoRa Settings" if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then set_lora_radio @@ -386,6 +399,8 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) # if we're in wizard mode AND there are no script arguments, then display a message [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 + send_settings + [ "$1" = "wizard" ] && return # quit function if wizard fi } @@ -395,7 +410,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) help="If script is run without arguments, menu will load.\n\ Options are:\n\ -h This message\n\ --w Wizard mode\ +-w Wizard mode (skips main menu)\ " while getopts ":hw" opt; do case ${opt} in @@ -499,18 +514,5 @@ while true; do ;; 20) break ;; esac - - if [ -n "$command" ]; then - set -o pipefail - echo "meshtastic --host $command" - output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save LoRa settings'" | tee /dev/tty) - exit_status=$? - set +o pipefail - if [ $exit_status -eq 1 ]; then - dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z1Command FAILED!\Zn\n\nLog:\n$output")" 0 0 - elif [ $exit_status -eq 0 ]; then - dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0 - fi - fi done From 0d71573975de19c5043b9e92d0865213cf7ac20b Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 17:38:03 +0200 Subject: [PATCH 089/149] Continued work on lora settings menu --- .../usr/local/bin/femto-config | 2 +- .../usr/local/bin/femto-license.sh | 9 +- .../usr/local/bin/femto-meshtasticd-config.sh | 172 +----------------- .../bin/femto-meshtasticd-lora-dialogs.sh | 9 +- 4 files changed, 18 insertions(+), 174 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 3a87175..7bdf98c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -614,7 +614,7 @@ help_menu() { local title="Help / About" help_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$help_choice" --item-help --menu "$title" 0 0 7 \ 1 "About Femtofox" "" \ - 2 "Display pinout" "" \ + 2 "View pinout" "" \ 3 "Femtofox licensing info - short" "" \ 4 "Femtofox licensing info - long" "" \ 5 "Meshtastic licensing info" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh index b0ed139..0490eb6 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-license.sh @@ -27,7 +27,14 @@ View the long licenses for more information.\n\ Contact us to license Femtofox." meshtastic_license="\ -Meshtastic is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk." +The Meshtastic firmware is licensed GPL3.\n\ +\n\ +Meshtastic is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.\n\ +\n\ +Some of the verbiage in the help-texts in the menus is sourced from the Meshtastic website, also licensed GPL3.\n\ +\n\ +For more information about Meshtastic, visit https://www.meshtastic.org\ +" luckfox_license="Luckfox and Luckfox Pico Mini are property of Luckfox Technology. Femtofox does not represent Luckfox Technology in any way, shape or form. Visit their website at https://www.luckfox.com/." diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index baf5b10..f5caf35 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -30,23 +30,6 @@ Options are: -x Uninstall Meshtasticd -m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m '--set security.admin_channel_enabled false' 10 'Disable legacy admin'\` Will retry the \`--set security.admin_channel_enabled false\` command until successful or up to 10 times, and tag status reports with \`Disable legacy admin\` via echo and to system log. -Meshtastic LoRa settings: --e "value" Region (frequency plan). Options are: UNSET, US, EU_433, EU_868, CN, JP, ANZ, KR, TW, RU ,IN, NZ_865, TH, LORA_24, UA_433, UA_868, MY_433, MY_919, SG_923 --P "true" Use modem preset (true, false) --E "value" Preset. Options are: LONG_FAST, LONG_SLOW, VERY_LONG_SLOW, MEDIUM_SLOW, MEDIUM_FAST, SHORT_SLOW, SHORT_FAST, SHORT_TURBO --b "value" Bandwidth (only used if modem preset is disabled) --f "value" Spread Factor (only used if modem preset is disabled) --C "value" Coding rate (only used if modem preset is disabled) --O "value" Frequency offset (MHz) --H "value" Hop limit (0-7) --T "true" TX enabled (true/false) --X "value" TX power (dBm) --F "value" Frequency slot --V "false" Override duty cycle (true/false) --B "true" SX126X RX boosted gain (true/false) --v "value" Override frequency (MHz) (overrides frequency slot) --G "false" Ignore MQTT (true/false) --K "false" OK to MQTT (true/false) EOF ) @@ -94,7 +77,7 @@ meshtastic_update() { } # Parse options -while getopts ":higkl:q:uU:rR:aA:cpo:sM:StwuxmP:E:b:f:C:O:e:H:T:X:F:V:B:v:G:K:" opt; do +while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -256,159 +239,14 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:StwuxmP:E:b:f:C:O:e:H:T:X:F:V:B:v:G:K:" x) # Option -x (uninstall meshtasticd) apt remove meshtasticd ;; - m) + m) # Option -m (manual meshtastic command) external="true" # set a variable so the function knows it was called by an an external script and not locally meshtastic_update "$2" $3 "$4" ;; - e) # Option -e (Set region/frequency plan) - regions="UNSET US EU_433 EU_868 CN JP ANZ KR TW RU IN NZ_865 TH LORA_24 UA_433 UA_868 MY_433 MY_919 SG_923" - if [[ ! " $regions " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $regions." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.region $OPTARG" 3 "Set region" - fi + \?) # Invalid option) + echo -e "Unknown argument $1.\n$help" ;; - P) # Option -P (Use modem preset: enable/disable) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.use_preset $OPTARG" 3 "Set use_preset" - fi - ;; - E) # Option -E (Preset. Options are: LONG_FAST, LONG_SLOW, VERY_LONG_SLOW, MEDIUM_SLOW, MEDIUM_FAST, SHORT_SLOW, SHORT_FAST, SHORT_TURBO) - presets="LONG_FAST LONG_SLOW VERY_LONG_SLOW MEDIUM_SLOW MEDIUM_FAST SHORT_SLOW SHORT_FAST SHORT_TURBO" - if [[ ! " $presets " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $presets." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.modem_preset $OPTARG" 3 "Set modem_preset" - fi - ;; - b) # Option -b (Set bandwidth; used if modem preset is disabled) - options="31 62 125 250 500" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.bandwidth $OPTARG" 3 "Set bandwidth" - fi - ;; - f) # Option -f (Set spread factor; used if modem preset is disabled) - options="7 8 9 10 11 12" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.spread_factor $OPTARG" 3 "Set spread_factor" - fi - ;; - C) # Option -C (Set coding rate; used if modem preset is disabled) - options="5 6 7 8" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.coding_rate $OPTARG" 3 "Set coding_rate" - fi - ;; - O) # Option -O (Set frequency offset in MHz) - if ! [[ "$OPTARG" =~ ^[0-1000000]$ ]]; then - echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 1000000." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.frequency_offset $OPTARG" 3 "Set frequency_offset" - fi - ;; - H) # Option -H (Set hop limit, range 0-7) - if ! [[ "$OPTARG" =~ ^[0-7]$ ]]; then - echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 7." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.hop_limit $OPTARG" 3 "Set hop limit" - fi - ;; - T) # Option -T (Enable/disable TX) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.tx_enabled $OPTARG" 3 "Set hop limit" - fi - ;; - X) # Option -X (Set TX power in dBm) - if ! [[ "$OPTARG" =~ ^([0-9]|1[0-9]|2[0-9]|30)$ ]]; then - echo "Error: Invalid option '$OPTARG'. Must be a number between 0 and 30." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.tx_power $OPTARG" 3 "Set tx_power" - fi - ;; - F) # Option -F (Set frequency slot) - meshtastic_update "--set lora.channel_num $OPTARG" 3 "Set frequency slot" - ;; - V) # Option -V (Enable/disable override duty cycle) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.override_duty_cycle $OPTARG" 3 "Set override_duty_cycle" - fi - ;; - B) # Option -B (Enable/disable SX126X RX boosted gain) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.sx126x_rx_boosted_gain $OPTARG" 3 "Set sx126x_rx_boosted_gain" - fi - ;; - v) # Option -v (Override frequency in MHz; overrides frequency slot) - meshtastic_update "--set lora.override_frequency $OPTARG" 3 "Set override_frequency" - ;; - G) # Option -G (enable/disable ignore MQTT) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.ignore_mqtt $OPTARG" 3 "Set ignore_mqtt" - fi - ;; - K) # Option -K (enable/disable OK to MQTT) - options="true false" - if [[ ! " $options " =~ " $OPTARG " ]]; then - echo "Error: Invalid option '$OPTARG'. Must be one of $options." >&2 - echo -e "$help" - exit 1 - else - meshtastic_update "--set lora.config_ok_to_mqtt $OPTARG" 3 "Set config_ok_to_mqtt" - fi - ;; - \?) # Invalid option - echo "Invalid option: -$OPTARG" - echo -e "$help" - exit 1 - ;; - :) # Missing argument for option + :) # Missing argument for option) echo "Option -$OPTARG requires a setting." echo -e "$help" exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 0d3d803..556c10a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -25,6 +25,7 @@ send_settings() { dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0 fi fi + [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 # if in wizard mode AND there are no script arguments, display the message } config_url() { @@ -34,8 +35,7 @@ config_url() { command+="--seturl $newurl " fi # if we're in wizard mode AND there are no script arguments, then display a message - [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 - send_settings + send_settings $1 ) } @@ -103,7 +103,6 @@ set_lora_radio() { lora_settings_actions() { if femto-config -c; then - if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then set_lora_radio [ "$1" != "wizard" ] && return @@ -399,7 +398,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) # if we're in wizard mode AND there are no script arguments, then display a message [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 - send_settings + send_settings $1 [ "$1" = "wizard" ] && return # quit function if wizard fi @@ -431,7 +430,7 @@ command="" # initialize command LoRa_menu_choice="" # zero the choice before loading the submenu while true; do command="" # initialize command - LoRa_menu_choice=$(dialog --no-collapse --title "Meshtastic LoRa Settings" --default-item "$LoRa_menu_choice" --cancel-label "Back" --item-help --menu "LoRa settings can also be set automatically by entering a Meshtastic configuration URL." 30 50 20 \ + LoRa_menu_choice=$(dialog --no-collapse --title "Meshtastic LoRa Settings" --default-item "$LoRa_menu_choice" --cancel-label "Back" --item-help --menu "Select a LoRa setting or run the wizard" 30 50 20 \ 1 "Wizard (set all)" "" \ 2 "Set LoRa radio model" "" \ 3 "Configure automatically with URL" "" \ From 5db521a4091e33619788c584743aee857a2ededd Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 16 Feb 2025 23:19:18 +0200 Subject: [PATCH 090/149] Update femto-meshtasticd-lora-dialogs.sh --- .../bin/femto-meshtasticd-lora-dialogs.sh | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 556c10a..5f8029e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -45,7 +45,7 @@ set_lora_radio() { while true; do echo "Checking LoRa radio..." #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "Cancel" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ "Radio name:" "Configuration:" "" \ "" "" "" \ "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ @@ -58,7 +58,7 @@ set_lora_radio() { "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ "Simulated radio" "(none)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog local radio="" case $choice in @@ -104,19 +104,19 @@ set_lora_radio() { lora_settings_actions() { if femto-config -c; then if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then - set_lora_radio + set_lora_radio $1 [ "$1" != "wizard" ] && return fi if [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ "Automatic configuration with URL" "" "" \ "Manual configuration" "" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] || [ "$choice" == "Skip" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made [ "$choice" == "Manual configuration" ] && break [ "$choice" == "Automatic configuration with URL" ] && config_url "$1" @@ -135,11 +135,11 @@ lora_settings_actions() { menu_items+=("${options[$i]}" "" "") # Other items without "(default)" fi done - menu_items+=("" "" "" "Cancel" "" "") + menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "Sets the region for your node. Default is unset. As long as this is not set, the node screen will display a message and not transmit any packets.\n\nRegion (default: UNSET)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "LONG_FAST" --item-help --menu "Sets the region for your node. Default is unset. As long as this is not set, the node screen will display a message and not transmit any packets.\n\nRegion (default: UNSET)?" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.region $choice " break @@ -150,12 +150,12 @@ lora_settings_actions() { if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made using_preset=$choice command+="--set lora.use_preset $(echo "$choice" | tr '[:upper:]' '[:lower:]') " @@ -178,11 +178,11 @@ lora_settings_actions() { menu_items+=("${options[$i]}" "" "") # Other items without "(default)" fi done - menu_items+=("" "" "" "Cancel" "" "") + menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "LONG_FAST" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "LONG_FAST" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset?" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.modem_preset $choice " break @@ -196,15 +196,15 @@ lora_settings_actions() { else if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 250 --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 250 --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth?" 0 0 0 \ 31 "" "" \ 62 "" "" \ 125 "" "" \ 250 "(default)" "" \ 500 "" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.bandwidth $choice " break @@ -214,7 +214,7 @@ lora_settings_actions() { if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 12 --menu "Indicates the number of chirps per symbol.\n\nSpread factor (only used if modem preset is disabled)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 12 --menu "Indicates the number of chirps per symbol.\n\nSpread factor (only used if modem preset is disabled)?" 0 0 0 \ 7 "" "" \ 8 "" "" \ 9 "" "" \ @@ -222,8 +222,8 @@ lora_settings_actions() { 11 "" "" \ 12 "(default)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.spread_factor $choice " break @@ -233,14 +233,14 @@ lora_settings_actions() { if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --item-help --default-item 8 --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 8 --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)?" 0 0 0 \ 5 "" "" \ 6 "" "" \ 7 "" "" \ 8 "(default)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.coding_rate $choice " break @@ -251,7 +251,7 @@ lora_settings_actions() { if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^([0-9]{1,6})(\.[0-9]+)?$ && $(echo "$input <= 1000000" | bc -l) -eq 1) ]] && break # exit loop if user input a number between 0 and 1000000. Decimals allowed dialog --no-collapse --title "$title" --msgbox "Must be between 0-1000000. Decimals allowed." 6 50 done @@ -263,7 +263,7 @@ lora_settings_actions() { if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-7]$) ]] && break # exit loop if user input an integer between 0 and 7 dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 7." 6 50 done @@ -276,12 +276,12 @@ lora_settings_actions() { if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made command+="--set lora.tx_enabled $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break @@ -291,7 +291,7 @@ lora_settings_actions() { if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --colors --title "$title" --cancel-label "Cancel" --inputbox "\ + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "\ \Z1\ZuWARNING!\Zn\n\ Setting a 33db radio above 8db will \Zupermanently\Zn damage it.\n\ ERP above 27db violates EU law.\n\ @@ -312,7 +312,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+$) ]] && break # exit loop if user input an integer 0 or higher dialog --no-collapse --title "$title" --msgbox "Must be an integer 0 or higher." 6 50 done @@ -324,12 +324,12 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made command+="--set lora.override_duty_cycle $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break @@ -339,12 +339,12 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain?" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made command+="--set lora.sx126x_rx_boosted_gain $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break @@ -354,7 +354,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+(\.[0-9]+)?$) ]] && break # exit loop if user input a number 0 or higher (decimals allowed) dialog --no-collapse --title "$title" --msgbox "Must be a number 0 or higher. Decimals allowed." 6 53 done @@ -367,12 +367,12 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made command+="--set lora.ignore_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break @@ -382,12 +382,12 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "False" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT?" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ - "Cancel" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made command+="--set lora.config_ok_to_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break From 793aa33869a516ad7adb41cec1fa9fed91507692 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 12:48:04 +0200 Subject: [PATCH 091/149] Enable Meshtastic webserver on port 443 --- ...mto_mac_address.yaml => femto_config.yaml} | 9 +- .../share/doc/meshtasticd/web/Logo_Black.svg | 12 - .../share/doc/meshtasticd/web/Logo_White.svg | 12 - .../doc/meshtasticd/web/apple-touch-icon.png | Bin 3213 -> 0 bytes .../usr/share/doc/meshtasticd/web/favicon.ico | Bin 15086 -> 0 bytes .../usr/share/doc/meshtasticd/web/icon.svg | 16 - .../doc/meshtasticd/web/index-b9vwykds.js | 441 ---- .../doc/meshtasticd/web/index-wV0rbIjU.css | 1 - .../usr/share/doc/meshtasticd/web/index.html | 30 - .../doc/meshtasticd/web/mapbox-gl-DY02hNYD.js | 2258 ----------------- .../meshtasticd/web/maplibre-gl-H6mDd47p.js | 580 ----- .../usr/share/doc/meshtasticd/web/robots.txt | 2 - .../doc/meshtasticd/web/site.webmanifest | 16 - 13 files changed, 8 insertions(+), 3369 deletions(-) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/{femto_mac_address.yaml => femto_config.yaml} (50%) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml similarity index 50% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml index b1f2e8a..a561d91 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml @@ -1,4 +1,11 @@ # this sets the mac address source to eth0, replacing the previous code that derived a seed from the CPU s/n. # of course, eth0 also has its mac address derived from CPU s/n, but this way meshtastic uses the exact mac address, instead of a bastardized version converted to a 9 digit int with `| bc | tail -c -9`. General: - MACAddressSource: eth0 \ No newline at end of file + MACAddressSource: eth0 + +# this activates the webserver +Webserver: + Port: 443 # Port for Webserver & Webservices + RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer + SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if> + SSLCert: /etc/meshtasticd/ssl/certificate.pem # Pa diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg deleted file mode 100644 index e0f9bb1..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg deleted file mode 100644 index b1bcd57..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png deleted file mode 100644 index 31e2210eee3d970514ebbb090e776be91fcc68bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3213 zcmZu!c{CJU8*(6i;J_RIQYPH$^yVnxH70#( zE$hXSFu)`i)I3rFo@+hi+*qzZV}SxRwqNaE^bad&U~b~^{Ly=FeW zE%n&|Bz8AE%GuEm$h zdHhf)DkM_zowDLa#6n8_j+6Ixr-}5)@DN4Lt77xK=f*eEV?T=#OURppBastddX7}D ztMSBT=BXxjttF)@RLIn@w}`pYOI`j$KlWVqXr+(C}z;4$(_^k@~oouPK_f+fGecDeS=w!i?@XstHBz(K{DBcgf z9zvn$LSHO)zy#^5MwW6Euukl@9^5OYx94MuTmw~(&kDn9GzB+1#Uj>j(w37B;= z9!6Il7~*V>*J`bYEL3)6r$4r`m5Vyr<++mCxlLw+Wy& zxlpHrpyD)?!lOYElja8GGkEGwYn-0far;OI-u#@I=BR7+`at)4_BY>-`;ni3w{EC` z^a=I^MkEX>gE4T3_+Go^uPa4L|AKoAKMMduqNow`Vp$ zrhU&d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+AOUQUSeewUh|09C7;y2F02=YGx-fMtJy$AAJ?{eS+z%!r1 zbj`D}IO`jz5ZB?%)#tZfiTU+s{>452N9IG|eENd4`MtyMO}GDbp)Z<&LqI6!1;24V z1^BJ!b=HLQgMpnmN$9|-LX$daFzs=^{*p%rcy)p&dGnlt#}YAs=bWM+ZX7?z-5;n2 zjswAtRsLVmd|&`j2b@bzKmW&yG(HD{|y6^yCz@0gD=Fl1%1JHAm$M=|H*DMCvWGy@*nA1dU;A4FRPFHIj`<#r{UX| z - - -Created with Fabric.js 4.6.0 - - - - - - - - - - - - \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js deleted file mode 100644 index 4925735..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js +++ /dev/null @@ -1,441 +0,0 @@ -function lE(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var _t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D1={exports:{}},Tu={},L1={exports:{}},Me={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Zs=Symbol.for("react.element"),cE=Symbol.for("react.portal"),uE=Symbol.for("react.fragment"),dE=Symbol.for("react.strict_mode"),fE=Symbol.for("react.profiler"),pE=Symbol.for("react.provider"),mE=Symbol.for("react.context"),hE=Symbol.for("react.forward_ref"),gE=Symbol.for("react.suspense"),vE=Symbol.for("react.memo"),yE=Symbol.for("react.lazy"),Ng=Symbol.iterator;function bE(e){return e===null||typeof e!="object"?null:(e=Ng&&e[Ng]||e["@@iterator"],typeof e=="function"?e:null)}var j1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F1=Object.assign,B1={};function Mi(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}Mi.prototype.isReactComponent={};Mi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $1(){}$1.prototype=Mi.prototype;function Mp(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}var Ap=Mp.prototype=new $1;Ap.constructor=Mp;F1(Ap,Mi.prototype);Ap.isPureReactComponent=!0;var Pg=Array.isArray,U1=Object.prototype.hasOwnProperty,Rp={current:null},V1={key:!0,ref:!0,__self:!0,__source:!0};function z1(e,t,n){var r,o={},a=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)U1.call(t,r)&&!V1.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Eu(e){const t=e[De];return t?t.type_:Array.isArray(e)?1:Nu(e)?2:Pu(e)?3:0}function Uf(e,t){return Eu(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function X1(e,t,n){const r=Eu(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function AE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Nu(e){return e instanceof Map}function Pu(e){return e instanceof Set}function ht(e){return e.copy_||e.base_}function Vf(e,t){if(Nu(e))return new Map(e);if(Pu(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=q1(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[De];let o=Reflect.ownKeys(r);for(let a=0;a1&&(e.set=e.add=e.clear=e.delete=RE),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Op(r,!0))),e}function RE(){vn(2)}function Mu(e){return Object.isFrozen(e)}var zf={};function qo(e){const t=zf[e];return t||vn(0,e),t}function IE(e,t){zf[e]||(zf[e]=t)}var ks;function Rc(){return ks}function OE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rg(e,t){t&&(qo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hf(e){Wf(e),e.drafts_.forEach(DE),e.drafts_=null}function Wf(e){e===ks&&(ks=e.parent_)}function Ig(e){return ks=OE(ks,e)}function DE(e){const t=e[De];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Og(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[De].modified_&&(Hf(t),vn(4)),_r(e)&&(e=Ic(t,e),t.parent_||Oc(t,e)),t.patches_&&qo("Patches").generateReplacementPatches_(n[De].base_,e,t.patches_,t.inversePatches_)):e=Ic(t,n,[]),Hf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==K1?e:void 0}function Ic(e,t,n){if(Mu(t))return t;const r=t[De];if(!r)return xs(t,(o,a)=>Dg(e,r,t,o,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Oc(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let a=o,i=!1;r.type_===3&&(a=new Set(o),o.clear(),i=!0),xs(a,(s,l)=>Dg(e,r,o,s,l,n,i)),Oc(e,o,!1),n&&e.patches_&&qo("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Dg(e,t,n,r,o,a,i){if(gi(o)){const s=a&&t&&t.type_!==3&&!Uf(t.assigned_,r)?a.concat(r):void 0,l=Ic(e,o,s);if(X1(n,r,l),gi(l))e.canAutoFreeze_=!1;else return}else i&&n.add(o);if(_r(o)&&!Mu(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ic(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Oc(e,o)}}function Oc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Op(t,n)}function LE(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Rc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,a=Dp;n&&(o=[r],a=Cs);const{revoke:i,proxy:s}=Proxy.revocable(o,a);return r.draft_=s,r.revoke_=i,s}var Dp={get(e,t){if(t===De)return e;const n=ht(e);if(!Uf(n,t))return jE(e,n,t);const r=n[t];return e.finalized_||!_r(r)?r:r===Md(e.base_,t)?(Ad(e),e.copy_[t]=Ss(r,e)):r},has(e,t){return t in ht(e)},ownKeys(e){return Reflect.ownKeys(ht(e))},set(e,t,n){const r=Y1(ht(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Md(ht(e),t),a=o?.[De];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(AE(n,o)&&(n!==void 0||Uf(e.base_,t)))return!0;Ad(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Md(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ad(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ht(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){vn(11)},getPrototypeOf(e){return hi(e.base_)},setPrototypeOf(){vn(12)}},Cs={};xs(Dp,(e,t)=>{Cs[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cs.deleteProperty=function(e,t){return Cs.set.call(this,e,t,void 0)};Cs.set=function(e,t,n){return Dp.set.call(this,e[0],t,n,e[0])};function Md(e,t){const n=e[De];return(n?ht(n):e)[t]}function jE(e,t,n){const r=Y1(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function Y1(e,t){if(!(t in e))return;let n=hi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=hi(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function Ad(e){e.copy_||(e.copy_=Vf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var FE=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const i=this;return function(l=a,...c){return i.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&vn(6),r!==void 0&&typeof r!="function"&&vn(7);let o;if(_r(t)){const a=Ig(this),i=Ss(t,void 0);let s=!0;try{o=n(i),s=!1}finally{s?Hf(a):Wf(a)}return Rg(a,r),Og(o,a)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===K1&&(o=void 0),this.autoFreeze_&&Op(o,!0),r){const a=[],i=[];qo("Patches").generateReplacementPatches_(t,o,a,i),r(a,i)}return o}else vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...s)=>this.produceWithPatches(i,l=>t(l,...s));let r,o;return[this.produce(t,n,(i,s)=>{r=i,o=s}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_r(e)||vn(8),gi(e)&&(e=BE(e));const t=Ig(this),n=Ss(e,void 0);return n[De].isManual_=!0,Wf(t),n}finishDraft(e,t){const n=e&&e[De];(!n||!n.isManual_)&&vn(9);const{scope_:r}=n;return Rg(r,t),Og(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=qo("Patches").applyPatches_;return gi(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ss(e,t){const n=Nu(e)?qo("MapSet").proxyMap_(e,t):Pu(e)?qo("MapSet").proxySet_(e,t):LE(e,t);return(t?t.scope_:Rc()).drafts_.push(n),n}function BE(e){return gi(e)||vn(10,e),Q1(e)}function Q1(e){if(!_r(e)||Mu(e))return e;const t=e[De];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vf(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vf(e,!0);return xs(n,(r,o)=>{X1(n,r,Q1(o))}),t&&(t.finalized_=!1),n}function $E(){class e extends Map{constructor(l,c){super(),this[De]={type_:2,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return ht(this[De]).size}has(l){return ht(this[De]).has(l)}set(l,c){const u=this[De];return i(u),(!ht(u).has(l)||ht(u).get(l)!==c)&&(n(u),mr(u),u.assigned_.set(l,!0),u.copy_.set(l,c),u.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),n(c),mr(c),c.base_.has(l)?c.assigned_.set(l,!1):c.assigned_.delete(l),c.copy_.delete(l),!0}clear(){const l=this[De];i(l),ht(l).size&&(n(l),mr(l),l.assigned_=new Map,xs(l.base_,c=>{l.assigned_.set(c,!1)}),l.copy_.clear())}forEach(l,c){const u=this[De];ht(u).forEach((d,p,g)=>{l.call(c,this.get(p),p,this)})}get(l){const c=this[De];i(c);const u=ht(c).get(l);if(c.finalized_||!_r(u)||u!==c.base_.get(l))return u;const d=Ss(u,c);return n(c),c.copy_.set(l,d),d}keys(){return ht(this[De]).keys()}values(){const l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{const c=l.next();return c.done?c:{done:!1,value:this.get(c.value)}}}}entries(){const l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{const c=l.next();if(c.done)return c;const u=this.get(c.value);return{done:!1,value:[c.value,u]}}}}[Symbol.iterator](){return this.entries()}}function t(s,l){return new e(s,l)}function n(s){s.copy_||(s.assigned_=new Map,s.copy_=new Map(s.base_))}class r extends Set{constructor(l,c){super(),this[De]={type_:3,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return ht(this[De]).size}has(l){const c=this[De];return i(c),c.copy_?!!(c.copy_.has(l)||c.drafts_.has(l)&&c.copy_.has(c.drafts_.get(l))):c.base_.has(l)}add(l){const c=this[De];return i(c),this.has(l)||(a(c),mr(c),c.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),a(c),mr(c),c.copy_.delete(l)||(c.drafts_.has(l)?c.copy_.delete(c.drafts_.get(l)):!1)}clear(){const l=this[De];i(l),ht(l).size&&(a(l),mr(l),l.copy_.clear())}values(){const l=this[De];return i(l),a(l),l.copy_.values()}entries(){const l=this[De];return i(l),a(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,c){const u=this.values();let d=u.next();for(;!d.done;)l.call(c,d.value,d.value,this),d=u.next()}}function o(s,l){return new r(s,l)}function a(s){s.copy_||(s.copy_=new Set,s.base_.forEach(l=>{if(_r(l)){const c=Ss(l,s);s.drafts_.set(l,c),s.copy_.add(c)}else s.copy_.add(l)}))}function i(s){s.revoked_&&vn(3,JSON.stringify(ht(s)))}IE("MapSet",{proxyMap_:t,proxySet_:o})}var tn=new FE,Ie=tn.produce;tn.produceWithPatches.bind(tn);tn.setAutoFreeze.bind(tn);tn.setUseStrictShallowCopy.bind(tn);tn.applyPatches.bind(tn);tn.createDraft.bind(tn);tn.finishDraft.bind(tn);var Z1={exports:{}},rn={},J1={exports:{}},eb={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(e){function t(K,Z){var re=K.length;K.push(Z);e:for(;0>>1,U=K[fe];if(0>>1;feo(S,re))Xo(H,S)?(K[fe]=H,K[X]=re,fe=X):(K[fe]=S,K[se]=re,fe=se);else if(Xo(H,re))K[fe]=H,K[X]=re,fe=X;else break e}}return Z}function o(K,Z){var re=K.sortIndex-Z.sortIndex;return re!==0?re:K.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,p=3,g=!1,v=!1,h=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(K){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=K)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function E(K){if(h=!1,x(K),!v)if(n(l)!==null)v=!0,G(w);else{var Z=n(c);Z!==null&&Y(E,Z.startTime-K)}}function w(K,Z){v=!1,h&&(h=!1,b(C),C=-1),g=!0;var re=p;try{for(x(Z),d=n(l);d!==null&&(!(d.expirationTime>Z)||K&&!R());){var fe=d.callback;if(typeof fe=="function"){d.callback=null,p=d.priorityLevel;var U=fe(d.expirationTime<=Z);Z=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),x(Z)}else r(l);d=n(l)}if(d!==null)var ae=!0;else{var se=n(c);se!==null&&Y(E,se.startTime-Z),ae=!1}return ae}finally{d=null,p=re,g=!1}}var T=!1,k=null,C=-1,P=5,O=-1;function R(){return!(e.unstable_now()-OK||125fe?(K.sortIndex=re,t(c,K),n(l)===null&&K===n(c)&&(h?(b(C),C=-1):h=!0,Y(E,re-fe))):(K.sortIndex=U,t(l,K),v||g||(v=!0,G(w))),K},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(K){var Z=p;return function(){var re=p;p=Z;try{return K.apply(this,arguments)}finally{p=re}}}})(eb);J1.exports=eb;var UE=J1.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var VE=m,nn=UE;function ie(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gf=Object.prototype.hasOwnProperty,zE=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Lg={},jg={};function HE(e){return Gf.call(jg,e)?!0:Gf.call(Lg,e)?!1:zE.test(e)?jg[e]=!0:(Lg[e]=!0,!1)}function WE(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function GE(e,t,n,r){if(t===null||typeof t>"u"||WE(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function jt(e,t,n,r,o,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var kt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kt[e]=new jt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kt[t]=new jt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kt[e]=new jt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kt[e]=new jt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){kt[e]=new jt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kt[e]=new jt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kt[e]=new jt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kt[e]=new jt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kt[e]=new jt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lp=/[\-:]([a-z])/g;function jp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kt[e]=new jt(e,1,!1,e.toLowerCase(),null,!1,!1)});kt.xlinkHref=new jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kt[e]=new jt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Fp(e,t,n,r){var o=kt.hasOwnProperty(t)?kt[t]:null;(o!==null?o.type!==0:r||!(2s||o[i]!==a[s]){var l=` -`+o[i].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=s);break}}}finally{Id=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ns(e):""}function KE(e){switch(e.tag){case 5:return ns(e.type);case 16:return ns("Lazy");case 13:return ns("Suspense");case 19:return ns("SuspenseList");case 0:case 2:case 15:return e=Od(e.type,!1),e;case 11:return e=Od(e.type.render,!1),e;case 1:return e=Od(e.type,!0),e;default:return""}}function Yf(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wa:return"Fragment";case Ha:return"Portal";case Kf:return"Profiler";case Bp:return"StrictMode";case qf:return"Suspense";case Xf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rb:return(e.displayName||"Context")+".Consumer";case nb:return(e._context.displayName||"Context")+".Provider";case $p:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Up:return t=e.displayName||null,t!==null?t:Yf(e.type)||"Memo";case Xr:t=e._payload,e=e._init;try{return Yf(e(t))}catch{}}return null}function qE(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yf(t);case 8:return t===Bp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function po(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ab(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function XE(e){var t=ab(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ml(e){e._valueTracker||(e._valueTracker=XE(e))}function ib(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ab(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qf(e,t){var n=t.checked;return Qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Bg(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=po(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function sb(e,t){t=t.checked,t!=null&&Fp(e,"checked",t,!1)}function Zf(e,t){sb(e,t);var n=po(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Jf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Jf(e,t.type,po(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $g(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Jf(e,t,n){(t!=="number"||Dc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var rs=Array.isArray;function ii(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Al.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Es(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ss={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},YE=["Webkit","ms","Moz","O"];Object.keys(ss).forEach(function(e){YE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ss[t]=ss[e]})});function db(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ss.hasOwnProperty(e)&&ss[e]?(""+t).trim():t+"px"}function fb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=db(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var QE=Qe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function n0(e,t){if(t){if(QE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ie(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ie(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ie(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ie(62))}}function r0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var o0=null;function Vp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a0=null,si=null,li=null;function zg(e){if(e=tl(e)){if(typeof a0!="function")throw Error(ie(280));var t=e.stateNode;t&&(t=Du(t),a0(e.stateNode,e.type,t))}}function pb(e){si?li?li.push(e):li=[e]:si=e}function mb(){if(si){var e=si,t=li;if(li=si=null,zg(e),t)for(e=0;e>>=0,e===0?32:31-(l9(e)/c9|0)|0}var Rl=64,Il=4194304;function os(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=n&268435455;if(i!==0){var s=i&~o;s!==0?r=os(s):(a&=i,a!==0&&(r=os(a)))}else i=n&~o,i!==0?r=os(i):a!==0&&(r=os(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,a=t&-t,o>=a||o===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Js(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-On(t),e[t]=n}function p9(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=cs),Zg=" ",Jg=!1;function Ob(e,t){switch(e){case"keyup":return U9.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Db(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function z9(e,t){switch(e){case"compositionend":return Db(t);case"keypress":return t.which!==32?null:(Jg=!0,Zg);case"textInput":return e=t.data,e===Zg&&Jg?null:e;default:return null}}function H9(e,t){if(Ga)return e==="compositionend"||!Yp&&Ob(e,t)?(e=Rb(),dc=Kp=eo=null,Ga=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rv(n)}}function Bb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $b(){for(var e=window,t=Dc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dc(e.document)}return t}function Qp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function J9(e){var t=$b(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bb(n.ownerDocument.documentElement,n)){if(r!==null&&Qp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=r.end===void 0?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=ov(n,a);var i=ov(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ka=null,d0=null,ds=null,f0=!1;function av(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;f0||Ka==null||Ka!==Dc(r)||(r=Ka,"selectionStart"in r&&Qp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ds&&Is(ds,r)||(ds=r,r=Vc(d0,"onSelect"),0Ya||(e.current=y0[Ya],y0[Ya]=null,Ya--)}function Be(e,t){Ya++,y0[Ya]=e.current,e.current=t}var mo={},Pt=xo(mo),Vt=xo(!1),Xo=mo;function yi(e,t){var n=e.type.contextTypes;if(!n)return mo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},a;for(a in n)o[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function zt(e){return e=e.childContextTypes,e!=null}function Hc(){He(Vt),He(Pt)}function fv(e,t,n){if(Pt.current!==mo)throw Error(ie(168));Be(Pt,t),Be(Vt,n)}function Xb(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ie(108,qE(e)||"Unknown",o));return Qe({},n,r)}function Wc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mo,Xo=Pt.current,Be(Pt,e),Be(Vt,Vt.current),!0}function pv(e,t,n){var r=e.stateNode;if(!r)throw Error(ie(169));n?(e=Xb(e,t,Xo),r.__reactInternalMemoizedMergedChildContext=e,He(Vt),He(Pt),Be(Pt,e)):He(Vt),Be(Vt,n)}var hr=null,Lu=!1,qd=!1;function Yb(e){hr===null?hr=[e]:hr.push(e)}function d8(e){Lu=!0,Yb(e)}function ko(){if(!qd&&hr!==null){qd=!0;var e=0,t=Le;try{var n=hr;for(Le=1;e>=i,o-=i,yr=1<<32-On(t)+o|n<C?(P=k,k=null):P=k.sibling;var O=p(b,k,x[C],E);if(O===null){k===null&&(k=P);break}e&&k&&O.alternate===null&&t(b,k),y=a(O,y,C),T===null?w=O:T.sibling=O,T=O,k=P}if(C===x.length)return n(b,k),We&&Io(b,C),w;if(k===null){for(;CC?(P=k,k=null):P=k.sibling;var R=p(b,k,O.value,E);if(R===null){k===null&&(k=P);break}e&&k&&R.alternate===null&&t(b,k),y=a(R,y,C),T===null?w=R:T.sibling=R,T=R,k=P}if(O.done)return n(b,k),We&&Io(b,C),w;if(k===null){for(;!O.done;C++,O=x.next())O=d(b,O.value,E),O!==null&&(y=a(O,y,C),T===null?w=O:T.sibling=O,T=O);return We&&Io(b,C),w}for(k=r(b,k);!O.done;C++,O=x.next())O=g(k,b,C,O.value,E),O!==null&&(e&&O.alternate!==null&&k.delete(O.key===null?C:O.key),y=a(O,y,C),T===null?w=O:T.sibling=O,T=O);return e&&k.forEach(function(N){return t(b,N)}),We&&Io(b,C),w}function _(b,y,x,E){if(typeof x=="object"&&x!==null&&x.type===Wa&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Pl:e:{for(var w=x.key,T=y;T!==null;){if(T.key===w){if(w=x.type,w===Wa){if(T.tag===7){n(b,T.sibling),y=o(T,x.props.children),y.return=b,b=y;break e}}else if(T.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Xr&&gv(w)===T.type){n(b,T.sibling),y=o(T,x.props),y.ref=qi(b,T,x),y.return=b,b=y;break e}n(b,T);break}else t(b,T);T=T.sibling}x.type===Wa?(y=Ho(x.props.children,b.mode,E,x.key),y.return=b,b=y):(E=bc(x.type,x.key,x.props,null,b.mode,E),E.ref=qi(b,y,x),E.return=b,b=E)}return i(b);case Ha:e:{for(T=x.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){n(b,y.sibling),y=o(y,x.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=nf(x,b.mode,E),y.return=b,b=y}return i(b);case Xr:return T=x._init,_(b,y,T(x._payload),E)}if(rs(x))return v(b,y,x,E);if(zi(x))return h(b,y,x,E);$l(b,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(n(b,y.sibling),y=o(y,x),y.return=b,b=y):(n(b,y),y=tf(x,b.mode,E),y.return=b,b=y),i(b)):n(b,y)}return _}var wi=ew(!0),tw=ew(!1),qc=xo(null),Xc=null,Ja=null,tm=null;function nm(){tm=Ja=Xc=null}function rm(e){var t=qc.current;He(qc),e._currentValue=t}function _0(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ui(e,t){Xc=e,tm=Ja=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ut=!0),e.firstContext=null)}function kn(e){var t=e._currentValue;if(tm!==e)if(e={context:e,memoizedValue:t,next:null},Ja===null){if(Xc===null)throw Error(ie(308));Ja=e,Xc.dependencies={lanes:0,firstContext:e}}else Ja=Ja.next=e;return t}var Fo=null;function om(e){Fo===null?Fo=[e]:Fo.push(e)}function nw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,om(t)):(n.next=o.next,o.next=n),t.interleaved=n,Cr(e,r)}function Cr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Yr=!1;function am(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Cr(e,n)}return o=r.interleaved,o===null?(t.next=t,om(r)):(t.next=o.next,o.next=t),r.interleaved=t,Cr(e,n)}function pc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hp(e,n)}}function vv(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?o=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Yc(e,t,n,r){var o=e.updateQueue;Yr=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var l=s,c=l.next;l.next=null,i===null?a=c:i.next=c,i=l;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==i&&(s===null?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(a!==null){var d=o.baseState;i=0,u=c=l=null,s=a;do{var p=s.lane,g=s.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:g,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var v=e,h=s;switch(p=t,g=n,h.tag){case 1:if(v=h.payload,typeof v=="function"){d=v.call(g,d,p);break e}d=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=h.payload,p=typeof v=="function"?v.call(g,d,p):v,p==null)break e;d=Qe({},d,p);break e;case 2:Yr=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[s]:p.push(s))}else g={eventTime:g,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(c=u=g,l=d):u=u.next=g,i|=p;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;p=s,s=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(u===null&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else a===null&&(o.shared.lanes=0);Zo|=i,e.lanes=i,e.memoizedState=d}}function yv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yd.transition;Yd.transition={};try{e(!1),t()}finally{Le=n,Yd.transition=r}}function ww(){return Cn().memoizedState}function h8(e,t,n){var r=co(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_w(e))xw(t,n);else if(n=nw(e,t,n,r),n!==null){var o=Ot();Dn(n,e,r,o),kw(n,t,r)}}function g8(e,t,n){var r=co(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_w(e))xw(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,s=a(i,n);if(o.hasEagerState=!0,o.eagerState=s,Ln(s,i)){var l=t.interleaved;l===null?(o.next=o,om(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=nw(e,t,o,r),n!==null&&(o=Ot(),Dn(n,e,r,o),kw(n,t,r))}}function _w(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function xw(e,t){fs=Zc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hp(e,n)}}var Jc={readContext:kn,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useInsertionEffect:St,useLayoutEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useMutableSource:St,useSyncExternalStore:St,useId:St,unstable_isNewReconciler:!1},v8={readContext:kn,useCallback:function(e,t){return Hn().memoizedState=[e,t===void 0?null:t],e},useContext:kn,useEffect:wv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,hc(4194308,4,hw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hc(4194308,4,e,t)},useInsertionEffect:function(e,t){return hc(4,2,e,t)},useMemo:function(e,t){var n=Hn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Hn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=h8.bind(null,Ye,e),[r.memoizedState,e]},useRef:function(e){var t=Hn();return e={current:e},t.memoizedState=e},useState:bv,useDebugValue:pm,useDeferredValue:function(e){return Hn().memoizedState=e},useTransition:function(){var e=bv(!1),t=e[0];return e=m8.bind(null,e[1]),Hn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ye,o=Hn();if(We){if(n===void 0)throw Error(ie(407));n=n()}else{if(n=t(),vt===null)throw Error(ie(349));Qo&30||sw(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,wv(cw.bind(null,r,a,e),[e]),r.flags|=2048,Us(9,lw.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Hn(),t=vt.identifierPrefix;if(We){var n=br,r=yr;n=(r&~(1<<32-On(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Bs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gn]=t,e[Ls]=r,Iw(e,t,!1,!1),t.stateNode=e;e:{switch(i=r0(n,r),n){case"dialog":ze("cancel",e),ze("close",e),o=r;break;case"iframe":case"object":case"embed":ze("load",e),o=r;break;case"video":case"audio":for(o=0;oki&&(t.flags|=128,r=!0,Xi(a,!1),t.lanes=4194304)}else{if(!r)if(e=Qc(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!We)return Tt(t),null}else 2*rt()-a.renderingStartTime>ki&&n!==1073741824&&(t.flags|=128,r=!0,Xi(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(n=a.last,n!==null?n.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=rt(),t.sibling=null,n=Xe.current,Be(Xe,r?n&1|2:n&1),t):(Tt(t),null);case 22:case 23:return bm(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xt&1073741824&&(Tt(t),t.subtreeFlags&6&&(t.flags|=8192)):Tt(t),null;case 24:return null;case 25:return null}throw Error(ie(156,t.tag))}function S8(e,t){switch(Jp(t),t.tag){case 1:return zt(t.type)&&Hc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _i(),He(Vt),He(Pt),lm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sm(t),null;case 13:if(He(Xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ie(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He(Xe),null;case 4:return _i(),null;case 10:return rm(t.type._context),null;case 22:case 23:return bm(),null;case 24:return null;default:return null}}var Vl=!1,Et=!1,T8=typeof WeakSet=="function"?WeakSet:Set,ge=null;function ei(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function M0(e,t,n){try{n()}catch(r){Je(e,t,r)}}var Av=!1;function E8(e,t){if(p0=$c,e=$b(),Qp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var i=0,s=-1,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var g;d!==n||o!==0&&d.nodeType!==3||(s=i+o),d!==a||r!==0&&d.nodeType!==3||(l=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(g=d.firstChild)!==null;)p=d,d=g;for(;;){if(d===e)break t;if(p===n&&++c===o&&(s=i),p===a&&++u===r&&(l=i),(g=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=g}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(m0={focusedElem:e,selectionRange:n},$c=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var h=v.memoizedProps,_=v.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?h:Mn(t.type,h),_);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ie(163))}}catch(E){Je(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return v=Av,Av=!1,v}function ps(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,a!==void 0&&M0(t,n,a)}o=o.next}while(o!==r)}}function Bu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function A0(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Lw(e){var t=e.alternate;t!==null&&(e.alternate=null,Lw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gn],delete t[Ls],delete t[v0],delete t[c8],delete t[u8])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function jw(e){return e.tag===5||e.tag===3||e.tag===4}function Rv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function R0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=zc));else if(r!==4&&(e=e.child,e!==null))for(R0(e,t,n),e=e.sibling;e!==null;)R0(e,t,n),e=e.sibling}function I0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(I0(e,t,n),e=e.sibling;e!==null;)I0(e,t,n),e=e.sibling}var wt=null,An=!1;function Vr(e,t,n){for(n=n.child;n!==null;)Fw(e,t,n),n=n.sibling}function Fw(e,t,n){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Au,n)}catch{}switch(n.tag){case 5:Et||ei(n,t);case 6:var r=wt,o=An;wt=null,Vr(e,t,n),wt=r,An=o,wt!==null&&(An?(e=wt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wt.removeChild(n.stateNode));break;case 18:wt!==null&&(An?(e=wt,n=n.stateNode,e.nodeType===8?Kd(e.parentNode,n):e.nodeType===1&&Kd(e,n),As(e)):Kd(wt,n.stateNode));break;case 4:r=wt,o=An,wt=n.stateNode.containerInfo,An=!0,Vr(e,t,n),wt=r,An=o;break;case 0:case 11:case 14:case 15:if(!Et&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&M0(n,t,i),o=o.next}while(o!==r)}Vr(e,t,n);break;case 1:if(!Et&&(ei(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Je(n,t,s)}Vr(e,t,n);break;case 21:Vr(e,t,n);break;case 22:n.mode&1?(Et=(r=Et)||n.memoizedState!==null,Vr(e,t,n),Et=r):Vr(e,t,n);break;default:Vr(e,t,n)}}function Iv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new T8),t.forEach(function(r){var o=L8.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Nn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=i),r&=~a}if(r=o,r=rt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*P8(r/1960))-r,10e?16:e,to===null)var r=!1;else{if(e=to,to=null,nu=0,Re&6)throw Error(ie(331));var o=Re;for(Re|=4,ge=e.current;ge!==null;){var a=ge,i=a.child;if(ge.flags&16){var s=a.deletions;if(s!==null){for(var l=0;lrt()-vm?zo(e,0):gm|=n),Ht(e,t)}function Gw(e,t){t===0&&(e.mode&1?(t=Il,Il<<=1,!(Il&130023424)&&(Il=4194304)):t=1);var n=Ot();e=Cr(e,t),e!==null&&(Js(e,t,n),Ht(e,n))}function D8(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gw(e,n)}function L8(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ie(314))}r!==null&&r.delete(t),Gw(e,n)}var Kw;Kw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vt.current)Ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ut=!1,k8(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,We&&t.flags&1048576&&Qb(t,Kc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gc(e,t),e=t.pendingProps;var o=yi(t,Pt.current);ui(t,n),o=um(null,t,r,e,o,n);var a=dm();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,zt(r)?(a=!0,Wc(t)):a=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,am(t),o.updater=Fu,t.stateNode=o,o._reactInternals=t,k0(t,r,e,n),t=T0(null,t,r,!0,a,n)):(t.tag=0,We&&a&&Zp(t),Rt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gc(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=F8(r),e=Mn(r,e),o){case 0:t=S0(null,t,r,e,n);break e;case 1:t=Nv(null,t,r,e,n);break e;case 11:t=Tv(null,t,r,e,n);break e;case 14:t=Ev(null,t,r,Mn(r.type,e),n);break e}throw Error(ie(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),S0(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),Nv(e,t,r,o,n);case 3:e:{if(Mw(t),e===null)throw Error(ie(387));r=t.pendingProps,a=t.memoizedState,o=a.element,rw(e,t),Yc(t,r,null,n);var i=t.memoizedState;if(r=i.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){o=xi(Error(ie(423)),t),t=Pv(e,t,r,n,o);break e}else if(r!==o){o=xi(Error(ie(424)),t),t=Pv(e,t,r,n,o);break e}else for(Zt=io(t.stateNode.containerInfo.firstChild),Jt=t,We=!0,Rn=null,n=tw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bi(),r===o){t=Sr(e,t,n);break e}Rt(e,t,r,n)}t=t.child}return t;case 5:return ow(t),e===null&&w0(t),r=t.type,o=t.pendingProps,a=e!==null?e.memoizedProps:null,i=o.children,h0(r,o)?i=null:a!==null&&h0(r,a)&&(t.flags|=32),Pw(e,t),Rt(e,t,i,n),t.child;case 6:return e===null&&w0(t),null;case 13:return Aw(e,t,n);case 4:return im(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=wi(t,null,r,n):Rt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),Tv(e,t,r,o,n);case 7:return Rt(e,t,t.pendingProps,n),t.child;case 8:return Rt(e,t,t.pendingProps.children,n),t.child;case 12:return Rt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,a=t.memoizedProps,i=o.value,Be(qc,r._currentValue),r._currentValue=i,a!==null)if(Ln(a.value,i)){if(a.children===o.children&&!Vt.current){t=Sr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){i=a.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(a.tag===1){l=wr(-1,n&-n),l.tag=2;var c=a.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),_0(a.return,n,t),s.lanes|=n;break}l=l.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(ie(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),_0(i,n,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}Rt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ui(t,n),o=kn(o),r=r(o),t.flags|=1,Rt(e,t,r,n),t.child;case 14:return r=t.type,o=Mn(r,t.pendingProps),o=Mn(r.type,o),Ev(e,t,r,o,n);case 15:return Ew(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),gc(e,t),t.tag=1,zt(r)?(e=!0,Wc(t)):e=!1,ui(t,n),Cw(t,r,o),k0(t,r,o,n),T0(null,t,r,!0,e,n);case 19:return Rw(e,t,n);case 22:return Nw(e,t,n)}throw Error(ie(156,t.tag))};function qw(e,t){return _b(e,t)}function j8(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(e,t,n,r){return new j8(e,t,n,r)}function _m(e){return e=e.prototype,!(!e||!e.isReactComponent)}function F8(e){if(typeof e=="function")return _m(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$p)return 11;if(e===Up)return 14}return 2}function uo(e,t){var n=e.alternate;return n===null?(n=bn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function bc(e,t,n,r,o,a){var i=2;if(r=e,typeof e=="function")_m(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Wa:return Ho(n.children,o,a,t);case Bp:i=8,o|=8;break;case Kf:return e=bn(12,n,t,o|2),e.elementType=Kf,e.lanes=a,e;case qf:return e=bn(13,n,t,o),e.elementType=qf,e.lanes=a,e;case Xf:return e=bn(19,n,t,o),e.elementType=Xf,e.lanes=a,e;case ob:return Uu(n,o,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nb:i=10;break e;case rb:i=9;break e;case $p:i=11;break e;case Up:i=14;break e;case Xr:i=16,r=null;break e}throw Error(ie(130,e==null?e:typeof e,""))}return t=bn(i,n,t,o),t.elementType=e,t.type=r,t.lanes=a,t}function Ho(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function Uu(e,t,n,r){return e=bn(22,e,r,t),e.elementType=ob,e.lanes=n,e.stateNode={isHidden:!1},e}function tf(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function nf(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function B8(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function xm(e,t,n,r,o,a,i,s,l){return e=new B8(e,t,n,s,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=bn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},am(a),e}function $8(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Zw)}catch(e){console.error(e)}}Zw(),Z1.exports=rn;var an=Z1.exports;const Jw=Pp(an);var e2,Uv=an;e2=Uv.createRoot,Uv.hydrateRoot;var W8={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Vv=e=>{let t;const n=new Set,r=(u,d)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const g=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(v=>v(t,g))}},o=()=>t,l={setState:r,getState:o,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(W8?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,o,l);return l},G8=e=>e?Vv(e):Vv;var t2={exports:{}},n2={},r2={exports:{}},o2={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ci=m;function K8(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var q8=typeof Object.is=="function"?Object.is:K8,X8=Ci.useState,Y8=Ci.useEffect,Q8=Ci.useLayoutEffect,Z8=Ci.useDebugValue;function J8(e,t){var n=t(),r=X8({inst:{value:n,getSnapshot:t}}),o=r[0].inst,a=r[1];return Q8(function(){o.value=n,o.getSnapshot=t,rf(o)&&a({inst:o})},[e,n,t]),Y8(function(){return rf(o)&&a({inst:o}),e(function(){rf(o)&&a({inst:o})})},[e]),Z8(n),n}function rf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!q8(e,n)}catch{return!0}}function e3(e,t){return t()}var t3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?e3:J8;o2.useSyncExternalStore=Ci.useSyncExternalStore!==void 0?Ci.useSyncExternalStore:t3;r2.exports=o2;var n3=r2.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Gu=m,r3=n3;function o3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var a3=typeof Object.is=="function"?Object.is:o3,i3=r3.useSyncExternalStore,s3=Gu.useRef,l3=Gu.useEffect,c3=Gu.useMemo,u3=Gu.useDebugValue;n2.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var a=s3(null);if(a.current===null){var i={hasValue:!1,value:null};a.current=i}else i=a.current;a=c3(function(){function l(g){if(!c){if(c=!0,u=g,g=r(g),o!==void 0&&i.hasValue){var v=i.value;if(o(v,g))return d=v}return d=g}if(v=d,a3(u,g))return v;var h=r(g);return o!==void 0&&o(v,h)?v:(u=g,d=h)}var c=!1,u,d,p=n===void 0?null:n;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,n,r,o]);var s=i3(e,a[0],a[1]);return l3(function(){i.hasValue=!0,i.value=s},[s]),u3(s),s};t2.exports=n2;var d3=t2.exports;const f3=Pp(d3);var a2={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:p3}=Ae,{useSyncExternalStoreWithSelector:m3}=f3;let zv=!1;const h3=e=>e;function g3(e,t=h3,n){(a2?"production":void 0)!=="production"&&n&&!zv&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),zv=!0);const r=m3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p3(r),r}const Hv=e=>{(a2?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?G8(e):e,n=(r,o)=>g3(t,r,o);return Object.assign(n,t),n},i2=e=>e?Hv(e):Hv,F0={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function B0(e,t,n,r=!1){const o=String(t),a=(l,c)=>`\x1B[${c[0]}m${l}\x1B[${c[1]}m`,i=(l,c)=>c!=null&&typeof c=="string"?a(l,F0[c]):c!=null&&Array.isArray(c)?c.reduce((u,d)=>i(u,d),l):c!=null&&c[l.trim()]!=null?i(l,c[l.trim()]):c!=null&&c["*"]!=null?i(l,c["*"]):l,s=null;return o.replace(/{{(.+?)}}/g,(l,c)=>{const u=n[c]!=null?String(n[c]):r?"":l;return e.stylePrettyLogs?i(u,e?.prettyLogStyles?.[c]??s)+a("",F0.reset):u})}function pn(e,t=2,n=0){return e!=null&&isNaN(e)?"":(e=e!=null?e+n:e,t===2?e==null?"--":e<10?"0"+e:e.toString():e==null?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function v3(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([t,n])=>({key:t,value:n})),hash:e.hash,origin:e.origin}}function s2(e){const t=new Set;return JSON.stringify(e,(n,r)=>{if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return typeof r=="bigint"?`${r}`:r})}function yn(e,t){const n={seen:[],stylize:l2};return t!=null&&f2(n,t),ni(n.showHidden)&&(n.showHidden=!1),ni(n.depth)&&(n.depth=2),ni(n.colors)&&(n.colors=!0),ni(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=b3),au(n,e,n.depth)}yn.colors=F0;yn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function y3(e){return typeof e=="boolean"}function ni(e){return e===void 0}function l2(e){return e}function b3(e,t){const n=yn.styles[t];return n!=null&&yn?.colors?.[n]?.[0]!=null&&yn?.colors?.[n]?.[1]!=null?"\x1B["+yn.colors[n][0]+"m"+e+"\x1B["+yn.colors[n][1]+"m":e}function Wl(e){return typeof e=="function"}function c2(e){return typeof e=="string"}function w3(e){return typeof e=="number"}function u2(e){return e===null}function d2(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function of(e){return Ku(e)&&Tm(e)==="[object RegExp]"}function Ku(e){return typeof e=="object"&&e!==null}function af(e){return Ku(e)&&(Tm(e)==="[object Error]"||e instanceof Error)}function Wv(e){return Ku(e)&&Tm(e)==="[object Date]"}function Tm(e){return Object.prototype.toString.call(e)}function _3(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function x3(e,t,n,r,o){const a=[];for(let i=0,s=t.length;i{i.match(/^\d+$/)||a.push($0(e,t,n,r,i,!0))}),a}function sf(e){return"["+Error.prototype.toString.call(e)+"]"}function au(e,t,n=0){if(e.customInspect&&t!=null&&Wl(t)&&t?.inspect!==yn&&!(t?.constructor&&t?.constructor.prototype===t)){if(typeof t.inspect!="function"&&t.toString!=null)return t.toString();let u=t?.inspect(n,e);return c2(u)||(u=au(e,u,n)),u}const r=Gr(e,t);if(r)return r;let o=Object.keys(t);const a=_3(o);try{e.showHidden&&Object.getOwnPropertyNames&&(o=Object.getOwnPropertyNames(t))}catch{}if(af(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return sf(t);if(o.length===0)if(Wl(e.stylize)){if(Wl(t)){const u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(of(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Wv(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(af(t))return sf(t)}else return t;let i="",s=!1,l=[`{ -`,` -}`];if(Array.isArray(t)&&(s=!0,l=[`[ -`,` -]`]),Wl(t)&&(i=" [Function"+(t.name?": "+t.name:"")+"]"),of(t)&&(i=" "+RegExp.prototype.toString.call(t)),Wv(t)&&(i=" "+Date.prototype.toUTCString.call(t)),af(t)&&(i=" "+sf(t)),o.length===0&&(!s||t.length==0))return l[0]+i+l[1];if(n<0)return of(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);let c;return s?c=x3(e,t,n,a,o):c=o.map(u=>$0(e,t,n,a,u,s)),e.seen.pop(),k3(c,i,l)}function $0(e,t,n,r,o,a){let i,s,l={value:void 0};try{l.value=t[o]}catch{}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,o)||l)}catch{}if(l.get?l.set?s=e.stylize("[Getter/Setter]","special"):s=e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),d2(r,o)||(i="["+o+"]"),s||(e.seen.indexOf(l.value)<0?(u2(n)?s=au(e,l.value,void 0):s=au(e,l.value,n-1),s.indexOf(` -`)>-1&&(a?s=s.split(` -`).map(c=>" "+c).join(` -`).substr(2):s=` -`+s.split(` -`).map(c=>" "+c).join(` -`))):s=e.stylize("[Circular]","special")),ni(i)){if(a&&o.match(/^\d+$/))return s;i=JSON.stringify(""+o),i.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+s}function Gr(e,t){if(ni(t))return e.stylize("undefined","undefined");if(c2(t)){const n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(n,"string")}if(w3(t))return e.stylize(""+t,"number");if(y3(t))return e.stylize(""+t,"boolean");if(u2(t))return e.stylize("null","null")}function k3(e,t,n){return n[0]+(t===""?"":t+` -`)+" "+e.join(`, - `)+" "+n[1]}function f2(e,t){const n={...e};if(!t||!Ku(t))return e;const r={...t},o=Object.keys(t);let a=o.length;for(;a--;)n[o[a]]=r[o[a]];return n}function C3(e,...t){const n={seen:[],stylize:l2};e!=null&&f2(n,e);const r=t[0];let o=0,a="",i="";if(typeof r=="string"){if(t.length===1)return r;let s,l=0;for(let c=0;c!n.includes("Error: "))?.[e])}function m2(e){return(e?.stack?.split(` -`)??[])?.filter(t=>!t.includes("Error: "))?.reduce((t,n)=>(t.push(h2(n)),t),[])}function h2(e){const t=globalThis?.location?.origin,n={fullFilePath:void 0,fileName:void 0,fileNameWithLine:void 0,fileColumn:void 0,fileLine:void 0,filePath:void 0,filePathWithLine:void 0,method:void 0};if(e!=null){const r=e.match(E3);if(r){n.filePath=r[1].replace(/\?.*$/,""),n.fullFilePath=`${t}${n.filePath}`;const o=n.filePath.split("/");n.fileName=o[o.length-1],n.fileLine=r[2],n.fileColumn=r[3],n.filePathWithLine=`${n.filePath}:${n.fileLine}`,n.fileNameWithLine=`${n.fileName}:${n.fileLine}`}}return n}function g2(e){return e instanceof Error}function P3(e,t){return e.reduce((n,r)=>(g2(r)?n.errors.push(v2(r,t)):n.args.push(r),n),{args:[],errors:[]})}function v2(e,t){const n=m2(e).map(o=>B0(t,t.prettyErrorStackTemplate,{...o},!0)),r={errorName:` ${e.name} `,errorMessage:Object.getOwnPropertyNames(e).reduce((o,a)=>(a!=="stack"&&o.push(e[a]),o),[]).join(", "),errorStack:n.join(` -`)};return B0(t,t.prettyErrorTemplate,r)}function M3(e,t,n,r){const o=(n.length>0&&t.length>0?` -`:"")+n.join(` -`);r.prettyInspectOptions.colors=r.stylePrettyLogs,console.log(e+C3(r.prettyInspectOptions,...t)+o)}function A3(e){console.log(s2(e))}function R3(e){return!1}class I3{constructor(t,n,r=4){this.logObj=n,this.stackDepthLevel=r,this.runtime=S3,this.settings={type:t?.type??"pretty",name:t?.name,parentNames:t?.parentNames,minLevel:t?.minLevel??0,argumentsArrayName:t?.argumentsArrayName,hideLogPositionForProduction:t?.hideLogPositionForProduction??!1,prettyLogTemplate:t?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} {{filePathWithLine}}{{nameWithDelimiterPrefix}} ",prettyErrorTemplate:t?.prettyErrorTemplate??` -{{errorName}} {{errorMessage}} -error stack: -{{errorStack}}`,prettyErrorStackTemplate:t?.prettyErrorStackTemplate??` • {{fileName}} {{method}} - {{filePathWithLine}}`,prettyErrorParentNamesSeparator:t?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:t?.prettyErrorLoggerNameDelimiter??" ",stylePrettyLogs:t?.stylePrettyLogs??!0,prettyLogTimeZone:t?.prettyLogTimeZone??"UTC",prettyLogStyles:t?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:t?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:t?.metaProperty??"_meta",maskPlaceholder:t?.maskPlaceholder??"[***]",maskValuesOfKeys:t?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:t?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:t?.maskValuesRegEx,prefix:[...t?.prefix??[]],attachedTransports:[...t?.attachedTransports??[]],overwrite:{mask:t?.overwrite?.mask,toLogObj:t?.overwrite?.toLogObj,addMeta:t?.overwrite?.addMeta,addPlaceholders:t?.overwrite?.addPlaceholders,formatMeta:t?.overwrite?.formatMeta,formatLogObj:t?.overwrite?.formatLogObj,transportFormatted:t?.overwrite?.transportFormatted,transportJSON:t?.overwrite?.transportJSON}}}log(t,n,...r){if(t0?this._mask(o):o,i=this.logObj!=null?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,s=this.settings.overwrite?.toLogObj!=null?this.settings.overwrite?.toLogObj(a,i):this._toLogObj(a,i),l=this.settings.overwrite?.addMeta!=null?this.settings.overwrite?.addMeta(s,t,n):this._addMetaToLogObj(s,t,n);let c,u;return this.settings.overwrite?.formatMeta!=null&&(c=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),this.settings.overwrite?.formatLogObj!=null&&(u=this.settings.overwrite?.formatLogObj(a,this.settings)),this.settings.type==="pretty"&&(c=c??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),u=u??this.runtime.prettyFormatLogObj(a,this.settings)),c!=null&&u!=null?this.settings.overwrite?.transportFormatted!=null?this.settings.overwrite?.transportFormatted(c,u.args,u.errors,this.settings):this.runtime.transportFormatted(c,u.args,u.errors,this.settings):this.settings.overwrite?.transportJSON!=null?this.settings.overwrite?.transportJSON(l):this.settings.type!=="hidden"&&this.runtime.transportJSON(l),this.settings.attachedTransports!=null&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(d=>{d(l)}),l}attachTransport(t){this.settings.attachedTransports.push(t)}getSubLogger(t,n){const r={...this.settings,...t,parentNames:this.settings?.parentNames!=null&&this.settings?.name!=null?[...this.settings.parentNames,this.settings.name]:this.settings?.name!=null?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...t?.prefix??[]]};return new this.constructor(r,n??this.logObj,this.stackDepthLevel)}_mask(t){const n=this.settings.maskValuesOfKeysCaseInsensitive!==!0?this.settings.maskValuesOfKeys:this.settings.maskValuesOfKeys.map(r=>r.toLowerCase());return t?.map(r=>this._recursiveCloneAndMaskValuesOfKeys(r,n))}_recursiveCloneAndMaskValuesOfKeys(t,n,r=[]){if(r.includes(t))return{...t};if(typeof t=="object"&&t!==null&&r.push(t),this.runtime.isError(t)||this.runtime.isBuffer(t))return t;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(Array.isArray(t))return t.map(o=>this._recursiveCloneAndMaskValuesOfKeys(o,n,r));if(t instanceof Date)return new Date(t.getTime());if(t instanceof URL)return v3(t);if(t!==null&&typeof t=="object"){const o=this.runtime.isError(t)?this._cloneError(t):Object.create(Object.getPrototypeOf(t));return Object.getOwnPropertyNames(t).reduce((a,i)=>(a[i]=n.includes(this.settings?.maskValuesOfKeysCaseInsensitive!==!0?i:i.toLowerCase())?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(t[i],n,r)}catch{return null}})(),a),o)}else{if(typeof t=="string"){let o=t;for(const a of this.settings?.maskValuesRegEx||[])o=o.replace(a,this.settings?.maskPlaceholder||"");return o}return t}}_recursiveCloneAndExecuteFunctions(t,n=[]){return this.isObjectOrArray(t)&&n.includes(t)?this.shallowCopy(t):(this.isObjectOrArray(t)&&n.push(t),Array.isArray(t)?t.map(r=>this._recursiveCloneAndExecuteFunctions(r,n)):t instanceof Date?new Date(t.getTime()):this.isObject(t)?Object.getOwnPropertyNames(t).reduce((r,o)=>{const a=Object.getOwnPropertyDescriptor(t,o);if(a){Object.defineProperty(r,o,a);const i=t[o];r[o]=typeof i=="function"?i():this._recursiveCloneAndExecuteFunctions(i,n)}return r},Object.create(Object.getPrototypeOf(t))):t)}isObjectOrArray(t){return typeof t=="object"&&t!==null}isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}shallowCopy(t){return Array.isArray(t)?[...t]:{...t}}_toLogObj(t,n={}){return t=t?.map(r=>this.runtime.isError(r)?this._toErrorObject(r):r),this.settings.argumentsArrayName==null?t.length===1&&!Array.isArray(t[0])&&this.runtime.isBuffer(t[0])!==!0&&!(t[0]instanceof Date)?n=typeof t[0]=="object"&&t[0]!=null?{...t[0],...n}:{0:t[0],...n}:n={...n,...t}:n={...n,[this.settings.argumentsArrayName]:t},n}_cloneError(t){const n=new t.constructor;return Object.getOwnPropertyNames(t).forEach(r=>{n[r]=t[r]}),n}_toErrorObject(t){return{nativeError:t,name:t.name??"Error",message:t.message,stack:this.runtime.getErrorTrace(t)}}_addMetaToLogObj(t,n,r){return{...t,[this.settings.metaProperty]:this.runtime.getMeta(n,r,this.stackDepthLevel,this.settings.hideLogPositionForProduction,this.settings.name,this.settings.parentNames)}}_prettyFormatLogObjMeta(t){if(t==null)return"";let n=this.settings.prettyLogTemplate;const r={};n.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?n=n.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):this.settings.prettyLogTimeZone==="UTC"?(r.yyyy=t?.date?.getUTCFullYear()??"----",r.mm=pn(t?.date?.getUTCMonth(),2,1),r.dd=pn(t?.date?.getUTCDate(),2),r.hh=pn(t?.date?.getUTCHours(),2),r.MM=pn(t?.date?.getUTCMinutes(),2),r.ss=pn(t?.date?.getUTCSeconds(),2),r.ms=pn(t?.date?.getUTCMilliseconds(),3)):(r.yyyy=t?.date?.getFullYear()??"----",r.mm=pn(t?.date?.getMonth(),2,1),r.dd=pn(t?.date?.getDate(),2),r.hh=pn(t?.date?.getHours(),2),r.MM=pn(t?.date?.getMinutes(),2),r.ss=pn(t?.date?.getSeconds(),2),r.ms=pn(t?.date?.getMilliseconds(),3));const o=this.settings.prettyLogTimeZone==="UTC"?t?.date:new Date(t?.date?.getTime()-t?.date?.getTimezoneOffset()*6e4);r.rawIsoStr=o?.toISOString(),r.dateIsoStr=o?.toISOString().replace("T"," ").replace("Z",""),r.logLevelName=t?.logLevelName,r.fileNameWithLine=t?.path?.fileNameWithLine??"",r.filePathWithLine=t?.path?.filePathWithLine??"",r.fullFilePath=t?.path?.fullFilePath??"";let a=this.settings.parentNames?.join(this.settings.prettyErrorParentNamesSeparator);return a=a!=null&&t?.name!=null?a+this.settings.prettyErrorParentNamesSeparator:void 0,r.name=t?.name!=null||a!=null?(a??"")+t?.name:"",r.nameWithDelimiterPrefix=r.name.length>0?this.settings.prettyErrorLoggerNameDelimiter+r.name:"",r.nameWithDelimiterSuffix=r.name.length>0?r.name+this.settings.prettyErrorLoggerNameDelimiter:"",this.settings.overwrite?.addPlaceholders!=null&&this.settings.overwrite?.addPlaceholders(t,r),B0(this.settings,n,r)}}class O3 extends I3{constructor(t,n){const r=typeof window<"u"&&typeof document<"u",o=r?window.chrome!==void 0&&window.CSS!==void 0&&window.CSS.supports("color","green"):!1,a=r?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1;t=t||{},t.stylePrettyLogs=t.stylePrettyLogs&&r&&!o?!1:t.stylePrettyLogs,super(t,n,a?4:5)}log(t,n,...r){return super.log(t,n,...r)}silly(...t){return super.log(0,"SILLY",...t)}trace(...t){return super.log(1,"TRACE",...t)}debug(...t){return super.log(2,"DEBUG",...t)}info(...t){return super.log(3,"INFO",...t)}warn(...t){return super.log(4,"WARN",...t)}error(...t){return super.log(5,"ERROR",...t)}fatal(...t){return super.log(6,"FATAL",...t)}getSubLogger(t,n){return super.getSubLogger(t,n)}}var _e={},Ii={},qu={},ea={},rl={};Object.defineProperty(rl,"__esModule",{value:!0});rl.DispatcherWrapper=void 0;class D3{constructor(t){this._subscribe=n=>t.subscribe(n),this._unsubscribe=n=>t.unsubscribe(n),this._one=n=>t.one(n),this._has=n=>t.has(n),this._clear=()=>t.clear(),this._count=()=>t.count,this._onSubscriptionChange=()=>t.onSubscriptionChange}get onSubscriptionChange(){return this._onSubscriptionChange()}get count(){return this._count()}subscribe(t){return this._subscribe(t)}sub(t){return this.subscribe(t)}unsubscribe(t){this._unsubscribe(t)}unsub(t){this.unsubscribe(t)}one(t){return this._one(t)}has(t){return this._has(t)}clear(){this._clear()}}rl.DispatcherWrapper=D3;var ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.Subscription=void 0;class L3{constructor(t,n){this.handler=t,this.isOnce=n,this.isExecuted=!1}execute(t,n,r){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var o=this.handler;t?setTimeout(()=>{o.apply(n,r)},1):o.apply(n,r)}}}ol.Subscription=L3;var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.EventManagement=void 0;class j3{constructor(t){this.unsub=t,this.propagationStopped=!1}stopPropagation(){this.propagationStopped=!0}}Oi.EventManagement=j3;Object.defineProperty(ea,"__esModule",{value:!0});ea.SubscriptionChangeEventDispatcher=ea.DispatcherBase=void 0;const F3=rl,B3=ol,$3=Oi;class y2{constructor(){this._subscriptions=new Array}get count(){return this._subscriptions.length}get onSubscriptionChange(){return this._onSubscriptionChange==null&&(this._onSubscriptionChange=new b2),this._onSubscriptionChange.asEvent()}subscribe(t){return t&&(this._subscriptions.push(this.createSubscription(t,!1)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(t)}}sub(t){return this.subscribe(t)}one(t){return t&&(this._subscriptions.push(this.createSubscription(t,!0)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(t)}}has(t){return t?this._subscriptions.some(n=>n.handler==t):!1}unsubscribe(t){if(!t)return;let n=!1;for(let r=0;rthis.unsub(o.handler)),i=Array.prototype.slice.call(r);if(i.push(a),o.execute(t,n,i),this.cleanup(o),!t&&a.propagationStopped)return{propagationStopped:!0}}return t?null:{propagationStopped:!1}}createSubscription(t,n){return new B3.Subscription(t,n)}cleanup(t){let n=!1;if(t.isOnce&&t.isExecuted){let r=this._subscriptions.indexOf(t);r>-1&&(this._subscriptions.splice(r,1),n=!0)}n&&this.triggerSubscriptionChange()}asEvent(){return this._wrap==null&&(this._wrap=new F3.DispatcherWrapper(this)),this._wrap}clear(){this._subscriptions.length!=0&&(this._subscriptions.splice(0,this._subscriptions.length),this.triggerSubscriptionChange())}triggerSubscriptionChange(){this._onSubscriptionChange!=null&&this._onSubscriptionChange.dispatch(this.count)}}ea.DispatcherBase=y2;class b2 extends y2{dispatch(t){this._dispatch(!1,this,arguments)}}ea.SubscriptionChangeEventDispatcher=b2;var al={};Object.defineProperty(al,"__esModule",{value:!0});al.DispatchError=void 0;class U3 extends Error{constructor(t){super(t)}}al.DispatchError=U3;var Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.EventListBase=void 0;class V3{constructor(){this._events={}}get(t){let n=this._events[t];return n||(n=this.createDispatcher(),this._events[t]=n,n)}remove(t){delete this._events[t]}}Xu.EventListBase=V3;var Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.HandlingBase=void 0;class z3{constructor(t){this.events=t}one(t,n){this.events.get(t).one(n)}has(t,n){return this.events.get(t).has(n)}subscribe(t,n){this.events.get(t).subscribe(n)}sub(t,n){this.subscribe(t,n)}unsubscribe(t,n){this.events.get(t).unsubscribe(n)}unsub(t,n){this.unsubscribe(t,n)}}Yu.HandlingBase=z3;var Qu={},il={};Object.defineProperty(il,"__esModule",{value:!0});il.PromiseSubscription=void 0;class H3{constructor(t,n){this.handler=t,this.isOnce=n,this.isExecuted=!1}async execute(t,n,r){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var o=this.handler;if(t){setTimeout(()=>{o.apply(n,r)},1);return}await o.apply(n,r)}}}il.PromiseSubscription=H3;Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PromiseDispatcherBase=void 0;const W3=il,G3=Oi,K3=ea,q3=al;class X3 extends K3.DispatcherBase{_dispatch(t,n,r){throw new q3.DispatchError("_dispatch not supported. Use _dispatchAsPromise.")}createSubscription(t,n){return new W3.PromiseSubscription(t,n)}async _dispatchAsPromise(t,n,r){for(let o of[...this._subscriptions]){let a=new G3.EventManagement(()=>this.unsub(o.handler)),i=Array.prototype.slice.call(r);if(i.push(a),await o.execute(t,n,i),this.cleanup(o),!t&&a.propagationStopped)return{propagationStopped:!0}}return t?null:{propagationStopped:!1}}}Qu.PromiseDispatcherBase=X3;(function(e){/*! - * Strongly Typed Events for TypeScript - Core - * https://github.com/KeesCBakker/StronlyTypedEvents/ - * http://keestalkstech.com - * - * Copyright Kees C. Bakker / KeesTalksTech - * Released under the MIT license - */Object.defineProperty(e,"__esModule",{value:!0}),e.SubscriptionChangeEventDispatcher=e.HandlingBase=e.PromiseDispatcherBase=e.PromiseSubscription=e.DispatchError=e.EventManagement=e.EventListBase=e.DispatcherWrapper=e.DispatcherBase=e.Subscription=void 0;const t=ea;Object.defineProperty(e,"DispatcherBase",{enumerable:!0,get:function(){return t.DispatcherBase}}),Object.defineProperty(e,"SubscriptionChangeEventDispatcher",{enumerable:!0,get:function(){return t.SubscriptionChangeEventDispatcher}});const n=al;Object.defineProperty(e,"DispatchError",{enumerable:!0,get:function(){return n.DispatchError}});const r=rl;Object.defineProperty(e,"DispatcherWrapper",{enumerable:!0,get:function(){return r.DispatcherWrapper}});const o=Xu;Object.defineProperty(e,"EventListBase",{enumerable:!0,get:function(){return o.EventListBase}});const a=Oi;Object.defineProperty(e,"EventManagement",{enumerable:!0,get:function(){return a.EventManagement}});const i=Yu;Object.defineProperty(e,"HandlingBase",{enumerable:!0,get:function(){return i.HandlingBase}});const s=Qu;Object.defineProperty(e,"PromiseDispatcherBase",{enumerable:!0,get:function(){return s.PromiseDispatcherBase}});const l=il;Object.defineProperty(e,"PromiseSubscription",{enumerable:!0,get:function(){return l.PromiseSubscription}});const c=ol;Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return c.Subscription}})})(qu);Object.defineProperty(Ii,"__esModule",{value:!0});Ii.SimpleEventDispatcher=void 0;const Gv=qu;class Y3 extends Gv.DispatcherBase{constructor(){super()}dispatch(t){const n=this._dispatch(!1,this,arguments);if(n==null)throw new Gv.DispatchError("Got `null` back from dispatch.");return n}dispatchAsync(t){this._dispatch(!0,this,arguments)}asEvent(){return super.asEvent()}}Ii.SimpleEventDispatcher=Y3;var Zu={},sl={};Object.defineProperty(sl,"__esModule",{value:!0});sl.SimpleEventList=void 0;const Q3=qu,Z3=Ii;class J3 extends Q3.EventListBase{constructor(){super()}createDispatcher(){return new Z3.SimpleEventDispatcher}}sl.SimpleEventList=J3;Object.defineProperty(Zu,"__esModule",{value:!0});Zu.SimpleEventHandlingBase=void 0;const eN=qu,tN=sl;class nN extends eN.HandlingBase{constructor(){super(new tN.SimpleEventList)}}Zu.SimpleEventHandlingBase=nN;var Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.NonUniformSimpleEventList=void 0;const rN=Ii;class oN{constructor(){this._events={}}get(t){if(this._events[t])return this._events[t];const n=this.createDispatcher();return this._events[t]=n,n}remove(t){delete this._events[t]}createDispatcher(){return new rN.SimpleEventDispatcher}}Ju.NonUniformSimpleEventList=oN;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NonUniformSimpleEventList=e.SimpleEventList=e.SimpleEventHandlingBase=e.SimpleEventDispatcher=void 0;const t=Ii;Object.defineProperty(e,"SimpleEventDispatcher",{enumerable:!0,get:function(){return t.SimpleEventDispatcher}});const n=Zu;Object.defineProperty(e,"SimpleEventHandlingBase",{enumerable:!0,get:function(){return n.SimpleEventHandlingBase}});const r=Ju;Object.defineProperty(e,"NonUniformSimpleEventList",{enumerable:!0,get:function(){return r.NonUniformSimpleEventList}});const o=sl;Object.defineProperty(e,"SimpleEventList",{enumerable:!0,get:function(){return o.SimpleEventList}})})(_e);let U0=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];typeof Int32Array<"u"&&(U0=new Int32Array(U0));const lf=(e,t)=>{let n=typeof t<"u"?~~t:65535;for(let r=0;r>8^e[r])&255]^n<<8)&65535;return n};var Kv={},aN=Object.defineProperty,nt=(e,t)=>{for(var n in t)aN(e,n,{get:t[n],enumerable:!0})},V0="f75c76d2-129e-4dad-a1dd-7866124401e7",z0="2c55e69e-4993-11ed-b878-0242ac120002",H0="ed9da18c-a800-4f66-a670-aa7547e34453",W0="6ba1b218-15a8-461f-9fa8-5dcae273eafd",G0=4294967295,K0=2.2,iN={ToRadioUuid:V0,FromRadioUuid:z0,FromNumUuid:H0,ServiceUuid:W0,broadcastNum:G0,minFwVer:K0},pe={};nt(pe,{Admin:()=>qe,AppOnly:()=>I_,CannedMessages:()=>O_,Channel:()=>lu,ClientOnly:()=>D_,Config:()=>U2,ConnectionStatus:()=>k_,DeviceOnly:()=>j_,LocalOnly:()=>L_,Mesh:()=>it,ModuleConfig:()=>r_,Mqtt:()=>V_,PaxCount:()=>dh,Portnums:()=>be,RemoteHardware:()=>fh,Rtttl:()=>H_,StoreForward:()=>W_,Telemetry:()=>Bm,Xmodem:()=>bt});var qe={};nt(qe,{AdminMessage:()=>uP,AdminMessage_ConfigType:()=>P_,AdminMessage_ModuleConfigType:()=>M_,HamParameters:()=>A_,NodeRemoteHardwarePinsResponse:()=>R_});function tt(e,t){if(!e)throw new Error(t)}var sN=34028234663852886e22,lN=-34028234663852886e22,cN=4294967295,uN=2147483647,dN=-2147483648;function wc(e){if(typeof e!="number")throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>uN||ecN||e<0)throw new Error("invalid uint 32: "+e)}function w2(e){if(typeof e!="number")throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>sN||e({no:o.no,name:o.name,localName:e[o.no]})))}function k2(e,t,n){const r=Object.create(null),o=Object.create(null),a=[];for(const i of t){const s=C2(i);a.push(s),r[i.name]=s,o[i.no]=s}return{typeName:e,values:a,findName(i){return r[i]},findNumber(i){return o[i]}}}function pN(e,t,n){const r={};for(const o of t){const a=C2(o);r[a.localName]=a.no,r[a.no]=a.localName}return x2(r,e,t),r}function C2(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var S2=class{equals(t){return this.getType().runtime.util.equals(this.getType(),this,t)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(t,n){const r=this.getType(),o=r.runtime.bin,a=o.makeReadOptions(n);return o.readMessage(this,a.readerFactory(t),t.byteLength,a),this}fromJson(t,n){const r=this.getType(),o=r.runtime.json,a=o.makeReadOptions(n);return o.readMessage(r,t,a,this),this}fromJsonString(t,n){let r;try{r=JSON.parse(t)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(r,n)}toBinary(t){const n=this.getType(),r=n.runtime.bin,o=r.makeWriteOptions(t),a=o.writerFactory();return r.writeMessage(this,a,o),a.finish()}toJson(t){const n=this.getType(),r=n.runtime.json,o=r.makeWriteOptions(t);return r.writeMessage(this,o)}toJsonString(t){var n;const r=this.toJson(t);return JSON.stringify(r,null,(n=t?.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function mN(e,t,n,r){var o;const a=(o=r?.localName)!==null&&o!==void 0?o:t.substring(t.lastIndexOf(".")+1),i={[a]:function(s){e.util.initFields(this),e.util.initPartial(s,this)}}[a];return Object.setPrototypeOf(i.prototype,new S2),Object.assign(i,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(s,l){return new i().fromBinary(s,l)},fromJson(s,l){return new i().fromJson(s,l)},fromJsonString(s,l){return new i().fromJsonString(s,l)},equals(s,l){return e.util.equals(i,s,l)}}),i}function hN(){let e=0,t=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(t|=(o&127)<>>a,s=!(!(i>>>7)&&t==0),l=(s?i|128:i)&255;if(n.push(l),!s)return}const r=e>>>28&15|(t&7)<<4,o=!!(t>>3);if(n.push((o?r|128:r)&255),!!o){for(let a=3;a<31;a=a+7){const i=t>>>a,s=!!(i>>>7),l=(s?i|128:i)&255;if(n.push(l),!s)return}n.push(t>>>31&1)}}var _c=4294967296;function qv(e){const t=e[0]==="-";t&&(e=e.slice(1));const n=1e6;let r=0,o=0;function a(i,s){const l=Number(e.slice(i,s));o*=n,r=r*n+l,r>=_c&&(o=o+(r/_c|0),r=r%_c)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?E2(r,o):Em(r,o)}function gN(e,t){let n=Em(e,t);const r=n.hi&2147483648;r&&(n=E2(n.lo,n.hi));const o=T2(n.lo,n.hi);return r?"-"+o:o}function T2(e,t){if({lo:e,hi:t}=vN(e,t),t<=2097151)return String(_c*t+e);const n=e&16777215,r=(e>>>24|t<<8)&16777215,o=t>>16&65535;let a=n+r*6777216+o*6710656,i=r+o*8147497,s=o*2;const l=1e7;return a>=l&&(i+=Math.floor(a/l),a%=l),i>=l&&(s+=Math.floor(i/l),i%=l),s.toString()+Xv(i)+Xv(a)}function vN(e,t){return{lo:e>>>0,hi:t>>>0}}function Em(e,t){return{lo:e|0,hi:t|0}}function E2(e,t){return t=~t,e?e=~e+1:t+=1,Em(e,t)}var Xv=e=>{const t=String(e);return"0000000".slice(t.length)+t};function Yv(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}function yN(){let e=this.buf[this.pos++],t=e&127;if(!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;e&128&&n<10;n++)e=this.buf[this.pos++];if(e&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}function bN(){const e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof process!="object"||typeof Kv!="object"||Kv.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),a=BigInt("9223372036854775807"),i=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>a||cs||ctt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),r=o=>tt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse(o){return typeof o!="string"&&(o=o.toString()),n(o),o},uParse(o){return typeof o!="string"&&(o=o.toString()),r(o),o},enc(o){return typeof o!="string"&&(o=o.toString()),n(o),qv(o)},uEnc(o){return typeof o!="string"&&(o=o.toString()),r(o),qv(o)},dec(o,a){return gN(o,a)},uDec(o,a){return T2(o,a)}}}var Qt=bN(),te;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(te||(te={}));var ho;(function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"})(ho||(ho={}));function zr(e,t,n){if(t===n)return!0;if(e==te.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let r=0;r>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(q0(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return wc(e),Yv(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){w2(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){q0(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){wc(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return wc(e),e=(e<<1^e>>31)>>>0,Yv(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Qt.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Qt.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=Qt.enc(e);return cf(t.lo,t.hi,this.buf),this}sint64(e){let t=Qt.enc(e),n=t.hi>>31,r=t.lo<<1^n,o=(t.hi<<1|t.lo>>>31)^n;return cf(r,o,this.buf),this}uint64(e){let t=Qt.uEnc(e);return cf(t.lo,t.hi,this.buf),this}},_N=class{constructor(e,t){this.varint64=hN,this.uint32=yN,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case ot.Varint:for(;this.buf[this.pos++]&128;);break;case ot.Bit64:this.pos+=4;case ot.Bit32:this.pos+=4;break;case ot.LengthDelimited:let r=this.uint32();this.pos+=r;break;case ot.StartGroup:for(;;){const[o,a]=this.tag();if(a===ot.EndGroup){if(t!==void 0&&o!==t)throw new Error("invalid end group tag");break}this.skip(a,o)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Qt.dec(...this.varint64())}uint64(){return Qt.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Qt.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function xN(e,t,n,r){let o;return{typeName:t,extendee:n,get field(){if(!o){const a=typeof r=="function"?r():r;a.name=t.split(".").pop(),a.jsonName=`[${t}]`,o=e.util.newFieldList([a]).list()[0]}return o},runtime:e}}function P2(e){const t=e.field.localName,n=Object.create(null);return n[t]=kN(e),[n,()=>n[t]]}function kN(e){const t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Si(t.T,t.L);case"message":const n=t.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function CN(e,t){if(!t.repeated&&(t.kind=="enum"||t.kind=="scalar")){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(n=>n.no===t.no)}var gr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ed=[];for(let e=0;e>4,i=a,o=2;break;case 2:n[r++]=(i&15)<<4|(a&60)>>2,i=a,o=3;break;case 3:n[r++]=(i&3)<<6|a,o=0;break}}if(o==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t="",n=0,r,o=0;for(let a=0;a>2],o=(r&3)<<4,n=1;break;case 1:t+=gr[o|r>>4],o=(r&15)<<2,n=2;break;case 2:t+=gr[o|r>>6],t+=gr[r&63],n=0;break}return n&&(t+=gr[o],t+="=",n==1&&(t+="=")),t}};function SN(e,t,n){R2(t,e);const r=t.runtime.bin.makeReadOptions(n),o=CN(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,i]=P2(t);for(const s of o)t.runtime.bin.readField(a,r.readerFactory(s.data),t.field,s.wireType,r);return i()}function TN(e,t,n,r){R2(t,e);const o=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(A2(e,t)){const c=e.getType().runtime.bin.listUnknownFields(e).filter(u=>u.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(const u of c)e.getType().runtime.bin.onUnknownField(e,u.no,u.wireType,u.data)}const i=a.writerFactory();let s=t.field;!s.opt&&!s.repeated&&(s.kind=="enum"||s.kind=="scalar")&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,i,a);const l=o.readerFactory(i.finish());for(;l.posr.no==t.field.no)}function R2(e,t){tt(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function I2(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!N2(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function Qv(e,t){const n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=r?e.T.values[0].no:void 0;break;case"scalar":t[n]=r?Si(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}function Wo(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(S2.prototype).every(r=>r in e&&typeof e[r]=="function"))return!1;const n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function O2(e,t){return Wo(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}te.DOUBLE,te.FLOAT,te.INT64,te.UINT64,te.INT32,te.UINT32,te.BOOL,te.STRING,te.BYTES;var Zv={ignoreUnknownFields:!1},Jv={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function EN(e){return e?Object.assign(Object.assign({},Zv),e):Zv}function NN(e){return e?Object.assign(Object.assign({},Jv),e):Jv}var iu=Symbol(),xc=Symbol();function PN(){return{makeReadOptions:EN,makeWriteOptions:NN,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.typeName} from JSON: ${Wn(t)}`);r=r??new e;const o=new Map,a=n.typeRegistry;for(const[i,s]of Object.entries(t)){const l=e.fields.findJsonName(i);if(l){if(l.oneof){if(s===null&&l.kind=="scalar")continue;const c=o.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);o.set(l.oneof,i)}ey(r,s,l,n,e)}else{let c=!1;if(a?.findExtension&&i.startsWith("[")&&i.endsWith("]")){const u=a.findExtension(i.substring(1,i.length-1));if(u&&u.extendee.typeName==e.typeName){c=!0;const[d,p]=P2(u);ey(d,s,u.field,n,u),TN(r,u,p(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${i}" is unknown`)}}return r},writeMessage(e,t){const n=e.getType(),r={};let o;try{for(o of n.fields.byNumber()){if(!I2(o,e)){if(o.req)throw"required field not set";if(!t.emitDefaultValues||!AN(o))continue}const i=o.oneof?e[o.oneof.localName].value:e[o.localName],s=ty(o,i,t);s!==void 0&&(r[t.useProtoFieldName?o.name:o.jsonName]=s)}const a=t.typeRegistry;if(a?.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(e)){const s=a.findExtensionFor(n.typeName,i.no);if(s&&A2(e,s)){const l=SN(e,s,t),c=ty(s.field,l,t);c!==void 0&&(r[s.field.jsonName]=c)}}}catch(a){const i=o?`cannot encode field ${n.typeName}.${o.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,s=a instanceof Error?a.message:String(a);throw new Error(i+(s.length>0?`: ${s}`:""))}return r},readScalar(e,t,n){return gs(e,t,n??ho.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||N2(e,t)))return kc(e,t)},debug:Wn}}function Wn(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function ey(e,t,n,r,o){let a=n.localName;if(n.repeated){if(tt(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`);const i=e[a];for(const s of t){if(s===null)throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(s)}`);switch(n.kind){case"message":i.push(n.T.fromJson(s,r));break;case"enum":const l=uf(n.T,s,r.ignoreUnknownFields,!0);l!==xc&&i.push(l);break;case"scalar":try{i.push(gs(n.T,s,n.L,!0))}catch(c){let u=`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(s)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`);const i=e[a];for(const[s,l]of Object.entries(t)){if(l===null)throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: map value null`);let c;try{c=MN(n.K,s)}catch(u){let d=`cannot decode map key for field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw u instanceof Error&&u.message.length>0&&(d+=`: ${u.message}`),new Error(d)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,r);break;case"enum":const u=uf(n.V.T,l,r.ignoreUnknownFields,!0);u!==xc&&(i[c]=u);break;case"scalar":try{i[c]=gs(n.V.T,l,ho.BIGINT,!0)}catch(d){let p=`cannot decode map value for field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const i=n.T;if(t===null&&i.typeName!="google.protobuf.Value")return;let s=e[a];Wo(s)?s.fromJson(t,r):(e[a]=s=i.fromJson(t,r),i.fieldWrapper&&!n.oneof&&(e[a]=i.fieldWrapper.unwrapField(s)));break;case"enum":const l=uf(n.T,t,r.ignoreUnknownFields,!1);switch(l){case iu:Qv(n,e);break;case xc:break;default:e[a]=l;break}break;case"scalar":try{const c=gs(n.T,t,n.L,!1);switch(c){case iu:Qv(n,e);break;default:e[a]=c;break}}catch(c){let u=`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}break}}function MN(e,t){if(e===te.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return gs(e,t,ho.BIGINT,!0).toString()}function gs(e,t,n,r){if(t===null)return r?Si(e,n):iu;switch(e){case te.DOUBLE:case te.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;const o=Number(t);if(Number.isNaN(o)||!Number.isFinite(o))break;return e==te.FLOAT&&w2(o),o;case te.INT32:case te.FIXED32:case te.SFIXED32:case te.SINT32:case te.UINT32:let a;if(typeof t=="number"?a=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),a===void 0)break;return e==te.UINT32||e==te.FIXED32?q0(a):wc(a),a;case te.INT64:case te.SFIXED64:case te.SINT64:if(typeof t!="number"&&typeof t!="string")break;const i=Qt.parse(t);return n?i.toString():i;case te.FIXED64:case te.UINT64:if(typeof t!="number"&&typeof t!="string")break;const s=Qt.uParse(t);return n?s.toString():s;case te.BOOL:if(typeof t!="boolean")break;return t;case te.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch{throw new Error("invalid UTF8")}return t;case te.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return M2.dec(t)}throw new Error}function uf(e,t,n,r){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:r?e.values[0].no:iu;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const o=e.findName(t);if(o!==void 0)return o.no;if(n)return xc;break}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Wn(t)}`)}function AN(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function ty(e,t,n){if(e.kind=="map"){tt(typeof t=="object"&&t!=null);const r={},o=Object.entries(t);switch(e.V.kind){case"scalar":for(const[i,s]of o)r[i.toString()]=kc(e.V.T,s);break;case"message":for(const[i,s]of o)r[i.toString()]=s.toJson(n);break;case"enum":const a=e.V.T;for(const[i,s]of o)r[i.toString()]=df(a,s,n.enumAsInteger);break}return n.emitDefaultValues||o.length>0?r:void 0}if(e.repeated){tt(Array.isArray(t));const r=[];switch(e.kind){case"scalar":for(let o=0;o0?r:void 0}switch(e.kind){case"scalar":return kc(e.T,t);case"enum":return df(e.T,t,n.enumAsInteger);case"message":return O2(e.T,t).toJson(n)}}function df(e,t,n){var r;if(tt(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;const o=e.findNumber(t);return(r=o?.name)!==null&&r!==void 0?r:t}function kc(e,t){switch(e){case te.INT32:case te.SFIXED32:case te.SINT32:case te.FIXED32:case te.UINT32:return tt(typeof t=="number"),t;case te.FLOAT:case te.DOUBLE:return tt(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case te.STRING:return tt(typeof t=="string"),t;case te.BOOL:return tt(typeof t=="boolean"),t;case te.UINT64:case te.FIXED64:case te.INT64:case te.SFIXED64:case te.SINT64:return tt(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case te.BYTES:return tt(t instanceof Uint8Array),M2.enc(t)}}var Oa=Symbol("@bufbuild/protobuf/unknown-fields"),ny={readUnknownFields:!0,readerFactory:e=>new _N(e)},ry={writeUnknownFields:!0,writerFactory:()=>new wN};function RN(e){return e?Object.assign(Object.assign({},ny),e):ny}function IN(e){return e?Object.assign(Object.assign({},ry),e):ry}function ON(){return{makeReadOptions:RN,makeWriteOptions:IN,listUnknownFields(e){var t;return(t=e[Oa])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[Oa]},writeUnknownFields(e,t){const r=e[Oa];if(r)for(const o of r)t.tag(o.no,o.wireType).raw(o.data)},onUnknownField(e,t,n,r){const o=e;Array.isArray(o[Oa])||(o[Oa]=[]),o[Oa].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,o){const a=e.getType(),i=o?t.len:t.pos+n;let s,l;for(;t.pos0&&(l=LN),a){let p=e[i];if(r==ot.LengthDelimited&&s!=te.STRING&&s!=te.BYTES){let v=t.uint32()+t.pos;for(;t.posWo(p,d)?p:new d(p));else{const p=i[o];d.fieldWrapper?d.typeName==="google.protobuf.BytesValue"?a[o]=Qi(p):a[o]=p:a[o]=Wo(p,d)?p:new d(p)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(r=>{const o=t[r.localName],a=n[r.localName];if(r.repeated){if(o.length!==a.length)return!1;switch(r.kind){case"message":return o.every((i,s)=>r.T.equals(i,a[s]));case"scalar":return o.every((i,s)=>zr(r.T,i,a[s]));case"enum":return o.every((i,s)=>zr(te.INT32,i,a[s]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(o,a);case"enum":return zr(te.INT32,o,a);case"scalar":return zr(r.T,o,a);case"oneof":if(o.case!==a.case)return!1;const i=r.findField(o.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(o.value,a.value);case"enum":return zr(te.INT32,o.value,a.value);case"scalar":return zr(i.T,o.value,a.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const s=Object.keys(o).concat(Object.keys(a));switch(r.V.kind){case"message":const l=r.V.T;return s.every(u=>l.equals(o[u],a[u]));case"enum":return s.every(u=>zr(te.INT32,o[u],a[u]));case"scalar":const c=r.V.T;return s.every(u=>zr(c,o[u],a[u]))}break}})},clone(e){const t=e.getType(),n=new t,r=n;for(const o of t.fields.byMember()){const a=e[o.localName];let i;if(o.repeated)i=a.map(Gl);else if(o.kind=="map"){i=r[o.localName];for(const[s,l]of Object.entries(a))i[s]=Gl(l)}else o.kind=="oneof"?i=o.findField(a.case)?{case:a.case,value:Gl(a.value)}:{case:void 0}:i=Gl(a);r[o.localName]=i}for(const o of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,o.no,o.wireType,o.data);return n}}}function Gl(e){if(e===void 0)return e;if(Wo(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Qi(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function $N(e,t,n){return{syntax:e,json:PN(),bin:ON(),util:Object.assign(Object.assign({},BN()),{newFieldList:t,initFields:n}),makeMessageType(r,o,a){return mN(this,r,o,a)},makeEnum:pN,makeEnumType:k2,getEnumType:fN,makeExtension(r,o,a){return xN(this,r,o,a)}}}var UN=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const t={};for(const n of this.list())t[n.jsonName]=t[n.name]=n;this.jsonNames=t}return this.jsonNames[e]}find(e){if(!this.numbers){const t={};for(const n of this.list())t[n.no]=n;this.numbers=t}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function L2(e,t){const n=j2(e);return t?n:KN(GN(n))}function VN(e){return L2(e,!1)}var zN=j2;function j2(e){let t=!1;const n=[];for(let r=0;r`${e}$`,GN=e=>WN.has(e)?F2(e):e,KN=e=>HN.has(e)?F2(e):e,qN=class{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=VN(e)}addField(e){tt(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let t=0;tnew UN(e,t=>XN(t)),e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=Si(t.T,t.L);break}}}),lu={};nt(lu,{Channel:()=>zs,ChannelSettings:()=>Nm,Channel_Role:()=>$2,ModuleSettings:()=>B2});var Nm=W.makeMessageType("meshtastic.ChannelSettings",()=>[{no:1,name:"channel_num",kind:"scalar",T:13},{no:2,name:"psk",kind:"scalar",T:12},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"id",kind:"scalar",T:7},{no:5,name:"uplink_enabled",kind:"scalar",T:8},{no:6,name:"downlink_enabled",kind:"scalar",T:8},{no:7,name:"module_settings",kind:"message",T:B2}]),B2=W.makeMessageType("meshtastic.ModuleSettings",()=>[{no:1,name:"position_precision",kind:"scalar",T:13},{no:2,name:"is_client_muted",kind:"scalar",T:8}]),zs=W.makeMessageType("meshtastic.Channel",()=>[{no:1,name:"index",kind:"scalar",T:5},{no:2,name:"settings",kind:"message",T:Nm},{no:3,name:"role",kind:"enum",T:W.getEnumType($2)}]),$2=W.makeEnum("meshtastic.Channel.Role",[{no:0,name:"DISABLED"},{no:1,name:"PRIMARY"},{no:2,name:"SECONDARY"}]),it={};nt(it,{ChunkedPayload:()=>lP,ChunkedPayloadResponse:()=>cP,ClientNotification:()=>y_,Compressed:()=>iP,Constants:()=>eP,CriticalErrorCode:()=>tP,Data:()=>f_,DeviceMetadata:()=>ih,FileInfo:()=>b_,FromRadio:()=>oP,HardwareModel:()=>ll,Heartbeat:()=>__,LogRecord:()=>g_,LogRecord_Level:()=>ah,MeshPacket:()=>Go,MeshPacket_Delayed:()=>m_,MeshPacket_Priority:()=>p_,MqttClientProxyMessage:()=>rh,MyNodeInfo:()=>oh,Neighbor:()=>w_,NeighborInfo:()=>sP,NodeInfo:()=>h_,NodeRemoteHardwarePin:()=>sh,Position:()=>th,Position_AltSource:()=>u_,Position_LocSource:()=>nh,QueueStatus:()=>v_,RouteDiscovery:()=>X0,Routing:()=>nP,Routing_Error:()=>d_,ToRadio:()=>aP,User:()=>Hs,Waypoint:()=>rP,resend_chunks:()=>x_});var U2={};nt(U2,{Config:()=>cu,Config_BluetoothConfig:()=>Lm,Config_BluetoothConfig_PairingMode:()=>Q2,Config_DeviceConfig:()=>Pm,Config_DeviceConfig_RebroadcastMode:()=>V2,Config_DeviceConfig_Role:()=>Di,Config_DisplayConfig:()=>Im,Config_DisplayConfig_CompassOrientation:()=>Y2,Config_DisplayConfig_DisplayMode:()=>X2,Config_DisplayConfig_DisplayUnits:()=>K2,Config_DisplayConfig_GpsCoordinateFormat:()=>G2,Config_DisplayConfig_OledType:()=>q2,Config_LoRaConfig:()=>td,Config_LoRaConfig_ModemPreset:()=>Dm,Config_LoRaConfig_RegionCode:()=>Om,Config_NetworkConfig:()=>Rm,Config_NetworkConfig_AddressMode:()=>H2,Config_NetworkConfig_IpV4Config:()=>W2,Config_PositionConfig:()=>Mm,Config_PositionConfig_GpsMode:()=>z2,Config_PositionConfig_PositionFlags:()=>YN,Config_PowerConfig:()=>Am,Config_SecurityConfig:()=>jm,Config_SessionkeyConfig:()=>Z2});var cu=W.makeMessageType("meshtastic.Config",()=>[{no:1,name:"device",kind:"message",T:Pm,oneof:"payload_variant"},{no:2,name:"position",kind:"message",T:Mm,oneof:"payload_variant"},{no:3,name:"power",kind:"message",T:Am,oneof:"payload_variant"},{no:4,name:"network",kind:"message",T:Rm,oneof:"payload_variant"},{no:5,name:"display",kind:"message",T:Im,oneof:"payload_variant"},{no:6,name:"lora",kind:"message",T:td,oneof:"payload_variant"},{no:7,name:"bluetooth",kind:"message",T:Lm,oneof:"payload_variant"},{no:8,name:"security",kind:"message",T:jm,oneof:"payload_variant"},{no:9,name:"sessionkey",kind:"message",T:Z2,oneof:"payload_variant"}]),Pm=W.makeMessageType("meshtastic.Config.DeviceConfig",()=>[{no:1,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:2,name:"serial_enabled",kind:"scalar",T:8},{no:4,name:"button_gpio",kind:"scalar",T:13},{no:5,name:"buzzer_gpio",kind:"scalar",T:13},{no:6,name:"rebroadcast_mode",kind:"enum",T:W.getEnumType(V2)},{no:7,name:"node_info_broadcast_secs",kind:"scalar",T:13},{no:8,name:"double_tap_as_button_press",kind:"scalar",T:8},{no:9,name:"is_managed",kind:"scalar",T:8},{no:10,name:"disable_triple_click",kind:"scalar",T:8},{no:11,name:"tzdef",kind:"scalar",T:9},{no:12,name:"led_heartbeat_disabled",kind:"scalar",T:8}],{localName:"Config_DeviceConfig"}),Di=W.makeEnum("meshtastic.Config.DeviceConfig.Role",[{no:0,name:"CLIENT"},{no:1,name:"CLIENT_MUTE"},{no:2,name:"ROUTER"},{no:3,name:"ROUTER_CLIENT"},{no:4,name:"REPEATER"},{no:5,name:"TRACKER"},{no:6,name:"SENSOR"},{no:7,name:"TAK"},{no:8,name:"CLIENT_HIDDEN"},{no:9,name:"LOST_AND_FOUND"},{no:10,name:"TAK_TRACKER"}]),V2=W.makeEnum("meshtastic.Config.DeviceConfig.RebroadcastMode",[{no:0,name:"ALL"},{no:1,name:"ALL_SKIP_DECODING"},{no:2,name:"LOCAL_ONLY"},{no:3,name:"KNOWN_ONLY"}]),Mm=W.makeMessageType("meshtastic.Config.PositionConfig",()=>[{no:1,name:"position_broadcast_secs",kind:"scalar",T:13},{no:2,name:"position_broadcast_smart_enabled",kind:"scalar",T:8},{no:3,name:"fixed_position",kind:"scalar",T:8},{no:4,name:"gps_enabled",kind:"scalar",T:8},{no:5,name:"gps_update_interval",kind:"scalar",T:13},{no:6,name:"gps_attempt_time",kind:"scalar",T:13},{no:7,name:"position_flags",kind:"scalar",T:13},{no:8,name:"rx_gpio",kind:"scalar",T:13},{no:9,name:"tx_gpio",kind:"scalar",T:13},{no:10,name:"broadcast_smart_minimum_distance",kind:"scalar",T:13},{no:11,name:"broadcast_smart_minimum_interval_secs",kind:"scalar",T:13},{no:12,name:"gps_en_gpio",kind:"scalar",T:13},{no:13,name:"gps_mode",kind:"enum",T:W.getEnumType(z2)}],{localName:"Config_PositionConfig"}),YN=W.makeEnum("meshtastic.Config.PositionConfig.PositionFlags",[{no:0,name:"UNSET"},{no:1,name:"ALTITUDE"},{no:2,name:"ALTITUDE_MSL"},{no:4,name:"GEOIDAL_SEPARATION"},{no:8,name:"DOP"},{no:16,name:"HVDOP"},{no:32,name:"SATINVIEW"},{no:64,name:"SEQ_NO"},{no:128,name:"TIMESTAMP"},{no:256,name:"HEADING"},{no:512,name:"SPEED"}]),z2=W.makeEnum("meshtastic.Config.PositionConfig.GpsMode",[{no:0,name:"DISABLED"},{no:1,name:"ENABLED"},{no:2,name:"NOT_PRESENT"}]),Am=W.makeMessageType("meshtastic.Config.PowerConfig",()=>[{no:1,name:"is_power_saving",kind:"scalar",T:8},{no:2,name:"on_battery_shutdown_after_secs",kind:"scalar",T:13},{no:3,name:"adc_multiplier_override",kind:"scalar",T:2},{no:4,name:"wait_bluetooth_secs",kind:"scalar",T:13},{no:6,name:"sds_secs",kind:"scalar",T:13},{no:7,name:"ls_secs",kind:"scalar",T:13},{no:8,name:"min_wake_secs",kind:"scalar",T:13},{no:9,name:"device_battery_ina_address",kind:"scalar",T:13},{no:32,name:"powermon_enables",kind:"scalar",T:4}],{localName:"Config_PowerConfig"}),Rm=W.makeMessageType("meshtastic.Config.NetworkConfig",()=>[{no:1,name:"wifi_enabled",kind:"scalar",T:8},{no:3,name:"wifi_ssid",kind:"scalar",T:9},{no:4,name:"wifi_psk",kind:"scalar",T:9},{no:5,name:"ntp_server",kind:"scalar",T:9},{no:6,name:"eth_enabled",kind:"scalar",T:8},{no:7,name:"address_mode",kind:"enum",T:W.getEnumType(H2)},{no:8,name:"ipv4_config",kind:"message",T:W2},{no:9,name:"rsyslog_server",kind:"scalar",T:9}],{localName:"Config_NetworkConfig"}),H2=W.makeEnum("meshtastic.Config.NetworkConfig.AddressMode",[{no:0,name:"DHCP"},{no:1,name:"STATIC"}]),W2=W.makeMessageType("meshtastic.Config.NetworkConfig.IpV4Config",()=>[{no:1,name:"ip",kind:"scalar",T:7},{no:2,name:"gateway",kind:"scalar",T:7},{no:3,name:"subnet",kind:"scalar",T:7},{no:4,name:"dns",kind:"scalar",T:7}],{localName:"Config_NetworkConfig_IpV4Config"}),Im=W.makeMessageType("meshtastic.Config.DisplayConfig",()=>[{no:1,name:"screen_on_secs",kind:"scalar",T:13},{no:2,name:"gps_format",kind:"enum",T:W.getEnumType(G2)},{no:3,name:"auto_screen_carousel_secs",kind:"scalar",T:13},{no:4,name:"compass_north_top",kind:"scalar",T:8},{no:5,name:"flip_screen",kind:"scalar",T:8},{no:6,name:"units",kind:"enum",T:W.getEnumType(K2)},{no:7,name:"oled",kind:"enum",T:W.getEnumType(q2)},{no:8,name:"displaymode",kind:"enum",T:W.getEnumType(X2)},{no:9,name:"heading_bold",kind:"scalar",T:8},{no:10,name:"wake_on_tap_or_motion",kind:"scalar",T:8},{no:11,name:"compass_orientation",kind:"enum",T:W.getEnumType(Y2)}],{localName:"Config_DisplayConfig"}),G2=W.makeEnum("meshtastic.Config.DisplayConfig.GpsCoordinateFormat",[{no:0,name:"DEC"},{no:1,name:"DMS"},{no:2,name:"UTM"},{no:3,name:"MGRS"},{no:4,name:"OLC"},{no:5,name:"OSGR"}]),K2=W.makeEnum("meshtastic.Config.DisplayConfig.DisplayUnits",[{no:0,name:"METRIC"},{no:1,name:"IMPERIAL"}]),q2=W.makeEnum("meshtastic.Config.DisplayConfig.OledType",[{no:0,name:"OLED_AUTO"},{no:1,name:"OLED_SSD1306"},{no:2,name:"OLED_SH1106"},{no:3,name:"OLED_SH1107"}]),X2=W.makeEnum("meshtastic.Config.DisplayConfig.DisplayMode",[{no:0,name:"DEFAULT"},{no:1,name:"TWOCOLOR"},{no:2,name:"INVERTED"},{no:3,name:"COLOR"}]),Y2=W.makeEnum("meshtastic.Config.DisplayConfig.CompassOrientation",[{no:0,name:"DEGREES_0"},{no:1,name:"DEGREES_90"},{no:2,name:"DEGREES_180"},{no:3,name:"DEGREES_270"},{no:4,name:"DEGREES_0_INVERTED"},{no:5,name:"DEGREES_90_INVERTED"},{no:6,name:"DEGREES_180_INVERTED"},{no:7,name:"DEGREES_270_INVERTED"}]),td=W.makeMessageType("meshtastic.Config.LoRaConfig",()=>[{no:1,name:"use_preset",kind:"scalar",T:8},{no:2,name:"modem_preset",kind:"enum",T:W.getEnumType(Dm)},{no:3,name:"bandwidth",kind:"scalar",T:13},{no:4,name:"spread_factor",kind:"scalar",T:13},{no:5,name:"coding_rate",kind:"scalar",T:13},{no:6,name:"frequency_offset",kind:"scalar",T:2},{no:7,name:"region",kind:"enum",T:W.getEnumType(Om)},{no:8,name:"hop_limit",kind:"scalar",T:13},{no:9,name:"tx_enabled",kind:"scalar",T:8},{no:10,name:"tx_power",kind:"scalar",T:5},{no:11,name:"channel_num",kind:"scalar",T:13},{no:12,name:"override_duty_cycle",kind:"scalar",T:8},{no:13,name:"sx126x_rx_boosted_gain",kind:"scalar",T:8},{no:14,name:"override_frequency",kind:"scalar",T:2},{no:15,name:"pa_fan_disabled",kind:"scalar",T:8},{no:103,name:"ignore_incoming",kind:"scalar",T:13,repeated:!0},{no:104,name:"ignore_mqtt",kind:"scalar",T:8},{no:105,name:"config_ok_to_mqtt",kind:"scalar",T:8}],{localName:"Config_LoRaConfig"}),Om=W.makeEnum("meshtastic.Config.LoRaConfig.RegionCode",[{no:0,name:"UNSET"},{no:1,name:"US"},{no:2,name:"EU_433"},{no:3,name:"EU_868"},{no:4,name:"CN"},{no:5,name:"JP"},{no:6,name:"ANZ"},{no:7,name:"KR"},{no:8,name:"TW"},{no:9,name:"RU"},{no:10,name:"IN"},{no:11,name:"NZ_865"},{no:12,name:"TH"},{no:13,name:"LORA_24"},{no:14,name:"UA_433"},{no:15,name:"UA_868"},{no:16,name:"MY_433"},{no:17,name:"MY_919"},{no:18,name:"SG_923"}]),Dm=W.makeEnum("meshtastic.Config.LoRaConfig.ModemPreset",[{no:0,name:"LONG_FAST"},{no:1,name:"LONG_SLOW"},{no:2,name:"VERY_LONG_SLOW"},{no:3,name:"MEDIUM_SLOW"},{no:4,name:"MEDIUM_FAST"},{no:5,name:"SHORT_SLOW"},{no:6,name:"SHORT_FAST"},{no:7,name:"LONG_MODERATE"},{no:8,name:"SHORT_TURBO"}]),Lm=W.makeMessageType("meshtastic.Config.BluetoothConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"mode",kind:"enum",T:W.getEnumType(Q2)},{no:3,name:"fixed_pin",kind:"scalar",T:13}],{localName:"Config_BluetoothConfig"}),Q2=W.makeEnum("meshtastic.Config.BluetoothConfig.PairingMode",[{no:0,name:"RANDOM_PIN"},{no:1,name:"FIXED_PIN"},{no:2,name:"NO_PIN"}]),jm=W.makeMessageType("meshtastic.Config.SecurityConfig",()=>[{no:1,name:"public_key",kind:"scalar",T:12},{no:2,name:"private_key",kind:"scalar",T:12},{no:3,name:"admin_key",kind:"scalar",T:12,repeated:!0},{no:4,name:"is_managed",kind:"scalar",T:8},{no:5,name:"serial_enabled",kind:"scalar",T:8},{no:6,name:"debug_log_api_enabled",kind:"scalar",T:8},{no:8,name:"admin_channel_enabled",kind:"scalar",T:8}],{localName:"Config_SecurityConfig"}),Z2=W.makeMessageType("meshtastic.Config.SessionkeyConfig",[],{localName:"Config_SessionkeyConfig"}),be={};nt(be,{PortNum:()=>Fm});var Fm=W.makeEnum("meshtastic.PortNum",[{no:0,name:"UNKNOWN_APP"},{no:1,name:"TEXT_MESSAGE_APP"},{no:2,name:"REMOTE_HARDWARE_APP"},{no:3,name:"POSITION_APP"},{no:4,name:"NODEINFO_APP"},{no:5,name:"ROUTING_APP"},{no:6,name:"ADMIN_APP"},{no:7,name:"TEXT_MESSAGE_COMPRESSED_APP"},{no:8,name:"WAYPOINT_APP"},{no:9,name:"AUDIO_APP"},{no:10,name:"DETECTION_SENSOR_APP"},{no:32,name:"REPLY_APP"},{no:33,name:"IP_TUNNEL_APP"},{no:34,name:"PAXCOUNTER_APP"},{no:64,name:"SERIAL_APP"},{no:65,name:"STORE_FORWARD_APP"},{no:66,name:"RANGE_TEST_APP"},{no:67,name:"TELEMETRY_APP"},{no:68,name:"ZPS_APP"},{no:69,name:"SIMULATOR_APP"},{no:70,name:"TRACEROUTE_APP"},{no:71,name:"NEIGHBORINFO_APP"},{no:72,name:"ATAK_PLUGIN"},{no:73,name:"MAP_REPORT_APP"},{no:74,name:"POWERSTRESS_APP"},{no:256,name:"PRIVATE_APP"},{no:257,name:"ATAK_FORWARDER"},{no:511,name:"MAX"}]),Bm={};nt(Bm,{AirQualityMetrics:()=>t_,DeviceMetrics:()=>nd,EnvironmentMetrics:()=>J2,LocalStats:()=>n_,Nau7802Config:()=>JN,PowerMetrics:()=>e_,Telemetry:()=>ZN,TelemetrySensorType:()=>QN});var QN=W.makeEnum("meshtastic.TelemetrySensorType",[{no:0,name:"SENSOR_UNSET"},{no:1,name:"BME280"},{no:2,name:"BME680"},{no:3,name:"MCP9808"},{no:4,name:"INA260"},{no:5,name:"INA219"},{no:6,name:"BMP280"},{no:7,name:"SHTC3"},{no:8,name:"LPS22"},{no:9,name:"QMC6310"},{no:10,name:"QMI8658"},{no:11,name:"QMC5883L"},{no:12,name:"SHT31"},{no:13,name:"PMSA003I"},{no:14,name:"INA3221"},{no:15,name:"BMP085"},{no:16,name:"RCWL9620"},{no:17,name:"SHT4X"},{no:18,name:"VEML7700"},{no:19,name:"MLX90632"},{no:20,name:"OPT3001"},{no:21,name:"LTR390UV"},{no:22,name:"TSL25911FN"},{no:23,name:"AHT10"},{no:24,name:"DFROBOT_LARK"},{no:25,name:"NAU7802"},{no:26,name:"BMP3XX"},{no:27,name:"ICM20948"},{no:28,name:"MAX17048"},{no:29,name:"CUSTOM_SENSOR"}]),nd=W.makeMessageType("meshtastic.DeviceMetrics",()=>[{no:1,name:"battery_level",kind:"scalar",T:13,opt:!0},{no:2,name:"voltage",kind:"scalar",T:2,opt:!0},{no:3,name:"channel_utilization",kind:"scalar",T:2,opt:!0},{no:4,name:"air_util_tx",kind:"scalar",T:2,opt:!0},{no:5,name:"uptime_seconds",kind:"scalar",T:13,opt:!0}]),J2=W.makeMessageType("meshtastic.EnvironmentMetrics",()=>[{no:1,name:"temperature",kind:"scalar",T:2,opt:!0},{no:2,name:"relative_humidity",kind:"scalar",T:2,opt:!0},{no:3,name:"barometric_pressure",kind:"scalar",T:2,opt:!0},{no:4,name:"gas_resistance",kind:"scalar",T:2,opt:!0},{no:5,name:"voltage",kind:"scalar",T:2,opt:!0},{no:6,name:"current",kind:"scalar",T:2,opt:!0},{no:7,name:"iaq",kind:"scalar",T:13,opt:!0},{no:8,name:"distance",kind:"scalar",T:2,opt:!0},{no:9,name:"lux",kind:"scalar",T:2,opt:!0},{no:10,name:"white_lux",kind:"scalar",T:2,opt:!0},{no:11,name:"ir_lux",kind:"scalar",T:2,opt:!0},{no:12,name:"uv_lux",kind:"scalar",T:2,opt:!0},{no:13,name:"wind_direction",kind:"scalar",T:13,opt:!0},{no:14,name:"wind_speed",kind:"scalar",T:2,opt:!0},{no:15,name:"weight",kind:"scalar",T:2,opt:!0},{no:16,name:"wind_gust",kind:"scalar",T:2,opt:!0},{no:17,name:"wind_lull",kind:"scalar",T:2,opt:!0}]),e_=W.makeMessageType("meshtastic.PowerMetrics",()=>[{no:1,name:"ch1_voltage",kind:"scalar",T:2,opt:!0},{no:2,name:"ch1_current",kind:"scalar",T:2,opt:!0},{no:3,name:"ch2_voltage",kind:"scalar",T:2,opt:!0},{no:4,name:"ch2_current",kind:"scalar",T:2,opt:!0},{no:5,name:"ch3_voltage",kind:"scalar",T:2,opt:!0},{no:6,name:"ch3_current",kind:"scalar",T:2,opt:!0}]),t_=W.makeMessageType("meshtastic.AirQualityMetrics",()=>[{no:1,name:"pm10_standard",kind:"scalar",T:13,opt:!0},{no:2,name:"pm25_standard",kind:"scalar",T:13,opt:!0},{no:3,name:"pm100_standard",kind:"scalar",T:13,opt:!0},{no:4,name:"pm10_environmental",kind:"scalar",T:13,opt:!0},{no:5,name:"pm25_environmental",kind:"scalar",T:13,opt:!0},{no:6,name:"pm100_environmental",kind:"scalar",T:13,opt:!0},{no:7,name:"particles_03um",kind:"scalar",T:13,opt:!0},{no:8,name:"particles_05um",kind:"scalar",T:13,opt:!0},{no:9,name:"particles_10um",kind:"scalar",T:13,opt:!0},{no:10,name:"particles_25um",kind:"scalar",T:13,opt:!0},{no:11,name:"particles_50um",kind:"scalar",T:13,opt:!0},{no:12,name:"particles_100um",kind:"scalar",T:13,opt:!0}]),n_=W.makeMessageType("meshtastic.LocalStats",()=>[{no:1,name:"uptime_seconds",kind:"scalar",T:13},{no:2,name:"channel_utilization",kind:"scalar",T:2},{no:3,name:"air_util_tx",kind:"scalar",T:2},{no:4,name:"num_packets_tx",kind:"scalar",T:13},{no:5,name:"num_packets_rx",kind:"scalar",T:13},{no:6,name:"num_packets_rx_bad",kind:"scalar",T:13},{no:7,name:"num_online_nodes",kind:"scalar",T:13},{no:8,name:"num_total_nodes",kind:"scalar",T:13}]),ZN=W.makeMessageType("meshtastic.Telemetry",()=>[{no:1,name:"time",kind:"scalar",T:7},{no:2,name:"device_metrics",kind:"message",T:nd,oneof:"variant"},{no:3,name:"environment_metrics",kind:"message",T:J2,oneof:"variant"},{no:4,name:"air_quality_metrics",kind:"message",T:t_,oneof:"variant"},{no:5,name:"power_metrics",kind:"message",T:e_,oneof:"variant"},{no:6,name:"local_stats",kind:"message",T:n_,oneof:"variant"}]),JN=W.makeMessageType("meshtastic.Nau7802Config",()=>[{no:1,name:"zeroOffset",kind:"scalar",T:5},{no:2,name:"calibrationFactor",kind:"scalar",T:2}]),r_={};nt(r_,{ModuleConfig:()=>uu,ModuleConfig_AmbientLightingConfig:()=>Zm,ModuleConfig_AudioConfig:()=>Hm,ModuleConfig_AudioConfig_Audio_Baud:()=>i_,ModuleConfig_CannedMessageConfig:()=>Qm,ModuleConfig_CannedMessageConfig_InputEventChar:()=>Sc,ModuleConfig_DetectionSensorConfig:()=>zm,ModuleConfig_ExternalNotificationConfig:()=>Km,ModuleConfig_MQTTConfig:()=>$m,ModuleConfig_MapReportSettings:()=>a_,ModuleConfig_NeighborInfoConfig:()=>Vm,ModuleConfig_PaxcounterConfig:()=>Wm,ModuleConfig_RangeTestConfig:()=>Xm,ModuleConfig_RemoteHardwareConfig:()=>Um,ModuleConfig_SerialConfig:()=>Gm,ModuleConfig_SerialConfig_Serial_Baud:()=>s_,ModuleConfig_SerialConfig_Serial_Mode:()=>l_,ModuleConfig_StoreForwardConfig:()=>qm,ModuleConfig_TelemetryConfig:()=>Ym,RemoteHardwarePin:()=>Jm,RemoteHardwarePinType:()=>o_});var o_=W.makeEnum("meshtastic.RemoteHardwarePinType",[{no:0,name:"UNKNOWN"},{no:1,name:"DIGITAL_READ"},{no:2,name:"DIGITAL_WRITE"}]),uu=W.makeMessageType("meshtastic.ModuleConfig",()=>[{no:1,name:"mqtt",kind:"message",T:$m,oneof:"payload_variant"},{no:2,name:"serial",kind:"message",T:Gm,oneof:"payload_variant"},{no:3,name:"external_notification",kind:"message",T:Km,oneof:"payload_variant"},{no:4,name:"store_forward",kind:"message",T:qm,oneof:"payload_variant"},{no:5,name:"range_test",kind:"message",T:Xm,oneof:"payload_variant"},{no:6,name:"telemetry",kind:"message",T:Ym,oneof:"payload_variant"},{no:7,name:"canned_message",kind:"message",T:Qm,oneof:"payload_variant"},{no:8,name:"audio",kind:"message",T:Hm,oneof:"payload_variant"},{no:9,name:"remote_hardware",kind:"message",T:Um,oneof:"payload_variant"},{no:10,name:"neighbor_info",kind:"message",T:Vm,oneof:"payload_variant"},{no:11,name:"ambient_lighting",kind:"message",T:Zm,oneof:"payload_variant"},{no:12,name:"detection_sensor",kind:"message",T:zm,oneof:"payload_variant"},{no:13,name:"paxcounter",kind:"message",T:Wm,oneof:"payload_variant"}]),$m=W.makeMessageType("meshtastic.ModuleConfig.MQTTConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"address",kind:"scalar",T:9},{no:3,name:"username",kind:"scalar",T:9},{no:4,name:"password",kind:"scalar",T:9},{no:5,name:"encryption_enabled",kind:"scalar",T:8},{no:6,name:"json_enabled",kind:"scalar",T:8},{no:7,name:"tls_enabled",kind:"scalar",T:8},{no:8,name:"root",kind:"scalar",T:9},{no:9,name:"proxy_to_client_enabled",kind:"scalar",T:8},{no:10,name:"map_reporting_enabled",kind:"scalar",T:8},{no:11,name:"map_report_settings",kind:"message",T:a_}],{localName:"ModuleConfig_MQTTConfig"}),a_=W.makeMessageType("meshtastic.ModuleConfig.MapReportSettings",()=>[{no:1,name:"publish_interval_secs",kind:"scalar",T:13},{no:2,name:"position_precision",kind:"scalar",T:13}],{localName:"ModuleConfig_MapReportSettings"}),Um=W.makeMessageType("meshtastic.ModuleConfig.RemoteHardwareConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"allow_undefined_pin_access",kind:"scalar",T:8},{no:3,name:"available_pins",kind:"message",T:Jm,repeated:!0}],{localName:"ModuleConfig_RemoteHardwareConfig"}),Vm=W.makeMessageType("meshtastic.ModuleConfig.NeighborInfoConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"update_interval",kind:"scalar",T:13}],{localName:"ModuleConfig_NeighborInfoConfig"}),zm=W.makeMessageType("meshtastic.ModuleConfig.DetectionSensorConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"minimum_broadcast_secs",kind:"scalar",T:13},{no:3,name:"state_broadcast_secs",kind:"scalar",T:13},{no:4,name:"send_bell",kind:"scalar",T:8},{no:5,name:"name",kind:"scalar",T:9},{no:6,name:"monitor_pin",kind:"scalar",T:13},{no:7,name:"detection_triggered_high",kind:"scalar",T:8},{no:8,name:"use_pullup",kind:"scalar",T:8}],{localName:"ModuleConfig_DetectionSensorConfig"}),Hm=W.makeMessageType("meshtastic.ModuleConfig.AudioConfig",()=>[{no:1,name:"codec2_enabled",kind:"scalar",T:8},{no:2,name:"ptt_pin",kind:"scalar",T:13},{no:3,name:"bitrate",kind:"enum",T:W.getEnumType(i_)},{no:4,name:"i2s_ws",kind:"scalar",T:13},{no:5,name:"i2s_sd",kind:"scalar",T:13},{no:6,name:"i2s_din",kind:"scalar",T:13},{no:7,name:"i2s_sck",kind:"scalar",T:13}],{localName:"ModuleConfig_AudioConfig"}),i_=W.makeEnum("meshtastic.ModuleConfig.AudioConfig.Audio_Baud",[{no:0,name:"CODEC2_DEFAULT"},{no:1,name:"CODEC2_3200"},{no:2,name:"CODEC2_2400"},{no:3,name:"CODEC2_1600"},{no:4,name:"CODEC2_1400"},{no:5,name:"CODEC2_1300"},{no:6,name:"CODEC2_1200"},{no:7,name:"CODEC2_700"},{no:8,name:"CODEC2_700B"}]),Wm=W.makeMessageType("meshtastic.ModuleConfig.PaxcounterConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"paxcounter_update_interval",kind:"scalar",T:13},{no:3,name:"wifi_threshold",kind:"scalar",T:5},{no:4,name:"ble_threshold",kind:"scalar",T:5}],{localName:"ModuleConfig_PaxcounterConfig"}),Gm=W.makeMessageType("meshtastic.ModuleConfig.SerialConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"echo",kind:"scalar",T:8},{no:3,name:"rxd",kind:"scalar",T:13},{no:4,name:"txd",kind:"scalar",T:13},{no:5,name:"baud",kind:"enum",T:W.getEnumType(s_)},{no:6,name:"timeout",kind:"scalar",T:13},{no:7,name:"mode",kind:"enum",T:W.getEnumType(l_)},{no:8,name:"override_console_serial_port",kind:"scalar",T:8}],{localName:"ModuleConfig_SerialConfig"}),s_=W.makeEnum("meshtastic.ModuleConfig.SerialConfig.Serial_Baud",[{no:0,name:"BAUD_DEFAULT"},{no:1,name:"BAUD_110"},{no:2,name:"BAUD_300"},{no:3,name:"BAUD_600"},{no:4,name:"BAUD_1200"},{no:5,name:"BAUD_2400"},{no:6,name:"BAUD_4800"},{no:7,name:"BAUD_9600"},{no:8,name:"BAUD_19200"},{no:9,name:"BAUD_38400"},{no:10,name:"BAUD_57600"},{no:11,name:"BAUD_115200"},{no:12,name:"BAUD_230400"},{no:13,name:"BAUD_460800"},{no:14,name:"BAUD_576000"},{no:15,name:"BAUD_921600"}]),l_=W.makeEnum("meshtastic.ModuleConfig.SerialConfig.Serial_Mode",[{no:0,name:"DEFAULT"},{no:1,name:"SIMPLE"},{no:2,name:"PROTO"},{no:3,name:"TEXTMSG"},{no:4,name:"NMEA"},{no:5,name:"CALTOPO"},{no:6,name:"WS85"}]),Km=W.makeMessageType("meshtastic.ModuleConfig.ExternalNotificationConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"output_ms",kind:"scalar",T:13},{no:3,name:"output",kind:"scalar",T:13},{no:8,name:"output_vibra",kind:"scalar",T:13},{no:9,name:"output_buzzer",kind:"scalar",T:13},{no:4,name:"active",kind:"scalar",T:8},{no:5,name:"alert_message",kind:"scalar",T:8},{no:10,name:"alert_message_vibra",kind:"scalar",T:8},{no:11,name:"alert_message_buzzer",kind:"scalar",T:8},{no:6,name:"alert_bell",kind:"scalar",T:8},{no:12,name:"alert_bell_vibra",kind:"scalar",T:8},{no:13,name:"alert_bell_buzzer",kind:"scalar",T:8},{no:7,name:"use_pwm",kind:"scalar",T:8},{no:14,name:"nag_timeout",kind:"scalar",T:13},{no:15,name:"use_i2s_as_buzzer",kind:"scalar",T:8}],{localName:"ModuleConfig_ExternalNotificationConfig"}),qm=W.makeMessageType("meshtastic.ModuleConfig.StoreForwardConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"heartbeat",kind:"scalar",T:8},{no:3,name:"records",kind:"scalar",T:13},{no:4,name:"history_return_max",kind:"scalar",T:13},{no:5,name:"history_return_window",kind:"scalar",T:13},{no:6,name:"is_server",kind:"scalar",T:8}],{localName:"ModuleConfig_StoreForwardConfig"}),Xm=W.makeMessageType("meshtastic.ModuleConfig.RangeTestConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"sender",kind:"scalar",T:13},{no:3,name:"save",kind:"scalar",T:8}],{localName:"ModuleConfig_RangeTestConfig"}),Ym=W.makeMessageType("meshtastic.ModuleConfig.TelemetryConfig",()=>[{no:1,name:"device_update_interval",kind:"scalar",T:13},{no:2,name:"environment_update_interval",kind:"scalar",T:13},{no:3,name:"environment_measurement_enabled",kind:"scalar",T:8},{no:4,name:"environment_screen_enabled",kind:"scalar",T:8},{no:5,name:"environment_display_fahrenheit",kind:"scalar",T:8},{no:6,name:"air_quality_enabled",kind:"scalar",T:8},{no:7,name:"air_quality_interval",kind:"scalar",T:13},{no:8,name:"power_measurement_enabled",kind:"scalar",T:8},{no:9,name:"power_update_interval",kind:"scalar",T:13},{no:10,name:"power_screen_enabled",kind:"scalar",T:8}],{localName:"ModuleConfig_TelemetryConfig"}),Qm=W.makeMessageType("meshtastic.ModuleConfig.CannedMessageConfig",()=>[{no:1,name:"rotary1_enabled",kind:"scalar",T:8},{no:2,name:"inputbroker_pin_a",kind:"scalar",T:13},{no:3,name:"inputbroker_pin_b",kind:"scalar",T:13},{no:4,name:"inputbroker_pin_press",kind:"scalar",T:13},{no:5,name:"inputbroker_event_cw",kind:"enum",T:W.getEnumType(Sc)},{no:6,name:"inputbroker_event_ccw",kind:"enum",T:W.getEnumType(Sc)},{no:7,name:"inputbroker_event_press",kind:"enum",T:W.getEnumType(Sc)},{no:8,name:"updown1_enabled",kind:"scalar",T:8},{no:9,name:"enabled",kind:"scalar",T:8},{no:10,name:"allow_input_source",kind:"scalar",T:9},{no:11,name:"send_bell",kind:"scalar",T:8}],{localName:"ModuleConfig_CannedMessageConfig"}),Sc=W.makeEnum("meshtastic.ModuleConfig.CannedMessageConfig.InputEventChar",[{no:0,name:"NONE"},{no:17,name:"UP"},{no:18,name:"DOWN"},{no:19,name:"LEFT"},{no:20,name:"RIGHT"},{no:10,name:"SELECT"},{no:27,name:"BACK"},{no:24,name:"CANCEL"}]),Zm=W.makeMessageType("meshtastic.ModuleConfig.AmbientLightingConfig",()=>[{no:1,name:"led_state",kind:"scalar",T:8},{no:2,name:"current",kind:"scalar",T:13},{no:3,name:"red",kind:"scalar",T:13},{no:4,name:"green",kind:"scalar",T:13},{no:5,name:"blue",kind:"scalar",T:13}],{localName:"ModuleConfig_AmbientLightingConfig"}),Jm=W.makeMessageType("meshtastic.RemoteHardwarePin",()=>[{no:1,name:"gpio_pin",kind:"scalar",T:13},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:W.getEnumType(o_)}]),bt={};nt(bt,{XModem:()=>eh,XModem_Control:()=>c_});var eh=W.makeMessageType("meshtastic.XModem",()=>[{no:1,name:"control",kind:"enum",T:W.getEnumType(c_)},{no:2,name:"seq",kind:"scalar",T:13},{no:3,name:"crc16",kind:"scalar",T:13},{no:4,name:"buffer",kind:"scalar",T:12}]),c_=W.makeEnum("meshtastic.XModem.Control",[{no:0,name:"NUL"},{no:1,name:"SOH"},{no:2,name:"STX"},{no:4,name:"EOT"},{no:6,name:"ACK"},{no:21,name:"NAK"},{no:24,name:"CAN"},{no:26,name:"CTRLZ"}]),ll=W.makeEnum("meshtastic.HardwareModel",[{no:0,name:"UNSET"},{no:1,name:"TLORA_V2"},{no:2,name:"TLORA_V1"},{no:3,name:"TLORA_V2_1_1P6"},{no:4,name:"TBEAM"},{no:5,name:"HELTEC_V2_0"},{no:6,name:"TBEAM_V0P7"},{no:7,name:"T_ECHO"},{no:8,name:"TLORA_V1_1P3"},{no:9,name:"RAK4631"},{no:10,name:"HELTEC_V2_1"},{no:11,name:"HELTEC_V1"},{no:12,name:"LILYGO_TBEAM_S3_CORE"},{no:13,name:"RAK11200"},{no:14,name:"NANO_G1"},{no:15,name:"TLORA_V2_1_1P8"},{no:16,name:"TLORA_T3_S3"},{no:17,name:"NANO_G1_EXPLORER"},{no:18,name:"NANO_G2_ULTRA"},{no:19,name:"LORA_TYPE"},{no:20,name:"WIPHONE"},{no:21,name:"WIO_WM1110"},{no:22,name:"RAK2560"},{no:23,name:"HELTEC_HRU_3601"},{no:25,name:"STATION_G1"},{no:26,name:"RAK11310"},{no:27,name:"SENSELORA_RP2040"},{no:28,name:"SENSELORA_S3"},{no:29,name:"CANARYONE"},{no:30,name:"RP2040_LORA"},{no:31,name:"STATION_G2"},{no:32,name:"LORA_RELAY_V1"},{no:33,name:"NRF52840DK"},{no:34,name:"PPR"},{no:35,name:"GENIEBLOCKS"},{no:36,name:"NRF52_UNKNOWN"},{no:37,name:"PORTDUINO"},{no:38,name:"ANDROID_SIM"},{no:39,name:"DIY_V1"},{no:40,name:"NRF52840_PCA10059"},{no:41,name:"DR_DEV"},{no:42,name:"M5STACK"},{no:43,name:"HELTEC_V3"},{no:44,name:"HELTEC_WSL_V3"},{no:45,name:"BETAFPV_2400_TX"},{no:46,name:"BETAFPV_900_NANO_TX"},{no:47,name:"RPI_PICO"},{no:48,name:"HELTEC_WIRELESS_TRACKER"},{no:49,name:"HELTEC_WIRELESS_PAPER"},{no:50,name:"T_DECK"},{no:51,name:"T_WATCH_S3"},{no:52,name:"PICOMPUTER_S3"},{no:53,name:"HELTEC_HT62"},{no:54,name:"EBYTE_ESP32_S3"},{no:55,name:"ESP32_S3_PICO"},{no:56,name:"CHATTER_2"},{no:57,name:"HELTEC_WIRELESS_PAPER_V1_0"},{no:58,name:"HELTEC_WIRELESS_TRACKER_V1_0"},{no:59,name:"UNPHONE"},{no:60,name:"TD_LORAC"},{no:61,name:"CDEBYTE_EORA_S3"},{no:62,name:"TWC_MESH_V4"},{no:63,name:"NRF52_PROMICRO_DIY"},{no:64,name:"RADIOMASTER_900_BANDIT_NANO"},{no:65,name:"HELTEC_CAPSULE_SENSOR_V3"},{no:66,name:"HELTEC_VISION_MASTER_T190"},{no:67,name:"HELTEC_VISION_MASTER_E213"},{no:68,name:"HELTEC_VISION_MASTER_E290"},{no:69,name:"HELTEC_MESH_NODE_T114"},{no:70,name:"SENSECAP_INDICATOR"},{no:71,name:"TRACKER_T1000_E"},{no:72,name:"RAK3172"},{no:73,name:"WIO_E5"},{no:74,name:"RADIOMASTER_900_BANDIT"},{no:75,name:"ME25LS01_4Y10TD"},{no:76,name:"RP2040_FEATHER_RFM95"},{no:77,name:"M5STACK_COREBASIC"},{no:78,name:"M5STACK_CORE2"},{no:255,name:"PRIVATE_HW"}]),eP=W.makeEnum("meshtastic.Constants",[{no:0,name:"ZERO"},{no:237,name:"DATA_PAYLOAD_LEN"}]),tP=W.makeEnum("meshtastic.CriticalErrorCode",[{no:0,name:"NONE"},{no:1,name:"TX_WATCHDOG"},{no:2,name:"SLEEP_ENTER_WAIT"},{no:3,name:"NO_RADIO"},{no:4,name:"UNSPECIFIED"},{no:5,name:"UBLOX_UNIT_FAILED"},{no:6,name:"NO_AXP192"},{no:7,name:"INVALID_RADIO_SETTING"},{no:8,name:"TRANSMIT_FAILED"},{no:9,name:"BROWNOUT"},{no:10,name:"SX1262_FAILURE"},{no:11,name:"RADIO_SPI_BUG"},{no:12,name:"FLASH_CORRUPTION_RECOVERABLE"},{no:13,name:"FLASH_CORRUPTION_UNRECOVERABLE"}]),th=W.makeMessageType("meshtastic.Position",()=>[{no:1,name:"latitude_i",kind:"scalar",T:15,opt:!0},{no:2,name:"longitude_i",kind:"scalar",T:15,opt:!0},{no:3,name:"altitude",kind:"scalar",T:5,opt:!0},{no:4,name:"time",kind:"scalar",T:7},{no:5,name:"location_source",kind:"enum",T:W.getEnumType(nh)},{no:6,name:"altitude_source",kind:"enum",T:W.getEnumType(u_)},{no:7,name:"timestamp",kind:"scalar",T:7},{no:8,name:"timestamp_millis_adjust",kind:"scalar",T:5},{no:9,name:"altitude_hae",kind:"scalar",T:17,opt:!0},{no:10,name:"altitude_geoidal_separation",kind:"scalar",T:17,opt:!0},{no:11,name:"PDOP",kind:"scalar",T:13},{no:12,name:"HDOP",kind:"scalar",T:13},{no:13,name:"VDOP",kind:"scalar",T:13},{no:14,name:"gps_accuracy",kind:"scalar",T:13},{no:15,name:"ground_speed",kind:"scalar",T:13,opt:!0},{no:16,name:"ground_track",kind:"scalar",T:13,opt:!0},{no:17,name:"fix_quality",kind:"scalar",T:13},{no:18,name:"fix_type",kind:"scalar",T:13},{no:19,name:"sats_in_view",kind:"scalar",T:13},{no:20,name:"sensor_id",kind:"scalar",T:13},{no:21,name:"next_update",kind:"scalar",T:13},{no:22,name:"seq_number",kind:"scalar",T:13},{no:23,name:"precision_bits",kind:"scalar",T:13}]),nh=W.makeEnum("meshtastic.Position.LocSource",[{no:0,name:"LOC_UNSET"},{no:1,name:"LOC_MANUAL"},{no:2,name:"LOC_INTERNAL"},{no:3,name:"LOC_EXTERNAL"}]),u_=W.makeEnum("meshtastic.Position.AltSource",[{no:0,name:"ALT_UNSET"},{no:1,name:"ALT_MANUAL"},{no:2,name:"ALT_INTERNAL"},{no:3,name:"ALT_EXTERNAL"},{no:4,name:"ALT_BAROMETRIC"}]),Hs=W.makeMessageType("meshtastic.User",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"long_name",kind:"scalar",T:9},{no:3,name:"short_name",kind:"scalar",T:9},{no:4,name:"macaddr",kind:"scalar",T:12},{no:5,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:6,name:"is_licensed",kind:"scalar",T:8},{no:7,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:8,name:"public_key",kind:"scalar",T:12}]),X0=W.makeMessageType("meshtastic.RouteDiscovery",()=>[{no:1,name:"route",kind:"scalar",T:7,repeated:!0},{no:2,name:"snr_towards",kind:"scalar",T:5,repeated:!0},{no:3,name:"route_back",kind:"scalar",T:7,repeated:!0},{no:4,name:"snr_back",kind:"scalar",T:5,repeated:!0}]),nP=W.makeMessageType("meshtastic.Routing",()=>[{no:1,name:"route_request",kind:"message",T:X0,oneof:"variant"},{no:2,name:"route_reply",kind:"message",T:X0,oneof:"variant"},{no:3,name:"error_reason",kind:"enum",T:W.getEnumType(d_),oneof:"variant"}]),d_=W.makeEnum("meshtastic.Routing.Error",[{no:0,name:"NONE"},{no:1,name:"NO_ROUTE"},{no:2,name:"GOT_NAK"},{no:3,name:"TIMEOUT"},{no:4,name:"NO_INTERFACE"},{no:5,name:"MAX_RETRANSMIT"},{no:6,name:"NO_CHANNEL"},{no:7,name:"TOO_LARGE"},{no:8,name:"NO_RESPONSE"},{no:9,name:"DUTY_CYCLE_LIMIT"},{no:32,name:"BAD_REQUEST"},{no:33,name:"NOT_AUTHORIZED"},{no:34,name:"PKI_FAILED"},{no:35,name:"PKI_UNKNOWN_PUBKEY"}]),f_=W.makeMessageType("meshtastic.Data",()=>[{no:1,name:"portnum",kind:"enum",T:W.getEnumType(Fm)},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"want_response",kind:"scalar",T:8},{no:4,name:"dest",kind:"scalar",T:7},{no:5,name:"source",kind:"scalar",T:7},{no:6,name:"request_id",kind:"scalar",T:7},{no:7,name:"reply_id",kind:"scalar",T:7},{no:8,name:"emoji",kind:"scalar",T:7},{no:9,name:"bitfield",kind:"scalar",T:13,opt:!0}]),rP=W.makeMessageType("meshtastic.Waypoint",()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"latitude_i",kind:"scalar",T:15,opt:!0},{no:3,name:"longitude_i",kind:"scalar",T:15,opt:!0},{no:4,name:"expire",kind:"scalar",T:13},{no:5,name:"locked_to",kind:"scalar",T:13},{no:6,name:"name",kind:"scalar",T:9},{no:7,name:"description",kind:"scalar",T:9},{no:8,name:"icon",kind:"scalar",T:7}]),rh=W.makeMessageType("meshtastic.MqttClientProxyMessage",()=>[{no:1,name:"topic",kind:"scalar",T:9},{no:2,name:"data",kind:"scalar",T:12,oneof:"payload_variant"},{no:3,name:"text",kind:"scalar",T:9,oneof:"payload_variant"},{no:4,name:"retained",kind:"scalar",T:8}]),Go=W.makeMessageType("meshtastic.MeshPacket",()=>[{no:1,name:"from",kind:"scalar",T:7},{no:2,name:"to",kind:"scalar",T:7},{no:3,name:"channel",kind:"scalar",T:13},{no:4,name:"decoded",kind:"message",T:f_,oneof:"payload_variant"},{no:5,name:"encrypted",kind:"scalar",T:12,oneof:"payload_variant"},{no:6,name:"id",kind:"scalar",T:7},{no:7,name:"rx_time",kind:"scalar",T:7},{no:8,name:"rx_snr",kind:"scalar",T:2},{no:9,name:"hop_limit",kind:"scalar",T:13},{no:10,name:"want_ack",kind:"scalar",T:8},{no:11,name:"priority",kind:"enum",T:W.getEnumType(p_)},{no:12,name:"rx_rssi",kind:"scalar",T:5},{no:13,name:"delayed",kind:"enum",T:W.getEnumType(m_)},{no:14,name:"via_mqtt",kind:"scalar",T:8},{no:15,name:"hop_start",kind:"scalar",T:13},{no:16,name:"public_key",kind:"scalar",T:12},{no:17,name:"pki_encrypted",kind:"scalar",T:8}]),p_=W.makeEnum("meshtastic.MeshPacket.Priority",[{no:0,name:"UNSET"},{no:1,name:"MIN"},{no:10,name:"BACKGROUND"},{no:64,name:"DEFAULT"},{no:70,name:"RELIABLE"},{no:80,name:"RESPONSE"},{no:100,name:"HIGH"},{no:120,name:"ACK"},{no:127,name:"MAX"}]),m_=W.makeEnum("meshtastic.MeshPacket.Delayed",[{no:0,name:"NO_DELAY"},{no:1,name:"DELAYED_BROADCAST"},{no:2,name:"DELAYED_DIRECT"}]),h_=W.makeMessageType("meshtastic.NodeInfo",()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"user",kind:"message",T:Hs},{no:3,name:"position",kind:"message",T:th},{no:4,name:"snr",kind:"scalar",T:2},{no:5,name:"last_heard",kind:"scalar",T:7},{no:6,name:"device_metrics",kind:"message",T:nd},{no:7,name:"channel",kind:"scalar",T:13},{no:8,name:"via_mqtt",kind:"scalar",T:8},{no:9,name:"hops_away",kind:"scalar",T:13},{no:10,name:"is_favorite",kind:"scalar",T:8}]),oh=W.makeMessageType("meshtastic.MyNodeInfo",()=>[{no:1,name:"my_node_num",kind:"scalar",T:13},{no:8,name:"reboot_count",kind:"scalar",T:13},{no:11,name:"min_app_version",kind:"scalar",T:13}]),g_=W.makeMessageType("meshtastic.LogRecord",()=>[{no:1,name:"message",kind:"scalar",T:9},{no:2,name:"time",kind:"scalar",T:7},{no:3,name:"source",kind:"scalar",T:9},{no:4,name:"level",kind:"enum",T:W.getEnumType(ah)}]),ah=W.makeEnum("meshtastic.LogRecord.Level",[{no:0,name:"UNSET"},{no:50,name:"CRITICAL"},{no:40,name:"ERROR"},{no:30,name:"WARNING"},{no:20,name:"INFO"},{no:10,name:"DEBUG"},{no:5,name:"TRACE"}]),v_=W.makeMessageType("meshtastic.QueueStatus",()=>[{no:1,name:"res",kind:"scalar",T:5},{no:2,name:"free",kind:"scalar",T:13},{no:3,name:"maxlen",kind:"scalar",T:13},{no:4,name:"mesh_packet_id",kind:"scalar",T:13}]),oP=W.makeMessageType("meshtastic.FromRadio",()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"packet",kind:"message",T:Go,oneof:"payload_variant"},{no:3,name:"my_info",kind:"message",T:oh,oneof:"payload_variant"},{no:4,name:"node_info",kind:"message",T:h_,oneof:"payload_variant"},{no:5,name:"config",kind:"message",T:cu,oneof:"payload_variant"},{no:6,name:"log_record",kind:"message",T:g_,oneof:"payload_variant"},{no:7,name:"config_complete_id",kind:"scalar",T:13,oneof:"payload_variant"},{no:8,name:"rebooted",kind:"scalar",T:8,oneof:"payload_variant"},{no:9,name:"moduleConfig",kind:"message",T:uu,oneof:"payload_variant"},{no:10,name:"channel",kind:"message",T:zs,oneof:"payload_variant"},{no:11,name:"queueStatus",kind:"message",T:v_,oneof:"payload_variant"},{no:12,name:"xmodemPacket",kind:"message",T:eh,oneof:"payload_variant"},{no:13,name:"metadata",kind:"message",T:ih,oneof:"payload_variant"},{no:14,name:"mqttClientProxyMessage",kind:"message",T:rh,oneof:"payload_variant"},{no:15,name:"fileInfo",kind:"message",T:b_,oneof:"payload_variant"},{no:16,name:"clientNotification",kind:"message",T:y_,oneof:"payload_variant"}]),y_=W.makeMessageType("meshtastic.ClientNotification",()=>[{no:1,name:"reply_id",kind:"scalar",T:13,opt:!0},{no:2,name:"time",kind:"scalar",T:7},{no:3,name:"level",kind:"enum",T:W.getEnumType(ah)},{no:4,name:"message",kind:"scalar",T:9}]),b_=W.makeMessageType("meshtastic.FileInfo",()=>[{no:1,name:"file_name",kind:"scalar",T:9},{no:2,name:"size_bytes",kind:"scalar",T:13}]),aP=W.makeMessageType("meshtastic.ToRadio",()=>[{no:1,name:"packet",kind:"message",T:Go,oneof:"payload_variant"},{no:3,name:"want_config_id",kind:"scalar",T:13,oneof:"payload_variant"},{no:4,name:"disconnect",kind:"scalar",T:8,oneof:"payload_variant"},{no:5,name:"xmodemPacket",kind:"message",T:eh,oneof:"payload_variant"},{no:6,name:"mqttClientProxyMessage",kind:"message",T:rh,oneof:"payload_variant"},{no:7,name:"heartbeat",kind:"message",T:__,oneof:"payload_variant"}]),iP=W.makeMessageType("meshtastic.Compressed",()=>[{no:1,name:"portnum",kind:"enum",T:W.getEnumType(Fm)},{no:2,name:"data",kind:"scalar",T:12}]),sP=W.makeMessageType("meshtastic.NeighborInfo",()=>[{no:1,name:"node_id",kind:"scalar",T:13},{no:2,name:"last_sent_by_id",kind:"scalar",T:13},{no:3,name:"node_broadcast_interval_secs",kind:"scalar",T:13},{no:4,name:"neighbors",kind:"message",T:w_,repeated:!0}]),w_=W.makeMessageType("meshtastic.Neighbor",()=>[{no:1,name:"node_id",kind:"scalar",T:13},{no:2,name:"snr",kind:"scalar",T:2},{no:3,name:"last_rx_time",kind:"scalar",T:7},{no:4,name:"node_broadcast_interval_secs",kind:"scalar",T:13}]),ih=W.makeMessageType("meshtastic.DeviceMetadata",()=>[{no:1,name:"firmware_version",kind:"scalar",T:9},{no:2,name:"device_state_version",kind:"scalar",T:13},{no:3,name:"canShutdown",kind:"scalar",T:8},{no:4,name:"hasWifi",kind:"scalar",T:8},{no:5,name:"hasBluetooth",kind:"scalar",T:8},{no:6,name:"hasEthernet",kind:"scalar",T:8},{no:7,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:8,name:"position_flags",kind:"scalar",T:13},{no:9,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:10,name:"hasRemoteHardware",kind:"scalar",T:8}]),__=W.makeMessageType("meshtastic.Heartbeat",[]),sh=W.makeMessageType("meshtastic.NodeRemoteHardwarePin",()=>[{no:1,name:"node_num",kind:"scalar",T:13},{no:2,name:"pin",kind:"message",T:Jm}]),lP=W.makeMessageType("meshtastic.ChunkedPayload",()=>[{no:1,name:"payload_id",kind:"scalar",T:13},{no:2,name:"chunk_count",kind:"scalar",T:13},{no:3,name:"chunk_index",kind:"scalar",T:13},{no:4,name:"payload_chunk",kind:"scalar",T:12}]),x_=W.makeMessageType("meshtastic.resend_chunks",()=>[{no:1,name:"chunks",kind:"scalar",T:13,repeated:!0}]),cP=W.makeMessageType("meshtastic.ChunkedPayloadResponse",()=>[{no:1,name:"payload_id",kind:"scalar",T:13},{no:2,name:"request_transfer",kind:"scalar",T:8,oneof:"payload_variant"},{no:3,name:"accept_transfer",kind:"scalar",T:8,oneof:"payload_variant"},{no:4,name:"resend_chunks",kind:"message",T:x_,oneof:"payload_variant"}]),k_={};nt(k_,{BluetoothConnectionStatus:()=>E_,DeviceConnectionStatus:()=>C_,EthernetConnectionStatus:()=>T_,NetworkConnectionStatus:()=>lh,SerialConnectionStatus:()=>N_,WifiConnectionStatus:()=>S_});var C_=W.makeMessageType("meshtastic.DeviceConnectionStatus",()=>[{no:1,name:"wifi",kind:"message",T:S_,opt:!0},{no:2,name:"ethernet",kind:"message",T:T_,opt:!0},{no:3,name:"bluetooth",kind:"message",T:E_,opt:!0},{no:4,name:"serial",kind:"message",T:N_,opt:!0}]),S_=W.makeMessageType("meshtastic.WifiConnectionStatus",()=>[{no:1,name:"status",kind:"message",T:lh},{no:2,name:"ssid",kind:"scalar",T:9},{no:3,name:"rssi",kind:"scalar",T:5}]),T_=W.makeMessageType("meshtastic.EthernetConnectionStatus",()=>[{no:1,name:"status",kind:"message",T:lh}]),lh=W.makeMessageType("meshtastic.NetworkConnectionStatus",()=>[{no:1,name:"ip_address",kind:"scalar",T:7},{no:2,name:"is_connected",kind:"scalar",T:8},{no:3,name:"is_mqtt_connected",kind:"scalar",T:8},{no:4,name:"is_syslog_connected",kind:"scalar",T:8}]),E_=W.makeMessageType("meshtastic.BluetoothConnectionStatus",()=>[{no:1,name:"pin",kind:"scalar",T:13},{no:2,name:"rssi",kind:"scalar",T:5},{no:3,name:"is_connected",kind:"scalar",T:8}]),N_=W.makeMessageType("meshtastic.SerialConnectionStatus",()=>[{no:1,name:"baud",kind:"scalar",T:13},{no:2,name:"is_connected",kind:"scalar",T:8}]),uP=W.makeMessageType("meshtastic.AdminMessage",()=>[{no:101,name:"session_passkey",kind:"scalar",T:12},{no:1,name:"get_channel_request",kind:"scalar",T:13,oneof:"payload_variant"},{no:2,name:"get_channel_response",kind:"message",T:zs,oneof:"payload_variant"},{no:3,name:"get_owner_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:4,name:"get_owner_response",kind:"message",T:Hs,oneof:"payload_variant"},{no:5,name:"get_config_request",kind:"enum",T:W.getEnumType(P_),oneof:"payload_variant"},{no:6,name:"get_config_response",kind:"message",T:cu,oneof:"payload_variant"},{no:7,name:"get_module_config_request",kind:"enum",T:W.getEnumType(M_),oneof:"payload_variant"},{no:8,name:"get_module_config_response",kind:"message",T:uu,oneof:"payload_variant"},{no:10,name:"get_canned_message_module_messages_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:11,name:"get_canned_message_module_messages_response",kind:"scalar",T:9,oneof:"payload_variant"},{no:12,name:"get_device_metadata_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:13,name:"get_device_metadata_response",kind:"message",T:ih,oneof:"payload_variant"},{no:14,name:"get_ringtone_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:15,name:"get_ringtone_response",kind:"scalar",T:9,oneof:"payload_variant"},{no:16,name:"get_device_connection_status_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:17,name:"get_device_connection_status_response",kind:"message",T:C_,oneof:"payload_variant"},{no:18,name:"set_ham_mode",kind:"message",T:A_,oneof:"payload_variant"},{no:19,name:"get_node_remote_hardware_pins_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:20,name:"get_node_remote_hardware_pins_response",kind:"message",T:R_,oneof:"payload_variant"},{no:21,name:"enter_dfu_mode_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:22,name:"delete_file_request",kind:"scalar",T:9,oneof:"payload_variant"},{no:23,name:"set_scale",kind:"scalar",T:13,oneof:"payload_variant"},{no:32,name:"set_owner",kind:"message",T:Hs,oneof:"payload_variant"},{no:33,name:"set_channel",kind:"message",T:zs,oneof:"payload_variant"},{no:34,name:"set_config",kind:"message",T:cu,oneof:"payload_variant"},{no:35,name:"set_module_config",kind:"message",T:uu,oneof:"payload_variant"},{no:36,name:"set_canned_message_module_messages",kind:"scalar",T:9,oneof:"payload_variant"},{no:37,name:"set_ringtone_message",kind:"scalar",T:9,oneof:"payload_variant"},{no:38,name:"remove_by_nodenum",kind:"scalar",T:13,oneof:"payload_variant"},{no:39,name:"set_favorite_node",kind:"scalar",T:13,oneof:"payload_variant"},{no:40,name:"remove_favorite_node",kind:"scalar",T:13,oneof:"payload_variant"},{no:41,name:"set_fixed_position",kind:"message",T:th,oneof:"payload_variant"},{no:42,name:"remove_fixed_position",kind:"scalar",T:8,oneof:"payload_variant"},{no:43,name:"set_time_only",kind:"scalar",T:7,oneof:"payload_variant"},{no:64,name:"begin_edit_settings",kind:"scalar",T:8,oneof:"payload_variant"},{no:65,name:"commit_edit_settings",kind:"scalar",T:8,oneof:"payload_variant"},{no:94,name:"factory_reset_device",kind:"scalar",T:5,oneof:"payload_variant"},{no:95,name:"reboot_ota_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:96,name:"exit_simulator",kind:"scalar",T:8,oneof:"payload_variant"},{no:97,name:"reboot_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:98,name:"shutdown_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:99,name:"factory_reset_config",kind:"scalar",T:5,oneof:"payload_variant"},{no:100,name:"nodedb_reset",kind:"scalar",T:5,oneof:"payload_variant"}]),P_=W.makeEnum("meshtastic.AdminMessage.ConfigType",[{no:0,name:"DEVICE_CONFIG"},{no:1,name:"POSITION_CONFIG"},{no:2,name:"POWER_CONFIG"},{no:3,name:"NETWORK_CONFIG"},{no:4,name:"DISPLAY_CONFIG"},{no:5,name:"LORA_CONFIG"},{no:6,name:"BLUETOOTH_CONFIG"},{no:7,name:"SECURITY_CONFIG"},{no:8,name:"SESSIONKEY_CONFIG"}]),M_=W.makeEnum("meshtastic.AdminMessage.ModuleConfigType",[{no:0,name:"MQTT_CONFIG"},{no:1,name:"SERIAL_CONFIG"},{no:2,name:"EXTNOTIF_CONFIG"},{no:3,name:"STOREFORWARD_CONFIG"},{no:4,name:"RANGETEST_CONFIG"},{no:5,name:"TELEMETRY_CONFIG"},{no:6,name:"CANNEDMSG_CONFIG"},{no:7,name:"AUDIO_CONFIG"},{no:8,name:"REMOTEHARDWARE_CONFIG"},{no:9,name:"NEIGHBORINFO_CONFIG"},{no:10,name:"AMBIENTLIGHTING_CONFIG"},{no:11,name:"DETECTIONSENSOR_CONFIG"},{no:12,name:"PAXCOUNTER_CONFIG"}]),A_=W.makeMessageType("meshtastic.HamParameters",()=>[{no:1,name:"call_sign",kind:"scalar",T:9},{no:2,name:"tx_power",kind:"scalar",T:5},{no:3,name:"frequency",kind:"scalar",T:2},{no:4,name:"short_name",kind:"scalar",T:9}]),R_=W.makeMessageType("meshtastic.NodeRemoteHardwarePinsResponse",()=>[{no:1,name:"node_remote_hardware_pins",kind:"message",T:sh,repeated:!0}]),I_={};nt(I_,{ChannelSet:()=>dP});var dP=W.makeMessageType("meshtastic.ChannelSet",()=>[{no:1,name:"settings",kind:"message",T:Nm,repeated:!0},{no:2,name:"lora_config",kind:"message",T:td}]),O_={};nt(O_,{CannedMessageModuleConfig:()=>fP});var fP=W.makeMessageType("meshtastic.CannedMessageModuleConfig",()=>[{no:1,name:"messages",kind:"scalar",T:9}]),D_={};nt(D_,{DeviceProfile:()=>pP});var L_={};nt(L_,{LocalConfig:()=>ch,LocalModuleConfig:()=>uh});var ch=W.makeMessageType("meshtastic.LocalConfig",()=>[{no:1,name:"device",kind:"message",T:Pm},{no:2,name:"position",kind:"message",T:Mm},{no:3,name:"power",kind:"message",T:Am},{no:4,name:"network",kind:"message",T:Rm},{no:5,name:"display",kind:"message",T:Im},{no:6,name:"lora",kind:"message",T:td},{no:7,name:"bluetooth",kind:"message",T:Lm},{no:8,name:"version",kind:"scalar",T:13},{no:9,name:"security",kind:"message",T:jm}]),uh=W.makeMessageType("meshtastic.LocalModuleConfig",()=>[{no:1,name:"mqtt",kind:"message",T:$m},{no:2,name:"serial",kind:"message",T:Gm},{no:3,name:"external_notification",kind:"message",T:Km},{no:4,name:"store_forward",kind:"message",T:qm},{no:5,name:"range_test",kind:"message",T:Xm},{no:6,name:"telemetry",kind:"message",T:Ym},{no:7,name:"canned_message",kind:"message",T:Qm},{no:9,name:"audio",kind:"message",T:Hm},{no:10,name:"remote_hardware",kind:"message",T:Um},{no:11,name:"neighbor_info",kind:"message",T:Vm},{no:12,name:"ambient_lighting",kind:"message",T:Zm},{no:13,name:"detection_sensor",kind:"message",T:zm},{no:14,name:"paxcounter",kind:"message",T:Wm},{no:8,name:"version",kind:"scalar",T:13}]),pP=W.makeMessageType("meshtastic.DeviceProfile",()=>[{no:1,name:"long_name",kind:"scalar",T:9,opt:!0},{no:2,name:"short_name",kind:"scalar",T:9,opt:!0},{no:3,name:"channel_url",kind:"scalar",T:9,opt:!0},{no:4,name:"config",kind:"message",T:ch,opt:!0},{no:5,name:"module_config",kind:"message",T:uh,opt:!0}]),j_={};nt(j_,{ChannelFile:()=>hP,DeviceState:()=>mP,NodeInfoLite:()=>U_,OEMStore:()=>gP,PositionLite:()=>B_,ScreenFonts:()=>F_,UserLite:()=>$_});var F_=W.makeEnum("meshtastic.ScreenFonts",[{no:0,name:"FONT_SMALL"},{no:1,name:"FONT_MEDIUM"},{no:2,name:"FONT_LARGE"}]),B_=W.makeMessageType("meshtastic.PositionLite",()=>[{no:1,name:"latitude_i",kind:"scalar",T:15},{no:2,name:"longitude_i",kind:"scalar",T:15},{no:3,name:"altitude",kind:"scalar",T:5},{no:4,name:"time",kind:"scalar",T:7},{no:5,name:"location_source",kind:"enum",T:W.getEnumType(nh)}]),$_=W.makeMessageType("meshtastic.UserLite",()=>[{no:1,name:"macaddr",kind:"scalar",T:12},{no:2,name:"long_name",kind:"scalar",T:9},{no:3,name:"short_name",kind:"scalar",T:9},{no:4,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:5,name:"is_licensed",kind:"scalar",T:8},{no:6,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:7,name:"public_key",kind:"scalar",T:12}]),U_=W.makeMessageType("meshtastic.NodeInfoLite",()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"user",kind:"message",T:$_},{no:3,name:"position",kind:"message",T:B_},{no:4,name:"snr",kind:"scalar",T:2},{no:5,name:"last_heard",kind:"scalar",T:7},{no:6,name:"device_metrics",kind:"message",T:nd},{no:7,name:"channel",kind:"scalar",T:13},{no:8,name:"via_mqtt",kind:"scalar",T:8},{no:9,name:"hops_away",kind:"scalar",T:13},{no:10,name:"is_favorite",kind:"scalar",T:8}]),mP=W.makeMessageType("meshtastic.DeviceState",()=>[{no:2,name:"my_node",kind:"message",T:oh},{no:3,name:"owner",kind:"message",T:Hs},{no:5,name:"receive_queue",kind:"message",T:Go,repeated:!0},{no:8,name:"version",kind:"scalar",T:13},{no:7,name:"rx_text_message",kind:"message",T:Go},{no:9,name:"no_save",kind:"scalar",T:8},{no:11,name:"did_gps_reset",kind:"scalar",T:8},{no:12,name:"rx_waypoint",kind:"message",T:Go},{no:13,name:"node_remote_hardware_pins",kind:"message",T:sh,repeated:!0},{no:14,name:"node_db_lite",kind:"message",T:U_,repeated:!0}]),hP=W.makeMessageType("meshtastic.ChannelFile",()=>[{no:1,name:"channels",kind:"message",T:zs,repeated:!0},{no:2,name:"version",kind:"scalar",T:13}]),gP=W.makeMessageType("meshtastic.OEMStore",()=>[{no:1,name:"oem_icon_width",kind:"scalar",T:13},{no:2,name:"oem_icon_height",kind:"scalar",T:13},{no:3,name:"oem_icon_bits",kind:"scalar",T:12},{no:4,name:"oem_font",kind:"enum",T:W.getEnumType(F_)},{no:5,name:"oem_text",kind:"scalar",T:9},{no:6,name:"oem_aes_key",kind:"scalar",T:12},{no:7,name:"oem_local_config",kind:"message",T:ch},{no:8,name:"oem_local_module_config",kind:"message",T:uh}]),V_={};nt(V_,{MapReport:()=>yP,ServiceEnvelope:()=>vP});var vP=W.makeMessageType("meshtastic.ServiceEnvelope",()=>[{no:1,name:"packet",kind:"message",T:Go},{no:2,name:"channel_id",kind:"scalar",T:9},{no:3,name:"gateway_id",kind:"scalar",T:9}]),yP=W.makeMessageType("meshtastic.MapReport",()=>[{no:1,name:"long_name",kind:"scalar",T:9},{no:2,name:"short_name",kind:"scalar",T:9},{no:3,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:4,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:5,name:"firmware_version",kind:"scalar",T:9},{no:6,name:"region",kind:"enum",T:W.getEnumType(Om)},{no:7,name:"modem_preset",kind:"enum",T:W.getEnumType(Dm)},{no:8,name:"has_default_channel",kind:"scalar",T:8},{no:9,name:"latitude_i",kind:"scalar",T:15},{no:10,name:"longitude_i",kind:"scalar",T:15},{no:11,name:"altitude",kind:"scalar",T:5},{no:12,name:"position_precision",kind:"scalar",T:13},{no:13,name:"num_online_local_nodes",kind:"scalar",T:13}]),dh={};nt(dh,{Paxcount:()=>bP});var bP=W.makeMessageType("meshtastic.Paxcount",()=>[{no:1,name:"wifi",kind:"scalar",T:13},{no:2,name:"ble",kind:"scalar",T:13},{no:3,name:"uptime",kind:"scalar",T:13}]),fh={};nt(fh,{HardwareMessage:()=>wP,HardwareMessage_Type:()=>z_});var wP=W.makeMessageType("meshtastic.HardwareMessage",()=>[{no:1,name:"type",kind:"enum",T:W.getEnumType(z_)},{no:2,name:"gpio_mask",kind:"scalar",T:4},{no:3,name:"gpio_value",kind:"scalar",T:4}]),z_=W.makeEnum("meshtastic.HardwareMessage.Type",[{no:0,name:"UNSET"},{no:1,name:"WRITE_GPIOS"},{no:2,name:"WATCH_GPIOS"},{no:3,name:"GPIOS_CHANGED"},{no:4,name:"READ_GPIOS"},{no:5,name:"READ_GPIOS_REPLY"}]),H_={};nt(H_,{RTTTLConfig:()=>_P});var _P=W.makeMessageType("meshtastic.RTTTLConfig",()=>[{no:1,name:"ringtone",kind:"scalar",T:9}]),W_={};nt(W_,{StoreAndForward:()=>xP,StoreAndForward_Heartbeat:()=>X_,StoreAndForward_History:()=>q_,StoreAndForward_RequestResponse:()=>G_,StoreAndForward_Statistics:()=>K_});var xP=W.makeMessageType("meshtastic.StoreAndForward",()=>[{no:1,name:"rr",kind:"enum",T:W.getEnumType(G_)},{no:2,name:"stats",kind:"message",T:K_,oneof:"variant"},{no:3,name:"history",kind:"message",T:q_,oneof:"variant"},{no:4,name:"heartbeat",kind:"message",T:X_,oneof:"variant"},{no:5,name:"text",kind:"scalar",T:12,oneof:"variant"}]),G_=W.makeEnum("meshtastic.StoreAndForward.RequestResponse",[{no:0,name:"UNSET"},{no:1,name:"ROUTER_ERROR"},{no:2,name:"ROUTER_HEARTBEAT"},{no:3,name:"ROUTER_PING"},{no:4,name:"ROUTER_PONG"},{no:5,name:"ROUTER_BUSY"},{no:6,name:"ROUTER_HISTORY"},{no:7,name:"ROUTER_STATS"},{no:8,name:"ROUTER_TEXT_DIRECT"},{no:9,name:"ROUTER_TEXT_BROADCAST"},{no:64,name:"CLIENT_ERROR"},{no:65,name:"CLIENT_HISTORY"},{no:66,name:"CLIENT_STATS"},{no:67,name:"CLIENT_PING"},{no:68,name:"CLIENT_PONG"},{no:106,name:"CLIENT_ABORT"}]),K_=W.makeMessageType("meshtastic.StoreAndForward.Statistics",()=>[{no:1,name:"messages_total",kind:"scalar",T:13},{no:2,name:"messages_saved",kind:"scalar",T:13},{no:3,name:"messages_max",kind:"scalar",T:13},{no:4,name:"up_time",kind:"scalar",T:13},{no:5,name:"requests",kind:"scalar",T:13},{no:6,name:"requests_history",kind:"scalar",T:13},{no:7,name:"heartbeat",kind:"scalar",T:8},{no:8,name:"return_max",kind:"scalar",T:13},{no:9,name:"return_window",kind:"scalar",T:13}],{localName:"StoreAndForward_Statistics"}),q_=W.makeMessageType("meshtastic.StoreAndForward.History",()=>[{no:1,name:"history_messages",kind:"scalar",T:13},{no:2,name:"window",kind:"scalar",T:13},{no:3,name:"last_request",kind:"scalar",T:13}],{localName:"StoreAndForward_History"}),X_=W.makeMessageType("meshtastic.StoreAndForward.Heartbeat",()=>[{no:1,name:"period",kind:"scalar",T:13},{no:2,name:"secondary",kind:"scalar",T:13}],{localName:"StoreAndForward_Heartbeat"}),Ws={};nt(Ws,{ChannelNumber:()=>Z_,DeviceStatusEnum:()=>Y_,Emitter:()=>ve,EmitterScope:()=>Q_});var Y_=(e=>(e[e.DeviceRestarting=1]="DeviceRestarting",e[e.DeviceDisconnected=2]="DeviceDisconnected",e[e.DeviceConnecting=3]="DeviceConnecting",e[e.DeviceReconnecting=4]="DeviceReconnecting",e[e.DeviceConnected=5]="DeviceConnected",e[e.DeviceConfiguring=6]="DeviceConfiguring",e[e.DeviceConfigured=7]="DeviceConfigured",e))(Y_||{}),Q_=(e=>(e[e.MeshDevice=1]="MeshDevice",e[e.SerialConnection=2]="SerialConnection",e[e.NodeSerialConnection=3]="NodeSerialConnection",e[e.BleConnection=4]="BleConnection",e[e.HttpConnection=5]="HttpConnection",e))(Q_||{}),ve=(e=>(e[e.Constructor=0]="Constructor",e[e.SendText=1]="SendText",e[e.SendWaypoint=2]="SendWaypoint",e[e.SendPacket=3]="SendPacket",e[e.SendRaw=4]="SendRaw",e[e.SetConfig=5]="SetConfig",e[e.SetModuleConfig=6]="SetModuleConfig",e[e.ConfirmSetConfig=7]="ConfirmSetConfig",e[e.SetOwner=8]="SetOwner",e[e.SetChannel=9]="SetChannel",e[e.ConfirmSetChannel=10]="ConfirmSetChannel",e[e.ClearChannel=11]="ClearChannel",e[e.GetChannel=12]="GetChannel",e[e.GetAllChannels=13]="GetAllChannels",e[e.GetConfig=14]="GetConfig",e[e.GetModuleConfig=15]="GetModuleConfig",e[e.GetOwner=16]="GetOwner",e[e.Configure=17]="Configure",e[e.HandleFromRadio=18]="HandleFromRadio",e[e.HandleMeshPacket=19]="HandleMeshPacket",e[e.Connect=20]="Connect",e[e.Ping=21]="Ping",e[e.ReadFromRadio=22]="ReadFromRadio",e[e.WriteToRadio=23]="WriteToRadio",e[e.SetDebugMode=24]="SetDebugMode",e[e.GetMetadata=25]="GetMetadata",e[e.ResetNodes=26]="ResetNodes",e[e.Shutdown=27]="Shutdown",e[e.Reboot=28]="Reboot",e[e.RebootOta=29]="RebootOta",e[e.FactoryReset=30]="FactoryReset",e[e.EnterDfuMode=31]="EnterDfuMode",e[e.RemoveNodeByNum=32]="RemoveNodeByNum",e[e.SetCannedMessages=33]="SetCannedMessages",e))(ve||{}),Z_=(e=>(e[e.Primary=0]="Primary",e[e.Channel1=1]="Channel1",e[e.Channel2=2]="Channel2",e[e.Channel3=3]="Channel3",e[e.Channel4=4]="Channel4",e[e.Channel5=5]="Channel5",e[e.Channel6=6]="Channel6",e[e.Admin=7]="Admin",e))(Z_||{}),kP={};nt(kP,{EventSystem:()=>J_,Queue:()=>ex,Xmodem:()=>nx,transformHandler:()=>tx,typedArrayToBuffer:()=>ph});var J_=class{onLogEvent=new _e.SimpleEventDispatcher;onFromRadio=new _e.SimpleEventDispatcher;onMeshPacket=new _e.SimpleEventDispatcher;onMyNodeInfo=new _e.SimpleEventDispatcher;onNodeInfoPacket=new _e.SimpleEventDispatcher;onChannelPacket=new _e.SimpleEventDispatcher;onConfigPacket=new _e.SimpleEventDispatcher;onModuleConfigPacket=new _e.SimpleEventDispatcher;onAtakPacket=new _e.SimpleEventDispatcher;onMessagePacket=new _e.SimpleEventDispatcher;onRemoteHardwarePacket=new _e.SimpleEventDispatcher;onPositionPacket=new _e.SimpleEventDispatcher;onUserPacket=new _e.SimpleEventDispatcher;onRoutingPacket=new _e.SimpleEventDispatcher;onDeviceMetadataPacket=new _e.SimpleEventDispatcher;onWaypointPacket=new _e.SimpleEventDispatcher;onAudioPacket=new _e.SimpleEventDispatcher;onDetectionSensorPacket=new _e.SimpleEventDispatcher;onPingPacket=new _e.SimpleEventDispatcher;onIpTunnelPacket=new _e.SimpleEventDispatcher;onPaxcounterPacket=new _e.SimpleEventDispatcher;onSerialPacket=new _e.SimpleEventDispatcher;onStoreForwardPacket=new _e.SimpleEventDispatcher;onRangeTestPacket=new _e.SimpleEventDispatcher;onTelemetryPacket=new _e.SimpleEventDispatcher;onZpsPacket=new _e.SimpleEventDispatcher;onSimulatorPacket=new _e.SimpleEventDispatcher;onTraceRoutePacket=new _e.SimpleEventDispatcher;onNeighborInfoPacket=new _e.SimpleEventDispatcher;onAtakPluginPacket=new _e.SimpleEventDispatcher;onMapReportPacket=new _e.SimpleEventDispatcher;onPrivatePacket=new _e.SimpleEventDispatcher;onAtakForwarderPacket=new _e.SimpleEventDispatcher;onDeviceStatus=new _e.SimpleEventDispatcher;onLogRecord=new _e.SimpleEventDispatcher;onMeshHeartbeat=new _e.SimpleEventDispatcher;onDeviceDebugLog=new _e.SimpleEventDispatcher;onPendingSettingsChange=new _e.SimpleEventDispatcher;onQueueStatus=new _e.SimpleEventDispatcher},ph=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),ex=class{queue=[];lock=!1;ackNotifier=new _e.SimpleEventDispatcher;errorNotifier=new _e.SimpleEventDispatcher;timeout;constructor(){this.timeout=6e4}getState(){return this.queue}clear(){this.queue=[]}push(e){const t={...e,sent:!1,added:new Date,promise:new Promise((n,r)=>{this.ackNotifier.subscribe(o=>{e.id===o&&(this.remove(e.id),n(o))}),this.errorNotifier.subscribe(o=>{e.id===o.id&&(this.remove(e.id),r(o))}),setTimeout(()=>{if(this.queue.findIndex(o=>o.id===e.id)!==-1){this.remove(e.id);const o=it.ToRadio.fromBinary(e.data);console.warn(`Packet ${e.id} of type ${o.payloadVariant.case} timed out`),r({id:e.id,error:it.Routing_Error.TIMEOUT})}},this.timeout)})};this.queue.push(t)}remove(e){if(this.lock){setTimeout(()=>this.remove(e),100);return}this.queue=this.queue.filter(t=>t.id!==e)}processAck(e){this.ackNotifier.dispatch(e)}processError(e){console.error(`Error received for packet ${e.id}: ${it.Routing_Error[e.error]}`),this.errorNotifier.dispatch(e)}async wait(e){const t=this.queue.find(n=>n.id===e);if(!t)throw new Error("Packet does not exist");return t.promise}async processQueue(e){if(!this.lock){for(this.lock=!0;this.queue.filter(t=>!t.sent).length>0;){const t=this.queue.filter(n=>!n.sent)[0];if(t){await new Promise(n=>setTimeout(n,200));try{await e(t.data),t.sent=!0}catch(n){console.error(`Error sending packet ${t.id}`,n)}}}this.lock=!1}}},tx=(e,t,n,r)=>{let o=new Uint8Array([]);return new TransformStream({transform(a,i){e=e.getSubLogger({name:"streamTransformer"}),t.subscribe(()=>{i.terminate()}),o=new Uint8Array([...o,...a]);let s=!1;for(;o.length!==0&&!s;){const l=o.findIndex(u=>u===148);if(o[l+1]===195){o.subarray(0,l).length&&(r?n.dispatch(o.subarray(0,l)):e.warn(2,20,`⚠️ Found unneccesary message padding, removing: ${o.subarray(0,l).toString()}`),o=o.subarray(l));const u=o[2],d=o[3];if(u!==void 0&&d!==void 0&&o.length>=4+(u<<8)+d){const p=o.subarray(4,4+(u<<8)+d),g=p.findIndex(v=>v===148);g!==-1&&p[g+1]===195?(e.warn(2,20,`⚠️ Malformed packet found, discarding: ${o.subarray(0,g-1).toString()}`,it.LogRecord_Level.WARNING),o=o.subarray(g)):(o=o.subarray(3+(u<<8)+d+1),i.enqueue(p))}else s=!0}else s=!0}}})},nx=class{sendRaw;rxBuffer;txBuffer;textEncoder;counter;constructor(e){this.sendRaw=e,this.rxBuffer=[],this.txBuffer=[],this.textEncoder=new TextEncoder,this.counter=0}async downloadFile(e){return await this.sendCommand(bt.XModem_Control.STX,this.textEncoder.encode(e),0)}async uploadFile(e,t){for(let n=0;nsetTimeout(t,100)),e.control){case bt.XModem_Control.NUL:break;case bt.XModem_Control.SOH:return this.counter=e.seq,this.validateCrc16(e)?(this.rxBuffer[this.counter]=e.buffer,this.sendCommand(bt.XModem_Control.ACK)):await this.sendCommand(bt.XModem_Control.NAK,void 0,e.seq);case bt.XModem_Control.STX:break;case bt.XModem_Control.EOT:break;case bt.XModem_Control.ACK:{if(this.counter++,this.txBuffer[this.counter-1])return this.sendCommand(bt.XModem_Control.SOH,this.txBuffer[this.counter-1],this.counter,lf(this.txBuffer[this.counter-1]??new Uint8Array));if(this.counter===this.txBuffer.length+1)return this.sendCommand(bt.XModem_Control.EOT);this.clear();break}case bt.XModem_Control.NAK:return this.sendCommand(bt.XModem_Control.SOH,this.txBuffer[this.counter],this.counter,lf(this.txBuffer[this.counter-1]??new Uint8Array));case bt.XModem_Control.CAN:{this.clear();break}case bt.XModem_Control.CTRLZ:break}return Promise.resolve(0)}validateCrc16(e){return lf(e.buffer)===e.crc16}clear(){this.counter=0,this.rxBuffer=[],this.txBuffer=[]}},mh=class{log;deviceStatus;isConfigured;pendingSettingsChanges;myNodeInfo;configId;queue;events;xModem;constructor(e){this.log=new O3({name:"iMeshDevice",prettyLogTemplate:"{{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} [{{name}}] "}),this.deviceStatus=2,this.isConfigured=!1,this.pendingSettingsChanges=!1,this.myNodeInfo=new it.MyNodeInfo,this.configId=e??this.generateRandId(),this.queue=new ex,this.events=new J_,this.xModem=new nx(this.sendRaw.bind(this)),this.events.onDeviceStatus.subscribe(t=>{this.deviceStatus=t,t===7?this.isConfigured=!0:t===6&&(this.isConfigured=!1)}),this.events.onMyNodeInfo.subscribe(t=>{this.myNodeInfo=t}),this.events.onPendingSettingsChange.subscribe(t=>{this.pendingSettingsChanges=t})}async sendText(e,t,n,r){this.log.debug(ve[1],`📤 Sending message to ${t??"broadcast"} on channel ${r?.toString()??0}`);const o=new TextEncoder;return await this.sendPacket(o.encode(e),be.PortNum.TEXT_MESSAGE_APP,t??"broadcast",r,n,!1,!0)}sendWaypoint(e,t,n){return this.log.debug(ve[2],`📤 Sending waypoint to ${t} on channel ${n?.toString()??0}`),e.id=this.generateRandId(),this.sendPacket(e.toBinary(),be.PortNum.WAYPOINT_APP,t,n,!0,!1)}async sendPacket(e,t,n,r=0,o=!0,a=!0,i=!1,s,l){this.log.trace(ve[3],`📤 Sending ${be.PortNum[t]} to ${n}`);const c=new it.MeshPacket({payloadVariant:{case:"decoded",value:{payload:e,portnum:t,wantResponse:a,emoji:l,replyId:s,dest:0,requestId:0,source:0}},from:this.myNodeInfo.myNodeNum,to:n==="broadcast"?G0:n==="self"?this.myNodeInfo.myNodeNum:n,id:this.generateRandId(),wantAck:o,channel:r}),u=new it.ToRadio({payloadVariant:{case:"packet",value:c}});return i&&(c.rxTime=Math.trunc(new Date().getTime()/1e3),this.handleMeshPacket(c)),await this.sendRaw(u.toBinary(),c.id)}async sendRaw(e,t=this.generateRandId()){if(e.length>512)throw new Error("Message longer than 512 bytes, it will not be sent!");return this.queue.push({id:t,data:e}),await this.queue.processQueue(async n=>{await this.writeToRadio(n)}),this.queue.wait(t)}async setConfig(e){this.log.debug(ve[5],`⚙️ Setting config, Variant: ${e.payloadVariant.case??"Unknown"}`),this.pendingSettingsChanges||await this.beginEditSettings();const t=new qe.AdminMessage({payloadVariant:{case:"setConfig",value:e}});return this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setModuleConfig(e){this.log.debug(ve[6],"⚙️ Setting module config");const t=new qe.AdminMessage({payloadVariant:{case:"setModuleConfig",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setCannedMessages(e){this.log.debug(ve[33],"⚙️ Setting CannedMessages");const t=new qe.AdminMessage({payloadVariant:{case:"setCannedMessageModuleMessages",value:e.messages}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setOwner(e){this.log.debug(ve[8],"👤 Setting owner");const t=new qe.AdminMessage({payloadVariant:{case:"setOwner",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setChannel(e){this.log.debug(ve[9],`📻 Setting Channel: ${e.index}`);const t=new qe.AdminMessage({payloadVariant:{case:"setChannel",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setPosition(e){return await this.sendPacket(e.toBinary(),be.PortNum.POSITION_APP,"self")}async getChannel(e){this.log.debug(ve[12],`📻 Requesting Channel: ${e}`);const t=new qe.AdminMessage({payloadVariant:{case:"getChannelRequest",value:e+1}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getConfig(e){this.log.debug(ve[14],"⚙️ Requesting config");const t=new qe.AdminMessage({payloadVariant:{case:"getConfigRequest",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getModuleConfig(e){this.log.debug(ve[15],"⚙️ Requesting module config");const t=new qe.AdminMessage({payloadVariant:{case:"getModuleConfigRequest",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getOwner(){this.log.debug(ve[16],"👤 Requesting owner");const e=new qe.AdminMessage({payloadVariant:{case:"getOwnerRequest",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async getMetadata(e){this.log.debug(ve[25],`🏷️ Requesting metadata from ${e}`);const t=new qe.AdminMessage({payloadVariant:{case:"getDeviceMetadataRequest",value:!0}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,e,7)}async clearChannel(e){this.log.debug(ve[11],`📻 Clearing Channel ${e}`);const t=new lu.Channel({index:e,role:lu.Channel_Role.DISABLED}),n=new qe.AdminMessage({payloadVariant:{case:"setChannel",value:t}});return await this.sendPacket(n.toBinary(),be.PortNum.ADMIN_APP,"self")}async beginEditSettings(){this.events.onPendingSettingsChange.dispatch(!0);const e=new qe.AdminMessage({payloadVariant:{case:"beginEditSettings",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async commitEditSettings(){this.events.onPendingSettingsChange.dispatch(!1);const e=new qe.AdminMessage({payloadVariant:{case:"commitEditSettings",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async resetNodes(){this.log.debug(ve[26],"📻 Resetting NodeDB");const e=new qe.AdminMessage({payloadVariant:{case:"nodedbReset",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async removeNodeByNum(e){this.log.debug(ve[32],`📻 Removing Node ${e} from NodeDB`);const t=new qe.AdminMessage({payloadVariant:{case:"removeByNodenum",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async shutdown(e){this.log.debug(ve[27],`🔌 Shutting down ${e>2?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"shutdownSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async reboot(e){this.log.debug(ve[28],`🔌 Rebooting node ${e>0?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"rebootSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async rebootOta(e){this.log.debug(ve[29],`🔌 Rebooting into OTA mode ${e>0?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"rebootOtaSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async factoryResetDevice(){this.log.debug(ve[30],"♻️ Factory resetting device");const e=new qe.AdminMessage({payloadVariant:{case:"factoryResetDevice",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async factoryResetConfig(){this.log.debug(ve[30],"♻️ Factory resetting config");const e=new qe.AdminMessage({payloadVariant:{case:"factoryResetConfig",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}configure(){this.log.debug(ve[17],"⚙️ Requesting device configuration"),this.updateDeviceStatus(6);const e=new it.ToRadio({payloadVariant:{case:"wantConfigId",value:this.configId}});return this.sendRaw(e.toBinary())}async traceRoute(e){const t=new it.RouteDiscovery({route:[]});return await this.sendPacket(t.toBinary(),be.PortNum.TRACEROUTE_APP,e)}async requestPosition(e){return await this.sendPacket(new Uint8Array,be.PortNum.POSITION_APP,e)}updateDeviceStatus(e){e!==this.deviceStatus&&this.events.onDeviceStatus.dispatch(e)}generateRandId(){const e=crypto.getRandomValues(new Uint32Array(1));if(!e[0])throw new Error("Cannot generate CSPRN");return Math.floor(e[0]*2**-32*1e9)}handleFromRadio(e){const t=it.FromRadio.fromBinary(e);switch(this.events.onFromRadio.dispatch(t),t.payloadVariant.case){case"packet":{this.handleMeshPacket(t.payloadVariant.value);break}case"myInfo":{this.events.onMyNodeInfo.dispatch(t.payloadVariant.value),this.log.info(ve[18],"📱 Received Node info for this device");break}case"nodeInfo":{this.log.info(ve[18],`📱 Received Node Info packet for node: ${t.payloadVariant.value.num}`),this.events.onNodeInfoPacket.dispatch(t.payloadVariant.value),t.payloadVariant.value.position&&this.events.onPositionPacket.dispatch({id:t.id,rxTime:new Date,from:t.payloadVariant.value.num,to:t.payloadVariant.value.num,type:"direct",channel:0,data:t.payloadVariant.value.position}),t.payloadVariant.value.user&&this.events.onUserPacket.dispatch({id:t.id,rxTime:new Date,from:t.payloadVariant.value.num,to:t.payloadVariant.value.num,type:"direct",channel:0,data:t.payloadVariant.value.user});break}case"config":{t.payloadVariant.value.payloadVariant.case?this.log.trace(ve[18],`💾 Received Config packet of variant: ${t.payloadVariant.value.payloadVariant.case}`):this.log.warn(ve[18],"⚠️ Received Config packet of variant: UNK"),this.events.onConfigPacket.dispatch(t.payloadVariant.value);break}case"logRecord":{this.log.trace(ve[18],"Received onLogRecord"),this.events.onLogRecord.dispatch(t.payloadVariant.value);break}case"configCompleteId":{t.payloadVariant.value!==this.configId&&this.log.error(ve[18],`❌ Invalid config id received from device, expected ${this.configId} but received ${t.payloadVariant.value}`),this.log.info(ve[18],`⚙️ Valid config id received from device: ${this.configId}`),this.updateDeviceStatus(7);break}case"rebooted":{this.configure().catch(()=>{});break}case"moduleConfig":{t.payloadVariant.value.payloadVariant.case?this.log.trace(ve[18],`💾 Received Module Config packet of variant: ${t.payloadVariant.value.payloadVariant.case}`):this.log.warn(ve[18],"⚠️ Received Module Config packet of variant: UNK"),this.events.onModuleConfigPacket.dispatch(t.payloadVariant.value);break}case"channel":{this.log.trace(ve[18],`🔐 Received Channel: ${t.payloadVariant.value.index}`),this.events.onChannelPacket.dispatch(t.payloadVariant.value);break}case"queueStatus":{this.log.trace(ve[18],`🚧 Received Queue Status: ${t.payloadVariant.value}`),this.events.onQueueStatus.dispatch(t.payloadVariant.value);break}case"xmodemPacket":{this.xModem.handlePacket(t.payloadVariant.value);break}case"metadata":{Number.parseFloat(t.payloadVariant.value.firmwareVersion){this.log.info(ve[20],"Device disconnected"),this.updateDeviceStatus(2),this.complete()}),await this.device.gatt?.connect().then(n=>{this.log.info(ve[20],`✅ Got GATT Server for device: ${n.device.id}`),this.gattServer=n}).catch(n=>{this.log.error(ve[20],`❌ Failed to connect: ${n.message}`)}),await this.gattServer?.getPrimaryService(W0).then(n=>{this.log.info(ve[20],`✅ Got GATT Service for device: ${n.device.id}`),this.service=n}).catch(n=>{this.log.error(ve[20],`❌ Failed to get primary service: q${n.message}`)}),[V0,z0,H0].map(async n=>{await this.service?.getCharacteristic(n).then(r=>{switch(this.log.info(ve[20],`✅ Got Characteristic ${r.uuid} for device: ${r.uuid}`),n){case V0:{this.toRadioCharacteristic=r;break}case z0:{this.fromRadioCharacteristic=r;break}case H0:{this.fromNumCharacteristic=r;break}}}).catch(r=>{this.log.error(ve[20],`❌ Failed to get toRadio characteristic: q${r.message}`)})}),await this.fromNumCharacteristic?.startNotifications(),this.fromNumCharacteristic?.addEventListener("characteristicvaluechanged",()=>{this.readFromRadio()}),this.updateDeviceStatus(5),this.configure().catch(()=>{}),this.timerUpdateFromRadio=setInterval(()=>this.readFromRadio(),1e3)}disconnect(){this.device?.gatt?.disconnect(),this.updateDeviceStatus(2),this.complete(),this.timerUpdateFromRadio&&clearInterval(this.timerUpdateFromRadio),this.timerUpdateFromRadio=null}async ping(){return await Promise.resolve(!0)}async readFromRadio(){let e=new ArrayBuffer(1);for(;e.byteLength>0&&this.fromRadioCharacteristic;)await this.fromRadioCharacteristic.readValue().then(t=>{e=t.buffer,t.byteLength>0&&this.handleFromRadio(new Uint8Array(e)),this.updateDeviceStatus(5)}).catch(t=>{e=new ArrayBuffer(0),this.log.error(ve[22],`❌ ${t.message}`)})}async writeToRadio(e){await this.toRadioCharacteristic?.writeValue(ph(e)),await this.readFromRadio()}},SP=class extends mh{connType;portId;receiveBatchRequests;readLoop;pendingRequest;abortController;constructor(e){super(e),this.log=this.log.getSubLogger({name:"HttpConnection"}),this.connType="http",this.portId="",this.receiveBatchRequests=!1,this.readLoop=null,this.pendingRequest=!1,this.abortController=new AbortController,this.log.debug(ve[0],"🔷 HttpConnection instantiated")}async connect({address:e,fetchInterval:t=3e3,receiveBatchRequests:n=!1,tls:r=!1}){this.updateDeviceStatus(3),this.receiveBatchRequests=n,this.portId=`${r?"https://":"http://"}${e}`,this.deviceStatus===3&&await this.ping()?(this.log.debug(ve[20],"Ping succeeded, starting configuration and request timer."),this.configure().catch(()=>{}),this.readLoop=setInterval(()=>{this.readFromRadio().catch(o=>{this.log.error(ve[20],`❌ ${o.message}`)})},t)):this.deviceStatus!==2&&setTimeout(()=>{this.connect({address:e,fetchInterval:t,receiveBatchRequests:n,tls:r})},1e4)}disconnect(){this.abortController.abort(),this.updateDeviceStatus(2),this.readLoop&&(clearInterval(this.readLoop),this.complete())}async ping(){this.log.debug(ve[21],"Attempting device ping.");const{signal:e}=this.abortController;let t=!1;return await fetch(`${this.portId}/hotspot-detect.html`,{signal:e,mode:"no-cors"}).then(()=>{t=!0,this.updateDeviceStatus(5)}).catch(n=>{t=!1,this.log.error(ve[21],`❌ ${n.message}`),this.updateDeviceStatus(4)}),t}async readFromRadio(){if(this.pendingRequest)return;let e=new ArrayBuffer(1);const{signal:t}=this.abortController;for(;e.byteLength>0;)this.pendingRequest=!0,await fetch(`${this.portId}/api/v1/fromradio?all=${this.receiveBatchRequests?"true":"false"}`,{signal:t,method:"GET",headers:{Accept:"application/x-protobuf"}}).then(async n=>{this.pendingRequest=!1,this.updateDeviceStatus(5),e=await n.arrayBuffer(),e.byteLength>0&&this.handleFromRadio(new Uint8Array(e))}).catch(n=>{this.pendingRequest=!1,this.log.error(ve[22],`❌ ${n.message}`),this.updateDeviceStatus(4)})}async writeToRadio(e){const{signal:t}=this.abortController;await fetch(`${this.portId}/api/v1/toradio`,{signal:t,method:"PUT",headers:{"Content-Type":"application/x-protobuf"},body:ph(e)}).then(async()=>{this.updateDeviceStatus(5),await this.readFromRadio().catch(n=>{this.log.error(ve[23],`❌ ${n.message}`)})}).catch(n=>{this.log.error(ve[23],`❌ ${n.message}`),this.updateDeviceStatus(4)})}},TP=class extends mh{connType;portId;port;readerHack;transformer;preventLock;pipePromise;onReleaseEvent;constructor(e){super(e),this.log=this.log.getSubLogger({name:"SerialConnection"}),this.connType="serial",this.portId="",this.port=void 0,this.transformer=void 0,this.onReleaseEvent=new _e.SimpleEventDispatcher,this.preventLock=!1,this.log.debug(ve[0],"🔷 SerialConnection instantiated")}async readFromRadio(e){for(this.onReleaseEvent.subscribe(async()=>{this.preventLock=!0,await e.cancel(),await this.pipePromise?.catch(()=>{}),e.releaseLock(),await this.port?.close()});this.port?.readable&&!this.preventLock;)await e.read().then(({value:t})=>{t&&this.handleFromRadio(t)}).catch(()=>{this.log.debug(ve[22],"Releasing reader")})}async getPorts(){return await navigator.serial.getPorts()}async getPort(e){return await navigator.serial.requestPort(e)}getCurrentPort(){return this.port}async connect({port:e,baudRate:t=115200,concurrentLogOutput:n=!1}){this.updateDeviceStatus(3),this.port=e??await this.getPort(),this.port.addEventListener("disconnect",()=>{this.log.info(ve[20],"Device disconnected"),this.updateDeviceStatus(2),this.complete()}),this.preventLock=!1,await this.port.open({baudRate:t}).then(()=>{if(this.port?.readable&&this.port.writable){this.transformer=tx(this.log,this.onReleaseEvent,this.events.onDeviceDebugLog,n),this.pipePromise=this.port.readable.pipeTo(this.transformer.writable);const r=this.readerHack=this.transformer.readable.getReader();this.readFromRadio(r),this.updateDeviceStatus(5),this.configure().catch(()=>{})}else console.log("not readable or writable")}).catch(r=>{this.log.error(ve[20],`❌ ${r.message}`)})}async reconnect(){await this.connect({port:this.port,concurrentLogOutput:!1})}async disconnect(){return this.preventLock=!0,await this.readerHack?.cancel(),await this.pipePromise?.catch(()=>{}),this.readerHack?.releaseLock(),this.port?.readable&&await this.port?.close(),this.updateDeviceStatus(2),this.complete(),this.port}async ping(){return await Promise.resolve(!0)}async writeToRadio(e){for(;this.port?.writable?.locked;)await new Promise(n=>setTimeout(n,100));const t=this.port?.writable?.getWriter();await t?.write(new Uint8Array([148,195,0,e.length,...e])),t?.releaseLock()}};const ca=i2((e,t)=>({devices:new Map,remoteDevices:new Map,addDevice:n=>{e(Ie(o=>{o.devices.set(n,{id:n,status:Ws.DeviceStatusEnum.DeviceDisconnected,channels:new Map,config:new pe.LocalOnly.LocalConfig,moduleConfig:new pe.LocalOnly.LocalModuleConfig,workingConfig:[],workingModuleConfig:[],hardware:new pe.Mesh.MyNodeInfo,nodes:new Map,metadata:new Map,messages:{direct:new Map,broadcast:new Map},traceroutes:new Map,connection:void 0,activePage:"messages",activeNode:0,waypoints:[],dialog:{import:!1,QR:!1,shutdown:!1,reboot:!1,deviceName:!1,nodeRemoval:!1},pendingSettingsChanges:!1,messageDraft:"",setStatus:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.status=a)}))},setConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s)switch(a.payloadVariant.case){case"device":{s.config.device=a.payloadVariant.value;break}case"position":{s.config.position=a.payloadVariant.value;break}case"power":{s.config.power=a.payloadVariant.value;break}case"network":{s.config.network=a.payloadVariant.value;break}case"display":{s.config.display=a.payloadVariant.value;break}case"lora":{s.config.lora=a.payloadVariant.value;break}case"bluetooth":{s.config.bluetooth=a.payloadVariant.value;break}case"security":s.config.security=a.payloadVariant.value}}))},setModuleConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s)switch(a.payloadVariant.case){case"mqtt":{s.moduleConfig.mqtt=a.payloadVariant.value;break}case"serial":{s.moduleConfig.serial=a.payloadVariant.value;break}case"externalNotification":{s.moduleConfig.externalNotification=a.payloadVariant.value;break}case"storeForward":{s.moduleConfig.storeForward=a.payloadVariant.value;break}case"rangeTest":{s.moduleConfig.rangeTest=a.payloadVariant.value;break}case"telemetry":{s.moduleConfig.telemetry=a.payloadVariant.value;break}case"cannedMessage":{s.moduleConfig.cannedMessage=a.payloadVariant.value;break}case"audio":{s.moduleConfig.audio=a.payloadVariant.value;break}case"neighborInfo":{s.moduleConfig.neighborInfo=a.payloadVariant.value;break}case"ambientLighting":{s.moduleConfig.ambientLighting=a.payloadVariant.value;break}case"detectionSensor":{s.moduleConfig.detectionSensor=a.payloadVariant.value;break}case"paxcounter":{s.moduleConfig.paxcounter=a.payloadVariant.value;break}}}))},setWorkingConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s?.workingConfig.findIndex(c=>c.payloadVariant.case===a.payloadVariant.case);l!==-1?s.workingConfig[l]=a:s?.workingConfig.push(a)}))},setWorkingModuleConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s?.workingModuleConfig.findIndex(c=>c.payloadVariant.case===a.payloadVariant.case);l!==-1?s.workingModuleConfig[l]=a:s?.workingModuleConfig.push(a)}))},setHardware:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.hardware=a)}))},setActivePage:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.activePage=a)}))},setPendingSettingsChanges:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.pendingSettingsChanges=a)}))},addChannel:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.channels.set(a.index,a)}))},addWaypoint:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s){const l=s.waypoints.findIndex(c=>c.id===a.id);l!==-1?s.waypoints[l]=a:s.waypoints.push(a)}}))},addNodeInfo:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.nodes.set(a.num,a)}))},setActiveNode:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.activeNode=a)}))},addUser:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from)??new pe.Mesh.NodeInfo;l.user=a.data,s.nodes.set(a.from,l)}))},addPosition:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from)??new pe.Mesh.NodeInfo;l.position=a.data,s.nodes.set(a.from,l)}))},addConnection:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.connection=a)}))},addMessage:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.messages[a.type],c=a.type==="direct"?a.from===s.hardware.myNodeNum?a.to:a.from:a.channel,u=l.get(c);u?(u.push(a),l.set(c,u)):l.set(c,[a])}))},addMetadata:(a,i)=>{e(Ie(s=>{const l=s.devices.get(n);l&&l.metadata.set(a,i)}))},addTraceRoute:a=>{e(Ie(i=>{console.log("addTraceRoute called"),console.log(a);const s=i.devices.get(n);if(!s)return;const l=s.traceroutes.get(a.from);l?(l.push(a),s.traceroutes.set(a.from,l)):s.traceroutes.set(a.from,[a])}))},removeNode:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.nodes.delete(a)}))},setMessageState:(a,i,s,l,c,u)=>{e(Ie(d=>{console.log("setMessageState called");const p=d.devices.get(n);if(!p){console.log("no device found for id");return}const g=p.messages[a],v=a==="direct"?l===p.hardware.myNodeNum?s:l:i,h=g.get(v);if(!h){console.log("no messages found for id");return}g.set(v,h.map(_=>(_.id===c&&(_.state=u),_)))}))},setDialogOpen:(a,i)=>{e(Ie(s=>{const l=s.devices.get(n);l&&(l.dialog[a]=i)}))},processPacket(a){e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from);l?s.nodes.set(a.from,{...l,lastHeard:a.time,snr:a.snr}):s.nodes.set(a.from,new pe.Mesh.NodeInfo({num:a.from,lastHeard:a.time,snr:a.snr}))}))},setMessageDraft:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.messageDraft=a)}))}})}));const r=t().devices.get(n);if(!r)throw new Error("Device not found");return r},removeDevice:n=>{e(Ie(r=>{r.devices.delete(n)}))},getDevices:()=>Array.from(t().devices.values()),getDevice:n=>t().devices.get(n)})),rx=m.createContext(void 0),Te=()=>{const e=m.useContext(rx);if(e===void 0)throw new Error("useDevice must be used within a DeviceProvider");return e},EP=({children:e,device:t})=>f.jsx(rx.Provider,{value:t,children:e});function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function NP(e,t){const n=m.createContext(t);function r(a){const{children:i,...s}=a,l=m.useMemo(()=>s,Object.values(s));return f.jsx(n.Provider,{value:l,children:i})}function o(a){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function Pr(e,t=[]){let n=[];function r(a,i){const s=m.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:p,children:g,...v}=d,h=p?.[e][l]||s,_=m.useMemo(()=>v,Object.values(v));return f.jsx(h.Provider,{value:_,children:g})}function u(d,p){const g=p?.[e][l]||s,v=m.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const o=()=>{const a=n.map(i=>m.createContext(i));return function(s){const l=s?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,PP(o,...t)]}function PP(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...s,...d}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function MP(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ox(...e){return t=>e.forEach(n=>MP(n,t))}function $e(...e){return m.useCallback(ox(...e),e)}var Ti=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),a=o.find(RP);if(a){const i=a.props.children,s=o.map(l=>l===a?m.Children.count(i)>1?m.Children.only(null):m.isValidElement(i)?i.props.children:null:l);return f.jsx(Y0,{...r,ref:t,children:m.isValidElement(i)?m.cloneElement(i,void 0,s):null})}return f.jsx(Y0,{...r,ref:t,children:n})});Ti.displayName="Slot";var Y0=m.forwardRef((e,t)=>{const{children:n,...r}=e;if(m.isValidElement(n)){const o=OP(n);return m.cloneElement(n,{...IP(r,n.props),ref:t?ox(t,o):o})}return m.Children.count(n)>1?m.Children.only(null):null});Y0.displayName="SlotClone";var AP=({children:e})=>f.jsx(f.Fragment,{children:e});function RP(e){return m.isValidElement(e)&&e.type===AP}function IP(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{a(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function OP(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function hh(e){const t=e+"CollectionProvider",[n,r]=Pr(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,_=Ae.useRef(null),b=Ae.useRef(new Map).current;return f.jsx(o,{scope:v,itemMap:b,collectionRef:_,children:h})};i.displayName=t;const s=e+"CollectionSlot",l=Ae.forwardRef((g,v)=>{const{scope:h,children:_}=g,b=a(s,h),y=$e(v,b.collectionRef);return f.jsx(Ti,{ref:y,children:_})});l.displayName=s;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=Ae.forwardRef((g,v)=>{const{scope:h,children:_,...b}=g,y=Ae.useRef(null),x=$e(v,y),E=a(c,h);return Ae.useEffect(()=>(E.itemMap.set(y,{ref:y,...b}),()=>void E.itemMap.delete(y))),f.jsx(Ti,{[u]:"",ref:x,children:_})});d.displayName=c;function p(g){const v=a(e+"CollectionConsumer",g);return Ae.useCallback(()=>{const _=v.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((E,w)=>b.indexOf(E.ref.current)-b.indexOf(w.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:l,ItemSlot:d},p,r]}var Mt=globalThis?.document?m.useLayoutEffect:()=>{},DP=W1.useId||(()=>{}),LP=0;function fo(e){const[t,n]=m.useState(DP());return Mt(()=>{e||n(r=>r??String(LP++))},[e]),e||(t?`radix-${t}`:"")}var jP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],xe=jP.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:a,...i}=r,s=a?Ti:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(s,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ax(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function Wt(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function go({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=FP({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,s=Wt(n),l=m.useCallback(c=>{if(a){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else o(c)},[a,e,o,s]);return[i,l]}function FP({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),a=Wt(t);return m.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}var BP=m.createContext(void 0);function gh(e){const t=m.useContext(BP);return e||t||"ltr"}var ff="rovingFocusGroup.onEntryFocus",$P={bubbles:!1,cancelable:!0},rd="RovingFocusGroup",[Q0,ix,UP]=hh(rd),[VP,sx]=Pr(rd,[UP]),[zP,HP]=VP(rd),lx=m.forwardRef((e,t)=>f.jsx(Q0.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Q0.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(WP,{...e,ref:t})})}));lx.displayName=rd;var WP=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=m.useRef(null),g=$e(t,p),v=gh(a),[h=null,_]=go({prop:i,defaultProp:s,onChange:l}),[b,y]=m.useState(!1),x=Wt(c),E=ix(n),w=m.useRef(!1),[T,k]=m.useState(0);return m.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(ff,x),()=>C.removeEventListener(ff,x)},[x]),f.jsx(zP,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:m.useCallback(C=>_(C),[_]),onItemShiftTab:m.useCallback(()=>y(!0),[]),onFocusableItemAdd:m.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:m.useCallback(()=>k(C=>C-1),[]),children:f.jsx(xe.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...d,ref:g,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{w.current=!0}),onFocus:we(e.onFocus,C=>{const P=!w.current;if(C.target===C.currentTarget&&P&&!b){const O=new CustomEvent(ff,$P);if(C.currentTarget.dispatchEvent(O),!O.defaultPrevented){const R=E().filter(G=>G.focusable),N=R.find(G=>G.active),B=R.find(G=>G.id===h),L=[N,B,...R].filter(Boolean).map(G=>G.ref.current);dx(L,u)}}w.current=!1}),onBlur:we(e.onBlur,()=>y(!1))})})}),cx="RovingFocusGroupItem",ux=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,...i}=e,s=fo(),l=a||s,c=HP(cx,n),u=c.currentTabStopId===l,d=ix(n),{onFocusableItemAdd:p,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),f.jsx(Q0.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(xe.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:we(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:we(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:we(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=qP(v,c.orientation,c.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=d().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")b.reverse();else if(h==="prev"||h==="next"){h==="prev"&&b.reverse();const y=b.indexOf(v.currentTarget);b=c.loop?XP(b,y+1):b.slice(y+1)}setTimeout(()=>dx(b))}})})})});ux.displayName=cx;var GP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qP(e,t,n){const r=KP(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GP[r]}function dx(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var YP=lx,QP=ux;function ZP(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var ua=e=>{const{present:t,children:n}=e,r=JP(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=$e(r.ref,e4(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:a}):null};ua.displayName="Presence";function JP(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[s,l]=ZP(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Kl(r.current);a.current=s==="mounted"?c:"none"},[s]),Mt(()=>{const c=r.current,u=o.current;if(u!==e){const p=a.current,g=Kl(c);e?l("MOUNT"):g==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Mt(()=>{if(t){const c=d=>{const g=Kl(r.current).includes(d.animationName);d.target===t&&g&&an.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(a.current=Kl(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Kl(e){return e?.animationName||"none"}function e4(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vh="Tabs",[t4,T7]=Pr(vh,[sx]),fx=sx(),[n4,yh]=t4(vh),px=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:s,activationMode:l="automatic",...c}=e,u=gh(s),[d,p]=go({prop:r,onChange:o,defaultProp:a});return f.jsx(n4,{scope:n,baseId:fo(),value:d,onValueChange:p,orientation:i,dir:u,activationMode:l,children:f.jsx(xe.div,{dir:u,"data-orientation":i,...c,ref:t})})});px.displayName=vh;var mx="TabsList",hx=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=yh(mx,n),i=fx(n);return f.jsx(YP,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:f.jsx(xe.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});hx.displayName=mx;var gx="TabsTrigger",vx=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,i=yh(gx,n),s=fx(n),l=wx(i.baseId,r),c=_x(i.baseId,r),u=r===i.value;return f.jsx(QP,{asChild:!0,...s,focusable:!o,active:u,children:f.jsx(xe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...a,ref:t,onMouseDown:we(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:we(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const d=i.activationMode!=="manual";!u&&!o&&d&&i.onValueChange(r)})})})});vx.displayName=gx;var yx="TabsContent",bx=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...i}=e,s=yh(yx,n),l=wx(s.baseId,r),c=_x(s.baseId,r),u=r===s.value,d=m.useRef(u);return m.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),f.jsx(ua,{present:o||u,children:({present:p})=>f.jsx(xe.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&a})})});bx.displayName=yx;function wx(e,t){return`${e}-trigger-${t}`}function _x(e,t){return`${e}-content-${t}`}var r4=px,xx=hx,kx=vx,Cx=bx;function Sx(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;ti(a))?.classGroupId}const sy=/^\[(.+)\]$/;function i4(e){if(sy.test(e)){const t=sy.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function s4(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return c4(Object.entries(e.classGroups),n).forEach(([a,i])=>{Z0(i,r,a,t)}),r}function Z0(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:ly(t,o);a.classGroupId=n;return}if(typeof o=="function"){if(l4(o)){Z0(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,i])=>{Z0(i,ly(t,a),n,r)})})}function ly(e,t){let n=e;return t.split(bh).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function l4(e){return e.isThemeGetter}function c4(e,t){return t?e.map(([n,r])=>{const o=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,s])=>[t+i,s])):a);return[n,o]}):e}function u4(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(a,i){n.set(a,i),t++,t>e&&(t=0,r=n,n=new Map)}return{get(a){let i=n.get(a);if(i!==void 0)return i;if((i=r.get(a))!==void 0)return o(a,i),i},set(a,i){n.has(a)?n.set(a,i):o(a,i)}}}const Ex="!";function d4(e){const t=e.separator,n=t.length===1,r=t[0],o=t.length;return function(i){const s=[];let l=0,c=0,u;for(let h=0;hc?u-c:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}}}function f4(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function p4(e){return{cache:u4(e.cacheSize),splitModifiers:d4(e),...a4(e)}}const m4=/\s+/;function h4(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=new Set;return e.trim().split(m4).map(i=>{const{modifiers:s,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:u}=n(i);let d=r(u?c.substring(0,u):c),p=!!u;if(!d){if(!u)return{isTailwindClass:!1,originalClassName:i};if(d=r(c),!d)return{isTailwindClass:!1,originalClassName:i};p=!1}const g=f4(s).join(":");return{isTailwindClass:!0,modifierId:l?g+Ex:g,classGroupId:d,originalClassName:i,hasPostfixModifier:p}}).reverse().filter(i=>{if(!i.isTailwindClass)return!0;const{modifierId:s,classGroupId:l,hasPostfixModifier:c}=i,u=s+l;return a.has(u)?!1:(a.add(u),o(l,c).forEach(d=>a.add(s+d)),!0)}).reverse().map(i=>i.originalClassName).join(" ")}function g4(){let e=0,t,n,r="";for(;ed(u),e());return n=p4(c),r=n.cache.get,o=n.cache.set,a=s,s(l)}function s(l){const c=r(l);if(c)return c;const u=h4(l,n);return o(l,u),u}return function(){return a(g4.apply(null,arguments))}}function Ve(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const Px=/^\[(?:([a-z-]+):)?(.+)\]$/i,y4=/^\d+\/\d+$/,b4=new Set(["px","full","screen"]),w4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,x4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,k4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function sr(e){return $o(e)||b4.has(e)||y4.test(e)}function Hr(e){return Li(e,"length",R4)}function $o(e){return!!e&&!Number.isNaN(Number(e))}function ql(e){return Li(e,"number",$o)}function Zi(e){return!!e&&Number.isInteger(Number(e))}function S4(e){return e.endsWith("%")&&$o(e.slice(0,-1))}function Se(e){return Px.test(e)}function Wr(e){return w4.test(e)}const T4=new Set(["length","size","percentage"]);function E4(e){return Li(e,T4,Mx)}function N4(e){return Li(e,"position",Mx)}const P4=new Set(["image","url"]);function M4(e){return Li(e,P4,O4)}function A4(e){return Li(e,"",I4)}function Ji(){return!0}function Li(e,t,n){const r=Px.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function R4(e){return _4.test(e)&&!x4.test(e)}function Mx(){return!1}function I4(e){return k4.test(e)}function O4(e){return C4.test(e)}function D4(){const e=Ve("colors"),t=Ve("spacing"),n=Ve("blur"),r=Ve("brightness"),o=Ve("borderColor"),a=Ve("borderRadius"),i=Ve("borderSpacing"),s=Ve("borderWidth"),l=Ve("contrast"),c=Ve("grayscale"),u=Ve("hueRotate"),d=Ve("invert"),p=Ve("gap"),g=Ve("gradientColorStops"),v=Ve("gradientColorStopPositions"),h=Ve("inset"),_=Ve("margin"),b=Ve("opacity"),y=Ve("padding"),x=Ve("saturate"),E=Ve("scale"),w=Ve("sepia"),T=Ve("skew"),k=Ve("space"),C=Ve("translate"),P=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",Se,t],N=()=>[Se,t],B=()=>["",sr,Hr],D=()=>["auto",$o,Se],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],G=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],Z=()=>["","0",Se],re=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[$o,ql],U=()=>[$o,Se];return{cacheSize:500,separator:":",theme:{colors:[Ji],spacing:[sr,Hr],blur:["none","",Wr,Se],brightness:fe(),borderColor:[e],borderRadius:["none","","full",Wr,Se],borderSpacing:N(),borderWidth:B(),contrast:fe(),grayscale:Z(),hueRotate:U(),invert:Z(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[S4,Hr],inset:R(),margin:R(),opacity:fe(),padding:N(),saturate:fe(),scale:fe(),sepia:Z(),skew:U(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",Se]}],container:["container"],columns:[{columns:[Wr]}],"break-after":[{"break-after":re()}],"break-before":[{"break-before":re()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),Se]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zi,Se]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Se]}],grow:[{grow:Z()}],shrink:[{shrink:Z()}],order:[{order:["first","last","none",Zi,Se]}],"grid-cols":[{"grid-cols":[Ji]}],"col-start-end":[{col:["auto",{span:["full",Zi,Se]},Se]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ji]}],"row-start-end":[{row:["auto",{span:[Zi,Se]},Se]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Se]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Se]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Se,t]}],"min-w":[{"min-w":[Se,t,"min","max","fit"]}],"max-w":[{"max-w":[Se,t,"none","full","min","max","fit","prose",{screen:[Wr]},Wr]}],h:[{h:[Se,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Se,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Se,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Se,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Wr,Hr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ql]}],"font-family":[{font:[Ji]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Se]}],"line-clamp":[{"line-clamp":["none",$o,ql]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",sr,Se]}],"list-image":[{"list-image":["none",Se]}],"list-style-type":[{list:["none","disc","decimal",Se]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",sr,Hr]}],"underline-offset":[{"underline-offset":["auto",sr,Se]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),N4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",E4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...G(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:G()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...G()]}],"outline-offset":[{"outline-offset":[sr,Se]}],"outline-w":[{outline:[sr,Hr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[sr,Hr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wr,A4]}],"shadow-color":[{shadow:[Ji]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wr,Se]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[x]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Se]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Se]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Se]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Zi,Se]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Se]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Se]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Se]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[sr,Hr,ql]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const L4=v4(D4);function Ee(...e){return L4(o4(e))}const od=r4,cl=m.forwardRef(({className:e,...t},n)=>f.jsx(xx,{ref:n,className:Ee("inline-flex flex-wrap items-center rounded-md bg-slate-100 p-1 mt-2 dark:bg-slate-800",e),...t}));cl.displayName=xx.displayName;const ul=m.forwardRef(({className:e,...t},n)=>f.jsx(kx,{className:Ee("inline-flex min-w-[100px] items-center justify-center rounded-[0.185rem] px-3 py-1.5 text-sm font-medium text-slate-700 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-slate-900 data-[state=active]:shadow-sm dark:text-slate-200 dark:data-[state=active]:bg-slate-900 dark:data-[state=active]:text-slate-100",e),...t,ref:n}));ul.displayName=kx.displayName;const dl=m.forwardRef(({className:e,...t},n)=>f.jsx(Cx,{className:Ee("mt-2 rounded-md border border-slate-200 p-6 dark:border-slate-700",e),...t,ref:n}));dl.displayName=Cx.displayName;function Ax(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,uy=j4,wh=(e,t)=>n=>{var r;if(t?.variants==null)return uy(e,n?.class,n?.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(c=>{const u=n?.[c],d=a?.[c];if(u===null)return null;const p=cy(u)||cy(d);return o[c][p]}),s=n&&Object.entries(n).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:p,...g}=u;return Object.entries(g).every(v=>{let[h,_]=v;return Array.isArray(_)?_.includes({...a,...s}[h]):{...a,...s}[h]===_})?[...c,d,p]:c},[]);return uy(e,i,l,n?.class,n?.className)},F4=wh("flex h-10 w-full rounded-md border bg-transparent py-2 px-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",{variants:{variant:{default:"border-slate-300 dark:border-slate-700",invalid:"border-red-500 dark:border-red-500"}},defaultVariants:{variant:"default"}}),jn=m.forwardRef(({className:e,value:t,variant:n,prefix:r,suffix:o,action:a,...i},s)=>f.jsxs("div",{className:"relative w-full",children:[r&&f.jsx("span",{className:"inline-flex items-center rounded-l-md bg-backgroundPrimary px-3 font-mono text-sm text-textSecondary brightness-hover",children:r}),f.jsx("input",{className:Ee(a&&"pr-8",e,F4({variant:n})),value:t,ref:s,...i}),o&&f.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-9 font-mono text-textSecondary",children:f.jsx("span",{className:"text-gray-500 sm:text-sm",children:o})}),a&&f.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 hover:text-gray-400 focus:outline-none ",onClick:a.onClick,children:f.jsx(a.icon,{size:20})})]}));jn.displayName="Input";var fl=e=>e.type==="checkbox",ri=e=>e instanceof Date,It=e=>e==null;const Rx=e=>typeof e=="object";var ft=e=>!It(e)&&!Array.isArray(e)&&Rx(e)&&!ri(e),Ix=e=>ft(e)&&e.target?fl(e.target)?e.target.checked:e.target.value:e,B4=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ox=(e,t)=>e.has(B4(t)),$4=e=>{const t=e.constructor&&e.constructor.prototype;return ft(t)&&t.hasOwnProperty("isPrototypeOf")},_h=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bt(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(_h&&(e instanceof Blob||e instanceof FileList))&&(n||ft(e)))if(t=n?[]:{},!n&&!$4(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Bt(e[r]));else return e;return t}var pl=e=>Array.isArray(e)?e.filter(Boolean):[],et=e=>e===void 0,de=(e,t,n)=>{if(!t||!ft(e))return n;const r=pl(t.split(/[,[\].]+?/)).reduce((o,a)=>It(o)?o:o[a],e);return et(r)||r===e?et(e[t])?n:e[t]:r},Kn=e=>typeof e=="boolean",xh=e=>/^\w*$/.test(e),Dx=e=>pl(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Fe=(e,t,n)=>{let r=-1;const o=xh(t)?[t]:Dx(t),a=o.length,i=a-1;for(;++rAe.useContext(U4);var Lx=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const i=a;return t._proxyFormState[i]!==In.all&&(t._proxyFormState[i]=!r||In.all),n&&(n[i]=!0),e[i]}});return o},qt=e=>ft(e)&&!Object.keys(e).length,jx=(e,t,n,r)=>{n(e);const{name:o,...a}=e;return qt(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!r||In.all))},Tc=e=>Array.isArray(e)?e:[e],Fx=(e,t,n)=>!e||!t||e===t||Tc(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function Ch(e){const t=Ae.useRef(e);t.current=e,Ae.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function V4(e){const t=kh(),{control:n=t.control,disabled:r,name:o,exact:a}=e||{},[i,s]=Ae.useState(n._formState),l=Ae.useRef(!0),c=Ae.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=Ae.useRef(o);return u.current=o,Ch({disabled:r,next:d=>l.current&&Fx(u.current,d.name,a)&&jx(d,c.current,n._updateFormState)&&s({...n._formState,...d}),subject:n._subjects.state}),Ae.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Lx(i,n,c.current,!1)}var Xn=e=>typeof e=="string",Bx=(e,t,n,r,o)=>Xn(e)?(r&&t.watch.add(e),de(n,e,o)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),de(n,a))):(r&&(t.watchAll=!0),n);function $x(e){const t=kh(),{control:n=t.control,name:r,defaultValue:o,disabled:a,exact:i}=e||{},s=Ae.useRef(r);s.current=r,Ch({disabled:a,subject:n._subjects.values,next:u=>{Fx(s.current,u.name,i)&&c(Bt(Bx(s.current,n._names,u.values||n._formValues,!1,o)))}});const[l,c]=Ae.useState(n._getWatch(r,o));return Ae.useEffect(()=>n._removeUnmounted()),l}function z4(e){const t=kh(),{name:n,disabled:r,control:o=t.control,shouldUnregister:a}=e,i=Ox(o._names.array,n),s=$x({control:o,name:n,defaultValue:de(o._formValues,n,de(o._defaultValues,n,e.defaultValue)),exact:!0}),l=V4({control:o,name:n}),c=Ae.useRef(o.register(n,{...e.rules,value:s,...Kn(e.disabled)?{disabled:e.disabled}:{}}));return Ae.useEffect(()=>{const u=o._options.shouldUnregister||a,d=(p,g)=>{const v=de(o._fields,p);v&&v._f&&(v._f.mount=g)};if(d(n,!0),u){const p=Bt(de(o._options.defaultValues,n));Fe(o._defaultValues,n,p),et(de(o._formValues,n))&&Fe(o._formValues,n,p)}return()=>{(i?u&&!o._state.action:u)?o.unregister(n):d(n,!1)}},[n,o,i,a]),Ae.useEffect(()=>{de(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:de(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:s,...Kn(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:Ae.useCallback(u=>c.current.onChange({target:{value:Ix(u),name:n},type:du.CHANGE}),[n]),onBlur:Ae.useCallback(()=>c.current.onBlur({target:{value:de(o._formValues,n),name:n},type:du.BLUR}),[n,o]),ref:u=>{const d=de(o._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:p=>u.setCustomValidity(p),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!de(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!de(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!de(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!de(l.validatingFields,n)},error:{enumerable:!0,get:()=>de(l.errors,n)}})}}const ml=e=>e.render(z4(e));var H4=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},dy=e=>({isOnSubmit:!e||e===In.onSubmit,isOnBlur:e===In.onBlur,isOnChange:e===In.onChange,isOnAll:e===In.all,isOnTouch:e===In.onTouched}),fy=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ys=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const a=de(e,o);if(a){const{_f:i,...s}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;ys(s,t)}else ft(s)&&ys(s,t)}}};var W4=(e,t,n)=>{const r=pl(de(e,n));return Fe(r,"root",t[n]),Fe(e,n,r),e},Sh=e=>e.type==="file",no=e=>typeof e=="function",fu=e=>{if(!_h)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ec=e=>Xn(e),Th=e=>e.type==="radio",pu=e=>e instanceof RegExp;const py={value:!1,isValid:!1},my={value:!0,isValid:!0};var Ux=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!et(e[0].attributes.value)?et(e[0].value)||e[0].value===""?my:{value:e[0].value,isValid:!0}:my:py}return py};const hy={isValid:!1,value:null};var Vx=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,hy):hy;function gy(e,t,n="validate"){if(Ec(e)||Array.isArray(e)&&e.every(Ec)||Kn(e)&&!e)return{type:n,message:Ec(e)?e:"",ref:t}}var Da=e=>ft(e)&&!pu(e)?e:{value:e,message:""},vy=async(e,t,n,r,o)=>{const{ref:a,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:g,name:v,valueAsNumber:h,mount:_,disabled:b}=e._f,y=de(t,v);if(!_||b)return{};const x=i?i[0]:a,E=N=>{r&&x.reportValidity&&(x.setCustomValidity(Kn(N)?"":N||""),x.reportValidity())},w={},T=Th(a),k=fl(a),C=T||k,P=(h||Sh(a))&&et(a.value)&&et(y)||fu(a)&&a.value===""||y===""||Array.isArray(y)&&!y.length,O=H4.bind(null,v,n,w),R=(N,B,D,L=lr.maxLength,G=lr.minLength)=>{const Y=N?B:D;w[v]={type:N?L:G,message:Y,ref:a,...O(N?L:G,Y)}};if(o?!Array.isArray(y)||!y.length:s&&(!C&&(P||It(y))||Kn(y)&&!y||k&&!Ux(i).isValid||T&&!Vx(i).isValid)){const{value:N,message:B}=Ec(s)?{value:!!s,message:s}:Da(s);if(N&&(w[v]={type:lr.required,message:B,ref:x,...O(lr.required,B)},!n))return E(B),w}if(!P&&(!It(u)||!It(d))){let N,B;const D=Da(d),L=Da(u);if(!It(y)&&!isNaN(y)){const G=a.valueAsNumber||y&&+y;It(D.value)||(N=G>D.value),It(L.value)||(B=Gnew Date(new Date().toDateString()+" "+re),K=a.type=="time",Z=a.type=="week";Xn(D.value)&&y&&(N=K?Y(y)>Y(D.value):Z?y>D.value:G>new Date(D.value)),Xn(L.value)&&y&&(B=K?Y(y)+N.value,L=!It(B.value)&&y.length<+B.value;if((D||L)&&(R(D,N.message,B.message),!n))return E(w[v].message),w}if(p&&!P&&Xn(y)){const{value:N,message:B}=Da(p);if(pu(N)&&!y.match(N)&&(w[v]={type:lr.pattern,message:B,ref:a,...O(lr.pattern,B)},!n))return E(B),w}if(g){if(no(g)){const N=await g(y,t),B=gy(N,x);if(B&&(w[v]={...B,...O(lr.validate,B.message)},!n))return E(B.message),w}else if(ft(g)){let N={};for(const B in g){if(!qt(N)&&!n)break;const D=gy(await g[B](y,t),x,B);D&&(N={...D,...O(B,D.message)},E(D.message),n&&(w[v]=N))}if(!qt(N)&&(w[v]={ref:x,...N},!n))return w}}return E(!0),w};function G4(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}},mu=e=>It(e)||!Rx(e);function Uo(e,t){if(mu(e)||mu(t))return e===t;if(ri(e)&&ri(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const a=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(ri(a)&&ri(i)||ft(a)&&ft(i)||Array.isArray(a)&&Array.isArray(i)?!Uo(a,i):a!==i)return!1}}return!0}var zx=e=>e.type==="select-multiple",q4=e=>Th(e)||fl(e),mf=e=>fu(e)&&e.isConnected,Hx=e=>{for(const t in e)if(no(e[t]))return!0;return!1};function hu(e,t={}){const n=Array.isArray(e);if(ft(e)||n)for(const r in e)Array.isArray(e[r])||ft(e[r])&&!Hx(e[r])?(t[r]=Array.isArray(e[r])?[]:{},hu(e[r],t[r])):It(e[r])||(t[r]=!0);return t}function Wx(e,t,n){const r=Array.isArray(e);if(ft(e)||r)for(const o in e)Array.isArray(e[o])||ft(e[o])&&!Hx(e[o])?et(t)||mu(n[o])?n[o]=Array.isArray(e[o])?hu(e[o],[]):{...hu(e[o])}:Wx(e[o],It(t)?{}:t[o],n[o]):n[o]=!Uo(e[o],t[o]);return n}var Xl=(e,t)=>Wx(e,t,hu(t)),Gx=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>et(e)?e:t?e===""?NaN:e&&+e:n&&Xn(e)?new Date(e):r?r(e):e;function hf(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Sh(t)?t.files:Th(t)?Vx(e.refs).value:zx(t)?[...t.selectedOptions].map(({value:n})=>n):fl(t)?Ux(e.refs).value:Gx(et(t.value)?e.ref.value:t.value,e)}var X4=(e,t,n,r)=>{const o={};for(const a of e){const i=de(t,a);i&&Fe(o,a,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},es=e=>et(e)?e:pu(e)?e.source:ft(e)?pu(e.value)?e.value.source:e.value:e,Y4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function yy(e,t,n){const r=de(e,n);if(r||xh(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const a=o.join("."),i=de(t,a),s=de(e,a);if(i&&!Array.isArray(i)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};o.pop()}return{name:n}}var Q4=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Z4=(e,t)=>!pl(de(e,t)).length&&ct(e,t);const J4={mode:In.onSubmit,reValidateMode:In.onChange,shouldFocusError:!0};function eM(e={}){let t={...J4,...e},n={submitCount:0,isDirty:!1,isLoading:no(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=ft(t.defaultValues)||ft(t.values)?Bt(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Bt(o),i={action:!1,mount:!1,watch:!1},s={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:pf(),array:pf(),state:pf()},p=dy(t.mode),g=dy(t.reValidateMode),v=t.criteriaMode===In.all,h=A=>q=>{clearTimeout(c),c=setTimeout(A,q)},_=async A=>{if(u.isValid||A){const q=t.resolver?qt((await C()).errors):await O(r,!0);q!==n.isValid&&d.state.next({isValid:q})}},b=(A,q)=>{(u.isValidating||u.validatingFields)&&((A||Array.from(s.mount)).forEach(Q=>{Q&&(q?Fe(n.validatingFields,Q,q):ct(n.validatingFields,Q))}),d.state.next({validatingFields:n.validatingFields,isValidating:!qt(n.validatingFields)}))},y=(A,q=[],Q,ue,le=!0,oe=!0)=>{if(ue&&Q){if(i.action=!0,oe&&Array.isArray(de(r,A))){const me=Q(de(r,A),ue.argA,ue.argB);le&&Fe(r,A,me)}if(oe&&Array.isArray(de(n.errors,A))){const me=Q(de(n.errors,A),ue.argA,ue.argB);le&&Fe(n.errors,A,me),Z4(n.errors,A)}if(u.touchedFields&&oe&&Array.isArray(de(n.touchedFields,A))){const me=Q(de(n.touchedFields,A),ue.argA,ue.argB);le&&Fe(n.touchedFields,A,me)}u.dirtyFields&&(n.dirtyFields=Xl(o,a)),d.state.next({name:A,isDirty:N(A,q),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Fe(a,A,q)},x=(A,q)=>{Fe(n.errors,A,q),d.state.next({errors:n.errors})},E=A=>{n.errors=A,d.state.next({errors:n.errors,isValid:!1})},w=(A,q,Q,ue)=>{const le=de(r,A);if(le){const oe=de(a,A,et(Q)?de(o,A):Q);et(oe)||ue&&ue.defaultChecked||q?Fe(a,A,q?oe:hf(le._f)):L(A,oe),i.mount&&_()}},T=(A,q,Q,ue,le)=>{let oe=!1,me=!1;const ke={name:A},je=!!(de(r,A)&&de(r,A)._f&&de(r,A)._f.disabled);if(!Q||ue){u.isDirty&&(me=n.isDirty,n.isDirty=ke.isDirty=N(),oe=me!==ke.isDirty);const Ge=je||Uo(de(o,A),q);me=!!(!je&&de(n.dirtyFields,A)),Ge||je?ct(n.dirtyFields,A):Fe(n.dirtyFields,A,!0),ke.dirtyFields=n.dirtyFields,oe=oe||u.dirtyFields&&me!==!Ge}if(Q){const Ge=de(n.touchedFields,A);Ge||(Fe(n.touchedFields,A,Q),ke.touchedFields=n.touchedFields,oe=oe||u.touchedFields&&Ge!==Q)}return oe&&le&&d.state.next(ke),oe?ke:{}},k=(A,q,Q,ue)=>{const le=de(n.errors,A),oe=u.isValid&&Kn(q)&&n.isValid!==q;if(e.delayError&&Q?(l=h(()=>x(A,Q)),l(e.delayError)):(clearTimeout(c),l=null,Q?Fe(n.errors,A,Q):ct(n.errors,A)),(Q?!Uo(le,Q):le)||!qt(ue)||oe){const me={...ue,...oe&&Kn(q)?{isValid:q}:{},errors:n.errors,name:A};n={...n,...me},d.state.next(me)}},C=async A=>{b(A,!0);const q=await t.resolver(a,t.context,X4(A||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(A),q},P=async A=>{const{errors:q}=await C(A);if(A)for(const Q of A){const ue=de(q,Q);ue?Fe(n.errors,Q,ue):ct(n.errors,Q)}else n.errors=q;return q},O=async(A,q,Q={valid:!0})=>{for(const ue in A){const le=A[ue];if(le){const{_f:oe,...me}=le;if(oe){const ke=s.array.has(oe.name);b([ue],!0);const je=await vy(le,a,v,t.shouldUseNativeValidation&&!q,ke);if(b([ue]),je[oe.name]&&(Q.valid=!1,q))break;!q&&(de(je,oe.name)?ke?W4(n.errors,je,oe.name):Fe(n.errors,oe.name,je[oe.name]):ct(n.errors,oe.name))}me&&await O(me,q,Q)}}return Q.valid},R=()=>{for(const A of s.unMount){const q=de(r,A);q&&(q._f.refs?q._f.refs.every(Q=>!mf(Q)):!mf(q._f.ref))&&X(A)}s.unMount=new Set},N=(A,q)=>(A&&q&&Fe(a,A,q),!Uo(fe(),o)),B=(A,q,Q)=>Bx(A,s,{...i.mount?a:et(q)?o:Xn(A)?{[A]:q}:q},Q,q),D=A=>pl(de(i.mount?a:o,A,e.shouldUnregister?de(o,A,[]):[])),L=(A,q,Q={})=>{const ue=de(r,A);let le=q;if(ue){const oe=ue._f;oe&&(!oe.disabled&&Fe(a,A,Gx(q,oe)),le=fu(oe.ref)&&It(q)?"":q,zx(oe.ref)?[...oe.ref.options].forEach(me=>me.selected=le.includes(me.value)):oe.refs?fl(oe.ref)?oe.refs.length>1?oe.refs.forEach(me=>(!me.defaultChecked||!me.disabled)&&(me.checked=Array.isArray(le)?!!le.find(ke=>ke===me.value):le===me.value)):oe.refs[0]&&(oe.refs[0].checked=!!le):oe.refs.forEach(me=>me.checked=me.value===le):Sh(oe.ref)?oe.ref.value="":(oe.ref.value=le,oe.ref.type||d.values.next({name:A,values:{...a}})))}(Q.shouldDirty||Q.shouldTouch)&&T(A,le,Q.shouldTouch,Q.shouldDirty,!0),Q.shouldValidate&&re(A)},G=(A,q,Q)=>{for(const ue in q){const le=q[ue],oe=`${A}.${ue}`,me=de(r,oe);(s.array.has(A)||!mu(le)||me&&!me._f)&&!ri(le)?G(oe,le,Q):L(oe,le,Q)}},Y=(A,q,Q={})=>{const ue=de(r,A),le=s.array.has(A),oe=Bt(q);Fe(a,A,oe),le?(d.array.next({name:A,values:{...a}}),(u.isDirty||u.dirtyFields)&&Q.shouldDirty&&d.state.next({name:A,dirtyFields:Xl(o,a),isDirty:N(A,oe)})):ue&&!ue._f&&!It(oe)?G(A,oe,Q):L(A,oe,Q),fy(A,s)&&d.state.next({...n}),d.values.next({name:i.mount?A:void 0,values:{...a}})},K=async A=>{i.mount=!0;const q=A.target;let Q=q.name,ue=!0;const le=de(r,Q),oe=()=>q.type?hf(le._f):Ix(A),me=ke=>{ue=Number.isNaN(ke)||ke===de(a,Q,ke)};if(le){let ke,je;const Ge=oe(),At=A.type===du.BLUR||A.type===du.FOCUS_OUT,nr=!Y4(le._f)&&!t.resolver&&!de(n.errors,Q)&&!le._f.deps||Q4(At,de(n.touchedFields,Q),n.isSubmitted,g,p),lt=fy(Q,s,At);Fe(a,Q,Ge),At?(le._f.onBlur&&le._f.onBlur(A),l&&l(0)):le._f.onChange&&le._f.onChange(A);const Tn=T(Q,Ge,At,!1),rr=!qt(Tn)||lt;if(!At&&d.values.next({name:Q,type:A.type,values:{...a}}),nr)return u.isValid&&_(),rr&&d.state.next({name:Q,...lt?{}:Tn});if(!At&<&&d.state.next({...n}),t.resolver){const{errors:or}=await C([Q]);if(me(Ge),ue){const ar=yy(n.errors,r,Q),sn=yy(or,r,ar.name||Q);ke=sn.error,Q=sn.name,je=qt(or)}}else b([Q],!0),ke=(await vy(le,a,v,t.shouldUseNativeValidation))[Q],b([Q]),me(Ge),ue&&(ke?je=!1:u.isValid&&(je=await O(r,!0)));ue&&(le._f.deps&&re(le._f.deps),k(Q,je,ke,Tn))}},Z=(A,q)=>{if(de(n.errors,q)&&A.focus)return A.focus(),1},re=async(A,q={})=>{let Q,ue;const le=Tc(A);if(t.resolver){const oe=await P(et(A)?A:le);Q=qt(oe),ue=A?!le.some(me=>de(oe,me)):Q}else A?(ue=(await Promise.all(le.map(async oe=>{const me=de(r,oe);return await O(me&&me._f?{[oe]:me}:me)}))).every(Boolean),!(!ue&&!n.isValid)&&_()):ue=Q=await O(r);return d.state.next({...!Xn(A)||u.isValid&&Q!==n.isValid?{}:{name:A},...t.resolver||!A?{isValid:Q}:{},errors:n.errors}),q.shouldFocus&&!ue&&ys(r,Z,A?le:s.mount),ue},fe=A=>{const q={...i.mount?a:o};return et(A)?q:Xn(A)?de(q,A):A.map(Q=>de(q,Q))},U=(A,q)=>({invalid:!!de((q||n).errors,A),isDirty:!!de((q||n).dirtyFields,A),error:de((q||n).errors,A),isValidating:!!de(n.validatingFields,A),isTouched:!!de((q||n).touchedFields,A)}),ae=A=>{A&&Tc(A).forEach(q=>ct(n.errors,q)),d.state.next({errors:A?n.errors:{}})},se=(A,q,Q)=>{const ue=(de(r,A,{_f:{}})._f||{}).ref,le=de(n.errors,A)||{},{ref:oe,message:me,type:ke,...je}=le;Fe(n.errors,A,{...je,...q,ref:ue}),d.state.next({name:A,errors:n.errors,isValid:!1}),Q&&Q.shouldFocus&&ue&&ue.focus&&ue.focus()},S=(A,q)=>no(A)?d.values.subscribe({next:Q=>A(B(void 0,q),Q)}):B(A,q,!0),X=(A,q={})=>{for(const Q of A?Tc(A):s.mount)s.mount.delete(Q),s.array.delete(Q),q.keepValue||(ct(r,Q),ct(a,Q)),!q.keepError&&ct(n.errors,Q),!q.keepDirty&&ct(n.dirtyFields,Q),!q.keepTouched&&ct(n.touchedFields,Q),!q.keepIsValidating&&ct(n.validatingFields,Q),!t.shouldUnregister&&!q.keepDefaultValue&&ct(o,Q);d.values.next({values:{...a}}),d.state.next({...n,...q.keepDirty?{isDirty:N()}:{}}),!q.keepIsValid&&_()},H=({disabled:A,name:q,field:Q,fields:ue,value:le})=>{if(Kn(A)&&i.mount||A){const oe=A?void 0:et(le)?hf(Q?Q._f:de(ue,q)._f):le;Fe(a,q,oe),T(q,oe,!1,!1,!0)}},I=(A,q={})=>{let Q=de(r,A);const ue=Kn(q.disabled);return Fe(r,A,{...Q||{},_f:{...Q&&Q._f?Q._f:{ref:{name:A}},name:A,mount:!0,...q}}),s.mount.add(A),Q?H({field:Q,disabled:q.disabled,name:A,value:q.value}):w(A,!0,q.value),{...ue?{disabled:q.disabled}:{},...t.progressive?{required:!!q.required,min:es(q.min),max:es(q.max),minLength:es(q.minLength),maxLength:es(q.maxLength),pattern:es(q.pattern)}:{},name:A,onChange:K,onBlur:K,ref:le=>{if(le){I(A,q),Q=de(r,A);const oe=et(le.value)&&le.querySelectorAll&&le.querySelectorAll("input,select,textarea")[0]||le,me=q4(oe),ke=Q._f.refs||[];if(me?ke.find(je=>je===oe):oe===Q._f.ref)return;Fe(r,A,{_f:{...Q._f,...me?{refs:[...ke.filter(mf),oe,...Array.isArray(de(o,A))?[{}]:[]],ref:{type:oe.type,name:A}}:{ref:oe}}}),w(A,!1,void 0,oe)}else Q=de(r,A,{}),Q._f&&(Q._f.mount=!1),(t.shouldUnregister||q.shouldUnregister)&&!(Ox(s.array,A)&&i.action)&&s.unMount.add(A)}}},F=()=>t.shouldFocusError&&ys(r,Z,s.mount),j=A=>{Kn(A)&&(d.state.next({disabled:A}),ys(r,(q,Q)=>{const ue=de(r,Q);ue&&(q.disabled=ue._f.disabled||A,Array.isArray(ue._f.refs)&&ue._f.refs.forEach(le=>{le.disabled=ue._f.disabled||A}))},0,!1))},$=(A,q)=>async Q=>{let ue;Q&&(Q.preventDefault&&Q.preventDefault(),Q.persist&&Q.persist());let le=Bt(a);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:oe,values:me}=await C();n.errors=oe,le=me}else await O(r);if(ct(n.errors,"root"),qt(n.errors)){d.state.next({errors:{}});try{await A(le,Q)}catch(oe){ue=oe}}else q&&await q({...n.errors},Q),F(),setTimeout(F);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:qt(n.errors)&&!ue,submitCount:n.submitCount+1,errors:n.errors}),ue)throw ue},V=(A,q={})=>{de(r,A)&&(et(q.defaultValue)?Y(A,Bt(de(o,A))):(Y(A,q.defaultValue),Fe(o,A,Bt(q.defaultValue))),q.keepTouched||ct(n.touchedFields,A),q.keepDirty||(ct(n.dirtyFields,A),n.isDirty=q.defaultValue?N(A,Bt(de(o,A))):N()),q.keepError||(ct(n.errors,A),u.isValid&&_()),d.state.next({...n}))},J=(A,q={})=>{const Q=A?Bt(A):o,ue=Bt(Q),le=qt(A),oe=le?o:ue;if(q.keepDefaultValues||(o=Q),!q.keepValues){if(q.keepDirtyValues)for(const me of s.mount)de(n.dirtyFields,me)?Fe(oe,me,de(a,me)):Y(me,de(oe,me));else{if(_h&&et(A))for(const me of s.mount){const ke=de(r,me);if(ke&&ke._f){const je=Array.isArray(ke._f.refs)?ke._f.refs[0]:ke._f.ref;if(fu(je)){const Ge=je.closest("form");if(Ge){Ge.reset();break}}}}r={}}a=e.shouldUnregister?q.keepDefaultValues?Bt(o):{}:Bt(oe),d.array.next({values:{...oe}}),d.values.next({values:{...oe}})}s={mount:q.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!q.keepIsValid||!!q.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:q.keepSubmitCount?n.submitCount:0,isDirty:le?!1:q.keepDirty?n.isDirty:!!(q.keepDefaultValues&&!Uo(A,o)),isSubmitted:q.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:le?[]:q.keepDirtyValues?q.keepDefaultValues&&a?Xl(o,a):n.dirtyFields:q.keepDefaultValues&&A?Xl(o,A):q.keepDirty?n.dirtyFields:{},touchedFields:q.keepTouched?n.touchedFields:{},errors:q.keepErrors?n.errors:{},isSubmitSuccessful:q.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ee=(A,q)=>J(no(A)?A(a):A,q);return{control:{register:I,unregister:X,getFieldState:U,handleSubmit:$,setError:se,_executeSchema:C,_getWatch:B,_getDirty:N,_updateValid:_,_removeUnmounted:R,_updateFieldArray:y,_updateDisabledField:H,_getFieldArray:D,_reset:J,_resetDefaultValues:()=>no(t.defaultValues)&&t.defaultValues().then(A=>{ee(A,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:A=>{n={...n,...A}},_disableForm:j,_subjects:d,_proxyFormState:u,_setErrors:E,get _fields(){return r},get _formValues(){return a},get _state(){return i},set _state(A){i=A},get _defaultValues(){return o},get _names(){return s},set _names(A){s=A},get _formState(){return n},set _formState(A){n=A},get _options(){return t},set _options(A){t={...t,...A}}},trigger:re,register:I,handleSubmit:$,watch:S,setValue:Y,getValues:fe,reset:ee,resetField:V,clearErrors:ae,unregister:X,setError:se,setFocus:(A,q={})=>{const Q=de(r,A),ue=Q&&Q._f;if(ue){const le=ue.refs?ue.refs[0]:ue.ref;le.focus&&(le.focus(),q.shouldSelect&&le.select())}},getFieldState:U}}function Eh(e={}){const t=Ae.useRef(),n=Ae.useRef(),[r,o]=Ae.useState({isDirty:!1,isValidating:!1,isLoading:no(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:no(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...eM(e),formState:r});const a=t.current.control;return a._options=e,Ch({subject:a._subjects.state,next:i=>{jx(i,a._proxyFormState,a._updateFormState,!0)&&o({...a._formState})}}),Ae.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),Ae.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==r.isDirty&&a._subjects.state.next({isDirty:i})}},[a,r.isDirty]),Ae.useEffect(()=>{e.values&&!Uo(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,o(i=>({...i}))):a._resetDefaultValues()},[e.values,a]),Ae.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),Ae.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),Ae.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),t.current.formState=Lx(r,a),t.current}function tM({control:e,disabled:t,field:n}){return f.jsx(ml,{name:n.name,control:e,render:({field:{value:r,onChange:o,...a}})=>f.jsx(jn,{type:n.type,step:n.properties?.step,value:n.type==="number"?Number.parseFloat(r):r,onChange:i=>{n.inputChange&&n.inputChange(i),o(n.type==="number"?Number.parseFloat(i.target.value):i.target.value)},...n.properties,...a,disabled:t})})}const nM=wh("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 dark:hover:bg-slate-800 dark:hover:text-slate-100 disabled:opacity-50 dark:focus:ring-slate-400 disabled:pointer-events-none dark:focus:ring-offset-slate-900 data-[state=open]:bg-slate-100 dark:data-[state=open]:bg-slate-800",{variants:{variant:{default:"bg-slate-900 text-white hover:bg-slate-700 dark:bg-slate-50 dark:text-slate-900",destructive:"bg-red-500 text-white hover:bg-red-600 dark:hover:bg-red-600",success:"bg-green-500 text-white hover:bg-green-600 dark:hover:bg-green-600",outline:"bg-transparent border border-slate-200 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-100",subtle:"bg-slate-100 text-slate-900 hover:bg-slate-200 dark:bg-slate-700 dark:text-slate-100",ghost:"bg-transparent hover:bg-slate-100 dark:hover:bg-slate-800 dark:text-slate-100 dark:hover:text-slate-100 data-[state=open]:bg-transparent dark:data-[state=open]:bg-transparent",link:"bg-transparent underline-offset-4 hover:underline text-slate-900 dark:text-slate-100 hover:bg-transparent dark:hover:bg-transparent"},size:{default:"h-10 py-2 px-4",sm:"h-9 px-2 rounded-md",lg:"h-11 px-8 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),pt=m.forwardRef(({className:e,variant:t,size:n,...r},o)=>f.jsx("button",{type:"button",className:Ee(nM({variant:t,size:n,className:e})),ref:o,...r}));pt.displayName="Button";function by(e,[t,n]){return Math.min(n,Math.max(t,e))}function rM(e,t=globalThis?.document){const n=Wt(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var oM="DismissableLayer",J0="dismissableLayer.update",aM="dismissableLayer.pointerDownOutside",iM="dismissableLayer.focusOutside",wy,Kx=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ad=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...l}=e,c=m.useContext(Kx),[u,d]=m.useState(null),p=u?.ownerDocument??globalThis?.document,[,g]=m.useState({}),v=$e(t,k=>d(k)),h=Array.from(c.layers),[_]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(_),y=u?h.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,E=y>=b,w=lM(k=>{const C=k.target,P=[...c.branches].some(O=>O.contains(C));!E||P||(o?.(k),i?.(k),k.defaultPrevented||s?.())},p),T=cM(k=>{const C=k.target;[...c.branches].some(O=>O.contains(C))||(a?.(k),i?.(k),k.defaultPrevented||s?.())},p);return rM(k=>{y===c.layers.size-1&&(r?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},p),m.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(wy=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),_y(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=wy)}},[u,p,n,c]),m.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),_y())},[u,c]),m.useEffect(()=>{const k=()=>g({});return document.addEventListener(J0,k),()=>document.removeEventListener(J0,k)},[]),f.jsx(xe.div,{...l,ref:v,style:{pointerEvents:x?E?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,T.onFocusCapture),onBlurCapture:we(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,w.onPointerDownCapture)})});ad.displayName=oM;var sM="DismissableLayerBranch",qx=m.forwardRef((e,t)=>{const n=m.useContext(Kx),r=m.useRef(null),o=$e(t,r);return m.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),f.jsx(xe.div,{...e,ref:o})});qx.displayName=sM;function lM(e,t=globalThis?.document){const n=Wt(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let l=function(){Xx(aM,n,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function cM(e,t=globalThis?.document){const n=Wt(e),r=m.useRef(!1);return m.useEffect(()=>{const o=a=>{a.target&&!r.current&&Xx(iM,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _y(){const e=new CustomEvent(J0);document.dispatchEvent(e)}function Xx(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ax(o,a):o.dispatchEvent(a)}var uM=ad,dM=qx,gf=0;function Yx(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??xy()),document.body.insertAdjacentElement("beforeend",e[1]??xy()),gf++,()=>{gf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gf--}},[])}function xy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var vf="focusScope.autoFocusOnMount",yf="focusScope.autoFocusOnUnmount",ky={bubbles:!1,cancelable:!0},fM="FocusScope",Nh=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=m.useState(null),c=Wt(o),u=Wt(a),d=m.useRef(null),p=$e(t,h=>l(h)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let h=function(x){if(g.paused||!s)return;const E=x.target;s.contains(E)?d.current=E:Kr(d.current,{select:!0})},_=function(x){if(g.paused||!s)return;const E=x.relatedTarget;E!==null&&(s.contains(E)||Kr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const w of x)w.removedNodes.length>0&&Kr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",_);const y=new MutationObserver(b);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",_),y.disconnect()}}},[r,s,g.paused]),m.useEffect(()=>{if(s){Sy.add(g);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(vf,ky);s.addEventListener(vf,c),s.dispatchEvent(b),b.defaultPrevented||(pM(yM(Qx(s)),{select:!0}),document.activeElement===h&&Kr(s))}return()=>{s.removeEventListener(vf,c),setTimeout(()=>{const b=new CustomEvent(yf,ky);s.addEventListener(yf,u),s.dispatchEvent(b),b.defaultPrevented||Kr(h??document.body,{select:!0}),s.removeEventListener(yf,u),Sy.remove(g)},0)}}},[s,c,u,g]);const v=m.useCallback(h=>{if(!n&&!r||g.paused)return;const _=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(_&&b){const y=h.currentTarget,[x,E]=mM(y);x&&E?!h.shiftKey&&b===E?(h.preventDefault(),n&&Kr(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),n&&Kr(E,{select:!0})):b===y&&h.preventDefault()}},[n,r,g.paused]);return f.jsx(xe.div,{tabIndex:-1,...i,ref:p,onKeyDown:v})});Nh.displayName=fM;function pM(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kr(r,{select:t}),document.activeElement!==n)return}function mM(e){const t=Qx(e),n=Cy(t,e),r=Cy(t.reverse(),e);return[n,r]}function Qx(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Cy(e,t){for(const n of e)if(!hM(n,{upTo:t}))return n}function hM(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function gM(e){return e instanceof HTMLInputElement&&"select"in e}function Kr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&gM(e)&&t&&e.select()}}var Sy=vM();function vM(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ty(e,t),e.unshift(t)},remove(t){e=Ty(e,t),e[0]?.resume()}}}function Ty(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yM(e){return e.filter(t=>t.tagName!=="A")}const bM=["top","right","bottom","left"],Yn=Math.min,Yt=Math.max,gu=Math.round,Yl=Math.floor,vo=e=>({x:e,y:e}),wM={left:"right",right:"left",bottom:"top",top:"bottom"},_M={start:"end",end:"start"};function ep(e,t,n){return Yt(e,Yn(t,n))}function Tr(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function ji(e){return e.split("-")[1]}function Ph(e){return e==="x"?"y":"x"}function Mh(e){return e==="y"?"height":"width"}function yo(e){return["top","bottom"].includes(Er(e))?"y":"x"}function Ah(e){return Ph(yo(e))}function xM(e,t,n){n===void 0&&(n=!1);const r=ji(e),o=Ah(e),a=Mh(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=vu(i)),[i,vu(i)]}function kM(e){const t=vu(e);return[tp(e),t,tp(t)]}function tp(e){return e.replace(/start|end/g,t=>_M[t])}function CM(e,t,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?a:i;default:return[]}}function SM(e,t,n,r){const o=ji(e);let a=CM(Er(e),n==="start",r);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(tp)))),a}function vu(e){return e.replace(/left|right|bottom|top/g,t=>wM[t])}function TM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zx(e){return typeof e!="number"?TM(e):{top:e,right:e,bottom:e,left:e}}function yu(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ey(e,t,n){let{reference:r,floating:o}=e;const a=yo(t),i=Ah(t),s=Mh(i),l=Er(t),c=a==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:d};break;case"left":g={x:r.x-o.width,y:d};break;default:g={x:r.x,y:r.y}}switch(ji(t)){case"start":g[i]-=p*(n&&c?-1:1);break;case"end":g[i]+=p*(n&&c?-1:1);break}return g}const EM=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ey(c,r,l),p=r,g={},v=0;for(let h=0;h({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Tr(e,t)||{};if(c==null)return{};const d=Zx(u),p={x:n,y:r},g=Ah(o),v=Mh(g),h=await i.getDimensions(c),_=g==="y",b=_?"top":"left",y=_?"bottom":"right",x=_?"clientHeight":"clientWidth",E=a.reference[v]+a.reference[g]-p[g]-a.floating[v],w=p[g]-a.reference[g],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let k=T?T[x]:0;(!k||!await(i.isElement==null?void 0:i.isElement(T)))&&(k=s.floating[x]||a.floating[v]);const C=E/2-w/2,P=k/2-h[v]/2-1,O=Yn(d[b],P),R=Yn(d[y],P),N=O,B=k-h[v]-R,D=k/2-h[v]/2+C,L=ep(N,D,B),G=!l.arrow&&ji(o)!=null&&D!==L&&a.reference[v]/2-(DD<=0)){var R,N;const D=(((R=a.flip)==null?void 0:R.index)||0)+1,L=k[D];if(L)return{data:{index:D,overflows:O},reset:{placement:L}};let G=(N=O.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:N.placement;if(!G)switch(g){case"bestFit":{var B;const Y=(B=O.filter(K=>{if(T){const Z=yo(K.placement);return Z===y||Z==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Z=>Z>0).reduce((Z,re)=>Z+re,0)]).sort((K,Z)=>K[1]-Z[1])[0])==null?void 0:B[0];Y&&(G=Y);break}case"initialPlacement":G=s;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function Ny(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Py(e){return bM.some(t=>e[t]>=0)}const MM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Tr(e,t);switch(r){case"referenceHidden":{const a=await Gs(t,{...o,elementContext:"reference"}),i=Ny(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Py(i)}}}case"escaped":{const a=await Gs(t,{...o,altBoundary:!0}),i=Ny(a,n.floating);return{data:{escapedOffsets:i,escaped:Py(i)}}}default:return{}}}}};async function AM(e,t){const{placement:n,platform:r,elements:o}=e,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Er(n),s=ji(n),l=yo(n)==="y",c=["left","top"].includes(i)?-1:1,u=a&&l?-1:1,d=Tr(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof v=="number"&&(g=s==="end"?v*-1:v),l?{x:g*u,y:p*c}:{x:p*c,y:g*u}}const RM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:s}=t,l=await AM(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:i}}}}},IM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:_=>{let{x:b,y}=_;return{x:b,y}}},...l}=Tr(e,t),c={x:n,y:r},u=await Gs(t,l),d=yo(Er(o)),p=Ph(d);let g=c[p],v=c[d];if(a){const _=p==="y"?"top":"left",b=p==="y"?"bottom":"right",y=g+u[_],x=g-u[b];g=ep(y,g,x)}if(i){const _=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=v+u[_],x=v-u[b];v=ep(y,v,x)}const h=s.fn({...t,[p]:g,[d]:v});return{...h,data:{x:h.x-n,y:h.y-r}}}}},OM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Tr(e,t),u={x:n,y:r},d=yo(o),p=Ph(d);let g=u[p],v=u[d];const h=Tr(s,t),_=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const x=p==="y"?"height":"width",E=a.reference[p]-a.floating[x]+_.mainAxis,w=a.reference[p]+a.reference[x]-_.mainAxis;gw&&(g=w)}if(c){var b,y;const x=p==="y"?"width":"height",E=["top","left"].includes(Er(o)),w=a.reference[d]-a.floating[x]+(E&&((b=i.offset)==null?void 0:b[d])||0)+(E?0:_.crossAxis),T=a.reference[d]+a.reference[x]+(E?0:((y=i.offset)==null?void 0:y[d])||0)-(E?_.crossAxis:0);vT&&(v=T)}return{[p]:g,[d]:v}}}},DM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:a}=t,{apply:i=()=>{},...s}=Tr(e,t),l=await Gs(t,s),c=Er(n),u=ji(n),d=yo(n)==="y",{width:p,height:g}=r.floating;let v,h;c==="top"||c==="bottom"?(v=c,h=u===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(h=c,v=u==="end"?"top":"bottom");const _=g-l.top-l.bottom,b=p-l.left-l.right,y=Yn(g-l[v],_),x=Yn(p-l[h],b),E=!t.middlewareData.shift;let w=y,T=x;if(d?T=u||E?Yn(x,b):b:w=u||E?Yn(y,_):_,E&&!u){const C=Yt(l.left,0),P=Yt(l.right,0),O=Yt(l.top,0),R=Yt(l.bottom,0);d?T=p-2*(C!==0||P!==0?C+P:Yt(l.left,l.right)):w=g-2*(O!==0||R!==0?O+R:Yt(l.top,l.bottom))}await i({...t,availableWidth:T,availableHeight:w});const k=await o.getDimensions(a.floating);return p!==k.width||g!==k.height?{reset:{rects:!0}}:{}}}};function Fi(e){return Jx(e)?(e.nodeName||"").toLowerCase():"#document"}function en(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mr(e){var t;return(t=(Jx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Jx(e){return e instanceof Node||e instanceof en(e).Node}function Jn(e){return e instanceof Element||e instanceof en(e).Element}function er(e){return e instanceof HTMLElement||e instanceof en(e).HTMLElement}function My(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof en(e).ShadowRoot}function hl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function LM(e){return["table","td","th"].includes(Fi(e))}function id(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Rh(e){const t=Ih(),n=Fn(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function jM(e){let t=bo(e);for(;er(t)&&!Ei(t);){if(id(t))return null;if(Rh(t))return t;t=bo(t)}return null}function Ih(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ei(e){return["html","body","#document"].includes(Fi(e))}function Fn(e){return en(e).getComputedStyle(e)}function sd(e){return Jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function bo(e){if(Fi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||My(e)&&e.host||Mr(e);return My(t)?t.host:t}function ek(e){const t=bo(e);return Ei(t)?e.ownerDocument?e.ownerDocument.body:e.body:er(t)&&hl(t)?t:ek(t)}function Ks(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ek(e),a=o===((r=e.ownerDocument)==null?void 0:r.body),i=en(o);return a?t.concat(i,i.visualViewport||[],hl(o)?o:[],i.frameElement&&n?Ks(i.frameElement):[]):t.concat(o,Ks(o,[],n))}function tk(e){const t=Fn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=er(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,s=gu(n)!==a||gu(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Oh(e){return Jn(e)?e:e.contextElement}function fi(e){const t=Oh(e);if(!er(t))return vo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=tk(t);let i=(a?gu(n.width):n.width)/r,s=(a?gu(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const FM=vo(0);function nk(e){const t=en(e);return!Ih()||!t.visualViewport?FM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==en(e)?!1:t}function ta(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=Oh(e);let i=vo(1);t&&(r?Jn(r)&&(i=fi(r)):i=fi(e));const s=BM(a,n,r)?nk(a):vo(0);let l=(o.left+s.x)/i.x,c=(o.top+s.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(a){const p=en(a),g=r&&Jn(r)?en(r):r;let v=p,h=v.frameElement;for(;h&&r&&g!==v;){const _=fi(h),b=h.getBoundingClientRect(),y=Fn(h),x=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*_.x,E=b.top+(h.clientTop+parseFloat(y.paddingTop))*_.y;l*=_.x,c*=_.y,u*=_.x,d*=_.y,l+=x,c+=E,v=en(h),h=v.frameElement}}return yu({width:u,height:d,x:l,y:c})}function $M(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a=o==="fixed",i=Mr(r),s=t?id(t.floating):!1;if(r===i||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=vo(1);const u=vo(0),d=er(r);if((d||!d&&!a)&&((Fi(r)!=="body"||hl(i))&&(l=sd(r)),er(r))){const p=ta(r);c=fi(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function UM(e){return Array.from(e.getClientRects())}function rk(e){return ta(Mr(e)).left+sd(e).scrollLeft}function VM(e){const t=Mr(e),n=sd(e),r=e.ownerDocument.body,o=Yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+rk(e);const s=-n.scrollTop;return Fn(r).direction==="rtl"&&(i+=Yt(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:s}}function zM(e,t){const n=en(e),r=Mr(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;const c=Ih();(!c||c&&t==="fixed")&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:s,y:l}}function HM(e,t){const n=ta(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=er(e)?fi(e):vo(1),i=e.clientWidth*a.x,s=e.clientHeight*a.y,l=o*a.x,c=r*a.y;return{width:i,height:s,x:l,y:c}}function Ay(e,t,n){let r;if(t==="viewport")r=zM(e,n);else if(t==="document")r=VM(Mr(e));else if(Jn(t))r=HM(t,n);else{const o=nk(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return yu(r)}function ok(e,t){const n=bo(e);return n===t||!Jn(n)||Ei(n)?!1:Fn(n).position==="fixed"||ok(n,t)}function WM(e,t){const n=t.get(e);if(n)return n;let r=Ks(e,[],!1).filter(s=>Jn(s)&&Fi(s)!=="body"),o=null;const a=Fn(e).position==="fixed";let i=a?bo(e):e;for(;Jn(i)&&!Ei(i);){const s=Fn(i),l=Rh(i);!l&&s.position==="fixed"&&(o=null),(a?!l&&!o:!l&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||hl(i)&&!l&&ok(e,i))?r=r.filter(u=>u!==i):o=s,i=bo(i)}return t.set(e,r),r}function GM(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?id(t)?[]:WM(t,this._c):[].concat(n),r],s=i[0],l=i.reduce((c,u)=>{const d=Ay(t,u,o);return c.top=Yt(d.top,c.top),c.right=Yn(d.right,c.right),c.bottom=Yn(d.bottom,c.bottom),c.left=Yt(d.left,c.left),c},Ay(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function KM(e){const{width:t,height:n}=tk(e);return{width:t,height:n}}function qM(e,t,n){const r=er(t),o=Mr(t),a=n==="fixed",i=ta(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=vo(0);if(r||!r&&!a)if((Fi(t)!=="body"||hl(o))&&(s=sd(t)),r){const d=ta(t,!0,a,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else o&&(l.x=rk(o));const c=i.left+s.scrollLeft-l.x,u=i.top+s.scrollTop-l.y;return{x:c,y:u,width:i.width,height:i.height}}function bf(e){return Fn(e).position==="static"}function Ry(e,t){return!er(e)||Fn(e).position==="fixed"?null:t?t(e):e.offsetParent}function ak(e,t){const n=en(e);if(id(e))return n;if(!er(e)){let o=bo(e);for(;o&&!Ei(o);){if(Jn(o)&&!bf(o))return o;o=bo(o)}return n}let r=Ry(e,t);for(;r&&LM(r)&&bf(r);)r=Ry(r,t);return r&&Ei(r)&&bf(r)&&!Rh(r)?n:r||jM(e)||n}const XM=async function(e){const t=this.getOffsetParent||ak,n=this.getDimensions,r=await n(e.floating);return{reference:qM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function YM(e){return Fn(e).direction==="rtl"}const QM={convertOffsetParentRelativeRectToViewportRelativeRect:$M,getDocumentElement:Mr,getClippingRect:GM,getOffsetParent:ak,getElementRects:XM,getClientRects:UM,getDimensions:KM,getScale:fi,isElement:Jn,isRTL:YM};function ZM(e,t){let n=null,r;const o=Mr(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const g=Yl(u),v=Yl(o.clientWidth-(c+d)),h=Yl(o.clientHeight-(u+p)),_=Yl(c),y={rootMargin:-g+"px "+-v+"px "+-h+"px "+-_+"px",threshold:Yt(0,Yn(1,l))||1};let x=!0;function E(w){const T=w[0].intersectionRatio;if(T!==l){if(!x)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return i(!0),a}function JM(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Oh(e),u=o||a?[...c?Ks(c):[],...Ks(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const d=c&&s?ZM(c,n):null;let p=-1,g=null;i&&(g=new ResizeObserver(b=>{let[y]=b;y&&y.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,h=l?ta(e):null;l&&_();function _(){const b=ta(e);h&&(b.x!==h.x||b.y!==h.y||b.width!==h.width||b.height!==h.height)&&n(),h=b,v=requestAnimationFrame(_)}return n(),()=>{var b;u.forEach(y=>{o&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),d?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const eA=RM,tA=IM,nA=PM,rA=DM,oA=MM,Iy=NM,aA=OM,iA=(e,t,n)=>{const r=new Map,o={platform:QM,...n},a={...o.platform,_c:r};return EM(e,t,{...o,platform:a})};var Nc=typeof document<"u"?m.useLayoutEffect:m.useEffect;function bu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bu(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&e.$$typeof)&&!bu(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ik(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oy(e,t){const n=ik(e);return Math.round(t*n)/n}function Dy(e){const t=m.useRef(e);return Nc(()=>{t.current=e}),t}function sA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=m.useState(r);bu(p,r)||g(r);const[v,h]=m.useState(null),[_,b]=m.useState(null),y=m.useCallback(Y=>{Y!==T.current&&(T.current=Y,h(Y))},[]),x=m.useCallback(Y=>{Y!==k.current&&(k.current=Y,b(Y))},[]),E=a||v,w=i||_,T=m.useRef(null),k=m.useRef(null),C=m.useRef(u),P=l!=null,O=Dy(l),R=Dy(o),N=m.useCallback(()=>{if(!T.current||!k.current)return;const Y={placement:t,strategy:n,middleware:p};R.current&&(Y.platform=R.current),iA(T.current,k.current,Y).then(K=>{const Z={...K,isPositioned:!0};B.current&&!bu(C.current,Z)&&(C.current=Z,an.flushSync(()=>{d(Z)}))})},[p,t,n,R]);Nc(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(Y=>({...Y,isPositioned:!1})))},[c]);const B=m.useRef(!1);Nc(()=>(B.current=!0,()=>{B.current=!1}),[]),Nc(()=>{if(E&&(T.current=E),w&&(k.current=w),E&&w){if(O.current)return O.current(E,w,N);N()}},[E,w,N,O,P]);const D=m.useMemo(()=>({reference:T,floating:k,setReference:y,setFloating:x}),[y,x]),L=m.useMemo(()=>({reference:E,floating:w}),[E,w]),G=m.useMemo(()=>{const Y={position:n,left:0,top:0};if(!L.floating)return Y;const K=Oy(L.floating,u.x),Z=Oy(L.floating,u.y);return s?{...Y,transform:"translate("+K+"px, "+Z+"px)",...ik(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:Z}},[n,s,L.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:N,refs:D,elements:L,floatingStyles:G}),[u,N,D,L,G])}const lA=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Iy({element:r.current,padding:o}).fn(n):{}:r?Iy({element:r,padding:o}).fn(n):{}}}},cA=(e,t)=>({...eA(e),options:[e,t]}),uA=(e,t)=>({...tA(e),options:[e,t]}),dA=(e,t)=>({...aA(e),options:[e,t]}),fA=(e,t)=>({...nA(e),options:[e,t]}),pA=(e,t)=>({...rA(e),options:[e,t]}),mA=(e,t)=>({...oA(e),options:[e,t]}),hA=(e,t)=>({...lA(e),options:[e,t]});var gA="Arrow",sk=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return f.jsx(xe.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});sk.displayName=gA;var vA=sk;function Dh(e){const[t,n]=m.useState(void 0);return Mt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,s;if("borderBoxSize"in a){const l=a.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,s=c.blockSize}else i=e.offsetWidth,s=e.offsetHeight;n({width:i,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Lh="Popper",[lk,ck]=Pr(Lh),[yA,uk]=lk(Lh),dk=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return f.jsx(yA,{scope:t,anchor:r,onAnchorChange:o,children:n})};dk.displayName=Lh;var fk="PopperAnchor",pk=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=uk(fk,n),i=m.useRef(null),s=$e(t,i);return m.useEffect(()=>{a.onAnchorChange(r?.current||i.current)}),r?null:f.jsx(xe.div,{...o,ref:s})});pk.displayName=fk;var jh="PopperContent",[bA,wA]=lk(jh),mk=m.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,...h}=e,_=uk(jh,n),[b,y]=m.useState(null),x=$e(t,H=>y(H)),[E,w]=m.useState(null),T=Dh(E),k=T?.width??0,C=T?.height??0,P=r+(a!=="center"?"-"+a:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},R=Array.isArray(c)?c:[c],N=R.length>0,B={padding:O,boundary:R.filter(xA),altBoundary:N},{refs:D,floatingStyles:L,placement:G,isPositioned:Y,middlewareData:K}=sA({strategy:"fixed",placement:P,whileElementsMounted:(...H)=>JM(...H,{animationFrame:g==="always"}),elements:{reference:_.anchor},middleware:[cA({mainAxis:o+C,alignmentAxis:i}),l&&uA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dA():void 0,...B}),l&&fA({...B}),pA({...B,apply:({elements:H,rects:I,availableWidth:F,availableHeight:j})=>{const{width:$,height:V}=I.reference,J=H.floating.style;J.setProperty("--radix-popper-available-width",`${F}px`),J.setProperty("--radix-popper-available-height",`${j}px`),J.setProperty("--radix-popper-anchor-width",`${$}px`),J.setProperty("--radix-popper-anchor-height",`${V}px`)}}),E&&hA({element:E,padding:s}),kA({arrowWidth:k,arrowHeight:C}),p&&mA({strategy:"referenceHidden",...B})]}),[Z,re]=vk(G),fe=Wt(v);Mt(()=>{Y&&fe?.()},[Y,fe]);const U=K.arrow?.x,ae=K.arrow?.y,se=K.arrow?.centerOffset!==0,[S,X]=m.useState();return Mt(()=>{b&&X(window.getComputedStyle(b).zIndex)},[b]),f.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:Y?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:S,"--radix-popper-transform-origin":[K.transformOrigin?.x,K.transformOrigin?.y].join(" "),...K.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(bA,{scope:n,placedSide:Z,onArrowChange:w,arrowX:U,arrowY:ae,shouldHideArrow:se,children:f.jsx(xe.div,{"data-side":Z,"data-align":re,...h,ref:x,style:{...h.style,animation:Y?void 0:"none"}})})})});mk.displayName=jh;var hk="PopperArrow",_A={top:"bottom",right:"left",bottom:"top",left:"right"},gk=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=wA(hk,r),i=_A[a.placedSide];return f.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:f.jsx(vA,{...o,ref:n,style:{...o.style,display:"block"}})})});gk.displayName=hk;function xA(e){return e!==null}var kA=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[c,u]=vk(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(o.arrow?.x??0)+s/2,g=(o.arrow?.y??0)+l/2;let v="",h="";return c==="bottom"?(v=i?d:`${p}px`,h=`${-l}px`):c==="top"?(v=i?d:`${p}px`,h=`${r.floating.height+l}px`):c==="right"?(v=`${-l}px`,h=i?d:`${g}px`):c==="left"&&(v=`${r.floating.width+l}px`,h=i?d:`${g}px`),{data:{x:v,y:h}}}});function vk(e){const[t,n="center"]=e.split("-");return[t,n]}var CA=dk,SA=pk,TA=mk,EA=gk,NA="Portal",ld=m.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=m.useState(!1);Mt(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Jw.createPortal(f.jsx(xe.div,{...r,ref:t}),i):null});ld.displayName=NA;function Fh(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var PA="VisuallyHidden",cd=m.forwardRef((e,t)=>f.jsx(xe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));cd.displayName=PA;var MA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},La=new WeakMap,Ql=new WeakMap,Zl={},wf=0,yk=function(e){return e&&(e.host||yk(e.parentNode))},AA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yk(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},RA=function(e,t,n,r){var o=AA(t,Array.isArray(e)?e:[e]);Zl[n]||(Zl[n]=new WeakMap);var a=Zl[n],i=[],s=new Set,l=new Set(o),c=function(d){!d||s.has(d)||(s.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(s.has(p))u(p);else try{var g=p.getAttribute(r),v=g!==null&&g!=="false",h=(La.get(p)||0)+1,_=(a.get(p)||0)+1;La.set(p,h),a.set(p,_),i.push(p),h===1&&v&&Ql.set(p,!0),_===1&&p.setAttribute(n,"true"),v||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return u(t),s.clear(),wf++,function(){i.forEach(function(d){var p=La.get(d)-1,g=a.get(d)-1;La.set(d,p),a.set(d,g),p||(Ql.has(d)||d.removeAttribute(r),Ql.delete(d)),g||d.removeAttribute(n)}),wf--,wf||(La=new WeakMap,La=new WeakMap,Ql=new WeakMap,Zl={})}},Bh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=MA(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),RA(r,o,n,"aria-hidden")):function(){return null}},Nt=function(){return Nt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return WA;var t=GA(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qA=Uh(),pi="data-scroll-locked",XA=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),` - .`.concat(IA,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(s,"px ").concat(r,`; - } - body[`).concat(pi,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(a,`px; - padding-right: `).concat(i,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(s,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(bs,` { - right: `).concat(s,"px ").concat(r,`; - } - - .`).concat(ws,` { - margin-right: `).concat(s,"px ").concat(r,`; - } - - .`).concat(bs," .").concat(bs,` { - right: 0 `).concat(r,`; - } - - .`).concat(ws," .").concat(ws,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(pi,`] { - `).concat(OA,": ").concat(s,`px; - } -`)},jy=function(){var e=parseInt(document.body.getAttribute(pi)||"0",10);return isFinite(e)?e:0},YA=function(){m.useEffect(function(){return document.body.setAttribute(pi,(jy()+1).toString()),function(){var e=jy()-1;e<=0?document.body.removeAttribute(pi):document.body.setAttribute(pi,e.toString())}},[])},Sk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;YA();var a=m.useMemo(function(){return KA(o)},[o]);return m.createElement(qA,{styles:XA(a,!t,o,n?"":"!important")})},np=!1;if(typeof window<"u")try{var Jl=Object.defineProperty({},"passive",{get:function(){return np=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{np=!1}var ja=np?{passive:!1}:!1,QA=function(e){return e.tagName==="TEXTAREA"},Tk=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!QA(e)&&n[t]==="visible")},ZA=function(e){return Tk(e,"overflowY")},JA=function(e){return Tk(e,"overflowX")},Fy=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ek(e,r);if(o){var a=Nk(e,r),i=a[1],s=a[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eR=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tR=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ek=function(e,t){return e==="v"?ZA(t):JA(t)},Nk=function(e,t){return e==="v"?eR(t):tR(t)},nR=function(e,t){return e==="h"&&t==="rtl"?-1:1},rR=function(e,t,n,r,o){var a=nR(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,p=0;do{var g=Nk(e,s),v=g[0],h=g[1],_=g[2],b=h-_-a*v;(v||b)&&Ek(e,s)&&(d+=b,p+=v),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(Math.abs(d)<1||!o)||!u&&(Math.abs(p)<1||!o))&&(c=!0),c},ec=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},By=function(e){return[e.deltaX,e.deltaY]},$y=function(e){return e&&"current"in e?e.current:e},oR=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aR=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},iR=0,Fa=[];function sR(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(iR++)[0],a=m.useState(Uh)[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=bk([e.lockRef.current],(e.shards||[]).map($y),!0).filter(Boolean);return h.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(h,_){if("touches"in h&&h.touches.length===2)return!i.current.allowPinchZoom;var b=ec(h),y=n.current,x="deltaX"in h?h.deltaX:y[0]-b[0],E="deltaY"in h?h.deltaY:y[1]-b[1],w,T=h.target,k=Math.abs(x)>Math.abs(E)?"h":"v";if("touches"in h&&k==="h"&&T.type==="range")return!1;var C=Fy(k,T);if(!C)return!0;if(C?w=k:(w=k==="v"?"h":"v",C=Fy(k,T)),!C)return!1;if(!r.current&&"changedTouches"in h&&(x||E)&&(r.current=w),!w)return!0;var P=r.current||w;return rR(P,_,h,P==="h"?x:E,!0)},[]),l=m.useCallback(function(h){var _=h;if(!(!Fa.length||Fa[Fa.length-1]!==a)){var b="deltaY"in _?By(_):ec(_),y=t.current.filter(function(w){return w.name===_.type&&(w.target===_.target||_.target===w.shadowParent)&&oR(w.delta,b)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(i.current.shards||[]).map($y).filter(Boolean).filter(function(w){return w.contains(_.target)}),E=x.length>0?s(_,x[0]):!i.current.noIsolation;E&&_.cancelable&&_.preventDefault()}}},[]),c=m.useCallback(function(h,_,b,y){var x={name:h,delta:_,target:b,should:y,shadowParent:lR(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(E){return E!==x})},1)},[]),u=m.useCallback(function(h){n.current=ec(h),r.current=void 0},[]),d=m.useCallback(function(h){c(h.type,By(h),h.target,s(h,e.lockRef.current))},[]),p=m.useCallback(function(h){c(h.type,ec(h),h.target,s(h,e.lockRef.current))},[]);m.useEffect(function(){return Fa.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,ja),document.addEventListener("touchmove",l,ja),document.addEventListener("touchstart",u,ja),function(){Fa=Fa.filter(function(h){return h!==a}),document.removeEventListener("wheel",l,ja),document.removeEventListener("touchmove",l,ja),document.removeEventListener("touchstart",u,ja)}},[]);var g=e.removeScrollBar,v=e.inert;return m.createElement(m.Fragment,null,v?m.createElement(a,{styles:aR(o)}):null,g?m.createElement(Sk,{gapMode:e.gapMode}):null)}function lR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const cR=kk(Ck,sR);var Vh=m.forwardRef(function(e,t){return m.createElement(ud,Nt({},e,{ref:t,sideCar:cR}))});Vh.classNames=ud.classNames;var uR=[" ","Enter","ArrowUp","ArrowDown"],dR=[" ","Enter"],gl="Select",[dd,fd,fR]=hh(gl),[Bi,E7]=Pr(gl,[fR,ck]),pd=ck(),[pR,Co]=Bi(gl),[mR,hR]=Bi(gl),Pk=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:g}=e,v=pd(t),[h,_]=m.useState(null),[b,y]=m.useState(null),[x,E]=m.useState(!1),w=gh(c),[T=!1,k]=go({prop:r,defaultProp:o,onChange:a}),[C,P]=go({prop:i,defaultProp:s,onChange:l}),O=m.useRef(null),R=h?!!h.closest("form"):!0,[N,B]=m.useState(new Set),D=Array.from(N).map(L=>L.props.value).join(";");return f.jsx(CA,{...v,children:f.jsxs(pR,{required:g,scope:t,trigger:h,onTriggerChange:_,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:E,contentId:fo(),value:C,onValueChange:P,open:T,onOpenChange:k,dir:w,triggerPointerDownPosRef:O,disabled:p,children:[f.jsx(dd.Provider,{scope:t,children:f.jsx(mR,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(L=>{B(G=>new Set(G).add(L))},[]),onNativeOptionRemove:m.useCallback(L=>{B(G=>{const Y=new Set(G);return Y.delete(L),Y})},[]),children:n})}),R?f.jsxs(Qk,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:d,value:C,onChange:L=>P(L.target.value),disabled:p,children:[C===void 0?f.jsx("option",{value:""}):null,Array.from(N)]},D):null]})})};Pk.displayName=gl;var Mk="SelectTrigger",Ak=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=pd(n),i=Co(Mk,n),s=i.disabled||r,l=$e(t,i.onTriggerChange),c=fd(n),[u,d,p]=Zk(v=>{const h=c().filter(y=>!y.disabled),_=h.find(y=>y.value===i.value),b=Jk(h,v,_);b!==void 0&&i.onValueChange(b.value)}),g=()=>{s||(i.onOpenChange(!0),p())};return f.jsx(SA,{asChild:!0,...a,children:f.jsx(xe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":Yk(i.value)?"":void 0,...o,ref:l,onClick:we(o.onClick,v=>{v.currentTarget.focus()}),onPointerDown:we(o.onPointerDown,v=>{const h=v.target;h.hasPointerCapture(v.pointerId)&&h.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(g(),i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:we(o.onKeyDown,v=>{const h=u.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&d(v.key),!(h&&v.key===" ")&&uR.includes(v.key)&&(g(),v.preventDefault())})})})});Ak.displayName=Mk;var Rk="SelectValue",Ik=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...s}=e,l=Co(Rk,n),{onValueNodeHasChildrenChange:c}=l,u=a!==void 0,d=$e(t,l.onValueNodeChange);return Mt(()=>{c(u)},[c,u]),f.jsx(xe.span,{...s,ref:d,style:{pointerEvents:"none"},children:Yk(l.value)?f.jsx(f.Fragment,{children:i}):a})});Ik.displayName=Rk;var gR="SelectIcon",vR=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(xe.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});vR.displayName=gR;var yR="SelectPortal",Ok=e=>f.jsx(ld,{asChild:!0,...e});Ok.displayName=yR;var na="SelectContent",Dk=m.forwardRef((e,t)=>{const n=Co(na,e.__scopeSelect),[r,o]=m.useState();if(Mt(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?an.createPortal(f.jsx(Lk,{scope:e.__scopeSelect,children:f.jsx(dd.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),a):null}return f.jsx(jk,{...e,ref:t})});Dk.displayName=na;var dr=10,[Lk,So]=Bi(na),bR="SelectContentImpl",jk=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:_,...b}=e,y=Co(na,n),[x,E]=m.useState(null),[w,T]=m.useState(null),k=$e(t,H=>E(H)),[C,P]=m.useState(null),[O,R]=m.useState(null),N=fd(n),[B,D]=m.useState(!1),L=m.useRef(!1);m.useEffect(()=>{if(x)return Bh(x)},[x]),Yx();const G=m.useCallback(H=>{const[I,...F]=N().map(V=>V.ref.current),[j]=F.slice(-1),$=document.activeElement;for(const V of H)if(V===$||(V?.scrollIntoView({block:"nearest"}),V===I&&w&&(w.scrollTop=0),V===j&&w&&(w.scrollTop=w.scrollHeight),V?.focus(),document.activeElement!==$))return},[N,w]),Y=m.useCallback(()=>G([C,x]),[G,C,x]);m.useEffect(()=>{B&&Y()},[B,Y]);const{onOpenChange:K,triggerPointerDownPosRef:Z}=y;m.useEffect(()=>{if(x){let H={x:0,y:0};const I=j=>{H={x:Math.abs(Math.round(j.pageX)-(Z.current?.x??0)),y:Math.abs(Math.round(j.pageY)-(Z.current?.y??0))}},F=j=>{H.x<=10&&H.y<=10?j.preventDefault():x.contains(j.target)||K(!1),document.removeEventListener("pointermove",I),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",F,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",F,{capture:!0})}}},[x,K,Z]),m.useEffect(()=>{const H=()=>K(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[K]);const[re,fe]=Zk(H=>{const I=N().filter($=>!$.disabled),F=I.find($=>$.ref.current===document.activeElement),j=Jk(I,H,F);j&&setTimeout(()=>j.ref.current.focus())}),U=m.useCallback((H,I,F)=>{const j=!L.current&&!F;(y.value!==void 0&&y.value===I||j)&&(P(H),j&&(L.current=!0))},[y.value]),ae=m.useCallback(()=>x?.focus(),[x]),se=m.useCallback((H,I,F)=>{const j=!L.current&&!F;(y.value!==void 0&&y.value===I||j)&&R(H)},[y.value]),S=r==="popper"?rp:Fk,X=S===rp?{side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:_}:{};return f.jsx(Lk,{scope:n,content:x,viewport:w,onViewportChange:T,itemRefCallback:U,selectedItem:C,onItemLeave:ae,itemTextRefCallback:se,focusSelectedItem:Y,selectedItemText:O,position:r,isPositioned:B,searchRef:re,children:f.jsx(Vh,{as:Ti,allowPinchZoom:!0,children:f.jsx(Nh,{asChild:!0,trapped:y.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:we(o,H=>{y.trigger?.focus({preventScroll:!0}),H.preventDefault()}),children:f.jsx(ad,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:f.jsx(S,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:H=>H.preventDefault(),...b,...X,onPlaced:()=>D(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:we(b.onKeyDown,H=>{const I=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!I&&H.key.length===1&&fe(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let j=N().filter($=>!$.disabled).map($=>$.ref.current);if(["ArrowUp","End"].includes(H.key)&&(j=j.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const $=H.target,V=j.indexOf($);j=j.slice(V+1)}setTimeout(()=>G(j)),H.preventDefault()}})})})})})})});jk.displayName=bR;var wR="SelectItemAlignedPosition",Fk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Co(na,n),i=So(na,n),[s,l]=m.useState(null),[c,u]=m.useState(null),d=$e(t,k=>u(k)),p=fd(n),g=m.useRef(!1),v=m.useRef(!0),{viewport:h,selectedItem:_,selectedItemText:b,focusSelectedItem:y}=i,x=m.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&c&&h&&_&&b){const k=a.trigger.getBoundingClientRect(),C=c.getBoundingClientRect(),P=a.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(a.dir!=="rtl"){const $=O.left-C.left,V=P.left-$,J=k.left-V,ee=k.width+J,ce=Math.max(ee,C.width),Pe=window.innerWidth-dr,Oe=by(V,[dr,Pe-ce]);s.style.minWidth=ee+"px",s.style.left=Oe+"px"}else{const $=C.right-O.right,V=window.innerWidth-P.right-$,J=window.innerWidth-k.right-V,ee=k.width+J,ce=Math.max(ee,C.width),Pe=window.innerWidth-dr,Oe=by(V,[dr,Pe-ce]);s.style.minWidth=ee+"px",s.style.right=Oe+"px"}const R=p(),N=window.innerHeight-dr*2,B=h.scrollHeight,D=window.getComputedStyle(c),L=parseInt(D.borderTopWidth,10),G=parseInt(D.paddingTop,10),Y=parseInt(D.borderBottomWidth,10),K=parseInt(D.paddingBottom,10),Z=L+G+B+K+Y,re=Math.min(_.offsetHeight*5,Z),fe=window.getComputedStyle(h),U=parseInt(fe.paddingTop,10),ae=parseInt(fe.paddingBottom,10),se=k.top+k.height/2-dr,S=N-se,X=_.offsetHeight/2,H=_.offsetTop+X,I=L+G+H,F=Z-I;if(I<=se){const $=_===R[R.length-1].ref.current;s.style.bottom="0px";const V=c.clientHeight-h.offsetTop-h.offsetHeight,J=Math.max(S,X+($?ae:0)+V+Y),ee=I+J;s.style.height=ee+"px"}else{const $=_===R[0].ref.current;s.style.top="0px";const J=Math.max(se,L+h.offsetTop+($?U:0)+X)+F;s.style.height=J+"px",h.scrollTop=I-se+h.offsetTop}s.style.margin=`${dr}px 0`,s.style.minHeight=re+"px",s.style.maxHeight=N+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[p,a.trigger,a.valueNode,s,c,h,_,b,a.dir,r]);Mt(()=>x(),[x]);const[E,w]=m.useState();Mt(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);const T=m.useCallback(k=>{k&&v.current===!0&&(x(),y?.(),v.current=!1)},[x,y]);return f.jsx(xR,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:f.jsx(xe.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Fk.displayName=wR;var _R="SelectPopperPosition",rp=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=dr,...a}=e,i=pd(n);return f.jsx(TA,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.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)"}})});rp.displayName=_R;var[xR,zh]=Bi(na,{}),op="SelectViewport",Bk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=So(op,n),i=zh(op,n),s=$e(t,a.onViewportChange),l=m.useRef(0);return f.jsxs(f.Fragment,{children:[f.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:r}),f.jsx(dd.Slot,{scope:n,children:f.jsx(xe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:we(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=i;if(p?.current&&d){const g=Math.abs(l.current-u.scrollTop);if(g>0){const v=window.innerHeight-dr*2,h=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),b=Math.max(h,_);if(b0?E:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Bk.displayName=op;var $k="SelectGroup",[kR,CR]=Bi($k),SR=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=fo();return f.jsx(kR,{scope:n,id:o,children:f.jsx(xe.div,{role:"group","aria-labelledby":o,...r,ref:t})})});SR.displayName=$k;var Uk="SelectLabel",Vk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=CR(Uk,n);return f.jsx(xe.div,{id:o.id,...r,ref:t})});Vk.displayName=Uk;var wu="SelectItem",[TR,zk]=Bi(wu),Hk=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,s=Co(wu,n),l=So(wu,n),c=s.value===r,[u,d]=m.useState(a??""),[p,g]=m.useState(!1),v=$e(t,b=>l.itemRefCallback?.(b,r,o)),h=fo(),_=()=>{o||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")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 f.jsx(TR,{scope:n,value:r,disabled:o,textId:h,isSelected:c,onItemTextChange:m.useCallback(b=>{d(y=>y||(b?.textContent??"").trim())},[]),children:f.jsx(dd.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(xe.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:v,onFocus:we(i.onFocus,()=>g(!0)),onBlur:we(i.onBlur,()=>g(!1)),onPointerUp:we(i.onPointerUp,_),onPointerMove:we(i.onPointerMove,b=>{o?l.onItemLeave?.():b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,b=>{b.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:we(i.onKeyDown,b=>{l.searchRef?.current!==""&&b.key===" "||(dR.includes(b.key)&&_(),b.key===" "&&b.preventDefault())})})})})});Hk.displayName=wu;var is="SelectItemText",Wk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Co(is,n),s=So(is,n),l=zk(is,n),c=hR(is,n),[u,d]=m.useState(null),p=$e(t,b=>d(b),l.onItemTextChange,b=>s.itemTextRefCallback?.(b,l.value,l.disabled)),g=u?.textContent,v=m.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:h,onNativeOptionRemove:_}=c;return Mt(()=>(h(v),()=>_(v)),[h,_,v]),f.jsxs(f.Fragment,{children:[f.jsx(xe.span,{id:l.textId,...a,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?an.createPortal(a.children,i.valueNode):null]})});Wk.displayName=is;var Gk="SelectItemIndicator",Kk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return zk(Gk,n).isSelected?f.jsx(xe.span,{"aria-hidden":!0,...r,ref:t}):null});Kk.displayName=Gk;var ap="SelectScrollUpButton",ER=m.forwardRef((e,t)=>{const n=So(ap,e.__scopeSelect),r=zh(ap,e.__scopeSelect),[o,a]=m.useState(!1),i=$e(t,r.onScrollButtonChange);return Mt(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollTop>0;a(c)};const l=n.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?f.jsx(qk,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop-l.offsetHeight)}}):null});ER.displayName=ap;var ip="SelectScrollDownButton",NR=m.forwardRef((e,t)=>{const n=So(ip,e.__scopeSelect),r=zh(ip,e.__scopeSelect),[o,a]=m.useState(!1),i=$e(t,r.onScrollButtonChange);return Mt(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?f.jsx(qk,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop+l.offsetHeight)}}):null});NR.displayName=ip;var qk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=So("SelectScrollButton",n),i=m.useRef(null),s=fd(n),l=m.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),Mt(()=>{s().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),f.jsx(xe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:we(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:we(o.onPointerMove,()=>{a.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:we(o.onPointerLeave,()=>{l()})})}),PR="SelectSeparator",Xk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(xe.div,{"aria-hidden":!0,...r,ref:t})});Xk.displayName=PR;var sp="SelectArrow",MR=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=pd(n),a=Co(sp,n),i=So(sp,n);return a.open&&i.position==="popper"?f.jsx(EA,{...o,...r,ref:t}):null});MR.displayName=sp;function Yk(e){return e===""||e===void 0}var Qk=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=m.useRef(null),a=$e(t,o),i=Fh(n);return m.useEffect(()=>{const s=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const d=new Event("change",{bubbles:!0});u.call(s,n),s.dispatchEvent(d)}},[i,n]),f.jsx(cd,{asChild:!0,children:f.jsx("select",{...r,ref:a,defaultValue:n})})});Qk.displayName="BubbleSelect";function Zk(e){const t=Wt(e),n=m.useRef(""),r=m.useRef(0),o=m.useCallback(i=>{const s=n.current+i;t(s),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(s)},[t]),a=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function Jk(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=AR(e,Math.max(a,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function AR(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var RR=Pk,eC=Ak,IR=Ik,OR=Ok,tC=Dk,DR=Bk,nC=Vk,rC=Hk,LR=Wk,jR=Kk,oC=Xk;/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var FR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ye=(e,t)=>{const n=m.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:l,...c},u)=>m.createElement("svg",{ref:u,...FR,width:o,height:o,stroke:r,strokeWidth:i?Number(a)*24/Number(o):a,className:["lucide",`lucide-${BR(e)}`,s].join(" "),...c},[...t.map(([d,p])=>m.createElement(d,p)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $R=ye("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UR=ye("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VR=ye("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zR=ye("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aC=ye("BoxSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HR=ye("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WR=ye("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iC=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sC=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GR=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uy=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vy=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zy=ye("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KR=ye("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qR=ye("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lC=ye("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XR=ye("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YR=ye("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QR=ye("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZR=ye("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hy=ye("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JR=ye("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e6=ye("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t6=ye("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wy=ye("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n6=ye("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cC=ye("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r6=ye("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o6=ye("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uC=ye("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dC=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a6=ye("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fC=ye("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pC=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mC=ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i6=ye("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s6=ye("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l6=ye("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hh=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hC=ye("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pc=ye("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lp=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c6=ye("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gC=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u6=ye("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wh=ye("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d6=ye("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f6=ye("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p6=ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vC=ye("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m6=ye("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gh=ye("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h6=ye("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yC=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g6=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v6=ye("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y6=ye("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),bC=RR,wC=IR,Kh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(eC,{ref:r,className:Ee("flex h-10 w-full items-center justify-between rounded-md border border-slate-300 bg-transparent py-2 px-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",e),...n,children:[t,f.jsx(sC,{className:"h-4 w-4 opacity-50"})]}));Kh.displayName=eC.displayName;const qh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsx(OR,{children:f.jsx(tC,{ref:r,className:Ee("relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white text-slate-700 shadow-md animate-in fade-in-80 dark:border-slate-800 dark:bg-slate-800 dark:text-slate-400",e),...n,children:f.jsx(DR,{className:"p-1",children:t})})}));qh.displayName=tC.displayName;const b6=m.forwardRef(({className:e,...t},n)=>f.jsx(nC,{ref:n,className:Ee("py-1.5 pr-2 pl-8 text-sm font-semibold text-slate-900 dark:text-slate-300",e),...t}));b6.displayName=nC.displayName;const Xh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(rC,{ref:r,className:Ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm font-medium outline-none focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-700",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(jR,{children:f.jsx(iC,{className:"h-4 w-4"})})}),f.jsx(LR,{children:t})]}));Xh.displayName=rC.displayName;const w6=m.forwardRef(({className:e,...t},n)=>f.jsx(oC,{ref:n,className:Ee("-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-700",e),...t}));w6.displayName=oC.displayName;const _C=m.forwardRef(({hide:e=!0,devicePSKBitCount:t,variant:n,value:r,buttonText:o,bits:a=[{text:"256 bit",value:"32",key:"bit256"},{text:"128 bit",value:"16",key:"bit128"},{text:"8 bit",value:"1",key:"bit8"}],selectChange:i,inputChange:s,buttonClick:l,action:c,disabled:u,...d},p)=>{const g=m.useRef(null);return m.useEffect(()=>{if(!g.current)return;const v=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;v&&(g.current.value="",v.call(g.current,r),g.current.dispatchEvent(new Event("input",{bubbles:!0})))},[r]),f.jsxs(f.Fragment,{children:[f.jsx(jn,{type:e?"password":"text",id:"pskInput",variant:n,value:r,onChange:s,action:c,disabled:u,ref:g}),f.jsxs(bC,{value:t?.toString(),onValueChange:v=>i(v),disabled:u,children:[f.jsx(Kh,{className:"!max-w-max",children:f.jsx(wC,{})}),f.jsx(qh,{children:a.map(({text:v,value:h,key:_})=>f.jsx(Xh,{value:h,children:v},_))})]}),f.jsx(pt,{type:"button",variant:"success",onClick:l,disabled:u,...d,children:o})]})});_C.displayName="Button";function _6({control:e,field:t,disabled:n}){return f.jsx(ml,{name:t.name,control:e,render:({field:{value:r,...o}})=>f.jsx(_C,{hide:t.hide,devicePSKBitCount:t.devicePSKBitCount,bits:t.bits,inputChange:t.inputChange,selectChange:t.selectChange,buttonClick:t.buttonClick,value:r,variant:t.validationText?"invalid":"default",buttonText:"Generate",...t.properties,...o,disabled:n})})}function x6({control:e,disabled:t,field:n}){return f.jsx(ml,{name:n.name,control:e,render:({field:{value:r,onChange:o,...a}})=>{const{enumValue:i,formatEnumName:s,...l}=n.properties,c=i?Object.entries(i).filter(u=>typeof u[1]=="number"):[];return f.jsxs(bC,{onValueChange:u=>o(Number.parseInt(u)),disabled:t,value:r?.toString(),...l,...a,children:[f.jsx(Kh,{children:f.jsx(wC,{})}),f.jsx(qh,{children:c.map(([u,d])=>f.jsx(Xh,{value:d.toString(),children:s?u.replace(/_/g," ").toLowerCase().split(" ").map(p=>p.charAt(0).toUpperCase()+p.substring(1)).join(" "):u},u))})]})}})}var Yh="Switch",[k6,N7]=Pr(Yh),[C6,S6]=k6(Yh),xC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,p]=m.useState(null),g=$e(t,y=>p(y)),v=m.useRef(!1),h=d?!!d.closest("form"):!0,[_=!1,b]=go({prop:o,defaultProp:a,onChange:c});return f.jsxs(C6,{scope:n,checked:_,disabled:s,children:[f.jsx(xe.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":SC(_),"data-disabled":s?"":void 0,disabled:s,value:l,...u,ref:g,onClick:we(e.onClick,y=>{b(x=>!x),h&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),h&&f.jsx(T6,{control:d,bubbles:!v.current,name:r,value:l,checked:_,required:i,disabled:s,style:{transform:"translateX(-100%)"}})]})});xC.displayName=Yh;var kC="SwitchThumb",CC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=S6(kC,n);return f.jsx(xe.span,{"data-state":SC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});CC.displayName=kC;var T6=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,a=m.useRef(null),i=Fh(n),s=Dh(t);return m.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const p=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(p)}},[i,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function SC(e){return e?"checked":"unchecked"}var TC=xC,E6=CC;const md=m.forwardRef(({className:e,...t},n)=>f.jsx(TC,{className:Ee("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=checked]:bg-slate-400 dark:data-[state=unchecked]:bg-slate-700",e),...t,ref:n,children:f.jsx(E6,{className:Ee("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));md.displayName=TC.displayName;function N6({control:e,disabled:t,field:n}){const r=o=>a=>{o({target:{value:a}})};return f.jsx(ml,{name:n.name,control:e,render:({field:{value:o,onChange:a,...i}})=>f.jsx(md,{checked:o,onCheckedChange:r(a),disabled:t,...n.properties,...i})})}function P6({field:e,control:t,disabled:n}){switch(e.type){case"text":case"password":case"number":return f.jsx(tM,{field:e,control:t,disabled:n});case"toggle":return f.jsx(N6,{field:e,control:t,disabled:n});case"select":return f.jsx(x6,{field:e,control:t,disabled:n});case"passwordGenerator":return f.jsx(_6,{field:e,control:t,disabled:n});case"multiSelect":return f.jsx("div",{children:"tmp"})}}var M6="Label",EC=m.forwardRef((e,t)=>f.jsx(xe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));EC.displayName=M6;var NC=EC;const xn=m.forwardRef(({className:e,...t},n)=>f.jsx(NC,{ref:n,className:Ee("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));xn.displayName=NC.displayName;const A6=({label:e,description:t,children:n,valid:r,validationText:o})=>f.jsx("div",{className:"pt-6 sm:pt-5",children:f.jsx("div",{role:"group","aria-labelledby":"label-notifications",children:f.jsxs("div",{className:"sm:grid sm:grid-cols-3 sm:items-baseline sm:gap-4",children:[f.jsx(xn,{children:e}),f.jsx("div",{className:"sm:col-span-2",children:f.jsxs("div",{className:"max-w-lg",children:[f.jsx("p",{className:"text-sm text-gray-500",children:t}),f.jsx("p",{hidden:r??!0,className:"text-sm text-red-500",children:o}),f.jsx("div",{className:"mt-4 space-y-4",children:f.jsx("div",{className:"flex items-center",children:n})})]})})]})})}),PC=({className:e,children:t})=>f.jsx("h4",{className:Ee("scroll-m-20 text-xl font-semibold tracking-tight",e),children:t}),wn=({className:e,children:t})=>f.jsx("p",{className:Ee("text-sm text-slate-500 dark:text-slate-400",e),children:t});function at({onSubmit:e,submitType:t="onChange",hasSubmitButton:n,defaultValues:r,fieldGroups:o}){const{handleSubmit:a,control:i,getValues:s}=Eh({mode:t,defaultValues:r}),l=(c,u)=>u?!0:c?c.some(d=>{const p=s(d.fieldName);return p==="always"?!0:typeof p=="boolean"?d.invert?p:!p:typeof p=="number"?d.invert?d.selector!==p:d.selector===p:!1}):!1;return f.jsxs("form",{className:"space-y-8 divide-y divide-gray-200",...t==="onSubmit"?{onSubmit:a(e)}:{onChange:a(e)},children:[o.map(c=>f.jsxs("div",{className:"space-y-8 divide-y divide-gray-200 sm:space-y-5",children:[f.jsxs("div",{children:[f.jsx(PC,{className:"font-medium",children:c.label}),f.jsx(wn,{children:c.description})]}),c.fields.map(u=>f.jsx(A6,{label:u.label,description:u.description,valid:u.validationText===void 0||u.validationText==="",validationText:u.validationText,children:f.jsx(P6,{field:u,control:i,disabled:l(u.disabledBy,u.disabled)})},u.label))]},c.label)),n&&f.jsx(pt,{type:"submit",children:"Submit"})]})}const R6=1,I6=1e6;let Cf=0;function O6(){return Cf=(Cf+1)%Number.MAX_VALUE,Cf.toString()}const Sf=new Map,Gy=e=>{if(Sf.has(e))return;const t=setTimeout(()=>{Sf.delete(e),_s({type:"REMOVE_TOAST",toastId:e})},I6);Sf.set(e,t)},D6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,R6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;if(n)Gy(n);else for(const r of e.toasts)Gy(r.id);return{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Mc=[];let Ac={toasts:[]};function _s(e){Ac=D6(Ac,e);for(const t of Mc)t(Ac)}function L6({...e}){const t=O6(),n=o=>_s({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>_s({type:"DISMISS_TOAST",toastId:t});return _s({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}const j6=e=>(Mc.push(e),function(){const n=Mc.indexOf(e);n>-1&&Mc.splice(n,1)}),F6=()=>Ac;function hd(){return{...m.useSyncExternalStore(j6,F6),toast:L6,dismiss:t=>_s({type:"DISMISS_TOAST",toastId:t})}}var Jr=z6,fr=G6,qn=[],mn=[],B6=typeof Uint8Array<"u"?Uint8Array:Array,Tf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ba=0,$6=Tf.length;Ba<$6;++Ba)qn[Ba]=Tf[Ba],mn[Tf.charCodeAt(Ba)]=Ba;mn[45]=62;mn[95]=63;function U6(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function V6(e,t,n){return(t+n)*3/4-n}function z6(e){var t,n=U6(e),r=n[0],o=n[1],a=new B6(V6(e,r,o)),i=0,s=o>0?r-4:r,l;for(l=0;l>16&255,a[i++]=t>>8&255,a[i++]=t&255;return o===2&&(t=mn[e.charCodeAt(l)]<<2|mn[e.charCodeAt(l+1)]>>4,a[i++]=t&255),o===1&&(t=mn[e.charCodeAt(l)]<<10|mn[e.charCodeAt(l+1)]<<4|mn[e.charCodeAt(l+2)]>>2,a[i++]=t>>8&255,a[i++]=t&255),a}function H6(e){return qn[e>>18&63]+qn[e>>12&63]+qn[e>>6&63]+qn[e&63]}function W6(e,t,n){for(var r,o=[],a=t;as?s:i+a));return r===1?(t=e[n-1],o.push(qn[t>>2]+qn[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(qn[t>>10]+qn[t>>4&63]+qn[t<<2&63]+"=")),o.join("")}const K6=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],q6=[..."0123456789"],X6=[..."CDEHKMPRTUWXY012458"],Y6=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],Q6=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],Z6=(e,t)=>e[t]+(e[t+1]<<8),J6=(e,t,n)=>{const r=t.length,o=Math.floor(65536/r)*r-1,a=2*Math.ceil(1.1*e);let i="",s=0;for(;so)&&(i+=t[u%r],s++)}}return i},eI=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),tI=(e,t,n)=>({length:r,type:o,characters:a})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(o!==void 0&&a!==void 0)throw new TypeError("Expected either `type` or `characters`");if(a!==void 0&&typeof a!="string")throw new TypeError("Expected `characters` to be string");if(!eI.has(o))throw new TypeError(`Unknown type: ${o}`);if(o===void 0&&a===void 0&&(o="hex"),o==="hex"||o===void 0&&a===void 0)return t(Math.ceil(r*.5),"hex",r);if(o==="base64")return t(Math.ceil(r*.75),"base64",r);if(o==="url-safe")return e(r,K6,n);if(o==="numeric")return e(r,q6,n);if(o==="distinguishable")return e(r,X6,n);if(o==="ascii-printable")return e(r,Y6,n);if(o==="alphanumeric")return e(r,Q6,n);if(a.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(a.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return e(r,a,n)};function nI(e,t){return tI(J6,e,t)}const rI=e=>[...e].map(t=>t.toString(16).padStart(2,"0")).join(""),oI=e=>btoa(String.fromCodePoint(...e)),Ky=65536;function MC(e){const t=new Uint8Array(e);for(let n=0;n{const{config:t,connection:n,addChannel:r}=Te(),{toast:o}=hd(),[a,i]=m.useState(fr(e?.settings?.psk??new Uint8Array(0))),[s,l]=m.useState(e?.settings?.psk.length??16),[c,u]=m.useState(),d=_=>{const b=new pe.Channel.Channel({..._,settings:{..._.settings,psk:Jr(a),moduleSettings:{positionPrecision:_.settings.positionEnabled?_.settings.preciseLocation?32:_.settings.positionPrecision:0}}});n?.setChannel(b).then(()=>{o({title:`Saved Channel: ${b.settings?.name}`}),r(b)})},p=()=>{i(btoa(iI({length:s??0,type:"alphanumeric"}))),u(void 0)},g=(_,b)=>{_.length%4!==0||Jr(_).length!==b?u(`Please enter a valid ${b*8} bit PSK.`):u(void 0)},v=_=>{const b=_.currentTarget?.value;i(b),g(b,s)},h=_=>{const b=Number.parseInt(_);l(b),g(a,b)};return f.jsx(at,{onSubmit:d,submitType:"onSubmit",hasSubmitButton:!0,defaultValues:{...e,settings:{...e?.settings,psk:a,positionEnabled:e?.settings?.moduleSettings?.positionPrecision!==void 0&&e?.settings?.moduleSettings?.positionPrecision>0,preciseLocation:e?.settings?.moduleSettings?.positionPrecision===32,positionPrecision:e?.settings?.moduleSettings?.positionPrecision===void 0?10:e?.settings?.moduleSettings?.positionPrecision}},fieldGroups:[{label:"Channel Settings",description:"Crypto, MQTT & misc settings",fields:[{type:"select",name:"role",label:"Role",disabled:e.index===0,description:"Device telemetry is sent over PRIMARY. Only one PRIMARY allowed",properties:{enumValue:e.index===0?{PRIMARY:1}:{DISABLED:0,SECONDARY:2}}},{type:"passwordGenerator",name:"settings.psk",label:"pre-Shared Key",description:"256, 128, or 8 bit PSKs allowed",validationText:c,devicePSKBitCount:s??0,inputChange:v,selectChange:h,buttonClick:p,properties:{value:a}},{type:"text",name:"settings.name",label:"Name",description:"A unique name for the channel <12 bytes, leave blank for default"},{type:"toggle",name:"settings.uplinkEnabled",label:"Uplink Enabled",description:"Send messages from the local mesh to MQTT"},{type:"toggle",name:"settings.downlinkEnabled",label:"Downlink Enabled",description:"Send messages from MQTT to the local mesh"},{type:"toggle",name:"settings.positionEnabled",label:"Allow Position Requests",description:"Send position to channel"},{type:"toggle",name:"settings.preciseLocation",label:"Precise Location",description:"Send precise location to channel"},{type:"select",name:"settings.positionPrecision",label:"Approximate Location",description:"If not sharing precise location, position shared on channel will be accurate within this distance",properties:{enumValue:t.display?.units===0?{"Within 23 km":10,"Within 12 km":11,"Within 5.8 km":12,"Within 2.9 km":13,"Within 1.5 km":14,"Within 700 m":15,"Within 350 m":16,"Within 200 m":17,"Within 90 m":18,"Within 50 m":19}:{"Within 15 miles":10,"Within 7.3 miles":11,"Within 3.6 miles":12,"Within 1.8 miles":13,"Within 0.9 miles":14,"Within 0.5 miles":15,"Within 0.2 miles":16,"Within 600 feet":17,"Within 300 feet":18,"Within 150 feet":19}}}]}]})},Qh=Ae.forwardRef(({className:e,...t},n)=>f.jsx("footer",{className:`flex flex- justify-center p-2 ${e}`,style:{backgroundColor:"var(--backgroundPrimary)",color:"var(--textPrimary)"},children:f.jsxs("p",{children:[f.jsx("a",{href:"https://vercel.com/?utm_source=meshtastic&utm_campaign=oss",className:"hover:underline",style:{color:"var(--link)"},children:"Powered by ▲ Vercel"})," ","| Meshtastic® is a registered trademark of Meshtastic LLC. |"," ",f.jsx("a",{href:"https://meshtastic.org/docs/legal",className:"hover:underline",style:{color:"var(--link)"},children:"Legal Information"})]})})),gd=({label:e,noPadding:t,actions:n,children:r})=>f.jsx(f.Fragment,{children:f.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[f.jsxs("div",{className:"flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4",children:[f.jsx("button",{type:"button",className:"pl-4 transition-all hover:text-accent md:hidden",children:f.jsx($R,{})}),f.jsx("div",{className:"flex flex-1 items-center justify-between px-4 md:px-0",children:f.jsxs("div",{className:"flex w-full items-center",children:[f.jsx("span",{className:"w-full text-lg font-medium",children:e}),f.jsx("div",{className:"flex justify-end space-x-4",children:n?.map((o,a)=>f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:o.onClick,children:f.jsx(o.icon,{className:o.iconClasses})},o.icon.name))})]})})]}),f.jsxs("div",{className:Ee("flex h-full w-full flex-col overflow-y-auto",!t&&"pl-3 pr-3 "),children:[r,f.jsx(Qh,{})]})]})}),qs=({label:e,children:t})=>f.jsxs("div",{className:"px-4 py-2",children:[f.jsx(PC,{className:"mb-2 ml-2",children:e}),f.jsx("div",{className:"space-y-1",children:t})]}),Ni=({label:e,active:t,Icon:n,element:r,onClick:o})=>f.jsxs(pt,{onClick:o,variant:t?"subtle":"ghost",size:"sm",className:"w-full justify-start gap-2",children:[n&&f.jsx(n,{size:16}),r&&r,e]}),vl=({children:e})=>{const{hardware:t,nodes:n,metadata:r}=Te(),o=n.get(t.myNodeNum),a=r.get(0),{activePage:i,setActivePage:s,setDialogOpen:l}=Te(),c=[{name:"Messages",icon:pC,page:"messages"},{name:"Map",icon:fC,page:"map"},{name:"Config",icon:Wh,page:"config"},{name:"Channels",icon:cC,page:"channels"},{name:"Nodes",icon:Gh,page:"nodes"}];return f.jsxs("div",{className:"min-w-[280px] max-w-min flex-col overflow-y-auto border-r-[0.5px] border-slate-300 bg-transparent dark:border-slate-700",children:[f.jsxs("div",{className:"flex justify-between px-8 pt-6",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-lg font-medium",children:o?.user?.shortName??"UNK"}),f.jsx(wn,{children:o?.user?.longName??"UNK"})]}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>l("deviceName",!0),children:f.jsx(f6,{size:16})})]}),f.jsxs("div",{className:"px-8 pb-6",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsx(VR,{size:24,viewBox:"0 0 28 24"}),f.jsxs(wn,{children:[o?.deviceMetrics?.batteryLevel??"UNK","%"]})]}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(g6,{size:24,viewBox:"0 0 36 24"}),f.jsxs(wn,{children:[o?.deviceMetrics?.voltage?.toPrecision(3)??"UNK"," volts"]})]}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(XR,{size:24,viewBox:"0 0 36 24"}),f.jsxs(wn,{children:["v",a?.firmwareVersion??"UNK"]})]})]}),f.jsx(qs,{label:"Navigation",children:c.map(u=>f.jsx(Ni,{label:u.name,Icon:u.icon,onClick:()=>{s(u.page)},active:u.page===i},u.name))}),e]})},cp=e=>e.settings?.name.length?e.settings?.name:e.index===0?"Primary":`Ch ${e.index}`,lI=()=>{const{channels:e,setDialogOpen:t}=Te(),[n,r]=m.useState(Ws.ChannelNumber.Primary),o=e.get(n),a=Array.from(e.values());return f.jsxs(f.Fragment,{children:[f.jsx(vl,{}),f.jsx(gd,{label:`Channel: ${o?cp(o):"Loading..."}`,actions:[{icon:t6,onClick(){t("import",!0)}},{icon:Pc,onClick(){t("QR",!0)}}],children:f.jsxs(od,{defaultValue:"0",children:[f.jsx(cl,{children:a.map(i=>f.jsx(ul,{value:i.index.toString(),children:cp(i)},i.index))}),a.map(i=>f.jsx(dl,{value:i.index.toString(),children:f.jsx(sI,{channel:i},i.index)},i.index))]})})]})},cI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"bluetooth",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.bluetooth,fieldGroups:[{label:"Bluetooth Settings",description:"Settings for the Bluetooth module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Bluetooth"},{type:"select",name:"mode",label:"Pairing mode",description:"Pin selection behaviour.",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.Config.Config_BluetoothConfig_PairingMode,formatEnumName:!0}},{type:"number",name:"fixedPin",label:"Pin",description:"Pin to use when pairing",disabledBy:[{fieldName:"mode",selector:pe.Config.Config_BluetoothConfig_PairingMode.FIXED_PIN,invert:!0},{fieldName:"enabled"}],properties:{}}]}]})},uI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"device",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.device,fieldGroups:[{label:"Device Settings",description:"Settings for the device",fields:[{type:"select",name:"role",label:"Role",description:"What role the device performs on the mesh",properties:{enumValue:{Client:pe.Config.Config_DeviceConfig_Role.CLIENT,"Client Mute":pe.Config.Config_DeviceConfig_Role.CLIENT_MUTE,Router:pe.Config.Config_DeviceConfig_Role.ROUTER,Repeater:pe.Config.Config_DeviceConfig_Role.REPEATER,Tracker:pe.Config.Config_DeviceConfig_Role.TRACKER,Sensor:pe.Config.Config_DeviceConfig_Role.SENSOR,TAK:pe.Config.Config_DeviceConfig_Role.TAK,"Client Hidden":pe.Config.Config_DeviceConfig_Role.CLIENT_HIDDEN,"Lost and Found":pe.Config.Config_DeviceConfig_Role.LOST_AND_FOUND,"TAK Tracker":pe.Config.Config_DeviceConfig_Role.SENSOR},formatEnumName:!0}},{type:"number",name:"buttonGpio",label:"Button Pin",description:"Button pin override"},{type:"number",name:"buzzerGpio",label:"Buzzer Pin",description:"Buzzer pin override"},{type:"select",name:"rebroadcastMode",label:"Rebroadcast Mode",description:"How to handle rebroadcasting",properties:{enumValue:pe.Config.Config_DeviceConfig_RebroadcastMode,formatEnumName:!0}},{type:"number",name:"nodeInfoBroadcastSecs",label:"Node Info Broadcast Interval",description:"How often to broadcast node info",properties:{suffix:"Seconds"}},{type:"toggle",name:"doubleTapAsButtonPress",label:"Double Tap as Button Press",description:"Treat double tap as button press"},{type:"toggle",name:"disableTripleClick",label:"Disable Triple Click",description:"Disable triple click"}]}]})},dI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"display",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.display,fieldGroups:[{label:"Display Settings",description:"Settings for the device display",fields:[{type:"number",name:"screenOnSecs",label:"Screen Timeout",description:"Turn off the display after this long",properties:{suffix:"Seconds"}},{type:"select",name:"gpsFormat",label:"GPS Display Units",description:"Coordinate display format",properties:{enumValue:pe.Config.Config_DisplayConfig_GpsCoordinateFormat}},{type:"number",name:"autoScreenCarouselSecs",label:"Carousel Delay",description:"How fast to cycle through windows",properties:{suffix:"Seconds"}},{type:"toggle",name:"compassNorthTop",label:"Compass North Top",description:"Fix north to the top of compass"},{type:"toggle",name:"flipScreen",label:"Flip Screen",description:"Flip display 180 degrees"},{type:"select",name:"units",label:"Display Units",description:"Display metric or imperial units",properties:{enumValue:pe.Config.Config_DisplayConfig_DisplayUnits,formatEnumName:!0}},{type:"select",name:"oled",label:"OLED Type",description:"Type of OLED screen attached to the device",properties:{enumValue:pe.Config.Config_DisplayConfig_OledType}},{type:"select",name:"displaymode",label:"Display Mode",description:"Screen layout variant",properties:{enumValue:pe.Config.Config_DisplayConfig_DisplayMode,formatEnumName:!0}},{type:"toggle",name:"headingBold",label:"Bold Heading",description:"Bolden the heading text"},{type:"toggle",name:"wakeOnTapOrMotion",label:"Wake on Tap or Motion",description:"Wake the device on tap or motion"}]}]})},fI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"lora",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.lora,fieldGroups:[{label:"Mesh Settings",description:"Settings for the LoRa mesh",fields:[{type:"select",name:"region",label:"Region",description:"Sets the region for your node",properties:{enumValue:pe.Config.Config_LoRaConfig_RegionCode}},{type:"select",name:"hopLimit",label:"Hop Limit",description:"Maximum number of hops",properties:{enumValue:{1:1,2:2,3:3,4:4,5:5,6:6,7:7}}},{type:"number",name:"channelNum",label:"Frequency Slot",description:"LoRa frequency channel number"},{type:"toggle",name:"ignoreMqtt",label:"Ignore MQTT",description:"Don't forward MQTT messages over the mesh"},{type:"toggle",name:"configOkToMqtt",label:"OK to MQTT",description:"When set to true, this configuration indicates that the user approves the packet to be uploaded to MQTT. If set to false, remote nodes are requested not to forward packets to MQTT"}]},{label:"Waveform Settings",description:"Settings for the LoRa waveform",fields:[{type:"toggle",name:"usePreset",label:"Use Preset",description:"Use one of the predefined modem presets"},{type:"select",name:"modemPreset",label:"Modem Preset",description:"Modem preset to use",disabledBy:[{fieldName:"usePreset"}],properties:{enumValue:pe.Config.Config_LoRaConfig_ModemPreset,formatEnumName:!0}},{type:"number",name:"bandwidth",label:"Bandwidth",description:"Channel bandwidth in MHz",disabledBy:[{fieldName:"usePreset",invert:!0}],properties:{suffix:"MHz"}},{type:"number",name:"spreadFactor",label:"Spreading Factor",description:"Indicates the number of chirps per symbol",disabledBy:[{fieldName:"usePreset",invert:!0}],properties:{suffix:"CPS"}},{type:"number",name:"codingRate",label:"Coding Rate",description:"The denominator of the coding rate",disabledBy:[{fieldName:"usePreset",invert:!0}]}]},{label:"Radio Settings",description:"Settings for the LoRa radio",fields:[{type:"toggle",name:"txEnabled",label:"Transmit Enabled",description:"Enable/Disable transmit (TX) from the LoRa radio"},{type:"number",name:"txPower",label:"Transmit Power",description:"Max transmit power",properties:{suffix:"dBm"}},{type:"toggle",name:"overrideDutyCycle",label:"Override Duty Cycle",description:"Override Duty Cycle"},{type:"number",name:"frequencyOffset",label:"Frequency Offset",description:"Frequency offset to correct for crystal calibration errors",properties:{suffix:"Hz"}},{type:"toggle",name:"sx126xRxBoostedGain",label:"Boosted RX Gain",description:"Boosted RX gain"},{type:"number",name:"overrideFrequency",label:"Override Frequency",description:"Override frequency",properties:{suffix:"MHz",step:.001}}]}]})};function tc(e){return`${e&255}.${e>>8&255}.${e>>16&255}.${e>>24&255}`}function nc(e){return e.split(".").reverse().reduce((t,n)=>(t<<8)+Number.parseInt(n),0)>>>0}const pI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"network",value:{...r,ipv4Config:new pe.Config.Config_NetworkConfig_IpV4Config({ip:nc(r.ipv4Config.ip)??0,gateway:nc(r.ipv4Config.gateway)??0,subnet:nc(r.ipv4Config.subnet)??0,dns:nc(r.ipv4Config.dns)??0})}}}))};return f.jsx(at,{onSubmit:n,defaultValues:{...e.network,ipv4Config:{ip:tc(e.network?.ipv4Config?.ip??0),gateway:tc(e.network?.ipv4Config?.gateway??0),subnet:tc(e.network?.ipv4Config?.subnet??0),dns:tc(e.network?.ipv4Config?.dns??0)}},fieldGroups:[{label:"WiFi Config",description:"WiFi radio configuration",fields:[{type:"toggle",name:"wifiEnabled",label:"Enabled",description:"Enable or disable the WiFi radio"},{type:"text",name:"wifiSsid",label:"SSID",description:"Network name",disabledBy:[{fieldName:"wifiEnabled"}]},{type:"password",name:"wifiPsk",label:"PSK",description:"Network password",disabledBy:[{fieldName:"wifiEnabled"}]}]},{label:"Ethernet Config",description:"Ethernet port configuration",fields:[{type:"toggle",name:"ethEnabled",label:"Enabled",description:"Enable or disable the Ethernet port"}]},{label:"IP Config",description:"IP configuration",fields:[{type:"select",name:"addressMode",label:"Address Mode",description:"Address assignment selection",properties:{enumValue:pe.Config.Config_NetworkConfig_AddressMode}},{type:"text",name:"ipv4Config.ip",label:"IP",description:"IP Address",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.gateway",label:"Gateway",description:"Default Gateway",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.subnet",label:"Subnet",description:"Subnet Mask",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.dns",label:"DNS",description:"DNS Server",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]}]},{label:"NTP Config",description:"NTP configuration",fields:[{type:"text",name:"ntpServer",label:"NTP Server"}]},{label:"Rsyslog Config",description:"Rsyslog configuration",fields:[{type:"text",name:"rsyslogServer",label:"Rsyslog Server"}]}]})},mI=()=>{const{config:e,nodes:t,hardware:n,setWorkingConfig:r}=Te(),o=a=>{r(new pe.Config.Config({payloadVariant:{case:"position",value:a}}))};return f.jsx(at,{onSubmit:o,defaultValues:e.position,fieldGroups:[{label:"Position Settings",description:"Settings for the position module",fields:[{type:"toggle",name:"positionBroadcastSmartEnabled",label:"Enable Smart Position",description:"Only send position when there has been a meaningful change in location"},{type:"select",name:"gpsMode",label:"GPS Mode",description:"Configure whether device GPS is Enabled, Disabled, or Not Present",properties:{enumValue:pe.Config.Config_PositionConfig_GpsMode}},{type:"toggle",name:"fixedPosition",label:"Fixed Position",description:"Don't report GPS position, but a manually-specified one"},{type:"multiSelect",name:"positionFlags",label:"Position Flags",description:"Configuration options for Position messages",properties:{enumValue:pe.Config.Config_PositionConfig_PositionFlags}},{type:"number",name:"rxGpio",label:"Receive Pin",description:"GPS module RX pin override"},{type:"number",name:"txGpio",label:"Transmit Pin",description:"GPS module TX pin override"},{type:"number",name:"gpsEnGpio",label:"Enable Pin",description:"GPS module enable pin override"}]},{label:"Intervals",description:"How often to send position updates",fields:[{type:"number",name:"positionBroadcastSecs",label:"Broadcast Interval",description:"How often your position is sent out over the mesh",properties:{suffix:"Seconds"}},{type:"number",name:"gpsUpdateInterval",label:"GPS Update Interval",description:"How often a GPS fix should be acquired",properties:{suffix:"Seconds"}},{type:"number",name:"broadcastSmartMinimumDistance",label:"Smart Position Minimum Distance",description:"Minimum distance (in meters) that must be traveled before a position update is sent",disabledBy:[{fieldName:"positionBroadcastSmartEnabled"}]},{type:"number",name:"broadcastSmartMinimumIntervalSecs",label:"Smart Position Minimum Interval",description:"Minimum interval (in seconds) that must pass before a position update is sent",disabledBy:[{fieldName:"positionBroadcastSmartEnabled"}]}]}]})},hI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"power",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.power,fieldGroups:[{label:"Power Config",description:"Settings for the power module",fields:[{type:"toggle",name:"isPowerSaving",label:"Enable power saving mode",description:"Select if powered from a low-current source (i.e. solar), to minimize power consumption as much as possible."},{type:"number",name:"onBatteryShutdownAfterSecs",label:"Shutdown on battery delay",description:"Automatically shutdown node after this long when on battery, 0 for indefinite",properties:{suffix:"Seconds"}},{type:"number",name:"adcMultiplierOverride",label:"ADC Multiplier Override ratio",description:"Used for tweaking battery voltage reading",properties:{step:1e-4}},{type:"number",name:"waitBluetoothSecs",label:"No Connection Bluetooth Disabled",description:"If the device does not receive a Bluetooth connection, the BLE radio will be disabled after this long",properties:{suffix:"Seconds"}},{type:"number",name:"deviceBatteryInaAddress",label:"INA219 Address",description:"Address of the INA219 battery monitor"}]},{label:"Sleep Settings",description:"Sleep settings for the power module",fields:[{type:"number",name:"sdsSecs",label:"Super Deep Sleep Duration",description:"How long the device will be in super deep sleep for",properties:{suffix:"Seconds"}},{type:"number",name:"lsSecs",label:"Light Sleep Duration",description:"How long the device will be in light sleep for",properties:{suffix:"Seconds"}},{type:"number",name:"minWakeSecs",label:"Minimum Wake Time",description:"Minimum amount of time the device will stay awake for after receiving a packet",properties:{suffix:"Seconds"}}]}]})};var Zh="Dialog",[AC,P7]=Pr(Zh),[gI,Bn]=AC(Zh),RC=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=m.useRef(null),l=m.useRef(null),[c=!1,u]=go({prop:r,defaultProp:o,onChange:a});return f.jsx(gI,{scope:t,triggerRef:s,contentRef:l,contentId:fo(),titleId:fo(),descriptionId:fo(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};RC.displayName=Zh;var IC="DialogTrigger",vI=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(IC,n),a=$e(t,o.triggerRef);return f.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":tg(o.open),...r,ref:a,onClick:we(e.onClick,o.onOpenToggle)})});vI.displayName=IC;var Jh="DialogPortal",[yI,OC]=AC(Jh,{forceMount:void 0}),DC=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=Bn(Jh,t);return f.jsx(yI,{scope:t,forceMount:n,children:m.Children.map(r,i=>f.jsx(ua,{present:n||a.open,children:f.jsx(ld,{asChild:!0,container:o,children:i})}))})};DC.displayName=Jh;var _u="DialogOverlay",LC=m.forwardRef((e,t)=>{const n=OC(_u,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Bn(_u,e.__scopeDialog);return a.modal?f.jsx(ua,{present:r||a.open,children:f.jsx(bI,{...o,ref:t})}):null});LC.displayName=_u;var bI=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(_u,n);return f.jsx(Vh,{as:Ti,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(xe.div,{"data-state":tg(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ra="DialogContent",jC=m.forwardRef((e,t)=>{const n=OC(ra,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Bn(ra,e.__scopeDialog);return f.jsx(ua,{present:r||a.open,children:a.modal?f.jsx(wI,{...o,ref:t}):f.jsx(_I,{...o,ref:t})})});jC.displayName=ra;var wI=m.forwardRef((e,t)=>{const n=Bn(ra,e.__scopeDialog),r=m.useRef(null),o=$e(t,n.contentRef,r);return m.useEffect(()=>{const a=r.current;if(a)return Bh(a)},[]),f.jsx(FC,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&a.preventDefault()}),onFocusOutside:we(e.onFocusOutside,a=>a.preventDefault())})}),_I=m.forwardRef((e,t)=>{const n=Bn(ra,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return f.jsx(FC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),FC=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=Bn(ra,n),l=m.useRef(null),c=$e(t,l);return Yx(),f.jsxs(f.Fragment,{children:[f.jsx(Nh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:f.jsx(ad,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":tg(s.open),...i,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(xI,{titleId:s.titleId}),f.jsx(CI,{contentRef:l,descriptionId:s.descriptionId})]})]})}),eg="DialogTitle",BC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(eg,n);return f.jsx(xe.h2,{id:o.titleId,...r,ref:t})});BC.displayName=eg;var $C="DialogDescription",UC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn($C,n);return f.jsx(xe.p,{id:o.descriptionId,...r,ref:t})});UC.displayName=$C;var VC="DialogClose",zC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(VC,n);return f.jsx(xe.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});zC.displayName=VC;function tg(e){return e?"open":"closed"}var HC="DialogTitleWarning",[M7,WC]=NP(HC,{contentName:ra,titleName:eg,docsSlug:"dialog"}),xI=({titleId:e})=>{const t=WC(HC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kI="DialogDescriptionWarning",CI=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WC(kI).contentName}}.`;return m.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},SI=RC,GC=DC,KC=LC,qC=jC,XC=BC,YC=UC,TI=zC;const Ar=SI,QC=({children:e,...t})=>f.jsx(GC,{...t,children:f.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center sm:items-center",children:e})});QC.displayName=GC.displayName;const ZC=m.forwardRef(({className:e,children:t,...n},r)=>f.jsx(KC,{className:Ee("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm transition-opacity animate-in fade-in",e),...n,ref:r}));ZC.displayName=KC.displayName;const tr=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(QC,{children:[f.jsx(ZC,{}),f.jsxs(qC,{ref:r,className:Ee("fixed z-50 grid w-full scale-100 gap-4 bg-white p-6 opacity-100 animate-in fade-in-90 slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0","dark:bg-slate-900",e),...n,children:[t,f.jsxs(TI,{className:"absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800",children:[f.jsx(yC,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tr.displayName=qC.displayName;const Rr=({className:e,...t})=>f.jsx("div",{className:Ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});Rr.displayName="DialogHeader";const $i=({className:e,...t})=>f.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$i.displayName="DialogFooter";const Ir=m.forwardRef(({className:e,...t},n)=>f.jsx(XC,{ref:n,className:Ee("text-lg font-semibold text-slate-900","dark:text-slate-50",e),...t}));Ir.displayName=XC.displayName;const To=m.forwardRef(({className:e,...t},n)=>f.jsx(YC,{ref:n,className:Ee("text-sm text-slate-500","dark:text-slate-400",e),...t}));To.displayName=YC.displayName;const EI=({open:e,onOpenChange:t,onSubmit:n})=>f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Regenerate Key pair?"}),f.jsx(To,{children:"Are you sure you want to regenerate key pair?"})]}),f.jsx($i,{children:f.jsx(pt,{variant:"destructive",onClick:()=>n(),children:"Regenerate"})})]})}),Ef=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */new Uint8Array(new Uint32Array([287454020]).buffer)[0];function NI(e=32){if(Ef&&typeof Ef.getRandomValues=="function")return Ef.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const PI=BigInt(0);function ng(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function JC(e){if(!ng(e))throw new Error("Uint8Array expected")}const MI=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function AI(e){JC(e);let t="";for(let n=0;n=cr._0&&e<=cr._9)return e-cr._0;if(e>=cr._A&&e<=cr._F)return e-(cr._A-10);if(e>=cr._a&&e<=cr._f)return e-(cr._a-10)}function eS(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,a=0;otypeof e=="bigint"&&PI<=e;function DI(e,t,n){return Nf(e)&&Nf(t)&&Nf(n)&&t<=e&&etypeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||ng(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function jI(e,t,n={}){const r=(o,a,i)=>{const s=LI[a];if(typeof s!="function")throw new Error(`Invalid validator "${a}", expected function`);const l=e[o];if(!(i&&l===void 0)&&!s(l,e))throw new Error(`Invalid param ${String(o)}=${l} (${typeof l}), expected ${a}`)};for(const[o,a]of Object.entries(t))r(o,a,!1);for(const[o,a]of Object.entries(n))r(o,a,!0);return e}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oi=BigInt(0),rc=BigInt(1);BigInt(2);BigInt(3);BigInt(4);BigInt(5);BigInt(8);BigInt(9);BigInt(16);function tS(e,t){const n=e%t;return n>=oi?n:t+n}function FI(e,t,n){if(n<=oi||t 0");if(n===rc)return oi;let r=rc;for(;t>oi;)t&rc&&(r=r*e%n),e=e*e%n,t>>=rc;return r}function Pn(e,t,n){let r=e;for(;t-- >oi;)r*=r,r%=n;return r}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $a=BigInt(0),Pf=BigInt(1);function BI(e){return jI(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function $I(e){const t=BI(e),{P:n}=t,r=y=>tS(y,n),o=t.montgomeryBits,a=Math.ceil(o/8),i=t.nByteLength,s=t.adjustScalarBytes||(y=>y),l=t.powPminus2||(y=>FI(y,n-BigInt(2),n));function c(y,x,E){const w=r(y*(x-E));return x=r(x-w),E=r(E+w),[x,E]}const u=(t.a-BigInt(2))/BigInt(4);function d(y,x){Qy("u",y,$a,n),Qy("scalar",x,$a,n);const E=x,w=y;let T=Pf,k=$a,C=y,P=Pf,O=$a,R;for(let B=BigInt(o-1);B>=$a;B--){const D=E>>B&Pf;O^=D,R=c(O,T,C),T=R[0],C=R[1],R=c(O,k,P),k=R[0],P=R[1],O=D;const L=T+k,G=r(L*L),Y=T-k,K=r(Y*Y),Z=G-K,re=C+P,fe=C-P,U=r(fe*L),ae=r(re*Y),se=U+ae,S=U-ae;C=r(se*se),P=r(w*r(S*S)),T=r(G*K),k=r(Z*(G+r(u*Z)))}R=c(O,T,C),T=R[0],C=R[1],R=c(O,k,P),k=R[0],P=R[1];const N=l(k);return r(T*N)}function p(y){return OI(r(y),a)}function g(y){const x=Yy("u coordinate",y,a);return i===32&&(x[31]&=127),Xy(x)}function v(y){const x=Yy("scalar",y),E=x.length;if(E!==a&&E!==i)throw new Error(`Expected ${a} or ${i} bytes, got ${E}`);return Xy(s(x))}function h(y,x){const E=g(x),w=v(y),T=d(E,w);if(T===$a)throw new Error("Invalid private or public key received");return p(T)}const _=p(t.Gu);function b(y){return h(y,_)}return{scalarMult:h,scalarMultBase:b,getSharedSecret:(y,x)=>h(y,x),getPublicKey:y=>b(y),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:_}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const up=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const UI=BigInt(1),Zy=BigInt(2),VI=BigInt(3),zI=BigInt(5);BigInt(8);function HI(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),a=up,s=e*e%a*e%a,l=Pn(s,Zy,a)*s%a,c=Pn(l,UI,a)*e%a,u=Pn(c,zI,a)*c%a,d=Pn(u,t,a)*u%a,p=Pn(d,n,a)*d%a,g=Pn(p,r,a)*p%a,v=Pn(g,o,a)*g%a,h=Pn(v,o,a)*g%a,_=Pn(h,t,a)*u%a;return{pow_p_5_8:Pn(_,Zy,a)*e%a,b2:s}}function WI(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const nS=$I({P:up,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=up,{pow_p_5_8:n,b2:r}=HI(e);return tS(Pn(n,VI,t)*r,t)},adjustScalarBytes:WI,randomBytes:NI});function GI(){const e=nS.utils.randomPrivateKey();return e[0]&=248,e[31]&=127,e[31]|=64,e}function Jy(e){return nS.getPublicKey(e)}const KI=()=>{const{config:e,nodes:t,hardware:n,setWorkingConfig:r}=Te(),[o,a]=m.useState(fr(e.security?.privateKey??new Uint8Array(0))),[i,s]=m.useState(!1),[l,c]=m.useState(e.security?.privateKey.length??32),[u,d]=m.useState(),[p,g]=m.useState(fr(e.security?.publicKey??new Uint8Array(0))),[v,h]=m.useState(fr(e.security?.adminKey[0]??new Uint8Array(0))),[_,b]=m.useState(),[y,x]=m.useState(!1),E=R=>{u||_||r(new pe.Config.Config({payloadVariant:{case:"security",value:{...R,adminKey:[Jr(v)],privateKey:Jr(o),publicKey:Jr(p)}}}))},w=(R,N,B)=>{try{R.length%4!==0||Jr(R).length!==N?B(`Please enter a valid ${N*8} bit PSK.`):B(void 0)}catch(D){console.error(D),B(`Please enter a valid ${N*8} bit PSK.`)}},T=()=>{x(!0)},k=()=>{const R=GI(),N=Jy(R);a(fr(R)),g(fr(N)),w(fr(R),l,d),x(!1)},C=R=>{const N=R.target.value;a(N),w(N,l,d);const B=Jy(Jr(N));g(fr(B))},P=R=>{const N=R.currentTarget?.value;h(N),w(N,l,b)},O=R=>{const N=Number.parseInt(R);c(N),w(o,N,d)};return f.jsxs(f.Fragment,{children:[f.jsx(at,{onSubmit:E,submitType:"onChange",defaultValues:{...e.security,adminKey:v,privateKey:o,publicKey:p,adminChannelEnabled:e.security?.adminChannelEnabled??!1,isManaged:e.security?.isManaged??!1,debugLogApiEnabled:e.security?.debugLogApiEnabled??!1,serialEnabled:e.security?.serialEnabled??!1},fieldGroups:[{label:"Security Settings",description:"Settings for the Security configuration",fields:[{type:"passwordGenerator",name:"privateKey",label:"Private Key",description:"Used to create a shared key with a remote device",bits:[{text:"256 bit",value:"32",key:"bit256"}],validationText:u,devicePSKBitCount:l,inputChange:C,selectChange:O,hide:!i,buttonClick:T,properties:{value:o,action:{icon:i?QR:ZR,onClick:()=>s(!i)}}},{type:"text",name:"publicKey",label:"Public Key",disabled:!0,description:"Sent out to other nodes on the mesh to allow them to compute a shared secret key",properties:{value:p}}]},{label:"Admin Settings",description:"Settings for Admin",fields:[{type:"toggle",name:"adminChannelEnabled",label:"Allow Legacy Admin",description:"Allow incoming device control over the insecure legacy admin channel"},{type:"toggle",name:"isManaged",label:"Managed",description:'If true, device is considered to be "managed" by a mesh administrator via admin messages'},{type:"text",name:"adminKey",label:"Admin Key",description:"The public key authorized to send admin messages to this node",validationText:_,inputChange:P,disabledBy:[{fieldName:"adminChannelEnabled",invert:!0}],properties:{value:v}}]},{label:"Logging Settings",description:"Settings for Logging",fields:[{type:"toggle",name:"debugLogApiEnabled",label:"Enable Debug Log API",description:"Output live debug logging over serial, view and export position-redacted device logs over Bluetooth"},{type:"toggle",name:"serialEnabled",label:"Serial Output Enabled",description:"Serial Console over the Stream API"}]}]}),f.jsx(EI,{open:y,onOpenChange:()=>x(!1),onSubmit:()=>k()})]})},qI=()=>{Te();const e=[{label:"Device",element:uI,count:0},{label:"Position",element:mI},{label:"Power",element:hI},{label:"Network",element:pI},{label:"Display",element:dI},{label:"LoRa",element:fI},{label:"Bluetooth",element:cI},{label:"Security",element:KI}];return f.jsxs(od,{defaultValue:"Device",children:[f.jsx(cl,{children:e.map(t=>f.jsx(ul,{value:t.label,children:t.label},t.label))}),e.map(t=>f.jsx(dl,{value:t.label,children:f.jsx(t.element,{})},t.label))]})},XI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"ambientLighting",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.ambientLighting,fieldGroups:[{label:"Ambient Lighting Settings",description:"Settings for the Ambient Lighting module",fields:[{type:"toggle",name:"ledState",label:"LED State",description:"Sets LED to on or off"},{type:"number",name:"current",label:"Current",description:"Sets the current for the LED output. Default is 10"},{type:"number",name:"red",label:"Red",description:"Sets the red LED level. Values are 0-255"},{type:"number",name:"green",label:"Green",description:"Sets the green LED level. Values are 0-255"},{type:"number",name:"blue",label:"Blue",description:"Sets the blue LED level. Values are 0-255"}]}]})},YI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"detectionSensor",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.detectionSensor,fieldGroups:[{label:"Detection Sensor Settings",description:"Settings for the Detection Sensor module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Detection Sensor Module"},{type:"number",name:"minimumBroadcastSecs",label:"Minimum Broadcast Seconds",description:"The interval in seconds of how often we can send a message to the mesh when a state change is detected",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"stateBroadcastSecs",label:"State Broadcast Seconds",description:"The interval in seconds of how often we should send a message to the mesh with the current state regardless of changes",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"sendBell",label:"Send Bell",description:"Send ASCII bell with alert message",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"name",label:"Friendly Name",description:"Used to format the message sent to mesh, max 20 Characters",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"monitorPin",label:"Monitor Pin",description:"The GPIO pin to monitor for state changes",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"detectionTriggeredHigh",label:"Detection Triggered High",description:"Whether or not the GPIO pin state detection is triggered on HIGH (1), otherwise LOW (0)",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"usePullup",label:"Use Pullup",description:"Whether or not use INPUT_PULLUP mode for GPIO pin",disabledBy:[{fieldName:"enabled"}]}]}]})},QI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"neighborInfo",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.neighborInfo,fieldGroups:[{label:"Neighbor Info Settings",description:"Settings for the Neighbor Info module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Neighbor Info Module"},{type:"number",name:"updateInterval",label:"Update Interval",description:"Interval in seconds of how often we should try to send our Neighbor Info to the mesh",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]}]}]})},ZI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"audio",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.audio,fieldGroups:[{label:"Audio Settings",description:"Settings for the Audio module",fields:[{type:"toggle",name:"codec2Enabled",label:"Codec 2 Enabled",description:"Enable Codec 2 audio encoding"},{type:"number",name:"pttPin",label:"PTT Pin",description:"GPIO pin to use for PTT"},{type:"select",name:"bitrate",label:"Bitrate",description:"Bitrate to use for audio encoding",properties:{enumValue:pe.ModuleConfig.ModuleConfig_AudioConfig_Audio_Baud}},{type:"number",name:"i2sWs",label:"i2S WS",description:"GPIO pin to use for i2S WS"},{type:"number",name:"i2sSd",label:"i2S SD",description:"GPIO pin to use for i2S SD"},{type:"number",name:"i2sDin",label:"i2S DIN",description:"GPIO pin to use for i2S DIN"},{type:"number",name:"i2sSck",label:"i2S SCK",description:"GPIO pin to use for i2S SCK"}]}]})},JI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"cannedMessage",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.cannedMessage,fieldGroups:[{label:"Canned Message Settings",description:"Settings for the Canned Message module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Canned Message"},{type:"toggle",name:"rotary1Enabled",label:"Rotary Encoder #1 Enabled",description:"Enable the rotary encoder"},{type:"number",name:"inputbrokerPinA",label:"Encoder Pin A",description:"GPIO Pin Value (1-39) For encoder port A"},{type:"number",name:"inputbrokerPinB",label:"Encoder Pin B",description:"GPIO Pin Value (1-39) For encoder port B"},{type:"number",name:"inputbrokerPinPress",label:"Encoder Pin Press",description:"GPIO Pin Value (1-39) For encoder Press"},{type:"select",name:"inputbrokerEventCw",label:"Clockwise event",description:"Select input event.",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"select",name:"inputbrokerEventCcw",label:"Counter Clockwise event",description:"Select input event.",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"select",name:"inputbrokerEventPress",label:"Press event",description:"Select input event",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"toggle",name:"updown1Enabled",label:"Up Down enabled",description:"Enable the up / down encoder"},{type:"text",name:"allowInputSource",label:"Allow Input Source",description:"Select from: '_any', 'rotEnc1', 'upDownEnc1', 'cardkb'"},{type:"toggle",name:"sendBell",label:"Send Bell",description:"Sends a bell character with each message"}]}]})},eO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"externalNotification",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.externalNotification,fieldGroups:[{label:"External Notification Settings",description:"Configure the external notification module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable External Notification"},{type:"number",name:"outputMs",label:"Output MS",description:"Output MS",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"ms"}},{type:"number",name:"output",label:"Output",description:"Output",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"outputVibra",label:"Output Vibrate",description:"Output Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"outputBuzzer",label:"Output Buzzer",description:"Output Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"active",label:"Active",description:"Active",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessage",label:"Alert Message",description:"Alert Message",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessageVibra",label:"Alert Message Vibrate",description:"Alert Message Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessageBuzzer",label:"Alert Message Buzzer",description:"Alert Message Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBell",label:"Alert Bell",description:"Should an alert be triggered when receiving an incoming bell?",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBellVibra",label:"Alert Bell Vibrate",description:"Alert Bell Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBellBuzzer",label:"Alert Bell Buzzer",description:"Alert Bell Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"usePwm",label:"Use PWM",description:"Use PWM",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"nagTimeout",label:"Nag Timeout",description:"Nag Timeout",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"useI2sAsBuzzer",label:"Use I²S Pin as Buzzer",description:"Designate I²S Pin as Buzzer Output",disabledBy:[{fieldName:"enabled"}]}]}]})},tO=()=>{const{config:e,moduleConfig:t,setWorkingModuleConfig:n}=Te(),r=o=>{n(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"mqtt",value:{...o,mapReportSettings:new pe.ModuleConfig.ModuleConfig_MapReportSettings(o.mapReportSettings)}}}))};return f.jsx(at,{onSubmit:r,defaultValues:t.mqtt,fieldGroups:[{label:"MQTT Settings",description:"Settings for the MQTT module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable MQTT"},{type:"text",name:"address",label:"MQTT Server Address",description:"MQTT server address to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"username",label:"MQTT Username",description:"MQTT username to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"password",name:"password",label:"MQTT Password",description:"MQTT password to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"encryptionEnabled",label:"Encryption Enabled",description:"Enable or disable MQTT encryption. Note: All messages are sent to the MQTT broker unencrypted if this option is not enabled, even when your uplink channels have encryption keys set. This includes position data.",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"jsonEnabled",label:"JSON Enabled",description:"Whether to send/consume JSON packets on MQTT",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"tlsEnabled",label:"TLS Enabled",description:"Enable or disable TLS",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"root",label:"Root topic",description:"MQTT root topic to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"proxyToClientEnabled",label:"Proxy to Client Enabled",description:"Use the client's internet connection for MQTT (feature only active in mobile apps)",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"mapReportingEnabled",label:"Map Reporting Enabled",description:"Enable or disable map reporting",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"mapReportSettings.publishIntervalSecs",label:"Map Report Publish Interval (s)",description:"Interval in seconds to publish map reports",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"},{fieldName:"mapReportingEnabled"}]},{type:"select",name:"mapReportSettings.positionPrecision",label:"Approximate Location",description:"Position shared will be accurate within this distance",properties:{enumValue:e.display?.units===0?{"Within 23 km":10,"Within 12 km":11,"Within 5.8 km":12,"Within 2.9 km":13,"Within 1.5 km":14,"Within 700 m":15,"Within 350 m":16,"Within 200 m":17,"Within 90 m":18,"Within 50 m":19}:{"Within 15 miles":10,"Within 7.3 miles":11,"Within 3.6 miles":12,"Within 1.8 miles":13,"Within 0.9 miles":14,"Within 0.5 miles":15,"Within 0.2 miles":16,"Within 600 feet":17,"Within 300 feet":18,"Within 150 feet":19}},disabledBy:[{fieldName:"enabled"},{fieldName:"mapReportingEnabled"}]}]}]})},nO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"paxcounter",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.paxcounter,fieldGroups:[{label:"Paxcounter Settings",description:"Settings for the Paxcounter module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Paxcounter"},{type:"number",name:"paxcounterUpdateInterval",label:"Update Interval (seconds)",description:"How long to wait between sending paxcounter packets",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]}]}]})},rO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"rangeTest",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.rangeTest,fieldGroups:[{label:"Range Test Settings",description:"Settings for the Range Test module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Range Test"},{type:"number",name:"sender",label:"Message Interval",description:"How long to wait between sending test packets",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"save",label:"Save CSV to storage",description:"ESP32 Only",disabledBy:[{fieldName:"enabled"}]}]}]})},oO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"serial",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.serial,fieldGroups:[{label:"Serial Settings",description:"Settings for the Serial module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Serial output"},{type:"toggle",name:"echo",label:"Echo",description:"Any packets you send will be echoed back to your device",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"rxd",label:"Receive Pin",description:"Set the GPIO pin to the RXD pin you have set up.",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"txd",label:"Transmit Pin",description:"Set the GPIO pin to the TXD pin you have set up.",disabledBy:[{fieldName:"enabled"}]},{type:"select",name:"baud",label:"Baud Rate",description:"The serial baud rate",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.ModuleConfig.ModuleConfig_SerialConfig_Serial_Baud}},{type:"number",name:"timeout",label:"Timeout",description:"Seconds to wait before we consider your packet as 'done'",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"Seconds"}},{type:"select",name:"mode",label:"Mode",description:"Select Mode",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.ModuleConfig.ModuleConfig_SerialConfig_Serial_Mode,formatEnumName:!0}},{type:"toggle",name:"overrideConsoleSerialPort",label:"Override Console Serial Port",description:"If you have a serial port connected to the console, this will override it."}]}]})},aO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"storeForward",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.storeForward,fieldGroups:[{label:"Store & Forward Settings",description:"Settings for the Store & Forward module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Store & Forward"},{type:"toggle",name:"heartbeat",label:"Heartbeat Enabled",description:"Enable Store & Forward heartbeat",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"records",label:"Number of records",description:"Number of records to store",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"Records"}},{type:"number",name:"historyReturnMax",label:"History return max",description:"Max number of records to return",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"historyReturnWindow",label:"History return window",description:"Max number of records to return",disabledBy:[{fieldName:"enabled"}]}]}]})},iO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"telemetry",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.telemetry,fieldGroups:[{label:"Telemetry Settings",description:"Settings for the Telemetry module",fields:[{type:"number",name:"deviceUpdateInterval",label:"Query Interval",description:"Interval to get telemetry data",properties:{suffix:"Seconds"}},{type:"number",name:"environmentUpdateInterval",label:"Update Interval",description:"How often to send Metrics over the mesh",properties:{suffix:"Seconds"}},{type:"toggle",name:"environmentMeasurementEnabled",label:"Module Enabled",description:"Enable the Environment Telemetry"},{type:"toggle",name:"environmentScreenEnabled",label:"Displayed on Screen",description:"Show the Telemetry Module on the OLED"},{type:"toggle",name:"environmentDisplayFahrenheit",label:"Display Fahrenheit",description:"Display temp in Fahrenheit"},{type:"toggle",name:"airQualityEnabled",label:"Air Quality Enabled",description:"Enable the Air Quality Telemetry"},{type:"number",name:"airQualityInterval",label:"Air Quality Update Interval",description:"How often to send Air Quality data over the mesh"},{type:"toggle",name:"powerMeasurementEnabled",label:"Power Measurement Enabled",description:"Enable the Power Measurement Telemetry"},{type:"number",name:"powerUpdateInterval",label:"Power Update Interval",description:"How often to send Power data over the mesh"},{type:"toggle",name:"powerScreenEnabled",label:"Power Screen Enabled",description:"Enable the Power Telemetry Screen"}]}]})},sO=()=>{const e=[{label:"MQTT",element:tO},{label:"Serial",element:oO},{label:"Ext Notif",element:eO},{label:"S&F",element:aO},{label:"Range Test",element:rO},{label:"Telemetry",element:iO},{label:"Canned",element:JI},{label:"Audio",element:ZI},{label:"Neighbor Info",element:QI},{label:"Ambient Lighting",element:XI},{label:"Detection Sensor",element:YI},{label:"Paxcounter",element:nO}];return f.jsxs(od,{defaultValue:"MQTT",children:[f.jsx(cl,{children:e.map(t=>f.jsx(ul,{value:t.label,children:t.label},t.label))}),e.map(t=>f.jsx(dl,{value:t.label,children:f.jsx(t.element,{})},t.label))]})},lO=()=>{const{workingConfig:e,workingModuleConfig:t,connection:n}=Te(),[r,o]=m.useState("device"),{toast:a}=hd();return f.jsxs(f.Fragment,{children:[f.jsx(vl,{children:f.jsxs(qs,{label:"Config Sections",children:[f.jsx(Ni,{label:"Radio Config",active:r==="device",onClick:()=>o("device"),Icon:Wh}),f.jsx(Ni,{label:"Module Config",active:r==="module",onClick:()=>o("module"),Icon:HR})]})}),f.jsx(gd,{label:r==="device"?"Radio Config":"Module Config",actions:[{icon:c6,async onClick(){r==="device"?e.map(async i=>await n?.setConfig(i).then(()=>a({title:`Config ${i.payloadVariant.case} saved`}))):t.map(async i=>await n?.setModuleConfig(i).then(()=>a({title:`Config ${i.payloadVariant.case} saved`}))),await n?.commitEditSettings()}}],children:r==="device"?f.jsx(qI,{}):f.jsx(sO,{})})]})},$n=i2()(e=>({selectedDevice:0,devices:[],currentPage:"messages",rasterSources:[],commandPaletteOpen:!1,darkMode:localStorage.getItem("theme-dark")!==null?localStorage.getItem("theme-dark")==="true":window.matchMedia("(prefers-color-scheme: dark)").matches,accent:"orange",connectDialogOpen:!1,nodeNumToBeRemoved:0,setRasterSources:t=>{e(Ie(n=>{n.rasterSources=t}))},addRasterSource:t=>{e(Ie(n=>{n.rasterSources.push(t)}))},removeRasterSource:t=>{e(Ie(n=>{n.rasterSources.splice(t,1)}))},setSelectedDevice:t=>e(()=>({selectedDevice:t})),addDevice:t=>e(n=>({devices:[...n.devices,t]})),removeDevice:t=>e(n=>({devices:n.devices.filter(r=>r.id!==t)})),setCommandPaletteOpen:t=>{e(Ie(n=>{n.commandPaletteOpen=t}))},setDarkMode:t=>{localStorage.setItem("theme-dark",t.toString()),e(Ie(n=>{n.darkMode=t}))},setNodeNumToBeRemoved:t=>e(n=>({nodeNumToBeRemoved:t})),setAccent(t){e(Ie(n=>{n.accent=t}))},setConnectDialogOpen:t=>{e(Ie(n=>{n.connectDialogOpen=t}))}}));var da={},vd={},yd={},rS={},bd={};bd.__esModule=!0;bd.StandardFigures=void 0;bd.StandardFigures=[[0,8,9,9,9,9,0,8,8,0,0,0,9,9,8,8,0,0,0,9,9,0,8,9,9,9,9,0],[0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,8,0,8,9,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0],[0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,9,8,0,8,9,0,0,0,0,0,0,0,0],[0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0],[0,0,0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0],[0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0,0,0],[0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0],[0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0],[0,0,0,0,0,0,0,8,9,9,0,0,9,8,8,9,9,0,0,9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,9,9,0,0,0,9,9,9,9,0,0,0,9,9,0,9,8,8,8,9,0],[0,0,0,0,0,0,0,8,9,9,9,9,9,0,8,9,9,9,9,9,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0],[0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,9,0,9,8,8,9,0,9,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,0,9,0,8,0,9,8,0,9,0,8,0,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,0,0,9,8,8,9,0,0,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,0,8,9,9,8,9,0,0,8,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,9,9,9,8,0,0,0,9,9,9,8,0,0,0,0,0,0,0]];var wd={};wd.__esModule=!0;wd.Sprites=void 0;wd.Sprites=[{x:0,y:0,shape:1,hidden:!0},{x:0,y:0,shape:0,light:"top"},{x:0,y:.25,shape:1,light:"left"},{x:0,y:.25,shape:0,light:"left"},{x:0,y:.5,shape:1,light:"left"},{x:0,y:.5,shape:0,light:"left"},{x:0,y:.75,shape:1,hidden:!0},{x:.25,y:-.125,shape:0,light:"top"},{x:.25,y:.125,shape:1,light:"top"},{x:.25,y:.125,shape:0,light:"top"},{x:.25,y:.375,shape:1,light:"left"},{x:.25,y:.375,shape:0,light:"left"},{x:.25,y:.625,shape:1,light:"left"},{x:.25,y:.625,shape:0,light:"left"},{x:.5,y:0,shape:1,light:"top"},{x:.5,y:0,shape:0,light:"top"},{x:.5,y:.25,shape:1,light:"top"},{x:.5,y:.25,shape:0,light:"right"},{x:.5,y:.5,shape:1,light:"right"},{x:.5,y:.5,shape:0,light:"right"},{x:.5,y:.75,shape:1,light:"right"},{x:.75,y:-.125,shape:0,hidden:!0},{x:.75,y:.125,shape:1,light:"top"},{x:.75,y:.125,shape:0,light:"right"},{x:.75,y:.375,shape:1,light:"right"},{x:.75,y:.375,shape:0,light:"right"},{x:.75,y:.625,shape:1,light:"right"},{x:.75,y:.625,shape:0,hidden:!0}];var _d={};_d.__esModule=!0;_d.Shapes=void 0;_d.Shapes=[{x1:0,y1:.25,x2:.25,y2:.125,x3:.25,y3:.375},{x1:0,y1:0,x2:.25,y2:.125,x3:0,y3:.25}];(function(e){e.__esModule=!0;var t=bd,n=wd,r=_d;function o(i,s){return i.min+s%(i.max-i.min)}function a(i,s){var l=o(s.hue,i[0]),c=o(s.saturation,i[1]),u=o(s.lightness,i[2]),d=o(s.shift,i[3]),p=o(s.figureAlpha,i[4]),g=i[5]%t.StandardFigures.length,v=s.createCanvas,h=s.size||100,_=v(h,h),b=_.getContext("2d");return n.Sprites.forEach(function(y,x){var E=s.light.enabled?s.light[y.light]:1,w=Math.round(i[6]/(x+1)),T=s.variation.enabled?o(s.variation,w):0;if(b.beginPath(),!y.hidden){var k=r.Shapes[y.shape];b.moveTo(h*(k.x1+y.x),h*(k.y1+y.y)),b.lineTo(h*(k.x2+y.x),h*(k.y2+y.y)),b.lineTo(h*(k.x3+y.x),h*(k.y3+y.y))}b.fillStyle="hsla("+(l+T)+", "+c+"%, "+(u+E)+"%, 1)",b.fill();var C=t.StandardFigures[g];if(C[x]>0){var P=C[x]*p/10;b.fillStyle="hsla("+(l+d+T)+", "+c+"%, "+(u+E)+"%, "+P+")",b.fill()}}),_}e.default=a})(rS);var xd={},oa={};oa.__esModule=!0;oa.createCanvas=oa.deepMerge=void 0;var oS=function(){for(var e=[],t=0;t>5,this.byteCount=this.blockCount<<2,this.outputBlocks=H>>5,this.extraBytes=(H&31)>>3;for(var I=0;I<50;++I)this.s[I]=0}U.prototype.update=function(S){if(this.finalized)throw new Error(n);var X,H=typeof S;if(H!=="string"){if(H==="object"){if(S===null)throw new Error(t);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(t)}else throw new Error(t);X=!0}for(var I=this.blocks,F=this.byteCount,j=S.length,$=this.blockCount,V=0,J=this.s,ee,ce;V>2]|=S[V]<>2]|=ce<>2]|=(192|ce>>6)<>2]|=(128|ce&63)<=57344?(I[ee>>2]|=(224|ce>>12)<>2]|=(128|ce>>6&63)<>2]|=(128|ce&63)<>2]|=(240|ce>>18)<>2]|=(128|ce>>12&63)<>2]|=(128|ce>>6&63)<>2]|=(128|ce&63)<=F){for(this.start=ee-F,this.block=I[$],ee=0;ee<$;++ee)J[ee]^=I[ee];se(J),this.reset=!0}else this.start=ee}return this},U.prototype.encode=function(S,X){var H=S&255,I=1,F=[H];for(S=S>>8,H=S&255;H>0;)F.unshift(H),S=S>>8,H=S&255,++I;return X?F.push(I):F.unshift(I),this.update(F),F.length},U.prototype.encodeString=function(S){var X,H=typeof S;if(H!=="string"){if(H==="object"){if(S===null)throw new Error(t);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(t)}else throw new Error(t);X=!0}var I=0,F=S.length;if(X)I=F;else for(var j=0;j=57344?I+=3:($=65536+(($&1023)<<10|S.charCodeAt(++j)&1023),I+=4)}return I+=this.encode(I*8),this.update(S),I},U.prototype.bytepad=function(S,X){for(var H=this.encode(X),I=0;I>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(S[0]=S[H],X=1;X>4&15]+c[V&15]+c[V>>12&15]+c[V>>8&15]+c[V>>20&15]+c[V>>16&15]+c[V>>28&15]+c[V>>24&15];j%S===0&&(se(X),F=0)}return I&&(V=X[F],$+=c[V>>4&15]+c[V&15],I>1&&($+=c[V>>12&15]+c[V>>8&15]),I>2&&($+=c[V>>20&15]+c[V>>16&15])),$},U.prototype.arrayBuffer=function(){this.finalize();var S=this.blockCount,X=this.s,H=this.outputBlocks,I=this.extraBytes,F=0,j=0,$=this.outputBits>>3,V;I?V=new ArrayBuffer(H+1<<2):V=new ArrayBuffer($);for(var J=new Uint32Array(V);j>8&255,$[V+2]=J>>16&255,$[V+3]=J>>24&255;j%S===0&&se(X)}return I&&(V=j<<2,J=X[F],$[V]=J&255,I>1&&($[V+1]=J>>8&255),I>2&&($[V+2]=J>>16&255)),$};function ae(S,X,H){U.call(this,S,X,H)}ae.prototype=new U,ae.prototype.finalize=function(){return this.encode(this.outputBits,!0),U.prototype.finalize.call(this)};var se=function(S){var X,H,I,F,j,$,V,J,ee,ce,Pe,Oe,A,q,Q,ue,le,oe,me,ke,je,Ge,At,nr,lt,Tn,rr,or,ar,sn,Eo,No,ma,ln,Po,ha,ga,Or,Un,Dr,Lr,jr,Vn,va,ya,ba,wa,_a,Mo,Fr,cn,xa,ka,Ca,Sa,Ta,Ft,Ea,Na,Pa,Ma,Aa,un;for(I=0;I<48;I+=2)F=S[0]^S[10]^S[20]^S[30]^S[40],j=S[1]^S[11]^S[21]^S[31]^S[41],$=S[2]^S[12]^S[22]^S[32]^S[42],V=S[3]^S[13]^S[23]^S[33]^S[43],J=S[4]^S[14]^S[24]^S[34]^S[44],ee=S[5]^S[15]^S[25]^S[35]^S[45],ce=S[6]^S[16]^S[26]^S[36]^S[46],Pe=S[7]^S[17]^S[27]^S[37]^S[47],Oe=S[8]^S[18]^S[28]^S[38]^S[48],A=S[9]^S[19]^S[29]^S[39]^S[49],X=Oe^($<<1|V>>>31),H=A^(V<<1|$>>>31),S[0]^=X,S[1]^=H,S[10]^=X,S[11]^=H,S[20]^=X,S[21]^=H,S[30]^=X,S[31]^=H,S[40]^=X,S[41]^=H,X=F^(J<<1|ee>>>31),H=j^(ee<<1|J>>>31),S[2]^=X,S[3]^=H,S[12]^=X,S[13]^=H,S[22]^=X,S[23]^=H,S[32]^=X,S[33]^=H,S[42]^=X,S[43]^=H,X=$^(ce<<1|Pe>>>31),H=V^(Pe<<1|ce>>>31),S[4]^=X,S[5]^=H,S[14]^=X,S[15]^=H,S[24]^=X,S[25]^=H,S[34]^=X,S[35]^=H,S[44]^=X,S[45]^=H,X=J^(Oe<<1|A>>>31),H=ee^(A<<1|Oe>>>31),S[6]^=X,S[7]^=H,S[16]^=X,S[17]^=H,S[26]^=X,S[27]^=H,S[36]^=X,S[37]^=H,S[46]^=X,S[47]^=H,X=ce^(F<<1|j>>>31),H=Pe^(j<<1|F>>>31),S[8]^=X,S[9]^=H,S[18]^=X,S[19]^=H,S[28]^=X,S[29]^=H,S[38]^=X,S[39]^=H,S[48]^=X,S[49]^=H,q=S[0],Q=S[1],ba=S[11]<<4|S[10]>>>28,wa=S[10]<<4|S[11]>>>28,or=S[20]<<3|S[21]>>>29,ar=S[21]<<3|S[20]>>>29,Pa=S[31]<<9|S[30]>>>23,Ma=S[30]<<9|S[31]>>>23,jr=S[40]<<18|S[41]>>>14,Vn=S[41]<<18|S[40]>>>14,ln=S[2]<<1|S[3]>>>31,Po=S[3]<<1|S[2]>>>31,ue=S[13]<<12|S[12]>>>20,le=S[12]<<12|S[13]>>>20,_a=S[22]<<10|S[23]>>>22,Mo=S[23]<<10|S[22]>>>22,sn=S[33]<<13|S[32]>>>19,Eo=S[32]<<13|S[33]>>>19,Aa=S[42]<<2|S[43]>>>30,un=S[43]<<2|S[42]>>>30,Ca=S[5]<<30|S[4]>>>2,Sa=S[4]<<30|S[5]>>>2,ha=S[14]<<6|S[15]>>>26,ga=S[15]<<6|S[14]>>>26,oe=S[25]<<11|S[24]>>>21,me=S[24]<<11|S[25]>>>21,Fr=S[34]<<15|S[35]>>>17,cn=S[35]<<15|S[34]>>>17,No=S[45]<<29|S[44]>>>3,ma=S[44]<<29|S[45]>>>3,nr=S[6]<<28|S[7]>>>4,lt=S[7]<<28|S[6]>>>4,Ta=S[17]<<23|S[16]>>>9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jr^~ln&ha,S[29]=Vn^~Po&ga,S[38]=xa^~va&ba,S[39]=ka^~ya&wa,S[48]=Aa^~Ca&Ta,S[49]=un^~Sa&Ft,S[0]^=h[I],S[1]^=h[I+1]};if(s)e.exports=D;else for(G=0;G>>16&65535,u=s&65535,d=l>>>16&65535,p=l&65535;return u*p+(c*p+u*d<<16>>>0)|0}e.mul=Math.imul||t;function n(s,l){return s+l|0}e.add=n;function r(s,l){return s-l|0}e.sub=r;function o(s,l){return s<>>32-l}e.rotl=o;function a(s,l){return s<<32-l|s>>>l}e.rotr=a;function i(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s}e.isInteger=Number.isInteger||i,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(s){return e.isInteger(s)&&s>=-e.MAX_SAFE_INTEGER&&s<=e.MAX_SAFE_INTEGER}})(sS);Object.defineProperty(Ne,"__esModule",{value:!0});var lS=sS;function fO(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}Ne.readInt16BE=fO;function pO(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])>>>0}Ne.readUint16BE=pO;function mO(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])<<16>>16}Ne.readInt16LE=mO;function hO(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])>>>0}Ne.readUint16LE=hO;function cS(e,t,n){return t===void 0&&(t=new Uint8Array(2)),n===void 0&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}Ne.writeUint16BE=cS;Ne.writeInt16BE=cS;function uS(e,t,n){return t===void 0&&(t=new Uint8Array(2)),n===void 0&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}Ne.writeUint16LE=uS;Ne.writeInt16LE=uS;function dp(e,t){return t===void 0&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}Ne.readInt32BE=dp;function fp(e,t){return t===void 0&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}Ne.readUint32BE=fp;function pp(e,t){return t===void 0&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}Ne.readInt32LE=pp;function mp(e,t){return t===void 0&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}Ne.readUint32LE=mp;function xu(e,t,n){return t===void 0&&(t=new Uint8Array(4)),n===void 0&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}Ne.writeUint32BE=xu;Ne.writeInt32BE=xu;function ku(e,t,n){return t===void 0&&(t=new Uint8Array(4)),n===void 0&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}Ne.writeUint32LE=ku;Ne.writeInt32LE=ku;function gO(e,t){t===void 0&&(t=0);var n=dp(e,t),r=dp(e,t+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64BE=gO;function vO(e,t){t===void 0&&(t=0);var n=fp(e,t),r=fp(e,t+4);return n*4294967296+r}Ne.readUint64BE=vO;function yO(e,t){t===void 0&&(t=0);var n=pp(e,t),r=pp(e,t+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64LE=yO;function bO(e,t){t===void 0&&(t=0);var n=mp(e,t),r=mp(e,t+4);return r*4294967296+n}Ne.readUint64LE=bO;function dS(e,t,n){return t===void 0&&(t=new Uint8Array(8)),n===void 0&&(n=0),xu(e/4294967296>>>0,t,n),xu(e>>>0,t,n+4),t}Ne.writeUint64BE=dS;Ne.writeInt64BE=dS;function fS(e,t,n){return t===void 0&&(t=new Uint8Array(8)),n===void 0&&(n=0),ku(e>>>0,t,n),ku(e/4294967296>>>0,t,n+4),t}Ne.writeUint64LE=fS;Ne.writeInt64LE=fS;function wO(e,t,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,o=1,a=e/8+n-1;a>=n;a--)r+=t[a]*o,o*=256;return r}Ne.readUintBE=wO;function _O(e,t,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,o=1,a=n;a=r;a--)n[a]=t/o&255,o*=256;return n}Ne.writeUintBE=xO;function kO(e,t,n,r){if(n===void 0&&(n=new Uint8Array(e/8)),r===void 0&&(r=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!lS.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,a=r;ae.DIGEST_LENGTH)throw new Error("blake2s: wrong digest length");l&&this.validateConfig(l);var c=0;l&&l.key&&(c=l.key.length);var u=1,d=1;if(l&&l.tree&&(u=l.tree.fanout,d=l.tree.maxDepth),this._state[0]^=s|c<<8|u<<16|d<<24,l&&l.tree){this._state[1]^=l.tree.leafSize;var p=l.tree.nodeOffset/4294967296>>>0,g=l.tree.nodeOffset>>>0;this._state[2]^=g,this._state[3]^=p|l.tree.nodeDepth<<16|l.tree.innerDigestLength<<24,this._lastNode=l.tree.lastNode}l&&l.salt&&(this._state[4]^=t.readUint32LE(l.salt,0),this._state[5]^=t.readUint32LE(l.salt,4)),l&&l.personalization&&(this._state[6]^=t.readUint32LE(l.personalization,0),this._state[7]^=t.readUint32LE(l.personalization,4)),this._initialState=new Uint32Array(this._state),l&&l.key&&c>0&&(this._paddedKey=new Uint8Array(e.BLOCK_SIZE),this._paddedKey.set(l.key),this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE)}return i.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE):this._bufferLength=0,this._ctr0=0,this._ctr1=0,this._flag0=0,this._flag1=0,this._finished=!1,this},i.prototype.validateConfig=function(s){if(s.key&&s.key.length>e.KEY_LENGTH)throw new Error("blake2s: wrong key length");if(s.salt&&s.salt.length!==e.SALT_LENGTH)throw new Error("blake2s: wrong salt length");if(s.personalization&&s.personalization.length!==e.PERSONALIZATION_LENGTH)throw new Error("blake2s: wrong personalization length");if(s.tree){if(s.tree.fanout<0||s.tree.fanout>e.MAX_FANOUT)throw new Error("blake2s: wrong tree fanout");if(s.tree.maxDepth<0||s.tree.maxDepth>e.MAX_MAX_DEPTH)throw new Error("blake2s: wrong tree depth");if(s.tree.leafSize<0||s.tree.leafSize>e.MAX_LEAF_SIZE)throw new Error("blake2s: wrong leaf size");if(s.tree.innerDigestLength<0||s.tree.innerDigestLength>e.DIGEST_LENGTH)throw new Error("blake2s: wrong tree inner digest length");if(s.tree.nodeOffset<0||s.tree.nodeOffset>e.MAX_NODE_OFFSET)throw new Error("blake2s: tree node offset is too large")}},i.prototype.update=function(s,l){if(l===void 0&&(l=s.length),this._finished)throw new Error("blake2s: can't update because hash was finished.");var c=e.BLOCK_SIZE-this._bufferLength,u=0;if(l===0)return this;if(l>c){for(var d=0;de.BLOCK_SIZE;){for(var d=0;d>>0,l!==this._ctr0&&this._ctr1++;var c=this._state[0],u=this._state[1],d=this._state[2],p=this._state[3],g=this._state[4],v=this._state[5],h=this._state[6],_=this._state[7],b=r[0],y=r[1],x=r[2],E=r[3],w=r[4]^this._ctr0,T=r[5]^this._ctr1,k=r[6]^this._flag0,C=r[7]^this._flag1,P=this._buffer,O=P[3]<<24|P[2]<<16|P[1]<<8|P[0],R=P[7]<<24|P[6]<<16|P[5]<<8|P[4],N=P[11]<<24|P[10]<<16|P[9]<<8|P[8],B=P[15]<<24|P[14]<<16|P[13]<<8|P[12],D=P[19]<<24|P[18]<<16|P[17]<<8|P[16],L=P[23]<<24|P[22]<<16|P[21]<<8|P[20],G=P[27]<<24|P[26]<<16|P[25]<<8|P[24],Y=P[31]<<24|P[30]<<16|P[29]<<8|P[28],K=P[35]<<24|P[34]<<16|P[33]<<8|P[32],Z=P[39]<<24|P[38]<<16|P[37]<<8|P[36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>>7,u=u+D|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+N|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+S|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+Z|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+B|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+ae|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+U|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+O|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+se|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+fe|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,this._state[0]^=c^b,this._state[1]^=u^y,this._state[2]^=d^x,this._state[3]^=p^E,this._state[4]^=g^w,this._state[5]^=v^T,this._state[6]^=h^k,this._state[7]^=_^C},i}();e.BLAKE2s=o;function a(i,s,l){s===void 0&&(s=e.DIGEST_LENGTH);var c=new o(s,l);c.update(i);var u=c.digest();return c.clean(),u}e.hash=a})(iS);var ai=_t&&_t.__assign||function(){return ai=Object.assign||function(e){for(var t,n=1,r=arguments.length;nn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),i=a?.nonce||a?.getAttribute("nonce");o=Promise.all(n.map(s=>{if(s=QO(s),s in e1)return;e1[s]=!0;const l=s.endsWith(".css"),c=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${c}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":YO,l||(u.as="script",u.crossOrigin=""),u.href=s,i&&u.setAttribute("nonce",i),document.head.appendChild(u),l)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${s}`)))})}))}return o.then(()=>t()).catch(a=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=a,window.dispatchEvent(i),!i.defaultPrevented)throw a})},og=m.createContext(null),ZO=e=>{const[t,n]=m.useState({}),r=m.useCallback((a,i="default")=>{n(s=>{if(i==="current")throw new Error("'current' cannot be used as map id");if(s[i])throw new Error(`Multiple maps with the same id: ${i}`);return{...s,[i]:a}})},[]),o=m.useCallback((a="default")=>{n(i=>{if(i[a]){const s={...i};return delete s[a],s}return i})},[]);return m.createElement(og.Provider,{value:{maps:t,onMapMount:r,onMapUnmount:o}},e.children)};function JO(){var e;const t=(e=m.useContext(og))===null||e===void 0?void 0:e.maps,n=m.useContext(yl);return m.useMemo(()=>({...t,current:n?.map}),[t,n])}function eD(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&r===a}function vr(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in r&&(o=Object.assign({},r),delete o.interactive);const a=t[r.ref];if(a){o=o||Object.assign({},r),delete o.ref;for(const i of nD)i in a&&(o[i]=a[i])}return o||r});return{...e,layers:n}}var a1={};const i1={version:8,sources:{},layers:[]},s1={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Mf={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},l1={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},rD=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],oD=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Pi{constructor(t,n,r){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=o=>{const a=this.props[l1[o.type]];a?a(o):o.type==="error"&&console.error(o.error)},this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const a=this.props[s1[o.type]];a&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),a(o),delete o.features)},this._onCameraEvent=o=>{if(!this._internalUpdate){const a=this.props[Mf[o.type]];a&&a(o)}o.type in this._deferredEvents&&(this._deferredEvents[o.type]=!1)},this._MapClass=t,this.props=n,this._initialize(r)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const n=this.props;this.props=t;const r=this._updateSettings(t,n);r&&this._createShadowTransform(this._map);const o=this._updateSize(t),a=this._updateViewState(t,!0);this._updateStyle(t,n),this._updateStyleComponents(t,n),this._updateHandlers(t,n),(r||o||a&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const r=Pi.savedMaps.pop();if(!r)return null;const o=r.map,a=o.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);o._container=n;const i=o._resizeObserver;i&&(i.disconnect(),i.observe(n)),r.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:s}=t;return s&&(s.bounds?o.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):r._updateViewState(s,!1)),o.isStyleLoaded()?o.fire("load"):o.once("styledata",()=>o.fire("load")),o._update(),r}_initialize(t){const{props:n}=this,{mapStyle:r=i1}=n,o={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||aD()||null,container:t,style:o1(r)},a=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[a.longitude||0,a.latitude||0],zoom:a.zoom||0,pitch:a.pitch||0,bearing:a.bearing||0}),n.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,n.gl)}const i=new this._MapClass(o);a.padding&&i.setPadding(a.padding),n.cursor&&(i.getCanvas().style.cursor=n.cursor),this._createShadowTransform(i);const s=i._render;i._render=u=>{this._inRender=!0,s.call(i,u),this._inRender=!1};const l=i._renderTaskQueue.run;i._renderTaskQueue.run=u=>{l.call(i._renderTaskQueue,u),this._onBeforeRepaint()},i.on("render",()=>this._onAfterRepaint());const c=i.fire;i.fire=this._fireEvent.bind(this,c),i.on("resize",()=>{this._renderTransform.resize(i.transform.width,i.transform.height)}),i.on("styledata",()=>{this._updateStyleComponents(this.props,{}),t1(i.transform,this._renderTransform)}),i.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const u in s1)i.on(u,this._onPointerEvent);for(const u in Mf)i.on(u,this._onCameraEvent);for(const u in l1)i.on(u,this._onEvent);this._map=i}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n?.remove(),Pi.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const n=tD(t.transform);t.painter.transform=n,this._renderTransform=n}_updateSize(t){const{viewState:n}=t;if(n){const r=this._map;if(n.width!==r.transform.width||n.height!==r.transform.height)return r.resize(),!0}return!1}_updateViewState(t,n){if(this._internalUpdate)return!1;const r=this._map,o=this._renderTransform,{zoom:a,pitch:i,bearing:s}=o,l=r.isMoving();l&&(o.cameraElevationReference="sea");const c=r1(o,{...n1(r.transform),...t});if(l&&(o.cameraElevationReference="ground"),c&&n){const u=this._deferredEvents;u.move=!0,u.zoom||(u.zoom=a!==o.zoom),u.rotate||(u.rotate=s!==o.bearing),u.pitch||(u.pitch=i!==o.pitch)}return l||r1(r.transform,t),c}_updateSettings(t,n){const r=this._map;let o=!1;for(const a of rD)if(a in t&&!vr(t[a],n[a])){o=!0;const i=r[`set${a[0].toUpperCase()}${a.slice(1)}`];i?.call(r,t[a])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:r=i1,styleDiffing:o=!0}=t,a={diff:o};return"localIdeographFontFamily"in t&&(a.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(o1(r),a),!0}return!1}_updateStyleComponents(t,n){const r=this._map;let o=!1;return r.isStyleLoaded()&&("light"in t&&r.setLight&&!vr(t.light,n.light)&&(o=!0,r.setLight(t.light)),"fog"in t&&r.setFog&&!vr(t.fog,n.fog)&&(o=!0,r.setFog(t.fog)),"terrain"in t&&r.setTerrain&&!vr(t.terrain,n.terrain)&&(!t.terrain||r.getSource(t.terrain.source))&&(o=!0,r.setTerrain(t.terrain))),o}_updateHandlers(t,n){var r,o;const a=this._map;let i=!1;for(const s of oD){const l=(r=t[s])!==null&&r!==void 0?r:!0,c=(o=n[s])!==null&&o!==void 0?o:!0;vr(l,c)||(i=!0,l?a[s].enable(l):a[s].disable())}return i}_queryRenderedFeatures(t){const n=this._map,r=n.transform,{interactiveLayerIds:o=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(t,{layers:o.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=r}}_updateHover(t){var n;const{props:r}=this;if(r.interactiveLayerIds&&(r.onMouseMove||r.onMouseEnter||r.onMouseLeave)){const a=t.type,i=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=a}else this._hoveredFeatures=null}_fireEvent(t,n,r){const o=this._map,a=o.transform,i=typeof n=="string"?n:n.type;return i==="move"&&this._updateViewState(this.props,!1),i in Mf&&(typeof n=="object"&&(n.viewState=n1(a)),this._map.isMoving())?(o.transform=this._renderTransform,t.call(o,n,r),o.transform=a,o):(t.call(o,n,r),o)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const r in this._deferredEvents)this._deferredEvents[r]&&t.fire(r);this._internalUpdate=!1;const n=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{t1(this._renderTransform,n),t.transform=n}}}Pi.savedMaps=[];function aD(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||a1.MapboxAccessToken}catch{}try{e=e||a1.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const iD=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function sD(e){if(!e)return null;const t=e.map,n={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:r=>{const o=t.transform;t.transform=e.transform;const a=t.project(r);return t.transform=o,a},unproject:r=>{const o=t.transform;t.transform=e.transform;const a=t.unproject(r);return t.transform=o,a},queryTerrainElevation:(r,o)=>{const a=t.transform;t.transform=e.transform;const i=t.queryTerrainElevation(r,o);return t.transform=a,i},queryRenderedFeatures:(r,o)=>{const a=t.transform;t.transform=e.transform;const i=t.queryRenderedFeatures(r,o);return t.transform=a,i}};for(const r of lD(t))!(r in n)&&!iD.includes(r)&&(n[r]=t[r].bind(t));return n}function lD(e){const t=new Set;let n=e;for(;n;){for(const r of Object.getOwnPropertyNames(n))r[0]!=="_"&&typeof e[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}const cD=typeof document<"u"?m.useLayoutEffect:m.useEffect,uD=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function dD(e,t){for(const r of uD)r in t&&(e[r]=t[r]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(n,r=>{r&&console.error(r)},!0)}const yl=m.createContext(null);function gS(e,t,n){const r=m.useContext(og),[o,a]=m.useState(null),i=m.useRef(),{current:s}=m.useRef({mapLib:null,map:null});m.useEffect(()=>{const u=e.mapLib;let d=!0,p;return Promise.resolve(u||n).then(g=>{if(!d)return;if(!g)throw new Error("Invalid mapLib");const v="Map"in g?g:g.default;if(!v.Map)throw new Error("Invalid mapLib");if(dD(v,e),!v.supported||v.supported(e))e.reuseMaps&&(p=Pi.reuse(e,i.current)),p||(p=new Pi(v.Map,e,i.current)),s.map=sD(p),s.mapLib=v,a(p),r?.onMapMount(s.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(g=>{const{onError:v}=e;v?v({type:"error",target:null,originalEvent:null,error:g}):console.error(g)}),()=>{d=!1,p&&(r?.onMapUnmount(e.id),e.reuseMaps?p.recycle():p.destroy())}},[]),cD(()=>{o&&o.setProps(e)}),m.useImperativeHandle(t,()=>s.map,[o]);const l=m.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return m.createElement("div",{id:e.id,ref:i,style:l},o&&m.createElement(yl.Provider,{value:s},m.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const fD=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function fa(e,t){if(!e||!t)return;const n=e.style;for(const r in t){const o=t[r];Number.isFinite(o)&&!fD.test(r)?n[r]=`${o}px`:n[r]=o}}function pD(e,t){const{map:n,mapLib:r}=m.useContext(yl),o=m.useRef({props:e});o.current.props=e;const a=m.useMemo(()=>{let h=!1;m.Children.forEach(e.children,y=>{y&&(h=!0)});const _={...e,element:h?document.createElement("div"):null},b=new r.Marker(_);return b.setLngLat([e.longitude,e.latitude]),b.getElement().addEventListener("click",y=>{var x,E;(E=(x=o.current.props).onClick)===null||E===void 0||E.call(x,{type:"click",target:b,originalEvent:y})}),b.on("dragstart",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDragStart)===null||E===void 0||E.call(x,w)}),b.on("drag",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDrag)===null||E===void 0||E.call(x,w)}),b.on("dragend",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDragEnd)===null||E===void 0||E.call(x,w)}),b},[]);m.useEffect(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);const{longitude:i,latitude:s,offset:l,style:c,draggable:u=!1,popup:d=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:v="auto"}=e;return m.useEffect(()=>{fa(a.getElement(),c)},[c]),m.useImperativeHandle(t,()=>a,[]),(a.getLngLat().lng!==i||a.getLngLat().lat!==s)&&a.setLngLat([i,s]),l&&!eD(a.getOffset(),l)&&a.setOffset(l),a.isDraggable()!==u&&a.setDraggable(u),a.getRotation()!==p&&a.setRotation(p),a.getRotationAlignment()!==g&&a.setRotationAlignment(g),a.getPitchAlignment()!==v&&a.setPitchAlignment(v),a.getPopup()!==d&&a.setPopup(d),an.createPortal(e.children,a.getElement())}const mD=m.memo(m.forwardRef(pD));function c1(e){return new Set(e?e.trim().split(/\s+/):[])}function hD(e,t){const{map:n,mapLib:r}=m.useContext(yl),o=m.useMemo(()=>document.createElement("div"),[]),a=m.useRef({props:e});a.current.props=e;const i=m.useMemo(()=>{const s={...e},l=new r.Popup(s);return l.setLngLat([e.longitude,e.latitude]),l.once("open",c=>{var u,d;(d=(u=a.current.props).onOpen)===null||d===void 0||d.call(u,c)}),l},[]);if(m.useEffect(()=>{const s=l=>{var c,u;(u=(c=a.current.props).onClose)===null||u===void 0||u.call(c,l)};return i.on("close",s),i.setDOMContent(o).addTo(n.getMap()),()=>{i.off("close",s),i.isOpen()&&i.remove()}},[]),m.useEffect(()=>{fa(i.getElement(),e.style)},[e.style]),m.useImperativeHandle(t,()=>i,[]),i.isOpen()&&((i.getLngLat().lng!==e.longitude||i.getLngLat().lat!==e.latitude)&&i.setLngLat([e.longitude,e.latitude]),e.offset&&!vr(i.options.offset,e.offset)&&i.setOffset(e.offset),(i.options.anchor!==e.anchor||i.options.maxWidth!==e.maxWidth)&&(i.options.anchor=e.anchor,i.setMaxWidth(e.maxWidth)),i.options.className!==e.className)){const s=c1(i.options.className),l=c1(e.className);for(const c of s)l.has(c)||i.removeClassName(c);for(const c of l)s.has(c)||i.addClassName(c);i.options.className=e.className}return an.createPortal(e.children,o)}m.memo(m.forwardRef(hD));function bl(e,t,n,r){const o=m.useContext(yl),a=m.useMemo(()=>e(o),[]);return m.useEffect(()=>{const i=t,s=typeof t=="function"&&typeof n=="function"?t:null,l=typeof t=="function"?t:null,{map:c}=o;return c.hasControl(a)||(c.addControl(a,i?.position),s&&s(o)),()=>{l&&l(o),c.hasControl(a)&&c.removeControl(a)}},[]),a}function gD(e){const t=bl(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return m.useEffect(()=>{fa(t._container,e.style)},[e.style]),null}m.memo(gD);function vD(e){const t=bl(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return m.useEffect(()=>{fa(t._controlContainer,e.style)},[e.style]),null}m.memo(vD);function yD(e,t){const n=m.useRef({props:e}),r=bl(({mapLib:o})=>{const a=new o.GeolocateControl(e),i=a._setupUI;return a._setupUI=s=>{a._container.hasChildNodes()||i(s)},a.on("geolocate",s=>{var l,c;(c=(l=n.current.props).onGeolocate)===null||c===void 0||c.call(l,s)}),a.on("error",s=>{var l,c;(c=(l=n.current.props).onError)===null||c===void 0||c.call(l,s)}),a.on("outofmaxbounds",s=>{var l,c;(c=(l=n.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(l,s)}),a.on("trackuserlocationstart",s=>{var l,c;(c=(l=n.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(l,s)}),a.on("trackuserlocationend",s=>{var l,c;(c=(l=n.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(l,s)}),a},{position:e.position});return n.current.props=e,m.useImperativeHandle(t,()=>r,[]),m.useEffect(()=>{fa(r._container,e.style)},[e.style]),null}m.memo(m.forwardRef(yD));function bD(e){const t=bl(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return m.useEffect(()=>{fa(t._container,e.style)},[e.style]),null}m.memo(bD);function wD(e){const t=bl(({mapLib:a})=>new a.ScaleControl(e),{position:e.position}),n=m.useRef(e),r=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),m.useEffect(()=>{fa(t._container,o)},[o]),null}m.memo(wD);function _D(){return JO()}const xD=hS(()=>import("./mapbox-gl-DY02hNYD.js").then(e=>e.m),[]);m.forwardRef(function(t,n){return gS(t,n,xD)});const u1=mD,kD=hS(()=>import("./maplibre-gl-H6mDd47p.js").then(e=>e.m),[]),CD=m.forwardRef(function(t,n){return gS(t,n,kD)}),SD=()=>{const{nodes:e,waypoints:t}=Te(),{rasterSources:n,darkMode:r}=$n(),{default:o}=_D(),[a,i]=m.useState(0),s=Array.from(e.values()),l=m.useCallback(()=>{if(!o)return;const c=s.filter(g=>g.position?.latitudeI);if(!c.length)return;if(c.length===1){o.easeTo({zoom:12,center:[(c[0].position?.longitudeI??0)/1e7,(c[0].position?.latitudeI??0)/1e7]});return}const u=XO(c.map(g=>[(g.position?.latitudeI??0)/1e7,(g.position?.longitudeI??0)/1e7])),d=hp(u),p=o.cameraForBounds([[d[1],d[0]],[d[3],d[2]]],{padding:{top:10,bottom:10,left:10,right:10}});p&&o.easeTo(p)},[s,o]);return m.useEffect(()=>{o?.on("zoom",()=>{i(o?.getZoom()??0)})},[o]),m.useEffect(()=>{o?.on("load",()=>{l()})},[o,l]),f.jsxs(f.Fragment,{children:[f.jsx(vl,{children:f.jsx(qs,{label:"Sources",children:n.map(c=>f.jsx(Ni,{label:c.title},c.title))})}),f.jsx(gd,{label:"Map",noPadding:!0,actions:[{icon:v6,onClick(){o?.zoomIn()}},{icon:y6,onClick(){o?.zoomOut()}},{icon:aC,onClick(){l()}}],children:f.jsxs(CD,{mapStyle:"https://raw.githubusercontent.com/hc-oss/maplibre-gl-styles/master/styles/osm-mapnik/v8/default.json",attributionControl:!1,renderWorldCopies:!1,maxPitch:0,style:{filter:r?"brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7)":""},dragRotate:!1,touchZoomRotate:!1,initialViewState:{zoom:1.6,latitude:35,longitude:0},children:[t.map(c=>f.jsx(u1,{longitude:(c.longitudeI??0)/1e7,latitude:(c.latitudeI??0)/1e7,anchor:"bottom",children:f.jsx("div",{children:f.jsx(a6,{size:16})})},c.id)),s.map(c=>{if(c.position?.latitudeI)return f.jsx(u1,{longitude:(c.position.longitudeI??0)/1e7,latitude:(c.position.latitudeI??0)/1e7,style:{filter:r?"invert(1)":""},anchor:"bottom",onClick:()=>{o?.easeTo({zoom:12,center:[(c.position?.longitudeI??0)/1e7,(c.position?.latitudeI??0)/1e7]})},children:f.jsxs("div",{className:"flex cursor-pointer gap-2 rounded-md border bg-backgroundPrimary p-1.5",children:[f.jsx(da.Hashicon,{value:c.num.toString(),size:22}),f.jsx(wn,{className:Ee(a<12&&"hidden"),children:c.user?.longName||`!${Xs(c.num)}`})]})},c.num)})]})})]})},TD=({lastMsgSameUser:e,message:t,sender:n})=>e?f.jsxs("div",{className:"ml-5 flex",children:[t.state==="ack"?f.jsx(Vy,{size:16,className:"my-auto text-textSecondary"}):t.state==="waiting"?f.jsx(zy,{size:16,className:"my-auto text-textSecondary"}):f.jsx(Uy,{size:16,className:"my-auto text-textSecondary"}),f.jsx("span",{className:`ml-4 border-l-2 border-l-backgroundPrimary pl-2 ${t.state==="ack"?"text-textPrimary":"text-textSecondary"}`,children:t.data})]}):f.jsxs("div",{className:"mx-4 mt-2 gap-2",children:[f.jsxs("div",{className:"flex gap-2",children:[f.jsx("div",{className:"w-6 cursor-pointer",children:f.jsx(da.Hashicon,{value:(n?.num??0).toString(),size:32})}),f.jsx("span",{className:"cursor-pointer font-medium text-textPrimary",children:n?.user?.longName??"UNK"}),f.jsx("span",{className:"mt-1 font-mono text-xs text-textSecondary",children:t.rxTime.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),f.jsxs("div",{className:"ml-1 flex",children:[t.state==="ack"?f.jsx(Vy,{size:16,className:"my-auto text-textSecondary"}):t.state==="waiting"?f.jsx(zy,{size:16,className:"my-auto text-textSecondary"}):f.jsx(Uy,{size:16,className:"my-auto text-textSecondary"}),f.jsx("span",{className:`ml-4 border-l-2 border-l-backgroundPrimary pl-2 ${t.state==="ack"?"text-textPrimary":"text-textSecondary"}`,children:t.data})]})]}),ED=({to:e,channel:t})=>{const{connection:n,setMessageState:r,messageDraft:o,setMessageDraft:a,hardware:i}=Te(),s=i.myNodeNum,l=async c=>{await n?.sendText(c,e,!0,t).then(u=>r(e==="broadcast"?"broadcast":"direct",t,e,s,u,"ack")).catch(u=>r(e==="broadcast"?"broadcast":"direct",t,e,s,u.id,u.error))};return f.jsx("div",{className:"flex gap-2",children:f.jsx("form",{className:"w-full",onSubmit:c=>{c.preventDefault(),l(o),a("")},children:f.jsxs("div",{className:"flex flex-grow gap-2",children:[f.jsx("span",{className:"w-full",children:f.jsx(jn,{autoFocus:!0,minLength:1,placeholder:"Enter Message",value:o,onChange:c=>a(c.target.value)})}),f.jsx(pt,{type:"submit",children:f.jsx(u6,{size:16})})]})})})},ND=({from:e,to:t,route:n})=>{const{nodes:r}=Te();return n.length===0?f.jsx("div",{className:"ml-5 flex",children:f.jsxs("span",{className:"ml-4 border-l-2 border-l-backgroundPrimary pl-2 text-textPrimary",children:[t?.user?.longName,"↔",e?.user?.longName]})}):f.jsx("div",{className:"ml-5 flex",children:f.jsxs("span",{className:"ml-4 border-l-2 border-l-backgroundPrimary pl-2 text-textPrimary",children:[t?.user?.longName,"↔",n.map(o=>{const a=r.get(o);return`${a?.user?.longName??(a?.num?Xs(a.num):"Unknown")}↔`}),e?.user?.longName]})})},d1=({messages:e,channel:t,to:n,traceroutes:r})=>{const{nodes:o}=Te();return f.jsxs("div",{className:"flex flex-grow flex-col",children:[f.jsxs("div",{className:"flex flex-grow",children:[f.jsx("div",{className:"flex flex-grow flex-col",children:e?e.map((a,i)=>f.jsx(TD,{message:a,lastMsgSameUser:i===0?!1:e[i-1].from===a.from,sender:o.get(a.from)},a.id)):f.jsxs("div",{className:"m-auto",children:[f.jsx(Wy,{className:"m-auto"}),f.jsx(wn,{children:"No Messages"})]})}),f.jsx("div",{className:`flex flex-grow flex-col border-slate-400 border-l ${r===void 0?"hidden":""}`,children:n==="broadcast"?null:r?r.map((a,i)=>f.jsx(ND,{from:o.get(a.from),to:o.get(a.to),route:a.data.route},a.id)):f.jsxs("div",{className:"m-auto",children:[f.jsx(Wy,{className:"m-auto"}),f.jsx(wn,{children:"No Traceroutes"})]})})]}),f.jsx("div",{className:"pl-3 pr-3 pt-3 pb-1",children:f.jsx(ED,{to:n,channel:t})})]})},PD=()=>{const{channels:e,nodes:t,hardware:n,messages:r,traceroutes:o,connection:a}=Te(),[i,s]=m.useState("broadcast"),[l,c]=m.useState(Ws.ChannelNumber.Primary),u=Array.from(t.values()).filter(b=>b.num!==n.myNodeNum),d=Array.from(e.values()),p=d.filter(b=>b.role!==pe.Channel.Channel_Role.DISABLED),g=e.get(l),{toast:v}=hd(),h=t.get(l),_=h?.num?Xs(h.num):"Unknown";return f.jsxs(f.Fragment,{children:[f.jsxs(vl,{children:[f.jsx(qs,{label:"Channels",children:p.map(b=>f.jsx(Ni,{label:b.settings?.name.length?b.settings?.name:b.index===0?"Primary":`Ch ${b.index}`,active:l===b.index,onClick:()=>{s("broadcast"),c(b.index)},element:f.jsx(JR,{size:16,className:"mr-2"})},b.index))}),f.jsx(qs,{label:"Nodes",children:u.map(b=>f.jsx(Ni,{label:b.user?.longName??`!${Xs(b.num)}`,active:l===b.num,onClick:()=>{s("direct"),c(b.num)},element:f.jsx(da.Hashicon,{size:20,value:b.num.toString()})},b.num))})]}),f.jsx("div",{className:"flex flex-col flex-grow",children:f.jsxs(gd,{label:`Messages: ${i==="broadcast"&&g?cp(g):i==="direct"&&t.get(l)?t.get(l)?.user?.longName??_:"Loading..."}`,actions:i==="direct"?[{icon:t.get(l)?.user?.publicKey.length?dC:uC,iconClasses:t.get(l)?.user?.publicKey.length?"text-green-600":"text-yellow-300",async onClick(){t.get(l)?.num!==void 0&&v({title:t.get(l)?.user?.publicKey.length?"Chat is using PKI encryption.":"Chat is using PSK encryption."})}},{icon:h6,async onClick(){const b=t.get(l)?.num;b!==void 0&&(v({title:"Sending Traceroute, please wait..."}),await a?.traceRoute(b).then(()=>v({title:"Traceroute sent."})))}}]:[],children:[d.map(b=>l===b.index&&f.jsx(d1,{to:"broadcast",messages:r.broadcast.get(b.index),channel:b.index},b.index)),u.map(b=>l===b.num&&f.jsx(d1,{to:l,messages:r.direct.get(b.num),channel:Ws.ChannelNumber.Primary,traceroutes:o.get(b.num)},b.num))]})})]})},Do=({children:e,className:t,...n})=>f.jsx("span",{className:`font-mono text-sm text-textSecondary ${t??""}`,...n,children:e}),MD=({headings:e,rows:t})=>{const[n,r]=m.useState("Last Heard"),[o,a]=m.useState("desc"),i=l=>{n===l?a(o==="asc"?"desc":"asc"):(r(l),a("asc"))},s=t.slice().sort((l,c)=>{if(!n)return 0;const u=e.findIndex(g=>g.title===n),d=l[u].props.children,p=c[u].props.children;if(n==="Last Heard"){const g=d.props.timestamp??0,v=p.props.timestamp??0;return gv?o==="asc"?1:-1:0}return dp?o==="asc"?1:-1:0});return f.jsxs("table",{className:"min-w-full",children:[f.jsx("thead",{className:"bg-backgroundPrimary text-sm font-semibold text-textPrimary",children:f.jsx("tr",{children:e.map(l=>f.jsx("th",{scope:"col",className:`py-2 pr-3 pl-6 text-left ${l.sortable?"cursor-pointer hover:brightness-hover active:brightness-press":""}`,onClick:()=>l.sortable&&i(l.title),onKeyUp:()=>l.sortable&&i(l.title),children:f.jsxs("div",{className:"flex gap-2",children:[l.title,n===l.title&&f.jsx(f.Fragment,{children:o==="asc"?f.jsx(GR,{size:16}):f.jsx(sC,{size:16})})]})},l.title))})}),f.jsx("tbody",{children:s.map((l,c)=>f.jsx("tr",{children:l.map((u,d)=>f.jsx("td",{className:"whitespace-nowrap py-2 text-sm text-textSecondary first:pl-2",children:u},d))},c))})]})};var AD=["second","minute","hour","day","week","month","year"];function RD(e,t){if(t===0)return["just now","right now"];var n=AD[Math.floor(t/2)];return e>1&&(n+="s"),[e+" "+n+" ago","in "+e+" "+n]}var ID=["秒","分钟","小时","天","周","个月","年"];function OD(e,t){if(t===0)return["刚刚","片刻后"];var n=ID[~~(t/2)];return[e+" "+n+"前",e+" "+n+"后"]}var gp={},vS=function(e,t){gp[e]=t},yS=function(e){return gp[e]||gp.en_US},Vo=[60,60,24,7,365/7/12,12];function f1(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function bS(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,o=0;e>=Vo[o]&&o(o===0?9:1)&&(o+=1),t(e,o,r)[n].replace("%s",e.toString())}function wS(e,t){var n=t?f1(t):new Date;return(+n-+f1(e))/1e3}function DD(e){for(var t=1,n=0,r=Math.abs(e);e>=Vo[n]&&nf.jsx(zD,{datetime:e,opts:{minInterval:10}});function WD(e,t,n){var r;if(n===void 0&&(n={}),!t.codes){t.codes={};for(var o=0;o=8&&(s-=8,i[c++]=255&l>>s)}if(s>=t.bits||255&l<<8-s)throw new SyntaxError("Unexpected end of data");return i}function GD(e,t,n){n===void 0&&(n={});for(var r=n,o=r.pad,a=o===void 0?!0:o,i=(1<t.bits;)l-=t.bits,s+=t.chars[i&c>>l];if(l&&(s+=t.chars[i&c<{const{nodes:e,hardware:t,setDialogOpen:n}=Te(),{setNodeNumToBeRemoved:r}=$n(),o=Array.from(e.values()).filter(a=>a.num!==t.myNodeNum);return f.jsxs(f.Fragment,{children:[f.jsx(vl,{}),f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("div",{className:"overflow-y-auto h-full",children:f.jsx(MD,{headings:[{title:"",type:"blank",sortable:!1},{title:"Name",type:"normal",sortable:!0},{title:"Model",type:"normal",sortable:!0},{title:"MAC Address",type:"normal",sortable:!0},{title:"Last Heard",type:"normal",sortable:!0},{title:"SNR",type:"normal",sortable:!0},{title:"Encryption",type:"normal",sortable:!1},{title:"Connection",type:"normal",sortable:!0},{title:"Remove",type:"normal",sortable:!1}],rows:o.map(a=>[f.jsx(da.Hashicon,{size:24,value:a.num.toString()},"icon"),f.jsx("h1",{children:a.user?.longName??(a.user?.macaddr?`Meshtastic ${h1.stringify(a.user?.macaddr.subarray(4,6)??[]).toLowerCase()}`:`!${Xs(a.num)}`)},"header"),f.jsx(Do,{children:pe.Mesh.HardwareModel[a.user?.hwModel??0]},"model"),f.jsx(Do,{children:h1.stringify(a.user?.macaddr??[]).match(/.{1,2}/g)?.join(":")??"UNK"},"addr"),f.jsx(m.Fragment,{children:a.lastHeard===0?f.jsx("p",{children:"Never"}):f.jsx(HD,{timestamp:a.lastHeard*1e3})},"lastHeard"),f.jsxs(Do,{children:[a.snr,"db/",Math.min(Math.max((a.snr+10)*5,0),100),"%/",(a.snr+10)*5,"raw"]},"snr"),f.jsx(Do,{children:a.user?.publicKey&&a.user?.publicKey.length>0?f.jsx(dC,{className:"text-green-600"}):f.jsx(uC,{className:"text-yellow-300"})},"pki"),f.jsxs(Do,{children:[a.lastHeard!==0?a.viaMqtt===!1&&a.hopsAway===0?"Direct":`${a.hopsAway.toString()} ${a.hopsAway>1?"hops":"hop"} away`:"-",a.viaMqtt===!0?", via MQTT":""]},"hops"),f.jsxs(pt,{variant:"destructive",onClick:()=>{r(a.num),n("nodeRemoval",!0)},children:[f.jsx(vC,{}),"Remove"]},"remove")])})}),f.jsx(Qh,{})]})]})},qD=()=>{const{activePage:e}=Te();return f.jsxs(f.Fragment,{children:[e==="messages"&&f.jsx(PD,{}),e==="map"&&f.jsx(SD,{}),e==="config"&&f.jsx(lO,{}),e==="channels"&&f.jsx(lI,{}),e==="nodes"&&f.jsx(KD,{})]})};var g1=1,XD=.9,YD=.8,QD=.17,Af=.1,Rf=.999,ZD=.9999,JD=.99,e5=/[\\\/_+.#"@\[\(\{&]/,t5=/[\\\/_+.#"@\[\(\{&]/g,n5=/[\s-]/,CS=/[\s-]/g;function bp(e,t,n,r,o,a,i){if(a===t.length)return o===e.length?g1:JD;var s=`${o},${a}`;if(i[s]!==void 0)return i[s];for(var l=r.charAt(a),c=n.indexOf(l,o),u=0,d,p,g,v;c>=0;)d=bp(e,t,n,r,c+1,a+1,i),d>u&&(c===o?d*=g1:e5.test(e.charAt(c-1))?(d*=YD,g=e.slice(o,c-1).match(t5),g&&o>0&&(d*=Math.pow(Rf,g.length))):n5.test(e.charAt(c-1))?(d*=XD,v=e.slice(o,c-1).match(CS),v&&o>0&&(d*=Math.pow(Rf,v.length))):(d*=QD,o>0&&(d*=Math.pow(Rf,c-o))),e.charAt(c)!==t.charAt(a)&&(d*=ZD)),(dd&&(d=p*Af)),d>u&&(u=d),c=n.indexOf(l,c+1);return i[s]=u,u}function v1(e){return e.toLowerCase().replace(CS," ")}function r5(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,bp(e,t,v1(e),v1(t),0,0,{})}function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>o5(n,t))}function wl(...e){return m.useCallback(SS(...e),e)}function a5(e,t=[]){let n=[];function r(a,i){const s=m.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:p,children:g,...v}=d,h=p?.[e][l]||s,_=m.useMemo(()=>v,Object.values(v));return m.createElement(h.Provider,{value:_},g)}function u(d,p){const g=p?.[e][l]||s,v=m.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const o=()=>{const a=n.map(i=>m.createContext(i));return function(s){const l=s?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,i5(o,...t)]}function i5(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...s,...d}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}const wp=globalThis?.document?m.useLayoutEffect:()=>{},s5=W1.useId||(()=>{});let l5=0;function If(e){const[t,n]=m.useState(s5());return wp(()=>{e||n(r=>r??String(l5++))},[e]),e||(t?`radix-${t}`:"")}function aa(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function c5({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=u5({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,s=aa(n),l=m.useCallback(c=>{if(a){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else o(c)},[a,e,o,s]);return[i,l]}function u5({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),a=aa(t);return m.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}const ig=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),a=o.find(f5);if(a){const i=a.props.children,s=o.map(l=>l===a?m.Children.count(i)>1?m.Children.only(null):m.isValidElement(i)?i.props.children:null:l);return m.createElement(_p,Dt({},r,{ref:t}),m.isValidElement(i)?m.cloneElement(i,void 0,s):null)}return m.createElement(_p,Dt({},r,{ref:t}),n)});ig.displayName="Slot";const _p=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...p5(r,n.props),ref:t?SS(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});_p.displayName="SlotClone";const d5=({children:e})=>m.createElement(m.Fragment,null,e);function f5(e){return m.isValidElement(e)&&e.type===d5}function p5(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{a(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const m5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Sn=m5.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:a,...i}=r,s=a?ig:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(s,Dt({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function h5(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function g5(e,t=globalThis?.document){const n=aa(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const xp="dismissableLayer.update",v5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside";let y1;const b5=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),w5=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=m.useContext(b5),[d,p]=m.useState(null),g=(n=d?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,v]=m.useState({}),h=wl(t,C=>p(C)),_=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(b),x=d?_.indexOf(d):-1,E=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=y,T=_5(C=>{const P=C.target,O=[...u.branches].some(R=>R.contains(P));!w||O||(a?.(C),s?.(C),C.defaultPrevented||l?.())},g),k=x5(C=>{const P=C.target;[...u.branches].some(R=>R.contains(P))||(i?.(C),s?.(C),C.defaultPrevented||l?.())},g);return g5(C=>{x===u.layers.size-1&&(o?.(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},g),m.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(y1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),b1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=y1)}},[d,g,r,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),b1())},[d,u]),m.useEffect(()=>{const C=()=>v({});return document.addEventListener(xp,C),()=>document.removeEventListener(xp,C)},[]),m.createElement(Sn.div,Dt({},c,{ref:h,style:{pointerEvents:E?w?"auto":"none":void 0,...e.style},onFocusCapture:mi(e.onFocusCapture,k.onFocusCapture),onBlurCapture:mi(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:mi(e.onPointerDownCapture,T.onPointerDownCapture)}))});function _5(e,t=globalThis?.document){const n=aa(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let c=function(){TS(v5,n,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function x5(e,t=globalThis?.document){const n=aa(e),r=m.useRef(!1);return m.useEffect(()=>{const o=a=>{a.target&&!r.current&&TS(y5,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function b1(){const e=new CustomEvent(xp);document.dispatchEvent(e)}function TS(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?h5(o,a):o.dispatchEvent(a)}const Of="focusScope.autoFocusOnMount",Df="focusScope.autoFocusOnUnmount",w1={bubbles:!1,cancelable:!0},k5=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=m.useState(null),c=aa(o),u=aa(a),d=m.useRef(null),p=wl(t,h=>l(h)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let h=function(x){if(g.paused||!s)return;const E=x.target;s.contains(E)?d.current=E:qr(d.current,{select:!0})},_=function(x){if(g.paused||!s)return;const E=x.relatedTarget;E!==null&&(s.contains(E)||qr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const w of x)w.removedNodes.length>0&&qr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",_);const y=new MutationObserver(b);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",_),y.disconnect()}}},[r,s,g.paused]),m.useEffect(()=>{if(s){x1.add(g);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(Of,w1);s.addEventListener(Of,c),s.dispatchEvent(b),b.defaultPrevented||(C5(P5(ES(s)),{select:!0}),document.activeElement===h&&qr(s))}return()=>{s.removeEventListener(Of,c),setTimeout(()=>{const b=new CustomEvent(Df,w1);s.addEventListener(Df,u),s.dispatchEvent(b),b.defaultPrevented||qr(h??document.body,{select:!0}),s.removeEventListener(Df,u),x1.remove(g)},0)}}},[s,c,u,g]);const v=m.useCallback(h=>{if(!n&&!r||g.paused)return;const _=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(_&&b){const y=h.currentTarget,[x,E]=S5(y);x&&E?!h.shiftKey&&b===E?(h.preventDefault(),n&&qr(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),n&&qr(E,{select:!0})):b===y&&h.preventDefault()}},[n,r,g.paused]);return m.createElement(Sn.div,Dt({tabIndex:-1},i,{ref:p,onKeyDown:v}))});function C5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qr(r,{select:t}),document.activeElement!==n)return}function S5(e){const t=ES(e),n=_1(t,e),r=_1(t.reverse(),e);return[n,r]}function ES(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _1(e,t){for(const n of e)if(!T5(n,{upTo:t}))return n}function T5(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function E5(e){return e instanceof HTMLInputElement&&"select"in e}function qr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&E5(e)&&t&&e.select()}}const x1=N5();function N5(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=k1(e,t),e.unshift(t)},remove(t){var n;e=k1(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function k1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function P5(e){return e.filter(t=>t.tagName!=="A")}const M5=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?Jw.createPortal(m.createElement(Sn.div,Dt({},o,{ref:t})),r):null});function A5(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const kd=e=>{const{present:t,children:n}=e,r=R5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=wl(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:a}):null};kd.displayName="Presence";function R5(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[s,l]=A5(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=oc(r.current);a.current=s==="mounted"?c:"none"},[s]),wp(()=>{const c=r.current,u=o.current;if(u!==e){const p=a.current,g=oc(c);e?l("MOUNT"):g==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),wp(()=>{if(t){const c=d=>{const g=oc(r.current).includes(d.animationName);d.target===t&&g&&an.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(a.current=oc(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function oc(e){return e?.animationName||"none"}let Lf=0;function I5(){m.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:C1()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:C1()),Lf++,()=>{Lf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Lf--}},[])}function C1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var NS=_k(),jf=function(){},Cd=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:jf,onWheelCapture:jf,onTouchMoveCapture:jf}),o=r[0],a=r[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,g=e.noIsolation,v=e.inert,h=e.allowPinchZoom,_=e.as,b=_===void 0?"div":_,y=$h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=p,E=wk([n,t]),w=Nt(Nt({},y),o);return m.createElement(m.Fragment,null,u&&m.createElement(x,{sideCar:NS,removeScrollBar:c,shards:d,noIsolation:g,inert:v,setCallbacks:a,allowPinchZoom:!!h,lockRef:n}),i?m.cloneElement(m.Children.only(s),Nt(Nt({},w),{ref:E})):m.createElement(b,Nt({},w,{className:l,ref:E}),s))});Cd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cd.classNames={fullWidth:ws,zeroRight:bs};var kp=!1;if(typeof window<"u")try{var ac=Object.defineProperty({},"passive",{get:function(){return kp=!0,!0}});window.addEventListener("test",ac,ac),window.removeEventListener("test",ac,ac)}catch{kp=!1}var Ua=kp?{passive:!1}:!1,O5=function(e){return e.tagName==="TEXTAREA"},PS=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!O5(e)&&n[t]==="visible")},D5=function(e){return PS(e,"overflowY")},L5=function(e){return PS(e,"overflowX")},S1=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=MS(e,n);if(r){var o=AS(e,n),a=o[1],i=o[2];if(a>i)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},j5=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},F5=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},MS=function(e,t){return e==="v"?D5(t):L5(t)},AS=function(e,t){return e==="v"?j5(t):F5(t)},B5=function(e,t){return e==="h"&&t==="rtl"?-1:1},$5=function(e,t,n,r,o){var a=B5(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,p=0;do{var g=AS(e,s),v=g[0],h=g[1],_=g[2],b=h-_-a*v;(v||b)&&MS(e,s)&&(d+=b,p+=v),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(d===0||!o)||!u&&(p===0||!o))&&(c=!0),c},ic=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},T1=function(e){return[e.deltaX,e.deltaY]},E1=function(e){return e&&"current"in e?e.current:e},U5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},V5=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},z5=0,Va=[];function H5(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(z5++)[0],a=m.useState(function(){return Uh()})[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=bk([e.lockRef.current],(e.shards||[]).map(E1),!0).filter(Boolean);return h.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(h,_){if("touches"in h&&h.touches.length===2)return!i.current.allowPinchZoom;var b=ic(h),y=n.current,x="deltaX"in h?h.deltaX:y[0]-b[0],E="deltaY"in h?h.deltaY:y[1]-b[1],w,T=h.target,k=Math.abs(x)>Math.abs(E)?"h":"v";if("touches"in h&&k==="h"&&T.type==="range")return!1;var C=S1(k,T);if(!C)return!0;if(C?w=k:(w=k==="v"?"h":"v",C=S1(k,T)),!C)return!1;if(!r.current&&"changedTouches"in h&&(x||E)&&(r.current=w),!w)return!0;var P=r.current||w;return $5(P,_,h,P==="h"?x:E,!0)},[]),l=m.useCallback(function(h){var _=h;if(!(!Va.length||Va[Va.length-1]!==a)){var b="deltaY"in _?T1(_):ic(_),y=t.current.filter(function(w){return w.name===_.type&&w.target===_.target&&U5(w.delta,b)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(i.current.shards||[]).map(E1).filter(Boolean).filter(function(w){return w.contains(_.target)}),E=x.length>0?s(_,x[0]):!i.current.noIsolation;E&&_.cancelable&&_.preventDefault()}}},[]),c=m.useCallback(function(h,_,b,y){var x={name:h,delta:_,target:b,should:y};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(E){return E!==x})},1)},[]),u=m.useCallback(function(h){n.current=ic(h),r.current=void 0},[]),d=m.useCallback(function(h){c(h.type,T1(h),h.target,s(h,e.lockRef.current))},[]),p=m.useCallback(function(h){c(h.type,ic(h),h.target,s(h,e.lockRef.current))},[]);m.useEffect(function(){return Va.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Ua),document.addEventListener("touchmove",l,Ua),document.addEventListener("touchstart",u,Ua),function(){Va=Va.filter(function(h){return h!==a}),document.removeEventListener("wheel",l,Ua),document.removeEventListener("touchmove",l,Ua),document.removeEventListener("touchstart",u,Ua)}},[]);var g=e.removeScrollBar,v=e.inert;return m.createElement(m.Fragment,null,v?m.createElement(a,{styles:V5(o)}):null,g?m.createElement(Sk,{gapMode:"margin"}):null)}const W5=kk(NS,H5);var RS=m.forwardRef(function(e,t){return m.createElement(Cd,Nt({},e,{ref:t,sideCar:W5}))});RS.classNames=Cd.classNames;const IS="Dialog",[OS,A7]=a5(IS),[G5,pa]=OS(IS),K5=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=m.useRef(null),l=m.useRef(null),[c=!1,u]=c5({prop:r,defaultProp:o,onChange:a});return m.createElement(G5,{scope:t,triggerRef:s,contentRef:l,contentId:If(),titleId:If(),descriptionId:If(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),modal:i},n)},DS="DialogPortal",[q5,LS]=OS(DS,{forceMount:void 0}),X5=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=pa(DS,t);return m.createElement(q5,{scope:t,forceMount:n},m.Children.map(r,i=>m.createElement(kd,{present:n||a.open},m.createElement(M5,{asChild:!0,container:o},i))))},Cp="DialogOverlay",Y5=m.forwardRef((e,t)=>{const n=LS(Cp,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=pa(Cp,e.__scopeDialog);return a.modal?m.createElement(kd,{present:r||a.open},m.createElement(Q5,Dt({},o,{ref:t}))):null}),Q5=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=pa(Cp,n);return m.createElement(RS,{as:ig,allowPinchZoom:!0,shards:[o.contentRef]},m.createElement(Sn.div,Dt({"data-state":FS(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Ys="DialogContent",Z5=m.forwardRef((e,t)=>{const n=LS(Ys,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=pa(Ys,e.__scopeDialog);return m.createElement(kd,{present:r||a.open},a.modal?m.createElement(J5,Dt({},o,{ref:t})):m.createElement(eL,Dt({},o,{ref:t})))}),J5=m.forwardRef((e,t)=>{const n=pa(Ys,e.__scopeDialog),r=m.useRef(null),o=wl(t,n.contentRef,r);return m.useEffect(()=>{const a=r.current;if(a)return Bh(a)},[]),m.createElement(jS,Dt({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mi(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=n.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:mi(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&a.preventDefault()}),onFocusOutside:mi(e.onFocusOutside,a=>a.preventDefault())}))}),eL=m.forwardRef((e,t)=>{const n=pa(Ys,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return m.createElement(jS,Dt({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,a),!a.defaultPrevented){var s;r.current||(s=n.triggerRef.current)===null||s===void 0||s.focus(),a.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:a=>{var i,s;(i=e.onInteractOutside)===null||i===void 0||i.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((s=n.triggerRef.current)===null||s===void 0?void 0:s.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}}))}),jS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=pa(Ys,n),l=m.useRef(null),c=wl(t,l);return I5(),m.createElement(m.Fragment,null,m.createElement(k5,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a},m.createElement(w5,Dt({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":FS(s.open)},i,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)});function FS(e){return e?"open":"closed"}const tL=K5,nL=X5,rL=Y5,oL=Z5;var ts='[cmdk-group=""]',Ff='[cmdk-group-items=""]',aL='[cmdk-group-heading=""]',sg='[cmdk-item=""]',N1=`${sg}:not([aria-disabled="true"])`,Sp="cmdk-item-select",Lo="data-value",iL=(e,t,n)=>r5(e,t,n),BS=m.createContext(void 0),_l=()=>m.useContext(BS),$S=m.createContext(void 0),lg=()=>m.useContext($S),US=m.createContext(void 0),VS=m.forwardRef((e,t)=>{let n=za(()=>{var U,ae;return{search:"",value:(ae=(U=e.value)!=null?U:e.defaultValue)!=null?ae:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=za(()=>new Set),o=za(()=>new Map),a=za(()=>new Map),i=za(()=>new Set),s=zS(e),{label:l,children:c,value:u,onValueChange:d,filter:p,shouldFilter:g,loop:v,disablePointerSelection:h=!1,vimBindings:_=!0,...b}=e,y=m.useId(),x=m.useId(),E=m.useId(),w=m.useRef(null),T=vL();ia(()=>{if(u!==void 0){let U=u.trim();n.current.value=U,k.emit()}},[u]),ia(()=>{T(6,B)},[]);let k=m.useMemo(()=>({subscribe:U=>(i.current.add(U),()=>i.current.delete(U)),snapshot:()=>n.current,setState:(U,ae,se)=>{var S,X,H;if(!Object.is(n.current[U],ae)){if(n.current[U]=ae,U==="search")N(),O(),T(1,R);else if(U==="value"&&(se||T(5,B),((S=s.current)==null?void 0:S.value)!==void 0)){let I=ae??"";(H=(X=s.current).onValueChange)==null||H.call(X,I);return}k.emit()}},emit:()=>{i.current.forEach(U=>U())}}),[]),C=m.useMemo(()=>({value:(U,ae,se)=>{var S;ae!==((S=a.current.get(U))==null?void 0:S.value)&&(a.current.set(U,{value:ae,keywords:se}),n.current.filtered.items.set(U,P(ae,se)),T(2,()=>{O(),k.emit()}))},item:(U,ae)=>(r.current.add(U),ae&&(o.current.has(ae)?o.current.get(ae).add(U):o.current.set(ae,new Set([U]))),T(3,()=>{N(),O(),n.current.value||R(),k.emit()}),()=>{a.current.delete(U),r.current.delete(U),n.current.filtered.items.delete(U);let se=D();T(4,()=>{N(),se?.getAttribute("id")===U&&R(),k.emit()})}),group:U=>(o.current.has(U)||o.current.set(U,new Set),()=>{a.current.delete(U),o.current.delete(U)}),filter:()=>s.current.shouldFilter,label:l||e["aria-label"],disablePointerSelection:h,listId:y,inputId:E,labelId:x,listInnerRef:w}),[]);function P(U,ae){var se,S;let X=(S=(se=s.current)==null?void 0:se.filter)!=null?S:iL;return U?X(U,n.current.search,ae):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let U=n.current.filtered.items,ae=[];n.current.filtered.groups.forEach(S=>{let X=o.current.get(S),H=0;X.forEach(I=>{let F=U.get(I);H=Math.max(F,H)}),ae.push([S,H])});let se=w.current;L().sort((S,X)=>{var H,I;let F=S.getAttribute("id"),j=X.getAttribute("id");return((H=U.get(j))!=null?H:0)-((I=U.get(F))!=null?I:0)}).forEach(S=>{let X=S.closest(Ff);X?X.appendChild(S.parentElement===X?S:S.closest(`${Ff} > *`)):se.appendChild(S.parentElement===se?S:S.closest(`${Ff} > *`))}),ae.sort((S,X)=>X[1]-S[1]).forEach(S=>{let X=w.current.querySelector(`${ts}[${Lo}="${encodeURIComponent(S[0])}"]`);X?.parentElement.appendChild(X)})}function R(){let U=L().find(se=>se.getAttribute("aria-disabled")!=="true"),ae=U?.getAttribute(Lo);k.setState("value",ae||void 0)}function N(){var U,ae,se,S;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let X=0;for(let H of r.current){let I=(ae=(U=a.current.get(H))==null?void 0:U.value)!=null?ae:"",F=(S=(se=a.current.get(H))==null?void 0:se.keywords)!=null?S:[],j=P(I,F);n.current.filtered.items.set(H,j),j>0&&X++}for(let[H,I]of o.current)for(let F of I)if(n.current.filtered.items.get(F)>0){n.current.filtered.groups.add(H);break}n.current.filtered.count=X}function B(){var U,ae,se;let S=D();S&&(((U=S.parentElement)==null?void 0:U.firstChild)===S&&((se=(ae=S.closest(ts))==null?void 0:ae.querySelector(aL))==null||se.scrollIntoView({block:"nearest"})),S.scrollIntoView({block:"nearest"}))}function D(){var U;return(U=w.current)==null?void 0:U.querySelector(`${sg}[aria-selected="true"]`)}function L(){var U;return Array.from((U=w.current)==null?void 0:U.querySelectorAll(N1))}function G(U){let ae=L()[U];ae&&k.setState("value",ae.getAttribute(Lo))}function Y(U){var ae;let se=D(),S=L(),X=S.findIndex(I=>I===se),H=S[X+U];(ae=s.current)!=null&&ae.loop&&(H=X+U<0?S[S.length-1]:X+U===S.length?S[0]:S[X+U]),H&&k.setState("value",H.getAttribute(Lo))}function K(U){let ae=D(),se=ae?.closest(ts),S;for(;se&&!S;)se=U>0?hL(se,ts):gL(se,ts),S=se?.querySelector(N1);S?k.setState("value",S.getAttribute(Lo)):Y(U)}let Z=()=>G(L().length-1),re=U=>{U.preventDefault(),U.metaKey?Z():U.altKey?K(1):Y(1)},fe=U=>{U.preventDefault(),U.metaKey?G(0):U.altKey?K(-1):Y(-1)};return m.createElement(Sn.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:U=>{var ae;if((ae=b.onKeyDown)==null||ae.call(b,U),!U.defaultPrevented)switch(U.key){case"n":case"j":{_&&U.ctrlKey&&re(U);break}case"ArrowDown":{re(U);break}case"p":case"k":{_&&U.ctrlKey&&fe(U);break}case"ArrowUp":{fe(U);break}case"Home":{U.preventDefault(),G(0);break}case"End":{U.preventDefault(),Z();break}case"Enter":if(!U.nativeEvent.isComposing&&U.keyCode!==229){U.preventDefault();let se=D();if(se){let S=new Event(Sp);se.dispatchEvent(S)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:bL},l),Sd(e,U=>m.createElement($S.Provider,{value:k},m.createElement(BS.Provider,{value:C},U))))}),sL=m.forwardRef((e,t)=>{var n,r;let o=m.useId(),a=m.useRef(null),i=m.useContext(US),s=_l(),l=zS(e),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;ia(()=>{if(!c)return s.item(o,i?.id)},[c]);let u=HS(o,a,[e.value,e.children,a],e.keywords),d=lg(),p=wo(T=>T.value&&T.value===u.current),g=wo(T=>c||s.filter()===!1?!0:T.search?T.filtered.items.get(o)>0:!0);m.useEffect(()=>{let T=a.current;if(!(!T||e.disabled))return T.addEventListener(Sp,v),()=>T.removeEventListener(Sp,v)},[g,e.onSelect,e.disabled]);function v(){var T,k;h(),(k=(T=l.current).onSelect)==null||k.call(T,u.current)}function h(){d.setState("value",u.current,!0)}if(!g)return null;let{disabled:_,value:b,onSelect:y,forceMount:x,keywords:E,...w}=e;return m.createElement(Sn.div,{ref:Qs([a,t]),...w,id:o,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||s.disablePointerSelection?void 0:h,onClick:_?void 0:v},e.children)}),lL=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,i=m.useId(),s=m.useRef(null),l=m.useRef(null),c=m.useId(),u=_l(),d=wo(g=>o||u.filter()===!1?!0:g.search?g.filtered.groups.has(i):!0);ia(()=>u.group(i),[]),HS(i,s,[e.value,e.heading,l]);let p=m.useMemo(()=>({id:i,forceMount:o}),[o]);return m.createElement(Sn.div,{ref:Qs([s,t]),...a,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&m.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Sd(e,g=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},m.createElement(US.Provider,{value:p},g))))}),cL=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),a=wo(i=>!i.search);return!n&&!a?null:m.createElement(Sn.div,{ref:Qs([o,t]),...r,"cmdk-separator":"",role:"separator"})}),uL=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,a=lg(),i=wo(u=>u.search),s=wo(u=>u.value),l=_l(),c=m.useMemo(()=>{var u;let d=(u=l.listInnerRef.current)==null?void 0:u.querySelector(`${sg}[${Lo}="${encodeURIComponent(s)}"]`);return d?.getAttribute("id")},[]);return m.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),m.createElement(Sn.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||a.setState("search",u.target.value),n?.(u.target.value)}})}),dL=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=m.useRef(null),i=m.useRef(null),s=_l();return m.useEffect(()=>{if(i.current&&a.current){let l=i.current,c=a.current,u,d=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let p=l.offsetHeight;c.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(l),()=>{cancelAnimationFrame(u),d.unobserve(l)}}},[]),m.createElement(Sn.div,{ref:Qs([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:s.listId},Sd(e,l=>m.createElement("div",{ref:Qs([i,s.listInnerRef]),"cmdk-list-sizer":""},l)))}),fL=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:i,...s}=e;return m.createElement(tL,{open:n,onOpenChange:r},m.createElement(nL,{container:i},m.createElement(rL,{"cmdk-overlay":"",className:o}),m.createElement(oL,{"aria-label":e.label,"cmdk-dialog":"",className:a},m.createElement(VS,{ref:t,...s}))))}),pL=m.forwardRef((e,t)=>wo(n=>n.filtered.count===0)?m.createElement(Sn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mL=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return m.createElement(Sn.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Sd(e,i=>m.createElement("div",{"aria-hidden":!0},i)))}),Gt=Object.assign(VS,{List:dL,Item:sL,Input:uL,Group:lL,Separator:cL,Dialog:fL,Empty:pL,Loading:mL});function hL(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gL(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function zS(e){let t=m.useRef(e);return ia(()=>{t.current=e}),t}var ia=typeof window>"u"?m.useEffect:m.useLayoutEffect;function za(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function Qs(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function wo(e){let t=lg(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function HS(e,t,n,r=[]){let o=m.useRef(),a=_l();return ia(()=>{var i;let s=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():o.current}})(),l=r.map(c=>c.trim());a.value(e,s,l),(i=t.current)==null||i.setAttribute(Lo,s),o.current=s}),o}var vL=()=>{let[e,t]=m.useState(),n=za(()=>new Map);return ia(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function yL(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Sd({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(yL(t),{ref:t.ref},n(t.props.children)):n(t)}var bL={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const WS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt,{ref:n,className:Ee("flex h-full w-full flex-col overflow-hidden rounded-lg bg-white dark:bg-slate-800",e),...t}));WS.displayName=Gt.displayName;const wL=({children:e,...t})=>f.jsx(Ar,{...t,children:f.jsx(tr,{className:"overflow-hidden p-0 shadow-2xl [&_[dialog-overlay]]:bg-red-100",children:f.jsx(WS,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 [&_[cmdk-group]]:px-2 [&_[cmdk-group]_+[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),GS=m.forwardRef(({className:e,...t},n)=>f.jsxs("div",{className:"flex items-center border-b border-b-slate-100 px-4 dark:border-b-slate-700","cmdk-input-wrapper":"",children:[f.jsx(gC,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),f.jsx(Gt.Input,{ref:n,className:Ee("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-slate-400 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-50",e),...t})]}));GS.displayName=Gt.Input.displayName;const KS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.List,{ref:n,className:Ee("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));KS.displayName=Gt.List.displayName;const qS=m.forwardRef((e,t)=>f.jsx(Gt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));qS.displayName=Gt.Empty.displayName;const XS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Group,{ref:n,className:Ee("overflow-hidden py-3 px-2 text-slate-700 dark:text-slate-400 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-slate-900 [&_[cmdk-group-heading]]:dark:text-slate-300",e),...t}));XS.displayName=Gt.Group.displayName;const _L=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Separator,{ref:n,className:Ee("-mx-1 h-px bg-slate-100 dark:bg-slate-700",e),...t}));_L.displayName=Gt.Separator.displayName;const cg=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Item,{ref:n,className:Ee("relative flex cursor-default select-none items-center rounded-md py-1.5 px-2 text-sm font-medium outline-none aria-selected:bg-slate-100 data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50 dark:aria-selected:bg-slate-700",e),...t}));cg.displayName=Gt.Item.displayName;const xL=()=>{const{commandPaletteOpen:e,setCommandPaletteOpen:t,setSelectedDevice:n,removeDevice:r,selectedDevice:o,darkMode:a,setDarkMode:i,setAccent:s}=$n(),{getDevices:l}=ca(),{setDialogOpen:c,setActivePage:u,connection:d}=Te(),p=[{label:"Goto",icon:r6,commands:[{label:"Messages",icon:pC,action(){u("messages")}},{label:"Map",icon:fC,action(){u("map")}},{label:"Config",icon:Wh,action(){u("config")},tags:["settings"]},{label:"Channels",icon:cC,action(){u("channels")}},{label:"Nodes",icon:Gh,action(){u("nodes")}}]},{label:"Manage",icon:d6,commands:[{label:"Switch Node",icon:UR,subItems:l().map(g=>({label:g.nodes.get(g.hardware.myNodeNum)?.user?.longName??g.hardware.myNodeNum.toString(),icon:f.jsx(da.Hashicon,{size:16,value:g.hardware.myNodeNum.toString()}),action(){n(g.id)}}))},{label:"Connect New Node",icon:Hh,action(){n(0)}}]},{label:"Contextual",icon:aC,commands:[{label:"QR Code",icon:Pc,subItems:[{label:"Generator",icon:f.jsx(Pc,{size:16}),action(){c("QR",!0)}},{label:"Import",icon:f.jsx(Pc,{size:16}),action(){c("import",!0)}}]},{label:"Disconnect",icon:KR,action(){d?.disconnect(),n(0),r(o??0)}},{label:"Schedule Shutdown",icon:hC,action(){c("shutdown",!0)}},{label:"Schedule Reboot",icon:lp,action(){c("reboot",!0)}},{label:"Reset Nodes",icon:vC,action(){d?.resetNodes()}},{label:"Factory Reset Device",icon:Hy,action(){d?.factoryResetDevice()}},{label:"Factory Reset Config",icon:Hy,action(){d?.factoryResetConfig()}}]},{label:"Debug",icon:WR,commands:[{label:"Reconfigure",icon:lp,action(){d?.configure()}},{label:"[WIP] Clear Messages",icon:YR,action(){alert("This feature is not implemented")}}]},{label:"Application",icon:l6,commands:[{label:"Toggle Dark Mode",icon:mC,action(){i(!a)}},{label:"Accent Color",icon:s6,subItems:[{label:"Red",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#f25555]":"bg-[#f28585]"}`}),action(){s("red")}},{label:"Orange",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#e1720b]":"bg-[#edb17a]"}`}),action(){s("orange")}},{label:"Yellow",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#ac8c1a]":"bg-[#e0cc87]"}`}),action(){s("yellow")}},{label:"Green",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#27a341]":"bg-[#8bc9c5]"}`}),action(){s("green")}},{label:"Blue",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#2093fe]":"bg-[#70afea]"}`}),action(){s("blue")}},{label:"Purple",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#926bff]":"bg-[#a09eef]"}`}),action(){s("purple")}},{label:"Pink",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#e454c4]":"bg-[#dba0c7]"}`}),action(){s("pink")}}]}]}];return m.useEffect(()=>{const g=v=>{v.key==="k"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),t(!0))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t]),f.jsxs(wL,{open:e,onOpenChange:t,children:[f.jsx(GS,{placeholder:"Type a command or search..."}),f.jsxs(KS,{children:[f.jsx(qS,{children:"No results found."}),p.map(g=>f.jsx(XS,{heading:g.label,children:g.commands.map(v=>f.jsxs("div",{children:[f.jsxs(cg,{onSelect:()=>{v.action?.(),t(!1)},children:[f.jsx(v.icon,{size:16,className:"mr-2"}),v.label]}),v.subItems?.map(h=>f.jsx(kL,{label:h.label,icon:h.icon,action:h.action},h.label))]},v.label))},g.label))]})]})},kL=({label:e,icon:t,action:n})=>wo(o=>o.search)?f.jsxs(cg,{onSelect:n,children:[t,e]}):null,P1=({active:e,onClick:t,children:n})=>f.jsxs("li",{className:"aspect-w-1 aspect-h-1 relative w-full",onClick:t,onKeyDown:t,children:[e&&f.jsx("div",{className:"absolute -left-2 h-10 w-1.5 rounded-full bg-accent"}),f.jsx("div",{className:"flex aspect-square cursor-pointer flex-col items-center justify-center",children:n})]});var CL="Separator",M1="horizontal",SL=["horizontal","vertical"],YS=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=M1,...o}=e,a=TL(r)?r:M1,s=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return f.jsx(xe.div,{"data-orientation":a,...s,...o,ref:t})});YS.displayName=CL;function TL(e){return SL.includes(e)}var QS=YS;const Cu=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>f.jsx(QS,{ref:o,decorative:n,orientation:t,className:Ee("bg-slate-200 dark:bg-slate-700",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Cu.displayName=QS.displayName;const EL=({children:e})=>f.jsx("code",{className:"relative rounded bg-slate-100 px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold text-slate-900 dark:bg-slate-800 dark:text-slate-400",children:e}),NL=()=>{const{getDevices:e}=ca(),{selectedDevice:t,setSelectedDevice:n,darkMode:r,setDarkMode:o,setCommandPaletteOpen:a,setConnectDialogOpen:i}=$n();return f.jsxs("nav",{className:"flex flex-col justify-between border-r-[0.5px] border-slate-300 bg-transparent pt-2 dark:border-slate-700",children:[f.jsx("div",{className:"flex flex-col overflow-y-hidden",children:f.jsxs("ul",{className:"flex w-20 grow flex-col items-center space-y-4 bg-transparent py-4 px-5",children:[f.jsx(P1,{active:t===0,onClick:()=>{n(0)},children:f.jsx(e6,{})}),e().map(s=>f.jsx(P1,{onClick:()=>{n(s.id)},active:t===s.id,children:f.jsx(da.Hashicon,{size:24,value:s.hardware.myNodeNum.toString()})},s.id)),f.jsx(Cu,{}),f.jsx("button",{type:"button",onClick:()=>i(!0),className:"transition-all duration-300 hover:text-accent",children:f.jsx(Hh,{})})]})}),f.jsxs("div",{className:"flex w-20 flex-col items-center space-y-5 bg-transparent px-5 pb-5",children:[f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>o(!r),children:r?f.jsx(p6,{}):f.jsx(mC,{})}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>a(!0),children:f.jsx(gC,{})}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",children:f.jsx(n6,{})}),f.jsx(Cu,{}),f.jsx(EL,{children:"06d2c39"})]})]})},PL=({open:e,onOpenChange:t})=>{const{connection:n,nodes:r,removeNode:o}=Te(),{nodeNumToBeRemoved:a}=$n(),i=()=>{n?.removeNodeByNum(a),o(a),t(!1)};return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Remove Node?"}),f.jsx(To,{children:"Are you sure you want to remove this Node?"})]}),f.jsx("div",{className:"gap-4",children:f.jsx("form",{onSubmit:i,children:f.jsx(xn,{children:r.get(a)?.user?.longName})})}),f.jsx($i,{children:f.jsx(pt,{variant:"destructive",onClick:()=>i(),children:"Remove"})})]})})},ML=({open:e,onOpenChange:t})=>{const{hardware:n,nodes:r,connection:o}=Te(),a=r.get(n.myNodeNum),{register:i,handleSubmit:s}=Eh({values:{longName:a?.user?.longName??"Unknown",shortName:a?.user?.shortName??"Unknown"}}),l=s(c=>{o?.setOwner(new pe.Mesh.User({...a?.user,...c})),t(!1)});return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Change Device Name"}),f.jsx(To,{children:"The Device will restart once the config is saved."})]}),f.jsx("div",{className:"gap-4",children:f.jsxs("form",{onSubmit:l,children:[f.jsx(xn,{children:"Long Name"}),f.jsx(jn,{...i("longName")}),f.jsx(xn,{children:"Short Name"}),f.jsx(jn,{maxLength:4,...i("shortName")})]})}),f.jsx($i,{children:f.jsx(pt,{onClick:()=>l(),children:"Save"})})]})})};var ug="Checkbox",[AL,R7]=Pr(ug),[RL,IL]=AL(ug),ZS=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,p]=m.useState(null),g=$e(t,x=>p(x)),v=m.useRef(!1),h=d?!!d.closest("form"):!0,[_=!1,b]=go({prop:o,defaultProp:a,onChange:c}),y=m.useRef(_);return m.useEffect(()=>{const x=d?.form;if(x){const E=()=>b(y.current);return x.addEventListener("reset",E),()=>x.removeEventListener("reset",E)}},[d,b]),f.jsxs(RL,{scope:n,state:_,disabled:s,children:[f.jsx(xe.button,{type:"button",role:"checkbox","aria-checked":Ko(_)?"mixed":_,"aria-required":i,"data-state":tT(_),"data-disabled":s?"":void 0,disabled:s,value:l,...u,ref:g,onKeyDown:we(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:we(e.onClick,x=>{b(E=>Ko(E)?!0:!E),h&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),h&&f.jsx(OL,{control:d,bubbles:!v.current,name:r,value:l,checked:_,required:i,disabled:s,style:{transform:"translateX(-100%)"}})]})});ZS.displayName=ug;var JS="CheckboxIndicator",eT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=IL(JS,n);return f.jsx(ua,{present:r||Ko(a.state)||a.state===!0,children:f.jsx(xe.span,{"data-state":tT(a.state),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});eT.displayName=JS;var OL=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,a=m.useRef(null),i=Fh(n),s=Dh(t);return m.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const p=new Event("click",{bubbles:r});l.indeterminate=Ko(n),d.call(l,Ko(n)?!1:n),l.dispatchEvent(p)}},[i,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:Ko(n)?!1:n,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ko(e){return e==="indeterminate"}function tT(e){return Ko(e)?"indeterminate":e?"checked":"unchecked"}var nT=ZS,DL=eT;const dg=m.forwardRef(({className:e,...t},n)=>f.jsx(nT,{ref:n,className:Ee("peer h-4 w-4 shrink-0 rounded-sm border border-slate-300 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",e),...t,children:f.jsx(DL,{className:Ee("flex items-center justify-center"),children:f.jsx(iC,{className:"h-4 w-4"})})}));dg.displayName=nT.displayName;const LL=({open:e,onOpenChange:t})=>{const[n,r]=m.useState(""),[o,a]=m.useState(),[i,s]=m.useState(!1),{connection:l}=Te();m.useEffect(()=>{try{const u=new URL(n);if(u.hostname!=="meshtastic.org"&&u.pathname!=="/e/"||!u.hash)throw"Invalid Meshtastic URL";const d=u.hash.substring(1),p=d.padEnd(d.length+(4-d.length%4)%4,"=").replace(/-/g,"+").replace(/_/g,"/");a(pe.AppOnly.ChannelSet.fromBinary(Jr(p))),s(!0)}catch{s(!1),a(void 0)}},[n]);const c=()=>{o?.settings.map((u,d)=>{l?.setChannel(new pe.Channel.Channel({index:d,role:d===0?pe.Channel.Channel_Role.PRIMARY:pe.Channel.Channel_Role.SECONDARY,settings:u}))}),o?.loraConfig&&l?.setConfig(new pe.Config.Config({payloadVariant:{case:"lora",value:o.loraConfig}}))};return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Import Channel Set"}),f.jsx(To,{children:"The current LoRa configuration will be overridden."})]}),f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(xn,{children:"Channel Set/QR Code URL"}),f.jsx(jn,{value:n,suffix:i?"✅":"❌",onChange:u=>{r(u.target.value)}}),i&&f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx("div",{className:"flex w-full gap-2",children:f.jsxs("div",{className:"w-36",children:[f.jsx(xn,{children:"Use Preset?"}),f.jsx(md,{disabled:!0,checked:o?.loraConfig?.usePreset??!0})]})}),f.jsx("span",{className:"text-md block font-medium text-textPrimary",children:"Channels:"}),f.jsx("div",{className:"flex w-40 flex-col gap-1",children:o?.settings.map(u=>f.jsxs("div",{className:"flex justify-between",children:[f.jsx(xn,{children:u.name.length?u.name:`Channel: ${u.id}`}),f.jsx(dg,{},u.id)]},u.id))})]})]}),f.jsx($i,{children:f.jsx(pt,{onClick:c,disabled:!i,children:"Apply"})})]})})};var fg={},Su={exports:{}};Su.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,a=2,i=9007199254740991,s="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",p="[object Error]",g="[object Function]",v="[object GeneratorFunction]",h="[object Map]",_="[object Number]",b="[object Null]",y="[object Object]",x="[object Promise]",E="[object Proxy]",w="[object RegExp]",T="[object Set]",k="[object String]",C="[object Symbol]",P="[object Undefined]",O="[object WeakMap]",R="[object ArrayBuffer]",N="[object DataView]",B="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",G="[object Int16Array]",Y="[object Int32Array]",K="[object Uint8Array]",Z="[object Uint8ClampedArray]",re="[object Uint16Array]",fe="[object Uint32Array]",U=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,S={};S[B]=S[D]=S[L]=S[G]=S[Y]=S[K]=S[Z]=S[re]=S[fe]=!0,S[s]=S[l]=S[R]=S[u]=S[N]=S[d]=S[p]=S[g]=S[h]=S[_]=S[y]=S[w]=S[T]=S[k]=S[O]=!1;var X=typeof _t=="object"&&_t&&_t.Object===Object&&_t,H=typeof self=="object"&&self&&self.Object===Object&&self,I=X||H||Function("return this")(),F=t&&!t.nodeType&&t,j=F&&!0&&e&&!e.nodeType&&e,$=j&&j.exports===F,V=$&&X.process,J=function(){try{return V&&V.binding&&V.binding("util")}catch{}}(),ee=J&&J.isTypedArray;function ce(M,z){for(var ne=-1,he=M==null?0:M.length,Ue=0,Ce=[];++ne-1}function Aa(M,z){var ne=this.__data__,he=kl(ne,M);return he<0?(++this.size,ne.push([M,z])):ne[he][1]=z,this}Ft.prototype.clear=Ea,Ft.prototype.delete=Na,Ft.prototype.get=Pa,Ft.prototype.has=Ma,Ft.prototype.set=Aa;function un(M){var z=-1,ne=M==null?0:M.length;for(this.clear();++zmt))return!1;var Ke=Ce.get(M);if(Ke&&Ce.get(z))return Ke==z;var Kt=-1,En=!0,Ct=ne&a?new xl:void 0;for(Ce.set(M,z),Ce.set(z,M);++Kt-1&&M%1==0&&M-1&&M%1==0&&M<=i}function Sg(M){var z=typeof M;return M!=null&&(z=="object"||z=="function")}function Vi(M){return M!=null&&typeof M=="object"}var Tg=ee?q(ee):WT;function aE(M){return rE(M)?UT(M):GT(M)}function iE(){return[]}function sE(){return!1}e.exports=oE})(Su,Su.exports);var jL=Su.exports,rT={exports:{}};(function(e,t){var n=function(){var r=function(w,T){var k=236,C=17,P=w,O=a[T],R=null,N=0,B=null,D=[],L={},G=function(I,F){N=P*4+17,R=function(j){for(var $=new Array(j),V=0;V=7&&fe(I),B==null&&(B=S(P,O,D)),ae(B,F)},Y=function(I,F){for(var j=-1;j<=7;j+=1)if(!(I+j<=-1||N<=I+j))for(var $=-1;$<=7;$+=1)F+$<=-1||N<=F+$||(0<=j&&j<=6&&($==0||$==6)||0<=$&&$<=6&&(j==0||j==6)||2<=j&&j<=4&&2<=$&&$<=4?R[I+j][F+$]=!0:R[I+j][F+$]=!1)},K=function(){for(var I=0,F=0,j=0;j<8;j+=1){G(!0,j);var $=s.getLostPoint(L);(j==0||I>$)&&(I=$,F=j)}return F},Z=function(){for(var I=8;I>j&1)==1;R[Math.floor(j/3)][j%3+N-8-3]=$}for(var j=0;j<18;j+=1){var $=!I&&(F>>j&1)==1;R[j%3+N-8-3][Math.floor(j/3)]=$}},U=function(I,F){for(var j=O<<3|F,$=s.getBCHTypeInfo(j),V=0;V<15;V+=1){var J=!I&&($>>V&1)==1;V<6?R[V][8]=J:V<8?R[V+1][8]=J:R[N-15+V][8]=J}for(var V=0;V<15;V+=1){var J=!I&&($>>V&1)==1;V<8?R[8][N-V-1]=J:V<9?R[8][15-V-1+1]=J:R[8][15-V-1]=J}R[N-8][8]=!I},ae=function(I,F){for(var j=-1,$=N-1,V=7,J=0,ee=s.getMaskFunction(F),ce=N-1;ce>0;ce-=2)for(ce==6&&(ce-=1);;){for(var Pe=0;Pe<2;Pe+=1)if(R[$][ce-Pe]==null){var Oe=!1;J>>V&1)==1);var A=ee($,ce-Pe);A&&(Oe=!Oe),R[$][ce-Pe]=Oe,V-=1,V==-1&&(J+=1,V=7)}if($+=j,$<0||N<=$){$-=j,j=-j;break}}},se=function(I,F){for(var j=0,$=0,V=0,J=new Array(F.length),ee=new Array(F.length),ce=0;ce=0?ue.getAt(le):0}}for(var oe=0,A=0;Ace*8)throw"code length overflow. ("+V.getLengthInBits()+">"+ce*8+")";for(V.getLengthInBits()+4<=ce*8&&V.put(0,4);V.getLengthInBits()%8!=0;)V.putBit(!1);for(;!(V.getLengthInBits()>=ce*8||(V.put(k,8),V.getLengthInBits()>=ce*8));)V.put(C,8);return se(V,$)};L.addData=function(I,F){F=F||"Byte";var j=null;switch(F){case"Numeric":j=p(I);break;case"Alphanumeric":j=g(I);break;case"Byte":j=v(I);break;case"Kanji":j=h(I);break;default:throw"mode:"+F}D.push(j),B=null},L.isDark=function(I,F){if(I<0||N<=I||F<0||N<=F)throw I+","+F;return R[I][F]},L.getModuleCount=function(){return N},L.make=function(){if(P<1){for(var I=1;I<40;I++){for(var F=u.getRSBlocks(I,O),j=d(),$=0;$"u"?I*4:F;var j="";j+='";for(var V=0;V';j+=""}return j+="",j+="
",j},L.createSvgTag=function(I,F,j,$){var V={};typeof arguments[0]=="object"&&(V=arguments[0],I=V.cellSize,F=V.margin,j=V.alt,$=V.title),I=I||2,F=typeof F>"u"?I*4:F,j=typeof j=="string"?{text:j}:j||{},j.text=j.text||null,j.id=j.text?j.id||"qrcode-description":null,$=typeof $=="string"?{text:$}:$||{},$.text=$.text||null,$.id=$.text?$.id||"qrcode-title":null;var J=L.getModuleCount()*I+F*2,ee,ce,Pe,Oe,A="",q;for(q="l"+I+",0 0,"+I+" -"+I+",0 0,-"+I+"z ",A+=''+X($.text)+"":"",A+=j.text?''+X(j.text)+"":"",A+='',A+='"u"?I*4:F;var j=L.getModuleCount()*I+F*2,$=F,V=j-F;return E(j,j,function(J,ee){if($<=J&&J"u"?I*4:F;var $=L.getModuleCount()*I+F*2,V="";return V+="",V};var X=function(I){for(var F="",j=0;j":F+=">";break;case"&":F+="&";break;case'"':F+=""";break;default:F+=$;break}}return F},H=function(I){var F=1;I=typeof I>"u"?F*2:I;var j=L.getModuleCount()*F+I*2,$=I,V=j-I,J,ee,ce,Pe,Oe,A={"██":"█","█ ":"▀"," █":"▄"," ":" "},q={"██":"▀","█ ":"▀"," █":" "," ":" "},Q="";for(J=0;J=V?q[Oe]:A[Oe];Q+=` -`}return j%2&&I>0?Q.substring(0,Q.length-j-1)+Array(j+1).join("▀"):Q.substring(0,Q.length-1)};return L.createASCII=function(I,F){if(I=I||1,I<2)return H(F);I-=1,F=typeof F>"u"?I*2:F;var j=L.getModuleCount()*I+F*2,$=F,V=j-F,J,ee,ce,Pe,Oe=Array(I+1).join("██"),A=Array(I+1).join(" "),q="",Q="";for(J=0;J>>8),O.push(B&255)):O.push(C)}}return O}};var o={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},a={L:1,M:0,Q:3,H:2},i={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var w=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],T=1335,k=7973,C=21522,P={},O=function(R){for(var N=0;R!=0;)N+=1,R>>>=1;return N};return P.getBCHTypeInfo=function(R){for(var N=R<<10;O(N)-O(T)>=0;)N^=T<=0;)N^=k<5&&(B+=3+G-5)}for(var D=0;D=256;)P-=255;return w[P]},C}();function c(w,T){if(typeof w.length>"u")throw w.length+"/"+T;var k=function(){for(var P=0;P"u")throw"bad rs block @ typeNumber:"+P+"/errorCorrectionLevel:"+O;for(var N=R.length/3,B=[],D=0;D>>7-C%8&1)==1},k.put=function(C,P){for(var O=0;O>>P-O-1&1)==1)},k.getLengthInBits=function(){return T},k.putBit=function(C){var P=Math.floor(T/8);w.length<=P&&w.push(0),C&&(w[P]|=128>>>T%8),T+=1},k},p=function(w){var T=o.MODE_NUMBER,k=w,C={};C.getMode=function(){return T},C.getLength=function(R){return k.length},C.write=function(R){for(var N=k,B=0;B+2>>8&255)*192+(B&255),O.put(B,13),N+=2}if(N>>8)},T.writeBytes=function(k,C,P){C=C||0,P=P||k.length;for(var O=0;O0&&(k+=","),k+=w[C];return k+="]",k},T},b=function(){var w=0,T=0,k=0,C="",P={},O=function(N){C+=String.fromCharCode(R(N&63))},R=function(N){if(!(N<0)){if(N<26)return 65+N;if(N<52)return 97+(N-26);if(N<62)return 48+(N-52);if(N==62)return 43;if(N==63)return 47}throw"n:"+N};return P.writeByte=function(N){for(w=w<<8|N&255,T+=8,k+=1;T>=6;)O(w>>>T-6),T-=6},P.flush=function(){if(T>0&&(O(w<<6-T),w=0,T=0),k%3!=0)for(var N=3-k%3,B=0;B=T.length){if(P==0)return-1;throw"unexpected end of file./"+P}var N=T.charAt(k);if(k+=1,N=="=")return P=0,-1;if(N.match(/^\s$/))continue;C=C<<6|R(N.charCodeAt(0)),P+=6}var B=C>>>P-8&255;return P-=8,B};var R=function(N){if(65<=N&&N<=90)return N-65;if(97<=N&&N<=122)return N-97+26;if(48<=N&&N<=57)return N-48+52;if(N==43)return 62;if(N==47)return 63;throw"c:"+N};return O},x=function(w,T){var k=w,C=T,P=new Array(w*T),O={};O.setPixel=function(D,L,G){P[L*k+D]=G},O.write=function(D){D.writeString("GIF87a"),D.writeShort(k),D.writeShort(C),D.writeByte(128),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(255),D.writeByte(255),D.writeByte(255),D.writeString(","),D.writeShort(0),D.writeShort(0),D.writeShort(k),D.writeShort(C),D.writeByte(0);var L=2,G=N(L);D.writeByte(L);for(var Y=0;G.length-Y>255;)D.writeByte(255),D.writeBytes(G,Y,255),Y+=255;D.writeByte(G.length-Y),D.writeBytes(G,Y,G.length-Y),D.writeByte(0),D.writeString(";")};var R=function(D){var L=D,G=0,Y=0,K={};return K.write=function(Z,re){if(Z>>>re)throw"length over";for(;G+re>=8;)L.writeByte(255&(Z<>>=8-G,Y=0,G=0;Y=Z<0&&L.writeByte(Y)},K},N=function(D){for(var L=1<>6,128|l&63):l<55296||l>=57344?i.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|a.charCodeAt(s)&1023),i.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return i}return o(r)}})(),function(r){e.exports=r()}(function(){return n})})(rT);var FL=rT.exports,BL=_t&&_t.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(fg,"__esModule",{value:!0});var oT=fg.QRCode=void 0,$L=jL,UL=FL,Bf=m,VL=an,zL=function(e){BL(t,e);function t(n){var r=e.call(this,n)||this;return r.canvas=Bf.createRef(),r}return t.utf16to8=function(n){var r="",o,a,i=n.length;for(o=0;o=1&&a<=127?r+=n.charAt(o):a>2047?(r+=String.fromCharCode(224|a>>12&15),r+=String.fromCharCode(128|a>>6&63),r+=String.fromCharCode(128|a>>0&63)):(r+=String.fromCharCode(192|a>>6&31),r+=String.fromCharCode(128|a>>0&63));return r},t.prototype.drawRoundedSquare=function(n,r,o,a,i,s,l,c){c.lineWidth=n,c.fillStyle=i,c.strokeStyle=i,o+=n/2,r+=n/2,a-=n,Array.isArray(s)||(s=[s,s,s,s]),s=s.map(function(v){return v=Math.min(v,a/2),v<0?0:v});var u=s[0]||0,d=s[1]||0,p=s[2]||0,g=s[3]||0;c.beginPath(),c.moveTo(r+u,o),c.lineTo(r+a-d,o),d&&c.quadraticCurveTo(r+a,o,r+a,o+d),c.lineTo(r+a,o+a-p),p&&c.quadraticCurveTo(r+a,o+a,r+a-p,o+a),c.lineTo(r+g,o+a),g&&c.quadraticCurveTo(r,o+a,r,o+a-g),c.lineTo(r,o+u),u&&c.quadraticCurveTo(r,o,r+u,o),c.closePath(),c.stroke(),l&&c.fill()},t.prototype.drawPositioningPattern=function(n,r,o,a,i,s,l){l===void 0&&(l=[0,0,0,0]);var c=Math.ceil(r),u,d;typeof l!="number"&&!Array.isArray(l)?(u=l.outer||0,d=l.inner||0):(u=l,d=u);var p,g;typeof s!="string"?(p=s.outer,g=s.inner):(p=s,g=s);var v=a*r+o,h=i*r+o,_=r*7;this.drawRoundedSquare(c,h,v,_,p,u,!1,n),_=r*3,v+=r*2,h+=r*2,this.drawRoundedSquare(c,h,v,_,g,d,!0,n)},t.prototype.isInPositioninZone=function(n,r,o){return o.some(function(a){return r>=a.row&&r<=a.row+7&&n>=a.col&&n<=a.col+7})},t.prototype.transformPixelLengthIntoNumberOfCells=function(n,r){return n/r},t.prototype.isCoordinateInImage=function(n,r,o,a,i,s,l,c){if(c){var u=2,d=this.transformPixelLengthIntoNumberOfCells(i,l),p=this.transformPixelLengthIntoNumberOfCells(s,l),g=this.transformPixelLengthIntoNumberOfCells(o,l)-1,v=this.transformPixelLengthIntoNumberOfCells(a,l)-1;return r>=d-u&&r<=d+g+u&&n>=p-u&&n<=p+v+u}else return!1},t.prototype.shouldComponentUpdate=function(n){return!$L(this.props,n)},t.prototype.componentDidMount=function(){this.update()},t.prototype.componentDidUpdate=function(){this.update()},t.prototype.update=function(){var n=this.props,r=n.value,o=n.ecLevel,a=n.enableCORS,i=n.bgColor,s=n.fgColor,l=n.logoImage,c=n.logoOpacity,u=n.logoOnLoad,d=n.removeQrCodeBehindLogo,p=n.qrStyle,g=n.eyeRadius,v=n.eyeColor,h=n.logoPaddingStyle,_=+this.props.size,b=+this.props.quietZone,y=this.props.logoWidth?+this.props.logoWidth:0,x=this.props.logoHeight?+this.props.logoHeight:0,E=this.props.logoPadding?+this.props.logoPadding:0,w=UL(0,o);w.addData(t.utf16to8(r)),w.make();var T=VL.findDOMNode(this.canvas.current),k=T.getContext("2d"),C=_+2*b,P=w.getModuleCount(),O=_/P,R=window.devicePixelRatio||1;T.height=T.width=C*R,k.scale(R,R),k.fillStyle=i,k.fillRect(0,0,C,C);var N=b,B=[{row:0,col:0},{row:0,col:P-7},{row:P-7,col:0}];if(k.strokeStyle=s,p==="dots"){k.fillStyle=s;for(var D=O/2,L=0;L0&&!w.isDark(L-1,G)&&G>0&&!w.isDark(L,G-1)&&(Y[0]=!0),L>0&&!w.isDark(L-1,G)&&G0&&!w.isDark(L,G-1)&&(Y[3]=!0);var K=Math.ceil((G+1)*O)-Math.floor(G*O),Z=Math.ceil((L+1)*O)-Math.floor(L*O);k.fillStyle=s,k.beginPath(),k.arc(Math.round(G*O)+D+N,Math.round(L*O)+D+N,D,0,2*Math.PI,!1),k.closePath(),k.fill(),Y[0]||k.fillRect(Math.round(G*O)+N,Math.round(L*O)+N,K/2,Z/2),Y[1]||k.fillRect(Math.round(G*O)+N+Math.floor(K/2),Math.round(L*O)+N,K/2,Z/2),Y[2]||k.fillRect(Math.round(G*O)+N+Math.floor(K/2),Math.round(L*O)+N+Math.floor(Z/2),K/2,Z/2),Y[3]||k.fillRect(Math.round(G*O)+N,Math.round(L*O)+N+Math.floor(Z/2),K/2,Z/2)}}else for(var L=0;L{const[o,a]=m.useState([0]),[i,s]=m.useState(""),[l,c]=m.useState(),u=m.useMemo(()=>Array.from(r.values()),[r]);return m.useEffect(()=>{const d=u.filter(v=>o.includes(v.index)).map(v=>v.settings).filter(v=>!!v),p=new pe.AppOnly.ChannelSet(new pe.AppOnly.ChannelSet({loraConfig:n,settings:d})),g=fr(p.toBinary()).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");s(`https://meshtastic.org/e/${l?"?add=true":""}#${g}`)},[u,o,l,n]),f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Generate QR Code"}),f.jsx(To,{children:"The current LoRa configuration will also be shared."})]}),f.jsxs("div",{className:"grid gap-4 py-4",children:[f.jsxs("div",{className:"flex gap-3 px-4 py-5 sm:p-6",children:[f.jsx("div",{className:"flex w-40 flex-col gap-2",children:u.map(d=>f.jsxs("div",{className:"flex justify-between",children:[f.jsx(xn,{children:d.settings?.name.length?d.settings.name:d.role===pe.Channel.Channel_Role.PRIMARY?"Primary":`Channel: ${d.index}`}),f.jsx(dg,{checked:o.includes(d.index),onCheckedChange:()=>{o.includes(d.index)?a(o.filter(p=>p!==d.index)):a([...o,d.index])}},d.index)]},d.index))}),f.jsx(oT,{value:i,size:200,qrStyle:"dots"})]}),f.jsxs("div",{className:"flex justify-center",children:[f.jsx("button",{type:"button",className:`border-black border-t border-l border-b rounded-l h-10 px-7 py-2 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 ${l?"focus:ring-green-800 bg-green-800 text-white":"focus:ring-slate-400 bg-slate-400 hover:bg-green-600"}`,onClick:()=>c(!0),children:"Add Channels"}),f.jsx("button",{type:"button",className:`border-black border-t border-r border-b rounded-r h-10 px-4 py-2 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 ${l?"focus:ring-slate-400 bg-slate-400 hover:bg-green-600":"focus:ring-green-800 bg-green-800 text-white"}`,onClick:()=>c(!1),children:"Replace Channels"})]})]}),f.jsxs($i,{children:[f.jsx(xn,{children:"Sharable URL"}),f.jsx(jn,{value:i,disabled:!0,action:{icon:qR,onClick(){navigator.clipboard.writeText(i)}}})]})]})})},WL=({open:e,onOpenChange:t})=>{const{connection:n}=Te(),[r,o]=m.useState(5);return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Schedule Reboot"}),f.jsx(To,{children:"Reboot the connected node after x minutes."})]}),f.jsxs("div",{className:"flex gap-2 p-4",children:[f.jsx(jn,{type:"number",value:r,onChange:a=>o(Number.parseInt(a.target.value)),action:{icon:lC,onClick(){n?.reboot(r*60).then(()=>t(!1))}}}),f.jsxs(pt,{className:"w-24",onClick:()=>{n?.reboot(2).then(()=>t(!1))},children:[f.jsx(lp,{className:"mr-2",size:16}),"Now"]})]})]})})},GL=({open:e,onOpenChange:t})=>{const{connection:n}=Te(),[r,o]=m.useState(5);return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Schedule Shutdown"}),f.jsx(To,{children:"Turn off the connected node after x minutes."})]}),f.jsxs("div",{className:"flex gap-2 p-4",children:[f.jsx(jn,{type:"number",value:r,onChange:a=>o(Number.parseInt(a.target.value)),suffix:"Minutes"}),f.jsx(pt,{className:"w-24",onClick:()=>{n?.shutdown(r*60).then(()=>t(!1))},children:f.jsx(lC,{size:16})}),f.jsxs(pt,{className:"w-24",onClick:()=>{n?.shutdown(2).then(()=>()=>t(!1))},children:[f.jsx(hC,{className:"mr-2",size:16}),"Now"]})]})]})})},KL=()=>{const{channels:e,config:t,dialog:n,setDialogOpen:r}=Te();return f.jsxs(f.Fragment,{children:[f.jsx(HL,{open:n.QR,onOpenChange:o=>{r("QR",o)},channels:e,loraConfig:t.lora}),f.jsx(LL,{open:n.import,onOpenChange:o=>{r("import",o)},loraConfig:t.lora}),f.jsx(GL,{open:n.shutdown,onOpenChange:()=>{r("shutdown",!1)}}),f.jsx(WL,{open:n.reboot,onOpenChange:()=>{r("reboot",!1)}}),f.jsx(ML,{open:n.deviceName,onOpenChange:o=>{r("deviceName",o)}}),f.jsx(PL,{open:n.nodeRemoval,onOpenChange:o=>{r("nodeRemoval",o)}})]})},pg=(e,t)=>{let n=0;t.events.onDeviceMetadataPacket.subscribe(r=>{e.addMetadata(r.from,r.data)}),t.events.onRoutingPacket.subscribe(r=>{switch(r.data.variant.case){case"errorReason":{if(r.data.variant.value===pe.Mesh.Routing_Error.NONE)return;console.log(`Routing Error: ${r.data.variant.value}`);break}case"routeReply":{console.log(`Route Reply: ${r.data.variant.value}`);break}case"routeRequest":{console.log(`Route Request: ${r.data.variant.value}`);break}}}),t.events.onTelemetryPacket.subscribe(r=>{}),t.events.onDeviceStatus.subscribe(r=>{e.setStatus(r)}),t.events.onWaypointPacket.subscribe(r=>{const{data:o,...a}=r;e.addWaypoint(o)}),t.events.onMyNodeInfo.subscribe(r=>{e.setHardware(r),n=r.myNodeNum}),t.events.onUserPacket.subscribe(r=>{e.addUser(r)}),t.events.onPositionPacket.subscribe(r=>{e.addPosition(r)}),t.events.onNodeInfoPacket.subscribe(r=>{e.addNodeInfo(r)}),t.events.onChannelPacket.subscribe(r=>{e.addChannel(r)}),t.events.onConfigPacket.subscribe(r=>{e.setConfig(r)}),t.events.onModuleConfigPacket.subscribe(r=>{e.setModuleConfig(r)}),t.events.onMessagePacket.subscribe(r=>{e.addMessage({...r,state:r.from!==n?"ack":"waiting"})}),t.events.onTraceRoutePacket.subscribe(r=>{e.addTraceRoute({...r})}),t.events.onPendingSettingsChange.subscribe(r=>{e.setPendingSettingsChanges(r)}),t.events.onMeshPacket.subscribe(r=>{e.processPacket({from:r.from,snr:r.rxSnr,time:r.rxTime})})},mg=()=>Math.floor(Math.random()*1e9),qL=({closeDialog:e})=>{const[t,n]=m.useState([]),{addDevice:r}=ca(),{setSelectedDevice:o}=$n(),a=m.useCallback(async()=>{n(await navigator.bluetooth.getDevices())},[]);m.useEffect(()=>{a()},[a]);const i=async s=>{const l=mg(),c=r(l);o(l);const u=new CP(l);await u.connect({device:s}),c.addConnection(u),pg(c,u),e()};return f.jsxs("div",{className:"flex w-full flex-col gap-2 p-4",children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2 overflow-y-auto",children:[t.map(s=>f.jsx(pt,{onClick:()=>{i(s)},children:s.name},s.id)),t.length===0&&f.jsx(Do,{className:"m-auto select-none",children:"No devices paired yet."})]}),f.jsx(pt,{onClick:async()=>{await navigator.bluetooth.requestDevice({filters:[{services:[iN.ServiceUuid]}]}).then(s=>{t.findIndex(c=>c.id===s.id)===-1&&n(t.concat(s))})},children:f.jsx("span",{children:"New device"})})]})},XL=({closeDialog:e})=>{const{addDevice:t}=ca(),{setSelectedDevice:n}=$n(),{register:r,handleSubmit:o,control:a}=Eh({defaultValues:{ip:["client.meshtastic.org","localhost"].includes(window.location.hostname)?"meshtastic.local":window.location.hostname,tls:location.protocol==="https:"}}),i=$x({control:a,name:"tls",defaultValue:location.protocol==="https:"}),[s,l]=m.useState(!1),c=o(async u=>{l(!0);const d=mg(),p=t(d),g=new SP(d);await g.connect({address:u.ip,fetchInterval:2e3,tls:u.tls}),n(d),p.addConnection(g),pg(p,g),e()});return f.jsxs("form",{className:"flex w-full flex-col gap-2 p-4",onSubmit:c,children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2",children:[f.jsx(xn,{children:"IP Address/Hostname"}),f.jsx(jn,{prefix:i?"https://":"http://",placeholder:"000.000.000.000 / meshtastic.local",disabled:s,...r("ip")}),f.jsx(ml,{name:"tls",control:a,render:({field:{value:u,...d}})=>f.jsxs(f.Fragment,{children:[f.jsx(xn,{children:"Use TLS"}),f.jsx(md,{disabled:location.protocol==="https:"||s,checked:u,...d})]})})]}),f.jsx(pt,{type:"submit",disabled:s,children:f.jsx("span",{children:s?"Connecting...":"Connect"})})]})},YL=({closeDialog:e})=>{const[t,n]=m.useState([]),{addDevice:r}=ca(),{setSelectedDevice:o}=$n(),a=m.useCallback(async()=>{n(await navigator.serial.getPorts())},[]);navigator.serial.addEventListener("connect",()=>{a()}),navigator.serial.addEventListener("disconnect",()=>{a()}),m.useEffect(()=>{a()},[a]);const i=async s=>{const l=mg(),c=r(l);o(l);const u=new TP(l);await u.connect({port:s,baudRate:void 0,concurrentLogOutput:!0}).catch(d=>console.log(`Unable to Connect: ${d.message}`)),c.addConnection(u),pg(c,u),e()};return f.jsxs("div",{className:"flex w-full flex-col gap-2 p-4",children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2 overflow-y-auto",children:[t.map((s,l)=>{const{usbProductId:c,usbVendorId:u}=s.getInfo();return f.jsx(pt,{disabled:s.readable!==null,onClick:async()=>{await i(s)},children:`# ${l} - ${u??"UNK"} - ${c??"UNK"}`},`${u??"UNK"}-${c??"UNK"}-${l}`)}),t.length===0&&f.jsx(Do,{className:"m-auto select-none",children:"No devices paired yet."})]}),f.jsx(pt,{onClick:async()=>{await navigator.serial.requestPort().then(s=>{n(t.concat(s))})},children:f.jsx("span",{children:"New device"})})]})},A1=({href:e,children:t})=>f.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-slate-900 underline underline-offset-4 dark:text-slate-50",children:t}),R1=[{label:"HTTP",element:XL,disabled:!1,disabledMessage:"Unsuported connection method"},{label:"Bluetooth",element:qL,disabled:!navigator.bluetooth,disabledMessage:"Web Bluetooth is currently only supported by Chromium-based browsers",disabledLink:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility"},{label:"Serial",element:YL,disabled:!navigator.serial,disabledMessage:"WebSerial is currently only supported by Chromium based browsers: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility"}],QL=({open:e,onOpenChange:t})=>f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsx(Rr,{children:f.jsx(Ir,{children:"Connect New Device"})}),f.jsxs(od,{defaultValue:"HTTP",children:[f.jsx(cl,{children:R1.map(n=>f.jsx(ul,{value:n.label,disabled:n.disabled,children:n.label},n.label))}),R1.map(n=>f.jsx(dl,{value:n.label,children:n.disabled?f.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:n.disabledMessage}):f.jsx(n.element,{closeDialog:()=>t(!1)})},n.label))]}),(!navigator.bluetooth||!navigator.serial)&&f.jsxs(f.Fragment,{children:[f.jsx(wn,{children:"Web Bluetooth and Web Serial are currently only supported by Chromium-based browsers."}),f.jsxs(wn,{children:["Read more: ",f.jsx(A1,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility",children:"Web Bluetooth"})," ",f.jsx(A1,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility",children:"Web Serial"})]})]})]})});var hg="ToastProvider",[gg,ZL,JL]=hh("Toast"),[aT,I7]=Pr("Toast",[JL]),[e7,Td]=aT(hg),iT=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:i}=e,[s,l]=m.useState(null),[c,u]=m.useState(0),d=m.useRef(!1),p=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${hg}\`. Expected non-empty \`string\`.`),f.jsx(gg.Provider,{scope:t,children:f.jsx(e7,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:c,viewport:s,onViewportChange:l,onToastAdd:m.useCallback(()=>u(g=>g+1),[]),onToastRemove:m.useCallback(()=>u(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:p,children:i})})};iT.displayName=hg;var sT="ToastViewport",t7=["F8"],Tp="toast.viewportPause",Ep="toast.viewportResume",lT=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=t7,label:o="Notifications ({hotkey})",...a}=e,i=Td(sT,n),s=ZL(n),l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),p=$e(t,d,i.onViewportChange),g=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;m.useEffect(()=>{const _=b=>{r.every(x=>b[x]||b.code===x)&&d.current?.focus()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[r]),m.useEffect(()=>{const _=l.current,b=d.current;if(v&&_&&b){const y=()=>{if(!i.isClosePausedRef.current){const T=new CustomEvent(Tp);b.dispatchEvent(T),i.isClosePausedRef.current=!0}},x=()=>{if(i.isClosePausedRef.current){const T=new CustomEvent(Ep);b.dispatchEvent(T),i.isClosePausedRef.current=!1}},E=T=>{!_.contains(T.relatedTarget)&&x()},w=()=>{_.contains(document.activeElement)||x()};return _.addEventListener("focusin",y),_.addEventListener("focusout",E),_.addEventListener("pointermove",y),_.addEventListener("pointerleave",w),window.addEventListener("blur",y),window.addEventListener("focus",x),()=>{_.removeEventListener("focusin",y),_.removeEventListener("focusout",E),_.removeEventListener("pointermove",y),_.removeEventListener("pointerleave",w),window.removeEventListener("blur",y),window.removeEventListener("focus",x)}}},[v,i.isClosePausedRef]);const h=m.useCallback(({tabbingDirection:_})=>{const y=s().map(x=>{const E=x.ref.current,w=[E,...m7(E)];return _==="forwards"?w:w.reverse()});return(_==="forwards"?y.reverse():y).flat()},[s]);return m.useEffect(()=>{const _=d.current;if(_){const b=y=>{const x=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!x){const w=document.activeElement,T=y.shiftKey;if(y.target===_&&T){c.current?.focus();return}const P=h({tabbingDirection:T?"backwards":"forwards"}),O=P.findIndex(R=>R===w);$f(P.slice(O+1))?y.preventDefault():T?c.current?.focus():u.current?.focus()}};return _.addEventListener("keydown",b),()=>_.removeEventListener("keydown",b)}},[s,h]),f.jsxs(dM,{ref:l,role:"region","aria-label":o.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&f.jsx(Np,{ref:c,onFocusFromOutsideViewport:()=>{const _=h({tabbingDirection:"forwards"});$f(_)}}),f.jsx(gg.Slot,{scope:n,children:f.jsx(xe.ol,{tabIndex:-1,...a,ref:p})}),v&&f.jsx(Np,{ref:u,onFocusFromOutsideViewport:()=>{const _=h({tabbingDirection:"backwards"});$f(_)}})]})});lT.displayName=sT;var cT="ToastFocusProxy",Np=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,a=Td(cT,n);return f.jsx(cd,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{const s=i.relatedTarget;!a.viewport?.contains(s)&&r()}})});Np.displayName=cT;var Ed="Toast",n7="toast.swipeStart",r7="toast.swipeMove",o7="toast.swipeCancel",a7="toast.swipeEnd",uT=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...i}=e,[s=!0,l]=go({prop:r,defaultProp:o,onChange:a});return f.jsx(ua,{present:n||s,children:f.jsx(l7,{open:s,...i,ref:t,onClose:()=>l(!1),onPause:Wt(e.onPause),onResume:Wt(e.onResume),onSwipeStart:we(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:we(e.onSwipeMove,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:we(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:we(e.onSwipeEnd,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});uT.displayName=Ed;var[i7,s7]=aT(Ed,{onClose(){}}),l7=m.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:i,onEscapeKeyDown:s,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:p,onSwipeEnd:g,...v}=e,h=Td(Ed,n),[_,b]=m.useState(null),y=$e(t,D=>b(D)),x=m.useRef(null),E=m.useRef(null),w=o||h.duration,T=m.useRef(0),k=m.useRef(w),C=m.useRef(0),{onToastAdd:P,onToastRemove:O}=h,R=Wt(()=>{_?.contains(document.activeElement)&&h.viewport?.focus(),i()}),N=m.useCallback(D=>{!D||D===1/0||(window.clearTimeout(C.current),T.current=new Date().getTime(),C.current=window.setTimeout(R,D))},[R]);m.useEffect(()=>{const D=h.viewport;if(D){const L=()=>{N(k.current),c?.()},G=()=>{const Y=new Date().getTime()-T.current;k.current=k.current-Y,window.clearTimeout(C.current),l?.()};return D.addEventListener(Tp,G),D.addEventListener(Ep,L),()=>{D.removeEventListener(Tp,G),D.removeEventListener(Ep,L)}}},[h.viewport,w,l,c,N]),m.useEffect(()=>{a&&!h.isClosePausedRef.current&&N(w)},[a,w,h.isClosePausedRef,N]),m.useEffect(()=>(P(),()=>O()),[P,O]);const B=m.useMemo(()=>_?vT(_):null,[_]);return h.viewport?f.jsxs(f.Fragment,{children:[B&&f.jsx(c7,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:B}),f.jsx(i7,{scope:n,onClose:R,children:an.createPortal(f.jsx(gg.ItemSlot,{scope:n,children:f.jsx(uM,{asChild:!0,onEscapeKeyDown:we(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||R(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:f.jsx(xe.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:y,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:we(e.onKeyDown,D=>{D.key==="Escape"&&(s?.(D.nativeEvent),D.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,R()))}),onPointerDown:we(e.onPointerDown,D=>{D.button===0&&(x.current={x:D.clientX,y:D.clientY})}),onPointerMove:we(e.onPointerMove,D=>{if(!x.current)return;const L=D.clientX-x.current.x,G=D.clientY-x.current.y,Y=!!E.current,K=["left","right"].includes(h.swipeDirection),Z=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,re=K?Z(0,L):0,fe=K?0:Z(0,G),U=D.pointerType==="touch"?10:2,ae={x:re,y:fe},se={originalEvent:D,delta:ae};Y?(E.current=ae,sc(r7,d,se,{discrete:!1})):I1(ae,h.swipeDirection,U)?(E.current=ae,sc(n7,u,se,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(L)>U||Math.abs(G)>U)&&(x.current=null)}),onPointerUp:we(e.onPointerUp,D=>{const L=E.current,G=D.target;if(G.hasPointerCapture(D.pointerId)&&G.releasePointerCapture(D.pointerId),E.current=null,x.current=null,L){const Y=D.currentTarget,K={originalEvent:D,delta:L};I1(L,h.swipeDirection,h.swipeThreshold)?sc(a7,g,K,{discrete:!0}):sc(o7,p,K,{discrete:!0}),Y.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),c7=e=>{const{__scopeToast:t,children:n,...r}=e,o=Td(Ed,t),[a,i]=m.useState(!1),[s,l]=m.useState(!1);return f7(()=>i(!0)),m.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),s?null:f.jsx(ld,{asChild:!0,children:f.jsx(cd,{...r,children:a&&f.jsxs(f.Fragment,{children:[o.label," ",n]})})})},u7="ToastTitle",dT=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.jsx(xe.div,{...r,ref:t})});dT.displayName=u7;var d7="ToastDescription",fT=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.jsx(xe.div,{...r,ref:t})});fT.displayName=d7;var pT="ToastAction",mT=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?f.jsx(gT,{altText:n,asChild:!0,children:f.jsx(vg,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${pT}\`. Expected non-empty \`string\`.`),null)});mT.displayName=pT;var hT="ToastClose",vg=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=s7(hT,n);return f.jsx(gT,{asChild:!0,children:f.jsx(xe.button,{type:"button",...r,ref:t,onClick:we(e.onClick,o.onClose)})})});vg.displayName=hT;var gT=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return f.jsx(xe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function vT(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),p7(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...vT(r))}}),t}function sc(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ax(o,a):o.dispatchEvent(a)}var I1=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),a=r>o;return t==="left"||t==="right"?a&&r>n:!a&&o>n};function f7(e=()=>{}){const t=Wt(e);Mt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function p7(e){return e.nodeType===e.ELEMENT_NODE}function m7(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $f(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var h7=iT,yT=lT,bT=uT,wT=dT,_T=fT,xT=mT,kT=vg;const g7=h7,CT=m.forwardRef(({className:e,...t},n)=>f.jsx(yT,{ref:n,className:Ee("fixed top-0 z-50 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));CT.displayName=yT.displayName;const v7=wh("data-[swipe=move]:transition-none grow-1 group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full mt-4 data-[state=closed]:slide-out-to-right-full dark:border-slate-700 last:mt-0 sm:last:mt-4",{variants:{variant:{default:"bg-white border-slate-200 dark:bg-slate-800 dark:border-slate-700",destructive:"group destructive bg-red-600 text-white border-red-600 dark:border-red-600"}},defaultVariants:{variant:"default"}}),ST=m.forwardRef(({className:e,variant:t,...n},r)=>f.jsx(bT,{ref:r,className:Ee(v7({variant:t}),e),...n}));ST.displayName=bT.displayName;const y7=m.forwardRef(({className:e,...t},n)=>f.jsx(xT,{ref:n,className:Ee("inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-slate-200 bg-transparent px-3 text-sm font-medium transition-colors hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-red-100 group-[.destructive]:hover:border-slate-50 group-[.destructive]:hover:bg-red-100 group-[.destructive]:hover:text-red-600 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:border-slate-700 dark:text-slate-100 dark:hover:bg-slate-700 dark:hover:text-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800",e),...t}));y7.displayName=xT.displayName;const TT=m.forwardRef(({className:e,...t},n)=>f.jsx(kT,{ref:n,className:Ee("absolute right-2 top-2 rounded-md p-1 text-slate-500 opacity-0 transition-opacity hover:text-slate-900 focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:hover:text-slate-50",e),"toast-close":"",...t,children:f.jsx(yC,{className:"h-4 w-4"})}));TT.displayName=kT.displayName;const ET=m.forwardRef(({className:e,...t},n)=>f.jsx(wT,{ref:n,className:Ee("text-sm font-semibold",e),...t}));ET.displayName=wT.displayName;const NT=m.forwardRef(({className:e,...t},n)=>f.jsx(_T,{ref:n,className:Ee("text-sm opacity-90",e),...t}));NT.displayName=_T.displayName;function b7(){const{toasts:e}=hd();return f.jsxs(g7,{children:[e.map(({id:t,title:n,description:r,action:o,...a})=>f.jsxs(ST,{...a,children:[f.jsxs("div",{className:"grid gap-1",children:[n&&f.jsx(ET,{className:"dark:text-white",children:n}),r&&f.jsx(NT,{className:"dark:text-white-400",children:r})]}),o,f.jsx(TT,{})]},t)),f.jsx(CT,{})]})}const w7=({children:e})=>{const{darkMode:t,accent:n}=$n();return f.jsx("div",{"data-theme":t?"dark":"light","data-accent":n,children:e})},O1=({children:e})=>f.jsx("h3",{className:"scroll-m-20 text-2xl font-semibold tracking-tight",children:e}),_7=()=>{const{setConnectDialogOpen:e}=$n(),{getDevices:t}=ca(),n=m.useMemo(()=>t(),[t]);return f.jsx(f.Fragment,{children:f.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"space-y-1",children:[f.jsx(O1,{children:"Connected Devices"}),f.jsx(wn,{children:"Manage, connect and disconnect devices"})]})}),f.jsx(Cu,{}),f.jsx("div",{className:"flex h-[450px] rounded-md border border-dashed border-slate-200 p-3 dark:border-slate-700",children:n.length?f.jsx("ul",{className:"grow divide-y divide-gray-200",children:n.map(r=>f.jsx("li",{children:f.jsxs("div",{className:"px-4 py-4 sm:px-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("p",{className:"truncate text-sm font-medium text-accent",children:r.nodes.get(r.hardware.myNodeNum)?.user?.longName??"UNK"}),f.jsxs("div",{className:"inline-flex w-24 justify-center gap-2 rounded-full bg-slate-100 py-1 text-xs font-semibold text-slate-900 transition-colors hover:bg-slate-700 hover:text-slate-50",children:[r.connection?.connType==="ble"&&f.jsxs(f.Fragment,{children:[f.jsx(zR,{size:16}),"BLE"]}),r.connection?.connType==="serial"&&f.jsxs(f.Fragment,{children:[f.jsx(m6,{size:16}),"Serial"]}),r.connection?.connType==="http"&&f.jsxs(f.Fragment,{children:[f.jsx(i6,{size:16}),"Network"]})]})]}),f.jsx("div",{className:"mt-2 sm:flex sm:justify-between",children:f.jsxs("div",{className:"flex gap-2 text-sm text-gray-500",children:[f.jsx(Gh,{size:20,className:"text-gray-400","aria-hidden":"true"}),r.nodes.size===0?0:r.nodes.size-1]})})]})},r.id))}):f.jsxs("div",{className:"m-auto flex flex-col gap-3 text-center",children:[f.jsx(o6,{size:48,className:"mx-auto text-textSecondary"}),f.jsx(O1,{children:"No Devices"}),f.jsx(wn,{children:"Connect at least one device to get started"}),f.jsxs(pt,{className:"gap-2",onClick:()=>e(!0),children:[f.jsx(Hh,{size:16}),"New Connection"]})]})})]})})},x7=()=>{const{getDevice:e}=ca(),{selectedDevice:t,setConnectDialogOpen:n,connectDialogOpen:r}=$n(),o=e(t);return f.jsxs(w7,{children:[f.jsx(QL,{open:r,onOpenChange:a=>{n(a)}}),f.jsx(b7,{}),f.jsx(ZO,{children:f.jsx(EP,{device:o,children:f.jsx("div",{className:"flex h-screen flex-col overflow-hidden bg-backgroundPrimary text-textPrimary",children:f.jsxs("div",{className:"flex flex-grow",children:[f.jsx(NL,{}),f.jsx("div",{className:"flex flex-grow flex-col",children:o?f.jsxs("div",{className:"flex h-screen",children:[f.jsx(KL,{}),f.jsx(xL,{}),f.jsx(qD,{})]}):f.jsxs(f.Fragment,{children:[f.jsx(_7,{}),f.jsx("div",{className:"flex flex-grow"}),f.jsx(Qh,{})]})})]})})})})]})},k7=document.getElementById("root"),C7=e2(k7);$E();C7.render(f.jsx(m.StrictMode,{children:f.jsx(x7,{})}));export{_t as c,Pp as g}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css deleted file mode 100644 index fe87e3c..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter var,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Cascadia Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.-left-2{left:-.5rem}.left-2{left:.5rem}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.z-50{z-index:50}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-auto{margin-top:auto;margin-bottom:auto}.mb-2{margin-bottom:.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[24px\]{height:24px}.h-\[450px\]{height:450px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[300px\]{max-height:300px}.max-h-screen{max-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-\[1px\]{width:1px}.w-\[44px\]{width:44px}.w-full{width:100%}.min-w-\[100px\]{min-width:100px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[280px\]{min-width:280px}.min-w-\[8rem\]{min-width:8rem}.min-w-full{min-width:100%}.\!max-w-max{max-width:-moz-max-content!important;max-width:max-content!important}.max-w-lg{max-width:32rem}.max-w-min{max-width:-moz-min-content;max-width:min-content}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.scroll-m-20{scroll-margin:5rem}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-hidden{overflow-y:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-\[0\.185rem\]{border-radius:.185rem}.rounded-\[0\.2rem\]{border-radius:.2rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-md{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-\[0\.5px\]{border-bottom-width:.5px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-\[0\.5px\]{border-right-width:.5px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.border-slate-400{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-b-slate-100{--tw-border-opacity: 1;border-bottom-color:rgb(241 245 249 / var(--tw-border-opacity))}.border-b-slate-200{--tw-border-opacity: 1;border-bottom-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-backgroundPrimary{border-left-color:var(--backgroundPrimary)}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#2093fe\]{--tw-bg-opacity: 1;background-color:rgb(32 147 254 / var(--tw-bg-opacity))}.bg-\[\#27a341\]{--tw-bg-opacity: 1;background-color:rgb(39 163 65 / var(--tw-bg-opacity))}.bg-\[\#70afea\]{--tw-bg-opacity: 1;background-color:rgb(112 175 234 / var(--tw-bg-opacity))}.bg-\[\#8bc9c5\]{--tw-bg-opacity: 1;background-color:rgb(139 201 197 / var(--tw-bg-opacity))}.bg-\[\#926bff\]{--tw-bg-opacity: 1;background-color:rgb(146 107 255 / var(--tw-bg-opacity))}.bg-\[\#a09eef\]{--tw-bg-opacity: 1;background-color:rgb(160 158 239 / var(--tw-bg-opacity))}.bg-\[\#ac8c1a\]{--tw-bg-opacity: 1;background-color:rgb(172 140 26 / var(--tw-bg-opacity))}.bg-\[\#dba0c7\]{--tw-bg-opacity: 1;background-color:rgb(219 160 199 / var(--tw-bg-opacity))}.bg-\[\#e0cc87\]{--tw-bg-opacity: 1;background-color:rgb(224 204 135 / var(--tw-bg-opacity))}.bg-\[\#e1720b\]{--tw-bg-opacity: 1;background-color:rgb(225 114 11 / var(--tw-bg-opacity))}.bg-\[\#e454c4\]{--tw-bg-opacity: 1;background-color:rgb(228 84 196 / var(--tw-bg-opacity))}.bg-\[\#edb17a\]{--tw-bg-opacity: 1;background-color:rgb(237 177 122 / var(--tw-bg-opacity))}.bg-\[\#f25555\]{--tw-bg-opacity: 1;background-color:rgb(242 85 85 / var(--tw-bg-opacity))}.bg-\[\#f28585\]{--tw-bg-opacity: 1;background-color:rgb(242 133 133 / var(--tw-bg-opacity))}.bg-accent{background-color:var(--accent)}.bg-backgroundPrimary{background-color:var(--backgroundPrimary)}.bg-black\/50{background-color:#00000080}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-green-800{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fill-current{fill:currentColor}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[0\.3rem\]{padding-left:.3rem;padding-right:.3rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-\[0\.2rem\]{padding-top:.2rem;padding-bottom:.2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:Cascadia Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-7{line-height:1.75rem}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent{color:var(--accent)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-textPrimary{color:var(--textPrimary)}.text-textSecondary{color:var(--textSecondary)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.brightness-hover{--tw-brightness: brightness(var(--brighnessHover));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-brightness-press{--tw-backdrop-brightness: brightness(var(--brightnessPress));-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in{--tw-enter-opacity: 0}.fade-in-50{--tw-enter-opacity: .5}.fade-in-80{--tw-enter-opacity: .8}.fade-in-90{--tw-enter-opacity: .9}.slide-in-from-bottom-10{--tw-enter-translate-y: 2.5rem}.slide-in-from-left-1{--tw-enter-translate-x: -.25rem}.slide-in-from-top-1{--tw-enter-translate-y: -.25rem}.duration-300{animation-duration:.3s}:root{--backgroundPrimary: #ffffff;--backgroundSecondary: #e6e9ed;--textPrimary: #111132;--textSecondary: #64748b;--link: #0b69bf;--brighnessHover: .95;--brightnessPress: 1.05;--brightnessDisabled: .75}[data-theme=dark]{--backgroundPrimary: #0f172a;--backgroundSecondary: #363638;--textPrimary: #ebebeb;--textSecondary: #bdbdbd;--link: #8ec9ff;--brighnessHover: 1.1;--brightnessPress: .9;--brightnessDisabled: .75}[data-accent=red]{--accent: #f28585;--accentMuted: #f4abab}[data-accent=red][data-theme=dark]{--accent: #f25555;--accentMuted: #b04749}[data-accent=orange]{--accent: #edb17a;--accentMuted: #efc7a4}[data-accent=orange][data-theme=dark]{--accent: #e1720b;--accentMuted: #a55c17}[data-accent=yellow]{--accent: #e0cc87;--accentMuted: #e8daad}[data-accent=yellow][data-theme=dark]{--accent: #ac8c1a;--accentMuted: #826c22}[data-accent=green]{--accent: #8bc9c5;--accentMuted: #afd7d5}[data-accent=green][data-theme=dark]{--accent: #27a341;--accentMuted: #297b3b}[data-accent=blue]{--accent: #70afea;--accentMuted: #9cc7ee}[data-accent=blue][data-theme=dark]{--accent: #2093fe;--accentMuted: #2471ba}[data-accent=purple]{--accent: #a09eef;--accentMuted: #bcbcf1}[data-accent=purple][data-theme=dark]{--accent: #926bff;--accentMuted: #7057bb}[data-accent=pink]{--accent: #dba0c7;--accentMuted: #e3bcd7}[data-accent=pink][data-theme=dark]{--accent: #e454c4;--accentMuted: #a84892}img{-drag:none;-webkit-user-drag:none}.placeholder\:text-slate-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-slate-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.first\:mt-0:first-child{margin-top:0}.first\:pl-2:first-child{padding-left:.5rem}.last\:mt-0:last-child{margin-top:0}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.hover\:bg-transparent:hover{background-color:transparent}.hover\:text-accent:hover{color:var(--accent)}.hover\:text-gray-400:hover{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.hover\:text-slate-50:hover{--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-hover:hover{--tw-brightness: brightness(var(--brighnessHover));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:bg-slate-100:focus{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-green-800:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(22 101 52 / var(--tw-ring-opacity))}.focus\:ring-slate-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(148 163 184 / var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.active\:brightness-press:active{--tw-brightness: brightness(var(--brightnessPress));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-slate-50:hover{--tw-border-opacity: 1;border-color:rgb(248 250 252 / var(--tw-border-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-slate-100[aria-selected=true]{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.data-\[disabled\=\'true\'\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-white[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.data-\[state\=checked\]\:bg-slate-900[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.data-\[state\=open\]\:bg-slate-100[data-state=open]{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.data-\[state\=open\]\:bg-transparent[data-state=open]{background-color:transparent}.data-\[state\=unchecked\]\:bg-slate-200[data-state=unchecked]{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.data-\[state\=active\]\:text-slate-900[data-state=active]{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.data-\[disabled\=\'true\'\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[side\=bottom\]\:slide-in-from-top-1[data-side=bottom]{--tw-enter-translate-y: -.25rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-1[data-side=left]{--tw-enter-translate-x: .25rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-1[data-side=right]{--tw-enter-translate-x: -.25rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-1[data-side=top]{--tw-enter-translate-y: .25rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.dark\:border-red-500:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.dark\:border-red-600:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity))}.dark\:border-slate-600:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.dark\:border-slate-700:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:border-slate-800:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.dark\:border-b-slate-700:is([data-theme=dark] *){--tw-border-opacity: 1;border-bottom-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:bg-slate-50:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.dark\:bg-slate-700:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:bg-slate-800:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:bg-slate-900:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.dark\:text-slate-100:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.dark\:text-slate-200:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.dark\:text-slate-300:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dark\:text-slate-400:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.dark\:text-slate-50:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dark\:text-slate-900:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.dark\:text-white:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-green-600:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.dark\:hover\:bg-red-600:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-700:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-800:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:hover\:bg-transparent:hover:is([data-theme=dark] *){background-color:transparent}.dark\:hover\:text-slate-100:hover:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.dark\:hover\:text-slate-50:hover:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dark\:focus\:bg-slate-700:focus:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:focus\:ring-slate-400:focus:is([data-theme=dark] *){--tw-ring-opacity: 1;--tw-ring-color: rgb(148 163 184 / var(--tw-ring-opacity))}.dark\:focus\:ring-offset-slate-900:focus:is([data-theme=dark] *){--tw-ring-offset-color: #0f172a}.dark\:aria-selected\:bg-slate-700[aria-selected=true]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=active\]\:bg-slate-900[data-state=active]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.dark\:data-\[state\=checked\]\:bg-slate-400[data-state=checked]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-slate-700[data-state=open]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-slate-800[data-state=open]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-transparent[data-state=open]:is([data-theme=dark] *){background-color:transparent}.dark\:data-\[state\=unchecked\]\:bg-slate-700[data-state=unchecked]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=active\]\:text-slate-100[data-state=active]:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:max-w-lg{max-width:32rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:items-center{align-items:center}.sm\:items-baseline{align-items:baseline}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-6{padding:1.5rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-5{padding-top:1.25rem}.sm\:text-left{text-align:left}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:zoom-in-90{--tw-enter-scale: .9}.sm\:slide-in-from-bottom-0{--tw-enter-translate-y: 0px}.sm\:last\:mt-4:last-child{margin-top:1rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:max-w-\[420px\]{max-width:420px}.md\:px-0{padding-left:0;padding-right:0}.md\:px-4{padding-left:1rem;padding-right:1rem}}@media (min-width: 1024px){.lg\:text-5xl{font-size:3rem;line-height:1}}.\[\&\:not\(\:first-child\)\]\:mt-6:not(:first-child){margin-top:1.5rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:pb-1\.5 [cmdk-group-heading]{padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-sm [cmdk-group-heading]{font-size:.875rem;line-height:1.25rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:font-semibold [cmdk-group-heading]{font-weight:600}.\[\&_\[cmdk-group-heading\]\]\:text-slate-500 [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.\[\&_\[cmdk-group-heading\]\]\:text-slate-900 [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.\[\&_\[cmdk-group-heading\]\]\:dark\:text-slate-300:is([data-theme=dark] *) [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group\]_\+\[cmdk-group\]\]\:pt-0 [cmdk-group]+[cmdk-group]{padding-top:0}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_\[dialog-overlay\]\]\:bg-red-100 [dialog-overlay]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html deleted file mode 100644 index eb93d2f..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - Meshtastic Web - - - - -
- - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js deleted file mode 100644 index 62f9248..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js +++ /dev/null @@ -1,2258 +0,0 @@ -import{g as Eb,c as Sb}from"./index-b9vwykds.js";function Mb(Ic,yp){for(var Qa=0;Qahn[dn]})}}}return Object.freeze(Object.defineProperty(Ic,Symbol.toStringTag,{value:"Module"}))}var Y0={exports:{}};(function(Ic,yp){var Qa={};(function(hn,dn){Ic.exports=dn()})(Sb,function(){var hn,dn,ks;function xp(s,pr){if(!hn)hn=pr;else if(!dn)dn=pr;else{var Mr="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+hn+")(sharedChunk); ("+dn+")(sharedChunk); self.onerror = null;",bt={};hn(bt),ks=pr(bt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(ks.workerUrl=window.URL.createObjectURL(new Blob([Mr],{type:"text/javascript"})))}}xp(["exports"],function(s){var pr="3.6.0";let Mr;const bt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Mr==null){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Mr=Qa.API_URL_REGEX!=null?new RegExp(Qa.API_URL_REGEX):t}catch{Mr=t}}return Mr},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!bt.API_URL)return null;try{const t=new URL(bt.API_URL);return t.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":t.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Zt(t){return bt.API_URL_REGEX.test(t)}function Di(t){return t.indexOf("mapbox:")===0}function Nr(t){return bt.API_CDN_URL_REGEX.test(t)}function zn(t){return bt.API_SPRITE_REGEX.test(t)}function to(t){return bt.API_STYLE_REGEX.test(t)&&!zn(t)}const Dn={create:"create",load:"load",fullLoad:"fullLoad"},el={mark(t){performance.mark(t)},measure(t,e,i){performance.measure(t,e,i)}};function Os(t){const e=t.name.split("?")[0];return Nr(e)&&e.includes("mapbox-gl.js")?"javascript":Nr(e)&&e.includes("mapbox-gl.css")?"css":function(i){return bt.API_FONTS_REGEX.test(i)}(e)?"fontRange":zn(e)?"sprite":to(e)?"style":function(i){return bt.API_TILEJSON_REGEX.test(i)}(e)?"tilejson":"other"}function Jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var di={},fi={};Object.defineProperty(fi,"__esModule",{value:!0}),fi.setMatrixArrayType=function(t){fi.ARRAY_TYPE=Do=t},fi.toRadian=function(t){return t*tl},fi.equals=function(t,e){return Math.abs(t-e)<=Rn*Math.max(1,Math.abs(t),Math.abs(e))},fi.RANDOM=fi.ARRAY_TYPE=fi.EPSILON=void 0;var Rn=1e-6;fi.EPSILON=Rn;var Do=typeof Float32Array<"u"?Float32Array:Array;fi.ARRAY_TYPE=Do;var Ac=Math.random;fi.RANDOM=Ac;var tl=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ni={};function Yt(t){return Yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yt(t)}Object.defineProperty(ni,"__esModule",{value:!0}),ni.create=function(){var t=new Vr.ARRAY_TYPE(4);return Vr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},ni.clone=function(t){var e=new Vr.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ni.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ni.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},ni.fromValues=function(t,e,i,n){var o=new Vr.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o},ni.set=function(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t},ni.transpose=function(t,e){if(t===e){var i=e[1];t[1]=e[2],t[2]=i}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},ni.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*l-o*n;return c?(t[0]=l*(c=1/c),t[1]=-n*c,t[2]=-o*c,t[3]=i*c,t):null},ni.adjoint=function(t,e){var i=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=i,t},ni.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},ni.multiply=il,ni.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+l*d,t[1]=o*f+c*d,t[2]=n*-d+l*f,t[3]=o*-d+c*f,t},ni.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=i[0],d=i[1];return t[0]=e[0]*c,t[1]=n*c,t[2]=o*d,t[3]=l*d,t},ni.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t},ni.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},ni.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},ni.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},ni.LDU=function(t,e,i,n){return t[2]=n[2]/n[0],i[0]=n[0],i[1]=n[1],i[3]=n[3]-t[2]*i[1],[t,e,i]},ni.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},ni.subtract=rl,ni.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ni.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],f=e[2],_=e[3];return Math.abs(i-c)<=Vr.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=Vr.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-f)<=Vr.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(l-_)<=Vr.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},ni.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},ni.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},ni.sub=ni.mul=void 0;var Vr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Yt(t)!=="object"&&typeof t!="function")return{default:t};var i=Ro(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Ro(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Ro=function(n){return n?i:e})(t)}function il(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*d+l*f,t[1]=o*d+c*f,t[2]=n*_+l*y,t[3]=o*_+c*y,t}function rl(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}ni.mul=il,ni.sub=rl;var Qt={};function Bs(t){return Bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bs(t)}Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.create=function(){var t=new Ir.ARRAY_TYPE(6);return Ir.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},Qt.clone=function(t){var e=new Ir.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},Qt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},Qt.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},Qt.fromValues=function(t,e,i,n,o,l){var c=new Ir.ARRAY_TYPE(6);return c[0]=t,c[1]=e,c[2]=i,c[3]=n,c[4]=o,c[5]=l,c},Qt.set=function(t,e,i,n,o,l,c){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t},Qt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=i*l-n*o;return f?(t[0]=l*(f=1/f),t[1]=-n*f,t[2]=-o*f,t[3]=i*f,t[4]=(o*d-l*c)*f,t[5]=(n*c-i*d)*f,t):null},Qt.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},Qt.multiply=Fs,Qt.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=Math.sin(i),y=Math.cos(i);return t[0]=n*y+l*_,t[1]=o*y+c*_,t[2]=n*-_+l*y,t[3]=o*-_+c*y,t[4]=d,t[5]=f,t},Qt.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=i[0],_=i[1];return t[0]=e[0]*f,t[1]=n*f,t[2]=o*_,t[3]=l*_,t[4]=c,t[5]=d,t},Qt.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=i[0],y=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=n*_+l*y+d,t[5]=o*_+c*y+f,t},Qt.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t[4]=0,t[5]=0,t},Qt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},Qt.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},Qt.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},Qt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},Qt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t},Qt.subtract=io,Qt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t},Qt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t},Qt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},Qt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=e[0],_=e[1],y=e[2],v=e[3],b=e[4],E=e[5];return Math.abs(i-f)<=Ir.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(n-_)<=Ir.EPSILON*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(o-y)<=Ir.EPSILON*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-v)<=Ir.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-b)<=Ir.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(d-E)<=Ir.EPSILON*Math.max(1,Math.abs(d),Math.abs(E))},Qt.sub=Qt.mul=void 0;var Ir=function(t,e){if(t&&t.__esModule)return t;if(t===null||Bs(t)!=="object"&&typeof t!="function")return{default:t};var i=nl(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function nl(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(nl=function(n){return n?i:e})(t)}function Fs(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=i[0],y=i[1],v=i[2],b=i[3],E=i[4],M=i[5];return t[0]=n*_+l*y,t[1]=o*_+c*y,t[2]=n*v+l*b,t[3]=o*v+c*b,t[4]=n*E+l*M+d,t[5]=o*E+c*M+f,t}function io(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t}Qt.mul=Fs,Qt.sub=io;var Ht={};function Lo(t){return Lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lo(t)}Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.create=function(){var t=new Ui.ARRAY_TYPE(9);return Ui.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},Ht.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},Ht.clone=function(t){var e=new Ui.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},Ht.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Ht.fromValues=function(t,e,i,n,o,l,c,d,f){var _=new Ui.ARRAY_TYPE(9);return _[0]=t,_[1]=e,_[2]=i,_[3]=n,_[4]=o,_[5]=l,_[6]=c,_[7]=d,_[8]=f,_},Ht.set=function(t,e,i,n,o,l,c,d,f,_){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t[8]=_,t},Ht.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},Ht.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=y*c-d*_,b=-y*l+d*f,E=_*l-c*f,M=i*v+n*b+o*E;return M?(t[0]=v*(M=1/M),t[1]=(-y*n+o*_)*M,t[2]=(d*n-o*c)*M,t[3]=b*M,t[4]=(y*i-o*f)*M,t[5]=(-d*i+o*l)*M,t[6]=E*M,t[7]=(-_*i+n*f)*M,t[8]=(c*i-n*l)*M,t):null},Ht.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8];return t[0]=c*y-d*_,t[1]=o*_-n*y,t[2]=n*d-o*c,t[3]=d*f-l*y,t[4]=i*y-o*f,t[5]=o*l-i*d,t[6]=l*_-c*f,t[7]=n*f-i*_,t[8]=i*c-n*l,t},Ht.determinant=function(t){var e=t[3],i=t[4],n=t[5],o=t[6],l=t[7],c=t[8];return t[0]*(c*i-n*l)+t[1]*(-c*e+n*o)+t[2]*(l*e-i*o)},Ht.multiply=sl,Ht.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=f,t[6]=b*n+E*c+_,t[7]=b*o+E*d+y,t[8]=b*l+E*f+v,t},Ht.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=Math.sin(i),E=Math.cos(i);return t[0]=E*n+b*c,t[1]=E*o+b*d,t[2]=E*l+b*f,t[3]=E*c-b*n,t[4]=E*d-b*o,t[5]=E*f-b*l,t[6]=_,t[7]=y,t[8]=v,t},Ht.scale=function(t,e,i){var n=i[0],o=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Ht.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},Ht.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},Ht.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,f=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,M=o*f,A=l*c,C=l*d,D=l*f;return t[0]=1-v-M,t[3]=y-D,t[6]=b+C,t[1]=y+D,t[4]=1-_-M,t[7]=E-A,t[2]=b-C,t[5]=E+A,t[8]=1-_-v,t},Ht.normalFromMat4=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15],V=i*d-n*c,N=i*f-o*c,U=i*_-l*c,H=n*f-o*d,X=n*_-l*d,Q=o*_-l*f,ae=y*A-v*M,de=y*C-b*M,ye=y*D-E*M,pe=v*C-b*A,we=v*D-E*A,De=b*D-E*C,Te=V*De-N*we+U*pe+H*ye-X*de+Q*ae;return Te?(t[0]=(d*De-f*we+_*pe)*(Te=1/Te),t[1]=(f*ye-c*De-_*de)*Te,t[2]=(c*we-d*ye+_*ae)*Te,t[3]=(o*we-n*De-l*pe)*Te,t[4]=(i*De-o*ye+l*de)*Te,t[5]=(n*ye-i*we-l*ae)*Te,t[6]=(A*Q-C*X+D*H)*Te,t[7]=(C*U-M*Q-D*N)*Te,t[8]=(M*X-A*U+D*V)*Te,t):null},Ht.projection=function(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},Ht.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},Ht.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},Ht.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t},Ht.subtract=al,Ht.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t},Ht.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t},Ht.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},Ht.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=t[8],v=e[0],b=e[1],E=e[2],M=e[3],A=e[4],C=e[5],D=e[6],V=e[7],N=e[8];return Math.abs(i-v)<=Ui.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-b)<=Ui.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-E)<=Ui.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(l-M)<=Ui.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-A)<=Ui.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-C)<=Ui.EPSILON*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(f-D)<=Ui.EPSILON*Math.max(1,Math.abs(f),Math.abs(D))&&Math.abs(_-V)<=Ui.EPSILON*Math.max(1,Math.abs(_),Math.abs(V))&&Math.abs(y-N)<=Ui.EPSILON*Math.max(1,Math.abs(y),Math.abs(N))},Ht.sub=Ht.mul=void 0;var Ui=function(t,e){if(t&&t.__esModule)return t;if(t===null||Lo(t)!=="object"&&typeof t!="function")return{default:t};var i=ol(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function ol(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ol=function(n){return n?i:e})(t)}function sl(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1],M=i[2],A=i[3],C=i[4],D=i[5],V=i[6],N=i[7],U=i[8];return t[0]=b*n+E*c+M*_,t[1]=b*o+E*d+M*y,t[2]=b*l+E*f+M*v,t[3]=A*n+C*c+D*_,t[4]=A*o+C*d+D*y,t[5]=A*l+C*f+D*v,t[6]=V*n+N*c+U*_,t[7]=V*o+N*d+U*y,t[8]=V*l+N*f+U*v,t}function al(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}Ht.mul=sl,Ht.sub=al;var dt={};function ko(t){return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ko(t)}Object.defineProperty(dt,"__esModule",{value:!0}),dt.create=function(){var t=new ai.ARRAY_TYPE(16);return ai.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},dt.clone=function(t){var e=new ai.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},dt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},dt.fromValues=function(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A){var C=new ai.ARRAY_TYPE(16);return C[0]=t,C[1]=e,C[2]=i,C[3]=n,C[4]=o,C[5]=l,C[6]=c,C[7]=d,C[8]=f,C[9]=_,C[10]=y,C[11]=v,C[12]=b,C[13]=E,C[14]=M,C[15]=A,C},dt.set=function(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t[8]=_,t[9]=y,t[10]=v,t[11]=b,t[12]=E,t[13]=M,t[14]=A,t[15]=C,t},dt.identity=cl,dt.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[3],l=e[6],c=e[7],d=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=l,t[11]=e[14],t[12]=o,t[13]=c,t[14]=d}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},dt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15],V=i*d-n*c,N=i*f-o*c,U=i*_-l*c,H=n*f-o*d,X=n*_-l*d,Q=o*_-l*f,ae=y*A-v*M,de=y*C-b*M,ye=y*D-E*M,pe=v*C-b*A,we=v*D-E*A,De=b*D-E*C,Te=V*De-N*we+U*pe+H*ye-X*de+Q*ae;return Te?(t[0]=(d*De-f*we+_*pe)*(Te=1/Te),t[1]=(o*we-n*De-l*pe)*Te,t[2]=(A*Q-C*X+D*H)*Te,t[3]=(b*X-v*Q-E*H)*Te,t[4]=(f*ye-c*De-_*de)*Te,t[5]=(i*De-o*ye+l*de)*Te,t[6]=(C*U-M*Q-D*N)*Te,t[7]=(y*Q-b*U+E*N)*Te,t[8]=(c*we-d*ye+_*ae)*Te,t[9]=(n*ye-i*we-l*ae)*Te,t[10]=(M*X-A*U+D*V)*Te,t[11]=(v*U-y*X-E*V)*Te,t[12]=(d*de-c*pe-f*ae)*Te,t[13]=(i*pe-n*de+o*ae)*Te,t[14]=(A*N-M*H-C*V)*Te,t[15]=(y*H-v*N+b*V)*Te,t):null},dt.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15];return t[0]=d*(b*D-E*C)-v*(f*D-_*C)+A*(f*E-_*b),t[1]=-(n*(b*D-E*C)-v*(o*D-l*C)+A*(o*E-l*b)),t[2]=n*(f*D-_*C)-d*(o*D-l*C)+A*(o*_-l*f),t[3]=-(n*(f*E-_*b)-d*(o*E-l*b)+v*(o*_-l*f)),t[4]=-(c*(b*D-E*C)-y*(f*D-_*C)+M*(f*E-_*b)),t[5]=i*(b*D-E*C)-y*(o*D-l*C)+M*(o*E-l*b),t[6]=-(i*(f*D-_*C)-c*(o*D-l*C)+M*(o*_-l*f)),t[7]=i*(f*E-_*b)-c*(o*E-l*b)+y*(o*_-l*f),t[8]=c*(v*D-E*A)-y*(d*D-_*A)+M*(d*E-_*v),t[9]=-(i*(v*D-E*A)-y*(n*D-l*A)+M*(n*E-l*v)),t[10]=i*(d*D-_*A)-c*(n*D-l*A)+M*(n*_-l*d),t[11]=-(i*(d*E-_*v)-c*(n*E-l*v)+y*(n*_-l*d)),t[12]=-(c*(v*C-b*A)-y*(d*C-f*A)+M*(d*b-f*v)),t[13]=i*(v*C-b*A)-y*(n*C-o*A)+M*(n*b-o*v),t[14]=-(i*(d*C-f*A)-c*(n*C-o*A)+M*(n*f-o*d)),t[15]=i*(d*b-f*v)-c*(n*b-o*v)+y*(n*f-o*d),t},dt.determinant=function(t){var e=t[0],i=t[1],n=t[2],o=t[3],l=t[4],c=t[5],d=t[6],f=t[7],_=t[8],y=t[9],v=t[10],b=t[11],E=t[12],M=t[13],A=t[14],C=t[15];return(e*c-i*l)*(v*C-b*A)-(e*d-n*l)*(y*C-b*M)+(e*f-o*l)*(y*A-v*M)+(i*d-n*c)*(_*C-b*E)-(i*f-o*c)*(_*A-v*E)+(n*f-o*d)*(_*M-y*E)},dt.multiply=ul,dt.translate=function(t,e,i){var n,o,l,c,d,f,_,y,v,b,E,M,A=i[0],C=i[1],D=i[2];return e===t?(t[12]=e[0]*A+e[4]*C+e[8]*D+e[12],t[13]=e[1]*A+e[5]*C+e[9]*D+e[13],t[14]=e[2]*A+e[6]*C+e[10]*D+e[14],t[15]=e[3]*A+e[7]*C+e[11]*D+e[15]):(o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],M=e[11],t[0]=n=e[0],t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=f,t[6]=_,t[7]=y,t[8]=v,t[9]=b,t[10]=E,t[11]=M,t[12]=n*A+d*C+v*D+e[12],t[13]=o*A+f*C+b*D+e[13],t[14]=l*A+_*C+E*D+e[14],t[15]=c*A+y*C+M*D+e[15]),t},dt.scale=function(t,e,i){var n=i[0],o=i[1],l=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*l,t[9]=e[9]*l,t[10]=e[10]*l,t[11]=e[11]*l,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},dt.rotate=function(t,e,i,n){var o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we=n[0],De=n[1],Te=n[2],ke=Math.hypot(we,De,Te);return ke0?(i[0]=2*(d*c+y*n+f*l-_*o)/v,i[1]=2*(f*c+y*o+_*n-d*l)/v,i[2]=2*(_*c+y*l+d*o-f*n)/v):(i[0]=2*(d*c+y*n+f*l-_*o),i[1]=2*(f*c+y*o+_*n-d*l),i[2]=2*(_*c+y*l+d*o-f*n)),Ns(t,e,i),t},dt.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},dt.getScaling=Oo,dt.getRotation=function(t,e){var i=new ai.ARRAY_TYPE(3);Oo(i,e);var n=1/i[0],o=1/i[1],l=1/i[2],c=e[0]*n,d=e[1]*o,f=e[2]*l,_=e[4]*n,y=e[5]*o,v=e[6]*l,b=e[8]*n,E=e[9]*o,M=e[10]*l,A=c+y+M,C=0;return A>0?(C=2*Math.sqrt(A+1),t[3]=.25*C,t[0]=(v-E)/C,t[1]=(b-f)/C,t[2]=(d-_)/C):c>y&&c>M?(C=2*Math.sqrt(1+c-y-M),t[3]=(v-E)/C,t[0]=.25*C,t[1]=(d+_)/C,t[2]=(b+f)/C):y>M?(C=2*Math.sqrt(1+y-c-M),t[3]=(b-f)/C,t[0]=(d+_)/C,t[1]=.25*C,t[2]=(v+E)/C):(C=2*Math.sqrt(1+M-c-y),t[3]=(d-_)/C,t[0]=(b+f)/C,t[1]=(v+E)/C,t[2]=.25*C),t},dt.fromRotationTranslationScale=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3],f=o+o,_=l+l,y=c+c,v=o*f,b=o*_,E=o*y,M=l*_,A=l*y,C=c*y,D=d*f,V=d*_,N=d*y,U=n[0],H=n[1],X=n[2];return t[0]=(1-(M+C))*U,t[1]=(b+N)*U,t[2]=(E-V)*U,t[3]=0,t[4]=(b-N)*H,t[5]=(1-(v+C))*H,t[6]=(A+D)*H,t[7]=0,t[8]=(E+V)*X,t[9]=(A-D)*X,t[10]=(1-(v+M))*X,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t},dt.fromRotationTranslationScaleOrigin=function(t,e,i,n,o){var l=e[0],c=e[1],d=e[2],f=e[3],_=l+l,y=c+c,v=d+d,b=l*_,E=l*y,M=l*v,A=c*y,C=c*v,D=d*v,V=f*_,N=f*y,U=f*v,H=n[0],X=n[1],Q=n[2],ae=o[0],de=o[1],ye=o[2],pe=(1-(A+D))*H,we=(E+U)*H,De=(M-N)*H,Te=(E-U)*X,ke=(1-(b+D))*X,be=(C+V)*X,Ie=(M+N)*Q,Be=(C-V)*Q,Ee=(1-(b+A))*Q;return t[0]=pe,t[1]=we,t[2]=De,t[3]=0,t[4]=Te,t[5]=ke,t[6]=be,t[7]=0,t[8]=Ie,t[9]=Be,t[10]=Ee,t[11]=0,t[12]=i[0]+ae-(pe*ae+Te*de+Ie*ye),t[13]=i[1]+de-(we*ae+ke*de+Be*ye),t[14]=i[2]+ye-(De*ae+be*de+Ee*ye),t[15]=1,t},dt.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,f=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,M=o*f,A=l*c,C=l*d,D=l*f;return t[0]=1-v-M,t[1]=y+D,t[2]=b-C,t[3]=0,t[4]=y-D,t[5]=1-_-M,t[6]=E+A,t[7]=0,t[8]=b+C,t[9]=E-A,t[10]=1-_-v,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},dt.frustum=function(t,e,i,n,o,l,c){var d=1/(i-e),f=1/(o-n),_=1/(l-c);return t[0]=2*l*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*l*f,t[6]=0,t[7]=0,t[8]=(i+e)*d,t[9]=(o+n)*f,t[10]=(c+l)*_,t[11]=-1,t[12]=0,t[13]=0,t[14]=c*l*2*_,t[15]=0,t},dt.perspectiveNO=Ur,dt.perspectiveZO=function(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=o*(l=1/(n-o)),t[14]=o*n*l):(t[10]=-1,t[14]=-n),t},dt.perspectiveFromFieldOfView=function(t,e,i,n){var o=Math.tan(e.upDegrees*Math.PI/180),l=Math.tan(e.downDegrees*Math.PI/180),c=Math.tan(e.leftDegrees*Math.PI/180),d=Math.tan(e.rightDegrees*Math.PI/180),f=2/(c+d),_=2/(o+l);return t[0]=f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=_,t[6]=0,t[7]=0,t[8]=-(c-d)*f*.5,t[9]=(o-l)*_*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},dt.orthoNO=jr,dt.orthoZO=function(t,e,i,n,o,l,c){var d=1/(e-i),f=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*f,t[14]=l*_,t[15]=1,t},dt.lookAt=function(t,e,i,n){var o,l,c,d,f,_,y,v,b,E,M=e[0],A=e[1],C=e[2],D=n[0],V=n[1],N=n[2],U=i[0],H=i[1],X=i[2];return Math.abs(M-U)0&&(y*=E=1/Math.sqrt(E),v*=E,b*=E);var M=f*b-_*v,A=_*y-d*b,C=d*v-f*y;return(E=M*M+A*A+C*C)>0&&(M*=E=1/Math.sqrt(E),A*=E,C*=E),t[0]=M,t[1]=A,t[2]=C,t[3]=0,t[4]=v*C-b*A,t[5]=b*M-y*C,t[6]=y*A-v*M,t[7]=0,t[8]=y,t[9]=v,t[10]=b,t[11]=0,t[12]=o,t[13]=l,t[14]=c,t[15]=1,t},dt.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},dt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},dt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t},dt.subtract=Vs,dt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t},dt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t[9]=e[9]+i[9]*n,t[10]=e[10]+i[10]*n,t[11]=e[11]+i[11]*n,t[12]=e[12]+i[12]*n,t[13]=e[13]+i[13]*n,t[14]=e[14]+i[14]*n,t[15]=e[15]+i[15]*n,t},dt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},dt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=t[8],v=t[9],b=t[10],E=t[11],M=t[12],A=t[13],C=t[14],D=t[15],V=e[0],N=e[1],U=e[2],H=e[3],X=e[4],Q=e[5],ae=e[6],de=e[7],ye=e[8],pe=e[9],we=e[10],De=e[11],Te=e[12],ke=e[13],be=e[14],Ie=e[15];return Math.abs(i-V)<=ai.EPSILON*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(n-N)<=ai.EPSILON*Math.max(1,Math.abs(n),Math.abs(N))&&Math.abs(o-U)<=ai.EPSILON*Math.max(1,Math.abs(o),Math.abs(U))&&Math.abs(l-H)<=ai.EPSILON*Math.max(1,Math.abs(l),Math.abs(H))&&Math.abs(c-X)<=ai.EPSILON*Math.max(1,Math.abs(c),Math.abs(X))&&Math.abs(d-Q)<=ai.EPSILON*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(f-ae)<=ai.EPSILON*Math.max(1,Math.abs(f),Math.abs(ae))&&Math.abs(_-de)<=ai.EPSILON*Math.max(1,Math.abs(_),Math.abs(de))&&Math.abs(y-ye)<=ai.EPSILON*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(v-pe)<=ai.EPSILON*Math.max(1,Math.abs(v),Math.abs(pe))&&Math.abs(b-we)<=ai.EPSILON*Math.max(1,Math.abs(b),Math.abs(we))&&Math.abs(E-De)<=ai.EPSILON*Math.max(1,Math.abs(E),Math.abs(De))&&Math.abs(M-Te)<=ai.EPSILON*Math.max(1,Math.abs(M),Math.abs(Te))&&Math.abs(A-ke)<=ai.EPSILON*Math.max(1,Math.abs(A),Math.abs(ke))&&Math.abs(C-be)<=ai.EPSILON*Math.max(1,Math.abs(C),Math.abs(be))&&Math.abs(D-Ie)<=ai.EPSILON*Math.max(1,Math.abs(D),Math.abs(Ie))},dt.sub=dt.mul=dt.ortho=dt.perspective=void 0;var ai=function(t,e){if(t&&t.__esModule)return t;if(t===null||ko(t)!=="object"&&typeof t!="function")return{default:t};var i=ll(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function ll(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ll=function(n){return n?i:e})(t)}function cl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ul(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],M=e[11],A=e[12],C=e[13],D=e[14],V=e[15],N=i[0],U=i[1],H=i[2],X=i[3];return t[0]=N*n+U*d+H*v+X*A,t[1]=N*o+U*f+H*b+X*C,t[2]=N*l+U*_+H*E+X*D,t[3]=N*c+U*y+H*M+X*V,t[4]=(N=i[4])*n+(U=i[5])*d+(H=i[6])*v+(X=i[7])*A,t[5]=N*o+U*f+H*b+X*C,t[6]=N*l+U*_+H*E+X*D,t[7]=N*c+U*y+H*M+X*V,t[8]=(N=i[8])*n+(U=i[9])*d+(H=i[10])*v+(X=i[11])*A,t[9]=N*o+U*f+H*b+X*C,t[10]=N*l+U*_+H*E+X*D,t[11]=N*c+U*y+H*M+X*V,t[12]=(N=i[12])*n+(U=i[13])*d+(H=i[14])*v+(X=i[15])*A,t[13]=N*o+U*f+H*b+X*C,t[14]=N*l+U*_+H*E+X*D,t[15]=N*c+U*y+H*M+X*V,t}function Ns(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=n+n,f=o+o,_=l+l,y=n*d,v=n*f,b=n*_,E=o*f,M=o*_,A=l*_,C=c*d,D=c*f,V=c*_;return t[0]=1-(E+A),t[1]=v+V,t[2]=b-D,t[3]=0,t[4]=v-V,t[5]=1-(y+A),t[6]=M+C,t[7]=0,t[8]=b+D,t[9]=M-C,t[10]=1-(y+E),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function Oo(t,e){var i=e[4],n=e[5],o=e[6],l=e[8],c=e[9],d=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(i,n,o),t[2]=Math.hypot(l,c,d),t}function Ur(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=(o+n)*(l=1/(n-o)),t[14]=2*o*n*l):(t[10]=-1,t[14]=-2*n),t}function jr(t,e,i,n,o,l,c){var d=1/(e-i),f=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*f,t[14]=(c+l)*_,t[15]=1,t}function Vs(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}dt.perspective=Ur,dt.ortho=jr,dt.mul=ul,dt.sub=Vs;var lt={},pt={};function Bo(t){return Bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bo(t)}Object.defineProperty(pt,"__esModule",{value:!0}),pt.create=hl,pt.clone=function(t){var e=new lr.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},pt.length=ro,pt.fromValues=function(t,e,i){var n=new lr.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=i,n},pt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},pt.set=function(t,e,i,n){return t[0]=e,t[1]=i,t[2]=n,t},pt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},pt.subtract=dl,pt.multiply=Ln,pt.divide=kn,pt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},pt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},pt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t},pt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t},pt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},pt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},pt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t},pt.distance=Fo,pt.squaredDistance=Us,pt.squaredLength=No,pt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},pt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},pt.normalize=function(t,e){var i=e[0],n=e[1],o=e[2],l=i*i+n*n+o*o;return l>0&&(l=1/Math.sqrt(l)),t[0]=e[0]*l,t[1]=e[1]*l,t[2]=e[2]*l,t},pt.dot=Vo,pt.cross=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],f=i[2];return t[0]=o*f-l*d,t[1]=l*c-n*f,t[2]=n*d-o*c,t},pt.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t},pt.hermite=function(t,e,i,n,o,l){var c=l*l,d=c*(2*l-3)+1,f=c*(l-2)+l,_=c*(l-1),y=c*(3-2*l);return t[0]=e[0]*d+i[0]*f+n[0]*_+o[0]*y,t[1]=e[1]*d+i[1]*f+n[1]*_+o[1]*y,t[2]=e[2]*d+i[2]*f+n[2]*_+o[2]*y,t},pt.bezier=function(t,e,i,n,o,l){var c=1-l,d=c*c,f=l*l,_=d*c,y=3*l*d,v=3*f*c,b=f*l;return t[0]=e[0]*_+i[0]*y+n[0]*v+o[0]*b,t[1]=e[1]*_+i[1]*y+n[1]*v+o[1]*b,t[2]=e[2]*_+i[2]*y+n[2]*v+o[2]*b,t},pt.random=function(t,e){e=e||1;var i=2*lr.RANDOM()*Math.PI,n=2*lr.RANDOM()-1,o=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*o,t[1]=Math.sin(i)*o,t[2]=n*e,t},pt.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[3]*n+i[7]*o+i[11]*l+i[15];return t[0]=(i[0]*n+i[4]*o+i[8]*l+i[12])/(c=c||1),t[1]=(i[1]*n+i[5]*o+i[9]*l+i[13])/c,t[2]=(i[2]*n+i[6]*o+i[10]*l+i[14])/c,t},pt.transformMat3=function(t,e,i){var n=e[0],o=e[1],l=e[2];return t[0]=n*i[0]+o*i[3]+l*i[6],t[1]=n*i[1]+o*i[4]+l*i[7],t[2]=n*i[2]+o*i[5]+l*i[8],t},pt.transformQuat=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=e[0],d=e[1],f=e[2],_=o*f-l*d,y=l*c-n*f,v=n*d-o*c,b=o*v-l*y,E=l*_-n*v,M=n*y-o*_,A=2*i[3];return y*=A,v*=A,E*=2,M*=2,t[0]=c+(_*=A)+(b*=2),t[1]=d+y+E,t[2]=f+v+M,t},pt.rotateX=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),l[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.rotateY=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),l[1]=o[1],l[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.rotateZ=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),l[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),l[2]=o[2],t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.angle=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2],f=Math.sqrt(i*i+n*n+o*o)*Math.sqrt(l*l+c*c+d*d),_=f&&Vo(t,e)/f;return Math.acos(Math.min(Math.max(_,-1),1))},pt.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},pt.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},pt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},pt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2];return Math.abs(i-l)<=lr.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-c)<=lr.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=lr.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))},pt.forEach=pt.sqrLen=pt.len=pt.sqrDist=pt.dist=pt.div=pt.mul=pt.sub=void 0;var lr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Bo(t)!=="object"&&typeof t!="function")return{default:t};var i=pn(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function pn(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(pn=function(n){return n?i:e})(t)}function hl(){var t=new lr.ARRAY_TYPE(3);return lr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ro(t){return Math.hypot(t[0],t[1],t[2])}function dl(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Ln(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function kn(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function Fo(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function Us(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2];return i*i+n*n+o*o}function No(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function Vo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}pt.sub=dl,pt.mul=Ln,pt.div=kn,pt.dist=Fo,pt.sqrDist=Us,pt.len=ro,pt.sqrLen=No;var Ar,or=(Ar=hl(),function(t,e,i,n,o,l){var c,d;for(e||(e=3),i||(i=0),d=n?Math.min(n*e+i,t.length):t.length,c=i;c0&&(c=1/Math.sqrt(c)),t[0]=i*c,t[1]=n*c,t[2]=o*c,t[3]=l*c,t},ct.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},ct.cross=function(t,e,i,n){var o=i[0]*n[1]-i[1]*n[0],l=i[0]*n[2]-i[2]*n[0],c=i[0]*n[3]-i[3]*n[0],d=i[1]*n[2]-i[2]*n[1],f=i[1]*n[3]-i[3]*n[1],_=i[2]*n[3]-i[3]*n[2],y=e[0],v=e[1],b=e[2],E=e[3];return t[0]=v*_-b*f+E*d,t[1]=-y*_+b*c-E*l,t[2]=y*f-v*c+E*o,t[3]=-y*d+v*l-b*o,t},ct.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t[3]=d+n*(i[3]-d),t},ct.random=function(t,e){var i,n,o,l,c,d;e=e||1;do c=(i=2*er.RANDOM()-1)*i+(n=2*er.RANDOM()-1)*n;while(c>=1);do d=(o=2*er.RANDOM()-1)*o+(l=2*er.RANDOM()-1)*l;while(d>=1);var f=Math.sqrt((1-c)/d);return t[0]=e*i,t[1]=e*n,t[2]=e*o*f,t[3]=e*l*f,t},ct.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3];return t[0]=i[0]*n+i[4]*o+i[8]*l+i[12]*c,t[1]=i[1]*n+i[5]*o+i[9]*l+i[13]*c,t[2]=i[2]*n+i[6]*o+i[10]*l+i[14]*c,t[3]=i[3]*n+i[7]*o+i[11]*l+i[15]*c,t},ct.transformQuat=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],f=i[2],_=i[3],y=_*n+d*l-f*o,v=_*o+f*n-c*l,b=_*l+c*o-d*n,E=-c*n-d*o-f*l;return t[0]=y*_+E*-c+v*-f-b*-d,t[1]=v*_+E*-d+b*-c-y*-f,t[2]=b*_+E*-f+y*-d-v*-c,t[3]=e[3],t},ct.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},ct.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},ct.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ct.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],f=e[2],_=e[3];return Math.abs(i-c)<=er.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=er.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-f)<=er.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(l-_)<=er.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},ct.forEach=ct.sqrLen=ct.len=ct.sqrDist=ct.dist=ct.div=ct.mul=ct.sub=void 0;var er=function(t,e){if(t&&t.__esModule)return t;if(t===null||Uo(t)!=="object"&&typeof t!="function")return{default:t};var i=Gr(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Gr(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gr=function(n){return n?i:e})(t)}function no(){var t=new er.ARRAY_TYPE(4);return er.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Cr(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function jo(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function js(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function Go(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function oo(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],l=e[3]-t[3];return i*i+n*n+o*o+l*l}function $o(t){return Math.hypot(t[0],t[1],t[2],t[3])}function qo(t){var e=t[0],i=t[1],n=t[2],o=t[3];return e*e+i*i+n*n+o*o}ct.sub=Cr,ct.mul=jo,ct.div=js,ct.dist=Go,ct.sqrDist=oo,ct.len=$o,ct.sqrLen=qo;var On=function(){var t=no();return function(e,i,n,o,l,c){var d,f;for(i||(i=4),n||(n=0),f=o?Math.min(o*i+n,e.length):e.length,d=n;dPr.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),i},lt.getAngle=function(t,e){var i=K(t,e);return Math.acos(2*i*i-1)},lt.multiply=$s,lt.rotateX=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+c*d,t[1]=o*f+l*d,t[2]=l*f-o*d,t[3]=c*f-n*d,t},lt.rotateY=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f-l*d,t[1]=o*f+c*d,t[2]=l*f+n*d,t[3]=c*f-o*d,t},lt.rotateZ=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+o*d,t[1]=o*f-n*d,t[2]=l*f+c*d,t[3]=c*f-l*d,t},lt.calculateW=function(t,e){var i=e[0],n=e[1],o=e[2];return t[0]=i,t[1]=n,t[2]=o,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-o*o)),t},lt.exp=oe,lt.ln=R,lt.pow=function(t,e,i){return R(t,e),te(t,t,i),oe(t,t),t},lt.slerp=F,lt.random=function(t){var e=Pr.RANDOM(),i=Pr.RANDOM(),n=Pr.RANDOM(),o=Math.sqrt(1-e),l=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*i),t[1]=o*Math.cos(2*Math.PI*i),t[2]=l*Math.sin(2*Math.PI*n),t[3]=l*Math.cos(2*Math.PI*n),t},lt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*i+n*n+o*o+l*l,d=c?1/c:0;return t[0]=-i*d,t[1]=-n*d,t[2]=-o*d,t[3]=l*d,t},lt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},lt.fromMat3=q,lt.fromEuler=function(t,e,i,n){var o=.5*Math.PI/180;e*=o,i*=o,n*=o;var l=Math.sin(e),c=Math.cos(e),d=Math.sin(i),f=Math.cos(i),_=Math.sin(n),y=Math.cos(n);return t[0]=l*f*y-c*d*_,t[1]=c*d*y+l*f*_,t[2]=c*f*_-l*d*y,t[3]=c*f*y+l*d*_,t},lt.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},lt.setAxes=lt.sqlerp=lt.rotationTo=lt.equals=lt.exactEquals=lt.normalize=lt.sqrLen=lt.squaredLength=lt.len=lt.length=lt.lerp=lt.dot=lt.scale=lt.mul=lt.add=lt.set=lt.copy=lt.fromValues=lt.clone=void 0;var Pr=so(fi),Cc=so(Ht),zr=so(pt),Bi=so(ct);function Gs(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gs=function(n){return n?i:e})(t)}function so(t,e){if(t&&t.__esModule)return t;if(t===null||Zo(t)!=="object"&&typeof t!="function")return{default:t};var i=Gs(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function Wo(){var t=new Pr.ARRAY_TYPE(4);return Pr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Mi(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function $s(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*f,t[1]=o*y+c*f+l*d-n*_,t[2]=l*y+c*_+n*f-o*d,t[3]=c*y-n*d-o*f-l*_,t}function oe(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=Math.exp(l),f=c>0?d*Math.sin(c)/c:0;return t[0]=i*f,t[1]=n*f,t[2]=o*f,t[3]=d*Math.cos(c),t}function R(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=c>0?Math.atan2(c,l)/c:0;return t[0]=i*d,t[1]=n*d,t[2]=o*d,t[3]=.5*Math.log(i*i+n*n+o*o+l*l),t}function F(t,e,i,n){var o,l,c,d,f,_=e[0],y=e[1],v=e[2],b=e[3],E=i[0],M=i[1],A=i[2],C=i[3];return(l=_*E+y*M+v*A+b*C)<0&&(l=-l,E=-E,M=-M,A=-A,C=-C),1-l>Pr.EPSILON?(o=Math.acos(l),c=Math.sin(o),d=Math.sin((1-n)*o)/c,f=Math.sin(n*o)/c):(d=1-n,f=n),t[0]=d*_+f*E,t[1]=d*y+f*M,t[2]=d*v+f*A,t[3]=d*b+f*C,t}function q(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,t[0]=(e[5]-e[7])*(i=.5/i),t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var l=(o+1)%3,c=(o+2)%3;i=Math.sqrt(e[3*o+o]-e[3*l+l]-e[3*c+c]+1),t[o]=.5*i,t[3]=(e[3*l+c]-e[3*c+l])*(i=.5/i),t[l]=(e[3*l+o]+e[3*o+l])*i,t[c]=(e[3*c+o]+e[3*o+c])*i}return t}lt.clone=Bi.clone,lt.fromValues=Bi.fromValues,lt.copy=Bi.copy,lt.set=Bi.set,lt.add=Bi.add,lt.mul=$s;var te=Bi.scale;lt.scale=te;var K=Bi.dot;lt.dot=K,lt.lerp=Bi.lerp;var ce=Bi.length;lt.length=ce,lt.len=ce;var xe=Bi.squaredLength;lt.squaredLength=xe,lt.sqrLen=xe;var le=Bi.normalize;lt.normalize=le,lt.exactEquals=Bi.exactEquals,lt.equals=Bi.equals;var ge,ze,Pe,qe=(ge=zr.create(),ze=zr.fromValues(1,0,0),Pe=zr.fromValues(0,1,0),function(t,e,i){var n=zr.dot(e,i);return n<-.999999?(zr.cross(ge,ze,e),zr.len(ge)<1e-6&&zr.cross(ge,Pe,e),zr.normalize(ge,ge),Mi(t,ge,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(zr.cross(ge,e,i),t[0]=ge[0],t[1]=ge[1],t[2]=ge[2],t[3]=1+n,le(t,t))});lt.rotationTo=qe;var tt,ot,Bt=(tt=Wo(),ot=Wo(),function(t,e,i,n,o,l){return F(tt,e,o,l),F(ot,i,n,l),F(t,tt,ot,2*l*(1-l)),t});lt.sqlerp=Bt;var yt,kt=(yt=Cc.create(),function(t,e,i,n){return yt[0]=i[0],yt[3]=i[1],yt[6]=i[2],yt[1]=n[0],yt[4]=n[1],yt[7]=n[2],yt[2]=-e[0],yt[5]=-e[1],yt[8]=-e[2],le(t,q(t,yt))});lt.setAxes=kt;var Je={};function si(t){return si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},si(t)}Object.defineProperty(Je,"__esModule",{value:!0}),Je.create=function(){var t=new Ft.ARRAY_TYPE(8);return Ft.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},Je.clone=function(t){var e=new Ft.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},Je.fromValues=function(t,e,i,n,o,l,c,d){var f=new Ft.ARRAY_TYPE(8);return f[0]=t,f[1]=e,f[2]=i,f[3]=n,f[4]=o,f[5]=l,f[6]=c,f[7]=d,f},Je.fromRotationTranslationValues=function(t,e,i,n,o,l,c){var d=new Ft.ARRAY_TYPE(8);d[0]=t,d[1]=e,d[2]=i,d[3]=n;var f=.5*o,_=.5*l,y=.5*c;return d[4]=f*n+_*i-y*e,d[5]=_*n+y*t-f*i,d[6]=y*n+f*e-_*t,d[7]=-f*t-_*e-y*i,d},Je.fromRotationTranslation=ji,Je.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},Je.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Je.fromMat4=function(t,e){var i=Dt.create();yi.getRotation(i,e);var n=new Ft.ARRAY_TYPE(3);return yi.getTranslation(n,e),ji(t,i,n),t},Je.copy=tr,Je.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Je.set=function(t,e,i,n,o,l,c,d,f){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t},Je.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},Je.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},Je.getTranslation=function(t,e){var i=e[4],n=e[5],o=e[6],l=e[7],c=-e[0],d=-e[1],f=-e[2],_=e[3];return t[0]=2*(i*_+l*c+n*f-o*d),t[1]=2*(n*_+l*d+o*c-i*f),t[2]=2*(o*_+l*f+i*d-n*c),t},Je.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=.5*i[0],f=.5*i[1],_=.5*i[2],y=e[4],v=e[5],b=e[6],E=e[7];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=c*d+o*_-l*f+y,t[5]=c*f+l*d-n*_+v,t[6]=c*_+n*f-o*d+b,t[7]=-n*d-o*f-l*_+E,t},Je.rotateX=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateX(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateY=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateY(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateZ=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateZ(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateByQuatAppend=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=i[3],d=e[0],f=e[1],_=e[2],y=e[3];return t[0]=d*c+y*n+f*l-_*o,t[1]=f*c+y*o+_*n-d*l,t[2]=_*c+y*l+d*o-f*n,t[3]=y*c-d*n-f*o-_*l,t[4]=(d=e[4])*c+(y=e[7])*n+(f=e[5])*l-(_=e[6])*o,t[5]=f*c+y*o+_*n-d*l,t[6]=_*c+y*l+d*o-f*n,t[7]=y*c-d*n-f*o-_*l,t},Je.rotateByQuatPrepend=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*f,t[1]=o*y+c*f+l*d-n*_,t[2]=l*y+c*_+n*f-o*d,t[3]=c*y-n*d-o*f-l*_,t[4]=n*(y=i[7])+c*(d=i[4])+o*(_=i[6])-l*(f=i[5]),t[5]=o*y+c*f+l*d-n*_,t[6]=l*y+c*_+n*f-o*d,t[7]=c*y-n*d-o*f-l*_,t},Je.rotateAroundAxis=function(t,e,i,n){if(Math.abs(n)0){i=Math.sqrt(i);var n=e[0]/i,o=e[1]/i,l=e[2]/i,c=e[3]/i,d=e[4],f=e[5],_=e[6],y=e[7],v=n*d+o*f+l*_+c*y;t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=(d-n*v)/i,t[5]=(f-o*v)/i,t[6]=(_-l*v)/i,t[7]=(y-c*v)/i}return t},Je.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},Je.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},Je.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=e[0],v=e[1],b=e[2],E=e[3],M=e[4],A=e[5],C=e[6],D=e[7];return Math.abs(i-y)<=Ft.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(n-v)<=Ft.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-b)<=Ft.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(l-E)<=Ft.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-M)<=Ft.EPSILON*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(d-A)<=Ft.EPSILON*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(f-C)<=Ft.EPSILON*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(_-D)<=Ft.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))},Je.sqrLen=Je.squaredLength=Je.len=Je.length=Je.dot=Je.mul=Je.setReal=Je.getReal=void 0;var Ft=Ri(fi),Dt=Ri(lt),yi=Ri(dt);function xi(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(xi=function(n){return n?i:e})(t)}function Ri(t,e){if(t&&t.__esModule)return t;if(t===null||si(t)!=="object"&&typeof t!="function")return{default:t};var i=xi(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function ji(t,e,i){var n=.5*i[0],o=.5*i[1],l=.5*i[2],c=e[0],d=e[1],f=e[2],_=e[3];return t[0]=c,t[1]=d,t[2]=f,t[3]=_,t[4]=n*_+o*f-l*d,t[5]=o*_+l*c-n*f,t[6]=l*_+n*d-o*c,t[7]=-n*c-o*d-l*f,t}function tr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function ao(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[4],f=i[5],_=i[6],y=i[7],v=e[4],b=e[5],E=e[6],M=e[7],A=i[0],C=i[1],D=i[2],V=i[3];return t[0]=n*V+c*A+o*D-l*C,t[1]=o*V+c*C+l*A-n*D,t[2]=l*V+c*D+n*C-o*A,t[3]=c*V-n*A-o*C-l*D,t[4]=n*y+c*d+o*_-l*f+v*V+M*A+b*D-E*C,t[5]=o*y+c*f+l*d-n*_+b*V+M*C+E*A-v*D,t[6]=l*y+c*_+n*f-o*d+E*V+M*D+v*C-b*A,t[7]=c*y-n*d-o*f-l*_+M*V-v*A-b*C-E*D,t}Je.getReal=Dt.copy,Je.setReal=Dt.copy,Je.mul=ao;var Pc=Dt.dot;Je.dot=Pc;var zc=Dt.length;Je.length=zc,Je.len=zc;var qs=Dt.squaredLength;Je.squaredLength=qs,Je.sqrLen=qs;var wt={};function pl(t){return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pl(t)}Object.defineProperty(wt,"__esModule",{value:!0}),wt.create=Rc,wt.clone=function(t){var e=new Bn.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},wt.fromValues=function(t,e){var i=new Bn.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},wt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},wt.set=function(t,e,i){return t[0]=e,t[1]=i,t},wt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},wt.subtract=Lc,wt.multiply=kc,wt.divide=Oc,wt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},wt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},wt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},wt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},wt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},wt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},wt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},wt.distance=Bc,wt.squaredDistance=Fc,wt.length=Zs,wt.squaredLength=Ws,wt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},wt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},wt.normalize=function(t,e){var i=e[0],n=e[1],o=i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t},wt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},wt.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},wt.lerp=function(t,e,i,n){var o=e[0],l=e[1];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t},wt.random=function(t,e){e=e||1;var i=2*Bn.RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},wt.transformMat2=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o,t[1]=i[1]*n+i[3]*o,t},wt.transformMat2d=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o+i[4],t[1]=i[1]*n+i[3]*o+i[5],t},wt.transformMat3=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[3]*o+i[6],t[1]=i[1]*n+i[4]*o+i[7],t},wt.transformMat4=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t},wt.rotate=function(t,e,i,n){var o=e[0]-i[0],l=e[1]-i[1],c=Math.sin(n),d=Math.cos(n);return t[0]=o*d-l*c+i[0],t[1]=o*c+l*d+i[1],t},wt.angle=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1],c=Math.sqrt(i*i+n*n)*Math.sqrt(o*o+l*l);return Math.acos(Math.min(Math.max(c&&(i*o+n*l)/c,-1),1))},wt.zero=function(t){return t[0]=0,t[1]=0,t},wt.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},wt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},wt.equals=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1];return Math.abs(i-o)<=Bn.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-l)<=Bn.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},wt.forEach=wt.sqrLen=wt.sqrDist=wt.dist=wt.div=wt.mul=wt.sub=wt.len=void 0;var Bn=function(t,e){if(t&&t.__esModule)return t;if(t===null||pl(t)!=="object"&&typeof t!="function")return{default:t};var i=Dc(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Dc(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Dc=function(n){return n?i:e})(t)}function Rc(){var t=new Bn.ARRAY_TYPE(2);return Bn.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function Lc(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function kc(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Oc(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Bc(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Fc(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function Zs(t){return Math.hypot(t[0],t[1])}function Ws(t){var e=t[0],i=t[1];return e*e+i*i}wt.len=Zs,wt.sub=Lc,wt.mul=kc,wt.div=Oc,wt.dist=Bc,wt.sqrDist=Fc,wt.sqrLen=Ws;var fl=function(){var t=Rc();return function(e,i,n,o,l,c){var d,f;for(i||(i=2),n||(n=0),f=o?Math.min(o*i+n,e.length):e.length,d=n;d1)return 1;for(var i=t,n=0;n<8;n++){var o=this.sampleCurveX(i)-t;if(Math.abs(o)o?c=i:d=i,i=.5*(d-c)+c;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Vc=Jr(xh),Xs=lo;function lo(t,e){this.x=t,this.y=e}lo.prototype={clone:function(){return new lo(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),o=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},lo.convert=function(t){return t instanceof lo?t:Array.isArray(t)?new lo(t[0],t[1]):t};var je=Jr(Xs);function Xo(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function gl(t,e,i,n){const o=new Vc(t,e,i,n);return function(l){return o.solve(l)}}const $r=gl(.25,.1,.25,1);function Et(t,e,i){return Math.min(i,Math.max(e,t))}function Uc(t,e,i){return(i=Et((i-t)/(e-t),0,1))*i*(3-2*i)}function Jo(t,e,i){const n=i-e,o=((t-e)%n+n)%n+e;return o===e?i:o}function Js(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const o=new Array(t.length);let l=null;t.forEach((c,d)=>{e(c,(f,_)=>{f&&(l=f),o[d]=_,--n==0&&i(l,o)})})}function jc(t){const e=[];for(const i in t)e.push(t[i]);return e}function Gi(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}let wh=1;function yl(){return wh++}function Ko(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function co(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Gc(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function xl(t,e){t.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Ks(t,e){return t.indexOf(e,t.length-e.length)!==-1}function Qs(t,e,i){const n={};for(const o in t)n[o]=e.call(this,t[o],o,t);return n}function $i(t,e,i){const n={};for(const o in t)e.call(this,t[o],o,t)&&(n[o]=t[o]);return n}function ar(t){return Array.isArray(t)?t.map(ar):typeof t=="object"&&t?Qs(t,ar):t}const qi={};function vi(t){qi[t]||(typeof console<"u"&&console.warn(t),qi[t]=!0)}function Fn(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Ep(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,o,l)=>{const c=o||l;return e[n]=!c||c.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let $c,ta,Nn,ia,Vn,ra,na=null;function vl(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function Un(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function bl(t,e,i,n){for(;e>1;t[o]>1;t[o]<=n?e=o+1:i=o}return e}function Th(t){return t>0?1/(1.001-t):1+t}function Eh(t){return t>0?1-1/(1.001-t):-t}function qc(){return $c==null&&($c=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),$c}const Zi={now:()=>ia!==void 0?ia:performance.now(),setNow(t){ia=t},restoreNow(){ia=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:i,height:n}=t;Vn||(Vn=document.createElement("canvas"));const o=Vn.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return(i>Vn.width||n>Vn.height)&&(Vn.width=i,Vn.height=n),o.clearRect(-e,-e,i+2*e,n+2*e),o.drawImage(t,0,0,i,n),o.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:t=>(ta||(ta=document.createElement("a")),ta.href=t,ta.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Nn==null&&(Nn=window.matchMedia("(prefers-reduced-motion: reduce)")),Nn.matches)},hasCanvasFingerprintNoise(){if(ra!==void 0)return ra;if(!qc())return ra=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let i=0;for(let o=0;o0?`?${l}`:""}`}const Mh="mapbox-tiles";let Wc=500,Hc=50;const Ih=["language","worldview","jobid"];let Kr,Tl;function Ah(){try{return caches}catch{}}function oa(){const t=Ah();t&&!Kr&&(Kr=t.open(Mh))}let El=1/0;const Sl={supported:!1,testSupport:function(t){!Ml&&ts&&(Ch?Xc(t):sa=t)}};let sa,ts,Ml=!1,Ch=!1;const Ph=typeof self<"u"?self:{};function Xc(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ts),t.isContextLost())return;Sl.supported=!0}catch{}t.deleteTexture(e),Ml=!0}Ph.document&&(ts=Ph.document.createElement("img"),ts.onload=function(){sa&&Xc(sa),sa=null,Ch=!0},ts.onerror=function(){Ml=!0,sa=null},ts.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const aa={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(aa);class Il extends Error{constructor(e,i,n){i===401&&Zt(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Yc=es()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Qr=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Yc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(n,o){const l=new AbortController,c=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Yc(),referrerPolicy:n.referrerPolicy,signal:l.signal});let d=!1,f=!1;const _=(y=c.url).indexOf("sku=")>0&&Zt(y);var y;n.type==="json"&&c.headers.set("Accept","application/json");const v=(E,M,A)=>{if(f)return;if(E&&E.message!=="SecurityError"&&vi(E.toString()),M&&A)return b(M);const C=Date.now();fetch(c).then(D=>{if(D.ok){const V=_?D.clone():null;return b(D,V,C)}return o(new Il(D.statusText,D.status,n.url))}).catch(D=>{D.name!=="AbortError"&&o(new Error(`${D.message} ${n.url}`))})},b=(E,M,A)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(C=>{f||(M&&A&&function(D,V,N){if(oa(),!Kr)return;const U=ea(V.headers.get("Cache-Control")||"");if(U["no-store"])return;const H={status:V.status,statusText:V.statusText,headers:new Headers};V.headers.forEach((ae,de)=>H.headers.set(de,ae)),U["max-age"]&&H.headers.set("Expires",new Date(N+1e3*U["max-age"]).toUTCString());const X=H.headers.get("Expires");if(!X||new Date(X).getTime()-N<42e4)return;let Q=Zc(D.url,{persistentParams:Ih});if(V.status===206){const ae=D.headers.get("Range");if(!ae)return;H.status=200,Q=Sh(Q,{range:ae})}(function(ae,de){if(Tl===void 0)try{new Response(new ReadableStream),Tl=!0}catch{Tl=!1}Tl?de(ae.body):ae.blob().then(de)})(V,ae=>{const de=new Response((ye=V.status)!==200&&ye!==404&&[101,103,204,205,304].includes(ye)?null:ae,H);var ye;oa(),Kr&&Kr.then(pe=>pe.put(Q,de)).catch(pe=>vi(pe.message))})}(c,M,A),d=!0,o(null,C,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(C=>{f||o(new Error(C.message))})};return _?function(E,M){if(oa(),!Kr)return M(null);Kr.then(A=>{let C=Zc(E.url,{persistentParams:Ih});const D=E.headers.get("Range");D&&(C=Sh(C,{range:D})),A.match(C).then(V=>{const N=function(U){if(!U)return!1;const H=new Date(U.headers.get("Expires")||0),X=ea(U.headers.get("Cache-Control")||"");return H>Date.now()&&!X["no-cache"]}(V);A.delete(C),N&&A.put(C,V.clone()),M(null,V,N)}).catch(M)}).catch(M)}(c,v):v(null,null),{cancel:()=>{f=!0,d||l.abort()}}}(t,e);if(es()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(n,o){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const c in n.headers)l.setRequestHeader(c,n.headers[c]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{o(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let c=l.response;if(n.type==="json")try{c=JSON.parse(l.response)}catch(d){return o(d)}o(null,c,l.getResponseHeader("Cache-Control"),l.getResponseHeader("Expires"))}else o(new Il(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}}(t,e)},uo=function(t,e){return Qr(Gi(t,{type:"arrayBuffer"}),e)};function Sp(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const zh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let la,is;la=[],is=0;const ca=function(t,e){if(Sl.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),is>=bt.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return la.push(l),l}is++;let i=!1;const n=()=>{if(!i)for(i=!0,is--;la.length&&is{n(),l?e(l):c&&(self.createImageBitmap?function(_,y){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(b=>{y(null,b)}).catch(b=>{y(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(c,(_,y)=>e(_,y,d,f)):function(_,y){const v=new Image;v.onload=()=>{y(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=zh})},v.onerror=()=>y(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):zh}(c,(_,y)=>e(_,y,d,f)))});return{cancel:()=>{o.cancel(),n()}}},Jc="01",Kc="NO_ACCESS_TOKEN",Mp=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Dr(t){const e=t.match(Mp);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function ho(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}const Qc="mapbox.eventData";function Dh(t){if(!t)return null;const e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class po{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Dh(bt.ACCESS_TOKEN);let n="";return n=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(o,l)=>String.fromCharCode(+("0x"+l)))):bt.ACCESS_TOKEN||"",e?`${Qc}.${e}:${n}`:`${Qc}:${n}`}fetchEventData(){const e=vl("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const o=localStorage.getItem(i);o&&(this.eventData=JSON.parse(o));const l=localStorage.getItem(n);l&&(this.anonId=l)}catch{vi("Unable to read from LocalStorage")}}saveEventData(){const e=vl("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.anonId;if(e&&o)try{localStorage.setItem(n,o),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch{vi("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,n,o){if(!bt.EVENTS_URL)return;const l=Dr(bt.EVENTS_URL);l.params.push(`access_token=${o||bt.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(e).toISOString()},d=i?Gi(c,i):c,f={url:ho(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([d])};this.pendingRequest=function(_,y){return Qr(Gi(_,{method:"POST"}),y)}(f,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(o)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}const Rh=new class extends po{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){bt.EVENTS_URL&&bt.ACCESS_TOKEN&&Array.isArray(t)&&t.some(i=>Di(i)||Zt(i))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=Dh(bt.ACCESS_TOKEN),i=e?e.u:bt.ACCESS_TOKEN;let n=i!==this.eventData.tokenU;Gc(this.anonId)||(this.anonId=Ko(),n=!0);const o=this.queue.shift();if(this.eventData.lastSuccess){const l=new Date(this.eventData.lastSuccess),c=new Date(o),d=(o-this.eventData.lastSuccess)/864e5;n=n||d>=1||d<-1||l.getDate()!==c.getDate()}else n=!0;n?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:pr,skuId:Jc,"enabled.telemetry":!1,userId:this.anonId},l=>{l||(this.eventData.lastSuccess=o,this.eventData.tokenU=i)},t):this.processRequests()}},eu=Rh.postTurnstileEvent.bind(Rh),rs=new class extends po{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,n){this.skuToken=e,this.errorCb=n,bt.EVENTS_URL&&(i||bt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Kc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),Gc(this.anonId)||(this.anonId=Ko()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:pr,skuId:Jc,skuToken:this.skuToken,userId:this.anonId},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t))}remove(){this.errorCb=null}},Lh=rs.postMapLoadEvent.bind(rs),ua=new class extends po{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let e=this.mapInstanceIdMap.get(t);return e||(e=Ko(),this.mapInstanceIdMap.set(t,e)),e}getEventId(t){const e=this.eventIdPerMapInstanceMap.get(t)||0;return this.eventIdPerMapInstanceMap.set(t,e+1),e}postStyleLoadEvent(t,e){const{map:i,style:n,importedStyles:o}=e;if(!bt.EVENTS_URL||!t&&!bt.ACCESS_TOKEN)return;const l=this.getMapInstanceId(i),c={mapInstanceId:l,eventId:this.getEventId(l),style:n};o.length&&(c.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:c},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,payload:i}=this.queue.shift();this.postEvent(e,i,()=>{},t)}},kh=ua.postStyleLoadEvent.bind(ua),Oh=new class extends po{constructor(){super("gljs.performance")}postPerformanceEvent(t,e){bt.EVENTS_URL&&(t||bt.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,performanceData:i}=this.queue.shift(),n=function(o){const l=performance.getEntriesByType("resource"),c=performance.getEntriesByType("mark"),d=function(E){const M={};if(E){for(const A in E)if(A!=="other")for(const C of E[A]){const D=`${A}ResolveRangeMin`,V=`${A}ResolveRangeMax`,N=`${A}RequestCount`,U=`${A}RequestCachedCount`;M[D]=Math.min(M[D]||1/0,C.startTime),M[V]=Math.max(M[V]||-1/0,C.responseEnd);const H=X=>{M[X]===void 0&&(M[X]=0),++M[X]};C.transferSize!==void 0&&C.transferSize===0&&H(U),H(N)}}return M}(function(E,M){const A={};if(E)for(const C of E){const D=M(C);A[D]===void 0&&(A[D]=[]),A[D].push(C)}return A}(l,Os)),f=window.devicePixelRatio,_=navigator.connection||navigator.mozConnection||navigator.webkitConnection,y=_?_.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},b=(E,M,A)=>{A!=null&&E.push({name:M,value:A.toString()})};for(const E in d)b(v.counters,E,d[E]);if(o.interactionRange[0]!==1/0&&o.interactionRange[1]!==-1/0&&(b(v.counters,"interactionRangeMin",o.interactionRange[0]),b(v.counters,"interactionRangeMax",o.interactionRange[1])),c)for(const E of Object.keys(Dn)){const M=Dn[E],A=c.find(C=>C.name===M);A&&b(v.counters,M,A.startTime)}return b(v.counters,"visibilityHidden",o.visibilityHidden),b(v.attributes,"style",function(E){if(E)for(const M of E){const A=M.name.split("?")[0];if(to(A)){const C=A.split("/").slice(-2);if(C.length===2)return`mapbox://styles/${C[0]}/${C[1]}`}}}(l)),b(v.attributes,"terrainEnabled",o.terrainEnabled?"true":"false"),b(v.attributes,"fogEnabled",o.fogEnabled?"true":"false"),b(v.attributes,"projection",o.projection),b(v.attributes,"zoom",o.zoom),b(v.metadata,"devicePixelRatio",f),b(v.metadata,"connectionEffectiveType",y),b(v.metadata,"navigatorUserAgent",navigator.userAgent),b(v.metadata,"screenWidth",window.screen.width),b(v.metadata,"screenHeight",window.screen.height),b(v.metadata,"windowWidth",window.innerWidth),b(v.metadata,"windowHeight",window.innerHeight),b(v.metadata,"mapWidth",o.width/f),b(v.metadata,"mapHeight",o.height/f),b(v.metadata,"webglRenderer",o.renderer),b(v.metadata,"webglVendor",o.vendor),b(v.metadata,"sdkVersion",pr),b(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(i);for(const o of n.metadata);for(const o of n.counters);for(const o of n.attributes);this.postEvent(e,n,()=>{},t)}},Ip=Oh.postPerformanceEvent.bind(Oh),ha=new class extends po{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,i,n){if(!bt.API_URL||!bt.SESSION_PATH)return;const o=Dr(bt.API_URL+bt.SESSION_PATH);o.params.push(`sku=${e||""}`),o.params.push(`access_token=${n||bt.ACCESS_TOKEN||""}`);const l={url:ho(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(c,d){return Qr(Gi(c,{method:"GET"}),d)}(l,c=>{this.pendingRequest=null,i(c),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,e,i,n){this.skuToken=e,this.errorCb=n,bt.SESSION_PATH&&bt.API_URL&&(i||bt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Kc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t)}remove(){this.errorCb=null}},tu=ha.getSessionAPI.bind(ha),da=new Set;var fo={exports:{}},ns={exports:function(t,e){var i,n,o,l,c,d,f,_;for(n=t.length-(i=3&t.length),o=e,c=3432918353,d=461845907,_=0;_>>16)*c&65535)<<16)&4294967295)<<15|f>>>17))*d+(((f>>>16)*d&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(l>>>16)&65535)<<16);switch(f=0,i){case 3:f^=(255&t.charCodeAt(_+2))<<16;case 2:f^=(255&t.charCodeAt(_+1))<<8;case 1:o^=f=(65535&(f=(f=(65535&(f^=255&t.charCodeAt(_)))*c+(((f>>>16)*c&65535)<<16)&4294967295)<<15|f>>>17))*d+(((f>>>16)*d&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}},Ap={exports:function(t,e){for(var i,n=t.length,o=e^n,l=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++l;switch(n){case 3:o^=(255&t.charCodeAt(l+2))<<16;case 2:o^=(255&t.charCodeAt(l+1))<<8;case 1:o=1540483477*(65535&(o^=255&t.charCodeAt(l)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}},Bh=ns.exports,Cp=Ap.exports;fo.exports=Bh,fo.exports.murmur3=Bh,fo.exports.murmur2=Cp;var Al=Jr(fo.exports);class en{constructor(e,...i){Gi(this,i[0]||{}),this.type=e}}class pa extends en{constructor(e,i={}){super("error",Gi({error:e},i))}}function Cl(t,e,i){i[t]&&i[t].indexOf(e)!==-1||(i[t]=i[t]||[],i[t].push(e))}function iu(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);n!==-1&&i[t].splice(n,1)}}class mo{on(e,i){return this._listeners=this._listeners||{},Cl(e,i,this._listeners),this}off(e,i){return iu(e,i,this._listeners),iu(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Cl(e,i,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,i){const n=typeof e=="string"?new en(e,i):e,o=n.type;if(this.listens(o)){n.target=this;const l=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const f of l)f.call(this,n);const c=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const f of c)iu(o,f,this._oneTimeListeners),f.call(this,n);const d=this._eventedParent;d&&(Gi(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(n))}else n instanceof pa&&console.error(n.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}s.G=void 0;var Fh={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Pl(t){return(t=Math.round(t))<0?0:t>255?255:t}function ru(t){return Pl(t[t.length-1]==="%"?parseFloat(t)/100*255:parseInt(t))}function zl(t){return(e=t[t.length-1]==="%"?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function nu(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{s.G={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Fh)return Fh[i].slice();if(i[0]==="#")return i.length===4?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:i.length===7&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),o=i.indexOf(")");if(n!==-1&&o+1===i.length){var l=i.substr(0,n),c=i.substr(n+1,o-(n+1)).split(","),d=1;switch(l){case"rgba":if(c.length!==4)return null;d=zl(c.pop());case"rgb":return c.length!==3?null:[ru(c[0]),ru(c[1]),ru(c[2]),d];case"hsla":if(c.length!==4)return null;d=zl(c.pop());case"hsl":if(c.length!==3)return null;var f=(parseFloat(c[0])%360+360)%360/360,_=zl(c[1]),y=zl(c[2]),v=y<=.5?y*(_+1):y+_-y*_,b=2*y-v;return[Pl(255*nu(b,v,f+1/3)),Pl(255*nu(b,v,f)),Pl(255*nu(b,v,f-1/3)),d];default:return null}}return null}}catch{}class Ut{constructor(e,i,n,o=1){this.r=e,this.g=i,this.b=n,this.a=o}static parse(e){if(!e)return;if(e instanceof Ut)return e;if(typeof e!="string")return;const i=s.G(e);return i?new Ut(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,i,n,o]=this.a===0?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(n)},${o})`}toRenderColor(e){const{r:i,g:n,b:o,a:l}=this;return new Pp(e,i,n,o,l)}}class Pp{constructor(e,i,n,o,l){if(e){const c=e.image.height,d=c*c;i=l===0?0:i/l*(c-1),n=l===0?0:n/l*(c-1),o=l===0?0:o/l*(c-1);const f=Math.floor(i),_=Math.floor(n),y=Math.floor(o),v=Math.ceil(i),b=Math.ceil(n),E=Math.ceil(o),M=i-f,A=n-_,C=o-y,D=e.image.data,V=4*(f+_*d+y*c),N=4*(f+_*d+E*c),U=4*(f+b*d+y*c),H=4*(f+b*d+E*c),X=4*(v+_*d+y*c),Q=4*(v+_*d+E*c),ae=4*(v+b*d+y*c),de=4*(v+b*d+E*c);if(V<0||de>=D.length)throw new Error("out of range");this.r=rt(rt(rt(D[V],D[N],C),rt(D[U],D[H],C),A),rt(rt(D[X],D[Q],C),rt(D[ae],D[de],C),A),M)/255*l,this.g=rt(rt(rt(D[V+1],D[N+1],C),rt(D[U+1],D[H+1],C),A),rt(rt(D[X+1],D[Q+1],C),rt(D[ae+1],D[de+1],C),A),M)/255*l,this.b=rt(rt(rt(D[V+2],D[N+2],C),rt(D[U+2],D[H+2],C),A),rt(rt(D[X+2],D[Q+2],C),rt(D[ae+2],D[de+2],C),A),M)/255*l,this.a=l}else this.r=i,this.g=n,this.b=o,this.a=l}toArray(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[255*e/o,255*i/o,255*n/o,o]}toArray01(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[e/o,i/o,n/o,o]}toArray01Scaled(e){const{r:i,g:n,b:o,a:l}=this;return l===0?[0,0,0]:[i/l*e,n/l*e,o/l*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:n,a:o}=this;return[e,i,n,o]}toArray01Linear(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[Math.pow(e/o,2.2),Math.pow(i/o,2.2),Math.pow(n/o,2.2),o]}}function rt(t,e,i){return t*(1-i)+e*i}function ou(t,e,i){return t.map((n,o)=>rt(n,e[o],i))}Ut.black=new Ut(0,0,0,1),Ut.white=new Ut(1,1,1,1),Ut.transparent=new Ut(0,0,0,0),Ut.red=new Ut(1,0,0,1),Ut.blue=new Ut(0,0,1,1);var fa=Object.freeze({__proto__:null,array:ou,color:function(t,e,i){return new Ut(rt(t.r,e.r,i),rt(t.g,e.g,i),rt(t.b,e.b,i),rt(t.a,e.a,i))},number:rt});function os(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}class tn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class su{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,o]of i)this.bindings[n]=o}concat(e){return new su(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const mr={kind:"null"},We={kind:"number"},Lt={kind:"string"},Gt={kind:"boolean"},Rr={kind:"color"},ss={kind:"object"},Nt={kind:"value"},Dl={kind:"collator"},as={kind:"formatted"},_o={kind:"resolvedImage"};function Wi(t,e){return{kind:"array",itemType:t,N:e}}function mi(t){if(t.kind==="array"){const e=mi(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}const au=[mr,We,Lt,Gt,Rr,as,ss,Wi(Nt),_o];function ma(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ma(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(const i of au)if(!ma(i,e))return null}}return`Expected ${mi(t)} but found ${mi(e)} instead.`}function Lr(t,e){return e.some(i=>i.kind===t.kind)}function _a(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}class Rl{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ll{constructor(e,i,n,o,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=o,this.textColor=l}}class ir{constructor(e){this.sections=e}static fromString(e){return new ir([new Ll(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.namePrimary.length!==0)}static factory(e){return e instanceof ir?e:ir.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(n)}return e}}class _r{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new _r({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Nh(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ls(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Ut||t instanceof Rl||t instanceof ir||t instanceof _r)return!0;if(Array.isArray(t)){for(const e of t)if(!ls(e))return!1;return!0}if(typeof t=="object"){for(const e in t)if(!ls(t[e]))return!1;return!0}return!1}function Ii(t){if(t===null)return mr;if(typeof t=="string")return Lt;if(typeof t=="boolean")return Gt;if(typeof t=="number")return We;if(t instanceof Ut)return Rr;if(t instanceof Rl)return Dl;if(t instanceof ir)return as;if(t instanceof _r)return _o;if(Array.isArray(t)){const e=t.length;let i;for(const n of t){const o=Ii(n);if(i){if(i===o)continue;i=Nt;break}i=o}return Wi(i||Nt,e)}return ss}function qr(t){const e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Ut||t instanceof ir||t instanceof _r?t.toString():JSON.stringify(t)}class Zr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ls(e[1]))return i.error("invalid value");const n=e[1];let o=Ii(n);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new Zr(o,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Ut?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof ir?this.value.serialize():this.value}}class Ci{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const lu={string:Lt,number:We,boolean:Gt,object:ss};class gr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,o=1;const l=e[0];if(l==="array"){let d,f;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in lu)||_==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=lu[_],o++}else d=Nt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);f=e[2],o++}n=Wi(d,f)}else n=lu[l];const c=[];for(;oe.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const o=e.N;(typeof o=="number"||this.args.length>1)&&i.push(o)}}return i.concat(this.args.map(n=>n.serialize()))}}class go{constructor(e){this.type=as,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let c=1;c<=e.length-1;++c){const d=e[c];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let f=null;if(d["font-scale"]&&(f=i.parse(d["font-scale"],1,We),!f))return null;let _=null;if(d["text-font"]&&(_=i.parse(d["text-font"],1,Wi(Lt)),!_))return null;let y=null;if(d["text-color"]&&(y=i.parse(d["text-color"],1,Rr),!y))return null;const v=o[o.length-1];v.scale=f,v.font=_,v.textColor=y}else{const f=i.parse(e[c],1,Nt);if(!f)return null;const _=f.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:f,scale:null,font:null,textColor:null})}}return new go(o)}evaluate(e){return new ir(this.sections.map(i=>{const n=i.content.evaluate(e);return Ii(n)===_o?new Ll("",n,null,null,null):new Ll(qr(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class fn{constructor(e,i){this.type=_o,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");const n=i.parse(e[1],1,Lt);if(!n)return i.error("No image name provided.");if(e.length===2)return new fn(n);const o=i.parse(e[2],1,Lt);return o?new fn(n,o):i.error("Secondary image variant is not a string.")}evaluate(e){const i=_r.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function jn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}const zp={"to-boolean":Gt,"to-color":Rr,"to-number":We,"to-string":Lt};class mn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],o=[];let l=mr;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const c=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=Wi(i.expectedType.itemType,c)}else{if(!(c>0&&ls(e[1][0])))return null;l=Wi(Ii(e[1][0]),c)}for(let d=0;d4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Nh(i[0],i[1],i[2],i[3]),!n))return new Ut(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ci(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new Ci(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?ir.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?_r.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):qr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new go([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fn(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Dp=["Unknown","Point","LineString","Polygon"];class cu{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Dp[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:n,y:o}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(o*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Ut.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class cr{constructor(e,i,n,o,l){this.name=e,this.type=i,this._evaluate=n,this.args=o,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=cr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const n=e[0],o=cr.definitions[n];if(!o)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,c=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=[];let f=null,_=-1;for(const[y,v]of c){if(Array.isArray(y)&&y.length!==e.length-1)continue;d.push(y),_++,f=new id(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const b=[];let E=!1;for(let M=1;Mb)).map(Rp).join(" | "),v=[];for(let b=1;bi;){if(n-i>600){const f=n-i+1,_=e-i+1,y=Math.log(f),v=.5*Math.exp(2*y/3),b=.5*Math.sqrt(y*v*(f-v)/f)*(_-f/2<0?-1:1);jt(t,e,Math.max(i,Math.floor(e-_*v/f+b)),Math.min(n,Math.floor(e+(f-_)*v/f+b)),o)}const l=t[e];let c=i,d=n;for(cs(t,i,e),o(t[n],l)>0&&cs(t,i,n);c0;)d--}o(t[i],l)===0?cs(t,i,d):(d++,cs(t,d,n)),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function cs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vh(t,e){return te?1:0}function Lp(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o=e[2]||t[1]<=e[1]||t[3]>=e[3])}function kl(t,e,i){const n=t[0]-e[0],o=t[1]-e[1],l=t[0]-i[0],c=t[1]-i[1];return n*c-l*o==0&&n*l<=0&&o*c<=0}function _n(t,e,i=!1){let n=!1;for(let d=0,f=e.length;d(o=t)[1]!=(c=M)[1]>o[1]&&o[0]<(c[0]-l[0])*(o[1]-l[1])/(c[1]-l[1])+l[0]&&(n=!n)}}var o,l,c;return n}function Uh(t,e,i,n){const o=n[0]-i[0],l=n[1]-i[1],c=(t[0]-i[0])*l-o*(t[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return c>0&&d<0||c<0&&d>0}function xa(t,e,i,n){return(o=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-t[0],e[1]-t[1]])[1]-o[1]*l[0]!=0&&!(!Uh(t,e,i,n)||!Uh(i,n,t,e));var o,l}const Hi=8192;function kp(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*Hi),Math.round(n*o*Hi)]}function jh(t,e){for(let i=0;ii[2]){const o=.5*n;let l=t[0]-i[0]>o?-n:i[0]-t[0]>o?n:0;l===0&&(l=t[0]-i[2]>o?-n:i[2]-t[0]>o?n:0),t[0]+=l}ya(e,t)}function Bl(t,e,i,n){const o=Math.pow(2,n.z)*Hi,l=[n.x*Hi,n.y*Hi],c=[];if(!t)return c;for(const d of t)for(const f of d){const _=[f.x+l[0],f.y+l[1]];hu(_,e,i,o),c.push(_)}return c}function $h(t,e,i,n){const o=Math.pow(2,n.z)*Hi,l=[n.x*Hi,n.y*Hi],c=[];if(!t)return c;for(const f of t){const _=[];for(const y of f){const v=[y.x+l[0],y.y+l[1]];ya(e,v),_.push(v)}c.push(_)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const f of c)for(const _ of f)hu(_,e,i,o)}var d;return c}class rn{constructor(e,i){this.type=Gt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ls(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let o=0;oi)return du(l,c,(i-(n-d))/d)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[o,l]=i,c=yr(n[0]-o)*this.kx,d=(n[1]-l)*this.ky;if(c!==0||d!==0){const f=(yr(e[0]-o)*this.kx*c+(e[1]-l)*this.ky*d)/(c*c+d*d);f>1?(o=n[0],l=n[1]):f>0&&(o+=c/this.kx*f,l+=d/this.ky*f)}return c=yr(e[0]-o)*this.kx,d=(e[1]-l)*this.ky,Math.sqrt(c*c+d*d)}pointOnLine(e,i){let n=1/0,o=e[0][0],l=e[0][1],c=0,d=0;for(let f=0;f1?(_=e[f+1][0],y=e[f+1][1]):E>0&&(_+=v/this.kx*E,y+=b/this.ky*E)),v=yr(i[0]-_)*this.kx,b=(i[1]-y)*this.ky;const M=v*v+b*b;Ml.index||o.index===l.index&&o.t>l.t){const _=o;o=l,l=_}const c=[o.point],d=o.index+1,f=l.index;!Wh(n[d],c[0])&&d<=f&&c.push(n[d]);for(let _=d+1;_<=f;_++)c.push(n[_]);return Wh(n[f],l.point)||c.push(l.point),c}lineSliceAlong(e,i,n){let o=0;const l=[];for(let c=0;ce&&l.length===0&&l.push(du(d,f,(e-(o-_))/_)),o>=i)return l.push(du(d,f,(i-(o-_))/_)),l;o>e&&l.push(f)}return l}bufferPoint(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[0]+o,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[2]+o,e[3]+n]}insideBBox(e,i){return yr(e[0]-i[0])>=0&&yr(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Wh(t,e){return t[0]===e[0]&&t[1]===e[1]}function du(t,e,i){const n=yr(e[0]-t[0]);return[t[0]+n*i,t[1]+(e[1]-t[1])*i]}function yr(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}class $n{constructor(e=[],i=(n,o)=>no?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:n}=this,o=i[e];for(;e>0;){const l=e-1>>1,c=i[l];if(n(o,c)>=0)break;i[e]=c,e=l}i[e]=o}_down(e){const{data:i,compare:n}=this,o=this.length>>1,l=i[e];for(;e=0)break;i[e]=i[c],e=c}i[e]=l}}var Fe=8192;function Hh(t,e){return e.dist-t.dist}const Ta=100,pu=50;function Xh(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let i=0;i=t[0]&&t[1]t[1])return[null,null];const i=Nl(t);if(e){if(i===2)return[t,null];const n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}{if(i===1)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}}function xr(t,e){const i=[1/0,1/0,-1/0,-1/0];if(!gn(e,t.length))return i;for(let n=e[0];n<=e[1];++n)ya(i,t[n]);return i}function Vl(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;ie[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(o=t[1]-e[3]),t[3]=n)return n;if(Gn(o,l)){if(ed(t,e))return 0}else if(ed(e,t))return 0;let c=n;for(const d of t)for(let f=0,_=d.length,y=_-1;f<_;y=f++)for(const v of e)for(let b=0,E=v.length,M=E-1;b=l)continue;const y=_.range1;if(Nl(y)<=d){if(!gn(y,t.length))return NaN;if(e){const v=Vp(t,y,i,n);if((l=Math.min(l,v))===0)return l}else for(let v=y[0];v<=y[1];++v){const b=Np(t[v],i,n);if((l=Math.min(l,b))===0)return l}}else{const v=fu(y,e);if(v[0]!==null){const b=us(xr(t,v[0]),f,n);b=c)continue;const v=y.range1,b=y.range2;if(Nl(v)<=f&&Nl(b)<=_){if(!gn(v,t.length)||!gn(b,i.length))return NaN;if(e&&n?c=Math.min(c,Bp(t,v,i,b,o)):e||n?e&&!n?c=Math.min(c,mu(i,b,t,v,o)):!e&&n&&(c=Math.min(c,mu(t,v,i,b,o))):c=Math.min(c,Fp(t,v,i,b,o)),c===0)return c}else{const E=fu(v,e),M=fu(b,n);yo(d,c,o,t,i,E[0],M[0]),yo(d,c,o,t,i,E[0],M[1]),yo(d,c,o,t,i,E[1],M[0]),yo(d,c,o,t,i,E[1],M[1])}}return c}function _u(t,e,i,n,o=1/0){let l=o;const c=xr(t,[0,t.length-1]);for(const d of i)if(!(l!==1/0&&us(c,xr(d,[0,d.length-1]),n)>=l)&&(l=Math.min(l,Ea(t,e,d,!0,n,l)),l===0))return l;return l}function jl(t,e,i,n,o=1/0){let l=o;const c=xr(t,[0,t.length-1]);for(const d of i){if(l!==1/0&&us(c,Vl(d),n)>=l)continue;const f=br(t,e,d,n,l);if(isNaN(f))return f;if((l=Math.min(l,f))===0)return l}return l}function gu(t){return t==="Point"||t==="MultiPoint"||t==="LineString"||t==="MultiLineString"||t==="Polygon"||t==="MultiPolygon"}class xo{constructor(e,i){this.type=We,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ls(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let o=0;oi&&(t=i),t}class qn{constructor(e,i,n){this.type=e,this.key=i,this.scope=n}static parse(e,i){let n=i.expectedType;if(n==null&&(n=Nt),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const o=i.parse(e[1],1);if(!(o instanceof Zr))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const l=i.parse(e[2],2);return l instanceof Zr?new qn(n,qr(o.value),qr(l.value)):i.error("Scope of 'config' expression must be a string literal.")}return new qn(n,qr(o.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join(""),n=e.getConfig(i);if(!n)return null;const{type:o,value:l,values:c,minValue:d,maxValue:f,stepValue:_}=n,y=n.default.evaluate(e);let v=y;if(l){const b=e.scope;e.scope=(b||"").split("").slice(1).join(""),v=l.evaluate(e),e.scope=b}return o&&(v=Sa(o,v)),v===void 0||d===void 0&&f===void 0&&_===void 0||(typeof v=="number"?v=td(v,d,f,_):Array.isArray(v)&&(v=v.map(b=>typeof b=="number"?td(b,d,f,_):b))),l!==void 0&&v!==void 0&&c&&!c.includes(v)&&(v=y,o&&(v=Sa(o,v))),(o&&o!==this.type||v!==void 0&&Ii(v)!==this.type)&&(v=Sa(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ma(t){if(t instanceof cr&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof rn||t instanceof xo)return!1;let e=!0;return t.eachChild(i=>{e&&!Ma(i)&&(e=!1)}),e}function Gl(t){if(t instanceof cr&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!Gl(i)&&(e=!1)}),e}function Ia(t){if(t instanceof qn)return new Set([t.key]);let e=new Set;return t.eachChild(i=>{e=new Set([...e,...Ia(i)])}),e}function Aa(t,e){if(t instanceof cr&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!Aa(n,e)&&(i=!1)}),i}class Ca{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new Ca(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class $l{constructor(e,i=[],n,o=new su,l=[],c,d){this.registry=e,this.path=i,this.key=i.map(f=>`[${f}]`).join(""),this.scope=o,this.errors=l,this.expectedType=n,this._scope=c,this.options=d}parse(e,i,n,o,l={}){return i||n?this.concat(i,n,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function n(o,l,c){return c==="assert"?new gr(l,[o]):c==="coerce"?new mn(l,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(o){let l=o.parse(e,this);if(!l)return null;if(this.expectedType){const c=this.expectedType,d=l.type;if(c.kind!=="string"&&c.kind!=="number"&&c.kind!=="boolean"&&c.kind!=="object"&&c.kind!=="array"||d.kind!=="value")if(c.kind!=="color"&&c.kind!=="formatted"&&c.kind!=="resolvedImage"||d.kind!=="value"&&d.kind!=="string"){if(this.checkSubtype(c,d))return null}else l=n(l,c,i.typeAnnotation||"coerce");else l=n(l,c,i.typeAnnotation||"assert")}if(!(l instanceof Zr)&&l.type.kind!=="resolvedImage"&&Pa(l)){const c=new cu(this._scope,this.options);try{l=new Zr(l.type,l.evaluate(c))}catch(d){return this.error(d.message),null}}return l}return mn.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n){const o=typeof e=="number"?this.path.concat(e):this.path,l=n?this.scope.concat(n):this.scope;return new $l(this.registry,o,i||null,l,this.errors,this._scope,this.options)}error(e,...i){const n=`${this.key}${i.map(o=>`[${o}]`).join("")}`;this.errors.push(new tn(n,e))}checkSubtype(e,i){const n=ma(e,i);return n&&this.error(n),n}}var id=$l;function Pa(t){if(t instanceof Ca)return Pa(t.boundExpression);if(t instanceof cr&&t.name==="error"||t instanceof ga||t instanceof rn||t instanceof xo||t instanceof qn)return!1;const e=t instanceof mn||t instanceof gr;let i=!0;return t.eachChild(n=>{i=e?i&&Pa(n):i&&n instanceof Zr}),!!i&&Ma(t)&&Aa(t,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function vo(t,e){const i=t.length-1;let n,o,l=0,c=i,d=0;for(;l<=c;)if(d=Math.floor((l+c)/2),n=t[d],o=t[d+1],n<=e){if(d===i||ee))throw new Ci("Input is not a number.");c=d-1}return 0}class ds{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of n)this.labels.push(o),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let c=1;c=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const v=i.parse(f,y,l);if(!v)return null;l=l||v.type,o.push([d,v])}return new ds(l,n,o)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;return o>=i[l-1]?n[l-1].evaluate(e):n[vo(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const rd=.95047,yu=1.08883,nd=4/29,Zn=6/29,od=3*Zn*Zn,Up=Zn*Zn*Zn,jp=Math.PI/180,Gp=180/Math.PI;function ql(t){return t>Up?Math.pow(t,1/3):t/od+nd}function xu(t){return t>Zn?t*t*t:od*(t-nd)}function vu(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function bu(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sd(t){const e=bu(t.r),i=bu(t.g),n=bu(t.b),o=ql((.4124564*e+.3575761*i+.1804375*n)/rd),l=ql((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(o-l),b:200*(l-ql((.0193339*e+.119192*i+.9503041*n)/yu)),alpha:t.a}}function ad(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*xu(e),i=rd*xu(i),n=yu*xu(n),new Ut(vu(3.2404542*i-1.5371385*e-.4985314*n),vu(-.969266*i+1.8760108*e+.041556*n),vu(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function $p(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const za={forward:sd,reverse:ad,interpolate:function(t,e,i){return{l:rt(t.l,e.l,i),a:rt(t.a,e.a,i),b:rt(t.b,e.b,i),alpha:rt(t.alpha,e.alpha,i)}}},Da={forward:function(t){const{l:e,a:i,b:n}=sd(t),o=Math.atan2(n,i)*Gp;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*jp,i=t.c;return ad({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:$p(t.h,e.h,i),c:rt(t.c,e.c,i),l:rt(t.l,e.l,i),alpha:rt(t.alpha,e.alpha,i)}}};var Ra=Object.freeze({__proto__:null,hcl:Da,lab:za});class wr{constructor(e,i,n,o,l){this.type=e,this.operator=i,this.interpolation=n,this.input=o,this.labels=[],this.outputs=[];for(const[c,d]of l)this.labels.push(c),this.outputs.push(d)}static interpolationFactor(e,i,n,o){let l=0;if(e.name==="exponential")l=wu(i,e.base,n,o);else if(e.name==="linear")l=wu(i,1,n,o);else if(e.name==="cubic-bezier"){const c=e.controlPoints;l=new Vc(c[0],c[1],c[2],c[3]).solve(wu(i,1,n,o))}return l}static parse(e,i){let[n,o,l,...c]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const _=o[1];if(typeof _!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:_}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const _=o.slice(1);if(_.length!==4||_.some(y=>typeof y!="number"||y<0||y>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:_}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,We),!l)return null;const d=[];let f=null;n==="interpolate-hcl"||n==="interpolate-lab"?f=Rr:i.expectedType&&i.expectedType.kind!=="value"&&(f=i.expectedType);for(let _=0;_=y)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',b);const M=i.parse(v,E,f);if(!M)return null;f=f||M.type,d.push([y,M])}return f.kind==="number"||f.kind==="color"||f.kind==="array"&&f.itemType.kind==="number"&&typeof f.N=="number"?new wr(f,n,o,l,d):i.error(`Type ${mi(f)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;if(o>=i[l-1])return n[l-1].evaluate(e);const c=vo(i,o),d=wr.interpolationFactor(this.interpolation,o,i[c],i[c+1]),f=n[c].evaluate(e),_=n[c+1].evaluate(e);return this.operator==="interpolate"?fa[this.type.kind.toLowerCase()](f,_,d):this.operator==="interpolate-hcl"?Da.reverse(Da.interpolate(Da.forward(f),Da.forward(_),d)):za.reverse(za.interpolate(za.forward(f),za.forward(_),d))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const i=[this.operator,e,this.input.serialize()];for(let n=0;nma(o,d.type));return new bo(c?Nt:n,l)}evaluate(e){let i,n=null,o=0;for(const l of this.args){if(o++,n=l.evaluate(e),n&&n instanceof _r&&!n.available&&(i||(i=n),n=null,o===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Zl{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l=n.length)throw new Ci(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new Ci(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Tu{constructor(e,i){this.type=Gt,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,Nt);return n&&o?Lr(n.type,[Gt,Lt,We,mr,Nt])?new Tu(n,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mi(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!_a(i,["boolean","string","number","null"]))throw new Ci(`Expected first argument to be of type boolean, string, number or null, but found ${mi(Ii(i))} instead.`);if(!_a(n,["string","array"]))throw new Ci(`Expected second argument to be of type array or string, but found ${mi(Ii(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class La{constructor(e,i,n){this.type=We,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,Nt);if(!n||!o)return null;if(!Lr(n.type,[Gt,Lt,We,mr,Nt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mi(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new La(n,o,l):null}return new La(n,o)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!_a(i,["boolean","string","number","null"]))throw new Ci(`Expected first argument to be of type boolean, string, number or null, but found ${mi(Ii(i))} instead.`);if(!_a(n,["string","array"]))throw new Ci(`Expected second argument to be of type array or string, but found ${mi(Ii(n))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return n.indexOf(i,o)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Hl{constructor(e,i,n,o,l,c){this.inputType=e,this.type=i,this.input=n,this.cases=o,this.outputs=l,this.otherwise=c}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},c=[];for(let _=2;_Number.MAX_SAFE_INTEGER)return b.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return b.error("Numeric branch labels must be integer values.");if(n){if(b.checkSubtype(n,Ii(M)))return null}else n=Ii(M);if(l[String(M)]!==void 0)return b.error("Branch labels must be unique.");l[String(M)]=c.length}const E=i.parse(v,_,o);if(!E)return null;o=o||E.type,c.push(E)}const d=i.parse(e[1],1,Nt);if(!d)return null;const f=i.parse(e[e.length-1],e.length-1,o);return f?d.type.kind!=="value"&&i.concat(1).checkSubtype(n,d.type)?null:new Hl(n,o,d,l,c,f):null}evaluate(e){const i=this.input.evaluate(e);return(Ii(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],o={};for(const c of i){const d=o[this.cases[c]];d===void 0?(o[this.cases[c]]=n.length,n.push([this.cases[c],[c]])):n[d][1].push(c)}const l=c=>this.inputType.kind==="number"?Number(c):c;for(const[c,d]of n)e.push(d.length===1?l(d[0]):d.map(l)),e.push(this.outputs[c].serialize());return e.push(this.otherwise.serialize()),e}}class Xl{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const o=[];for(let c=1;ci.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class ka{constructor(e,i,n,o){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,We);if(!n||!o)return null;if(!Lr(n.type,[Wi(Nt),Lt,Nt]))return i.error(`Expected first argument to be of type array or string, but found ${mi(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new ka(n.type,n,o,l):null}return new ka(n.type,n,o)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!_a(i,["string","array"]))throw new Ci(`Expected first argument to be of type array or string, but found ${mi(Ii(i))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return i.slice(n,o)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Yl(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Jl(t,e,i,n){return n.compare(e,i)===0}function ps(t,e,i){const n=t!=="=="&&t!=="!=";return class J0{constructor(l,c,d){this.type=Gt,this.lhs=l,this.rhs=c,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||c.type.kind==="value"}static parse(l,c){if(l.length!==3&&l.length!==4)return c.error("Expected two or three arguments.");const d=l[0];let f=c.parse(l[1],1,Nt);if(!f)return null;if(!Yl(d,f.type))return c.concat(1).error(`"${d}" comparisons are not supported for type '${mi(f.type)}'.`);let _=c.parse(l[2],2,Nt);if(!_)return null;if(!Yl(d,_.type))return c.concat(2).error(`"${d}" comparisons are not supported for type '${mi(_.type)}'.`);if(f.type.kind!==_.type.kind&&f.type.kind!=="value"&&_.type.kind!=="value")return c.error(`Cannot compare types '${mi(f.type)}' and '${mi(_.type)}'.`);n&&(f.type.kind==="value"&&_.type.kind!=="value"?f=new gr(_.type,[f]):f.type.kind!=="value"&&_.type.kind==="value"&&(_=new gr(f.type,[_])));let y=null;if(l.length===4){if(f.type.kind!=="string"&&_.type.kind!=="string"&&f.type.kind!=="value"&&_.type.kind!=="value")return c.error("Cannot use collator to compare non-string types.");if(y=c.parse(l[3],3,Dl),!y)return null}return new J0(f,_,y)}evaluate(l){const c=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const f=Ii(c),_=Ii(d);if(f.kind!==_.kind||f.kind!=="string"&&f.kind!=="number")throw new Ci(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${f.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const f=Ii(c),_=Ii(d);if(f.kind!=="string"||_.kind!=="string")return e(l,c,d)}return this.collator?i(l,c,d,this.collator.evaluate(l)):e(l,c,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[t];return this.eachChild(c=>{l.push(c.serialize())}),l}}}const qp=ps("==",function(t,e,i){return e===i},Jl),ld=ps("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Jl(0,e,i,n)}),Zp=ps("<",function(t,e,i){return e",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Hp=ps("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Xp=ps(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class Eu{constructor(e,i,n,o,l,c){this.type=Lt,this.number=e,this.locale=i,this.currency=n,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=c}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Lt),!l))return null;let c=null;if(o.currency&&(c=i.parse(o.currency,1,Lt),!c))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,Lt),!d))return null;let f=null;if(o["min-fraction-digits"]&&(f=i.parse(o["min-fraction-digits"],1,We),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=i.parse(o["max-fraction-digits"],1,We),!_)?null:new Eu(n,l,c,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Su{constructor(e){this.type=We,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${mi(n.type)} instead.`):new Su(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Ci(`Expected value to be of type string or array, but found ${mi(Ii(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function cd(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const fs={"==":qp,"!=":ld,">":Wp,"<":Zp,">=":Xp,"<=":Hp,array:gr,at:Wl,boolean:gr,case:Xl,coalesce:bo,collator:ga,format:go,image:fn,in:Tu,"index-of":La,interpolate:wr,"interpolate-hcl":wr,"interpolate-lab":wr,length:Su,let:Zl,literal:Zr,match:Hl,number:gr,"number-format":Eu,object:gr,slice:ka,step:ds,string:gr,"to-boolean":mn,"to-color":mn,"to-number":mn,"to-string":mn,var:Ca,within:rn,distance:xo,config:qn};function ud(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=Nh(e,i,n,l);if(c)throw new Ci(c);return new Ut(e/255*l,i/255*l,n/255*l,l)}function Yp(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=function(_,y,v,b){return typeof _=="number"&&_>=0&&_<=360?typeof y=="number"&&y>=0&&y<=100&&typeof v=="number"&&v>=0&&v<=100?b===void 0||typeof b=="number"&&b>=0&&b<=1?null:`Invalid hsla value [${[_,y,v,b].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,n,l);if(c)throw new Ci(c);const d=`hsla(${e}, ${i}%, ${n}%, ${l})`,f=Ut.parse(d);if(!f)throw new Ci(`Failed to parse HSLA color: ${d}`);return f}function u(t,e){return t in e}function r(t,e){const i=e[t];return i===void 0?null:i}function a(t){return{type:t}}function h(t){return{result:"success",value:t}}function p(t){return{result:"error",value:t}}function m(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function g(t){return t["property-type"]==="data-driven"}function x(t){return m(t.expression,"measure-light")}function w(t){return m(t.expression,"zoom")}function T(t){return!!t.expression&&t.expression.interpolated}function S(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function I(t){return t}function P(t,e){const i=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",o=n||!(n||t.property!==void 0),l=t.type||(T(e)?"exponential":"interval");if(i&&((t=os({},t)).stops&&(t.stops=t.stops.map(_=>[_[0],Ut.parse(_[1])])),t.default=Ut.parse(t.default?t.default:e.default)),t.colorSpace&&t.colorSpace!=="rgb"&&!Ra[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let c,d,f;if(l==="exponential")c=O;else if(l==="interval")c=k;else if(l==="categorical"){c=L,d=Object.create(null);for(const _ of t.stops)d[_[0]]=_[1];f=typeof t.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);c=B}if(n){const _={},y=[];for(let E=0;EE[0]),evaluate:({zoom:E},M)=>O({stops:v,base:t.base},e,E).evaluate(E,M)}}if(o){const _=l==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:wr.interpolationFactor.bind(void 0,_),zoomStops:t.stops.map(y=>y[0]),evaluate:({zoom:y})=>c(t,e,y,d,f)}}return{kind:"source",evaluate(_,y){const v=y&&y.properties?y.properties[t.property]:void 0;return v===void 0?z(t.default,e.default):c(t,e,v,d,f)}}}function z(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function L(t,e,i,n,o){return z(typeof i===o?n[i]:void 0,t.default,e.default)}function k(t,e,i){if(jn(i)!=="number")return z(t.default,e.default);const n=t.stops.length;if(n===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=vo(t.stops.map(l=>l[0]),i);return t.stops[o][1]}function O(t,e,i){const n=t.base!==void 0?t.base:1;if(jn(i)!=="number")return z(t.default,e.default);const o=t.stops.length;if(o===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[o-1][0])return t.stops[o-1][1];const l=vo(t.stops.map(y=>y[0]),i),c=function(y,v,b,E){const M=E-b,A=y-b;return M===0?0:v===1?A/M:(Math.pow(v,A)-1)/(Math.pow(v,M)-1)}(i,n,t.stops[l][0],t.stops[l+1][0]),d=t.stops[l][1],f=t.stops[l+1][1];let _=fa[e.type]||I;if(t.colorSpace&&t.colorSpace!=="rgb"){const y=Ra[t.colorSpace];_=(v,b)=>y.reverse(y.interpolate(y.forward(v),y.forward(b),c))}return typeof d.evaluate=="function"?{evaluate(...y){const v=d.evaluate.apply(void 0,y),b=f.evaluate.apply(void 0,y);if(v!==void 0&&b!==void 0)return _(v,b,c)}}:_(d,f,c)}function B(t,e,i){return e.type==="color"?i=Ut.parse(i):e.type==="formatted"?i=ir.fromString(i.toString()):e.type==="resolvedImage"?i=_r.fromString(i.toString()):jn(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),z(i,t.default,e.default)}cr.register(fs,{error:[{kind:"error"},[Lt],(t,[e])=>{throw new Ci(e.evaluate(t))}],typeof:[Lt,[Nt],(t,[e])=>mi(Ii(e.evaluate(t)))],"to-rgba":[Wi(We,4),[Rr],(t,[e])=>e.evaluate(t).toRenderColor(null).toArray()],rgb:[Rr,[We,We,We],ud],rgba:[Rr,[We,We,We,We],ud],hsl:[Rr,[We,We,We],Yp],hsla:[Rr,[We,We,We,We],Yp],has:{type:Gt,overloads:[[[Lt],(t,[e])=>u(e.evaluate(t),t.properties())],[[Lt,ss],(t,[e,i])=>u(e.evaluate(t),i.evaluate(t))]]},get:{type:Nt,overloads:[[[Lt],(t,[e])=>r(e.evaluate(t),t.properties())],[[Lt,ss],(t,[e,i])=>r(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Nt,[Lt],(t,[e])=>r(e.evaluate(t),t.featureState||{})],properties:[ss,[],t=>t.properties()],"geometry-type":[Lt,[],t=>t.geometryType()],id:[Nt,[],t=>t.id()],zoom:[We,[],t=>t.globals.zoom],pitch:[We,[],t=>t.globals.pitch||0],"distance-from-center":[We,[],t=>t.distanceFromCenter()],"measure-light":[We,[Lt],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[We,[],t=>t.globals.heatmapDensity||0],"line-progress":[We,[],t=>t.globals.lineProgress||0],"raster-value":[We,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[We,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[We,[],t=>t.globals.skyRadialProgress||0],accumulated:[Nt,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[We,a(We),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[We,a(We),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:We,overloads:[[[We,We],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[We],(t,[e])=>-e.evaluate(t)]]},"/":[We,[We,We],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[We,[We,We],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[We,[],()=>Math.LN2],pi:[We,[],()=>Math.PI],e:[We,[],()=>Math.E],"^":[We,[We,We],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[We,[We],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[We,[We],(t,[e])=>Math.log(e.evaluate(t))],log2:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[We,[We],(t,[e])=>Math.sin(e.evaluate(t))],cos:[We,[We],(t,[e])=>Math.cos(e.evaluate(t))],tan:[We,[We],(t,[e])=>Math.tan(e.evaluate(t))],asin:[We,[We],(t,[e])=>Math.asin(e.evaluate(t))],acos:[We,[We],(t,[e])=>Math.acos(e.evaluate(t))],atan:[We,[We],(t,[e])=>Math.atan(e.evaluate(t))],min:[We,a(We),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[We,a(We),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[We,[We],(t,[e])=>Math.abs(e.evaluate(t))],round:[We,[We],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[We,[We],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[We,[We],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Gt,[Lt,Nt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Gt,[Nt],(t,[e])=>t.id()===e.value],"filter-type-==":[Gt,[Lt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Gt,[Nt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Gt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Gt,[Wi(Lt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Gt,[Wi(Nt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Gt,[Lt,Wi(Nt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Gt,[Lt,Wi(Nt)],(t,[e,i])=>function(n,o,l,c){for(;l<=c;){const d=l+c>>1;if(o[d]===n)return!0;o[d]>n?c=d-1:l=d+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Gt,overloads:[[[Gt,Gt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[a(Gt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Gt,overloads:[[[Gt,Gt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[a(Gt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Gt,[Gt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Gt,[Lt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Lt,a(Nt),(t,e)=>e.map(i=>qr(i.evaluate(t))).join("")],"resolved-locale":[Lt,[Dl],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[We,[We,We,Nt],(t,e)=>{const[i,n,o]=e.map(c=>c.evaluate(t));if(i>n||i===n)return i;let l;if(typeof o=="string")l=function(c){let d=0;if(c.length===0)return d;for(let f=0;fJSON.stringify(y)).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${_.message}`)),this._defaultValue}}}function $(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in fs}function j(t,e,i,n){const o=new id(fs,[],e?function(c){const d={color:Rr,string:Lt,number:We,enum:Lt,boolean:Gt,formatted:as,resolvedImage:_o};return c.type==="array"?Wi(d[c.value]||Nt,c.length):d[c.type]}(e):void 0,void 0,void 0,i,n),l=o.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?h(new G(l,e,i,n)):p(o.errors)}class J{constructor(e,i,n){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isStateDependent=e!=="constant"&&!Gl(i.expression),this.configDependencies=Ia(i.expression)}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}}class Z{constructor(e,i,n,o,l){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Gl(i.expression),this.isLightConstant=l,this.configDependencies=Ia(i.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}interpolationFactor(e,i,n){return this.interpolationType?wr.interpolationFactor(this.interpolationType,e,i,n):0}}function W(t,e,i,n){if((t=j(t,e,i,n)).result==="error")return t;const o=t.value.expression,l=Ma(o);if(!l&&!g(e))return p([new tn("","data expressions not supported")]);const c=Aa(o,["zoom","pitch","distance-from-center"]);if(!c&&!w(e))return p([new tn("","zoom expressions not supported")]);const d=Aa(o,["measure-light"]);if(!d&&!x(e))return p([new tn("","measure-light expression not supported")]);const f=e.expression&&e.expression.relaxZoomRestriction,_=ie(o);return _||c||f?_ instanceof tn?p([_]):_ instanceof wr&&!T(e)?p([new tn("",'"interpolate" expressions cannot be used with this property')]):h(_?new Z(l?"camera":"composite",t.value,_.labels,_ instanceof wr?_.interpolation:void 0,d):new J(l?"constant":"source",t.value,d)):p([new tn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ee{constructor(e,i){this._parameters=e,this._specification=i,os(this,P(this._parameters,this._specification))}static deserialize(e){return new ee(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ie(t){let e=null;if(t instanceof Zl)e=ie(t.result);else if(t instanceof bo){for(const i of t.args)if(e=ie(i),e)break}else(t instanceof ds||t instanceof wr)&&t.input instanceof cr&&t.input.name==="zoom"&&(e=t);return e instanceof tn||t.eachChild(i=>{const n=ie(i);n instanceof tn?e=n:e&&n&&e!==n&&(e=new tn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var ue=Y,re=3;function Y(t,e,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(var l=0;l=y[E+0]&&n>=y[E+1])?(c[b]=!0,l.push(_[b])):c[b]=!1}}},Y.prototype._forEachCell=function(t,e,i,n,o,l,c,d){for(var f=this._convertToCellCoord(t),_=this._convertToCellCoord(e),y=this._convertToCellCoord(i),v=this._convertToCellCoord(n),b=f;b<=y;b++)for(var E=_;E<=v;E++){var M=this.d*E+b;if((!d||d(this._convertFromCellCoord(b),this._convertFromCellCoord(E),this._convertFromCellCoord(b+1),this._convertFromCellCoord(E+1)))&&o.call(this,t,e,i,n,M,l,c,d))return}},Y.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Y.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Y.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=re+this.cells.length+1+1,i=0,n=0;n=0||(o[l]=he(t[l],e)));t instanceof Error&&(o.message=t.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(o.$name=n),o}throw new Error("can't serialize object of type "+typeof t)}function ve(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Ce(t)||Se(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ve);if(typeof t=="object"){const e=t.$name||"Object";if(e==="Map"){const o=new Map;for(const l of Object.keys(t))l!=="$name"&&o.set(l,ve(t[l]));return o}if(e==="Set"){const o=new Set;for(const l of Object.keys(t))l!=="$name"&&o.add(ve(t[l]));return o}const{klass:i}=fe[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const o of Object.keys(t))o!=="$name"&&(n[o]=ve(t[o]));return n}throw new Error("can't deserialize object of type "+typeof t)}const ne={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function Me(t){for(const e of t)if(Ge(e.charCodeAt(0)))return!0;return!1}function Ae(t){for(const e of t)if(!Ue(e.charCodeAt(0)))return!1;return!0}function Ue(t){return!(ne.Arabic(t)||ne["Arabic Supplement"](t)||ne["Arabic Extended-A"](t)||ne["Arabic Presentation Forms-A"](t)||ne["Arabic Presentation Forms-B"](t))}function Ge(t){return!(t!==746&&t!==747&&(t<4352||!(ne["Bopomofo Extended"](t)||ne.Bopomofo(t)||ne["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||ne["CJK Compatibility Ideographs"](t)||ne["CJK Compatibility"](t)||ne["CJK Radicals Supplement"](t)||ne["CJK Strokes"](t)||!(!ne["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||ne["CJK Unified Ideographs Extension A"](t)||ne["CJK Unified Ideographs"](t)||ne["Enclosed CJK Letters and Months"](t)||ne["Hangul Compatibility Jamo"](t)||ne["Hangul Jamo Extended-A"](t)||ne["Hangul Jamo Extended-B"](t)||ne["Hangul Jamo"](t)||ne["Hangul Syllables"](t)||ne.Hiragana(t)||ne["Ideographic Description Characters"](t)||ne.Kanbun(t)||ne["Kangxi Radicals"](t)||ne["Katakana Phonetic Extensions"](t)||ne.Katakana(t)&&t!==12540||!(!ne["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!ne["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||ne["Unified Canadian Aboriginal Syllabics"](t)||ne["Unified Canadian Aboriginal Syllabics Extended"](t)||ne["Vertical Forms"](t)||ne["Yijing Hexagram Symbols"](t)||ne["Yi Syllables"](t)||ne["Yi Radicals"](t))))}function He(t){return!(Ge(t)||function(e){return!!(ne["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ne["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ne["Letterlike Symbols"](e)||ne["Number Forms"](e)||ne["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ne["Control Pictures"](e)&&e!==9251||ne["Optical Character Recognition"](e)||ne["Enclosed Alphanumerics"](e)||ne["Geometric Shapes"](e)||ne["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ne["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ne["CJK Symbols and Punctuation"](e)||ne.Katakana(e)||ne["Private Use Area"](e)||ne["CJK Compatibility Forms"](e)||ne["Small Form Variants"](e)||ne["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function $e(t){return t>=1424&&t<=2303||ne["Arabic Presentation Forms-A"](t)||ne["Arabic Presentation Forms-B"](t)}function it(t,e){return!(!e&&$e(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||ne.Khmer(t))}function _t(t){for(const e of t)if($e(e.charCodeAt(0)))return!0;return!1}const nt="deferred",xt="loading",Ct="loaded";let ii=null,Jt="unavailable",Pt=null;const Xt=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(Jt="error"),ii&&ii(t)};function Tt(){St.fire(new en("pluginStateChange",{pluginStatus:Jt,pluginURL:Pt}))}const St=new mo,gt=function(){return Jt},Ot=function(){if(Jt!==nt||!Pt)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Jt=xt,Tt(),Pt&&uo({url:Pt},t=>{t?Xt(t):(Jt=Ct,Tt())})},Mt={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Jt===Ct||Mt.applyArabicShaping!=null,isLoading:()=>Jt===xt,setState(t){Jt=t.pluginStatus,Pt=t.pluginURL},isParsed:()=>Mt.applyArabicShaping!=null&&Mt.processBidirectionalText!=null&&Mt.processStyledBidirectionalText!=null,getPluginURL:()=>Pt};class at{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,n){for(const o of i)if(!it(o.charCodeAt(0),n))return!1;return!0}(e,Mt.isLoaded())}}class bi{constructor(e,i,n,o){this.property=e,this.value=i,this.expression=function(l,c,d,f){if(S(l))return new ee(l,c);if($(l)||Array.isArray(l)&&l.length>0){const _=W(l,c,d,f);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));return _.value}{let _=l;return typeof l=="string"&&c.type==="color"&&(_=Ut.parse(l)),{kind:"constant",configDependencies:new Set,evaluate:()=>_}}}(i===void 0?e.specification.default:i,e.specification,n,o)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n){return this.property.possiblyEvaluate(this,e,i,n)}}class wi{constructor(e,i,n){this.property=e,this.value=new bi(e,void 0,i,n)}transitioned(e,i){return new Yi(this.property,this.value,i,Gi({},e.transition,this.transition),e.now)}untransitioned(){return new Yi(this.property,this.value,null,{},0)}}class Xi{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this.configDependencies=new Set}getValue(e){return ar(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new wi(this._values[e].property,this._scope,this._options)),this._values[e].value=new bi(this._values[e].property,i===null?void 0:ar(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const o in e){const l=e[o];if(Ks(o,"-transition")){const c=o.slice(0,-11);n[c]&&this.setTransition(c,l)}else n.hasOwnProperty(o)&&this.setValue(o,l)}}getTransition(e){return ar(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new wi(this._values[e].property)),this._values[e].transition=ar(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const o=this.getTransition(i);o!==void 0&&(e[`${i}-transition`]=o)}return e}transitioned(e,i){const n=new Fi(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(e,i._values[o]);return n}untransitioned(){const e=new Fi(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Yi{constructor(e,i,n,o,l){const c=o.delay||0,d=o.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+c,this.end=this.begin+d,e.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,n),c=this.prior;if(c){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-line-alignment":{"type":"enum","values":{"inside":1,"outside":1,"center":1},"default":"center","property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function yn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Wr(t){if(Array.isArray(t))return t.map(Wr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Wr(t[i]);return e}return yn(t)}function xn(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!xn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function vn(t,e="fill"){if(t==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};xn(t)||(t=ms(t));const i=t;let n=!0;try{n=function(_){if(!Wn(_))return _;let y=Wr(_);return Ql(y),y=Kl(y),y}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. -This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md -and paste the contents of this message in the report. -Thank you! -Filter Expression: -${JSON.stringify(i,null,2)} - `)}const o=me[`filter_${e}`],l=j(n,o);let c=null;if(l.result==="error")throw new Error(l.value.map(_=>`${_.key}: ${_.message}`).join(", "));c=(_,y,v)=>l.value.evaluate(_,y,{},v);let d=null,f=null;if(n!==i){const _=j(i,o);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));d=(y,v,b,E,M)=>_.value.evaluate(y,v,{},b,void 0,void 0,E,M),f=!Ma(_.value.expression)}return{filter:c,dynamicFilter:d||void 0,needGeometry:ec(n),needFeature:!!f}}function Kl(t){if(!Array.isArray(t))return t;const e=function(i){if(Mu.has(i[0])){for(let n=1;nKl(i))}function Ql(t){let e=!1;const i=[];if(t[0]==="case"){for(let n=1;n",">=","<","<=","to-boolean"]);function wo(t,e){return te?1:0}function ec(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Jp(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(ms))):e==="all"?["all"].concat(t.slice(1).map(ms)):e==="none"?["all"].concat(t.slice(1).map(ms).map(hd)):e==="in"?Nm(t[1],t.slice(2)):e==="!in"?hd(Nm(t[1],t.slice(2))):e==="has"?Vm(t[1]):e!=="!has"||hd(Vm(t[1]));var i}function Jp(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Nm(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(wo)]]:["filter-in-small",t,["literal",e]]}}function Vm(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function hd(t){return["!",t]}const dd="";function Um(t,e){return e?`${t}${dd}${e}`:t}const jm="-transition",ex=new Set(["fill","line","background","hillshade","raster"]);class Tr extends mo{constructor(e,i,n,o,l){if(super(),this.id=e.id,this.fqid=Um(this.id,n),this.type=e.type,this.scope=n,this.lut=o,this.options=l,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new Ji(i.layout,this.scope,l),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint)){this._transitionablePaint=new Xi(i.paint,this.scope,l);for(const c in e.paint)this.setPaintProperty(c,e.paint[c]);for(const c in e.layout)this.setLayoutProperty(c,e.layout[c]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ni(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return ex.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...n.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return Ks(e,jm)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const n=this._transitionablePaint,o=n._properties.properties;if(Ks(e,jm)){const v=e.slice(0,-11);return o[v]&&n.setTransition(v,i||void 0),!1}if(!o[e])return!1;const l=n._values[e],c=l.value.isDataDriven(),d=l.value;n.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...n.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const f=n._values[e].value,_=f.isDataDriven(),y=Ks(e,"pattern")||e==="line-dasharray";return _||c||y||this._handleOverridablePaintPropertyUpdate(e,d,f)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return $i({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Li&&g(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=vn(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,n,o,l,c,d,f,_){}queryIntersectsMatchingFeature(e,i,n,o){}}const tx={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Iu{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class li{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function $t(t,e=1){let i=0,n=0;return{members:t.map(o=>{const l=tx[o.type].BYTES_PER_ELEMENT,c=i=Gm(i,Math.max(e,l)),d=o.components||1;return n=Math.max(n,l),i+=l*d,{name:o.name,type:o.type,components:d,offset:c}}),size:Gm(i,Math.max(n,e)),alignment:e}}function Gm(t,e){return Math.ceil(t/e)*e}class bn extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=n,e}}bn.prototype.bytesPerElement=4,se(bn,"StructArrayLayout2i4");class pd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=o,e}}pd.prototype.bytesPerElement=6,se(pd,"StructArrayLayout3i6");class To extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.int16[c+0]=i,this.int16[c+1]=n,this.int16[c+2]=o,this.int16[c+3]=l,e}}To.prototype.bytesPerElement=8,se(To,"StructArrayLayout4i8");class Kp extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.int16[d+0]=i,this.int16[d+1]=n,this.int16[d+2]=o,this.int16[d+3]=l,this.int16[d+4]=c,e}}Kp.prototype.bytesPerElement=10,se(Kp,"StructArrayLayout5i10");class Qp extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=6*e,y=12*e,v=3*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.uint8[y+4]=o,this.uint8[y+5]=l,this.uint8[y+6]=c,this.uint8[y+7]=d,this.float32[v+2]=f,e}}Qp.prototype.bytesPerElement=12,se(Qp,"StructArrayLayout2i4ub1f12");class _s extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.float32[c+0]=i,this.float32[c+1]=n,this.float32[c+2]=o,this.float32[c+3]=l,e}}_s.prototype.bytesPerElement=16,se(_s,"StructArrayLayout4f16");class gs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=o,e}}gs.prototype.bytesPerElement=12,se(gs,"StructArrayLayout3f12");class ys extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=6*e,f=3*e;return this.uint16[d+0]=i,this.uint16[d+1]=n,this.uint16[d+2]=o,this.uint16[d+3]=l,this.float32[f+2]=c,e}}ys.prototype.bytesPerElement=12,se(ys,"StructArrayLayout4ui1f12");class fd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.uint16[c+0]=i,this.uint16[c+1]=n,this.uint16[c+2]=o,this.uint16[c+3]=l,e}}fd.prototype.bytesPerElement=8,se(fd,"StructArrayLayout4ui8");class md extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const f=6*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=o,this.int16[f+3]=l,this.int16[f+4]=c,this.int16[f+5]=d,e}}md.prototype.bytesPerElement=12,se(md,"StructArrayLayout6i12");class ef extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,o,l,c,d,f,_,y,v,b)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E){const M=12*e;return this.int16[M+0]=i,this.int16[M+1]=n,this.int16[M+2]=o,this.int16[M+3]=l,this.uint16[M+4]=c,this.uint16[M+5]=d,this.uint16[M+6]=f,this.uint16[M+7]=_,this.int16[M+8]=y,this.int16[M+9]=v,this.int16[M+10]=b,this.int16[M+11]=E,e}}ef.prototype.bytesPerElement=24,se(ef,"StructArrayLayout4i4ui4i24");class tf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const f=10*e,_=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=o,this.float32[_+2]=l,this.float32[_+3]=c,this.float32[_+4]=d,e}}tf.prototype.bytesPerElement=20,se(tf,"StructArrayLayout3i3f20");class rf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}rf.prototype.bytesPerElement=4,se(rf,"StructArrayLayout1ul4");class xs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=n,e}}xs.prototype.bytesPerElement=4,se(xs,"StructArrayLayout2ui4");class nf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,n,o,l,c,d,f,_,y,v,b,E)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M){const A=20*e,C=10*e;return this.int16[A+0]=i,this.int16[A+1]=n,this.int16[A+2]=o,this.int16[A+3]=l,this.int16[A+4]=c,this.float32[C+3]=d,this.float32[C+4]=f,this.float32[C+5]=_,this.float32[C+6]=y,this.int16[A+14]=v,this.uint32[C+8]=b,this.uint16[A+18]=E,this.uint16[A+19]=M,e}}nf.prototype.bytesPerElement=40,se(nf,"StructArrayLayout5i4f1i1ul2ui40");class _d extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=8*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=o,this.int16[_+4]=l,this.int16[_+5]=c,this.int16[_+6]=d,this.int16[_+7]=f,e}}_d.prototype.bytesPerElement=16,se(_d,"StructArrayLayout3i2i2i16");class of extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=4*e,f=8*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.int16[f+6]=l,this.int16[f+7]=c,e}}of.prototype.bytesPerElement=16,se(of,"StructArrayLayout2f1f2i16");class sf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=12*e,d=3*e;return this.uint8[c+0]=i,this.uint8[c+1]=n,this.float32[d+1]=o,this.float32[d+2]=l,e}}sf.prototype.bytesPerElement=12,se(sf,"StructArrayLayout2ub2f12");class ki extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=o,e}}ki.prototype.bytesPerElement=6,se(ki,"StructArrayLayout3ui6");class af extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H){const X=this.length;return this.resize(X+1),this.emplace(X,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X){const Q=30*e,ae=15*e,de=60*e;return this.int16[Q+0]=i,this.int16[Q+1]=n,this.int16[Q+2]=o,this.float32[ae+2]=l,this.float32[ae+3]=c,this.uint16[Q+8]=d,this.uint16[Q+9]=f,this.uint32[ae+5]=_,this.uint32[ae+6]=y,this.uint32[ae+7]=v,this.uint16[Q+16]=b,this.uint16[Q+17]=E,this.uint16[Q+18]=M,this.float32[ae+10]=A,this.float32[ae+11]=C,this.uint8[de+48]=D,this.uint8[de+49]=V,this.uint8[de+50]=N,this.uint32[ae+13]=U,this.int16[Q+28]=H,this.uint8[de+58]=X,e}}af.prototype.bytesPerElement=60,se(af,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class lf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be,Ie){const Be=20*e,Ee=40*e,Ve=80*e;return this.float32[Be+0]=i,this.float32[Be+1]=n,this.int16[Ee+4]=o,this.int16[Ee+5]=l,this.int16[Ee+6]=c,this.int16[Ee+7]=d,this.int16[Ee+8]=f,this.int16[Ee+9]=_,this.int16[Ee+10]=y,this.int16[Ee+11]=v,this.int16[Ee+12]=b,this.uint16[Ee+13]=E,this.uint16[Ee+14]=M,this.uint16[Ee+15]=A,this.uint16[Ee+16]=C,this.uint16[Ee+17]=D,this.uint16[Ee+18]=V,this.uint16[Ee+19]=N,this.uint16[Ee+20]=U,this.uint16[Ee+21]=H,this.uint16[Ee+22]=X,this.uint16[Ee+23]=Q,this.uint16[Ee+24]=ae,this.uint16[Ee+25]=de,this.uint16[Ee+26]=ye,this.uint16[Ee+27]=pe,this.uint32[Be+14]=we,this.float32[Be+15]=De,this.float32[Be+16]=Te,this.float32[Be+17]=ke,this.float32[Be+18]=be,this.uint8[Ve+76]=Ie,e}}lf.prototype.bytesPerElement=80,se(lf,"StructArrayLayout2f9i15ui1ul4f1ub80");class tc extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}tc.prototype.bytesPerElement=4,se(tc,"StructArrayLayout1f4");class Oa extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.float32[d+3]=l,this.float32[d+4]=c,e}}Oa.prototype.bytesPerElement=20,se(Oa,"StructArrayLayout5f20");class cf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=7*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=o,this.float32[_+3]=l,this.float32[_+4]=c,this.float32[_+5]=d,this.float32[_+6]=f,e}}cf.prototype.bytesPerElement=28,se(cf,"StructArrayLayout7f28");class uf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=6*e;return this.uint32[3*e+0]=i,this.uint16[c+2]=n,this.uint16[c+3]=o,this.uint16[c+4]=l,e}}uf.prototype.bytesPerElement=12,se(uf,"StructArrayLayout1ul3ui12");class Au extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Au.prototype.bytesPerElement=2,se(Au,"StructArrayLayout1ui2");class Cu extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=n,e}}Cu.prototype.bytesPerElement=8,se(Cu,"StructArrayLayout2f8");class hf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D){const V=16*e;return this.float32[V+0]=i,this.float32[V+1]=n,this.float32[V+2]=o,this.float32[V+3]=l,this.float32[V+4]=c,this.float32[V+5]=d,this.float32[V+6]=f,this.float32[V+7]=_,this.float32[V+8]=y,this.float32[V+9]=v,this.float32[V+10]=b,this.float32[V+11]=E,this.float32[V+12]=M,this.float32[V+13]=A,this.float32[V+14]=C,this.float32[V+15]=D,e}}hf.prototype.bytesPerElement=64,se(hf,"StructArrayLayout16f64");class gd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=10*e,y=5*e;return this.uint16[_+0]=i,this.uint16[_+1]=n,this.uint16[_+2]=o,this.uint16[_+3]=l,this.float32[y+2]=c,this.float32[y+3]=d,this.float32[y+4]=f,e}}gd.prototype.bytesPerElement=20,se(gd,"StructArrayLayout4ui3f20");class df extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}df.prototype.bytesPerElement=2,se(df,"StructArrayLayout1i2");class pf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}pf.prototype.bytesPerElement=1,se(pf,"StructArrayLayout1ub1");class $m extends Iu{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}$m.prototype.size=40;class ff extends nf{get(e){return new $m(this,e)}}se(ff,"CollisionBoxArray");class qm extends Iu{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}qm.prototype.size=60;class Zm extends af{get(e){return new qm(this,e)}}se(Zm,"PlacedSymbolArray");class Wm extends Iu{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}Wm.prototype.size=80;class Hm extends lf{get(e){return new Wm(this,e)}}se(Hm,"SymbolInstanceArray");class Xm extends tc{getoffsetX(e){return this.float32[1*e+0]}}se(Xm,"GlyphOffsetArray");class Ym extends bn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}se(Ym,"SymbolLineVertexArray");class Jm extends Iu{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Jm.prototype.size=12;class Km extends uf{get(e){return new Jm(this,e)}}se(Km,"FeatureIndexArray");class Qm extends xs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}se(Qm,"FillExtrusionCentroidArray");class e_ extends Iu{get a_join_normal_inside_polygon0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside_polygon1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside_polygon2(){return this._structArray.int16[this._pos2+2]}get a_join_normal_inside_polygon3(){return this._structArray.int16[this._pos2+3]}}e_.prototype.size=8;class t_ extends To{get(e){return new e_(this,e)}}se(t_,"FillExtrusionWallArray");const ix=$t([{name:"a_pos",components:2,type:"Int16"}],4),rx=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class hi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,o){let l=this.segments[this.segments.length-1];return e>hi.MAX_VERTEX_ARRAY_LENGTH&&vi(`Max vertices per segment is ${hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!l||l.vertexLength+e>hi.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o)&&(l={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},o!==void 0&&(l.sortKey=o),this.segments.push(l)),l}prepareSegment(e,i,n,o){return this._prepareSegment(e,i.length,n.length,o)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,o){return new hi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0}])}}function i_(t,e){return 256*(t=Et(Math.floor(t),0,255))+Et(Math.floor(e),0,255)}hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,se(hi,"SegmentVector");const nx=$t([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ox=$t([{name:"a_dash",components:4,type:"Uint16"}]);class Pu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,o){this.ids.push(r_(e)),this.positions.push(i,n,o)}eachPosition(e,i){const n=r_(e);let o=0,l=this.ids.length-1;for(;o>1;this.ids[c]>=n?l=c:o=c+1}for(;this.ids[o]===n;)i(this.positions[3*o],this.positions[3*o+1],this.positions[3*o+2]),o++}static serialize(e,i){const n=new Float64Array(e.ids),o=new Uint32Array(e.positions);return mf(n,o,0,n.length-1),i&&(i.add(n.buffer),i.add(o.buffer)),{ids:n,positions:o}}static deserialize(e){const i=new Pu;let n;i.ids=e.ids,i.positions=e.positions;for(const o of i.ids)o!==n&&i.uniqueIds.push(o),n=o;return i.indexed=!0,i}}function r_(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Al(String(t))}function mf(t,e,i,n){for(;i>1];let l=i-1,c=n+1;for(;;){do l++;while(t[l]o);if(l>=c)break;yd(t,l,c),yd(e,3*l,3*c),yd(e,3*l+1,3*c+1),yd(e,3*l+2,3*c+2)}c-i`u_${l}`),this.type=n,this.context=o}setUniform(e,i,n,o,l){const c=o.constantOr(this.value);i.set(e,l,c instanceof Ut?c.toRenderColor(this.context.lut):c)}getBinding(e,i){return this.type==="color"?new n_(e):new ur(e)}}class ic{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,n,o,l){const c=l==="u_pattern"||l==="u_dash"?this.pattern:l==="u_pixel_ratio"?this.pixelRatio:null;c&&i.set(e,l,c)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new gf(e):new ur(e)}}class Mo{constructor(e,i,n,o){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,n,o,l,c,d){const f=this.paintVertexArray.length,_=this.expression.evaluate(new at(0,{brightness:c}),i,{},l,o,d);this.paintVertexArray.resize(e),this._setPaintValue(f,e,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate({zoom:0,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,f,this.context)}_setPaintValue(e,i,n,o){if(this.type==="color"){const l=xf(n.toRenderColor(o.lut));for(let c=e;c`u_${d}_t`),this.type=n,this.useIntegerZoom=o,this.context=l,this.maxValue=0,this.paintVertexAttributes=i.map(d=>({name:`a_${d}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate(new at(this.context.zoom,{brightness:c}),i,{},l,o,d),_=this.expression.evaluate(new at(this.context.zoom+1,{brightness:c}),i,{},l,o,d),y=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(y,e,f,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate({zoom:this.context.zoom,brightness:d},n,o,void 0,l),_=this.expression.evaluate({zoom:this.context.zoom+1,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,f,_,this.context)}_setPaintValue(e,i,n,o,l){if(this.type==="color"){const c=xf(n.toRenderColor(l.lut)),d=xf(n.toRenderColor(l.lut));for(let f=e;f!0){this.binders={},this._buffers=[],this.context=i;const o=[];for(const l in e.paint._values){const c=e.paint.get(l);if(!n(l)||!(c instanceof Li&&g(c.property.specification)))continue;const d=ux(l,e.type),f=c.value,_=c.property.specification.type,y=!!c.property.useIntegerZoom,v=l==="line-dasharray"||l.endsWith("pattern"),b=l==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(f.kind!=="constant"||b)if(f.kind==="source"||b||v){const E=o_(l,_,"source");this.binders[l]=v?new vs(f,d,_,E,e.id):new Mo(f,d,_,E),o.push(`/a_${l}`)}else{const E=o_(l,_,"composite");this.binders[l]=new wn(f,d,_,y,i,E),o.push(`/z_${l}`)}else this.binders[l]=v?new ic(f.value,d):new Du(f.value,d,_,i),o.push(`/u_${l}`)}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Mo||i instanceof wn?i.maxValue:0}populatePaintArrays(e,i,n,o,l,c,d){for(const f in this.binders){const _=this.binders[f];_.context=this.context,(_ instanceof Mo||_ instanceof wn||_ instanceof vs)&&_.populatePaintArray(e,i,n,o,l,c,d)}}setConstantPatternPositions(e){for(const i in this.binders){const n=this.binders[i];n instanceof ic&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,i,n,o,l,c,d,f){let _=!1;const y=Object.keys(e),v=y.length!==0,b=v?y:i.uniqueIds;this.context.lut=l.lut;for(const E in this.binders){const M=this.binders[E];if(M.context=this.context,(M instanceof Mo||M instanceof wn||M instanceof vs)&&(M.expression.isStateDependent===!0||M.expression.isLightConstant===!1)){const A=l.paint.get(E);M.expression=A.value;for(const C of b){const D=e[C.toString()];i.eachPosition(C,(V,N,U)=>{const H=o.feature(V);M.updatePaintArray(N,U,H,D,c,d,f)})}if(!v)for(const C of n.uniqueIds){const D=e[C.toString()];n.eachPosition(C,(V,N,U)=>{const H=o.feature(V);M.updatePaintArray(N,U,H,D,c,d,f)})}_=!0}}return _}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof Du||n instanceof ic)&&e.push(...n.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Mo||n instanceof wn||n instanceof vs)for(let o=0;o!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Ba(o,i,n);this.needsUpload=!1,this._featureMap=new Pu,this._featureMapWithoutIds=new Pu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,o,l,c,d,f){for(const _ in this.programConfigurations)this.programConfigurations[_].populatePaintArrays(e,i,o,l,c,d,f);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,o,l,c){for(const d of n)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,d,o,l,c||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const cx={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function ux(t,e){return cx[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const hx={"line-pattern":{source:ys,composite:ys},"fill-pattern":{source:ys,composite:ys},"fill-extrusion-pattern":{source:ys,composite:ys},"line-dasharray":{source:fd,composite:fd}},dx={color:{source:Cu,composite:_s},number:{source:tc,composite:Cu}};function o_(t,e,i){const n=hx[t];return n&&n[i]||dx[e][i]}se(Du,"ConstantBinder"),se(ic,"PatternConstantBinder"),se(Mo,"SourceExpressionBinder"),se(vs,"PatternCompositeBinder"),se(wn,"CompositeExpressionBinder"),se(Ba,"ProgramConfiguration",{omit:["_buffers"]}),se(bs,"ProgramConfigurationSet");const hr=Fe/Math.PI/2,vf=5,s_=6,px=16383,rc=64,bf=[rc,32,16],nn=-hr,on=hr;function nc(t,e,i,n=hr){return i=At(i),[t*Math.sin(i)*n,-e*n,t*Math.cos(i)*n]}function Fa(t,e,i){return nc(Math.cos(At(t)),Math.sin(At(t)),e,i)}const oc=63710088e-1,wf=2*Math.PI*oc;class Vt{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Vt(Jo(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,o=e.lat*i,l=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return oc*Math.acos(Math.min(l,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new ws({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return Fa(this.lat,this.lng,hr+e*hr/oc)}static convert(e){if(e instanceof Vt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Vt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Vt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class ws{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const n=e;this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]])}else{const n=e;this.setSouthWest(n[0]).setNorthEast(n[1])}}setNorthEast(e){return this._ne=e instanceof Vt?new Vt(e.lng,e.lat):Vt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Vt?new Vt(e.lng,e.lat):Vt.convert(e),this}extend(e){const i=this._sw,n=this._ne;let o,l;if(e instanceof Vt)o=e,l=e;else{if(!(e instanceof ws))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ws.convert(e)):this.extend(Vt.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Vt.convert(e)):this;if(o=e._sw,l=e._ne,!o||!l)return this}return i||n?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Vt(o.lng,o.lat),this._ne=new Vt(l.lng,l.lat)),this}getCenter(){return new Vt((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Vt(this.getWest(),this.getNorth())}getSouthEast(){return new Vt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=Vt.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(e){return!e||e instanceof ws?e:new ws(e)}}var a_={};(function(t,e){(function(i){function n(l,c,d){var f=o(256*l,256*(c=Math.pow(2,d)-c-1),d),_=o(256*(l+1),256*(c+1),d);return f[0]+","+f[1]+","+_[0]+","+_[1]}function o(l,c,d){var f=2*Math.PI*6378137/256/Math.pow(2,d);return[l*f-2*Math.PI*6378137/2,c*f-2*Math.PI*6378137/2]}i.getURL=function(l,c,d,f,_,y){return y=y||{},l+"?"+["bbox="+n(d,f,_),"format="+(y.format||"image/png"),"service="+(y.service||"WMS"),"version="+(y.version||"1.1.1"),"request="+(y.request||"GetMap"),"srs="+(y.srs||"EPSG:3857"),"width="+(y.width||256),"height="+(y.height||256),"layers="+c].join("&")},i.getTileBBox=n,i.getMercCoords=o,Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,a_);var fx=a_;class Na{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=sc(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const n=fx.getTileBBox(this.x,this.y,this.z),o=function(l,c,d){let f,_="";for(let y=l;y>0;y--)f=1<this.canonical.z?new Pi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Pi(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return sc(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return sc(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Pi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new Pi(i,this.wrap,i,n,o),new Pi(i,this.wrap,i,n+1,o),new Pi(i,this.wrap,i,n,o+1),new Pi(i,this.wrap,i,n+1,o+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let e=t.canonical.x-1,i=t.wrap;return e<0&&(e=(1<{let e=t.canonical.x+1,i=t.wrap;return e===1<new Pi(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(t.canonical.y===0?1<new Pi(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<=f?(Ef(t,e,i,_,y,l,v,d,f),Ef(t,_,y,n,o,v,c,d,f)):t.push(c)}function d_(t,e,i){let n=t[0],o=n.x,l=n.y;e(n);const c=[n];for(let d=1;dt.x+1||nt.y+1)&&vi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Tn(t,e,i){const n=t.loadGeometry(),o=t.extent,l=Fe/o;if(e&&i&&i.projection.isReprojectedInTileSpace){const c=1<{const E=Er((e.x+b.x/o)/c),M=Vi((e.y+b.y/o)/c),A=y.project(E,M);b.x=(A.x*d-f)*o,b.y=(A.y*d-_)*o};for(let b=0;b=o||M.y<0||M.y>=o||(v(M),E.push(M));n[b]=E}}for(const c of n)for(const d of c)xx(d,l);return n}function Io(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Tn(t):[]}}function bd(t,e,i,n,o){t.emplaceBack(2*e+(n+1)/2,2*i+(o+1)/2)}function wd(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class If{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new bn,this.indexArray=new ki,this.segments=new hi,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,n,o){const l=this.layers[0],c=[];let d=null;l.type==="circle"&&(d=l.layout.get("circle-sort-key"));for(const{feature:_,id:y,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,M=Io(_,E);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),M,n))continue;const A=d?d.evaluate(M,{},n):void 0,C={id:y,properties:_.properties,type:_.type,sourceLayerIndex:b,index:v,geometry:E?M.geometry:Tn(_,n,o),patterns:{},sortKey:A};c.push(C)}d&&c.sort((_,y)=>_.sortKey-y.sortKey);let f=null;o.projection.name==="globe"&&(this.globeExtVertexArray=new md,f=o.projection);for(const _ of c){const{geometry:y,index:v,sourceLayerIndex:b}=_,E=e[v].feature;this.addFeature(_,y,v,i.availableImages,n,f,i.brightness),i.featureIndex.insert(E,y,v,b,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ix.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rx.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,n,o,l,c,d){for(const f of i)for(const _ of f){const y=_.x,v=_.y;if(y<0||y>=Fe||v<0||v>=Fe)continue;if(c){const M=c.projectTilePoint(y,v,l),A=c.upVector(l,y,v),C=this.globeExtVertexArray;wd(C,M,A),wd(C,M,A),wd(C,M,A),wd(C,M,A)}const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),E=b.vertexLength;bd(this.layoutVertexArray,y,v,-1,-1),bd(this.layoutVertexArray,y,v,1,-1),bd(this.layoutVertexArray,y,v,1,1),bd(this.layoutVertexArray,y,v,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+2,E+3),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},o,l,d)}}function Af(t,e){for(let i=0;i1){if(Cf(t,e))return!0;for(let n=0;n1?i:i.sub(e)._mult(o)._add(e))}function __(t,e){let i,n,o,l=!1;for(let c=0;ce.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(l=!l)}return l}function Ts(t,e){let i=!1;for(let n=0,o=t.length-1;ne.y!=c.y>e.y&&e.x<(c.x-l.x)*(e.y-l.y)/(c.y-l.y)+l.x&&(i=!i)}return i}function g_(t,e,i,n,o){for(const c of t)if(e<=c.x&&i<=c.y&&n>=c.x&&o>=c.y)return!0;const l=[new je(e,i),new je(e,o),new je(n,o),new je(n,i)];if(t.length>2){for(const c of l)if(Ts(t,c))return!0}for(let c=0;co.x&&e.x>o.x||t.yo.y&&e.y>o.y)return!1;const l=Fn(t,e,i[0]);return l!==Fn(t,e,i[1])||l!==Fn(t,e,i[2])||l!==Fn(t,e,i[3])}function ac(t,e,i,n,o,l){let c=e.y-t.y,d=t.x-e.x;if(l=l||0){const f=c*c+d*d;if(f===0)return!0;const _=Math.sqrt(f);c/=_,d/=_}return!((i.x-t.x)*c+(i.y-t.y)*d-l<0||(n.x-t.x)*c+(n.y-t.y)*d-l<0||(o.x-t.x)*c+(o.y-t.y)*d-l<0)}function zf(t,e,i,n,o,l,c){return!(ac(t,e,n,o,l,c)||ac(e,i,n,o,l,c)||ac(i,t,n,o,l,c)||ac(n,o,t,e,i,c)||ac(o,l,t,e,i,c)||ac(l,n,t,e,i,c))}function lc(t,e,i){const n=e.paint.get(t).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Td(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function y_(t,e,i,n,o){if(!e[0]&&!e[1])return t;const l=je.convert(e)._mult(o);i==="viewport"&&l._rotate(-n);const c=[];for(let d=0;d=0;if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}function T_(t,e){for(const i of t.projections){const n=Ru(e,t.points[0],i.axis);if(i.projection[1]n[1])return 0}return 1}function E_(t,e){let i=0;const n=[0,0,0,0];for(let o=0;o=0&&i++;return i}class Lf{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=ci.fromPoints(this.points),this.projections=[],this.frustumEdges=[s.$.sub([],this.points[2],this.points[3]),s.$.sub([],this.points[0],this.points[3]),s.$.sub([],this.points[4],this.points[0]),s.$.sub([],this.points[5],this.points[1]),s.$.sub([],this.points[6],this.points[2]),s.$.sub([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const o=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:o,projection:Ru(this.points,this.points[0],o)}),this.projections.push({axis:l,projection:Ru(this.points,this.points[0],l)})}}static fromInvProjectionMatrix(e,i,n,o){const l=Math.pow(2,n),c=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=s.aB.transformMat4([],_,e),v=1/y[3]/i*l;return s.aB.mul(y,y,[v,v,o?1/y[3]:v,v])}),d=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=s.$.sub([],c[_[0]],c[_[1]]),v=s.$.sub([],c[_[2]],c[_[1]]),b=s.$.normalize([],s.$.cross([],y,v)),E=-s.$.dot(b,c[_[1]]);return b.concat(E)}),f=[];for(let _=0;__[1]||_[0]>f[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const n=i[3];if(s.$.dot([i[0],i[1],i[2]],e)+n<0)return!1}return!0}}class ci{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const o of e)s.$.min(i,i,o),s.$.max(n,n,o);return new ci(i,n)}static fromTileIdAndHeight(e,i,n){const o=1<e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}se(ci,"Aabb");const Ex=$t([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Ed}=Ex,S_=$t([{name:"a_pos_3",components:3,type:"Int16"}]);var Lu=$t([{name:"a_pos",type:"Int16",components:2}]);function Sd(t){return t*hr/oc}const Sx=[new ci([nn,nn,nn],[on,on,on]),new ci([nn,nn,nn],[0,0,on]),new ci([0,nn,nn],[on,0,on]),new ci([nn,0,nn],[0,on,on]),new ci([0,0,nn],[on,on,on])];function M_(t,e,i,n=!0){const o=s.$.scale([],t._camera.position,t.worldSize),l=[e,i,1,1];s.aB.transformMat4(l,l,t.pixelMatrixInverse),s.aB.scale(l,l,1/l[3]);const c=s.$.sub([],l,o),d=s.$.normalize([],c),f=t.globeMatrix,_=[f[12],f[13],f[14]],y=s.$.sub([],_,o),v=s.$.length(y),b=s.$.normalize([],y),E=t.worldSize/(2*Math.PI),M=s.$.dot(b,d),A=Math.asin(E/v);if(A1?null:function(n,o,l,c){const d=Math.sin(l);return n*(Math.sin((1-c)*l)/d)+o*(Math.sin(c*l)/d)}(t.a[e],t.b[e],t.angle,Et(i,0,1))+t.center[e]}function Yn(t){if(t.z<=1)return Sx[t.z+2*t.y+t.x];const e=Of(Md(t));return ci.fromPoints(e)}function Ao(t,e,i){return s.$.scale(t,t,1-i),s.$.scaleAndAdd(t,t,e,i)}function I_(t,e){const i=Co(e.zoom);if(i===0)return Yn(t);const n=Md(t),o=Of(n),l=Hn(n.getWest())*e.worldSize,c=Hn(n.getEast())*e.worldSize,d=Xn(n.getNorth())*e.worldSize,f=Xn(n.getSouth())*e.worldSize,_=[l,d,0],y=[c,d,0],v=[l,f,0],b=[c,f,0],E=s.ae.invert([],e.globeMatrix);return s.$.transformMat4(_,_,E),s.$.transformMat4(y,y,E),s.$.transformMat4(v,v,E),s.$.transformMat4(b,b,E),o[0]=Ao(o[0],v,i),o[1]=Ao(o[1],b,i),o[2]=Ao(o[2],y,i),o[3]=Ao(o[3],_,i),ci.fromPoints(o)}function A_(t,e,i){for(const n of t)s.$.transformMat4(n,n,e),s.$.scale(n,n,i)}function C_(t,e,i,n){const o=e/t.worldSize,l=t.globeMatrix;if(i.z<=1){const de=Yn(i).getCorners();return A_(de,l,o),ci.fromPoints(de)}const c=Md(i,n),d=Of(c,hr+Sd(t._tileCoverLift));A_(d,l,o);const f=Number.MAX_VALUE,_=[-f,-f,-f],y=[f,f,f];if(c.contains(t.center)){for(const pe of d)s.$.min(y,y,pe),s.$.max(_,_,pe);_[2]=0;const de=t.point,ye=[de.x*o,de.y*o,0];return s.$.min(y,y,ye),s.$.max(_,_,ye),new ci(y,_)}if(t._tileCoverLift>0){for(const de of d)s.$.min(y,y,de),s.$.max(_,_,de);return new ci(y,_)}const v=[l[12]*o,l[13]*o,l[14]*o],b=c.getCenter(),E=Et(t.center.lat,-Ti,Ti),M=Et(b.lat,-Ti,Ti),A=Hn(t.center.lng),C=Xn(E);let D=A-Hn(b.lng);const V=C-Xn(M);D>.5?D-=1:D<-.5&&(D+=1);let N=0;if(Math.abs(D)>Math.abs(V))N=D>=0?1:3;else{N=V>=0?0:2;const de=[l[4]*o,l[5]*o,l[6]*o],ye=-Math.sin(At(V>=0?c.getSouth():c.getNorth()))*hr;s.$.scaleAndAdd(v,v,de,ye)}const U=d[N],H=d[(N+1)%4],X=new Mx(U,H,v),Q=[kf(X,0)||U[0],kf(X,1)||U[1],kf(X,2)||U[2]],ae=Co(t.zoom);if(ae>0){const de=function({x:pe,y:we,z:De},Te,ke,be,Ie){const Be=1/(1<.5?et=-1:Ke<-.5&&(et=1),Ee=((Ee+et)*Te-(be*=Te))*ke+be,Ve=((Ve+et)*Te-be)*ke+be,Oe=(Oe*Te-(Ie*=Te))*ke+Ie,Re=(Re*Te-Ie)*ke+Ie,[[Ee,Re,0],[Ve,Re,0],[Ve,Oe,0],[Ee,Oe,0]]}(i,e,t._pixelsPerMercatorPixel,A,C);for(let pe=0;peMath.PI/2*1.01}const L_=At(85),Ix=Math.cos(L_),Ax=Math.sin(L_),Cx=s.ae.create(),k_=t=>{const e=[];return t.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),t.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function O_(t,e,i,n,o,l,c,d,f){if(l&&t.queryGeometry.isAboveHorizon)return!1;l&&(f*=t.pixelToTileUnitsFactor);const _=t.tileID.canonical,y=i.projection.upVectorScale(_,i.center.lat,i.worldSize).metersToTile;for(const v of e)for(const b of v){const E=b.add(d),M=o&&i.elevation?i.elevation.exaggeration()*o.getElevationAt(E.x,E.y,!0):0,A=i.projection.projectTilePoint(E.x,E.y,_);if(M>0){const N=i.projection.upVector(_,E.x,E.y);A.x+=N[0]*y*M,A.y+=N[1]*y*M,A.z+=N[2]*y*M}const C=l?E:Px(A.x,A.y,A.z,n),D=l?t.tilespaceRays.map(N=>Dx(N,M)):t.queryGeometry.screenGeometry,V=s.aB.transformMat4([],[A.x,A.y,A.z,1],n);if(!c&&l?f*=V[3]/i.cameraToCenterDistance:c&&!l&&(f*=i.cameraToCenterDistance/V[3]),l){const N=Vi((b.y/Fe+_.y)/(1<<_.z));f/=i.projection.pixelsPerMeter(N,1)/dr(1,N)}if(vx(D,C,f))return!0}return!1}function Px(t,e,i,n){const o=s.aB.transformMat4([],[t,e,i,1],n);return new je(o[0]/o[3],o[1]/o[3])}const B_=s.$.fromValues(0,0,0),zx=s.$.fromValues(0,0,1);function Dx(t,e){const i=s.$.create();return B_[2]=e,t.intersectsPlane(B_,zx,i),new je(i[0],i[1])}class F_ extends If{}function N_(t,{width:e,height:i},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*n)throw new RangeError("mismatched image size")}else o=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=o,t}function V_(t,e,i){const{width:n,height:o}=e;n===t.width&&o===t.height||(Vf(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,o)},i,null),t.width=n,t.height=o,t.data=e.data)}function Vf(t,e,i,n,o,l,c,d){if(o.width===0||o.height===0)return e;if(o.width>t.width||o.height>t.height||i.x>t.width-o.width||i.y>t.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||n.x>e.width-o.width||n.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const f=t.data,_=e.data,y=l===4&&d;for(let v=0;v{e[t.evaluationKey]=f;const _=t.expression.evaluate(e);_&&(o.data[c+d+0]=Math.floor(255*_.r/_.a),o.data[c+d+1]=Math.floor(255*_.g/_.a),o.data[c+d+2]=Math.floor(255*_.b/_.a),o.data[c+d+3]=Math.floor(255*_.a))};if(t.clips)for(let c=0,d=0;c80*i){d=1/0,f=1/0;let y=-1/0,v=-1/0;for(let b=i;by&&(y=E),M>v&&(v=M)}_=Math.max(y-d,v-f),_=_!==0?32767/_:0}return Nu(l,c,i,d,f,_,0),c}function Z_(t,e,i,n,o){let l;if(o===function(c,d,f,_){let y=0;for(let v=d,b=f-_;v0)for(let c=e;c=e;c-=n)l=X_(c/n|0,t[c],t[c+1],l);return l&&Ad(l,l.next)&&(Uu(l),l=l.next),l}function Ua(t,e){if(!t)return t;e||(e=t);let i,n=t;do if(i=!1,n.steiner||!Ad(n,n.next)&&zi(n.prev,n,n.next)!==0)n=n.next;else{if(Uu(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function Nu(t,e,i,n,o,l,c){if(!t)return;!c&&l&&function(f,_,y,v){let b=f;do b.z===0&&(b.z=Uf(b.x,b.y,_,y,v)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==f);b.prevZ.nextZ=null,b.prevZ=null,function(E){let M,A=1;do{let C,D=E;E=null;let V=null;for(M=0;D;){M++;let N=D,U=0;for(let X=0;X0||H>0&&N;)U!==0&&(H===0||!N||D.z<=N.z)?(C=D,D=D.nextZ,U--):(C=N,N=N.nextZ,H--),V?V.nextZ=C:E=C,C.prevZ=V,V=C;D=N}V.nextZ=null,A*=2}while(M>1)}(b)}(t,n,o,l);let d=t;for(;t.prev!==t.next;){const f=t.prev,_=t.next;if(l?Ox(t,n,o,l):kx(t))e.push(f.i,t.i,_.i),Uu(t),t=_.next,d=_.next;else if((t=_)===d){c?c===1?Nu(t=Bx(Ua(t),e),e,i,n,o,l,2):c===2&&Fx(t,e,i,n,o,l):Nu(Ua(t),e,i,n,o,l,1);break}}}function kx(t){const e=t.prev,i=t,n=t.next;if(zi(e,i,n)>=0)return!1;const o=e.x,l=i.x,c=n.x,d=e.y,f=i.y,_=n.y,y=ol?o>c?o:c:l>c?l:c,E=d>f?d>_?d:_:f>_?f:_;let M=n.next;for(;M!==e;){if(M.x>=y&&M.x<=b&&M.y>=v&&M.y<=E&&cc(o,d,l,f,c,_,M.x,M.y)&&zi(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function Ox(t,e,i,n){const o=t.prev,l=t,c=t.next;if(zi(o,l,c)>=0)return!1;const d=o.x,f=l.x,_=c.x,y=o.y,v=l.y,b=c.y,E=df?d>_?d:_:f>_?f:_,C=y>v?y>b?y:b:v>b?v:b,D=Uf(E,M,e,i,n),V=Uf(A,C,e,i,n);let N=t.prevZ,U=t.nextZ;for(;N&&N.z>=D&&U&&U.z<=V;){if(N.x>=E&&N.x<=A&&N.y>=M&&N.y<=C&&N!==o&&N!==c&&cc(d,y,f,v,_,b,N.x,N.y)&&zi(N.prev,N,N.next)>=0||(N=N.prevZ,U.x>=E&&U.x<=A&&U.y>=M&&U.y<=C&&U!==o&&U!==c&&cc(d,y,f,v,_,b,U.x,U.y)&&zi(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;N&&N.z>=D;){if(N.x>=E&&N.x<=A&&N.y>=M&&N.y<=C&&N!==o&&N!==c&&cc(d,y,f,v,_,b,N.x,N.y)&&zi(N.prev,N,N.next)>=0)return!1;N=N.prevZ}for(;U&&U.z<=V;){if(U.x>=E&&U.x<=A&&U.y>=M&&U.y<=C&&U!==o&&U!==c&&cc(d,y,f,v,_,b,U.x,U.y)&&zi(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function Bx(t,e){let i=t;do{const n=i.prev,o=i.next.next;!Ad(n,o)&&W_(n,i,i.next,o)&&Vu(n,o)&&Vu(o,n)&&(e.push(n.i,i.i,o.i),Uu(i),Uu(i.next),i=t=o),i=i.next}while(i!==t);return Ua(i)}function Fx(t,e,i,n,o,l){let c=t;do{let d=c.next.next;for(;d!==c.prev;){if(c.i!==d.i&&Gx(c,d)){let f=H_(c,d);return c=Ua(c,c.next),f=Ua(f,f.next),Nu(c,e,i,n,o,l,0),void Nu(f,e,i,n,o,l,0)}d=d.next}c=c.next}while(c!==t)}function Nx(t,e){return t.x-e.x}function Vx(t,e){const i=function(o,l){let c=l;const d=o.x,f=o.y;let _,y=-1/0;do{if(f<=c.y&&f>=c.next.y&&c.next.y!==c.y){const A=c.x+(f-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(A<=d&&A>y&&(y=A,_=c.x=c.x&&c.x>=b&&d!==c.x&&cc(f_.x||c.x===_.x&&Ux(_,c)))&&(_=c,M=A)}c=c.next}while(c!==v);return _}(t,e);if(!i)return e;const n=H_(i,t);return Ua(n,n.next),Ua(i,i.next)}function Ux(t,e){return zi(t.prev,t,e.prev)<0&&zi(e.next,t,t.next)<0}function Uf(t,e,i,n,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jx(t){let e=t,i=t;do(e.x=(t-c)*(l-d)&&(t-c)*(n-d)>=(i-c)*(e-d)&&(i-c)*(l-d)>=(o-c)*(n-d)}function Gx(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==n.i&&o.next.i!==n.i&&W_(o,o.next,i,n))return!0;o=o.next}while(o!==i);return!1}(t,e)&&(Vu(t,e)&&Vu(e,t)&&function(i,n){let o=i,l=!1;const c=(i.x+n.x)/2,d=(i.y+n.y)/2;do o.y>d!=o.next.y>d&&o.next.y!==o.y&&c<(o.next.x-o.x)*(d-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l}(t,e)&&(zi(t.prev,t,e.prev)||zi(t,e.prev,e))||Ad(t,e)&&zi(t.prev,t,t.next)>0&&zi(e.prev,e,e.next)>0)}function zi(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ad(t,e){return t.x===e.x&&t.y===e.y}function W_(t,e,i,n){const o=Pd(zi(t,e,i)),l=Pd(zi(t,e,n)),c=Pd(zi(i,n,t)),d=Pd(zi(i,n,e));return o!==l&&c!==d||!(o!==0||!Cd(t,i,e))||!(l!==0||!Cd(t,n,e))||!(c!==0||!Cd(i,t,n))||!(d!==0||!Cd(i,e,n))}function Cd(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Pd(t){return t>0?1:t<0?-1:0}function Vu(t,e){return zi(t.prev,t,t.next)<0?zi(t,e,t.next)>=0&&zi(t,t.prev,e)>=0:zi(t,e,t.prev)<0||zi(t,t.next,e)<0}function H_(t,e){const i=jf(t.i,t.x,t.y),n=jf(e.i,e.x,e.y),o=t.next,l=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function X_(t,e,i,n){const o=jf(t,e,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function Uu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jf(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zd(t,e){const i=t.length;if(i<=1)return[t];const n=[];let o,l;for(let c=0;c1)for(let c=0;ci.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bn,this.indexArray=new ki,this.indexArray2=new xs,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new hi,this.segments2=new hi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Gf("fill",this.layers,i);const l=this.layers[0].layout.get("fill-sort-key"),c=[];for(const{feature:d,id:f,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Io(d,v);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),b,n))continue;const E=l?l.evaluate(b,{},n,i.availableImages):void 0,M={id:f,properties:d.properties,type:d.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:Tn(d,n,o),patterns:{},sortKey:E};c.push(M)}l&&c.sort((d,f)=>d.sortKey-f.sortKey);for(const d of c){const{geometry:f,index:_,sourceLayerIndex:y}=d;if(this.hasPattern){const v=$f("fill",this.layers,d,this.zoom,i);this.patternFeatures.push(v)}else this.addFeature(d,f,_,n,{},i.availableImages,i.brightness);i.featureIndex.insert(e[_].feature,f,_,y,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Lx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,n,o,l,c=[],d){for(const f of zd(i,500)){let _=0;for(const A of f)_+=A.length;const y=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray),v=y.vertexLength,b=[],E=[];for(const A of f){if(A.length===0)continue;A!==f[0]&&E.push(b.length/2);const C=this.segments2.prepareSegment(A.length,this.layoutVertexArray,this.indexArray2),D=C.vertexLength;this.layoutVertexArray.emplaceBack(A[0].x,A[0].y),this.indexArray2.emplaceBack(D+A.length-1,D),b.push(A[0].x),b.push(A[0].y);for(let V=1;Vv.cellIdx-b.cellIdx||v.triIdx-b.triIdx);let y=0;for(;y<_.length;){const v=_[y].cellIdx,b={start:this.payload.length,len:0};for(;y<_.length&&_[y].cellIdx===v;)++b.len,this.payload.push(_[y++].triIdx);this.cells[v]=b}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=Jn(e.x-this.min.x,this.xScale,this.cellsX),o=Jn(e.y-this.min.y,this.yScale,this.cellsY),l=this.cells[o*this.cellsX+n];if(l){this._lazyInitLookup();for(let c=0;cthis.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const o=Jn(e.x-this.min.x,this.xScale,this.cellsX),l=Jn(i.x-this.min.x,this.xScale,this.cellsX),c=Jn(e.y-this.min.y,this.yScale,this.cellsY),d=Jn(i.y-this.min.y,this.yScale,this.cellsY);for(let f=c;f<=d;f++)for(let _=o;_<=l;_++){const y=this.cells[f*this.cellsX+_];if(y)for(let v=0;vi.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[]}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}populate(e,i,n,o){const l=[];for(const{feature:c,id:d,index:f,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=Io(c,y);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),v,n))continue;const b={id:d,properties:c.properties,type:c.type,sourceLayerIndex:_,index:f,geometry:y?v.geometry:Tn(c,n,o),patterns:{}};l.push(b)}for(const c of l){const{geometry:d,index:f,sourceLayerIndex:_}=c;this.addFeature(c,d,f,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[f].feature,d,f,_,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,o,l){}destroy(){}addFeature(e,i,n,o,l,c=[],d){for(const f of zd(i,2)){const _=[],y=[],v=[],b=new je(1/0,1/0),E=new je(-1/0,-1/0);for(const C of f)if(C.length!==0){C!==f[0]&&v.push(y.length/2);for(let D=0;D>3}if(o--,n===1||n===2)l+=t.readSVarint(),c+=t.readSVarint(),n===1&&(e&&d.push(e),e=[]),e.push(new Kx(l,c));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&d.push(e),d},uc.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,o=0,l=0,c=1/0,d=-1/0,f=1/0,_=-1/0;t.pos>3}if(n--,i===1||i===2)(o+=t.readSVarint())d&&(d=o),(l+=t.readSVarint())_&&(_=l);else if(i!==7)throw new Error("unknown command "+i)}return[c,f,d,_]},uc.prototype.toGeoJSON=function(t,e,i){var n,o,l=this.extent*Math.pow(2,i),c=this.extent*t,d=this.extent*e,f=this.loadGeometry(),_=uc.types[this.type];function y(E){for(var M=0;M>3;o=c===1?n.readString():c===2?n.readFloat():c===3?n.readDouble():c===4?n.readVarint64():c===5?n.readVarint():c===6?n.readSVarint():c===7?n.readBoolean():null}return o}(i))}rg.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new tv(this._pbf,e,this.extent,this._keys,this._values)};var rv=ig;function nv(t,e,i){if(t===3){var n=new rv(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}var Zf=Rd.VectorTile=function(t,e){this.layers=t.readFields(nv,{},e)},Ld=Rd.VectorTileFeature=tg;Rd.VectorTileLayer=ig;class ja extends je{constructor(e,i,n){super(e,i),this.z=n}}class ng extends ja{constructor(e,i,n,o){super(e,i,n),this.w=o}}function kd(t,e,i,n){const o=[],l=n===0?(c,d,f,_,y,v)=>{c.push(new je(v,f+(v-d)/(_-d)*(y-f)))}:(c,d,f,_,y,v)=>{c.push(new je(d+(v-f)/(y-f)*(_-d),v))};for(const c of t){const d=[];for(const f of c){if(f.length<=2)continue;const _=[];for(let b=0;be&&l(_,E,M,A,C,e):D>i?V=e&&l(_,E,M,A,C,e),V>i&&D<=i&&l(_,E,M,A,C,i)}let y=f[f.length-1];const v=n===0?y.x:y.y;v>=e&&v<=i&&_.push(y),_.length&&(y=_[_.length-1],_[0].x===y.x&&_[0].y===y.y||_.push(_[0]),d.push(_))}d.length&&o.push(d)}return o}function og(t,e,i,n){const o=i==="x"?"y":"x",l=(n-t[i])/(e[i]-t[i]);t[o]=t[o]+(e[o]-t[o])*l,t[i]=n,t.hasOwnProperty("z")&&(t.z=rt(t.z,e.z,l)),t.hasOwnProperty("w")&&(t.w=rt(t.w,e.w,l))}function sg(t,e,i,n){const o=i,l=n;for(const c of["x","y"]){let d=t,f=e;d[c]>=f[c]&&(d=e,f=t),d[c]o&&og(d,f,c,o),d[c]l&&og(f,d,c,l)}}const Od=Number.MAX_SAFE_INTEGER;function ag(t,e,i,n){return t.orderc===o)===void 0}(n,t.clipScope)}function Bd(t,e){return t.x-e.x||t.y-e.y}function lg(t,e){return Bd(t.min,e.min)===0&&Bd(t.max,e.max)===0}function Wf(t,e){return!(t.min.x>e.max.x||t.max.xe.max.y||t.max.ynew je((f.x+l.x*Fe)*d-c.x*Fe,(f.y+l.y*Fe)*d-c.y*Fe))}return ug(i,o,t.indices,0,t.indices.length,0,0)}function dg(t,e,i,n){const o=Math.pow(2,n.z-i.z);return new je((t+i.x*Fe)*o-n.x*Fe,(e+i.y*Fe)*o-n.y*Fe)}function pg(t,e){const i=[];e.footprint.grid.queryPoint(t,i);const n=e.footprint.indices,o=e.footprint.vertices;for(let l=0;le[c])return null}else{const d=1/n[c];let f=(t[c]-i[c])*d,_=(e[c]-i[c])*d;if(f>_){const y=f;f=_,_=y}if(f>o&&(o=f),_l)return null}return o}function _g(t,e,i,n,o,l,c,d,f,_,y){const v=n-t,b=o-e,E=l-i,M=c-t,A=d-e,C=f-i,D=y[1]*C-y[2]*A,V=y[2]*M-y[0]*C,N=y[0]*A-y[1]*M,U=v*D+b*V+E*N;if(Math.abs(U)<1e-15)return null;const H=1/U,X=_[0]-t,Q=_[1]-e,ae=_[2]-i,de=(X*D+Q*V+ae*N)*H;if(de<0||de>1)return null;const ye=Q*E-ae*b,pe=ae*v-X*E,we=X*b-Q*v,De=(y[0]*ye+y[1]*pe+y[2]*we)*H;return De<0||de+De>1?null:(M*ye+A*pe+C*we)*H}function gg(t,e,i){return(t-e)/(i-e)}function yg(t,e,i,n,o,l,c,d,f){const _=1<{const V=C?1:0,N=(E+1)*A-V,U=M*A,H=(M+1)*A-V;D[0]=E*A,D[1]=U,D[2]=N,D[3]=H};let v=new fg(f);const b=[];for(let E=0;E=1;f/=2){const E=d[d.length-1];v=new fg(f);for(let M=0;M0;){const{idx:M,t:A,nodex:C,nodey:D,depth:V}=E.pop();if(this.leaves[M]){yg(C,D,V,e,i,n,o,v,b);const U=1<=be[2])return A}continue}let N=0;for(let U=0;U=_[y[ae]]&&(y.splice(ae,0,U),Q=!0);Q||(y[N]=U),N++}}for(let U=0;U=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],o=Fd.getUnpackVector(i);let l=Math.floor((e+o[3])/o[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new U_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,l=i*this.dim+this.dim,c=n*this.dim,d=n*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(n){case-1:c=d-1;break;case 1:d=c+1}const f=-i*this.dim,_=-n*this.dim;for(let y=c;ye.max.x&&(e.max.x=i.x,o=!0),i.ye.max.y&&(e.max.y=i.y,o=!0),((i.x===0||i.x===Fe)&&i.x===n.x)!=((i.y===0||i.y===Fe)&&i.y===n.y)&&this.processBorderOverlap(i,n),o&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,rt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Fe!=e.x>Fe&&this.addBorderIntersection(1,rt(i.y,e.y,(Fe-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,rt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Fe!=e.y>Fe&&this.addBorderIntersection(3,rt(i.x,e.x,(Fe-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];in[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new je(0,0):new je(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function Mg(t,e){const i=t.add(e)._unit(),n=Et(t.x*i.x+t.y*i.y,-1,1);var o,l,c;return o=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(o)))/4*pv*((l=t).x*(c=e).y-l.y*c.x<0?-1:1)}const fv=[t=>t.x<0,t=>t.x>Fe,t=>t.y<0,t=>t.y>Fe];function mv(t,e,i,n){const o=[4];if(n===0)return o;i._mult(n);const l=t.sub(i),c=e.sub(i),d=[t,e,l,c];for(let f=0;f<4;f++)for(const _ of d)if(fv[f](_)){o.push(f);break}return o}class Ig{constructor(e){this.vertexArray=new Kp,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut},i=>hv.includes(i)),this._segments=new hi,this.hiddenByLandmarkVertexArray=new pf,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new hi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,o=!1){const l=e.length;if(l>2){let c=Math.max(0,this._segments.get().length-1);const d=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[c].length);let f;c!==this._segments.get().length-1&&(c++,this._segmentToGroundQuads[c]=[],this._segmentToRegionTriCounts[c]=[0,0,0,0,0]);{const _=e[0],y=e[1];f=Mg(_.sub(e[l-1])._perp()._unit(),y.sub(_)._perp()._unit())}for(let _=0;_o.region-l.region);for(let n=0;nf+_,0);let d=0;for(let f=0;f<=4;f++){const _=c[f];if(_!==0){let y=this.regionSegments[f];y||(y=this.regionSegments[f]=new hi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+d,vertexLength:l.vertexLength,primitiveLength:_};y.get().push(v)}d+=_}for(let f=0;f0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Xx.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Vd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new ki,this.footprintVertices=new bn,this.footprintSegments=[],this.layoutVertexArray=new To,this.centroidVertexArray=new Qm,this.wallVertexArray=new t_,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut},i=>uv.includes(i)),this.segments=new hi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Ig(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,n,o){this.features=[],this.hasPattern=Gf("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=vd(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:l,id:c,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,y=Io(l,_);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),y,n))continue;const v={id:c,sourceLayerIndex:f,index:d,geometry:_?y.geometry:Tn(l,n,o),properties:l.properties,type:l.type,patterns:{}},b=this.layoutVertexArray.length;if(this.hasPattern)this.features.push($f("fill-extrusion",this.layers,v,this.zoom,i));else if(this.wallMode)for(const E of v.geometry)this.addFeature(v,[E],d,n,{},i.availableImages,o,i.brightness);else this.addFeature(v,v.geometry,d,n,{},i.availableImages,o,i.brightness);i.featureIndex.insert(l,v.geometry,d,f,this.index,b)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,o,l,c){for(const d of this.features){const{geometry:f}=d;if(this.wallMode)for(const _ of f)this.addFeature(d,[_],d.index,i,n,o,l,c);else this.addFeature(d,f,d.index,i,n,o,l,c)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.groundEffect.update(e,i,d,n,o,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Hx.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Yx.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Wx.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,n,o,l,c,d,f){const _=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,y=[new je(0,0),new je(Fe,Fe)],v=d.projection,b=v.name==="globe",E=this.wallMode||cv[e.type]==="Polygon",M=new Sg;M.centroidDataIndex=this.centroidData.length;const A=new Eg,C=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},o)<=0,D=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},o);let V;if(A.height=D,A.vertexArrayOffset=this.layoutVertexArray.length,A.groundVertexArrayOffset=this.groundEffect.vertexArray.length,b&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new md),this.wallMode){if(b)return void vi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;V=function(ye){const pe=ye[0].x===ye[ye.length-1].x&&ye[0].y===ye[ye.length-1].y;(function(Ke){let Ze=0;const Ne=Ke.length;for(let st=0;st=0})(ye)||(ye=ye.reverse());const De={isPolygon:pe,geometry:[],joinNormals:[]},Te=[],ke=[],be=[];let Ie=ye.length;if(Ie<(pe?3:2))return De;for(;Ie>=2&&ye[Ie-1].equals(ye[Ie-2]);)Ie--;let Be,Ee,Ve,Oe,Re,et=0;for(;et0;let Xe="miter";Xe==="miter"&&st>2&&(Xe="bevel");const ut=(ft,ht,vt,zt)=>{const It=new je(ft.x,ft.y),Kt=new je(ft.x,ft.y);It.x-=ht.x*zt,It.y-=ht.y*zt,Kt.x-=ht.x*Math.max(vt,1),Kt.y-=ht.y*Math.max(vt,1),be.push(ht),Te.push(It),ke.push(Kt)};if(Xe==="miter")Ze._mult(st),ut(Be,Ze,1,0);else{const ft=-Math.sqrt(st*st-1),ht=Qe?ft:0,vt=Qe?0:ft;Ee&&ut(Be,Oe,ht,vt),Ve&&ut(Be,Re,ht,vt)}}return De.geometry=[...Te,...ke.reverse(),Te[0]],De.joinNormals=[...be,...be.reverse(),be[be.length-1]],De}(i[0]),i=[V.geometry]}const N=(ye,pe)=>ye<(pe.length-1)/2||ye===pe.length-1,U=this.wallMode?[i]:zd(i,500);for(let ye=U.length-1;ye>=0;ye--){const pe=U[ye];(pe.length===0||(H=pe[0]).every(we=>we.x<=0)||H.every(we=>we.x>=Fe)||H.every(we=>we.y<=0)||H.every(we=>we.y>=Fe))&&U.splice(ye,1)}var H;let X;if(b)X=Lg(U,y,o);else{X=[];for(const ye of U)X.push({polygon:ye,bounds:y})}const Q=E?this.edgeRadius:0,ae=Q>0&&this.zoom<17,de=(ye,pe)=>{if(ye.length===0)return!1;const we=ye[ye.length-1];return pe.x===we.x&&pe.y===we.y};for(const{polygon:ye,bounds:pe}of X){let we=0,De=0;for(const Ie of ye)E&&!Ie[0].equals(Ie[Ie.length-1])&&Ie.push(Ie[0]),De+=E?Ie.length-1:Ie.length;const Te=this.segments.prepareSegment((E?5:4)*De,this.layoutVertexArray,this.indexArray);A.footprintSegIdx<0&&(A.footprintSegIdx=this.footprintSegments.length),A.polygonSegIdx<0&&(A.polygonSegIdx=this.polygonSegments.length);const ke={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},be=new Tg;if(be.vertexOffset=this.footprintVertices.length,be.indexOffset=3*this.footprintIndices.length,be.ringIndices=[],E){const Ie=[],Be=[];we=Te.vertexLength;for(let Ve=0;Ve4&&zg(Be[Be.length-2],Be[0],Be[1]),Ve=Q?_v(Be[Be.length-2],Be[0],Be[1],Q):0;const Oe=[];let Re,et,Ke;et=Be[1].sub(Be[0])._perp()._unit();let Ze=!0;for(let Ne=1,st=0;Ne0?1:0,zt=Qe.dist(Xe);if(st+zt>32768&&(st=0),Q){Ke=ut.sub(Xe)._perp()._unit();let mt=Cg(Qe,Xe,ut,Ag(et,Ke),Q);isNaN(mt)&&(mt=0);const qt=Xe.sub(Qe)._unit();Qe=Qe.add(qt.mult(Ve))._round(),Xe=Xe.add(qt.mult(-mt))._round(),Ve=mt,et=Ke,C&&this.zoom>=17&&(de(Oe,Qe)||Oe.push(Qe),de(Oe,Xe)||Oe.push(Xe))}const It=Te.vertexLength,Kt=Be.length>4&&zg(Qe,Xe,ut);let ti=Dg(st,Ee,Ze);if(ju(this.layoutVertexArray,Qe.x,Qe.y,ht,vt,0,0,ti),ju(this.layoutVertexArray,Qe.x,Qe.y,ht,vt,0,1,ti),this.wallMode){const mt=N(Ne-1,Be),qt=V.joinNormals[Ne-1];Gu(this.wallVertexArray,qt,!mt,V.isPolygon),Gu(this.wallVertexArray,qt,!mt,V.isPolygon)}if(st+=zt,ti=Dg(st,Kt,!Ze),Ee=Kt,ju(this.layoutVertexArray,Xe.x,Xe.y,ht,vt,0,0,ti),ju(this.layoutVertexArray,Xe.x,Xe.y,ht,vt,0,1,ti),this.wallMode){const mt=N(Ne,Be),qt=V.joinNormals[Ne];Gu(this.wallVertexArray,qt,!mt,V.isPolygon),Gu(this.wallVertexArray,qt,!mt,V.isPolygon)}if(Te.vertexLength+=4,this.indexArray.emplaceBack(It+0,It+1,It+2),this.indexArray.emplaceBack(It+1,It+3,It+2),Te.primitiveLength+=2,Q){const mt=we+(Ne===1?Be.length-2:Ne-2),qt=Ne===1?we:mt+1;if(this.indexArray.emplaceBack(It+1,mt,It+3),this.indexArray.emplaceBack(mt,qt,It+3),Te.primitiveLength+=2,Re===void 0&&(Re=It),!Xf(ut,Be[Ne],pe)){const Wt=Ne===Be.length-1?Re:Te.vertexLength;this.indexArray.emplaceBack(It+2,It+3,Wt),this.indexArray.emplaceBack(It+3,Wt+1,Wt),this.indexArray.emplaceBack(It+3,qt,Wt+1),Te.primitiveLength+=3}Ze=!Ze}if(b){const mt=this.layoutVertexExtArray,qt=v.projectTilePoint(Qe.x,Qe.y,o),Wt=v.projectTilePoint(Xe.x,Xe.y,o),oi=v.upVector(o,Qe.x,Qe.y),_i=v.upVector(o,Xe.x,Xe.y);$u(mt,qt,oi),$u(mt,qt,oi),$u(mt,Wt,_i),$u(mt,Wt,_i)}}E&&(we+=Be.length-1),C&&Q&&this.zoom>=17&&(Oe.length!==0&&de(Oe,Oe[0])&&Oe.pop(),this.groundEffect.addData(Oe,pe,_,Q>0))}this.footprintSegments.push(be),ke.triangleCount=this.indexArray.length-ke.triangleArrayOffset,this.polygonSegments.push(ke),++A.footprintSegLen,++A.polygonSegLen}if(A.vertexCount=this.layoutVertexArray.length-A.vertexArrayOffset,A.groundVertexCount=this.groundEffect.vertexArray.length-A.groundVertexArrayOffset,A.vertexCount!==0){if(A.centroidXY=M.borders?wg:this.encodeCentroid(M,A),this.centroidData.push(A),M.borders){this.featuresOnBorder.push(M);const ye=this.featuresOnBorder.length-1;for(let pe=0;pethis.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let d=0;dFe),y=2*_+(+(f.min.x+f.max.x>Fe)^_);for(let v=0;vd.triangleSegmentIdx===f.triangleSegmentIdx?d.subtile-f.subtile:d.triangleSegmentIdx-f.triangleSegmentIdx);let n=0,o=0,l=0;for(const d of e){if(d.triangleSegmentIdx!==n)break;l++}const c=e.length;for(;o!==e.length;){n=e[o].triangleSegmentIdx;let d=0,f=o,_=o;for(let y=f;y0&&this.triangleSubSegments.push({segment:E,min:v,max:b}),f=_;for(let M=f;M[A[0]*(1-D[0])+C[0]*D[0],A[1]*(1-D[1])+C[1]*D[1]],E=[],M=[];for(const A of this.triangleSubSegments){E[0]=A.min.x/Fe,E[1]=A.min.y/Fe,M[0]=A.max.x/Fe,M[1]=A.max.y/Fe;const C=b(y,v,E),D=b(y,v,M);if(new ci([C[0],C[1],l],[D[0],D[1],c]).intersectsPrecise(n)===0){_&&(o.segments.push(_),_=void 0);continue}const V=A.segment;_&&_.vertexOffset!==V.vertexOffset&&(o.segments.push(_),_=void 0),_?(_.vertexLength+=V.vertexLength,_.primitiveLength+=V.primitiveLength):_={vertexOffset:V.vertexOffset,primitiveLength:V.primitiveLength,vertexLength:V.vertexLength,primitiveOffset:V.primitiveOffset,sortKey:void 0,vaos:{}}}return _&&o.segments.push(_),o}encodeCentroid(e,i){const n=e.centroid(),o=i.span(),l=Math.min(7,Math.round(o.x*this.tileToMeter/10)),c=Math.min(7,Math.round(o.y*this.tileToMeter/10));return new je(Et(n.x,1,Fe-1)<<3|l,Et(n.y,1,Fe-1)<<3|c)}encodeBorderCentroid(e){if(!e.borders)return new je(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const o=i[0][0]!==n?0:1;return new je(6|(i[0][0]!==n?0:65528),(i[o][0]+i[o][1])/2<<3|6)}{const o=i[2][0]!==n?2:3;return new je((i[o][0]+i[o][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Ms,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,o=e.flags&Ms?wg:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==o.y||l!==o.x){for(let c=i;cf.max.x||f.min.x>c.max.x||c.min.y>f.max.y||f.min.y>c.max.y))for(let _=0;_i!=E>i&&e<(this.footprintVertices.int16[2*(y+c.vertexOffset)+0]-v)*(i-b)/(E-b)+v&&(o=!o)}d=f}}return o}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,o=!0;const l=4*(e+Fe)*Fe+(i+Fe);if(this.partLookup.hasOwnProperty(l)){const c=this.partLookup[l];return c?{height:c.height,hidden:!!(c.flags&Ms)}:void 0}for(const c of this.centroidData)e>c.max.x||c.min.x>e||i>c.max.y||c.min.y>i||this.footprintContainsPoint(e,i,c)&&c&&c.height>n&&(n=c.height,this.partLookup[l]=c,o=!!(c.flags&Ms));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:o};this.partLookup[l]=void 0}}function Ag(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function _v(t,e,i,n){const o=e.sub(t)._perp()._unit(),l=i.sub(e)._perp()._unit();return Cg(t,e,i,Ag(o,l),n)}function Cg(t,e,i,n,o){const l=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(i)/3,o*l/n)}function Xf(t,e,i){return t.xi[1].x&&e.x>i[1].x||t.yi[1].y&&e.y>i[1].y}function Pg(t,e){return t.xe[1].x||t.ye[1].y}function zg(t,e,i){if(t.x<0||t.x>=Fe||e.x<0||e.x>=Fe||i.x<0||i.x>=Fe)return!1;const n=i.sub(e),o=n.perp(),l=t.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&o.x*l.x+o.y*l.y<0}function Dg(t,e,i){const n=e?2|t:-3&t;return i?1|n:-2&n}function Rg(){const t=Math.PI/32,e=Math.tan(t),i=oc;return i*Math.sqrt(1+2*e*e)-i}function Lg(t,e,i){const n=1<{for(const ae of X)M.push({polygon:ae,bounds:Q})},C=Math.ceil(Math.log2(y)),D=Math.ceil(Math.log2(v)),V=C-D,N=[];for(let X=0;X0?0:1);for(let X=0;XQ+1?H.push({polygons:Te,bounds:be,depth:Q+1}):A(Te,be)}if(ke.length){const be=[new je(ae===0?De:de.x,ae===1?De:de.y),ye];N.length>Q+1?H.push({polygons:ke,bounds:be,depth:Q+1}):A(ke,be)}}return M}(t,e,Math.ceil((l-o)/11.25),Math.ceil((c-d)/11.25),1,(f,_,y)=>{if(f===0)return .5*(_+y);{const v=Vi((i.y+_/Fe)/n);return(Xn(.5*(Vi((i.y+y/Fe)/n)+v))*n-i.y)*Fe}})}function gv(t,e,i,n,o,l){const c=Math.pow(2,n.z-o.z);for(let d=0;d1&&(f=e[++d]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(y,v);let E;const M=l/n*(o+1);if(f.isDash){const A=o-Math.abs(M);E=Math.sqrt(b*b+A*A)}else E=o-Math.sqrt(b*b+M*M);this.image.data[c+_]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let f=e.length-1;f>=0;--f){const _=e[f],y=e[f+1];_.zeroLength?e.splice(f,1):y&&y.isDash===_.isDash&&(y.left=_.left,e.splice(f,1))}const n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const l=this.width*this.nextRow;let c=0,d=e[c];for(let f=0;f1&&(d=e[++c]);const _=Math.abs(f-d.left),y=Math.abs(f-d.right),v=Math.min(_,y);this.image.data[l+f]=Math.max(0,Math.min(255,(d.isDash?v:-v)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const o=i==="round",l=o?7:0,c=2*l+1;if(this.nextRow+c>this.height)return vi("LineAtlas out of space"),null;e.length===0&&e.push(1);let d=0;for(let y=0;yi.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Qp,this.layoutVertexArray2=new _s,this.patternVertexArray=new gs,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new hi,this.maxLineLength=0,this.zOffsetVertexArray=new tc,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:Fe/64}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Gf("line",this.layers,i);const l=this.layers[0].layout.get("line-sort-key"),c=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!c.isConstant()||!!c.constantOr(0);const d=[];for(const{feature:v,id:b,index:E,sourceLayerIndex:M}of e){const A=this.layers[0]._featureFilter.needGeometry,C=Io(v,A);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),C,n))continue;const D=l?l.evaluate(C,{},n):void 0,V={id:b,properties:v.properties,type:v.type,sourceLayerIndex:M,index:E,geometry:A?C.geometry:Tn(v,n,o),patterns:{},sortKey:D};d.push(V)}l&&d.sort((v,b)=>v.sortKey-b.sortKey);const{lineAtlas:f,featureIndex:_}=i,y=this.addConstantDashes(f);for(const v of d){const{geometry:b,index:E,sourceLayerIndex:M}=v;if(y&&this.addFeatureDashes(v,f),this.hasPattern){const A=$f("line",this.layers,v,this.zoom,i);this.patternFeatures.push(A)}else this.addFeature(v,b,E,n,f.positions,i.availableImages,i.brightness);_.insert(e[E].feature,b,E,M,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(o.kind!=="constant"||l.kind!=="constant")i=!0;else{const c=l.value,d=o.value;if(!d)continue;e.addDash(d,c)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const o of this.layers){const l=o.paint.get("line-dasharray").value,c=o.layout.get("line-cap").value;if(l.kind==="constant"&&c.kind==="constant")continue;let d,f;if(l.kind==="constant"){if(d=l.value,!d)continue}else d=l.evaluate({zoom:n},e);f=c.kind==="constant"?c.value:c.evaluate({zoom:n},e),i.addDash(d,f),e.patterns[o.id]=i.getKey(d,f)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,bv)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Tv)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ng.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xv),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,n,o,l,c,d){const f=this.layers[0].layout,_=f.get("line-join").evaluate(e,{}),y=f.get("line-cap").evaluate(e,{}),v=f.get("line-miter-limit"),b=f.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,o,_,y,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,o,d)}addLine(e,i,n,o,l,c,d){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.currentVertex=void 0;const f={zoom:this.zoom,lineProgress:void 0},_=this.layers[0].layout,y=o==="none";if(this.patternJoinNone=this.hasPattern&&y,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let X=0;X=2&&e[b-1].equals(e[b-2]);)b--;let E=0;for(;E0;if(Te&&X>E){const be=C.dist(D);if(be>2*M){const Ie=C.sub(C.sub(D)._mult(M/be)._round());this.updateDistance(D,Ie),this.addCurrentVertex(Ie,N,0,0,A,H),D=Ie}}if(Q&&ae==="round"&&(wec&&(ae="bevel"),ae==="bevel"&&(we>2&&(ae="flipbevel"),we100)ye=U.mult(-1);else{const be=we*N.add(U).mag()/N.sub(U).mag();ye._perp()._mult(be*(ke?-1:1))}this.addCurrentVertex(C,ye,0,0,A,H),this.addCurrentVertex(C,ye.mult(-1),0,0,A,H)}else if(ae==="bevel"||ae==="fakeround"){const be=-Math.sqrt(we*we-1),Ie=ke?be:0,Be=ke?0:be;if(D&&this.addCurrentVertex(C,N,Ie,Be,A,H),ae==="fakeround"){const Ee=Math.round(180*De/Math.PI/20);for(let Ve=1;Ve2*M){const Ie=C.add(V.sub(C)._mult(M/be)._round());this.updateDistance(C,Ie),this.addCurrentVertex(Ie,U,0,0,A,H),C=Ie}}}}addVerticesTo(e,i,n,o,l,c,d,f,_,y){const v=(i.w-e.w)/this.tessellationStep|0;if(v>1){this.lineSoFar=e.w;const b=(i.x-e.x)/v,E=(i.y-e.y)/v,M=(i.z-e.z)/v,A=(i.w-e.w)/v;for(let C=1;C=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,y),f.primitiveLength++),c?this.e2=y:this.e1=y,_!=null&&this.zOffsetVertexArray.emplaceBack(_)}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}function jg(t,e,i){return t.xi||t.yi}let Gg,$g;function qg(t,e,i){return e*(Fe/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function Zg(t,e){return 1/qg(t,1,e.tileZoom)}function Wg(t,e,i,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}se(Ud,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Hg=t=>{const e=[];Xg(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),t.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=t.layout.get("line-join").constantOr("miter")==="none",o=!!t.paint.get("line-pattern").constantOr(1);return n&&o&&e.push("LINE_JOIN_NONE"),e};function Xg(t){const e=t.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}class Yg{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i>1,y=-7,v=i?o-1:0,b=i?-1:1,E=t[e+v];for(v+=b,l=E&(1<<-y)-1,E>>=-y,y+=d;y>0;l=256*l+t[e+v],v+=b,y-=8);for(c=l&(1<<-y)-1,l>>=-y,y+=n;y>0;c=256*c+t[e+v],v+=b,y-=8);if(l===0)l=1-_;else{if(l===f)return c?NaN:1/0*(E?-1:1);c+=Math.pow(2,n),l-=_}return(E?-1:1)*c*Math.pow(2,l-n)},write:function(t,e,i,n,o,l){var c,d,f,_=8*l-o-1,y=(1<<_)-1,v=y>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:l-1,M=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,c=y):(c=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-c))<1&&(c--,f*=2),(e+=c+v>=1?b/f:b*Math.pow(2,1-v))*f>=2&&(c++,f/=2),c+v>=y?(d=0,c=y):c+v>=1?(d=(e*f-1)*Math.pow(2,o),c+=v):(d=e*Math.pow(2,v-1)*Math.pow(2,o),c=0));o>=8;t[i+E]=255&d,E+=M,d/=256,o-=8);for(c=c<0;t[i+E]=255&c,E+=M,c/=256,_-=8);t[i+E-M]|=128*A}},Jg=ui,jd=Lv;function ui(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ui.Varint=0,ui.Fixed64=1,ui.Bytes=2,ui.Fixed32=5;var Yf=4294967296,Kg=1/Yf,Qg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Po(t){return t.type===ui.Bytes?t.readVarint()+t.pos:t.pos+1}function dc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ey(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=t;o--)i.buf[o+n]=i.buf[o]}function kv(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function ty(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ui.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,l=this.pos;this.type=7&n,t(o,e,this),this.pos===l&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Gd(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ty(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Gd(this.buf,this.pos)+Gd(this.buf,this.pos+4)*Yf;return this.pos+=8,t},readSFixed64:function(){var t=Gd(this.buf,this.pos)+ty(this.buf,this.pos+4)*Yf;return this.pos+=8,t},readFloat:function(){var t=jd.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=jd.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(o,l,c){var d,f,_=c.buf;if(d=(112&(f=_[c.pos++]))>>4,f<128||(d|=(127&(f=_[c.pos++]))<<3,f<128)||(d|=(127&(f=_[c.pos++]))<<10,f<128)||(d|=(127&(f=_[c.pos++]))<<17,f<128)||(d|=(127&(f=_[c.pos++]))<<24,f<128)||(d|=(1&(f=_[c.pos++]))<<31,f<128))return dc(o,d,l);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Qg?function(i,n,o){return Qg.decode(i.subarray(n,o))}(this.buf,e,t):function(i,n,o){for(var l="",c=n;c239?4:y>223?3:y>191?2:1;if(c+b>o)break;b===1?y<128&&(v=y):b===2?(192&(d=i[c+1]))==128&&(v=(31&y)<<6|63&d)<=127&&(v=null):b===3?(f=i[c+2],(192&(d=i[c+1]))==128&&(192&f)==128&&((v=(15&y)<<12|(63&d)<<6|63&f)<=2047||v>=55296&&v<=57343)&&(v=null)):b===4&&(f=i[c+2],_=i[c+3],(192&(d=i[c+1]))==128&&(192&f)==128&&(192&_)==128&&((v=(15&y)<<18|(63&d)<<12|(63&f)<<6|63&_)<=65535||v>=1114112)&&(v=null)),v===null?(v=65533,b=1):v>65535&&(v-=65536,l+=String.fromCharCode(v>>>10&1023|55296),v=56320|1023&v),l+=String.fromCharCode(v),c+=b}return l}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==ui.Bytes)return t.push(this.readVarint(e));var i=Po(this);for(t=t||[];this.pos127;);else if(e===ui.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ui.Fixed32)this.pos+=4;else{if(e!==ui.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(e,i){var n,o;if(e>=0?(n=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(l,c,d){d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,d.buf[d.pos]=127&(l>>>=7)}(n,0,i),function(l,c){var d=(7&l)<<4;c.buf[c.pos++]|=d|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(o,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(n,o,l){for(var c,d,f=0;f55295&&c<57344){if(!d){c>56319||f+1===o.length?(n[l++]=239,n[l++]=191,n[l++]=189):d=c;continue}if(c<56320){n[l++]=239,n[l++]=191,n[l++]=189,d=c;continue}c=d-55296<<10|c-56320|65536,d=null}else d&&(n[l++]=239,n[l++]=191,n[l++]=189,d=null);c<128?n[l++]=c:(c<2048?n[l++]=c>>6|192:(c<65536?n[l++]=c>>12|224:(n[l++]=c>>18|240,n[l++]=c>>12&63|128),n[l++]=c>>6&63|128),n[l++]=63&c|128)}return l}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&ey(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),jd.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),jd.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&ey(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,ui.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,kv,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ov,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Nv,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Bv,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Fv,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Vv,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Uv,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,jv,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Gv,e)},writeBytesField:function(t,e){this.writeTag(t,ui.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ui.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ui.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};var Zu=Jr(Jg);const $v=["id","tile","layer","source","sourceLayer","state"];class iy{constructor(e,i,n,o,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=o,this.properties=e.properties,this.id=l}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of $v)this[i]!==void 0&&(e[i]=this[i]);return e}}class qv{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},Gi(this.stateChanges[e][o],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(const l in this.state[e])l!==o&&(this.deletedStates[e][l]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const l in this.state[e][o])n[l]||(this.deletedStates[e][o][l]=null)}else for(const l in n)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][l]===null&&delete this.deletedStates[e][o][l]}removeFeatureState(e,i,n){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(n in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][n]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const n=String(i),o=Gi({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const l=this.deletedStates[e][i];if(l===null)return{};for(const c in l)delete o[c]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const n={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const l={};for(const c in this.stateChanges[o])this.state[o][c]||(this.state[o][c]={}),Gi(this.state[o][c],this.stateChanges[o][c]),l[c]=this.state[o][c];n[o]=l}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const l={};if(this.deletedStates[o]===null)for(const c in this.state[o])l[c]={},this.state[o][c]={};else for(const c in this.deletedStates[o]){if(this.deletedStates[o][c]===null)this.state[o][c]={};else if(this.state[o][c])for(const d of Object.keys(this.deletedStates[o][c]))delete this.state[o][c][d];l[c]=this.state[o][c]}n[o]=n[o]||{},Gi(n[o],l)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const o in e)e[o].setFeatureState(n,i)}}class ry{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new _e(Fe,16,0),this.featureIndexArray=new Km,this.promoteId=i,this.is3DTile=!1}insert(e,i,n,o,l,c=0,d=0){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,o,l,c);const _=this.grid;for(let y=0;y=0&&b[3]>=0&&_.insert(f,b[0],b[1],b[2],b[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Zf(new Zu(this.rawTileData)).layers,this.sourceLayerCoder=new Yg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i,n,o){this.loadVTLayers();const l=e.params||{},c=vn(l.filter),d=e.tileResult,f=e.transform,_=d.bufferedTilespaceBounds,y=this.grid.query(_.min.x,_.min.y,_.max.x,_.max.y,(M,A,C,D)=>g_(d.bufferedTilespaceGeometry,M,A,C,D));y.sort(Zv);let v=null;f.elevation&&y.length>0&&(v=hc.create(f.elevation,this.tileID));const b={};let E;for(let M=0;M(D||(D=Tn(V,this.tileID.canonical,e.tileTransform)),N.queryIntersectsFeature(d,V,U,D,this.z,e.transform,e.pixelPosMatrix,v,H)))}return b}loadMatchingFeature(e,i,n,o,l,c,d,f,_){const{featureIndex:y,bucketIndex:v,sourceLayerIndex:b,layoutVertexArrayOffset:E}=i,M=this.bucketLayerIDs[v];if(o&&!function(V,N){for(let U=0;U=0)return!0;return!1}(o,M))return;const A=this.sourceLayerCoder.decode(b),C=this.vtLayers[A].feature(y);if(n.needGeometry){const V=Io(C,!0);if(!n.filter(new at(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!n.filter(new at(this.tileID.overscaledZ),C))return;const D=this.getId(C,A);for(let V=0;V{const d=e instanceof Ni?e.get(c):null;return d&&d.evaluate?d.evaluate(i,n,o):d})}function Zv(t,e){return e-t}se(ry,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var Ki=24;const En=128;function Jf(t,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new at(t+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:o}=i;let l=0;for(;l{n.text=function(o,l,c){const d=l.layout.get("text-transform").evaluate(c,{});return d==="uppercase"?o=o.toLocaleUpperCase():d==="lowercase"&&(o=o.toLocaleLowerCase()),Mt.applyArabicShaping&&(o=Mt.applyArabicShaping(o)),o}(n.text,e,i)}),t}const Wu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Xv(t){return t==="︶"||t==="﹈"||t==="︸"||t==="﹄"||t==="﹂"||t==="︾"||t==="︼"||t==="︺"||t==="︘"||t==="﹀"||t==="︐"||t==="︓"||t==="︔"||t==="`"||t===" ̄"||t==="︑"||t==="︒"}function Yv(t){return t==="︵"||t==="﹇"||t==="︷"||t==="﹃"||t==="﹁"||t==="︽"||t==="︻"||t==="︹"||t==="︗"||t==="︿"}const Kf=3;function Jv(t,e,i){e.glyphs=[],t===1&&i.readMessage(Kv,e)}function Kv(t,e,i){if(t===3){const{id:n,bitmap:o,width:l,height:c,left:d,top:f,advance:_}=i.readMessage(Qv,{});e.glyphs.push({id:n,bitmap:new Es({width:l+2*Kf,height:c+2*Kf},o),metrics:{width:l,height:c,left:d,top:f,advance:_}})}else t===4?e.ascender=i.readSVarint():t===5&&(e.descender=i.readSVarint())}function Qv(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}const oy=Kf,Xr={horizontal:1,vertical:2,horizontalOnly:3};class Hu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){const n=new Hu;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Hu;return i.imageName=e,i}}class mc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){const n=new mc;for(let o=0;o=0&&n>=e&&qd[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new mc;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Hu.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Qf(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M){const A=mc.fromFeature(t,o);v===Xr.vertical&&A.verticalizePunctuation(b);let C=[];const D=function(X,Q,ae,de,ye,pe){if(!X)return[];const we=[],De=function(Ie,Be,Ee,Ve,Oe,Re){let et=0;for(let Ke=0;Ke=0;let ke=0;for(let Ie=0;Ie0&&Sr>vt&&(vt=Sr)}else{const Qi=ae[mt.fontStack];if(!Qi)continue;Qi[Wt]&&(Si=Qi[Wt]);const ri=Q[mt.fontStack];if(!ri)continue;const Sr=ri.glyphs[Wt];if(!Sr)continue;if(_i=Sr.metrics,pi=Wt!==8203?Ki:0,Re){const Pn=ri.ascender!==void 0?Math.abs(ri.ascender):0,cn=ri.descender!==void 0?Math.abs(ri.descender):0,un=(Pn+cn)*oi;zt-i/2;){if(c--,c<0)return!1;d-=t[c].dist(l),l=t[c]}d+=t[c].dist(t[c+1]),c++;const f=[];let _=0;for(;dn;)_-=f.shift().angleDelta;if(_>o)return!1;c++,d+=y.dist(v)}return!0}function py(t){let e=0;for(let i=0;i_){const M=(_-f)/E,A=rt(v.x,b.x,M),C=rt(v.y,b.y,M),D=new zo(A,C,0,b.angleTo(v),y);return!c||dy(t,D,d,c,e)?D:void 0}f+=E}}function n1(t,e,i,n,o,l,c,d,f){const _=fy(n,l,c),y=my(n,o),v=y*c,b=t[0].x===0||t[0].x===f||t[0].y===0||t[0].y===f;return e-v=0&&U=0&&H=0&&b+_<=y){const X=new zo(U,H,0,V,M);n&&!dy(t,X,l,n,o)||E.push(X)}}v+=D}return d||E.length||c||(E=_y(t,v/2,i,n,o,l,c,!0,f)),E}function gy(t,e,i,n,o){const l=[];for(let c=0;c=n&&v.x>=n||(y.x>=n?y=new je(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x>=n&&(v=new je(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y>=o&&v.y>=o||(y.y>=o?y=new je(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round():v.y>=o&&(v=new je(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round()),f&&y.equals(f[f.length-1])||(f=[y],l.push(f)),f.push(v)))))}}return l}function yy(t){let e=0,i=0;for(const c of t)e+=c.w*c.h,i=Math.max(i,c.w);t.sort((c,d)=>d.h-c.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const c of t)for(let d=n.length-1;d>=0;d--){const f=n[d];if(!(c.w>f.w||c.h>f.h)){if(c.x=f.x,c.y=f.y,l=Math.max(l,c.y+c.h),o=Math.max(o,c.x+c.w),c.w===f.w&&c.h===f.h){const _=n.pop();de.hasImage(o,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const o in e.getUpdatedImages(n))this.patchUpdatedImage(this.iconPositions[o],e.getImage(o,n),i),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o,n),i)}patchUpdatedImage(e,i,n){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,l]=e.tl,c=!!Object.keys(this.patternPositions).length;n.update(i.data,{useMipmap:c},{x:o,y:l})}}se(tm,"ImagePosition"),se(xy,"ImageAtlas");const Xu=1e20;function vy(t,e,i,n,o,l,c,d,f){for(let _=e;_-1);f++,l[f]=d,c[f]=_,c[f+1]=Xu}for(let d=0,f=0;d{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:c,id:d,glyph:y});if(y=this._tinySDF(_,c,d),y)return _.glyphs[d]=y,void f(null,{stack:c,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:c,id:d,glyph:y});let b=_.requests[v];b||(b=_.requests[v]=[],_c.loadGlyphRange(c,v,l,this.requestManager,(E,M)=>{if(M){_.ascender=M.ascender,_.descender=M.descender;for(const A in M.glyphs)this._doesCharSupportLocalGlyph(+A)||(_.glyphs[+A]=M.glyphs[+A]);_.ranges[v]=!0}for(const A of b)A(E,M);delete _.requests[v]})),b.push((E,M)=>{E?f(E):M&&f(null,{stack:c,id:d,glyph:M.glyphs[d]||null})})},(c,d)=>{if(c)n(c);else if(d){const f={};for(const{stack:_,id:y,glyph:v}of d)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;n(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==im.none&&(this.localGlyphMode===im.all?!!this.localFontFamily:!!this.localFontFamily&&(ne["CJK Unified Ideographs"](e)||ne["Hangul Syllables"](e)||ne.Hiragana(e)||ne.Katakana(e)||ne["CJK Symbols and Punctuation"](e)||ne["CJK Unified Ideographs Extension A"](e)||ne["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let A="400";/bold/i.test(i)?A="900":/medium/i.test(i)?A="500":/light/i.test(i)&&(A="200"),l=e.tinySDF=new _c.TinySDF({fontFamily:o,fontWeight:A,fontSize:24*Sn,buffer:3*Sn,radius:8*Sn}),l.fontWeight=A}if(this.localGlyphs[l.fontWeight][n])return this.localGlyphs[l.fontWeight][n];const c=String.fromCodePoint(n),{data:d,width:f,height:_,glyphWidth:y,glyphHeight:v,glyphLeft:b,glyphTop:E,glyphAdvance:M}=l.draw(c);return this.localGlyphs[l.fontWeight][n]={id:n,bitmap:new Es({width:f,height:_},d),metrics:{width:y/Sn,height:v/Sn,left:b/Sn,top:E/Sn-27,advance:M/Sn,localGlyph:!0}}}}_c.loadGlyphRange=function(t,e,i,n,o){const l=256*e,c=l+255,d=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",`${l}-${c}`),aa.Glyphs);uo(d,(f,_)=>{if(f)o(f);else if(_){const y={},v=function(b){return new Zu(b).readFields(Jv,{})}(_);for(const b of v.glyphs)y[b.id]=b;o(null,{glyphs:y,ascender:v.ascender,descender:v.descender})}})},_c.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:l="normal",fontStyle:c="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const d=this.size=t+4*e,f=this._createCanvas(d),_=this.ctx=f.getContext("2d",{willReadFrequently:!0});_.font=`${c} ${l} ${t}px ${o}`,_.textBaseline="alphabetic",_.textAlign="left",_.fillStyle="black",this.gridOuter=new Float64Array(d*d),this.gridInner=new Float64Array(d*d),this.f=new Float64Array(d),this.z=new Float64Array(d+1),this.v=new Uint16Array(d)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:l}=this.ctx.measureText(t),c=Math.ceil(i),d=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-o))),f=Math.min(this.size-this.buffer,c+Math.ceil(n)),_=d+2*this.buffer,y=f+2*this.buffer,v=Math.max(_*y,0),b=new Uint8ClampedArray(v),E={data:b,width:_,height:y,glyphWidth:d,glyphHeight:f,glyphTop:c,glyphLeft:0,glyphAdvance:e};if(d===0||f===0)return E;const{ctx:M,buffer:A,gridInner:C,gridOuter:D}=this;M.clearRect(A,A,d,f),M.fillText(t,A,A+c);const V=M.getImageData(A,A,d,f);D.fill(Xu,0,v),C.fill(0,0,v);for(let N=0;N0?Q*Q:0,C[X]=Q<0?Q*Q:0}}vy(D,0,0,_,y,_,this.f,this.v,this.z),vy(C,A,A,d,f,_,this.f,this.v,this.z);for(let N=0;Npe+we[1]-we[0],M=v.reduce(E,0),A=b.reduce(E,0),C=d-M,D=f-A;let V=0,N=M,U=0,H=A,X=0,Q=C,ae=0,de=D;if(l.content&&n){const pe=l.content;V=Zd(v,0,pe[0]),U=Zd(b,0,pe[1]),N=Zd(v,pe[0],pe[2]),H=Zd(b,pe[1],pe[3]),X=pe[0]-V,ae=pe[1]-U,Q=pe[2]-pe[0]-N,de=pe[3]-pe[1]-H}const ye=(pe,we,De,Te)=>{const ke=Wd(pe.stretch-V,N,_,t.left),be=Hd(pe.fixed-X,Q,pe.stretch,M),Ie=Wd(we.stretch-U,H,y,t.top),Be=Hd(we.fixed-ae,de,we.stretch,A),Ee=Wd(De.stretch-V,N,_,t.left),Ve=Hd(De.fixed-X,Q,De.stretch,M),Oe=Wd(Te.stretch-U,H,y,t.top),Re=Hd(Te.fixed-ae,de,Te.stretch,A),et=new je(ke,Ie),Ke=new je(Ee,Ie),Ze=new je(Ee,Oe),Ne=new je(ke,Oe),st=new je(be/c,Be/c),Qe=new je(Ve/c,Re/c),Xe=e*Math.PI/180;if(Xe){const It=Math.sin(Xe),Kt=Math.cos(Xe),ti=[Kt,-It,It,Kt];et._matMult(ti),Ke._matMult(ti),Ne._matMult(ti),Ze._matMult(ti)}const ut=pe.stretch+pe.fixed,ft=De.stretch+De.fixed,ht=we.stretch+we.fixed,vt=Te.stretch+Te.fixed,zt=t.imageSecondary;return{tl:et,tr:Ke,bl:Ne,br:Ze,texPrimary:{x:l.paddedRect.x+Is+ut,y:l.paddedRect.y+Is+ht,w:ft-ut,h:vt-ht},texSecondary:zt?{x:zt.paddedRect.x+Is+ut,y:zt.paddedRect.y+Is+ht,w:ft-ut,h:vt-ht}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:st,pixelOffsetBR:Qe,minFontScaleX:Q/c/_,minFontScaleY:de/c/y,isSDF:i}};if(n&&(l.stretchX||l.stretchY)){const pe=Ty(v,C,M),we=Ty(b,D,A);for(let De=0;Del)&&(l=M.x),(!E||M.y>c)&&(c=M.y)}const f=Math.min(l-n,c-o);let _=f/2;const y=new $n([],a1);if(f===0)return new je(n,o);for(let E=n;Ev.d||!v.d)&&(v=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,b)),E.max-v.d<=e||(_=E.h/2,y.push(new gc(E.p.x-_,E.p.y-_,_,t)),y.push(new gc(E.p.x+_,E.p.y-_,_,t)),y.push(new gc(E.p.x-_,E.p.y+_,_,t)),y.push(new gc(E.p.x+_,E.p.y+_,_,t)),b+=4)}return i&&(console.log(`num probes: ${b}`),console.log(`best distance: ${v.d}`)),v.p}function a1(t,e){return e.max-t.max}class gc{constructor(e,i,n,o){this.p=new je(e,i),this.h=n,this.d=function(l,c){let d=!1,f=1/0;for(let _=0;_l.y!=A.y>l.y&&l.x<(A.x-M.x)*(l.y-M.y)/(A.y-M.y)+M.x&&(d=!d),f=Math.min(f,m_(l,M,A))}}return(d?1:-1)*Math.sqrt(f)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}}const rm=Number.POSITIVE_INFINITY,l1=Math.sqrt(2);function Ey(t,[e,i]){let n=0,o=0;if(i===rm){e<0&&(e=0);const l=e/l1;switch(t){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=7-l;break;case"bottom":o=7-e;break;case"top":o=e-7}switch(t){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":o=i-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,o]}function nm(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function c1(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M){let A=l.textMaxSize.evaluate(e,{},v);A===void 0&&(A=c);const C=t.layers[0].layout,D=C.get("icon-offset").evaluate(e,{},v),V=My(i.horizontal)||i.vertical,N=b.name==="globe",U=Ki,H=c/U,X=t.tilePixelRatio*A/U,Q=(ke=t.overscaling,t.zoom>18&&ke>2&&(ke>>=1),Math.max(Fe/(512*ke),1)*C.get("symbol-spacing")),ae=C.get("text-padding")*t.tilePixelRatio,de=C.get("icon-padding")*t.tilePixelRatio,ye=At(C.get("text-max-angle")),pe=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",we=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",De=C.get("symbol-placement"),Te=Q/2;var ke;const be=C.get("icon-text-fit").evaluate(e,{},v),Ie=C.get("icon-text-fit-padding").evaluate(e,{},v),Be=be!=="none";let Ee;t.hasAnyIconTextFit===!1&&Be&&(t.hasAnyIconTextFit=!0),n&&Be&&(t.allowVerticalPlacement&&i.vertical&&(Ee=hy(n,i.vertical,be,Ie,D,H)),V&&(n=hy(n,V,be,Ie,D,H)));const Ve=(Oe,Re,et)=>{if(Re.x<0||Re.x>=Fe||Re.y<0||Re.y>=Fe)return;let Ke=null;if(N){const{x:Ze,y:Ne,z:st}=b.projectTilePoint(Re.x,Re.y,et);Ke={anchor:new zo(Ze,Ne,st,0,void 0),up:b.upVector(et,Re.x,Re.y)}}(function(Ze,Ne,st,Qe,Xe,ut,ft,ht,vt,zt,It,Kt,ti,mt,qt,Wt,oi,_i,Si,gi,pi,Oi,Ai,Qi,ri,Sr,Pn){const cn=Ze.addToLineVertexArray(Ne,Qe);let un,Xa,Rs,Ya,mh,j0,G0,$0=0,q0=0,Z0=0,W0=0,Rm=-1,Lm=-1;const eo={};let H0=Al("");const Ja=st?st.anchor:Ne,km=vt.layout.get("icon-text-fit").evaluate(pi,{},ri)!=="none";let Om=0,Bm=0;if(vt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Om,Bm]=vt.layout.get("text-offset").evaluate(pi,{},ri).map(Br=>Br*Ki):(Om=vt.layout.get("text-radial-offset").evaluate(pi,{},ri)*Ki,Bm=rm),Ze.allowVerticalPlacement&&Xe.vertical){const Br=Xe.vertical;if(qt)j0=om(Br),ht&&(G0=om(ht));else{const Fr=vt.layout.get("text-rotate").evaluate(pi,{},ri)+90;Rs=Xd(zt,Ja,Ne,It,Kt,ti,Br,mt,Fr,Wt),ht&&(Ya=Xd(zt,Ja,Ne,It,Kt,ti,ht,_i,Fr))}}if(ut){const Br=vt.layout.get("icon-rotate").evaluate(pi,{},ri),Fr=wy(ut,Br,Ai,km),Mc=ht?wy(ht,Br,Ai,km):void 0;Xa=Xd(zt,Ja,Ne,It,Kt,ti,ut,_i,Br),$0=4*Fr.length;const X0=Ze.iconSizeData;let Ka=null;X0.kind==="source"?(Ka=[En*vt.layout.get("icon-size").evaluate(pi,{},ri)],Ka[0]>As&&vi(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${Yu}. Reduce your "icon-size".`)):X0.kind==="composite"&&(Ka=[En*Oi.compositeIconSizes[0].evaluate(pi,{},ri),En*Oi.compositeIconSizes[1].evaluate(pi,{},ri)],(Ka[0]>As||Ka[1]>As)&&vi(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${Yu}. Reduce your "icon-size".`)),Ze.addSymbols(Ze.icon,Fr,Ka,gi,Si,pi,!1,st,Ne,cn.lineStartIndex,cn.lineLength,-1,Qi,ri,Sr,Pn),Rm=Ze.icon.placedSymbolArray.length-1,Mc&&(q0=4*Mc.length,Ze.addSymbols(Ze.icon,Mc,Ka,gi,Si,pi,Xr.vertical,st,Ne,cn.lineStartIndex,cn.lineLength,-1,Qi,ri,Sr,Pn),Lm=Ze.icon.placedSymbolArray.length-1)}for(const Br in Xe.horizontal){const Fr=Xe.horizontal[Br];un||(H0=Al(Fr.text),qt?mh=om(Fr):un=Xd(zt,Ja,Ne,It,Kt,ti,Fr,mt,vt.layout.get("text-rotate").evaluate(pi,{},ri),Wt));const Mc=Fr.positionedLines.length===1;if(Z0+=Sy(Ze,st,Ne,Fr,ft,vt,qt,pi,Wt,cn,Xe.vertical?Xr.horizontal:Xr.horizontalOnly,Mc?Object.keys(Xe.horizontal):[Br],eo,Rm,Oi,Qi,ri,Sr),Mc)break}Xe.vertical&&(W0+=Sy(Ze,st,Ne,Xe.vertical,ft,vt,qt,pi,Wt,cn,Xr.vertical,["vertical"],eo,Lm,Oi,Qi,ri,Sr));let Ls=-1;const Fm=(Br,Fr)=>Br?Math.max(Br,Fr):Fr;Ls=Fm(mh,Ls),Ls=Fm(j0,Ls),Ls=Fm(G0,Ls);const Tb=Ls>-1?1:0;Ze.glyphOffsetArray.length>=65535&&vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pi.sortKey!==void 0&&Ze.addToSortKeyRanges(Ze.symbolInstances.length,pi.sortKey),Ze.symbolInstances.emplaceBack(Ne.x,Ne.y,Ja.x,Ja.y,Ja.z,eo.right>=0?eo.right:-1,eo.center>=0?eo.center:-1,eo.left>=0?eo.left:-1,eo.vertical>=0?eo.vertical:-1,Rm,Lm,H0,un!==void 0?un:Ze.collisionBoxArray.length,un!==void 0?un+1:Ze.collisionBoxArray.length,Rs!==void 0?Rs:Ze.collisionBoxArray.length,Rs!==void 0?Rs+1:Ze.collisionBoxArray.length,Xa!==void 0?Xa:Ze.collisionBoxArray.length,Xa!==void 0?Xa+1:Ze.collisionBoxArray.length,Ya||Ze.collisionBoxArray.length,Ya?Ya+1:Ze.collisionBoxArray.length,It,Z0,W0,$0,q0,Tb,0,Om,Bm,Ls,0,km?1:0)})(t,Re,Ke,Oe,i,n,o,Ee,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,ae,pe,f,0,de,we,D,e,l,_,y,v,E,M)};if(De==="line")for(const Oe of gy(e.geometry,0,0,Fe,Fe)){const Re=n1(Oe,Q,ye,i.vertical||V,n,U,X,t.overscaling,Fe);for(const et of Re)V&&u1(t,V.text,Te,et)||Ve(Oe,et,v)}else if(De==="line-center"){for(const Oe of e.geometry)if(Oe.length>1){const Re=r1(Oe,ye,i.vertical||V,n,U,X);Re&&Ve(Oe,Re,v)}}else if(e.type==="Polygon")for(const Oe of zd(e.geometry,0)){const Re=s1(Oe,16);Ve(Oe[0],new zo(Re.x,Re.y,0,0,void 0),v)}else if(e.type==="LineString")for(const Oe of e.geometry)Ve(Oe,new zo(Oe[0].x,Oe[0].y,0,0,void 0),v);else if(e.type==="Point")for(const Oe of e.geometry)for(const Re of Oe)Ve([Re],new zo(Re.x,Re.y,0,0,void 0),v)}const Yu=255,As=Yu*En;function Sy(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D){const V=function(H,X,Q,ae,de,ye,pe,we){const De=[];if(X.positionedLines.length===0)return De;const Te=ae.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,ke=function(Ve){const Oe=Ve[0],Re=Ve[1],et=Oe*Re;return et>0?[Oe,-Re]:et<0?[-Oe,Re]:Oe===0?[Re,Oe]:[Re,-Oe]}(Q);let be=Math.abs(X.top-X.bottom);for(const Ve of X.positionedLines)be-=Ve.lineOffset;const Ie=X.positionedLines.length,Be=be/Ie;let Ee=X.top-Q[1];for(let Ve=0;VeAs&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${Yu}. Reduce your "text-size".`)):N.kind==="composite"&&(U=[En*M.compositeTextSizes[0].evaluate(d,{},C),En*M.compositeTextSizes[1].evaluate(d,{},C)],(U[0]>As||U[1]>As)&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${Yu}. Reduce your "text-size".`)),t.addSymbols(t.text,V,U,f,c,d,y,e,i,_.lineStartIndex,_.lineLength,E,A,C,D,!1);for(const H of v)b[H]=t.text.placedSymbolArray.length-1;return 4*V.length}function My(t){for(const e in t)return t[e];return null}function Xd(t,e,i,n,o,l,c,d,f,_){let y=c.top,v=c.bottom,b=c.left,E=c.right;const M=c.collisionPadding;if(M&&(b-=M[0],y-=M[1],E+=M[2],v+=M[3]),f){const A=new je(b,y),C=new je(E,y),D=new je(b,v),V=new je(E,v),N=At(f);let U=new je(0,0);_&&(U=new je(_[0],_[1])),A._rotateAround(N,U),C._rotateAround(N,U),D._rotateAround(N,U),V._rotateAround(N,U),b=Math.min(A.x,C.x,D.x,V.x),E=Math.max(A.x,C.x,D.x,V.x),y=Math.min(A.y,C.y,D.y,V.y),v=Math.max(A.y,C.y,D.y,V.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,b,y,E,v,d,n,o,l),t.length-1}function om(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function u1(t,e,i,n){const o=t.compareText;if(e in o){const l=o[e];for(let c=l.length-1;c>=0;c--)if(n.dist(l[c])N&&(U(X,Te,ae,de,we,De),U(Te,Q,we,De,ye,pe))}U(v,b,n,l,o,l),U(b,E,o,l,o,c),U(E,M,o,c,n,c),U(M,v,n,c,n,l),A-=N,C-=N,D+=N,V+=N;const H=1/Math.max(D-A,V-C);return{scale:H,x:A*H,y:C*H,x2:D*H,y2:V*H,projection:e}}function Ay(t,{x:e,y:i},n=0){return new je(((e-n)*t.scale-t.x)*Fe,(i*t.scale-t.y)*Fe)}const h1=s.ae.identity(new Float32Array(16));class Cs{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new Vt(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n=!0){return e._coordinatePoint(e.locationCoordinate(i),n)}pixelsPerMeter(e,i){return dr(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return Iy(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,o){const l=e.horizonLineFromTop(!1),c=new je(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(c,o))}pointCoordinate3D(e,i,n){const o=new je(i,n);if(e.elevation)return e.elevation.pointCoordinate(o);{const l=this.pointCoordinate(e,o.x,o.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y0?i<-yc+n&&(i=-yc+n):i>yc-n&&(i=yc-n);const c=l/Math.pow(Jd(i),o);let d=c*Math.sin(o*e),f=l-c*Math.cos(o*e);return d=.5*(d/Math.PI+.5),f=.5*(f/Math.PI+.5),{x:d,y:this.southernCenter?f:1-f,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:o}=this,l=o-i,c=Math.sign(l),d=Math.sign(n)*Math.sqrt(e*e+l*l);let f=Math.atan2(e,Math.abs(l))*c;l*n<0&&(f-=Math.PI*Math.sign(e)*c);const _=Et(sr(f/n)+this.center[0],-180,180),y=Et(sr(2*Math.atan(Math.pow(o/d,1/n))-yc),-Ti,Ti);return new Vt(_,this.southernCenter?-y:y)}}class Cy extends Cs{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:Hn(e),y:Xn(i),z:0}}unproject(e,i){const n=Er(e),o=Vi(i);return new Vt(n,o)}}const Py=At(Ti);class _1 extends Cs{project(e,i){const n=(i=At(i))*i,o=n*n;return{x:.5*((e=At(e))*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,o=25,l=0,c=n*n;do{c=n*n;const _=c*c;l=(n*(1.007226+c*(.015085+_*(.028874*c-.044475-.005916*_)))-i)/(1.007226+c*(.045255+_*(.259866*c-.311325-.005916*11*_))),n=Et(n-l,-Py,Py)}while(Math.abs(l)>1e-6&&--o>0);c=n*n;const d=Et(sr(e/(.8707+c*(c*(c*c*c*(.003971-.001529*c)-.013791)-.131979))),-180,180),f=sr(n);return new Vt(d,f)}}const zy=At(Ti);class g1 extends Cs{project(e,i){i=At(i),e=At(e);const n=Math.cos(i),o=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),c=Math.sin(l)/l,d=.5*(e*o+2*n*Math.sin(e/2)/c)||0,f=.5*(i+Math.sin(i)/c)||0;return{x:.5*(d/Math.PI+.5),y:1-.5*(f/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,o=i=(2*(1-i)-1)*Math.PI,l=25;const c=1e-6;let d=0,f=0;do{const _=Math.cos(o),y=Math.sin(o),v=2*y*_,b=y*y,E=_*_,M=Math.cos(n/2),A=Math.sin(n/2),C=2*M*A,D=A*A,V=1-E*M*M,N=V?1/V:0,U=V?Math.acos(_*M)*Math.sqrt(1/V):0,H=.5*(2*U*_*A+2*n/Math.PI)-e,X=.5*(U*y+o)-i,Q=.5*N*(E*D+U*_*M*b)+1/Math.PI,ae=N*(C*v/4-U*y*A),de=.125*N*(v*A-U*y*E*C),ye=.5*N*(b*M+U*D*_)+.5,pe=ae*de-ye*Q;d=(X*ae-H*ye)/pe,f=(H*de-X*Q)/pe,n=Et(n-d,-Math.PI,Math.PI),o=Et(o-f,-zy,zy)}while((Math.abs(d)>c||Math.abs(f)>c)&&--l>0);return new Vt(sr(n),sr(o))}}class Dy extends Cs{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(At(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:o}=this;return{x:At(e)*o*n+.5,y:-Math.sin(At(i))/o*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:o}=this,l=-(i-.5)/n,c=Et(sr((e-.5)/n)/o,-180,180),d=Math.asin(Et(l*o,-1,1)),f=Et(sr(d),-Ti,Ti);return new Vt(c,f)}}class y1 extends Cy{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,n){const o=ku(e,i,n),l=Ou(Yn(n));return s.$.transformMat4(o,o,l),{x:o[0],y:o[1],z:o[2]}}locationPoint(e,i){const n=Fa(i.lat,i.lng),o=s.$.normalize([],n),l=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,c=dr(1,0)*Fe*l;s.$.scaleAndAdd(n,n,o,c);const d=s.ae.identity(new Float64Array(16));return s.ae.multiply(d,e.pixelMatrix,e.globeMatrix),s.$.transformMat4(n,n,d),new je(n[0],n[1])}pixelsPerMeter(e,i){return dr(1,0)*i}pixelSpaceConversion(e,i,n){const o=dr(1,e)*i,l=rt(dr(1,45)*i,o,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const o=Bf(Yn(n.canonical));return s.ae.multiply(new Float64Array(16),e.globeMatrix,o)}createInversionMatrix(e,i){const{center:n}=e,o=Ou(Yn(i));return s.ae.rotateY(o,o,At(n.lng)),s.ae.rotateX(o,o,At(n.lat)),s.ae.scale(o,o,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(o)}pointCoordinate(e,i,n,o){return M_(e,i,n,!0)||new nr(0,0)}pointCoordinate3D(e,i,n){const o=this.pointCoordinate(e,i,n,0);return[o.x,o.y,o.z]}isPointAboveHorizon(e,i){return!M_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(o,l){const c=o.cameraToCenterDistance,d=o._centerAltitude*l,f=o._camera,_=o._camera.forward(),y=s.$.add([],s.$.scale([],_,-c),[0,0,d]),v=o.worldSize/(2*Math.PI),b=[0,0,-v],E=o.width/o.height,M=Math.tan(o.fovAboveCenter),A=s.$.scale([],f.up(),M),C=s.$.scale([],f.right(),M*E),D=s.$.normalize([],s.$.add([],s.$.add([],_,A),C)),V=[];let N;if(new Df(y,D).closestPointOnSphere(b,v,V)){const U=s.$.add([],V,b),H=s.$.sub([],U,y);N=Math.cos(o.fovAboveCenter)*s.$.length(H)}else{const U=s.$.sub([],y,b),H=s.$.sub([],b,y);s.$.normalize(H,H);const X=s.$.length(U)-v;N=Math.sqrt(X*(X+2*v));const Q=Math.acos(N/(v+X))-Math.acos(s.$.dot(_,H));N*=Math.cos(Q)}return 1.01*N}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Co(e.zoom);if(n>0){const o=Iy(e,dr(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),c=Math.max(e.width,e.height)/e.worldSize*Math.PI;return rt(i,o+l*(1-Math.cos(c)),Math.pow(n,10))}return i}upVector(e,i,n){return ku(i,n,e,1)}upVectorScale(e){return{metersToTile:Sd(Id(Yn(e)))}}}function Ry(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Cy(t);case"equirectangular":return new f1(t);case"naturalEarth":return new _1(t);case"equalEarth":return new p1(t);case"winkelTripel":return new g1(t);case"albers":return i?new Dy(t):new d1(t);case"lambertConformalConic":return i?new Dy(t):new m1(t);case"globe":return new y1(t)}throw new Error(`Invalid projection name: ${t.name}`)}const x1=Ld.types,v1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Kd(t,e,i,n,o,l,c,d,f,_,y,v,b){const E=d?Math.min(As,Math.round(d[0])):0,M=d?Math.min(As,Math.round(d[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*o),l,c,(E<<1)+(f?1:0),M,16*_,16*y,256*v,256*b)}function Qd(t,e,i){t.emplaceBack(e,i)}function ep(t,e,i,n,o,l,c){t.emplaceBack(e,i,n,o,l,c)}function tp(t,e,i,n,o){t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o)}function b1(t){for(const e of t.sections)if(_t(e.text))return!0;return!1}class sm{constructor(e){this.layoutVertexArray=new ef,this.indexArray=new ki,this.programConfigurations=e,this.segments=new hi,this.dynamicLayoutVertexArray=new _s,this.opacityVertexArray=new rf,this.placedSymbolArray=new Zm,this.iconTransitioningVertexArray=new xs,this.globeExtVertexArray=new tf,this.zOffsetVertexArray=new tc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,n,o,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ev.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Mv.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,v1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Iv.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Sv.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ng.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}se(sm,"SymbolBuffers");class am{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new hi,this.collisionVertexArray=new sf,this.collisionVertexArrayExt=new _s}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Av.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Cv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}se(am,"CollisionBuffers");class xc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(c=>c.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=s.ae.identity([]),this.placementViewportMatrix=s.ae.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jf(this.zoom,i["text-size"]),this.iconSizeData=Jf(this.zoom,i["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&o.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(c=>Xr[c]),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new sm(new bs(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^text/.test(e))),this.icon=new sm(new bs(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^icon/.test(e))),this.glyphOffsetArray=new Xm,this.lineVertexArray=new Ym,this.symbolInstances=new Hm}calculateGlyphDependencies(e,i,n,o,l){for(let c=0;c0)&&(f.value.kind!=="constant"||f.value.value.length>0),b=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,E=c.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const M=i.iconDependencies,A=i.glyphDependencies,C=i.availableImages,D=new at(this.zoom);for(const{feature:V,id:N,index:U,sourceLayerIndex:H}of e){const X=l._featureFilter.needGeometry,Q=Io(V,X);if(!l._featureFilter.filter(D,Q,n))continue;if(X||(Q.geometry=Tn(V,n,o)),d&&V.type!==1&&n.z<=5){const pe=Q.geometry,we=.98078528056,De=(Te,ke)=>{const be=ku(Te.x,Te.y,n,1),Ie=ku(ke.x,ke.y,n,1);return s.$.dot(be,Ie)=0;for(const De of ae.sections)if(De.image)M[De.image.namePrimary]=!0;else{const Te=Me(ae.toString()),ke=De.fontStack||pe,be=A[ke]=A[ke]||{};this.calculateGlyphDependencies(De.text,be,we,this.allowVerticalPlacement,Te)}}}c.get("symbol-placement")==="line"&&(this.features=function(V){const N={},U={},H=[];let X=0;function Q(pe){H.push(V[pe]),X++}function ae(pe,we,De){const Te=U[pe];return delete U[pe],U[we]=Te,H[Te].geometry[0].pop(),H[Te].geometry[0]=H[Te].geometry[0].concat(De[0]),Te}function de(pe,we,De){const Te=N[we];return delete N[we],N[pe]=Te,H[Te].geometry[0].shift(),H[Te].geometry[0]=De[0].concat(H[Te].geometry[0]),Te}function ye(pe,we,De){const Te=De?we[0][we[0].length-1]:we[0][0];return`${pe}:${Te.x}:${Te.y}`}for(let pe=0;pepe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,N)=>V.sortKey-N.sortKey)}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.icon.programConfigurations.updatePaintArrays(e,i,d,n,o,l)}updateZOffset(){const e=(l,c,d)=>{n+=c,n>l.length&&l.resize(n);for(let f=-c;f<0;f++)l.emplace(f+n,d)},i=(l,c,d)=>{o+=c,o>l.length&&l.resize(o);for(let f=-c;f<0;f++)l.emplace(f+o,d)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,o=0;for(let l=0;l0;if((d>0||f>0)&&(e(this.text.zOffsetVertexArray,d,y),e(this.text.zOffsetVertexArray,f,y)),v){const{placedIconSymbolIndex:b,verticalPlacedIconSymbolIndex:E}=c;b>=0&&i(this.icon.zOffsetVertexArray,_,y),E>=0&&i(this.icon.zOffsetVertexArray,c.numVerticalIconVertices,y)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ry(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:o,y:l}of i)this.lineVertexArray.emplaceBack(o,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){const D=e.indexArray,V=e.layoutVertexArray,N=e.globeExtVertexArray,U=e.segments.prepareSegment(4*i.length,V,D,this.canOverlap?c.sortKey:void 0),H=this.glyphOffsetArray.length,X=U.vertexLength,Q=this.allowVerticalPlacement&&d===Xr.vertical?Math.PI/2:0,ae=c.text&&c.text.sections;for(let ye=0;ye=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:o),c=$d(this.textSizeData,e,l)/Ki;return this.tilePixelRatio*c}getSymbolInstanceIconSize(e,i,n){const o=this.icon.placedSymbolArray.get(n),l=$d(this.iconSizeData,e,o);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,o){e.emplaceBack(i,-n,-n,o),e.emplaceBack(i,n,-n,o),e.emplaceBack(i,n,n,o),e.emplaceBack(i,-n,n,o)}_updateTextDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),o=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;lo[d]-o[f]||l[f]-l[d]),c}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:c,verticalPlacedTextSymbolIndex:d,placedIconSymbolIndex:f,verticalPlacedIconSymbolIndex:_}=n;o>=0&&this.addIndicesForPlacedSymbol(this.text,o),l>=0&&l!==o&&this.addIndicesForPlacedSymbol(this.text,l),c>=0&&c!==l&&c!==o&&this.addIndicesForPlacedSymbol(this.text,c),d>=0&&this.addIndicesForPlacedSymbol(this.text,d),f>=0&&this.addIndicesForPlacedSymbol(this.icon,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}se(xc,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),xc.addDynamicAttributes=tp;class sn{constructor(e,i,n,o){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,n){const{width:o,height:l}=e,{context:c}=this,{gl:d}=c;if(d.bindTexture(d.TEXTURE_2D,this.texture),c.pixelStoreUnpackFlipY.set(!1),c.pixelStoreUnpack.set(1),c.pixelStoreUnpackPremultiplyAlpha.set(this.format===d.RGBA&&(!i||i.premultiply!==!1)),this.useMipmap=!!(i&&i.useMipmap),n||this.size&&this.size[0]===o&&this.size[1]===l){const{x:f,y:_}=n||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)d.texSubImage2D(d.TEXTURE_2D,0,f,_,d.RGBA,d.UNSIGNED_BYTE,e);else{let y=this.format,v=d.UNSIGNED_BYTE;this.format===d.R32F&&(y=d.RED,v=d.FLOAT),d.texSubImage2D(d.TEXTURE_2D,0,f,_,o,l,y,v,e.data)}}else if(this.size=[o,l],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let f=this.format;this.format===d.R8&&(f=d.RED),d.texImage2D(d.TEXTURE_2D,0,this.format,f,d.UNSIGNED_BYTE,e)}else{let f=this.format,_=this.format,y=d.UNSIGNED_BYTE,v=!1;this.format===d.DEPTH_COMPONENT&&(f=d.DEPTH_COMPONENT16,y=d.UNSIGNED_SHORT),this.format===d.DEPTH_STENCIL&&(f=d.DEPTH24_STENCIL8,y=d.UNSIGNED_INT_24_8,v=!0),this.format===d.R8&&(_=d.RED),this.format===d.R32F&&(y=d.FLOAT,_=d.RED),!this.useMipmap&&v?d.texStorage2D(d.TEXTURE_2D,1,f,o,l):d.texImage2D(d.TEXTURE_2D,0,f,o,l,0,_,y,e.data)}this.useMipmap&&d.generateMipmap(d.TEXTURE_2D)}bind(e,i,n=!1){const{context:o}=this,{gl:l}=o;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,o){const{context:l}=this,{gl:c}=l;c.bindTexture(c.TEXTURE_2D,this.texture),i!==this.magFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,this.useMipmap?e===c.NEAREST?c.NEAREST_MIPMAP_NEAREST:c.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),this.wrapS=n),o!==this.wrapT&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,o),this.wrapT=o)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class ip{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,i),this.wrapS=i)}}const an=32,Kn=33,Ps=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,i=0,n=0,o=0,l=0,c=0,d=0;for(1&e?o=l=c=an:i=n=d=an;(e>>=1)>1;){const _=i+o>>1,y=n+l>>1;1&e?(o=i,l=n,i=c,n=d):(i=o,n=l,o=c,l=d),c=_,d=y}const f=4*t;Ps[f+0]=i,Ps[f+1]=n,Ps[f+2]=o,Ps[f+3]=l}const Qn=new Uint16Array(2178),zs=new Uint8Array(1089),rp=new Uint16Array(1089);function Ly(t){return t===0?-.03125:t===32?.03125:0}var np=$t([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $a{constructor(e,i,n,o){this.id=$a.uniqueIdxCounter,$a.uniqueIdxCounter++,this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=$a.uniqueIdxCounter,$a.uniqueIdxCounter++;const i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}$a.uniqueIdxCounter=0;class vc{constructor(e,i,n){this.func=e,this.mask=i,this.range=n}}vc.ReadOnly=!1,vc.ReadWrite=!0,vc.disabled=new vc(519,vc.ReadOnly,[0,1]);const lm=7680;class cm{constructor(e,i,n,o,l,c){this.test=e,this.ref=i,this.mask=n,this.fail=o,this.depthFail=l,this.pass=c}}cm.disabled=new cm({func:519,mask:0},0,0,lm,lm,lm);const th=771;class Or{constructor(e,i,n,o){this.blendFunction=e,this.blendColor=i,this.mask=n,this.blendEquation=o}}Or.Replace=[1,0,1,0],Or.disabled=new Or(Or.Replace,Ut.transparent,[!1,!1,!1,!1]),Or.unblended=new Or(Or.Replace,Ut.transparent,[!0,!0,!0,!0]),Or.alphaBlended=new Or([1,th,1,th],Ut.transparent,[!0,!0,!0,!0]),Or.alphaBlendedNonPremultiplied=new Or([770,th,770,th],Ut.transparent,[!0,!0,!0,!0]),Or.multiply=new Or([774,0,774,0],Ut.transparent,[!0,!0,!0,!0]);const um=1029,hm=2305;class Mn{constructor(e,i,n){this.enable=e,this.mode=i,this.frontFace=n}}Mn.disabled=new Mn(!1,um,hm),Mn.backCCW=new Mn(!0,um,hm),Mn.backCW=new Mn(!0,um,2304),Mn.frontCW=new Mn(!0,1028,2304),Mn.frontCCW=new Mn(!0,1028,hm);var w1=$t([{name:"a_index",type:"Int16",components:1}]);const ky={type:2,extent:Fe,loadGeometry:()=>[[new je(0,0),new je(Fe+1,0),new je(Fe+1,Fe+1),new je(0,Fe+1),new je(0,0)]]};class op{constructor(e,i,n,o,l){this.tileID=e,this.uid=yl(),this.uses=0,this.tileSize=i,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=l,o&&o.style&&(this._lastUpdatedBrightness=o.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(e){const i=e+this.timeAdded;il.getLayer(_)).filter(Boolean);if(f.length!==0){d.layers=f,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(_=>f.filter(y=>y.id===_)[0]));for(const _ of f)c[_.fqid]=d}}return c}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const l=this.buckets[o];if(l instanceof xc){if(this.hasSymbolBuckets=!0,!n)break;l.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const l=this.buckets[o];if(l instanceof xc&&l.hasRTLText){this.hasRTLText=!0,Mt.isLoading()||Mt.isLoaded()||gt()!=="deferred"||Ot();break}}this.queryPadding=0;for(const o in this.buckets){const l=this.buckets[o],c=i.style.getOwnLayer(o);if(!c)continue;const d=c.queryRadius(l);this.queryPadding=Math.max(this.queryPadding,d)}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas),this._lastUpdatedBrightness=e.brightness}else this.collisionBoxArray=new ff}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.fqid]}upload(e){for(const o in this.buckets){const l=this.buckets[o];l.uploadPending()&&l.upload(e)}const i=e.gl,n=this.imageAtlas;if(n&&!n.uploaded){const o=!!Object.keys(n.patternPositions).length;this.imageAtlasTexture=new sn(e,n.image,i.RGBA,{useMipmap:o}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new sn(e,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new sn(e,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,n){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,n),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const o=i.style.getBrightness();(this._lastUpdatedBrightness||o)&&(this._lastUpdatedBrightness&&o&&Math.abs(this._lastUpdatedBrightness-o)<.001||(this._lastUpdatedBrightness=o,this.updateBuckets(void 0,i)))}queryRenderedFeatures(e,i,n,o,l,c,d,f){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:d,transform:c,params:l,tileTransform:this.tileTransform},e,i,n):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),l=i?i.sourceLayer:"",c=o._geojsonTileLayer||o[l];if(!c)return;const d=vn(i&&i.filter),{z:f,x:_,y}=this.tileID.canonical,v={z:f,x:_,y};for(let b=0;bn)o=!1;else if(i)if(this.expirationTime=0;C--){const D=4*C,V=Ps[D+0],N=Ps[D+1],U=Ps[D+2],H=Ps[D+3],X=V+U>>1,Q=N+H>>1,ae=X+Q-N,de=Q+V-X,ye=N*Kn+V,pe=H*Kn+U,we=Q*Kn+X,De=Math.hypot((Qn[2*ye+0]+Qn[2*pe+0])/2-Qn[2*we+0],(Qn[2*ye+1]+Qn[2*pe+1])/2-Qn[2*we+1])>=16;zs[we]=zs[we]||(De?1:0),C<1022&&(zs[we]=zs[we]||zs[(N+de>>1)*Kn+(V+ae>>1)]||zs[(H+de>>1)*Kn+(U+ae>>1)])}const v=new To,b=new ki;let E=0;function M(C,D){const V=D*Kn+C;return rp[V]===0&&(v.emplaceBack(Qn[2*V+0],Qn[2*V+1],C*Fe/an,D*Fe/an),rp[V]=++E),rp[V]-1}function A(C,D,V,N,U,H){const X=C+V>>1,Q=D+N>>1;if(Math.abs(C-U)+Math.abs(D-H)>1&&zs[Q*Kn+X])A(U,H,C,D,X,Q),A(V,N,U,H,X,Q);else{const ae=M(C,D),de=M(V,N),ye=M(U,H);b.emplaceBack(ae,de,ye)}}return A(0,0,an,an,an,0),A(an,an,0,0,0,an),{vertices:v,indices:b}}(this.tileID.canonical,i);o=c.vertices,l=c.indices}else{o=new To,l=new ki;for(const{x:d,y:f}of n)o.emplaceBack(d,f,0,0);const c=Fu(o.int16,void 0,4);for(let d=0;d0&&(d=s.ae.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,o,i,l,d,c),this._makeGlobeTileDebugTextBuffer(e,o,i,l,d,c)}_globePoint(e,i,n,o,l,c,d){let f=ku(e,i,n);if(c){const _=1<.5?E=-1:b<-.5&&(E=1);let M=(e/Fe+n.x)/_+E,A=(i/Fe+n.y)/_;M=(M-y)*o._pixelsPerMercatorPixel+y,A=(A-v)*o._pixelsPerMercatorPixel+v;const C=[M*o.worldSize,A*o.worldSize,0];s.$.transformMat4(C,C,c),f=Ao(f,C,d)}return s.$.transformMat4(f,f,l)}_makeGlobeTileDebugBorderBuffer(e,i,n,o,l,c){const d=new bn,f=new Au,_=new pd,y=(b,E,M,A,C)=>{const D=(M-b)/(C-1),V=(A-E)/(C-1),N=d.length;for(let U=0;Uv*E+M;for(let E=0;E=1;n--){const o=n===1?1:0,l=n===2?1:0;for(let c=0;c>>1^-(1&t[e]);return t}function L1(t,e){switch(e){case"uint32":return t;case"uint16":for(let i=0;i>4|(61440&n)>>8|(240&o)<<4|61440&o,t[i+1]=15&n|(3840&n)>>4|(15&o)<<8|(3840&o)<<4}return t;case"uint8":for(let i=0;i>6|(192&o)>>4|(192&l)>>2|192&c,t[i+1]=(48&n)>>4|(48&o)>>2|48&l|(48&c)<<2,t[i+2]=(12&n)>>2|12&o|(12&l)<<2|(12&c)<<4,t[i+3]=3&n|(3&o)<<2|(3&l)<<4|(3&c)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}var Yr=Uint8Array,ih=Uint16Array,k1=Int32Array,Oy=new Yr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),By=new Yr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),O1=new Yr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fy=function(t,e){for(var i=new ih(31),n=0;n<31;++n)i[n]=e+=1<>1|(21845&Ei)<<1;Uy[Ei]=((65280&(bc=(61680&(bc=(52428&bc)>>2|(13107&bc)<<2))>>4|(3855&bc)<<4))>>8|(255&bc)<<8)>>1}var rh=function(t,e,i){for(var n=t.length,o=0,l=new ih(e);o>f]=_;return c},nh=new Yr(288);for(Ei=0;Ei<144;++Ei)nh[Ei]=8;for(Ei=144;Ei<256;++Ei)nh[Ei]=9;for(Ei=256;Ei<280;++Ei)nh[Ei]=7;for(Ei=280;Ei<288;++Ei)nh[Ei]=8;var jy=new Yr(32);for(Ei=0;Ei<32;++Ei)jy[Ei]=5;var N1=rh(nh,9),V1=rh(jy,5),dm=function(t){for(var e=t[0],i=1;ie&&(e=t[i]);return e},In=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},pm=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},U1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],An=function(t,e,i){var n=new Error(e||U1[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,An),!i)throw n;return n},j1=new Yr(0),G1=typeof TextDecoder<"u"&&new TextDecoder;try{G1.decode(j1,{stream:!0})}catch{}const $1={gzip_data:"gzip"};class ln extends Error{constructor(e){super(e),this.name="MRTError"}}const q1={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Gy={uint32:1,uint16:2,uint8:4},Z1={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let fm,mm;class oh{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ln(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new ln("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length= ${n} but got buffer of length ${i.length}`);const o=function(l,c){return l.readFields(T1,{header_length:0,x:0,y:0,z:0,layers:[]},void 0)}(new fm(i.subarray(0,n)));if(!isNaN(this.x)&&(this.x!==o.x||this.y!==o.y||this.z!==o.z))throw new ln(`Invalid attempt to parse header ${o.z}/${o.x}/${o.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=o.x,this.y=o.y,this.z=o.z;for(const l of o.layers)this.layers[l.name]=new W1(l,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let o of e.blockIndices){const l=n.dataIndex[o],c=l.first_byte-e.firstByte,d=l.last_byte-e.firstByte;if(n._blocksInProgress.has(o))continue;const f={layerName:n.name,firstByte:c,lastByte:d,pixelFormat:n.pixelFormat,blockIndex:o,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(_=>_.filter)};n._blocksInProgress.add(o),i.push(f)}return new $y(i,()=>{i.forEach(o=>n._blocksInProgress.delete(o.blockIndex))},(o,l)=>{if(i.forEach(c=>n._blocksInProgress.delete(c.blockIndex)),o)throw o;l.forEach(c=>{this.getLayer(c.layerName).processDecodedData(c)})})}}class W1{constructor({version:e,name:i,units:n,tilesize:o,pixel_format:l,buffer:c,data_index:d},f){if(this.version=e,this.version!==1)throw new ln(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=o,this.buffer=c,this.pixelFormat=q1[l],this.dataIndex=d,this.bandShape=[o+2*c,o+2*c,Gy[this.pixelFormat]],this._decodedBlocks=new z1(f?f.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Gy[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,o]of this.dataIndex.entries()){for(const[l,c]of o.bands.entries())if(c===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=o.bands.length}break;case"number":for(const[n,o]of this.dataIndex.entries()){if(e>=i&&ethis.cacheSize)throw new ln(`Number of blocks to decode (${l.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:n,blockIndices:o}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e),o=this._decodedBlocks.get(i.toString());if(!o)throw new ln(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],c=this.bandShape.reduce((_,y)=>_*y,1),d=n*c,f=o.subarray(d,d+c);return{data:f,bytes:new Uint8Array(f.buffer).subarray(f.byteOffset,f.byteOffset+f.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:l.offset!==0?l.offset:l.deprecated_offset,scale:l.scale!==0?l.scale:l.deprecated_scale}}}oh.setPbf=function(t){fm=t};class $y{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}oh.performDecoding=function(t,e){const i=new Uint8Array(t);return Promise.all(e.tasks.map(n=>{const{layerName:o,firstByte:l,lastByte:c,pixelFormat:d,blockShape:f,blockIndex:_,filters:y,codec:v}=n,b=i.subarray(l,c+1),E=new Uint32Array(f[0]*f[1]*f[2]);let M;if(v!=="gzip_data")throw new ln(`Unhandled codec: ${v}`);return M=function(A,C){if(!globalThis.DecompressionStream&&C==="gzip_data")return Promise.resolve(((U=function(Q){Q[0]==31&&Q[1]==139&&Q[2]==8||An(6,"invalid gzip data");var ae=Q[3],de=10;4&ae&&(de+=2+(Q[10]|Q[11]<<8));for(var ye=(ae>>3&1)+(ae>>4&1);ye>0;ye-=!Q[de++]);return de+(2&ae)}(N=A))+8>N.length&&An(6,"invalid gzip data"),function(Q,ae,de,ye){var pe=Q.length;if(!pe||ae.f&&!ae.l)return de||new Yr(0);var we=!de,De=we||ae.i!=2,Te=ae.i;we&&(de=new Yr(3*pe));var ke,be,Ie=function(Rs){var Ya=de.length;if(Rs>Ya){var mh=new Yr(Math.max(2*Ya,Rs));mh.set(de),de=mh}},Be=ae.f||0,Ee=ae.p||0,Ve=ae.b||0,Oe=ae.l,Re=ae.d,et=ae.m,Ke=ae.n,Ze=8*pe;do{if(!Oe){Be=In(Q,Ee,1);var Ne=In(Q,Ee+1,3);if(Ee+=3,!Ne){var st=Q[(mt=4+((Ee+7)/8|0))-4]|Q[mt-3]<<8,Qe=mt+st;if(Qe>pe){Te&&An(0);break}De&&Ie(Ve+st),de.set(Q.subarray(mt,Qe),Ve),ae.b=Ve+=st,ae.p=Ee=8*Qe,ae.f=Be;continue}if(Ne==1)Oe=N1,Re=V1,et=9,Ke=5;else if(Ne==2){var Xe=In(Q,Ee,31)+257,ut=In(Q,Ee+10,15)+4,ft=Xe+In(Q,Ee+5,31)+1;Ee+=14;for(var ht=new Yr(ft),vt=new Yr(19),zt=0;zt>4)<16)ht[zt++]=mt;else{var Wt=0,oi=0;for(mt==16?(oi=3+In(Q,Ee,3),Ee+=2,Wt=ht[zt-1]):mt==17?(oi=3+In(Q,Ee,7),Ee+=3):mt==18&&(oi=11+In(Q,Ee,127),Ee+=7);oi--;)ht[zt++]=Wt}}var _i=ht.subarray(0,Xe),Si=ht.subarray(Xe);et=dm(_i),Ke=dm(Si),Oe=rh(_i,et),Re=rh(Si,Ke)}else An(1);if(Ee>Ze){Te&&An(0);break}}De&&Ie(Ve+131072);for(var gi=(1<>4;if((Ee+=15&Wt)>Ze){Te&&An(0);break}if(Wt||An(2),Ai<256)de[Ve++]=Ai;else{if(Ai==256){Oi=Ee,Oe=null;break}var Qi=Ai-254;Ai>264&&(Qi=In(Q,Ee,(1<<(Pn=Oy[zt=Ai-257]))-1)+Vy[zt],Ee+=Pn);var ri=Re[pm(Q,Ee)&pi],Sr=ri>>4;if(ri||An(3),Ee+=15&ri,Si=F1[Sr],Sr>3){var Pn=By[Sr];Si+=pm(Q,Ee)&(1<Ze){Te&&An(0);break}De&&Ie(Ve+131072);var cn=Ve+Qi;if(Veke.length)&&(be=ke.length),new Yr(ke.subarray(0,be))):de.subarray(0,Ve)}(N.subarray(U,-8),{i:2},new Yr(((D=N)[(V=D.length)-4]|D[V-3]<<8|D[V-2]<<16|D[V-1]<<24)>>>0))));var D,V,N,U;const H=$1[C];if(!H)throw new Error(`Unhandled codec: ${C}`);const X=new globalThis.DecompressionStream(H);return new Response(new Blob([A]).stream().pipeThrough(X)).arrayBuffer().then(Q=>new Uint8Array(Q))}(b,v).then(A=>(function(C,D){C.readFields(C1,D)}(new fm(A),E),new Z1[d](E.buffer))),M.then(A=>{for(let C=y.length-1;C>=0;C--)switch(y[C]){case"delta_filter":D1(A,f);break;case"zigzag_filter":R1(A);break;case"bitshuffle_filter":L1(A,d);break;default:throw new ln(`Unhandled filter "${y[C]}"`)}return{layerName:o,blockIndex:_,data:A}}).catch(A=>{throw A})}))},oh.setPbf(Zu);class qy extends op{constructor(e,i,n,o,l){super(e,i,n,o,l),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(e,i){const n=i.context,o=n.gl;this.texture=this.texture||i.getTileTexture(e.width),this.texture&&this.texture instanceof sn?this.texture.update(e,{useMipmap:!1,premultiply:!1}):this.texture=new sn(n,e,o.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(e=16384,i){const n=this._mrt=new oh(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(e-1)}});return this.entireBuffer=null,this.request=uo(o,(l,c,d,f)=>{if(l)i(l);else try{const _=n.getHeaderLength(c);if(_>e)return void(this.request=this.fetchHeader(_,i));n.parseHeader(c),this._isHeaderLoaded=!0;let y=0;for(const v of Object.values(n.layers))y=Math.max(y,v.dataIndex[v.dataIndex.length-1].last_byte);c.byteLength>=y&&(this.entireBuffer=c),i(null,this.entireBuffer||c,d,f)}catch(_){i(_)}}),this.request}fetchBand(e,i,n){const o=this._mrt;if(!this._isHeaderLoaded||!o)return void n(new Error("Tile header is not ready"));const l=this.actor;if(!l)return void n(new Error("Can't fetch tile band without an actor"));let c;const d=(v,b)=>{c.complete(v,b),v?n(v):(this.updateTextureDescriptor(e,i),n(null,this.textureDescriptor&&this.textureDescriptor.img))},f=(v,b)=>{if(v)return n(v);const E=l.send("decodeRasterArray",{buffer:b,task:c},d,void 0,!0);this._workQueue.push(()=>{E&&E.cancel(),c.cancel()})},_=o.getLayer(e);if(!_)return void n(new Error(`Unknown sourceLayer "${e}"`));if(_.hasDataForBand(i))return this.updateTextureDescriptor(e,i),void n(null,this.textureDescriptor?this.textureDescriptor.img:null);const y=_.getDataRange([i]);if(c=o.createDecodingTask(y),!c||c.tasks.length)if(this.flushQueues(),this.entireBuffer)f(null,this.entireBuffer.slice(y.firstByte,y.lastByte+1));else{const v=Object.assign({},this.requestParams,{headers:{Range:`bytes=${y.firstByte}-${y.lastByte}`}}),b=uo(v,f);this._fetchQueue.push(()=>{b.cancel(),c.cancel()})}else n(null)}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&this.state!=="errored"}updateTextureDescriptor(e,i){if(!this._mrt)return;const n=this._mrt.getLayer(e);if(!n||!n.hasBand(i)||!n.hasDataForBand(i))return;const{bytes:o,tileSize:l,buffer:c,offset:d,scale:f}=n.getBandView(i),_=l+2*c,y={data:o,width:_,height:_},v=this.texture;v&&v instanceof sn&&v.update(y,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:e,band:i,img:y,buffer:c,offset:d,tileSize:l,format:n.pixelFormat,mix:[f,256*f,65536*f,16777216*f]}}}class H1{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,n){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const l={value:i,timeout:void 0};if(n!==void 0&&(l.timeout=setTimeout(()=>{this.remove(e,l)},n)),this.data[o].push(l),this.order.push(o),this.order.length>this.max){const c=this._getAndRemoveByKey(this.order[0]);c&&this.onRemove(c)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const n=e.wrapped().key,o=i===void 0?0:this.data[n].indexOf(i),l=this.data[n][o];return this.data[n].splice(o,1),l.timeout&&clearTimeout(l.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(l.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const n in this.data)for(const o of this.data[n])e(o.value)||i.push(o);for(const n of i)this.remove(n.value.tileID,n)}}class qa extends mo{constructor(e,i,n){super(),this.id=e,this._onlySymbols=n,i.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new H1(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new qv,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(e){this.map=e,this._minTileCacheSize=this._minTileCacheSize===void 0&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const n=this._tiles[i];n.upload(e),n.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return jc(this._tiles).map(e=>e.tileID).sort(Zy).map(e=>e.key)}getRenderableIds(e,i){const n=[];for(const o in this._tiles)this._isIdRenderable(+o,e,i)&&n.push(this._tiles[o]);return e?n.sort((o,l)=>{const c=o.tileID,d=l.tileID,f=new je(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),_=new je(d.canonical.x,d.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-d.overscaledZ||_.y-f.y||_.x-f.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Zy).map(o=>o.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(n||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(+e,"reloading")}}_reloadTile(e,i){const n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=i),this._loadTile(n,this._tileLoaded.bind(this,n,e,i)))}_tileLoaded(e,i,n,o){if(o)if(e.state="errored",o.status!==404)this._source.fire(new pa(o,{tile:e}));else{if(this._source.fire(new en("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:e})),!(e.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const l=this.map.painter.terrain;this.update(this.transform,l.getScaledDemTileSize(),!0),l.resetTileLookupCache(this.id)}else this.update(this.transform)}else e.timeAdded=Zi.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this._source.type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new en("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o1||(Math.abs(c)>1&&(Math.abs(c+f)===1?c+=f:Math.abs(c-f)===1&&(c-=f)),l.dem&&o.dem&&(o.dem.backfillBorder(l.dem,c,d),o.neighboringTiles&&o.neighboringTiles[_]&&(o.neighboringTiles[_].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,n,o){for(const l in this._tiles){let c=this._tiles[l];if(o[l]||!c.hasData()||c.tileID.overscaledZ<=i||c.tileID.overscaledZ>n)continue;let d=c.tileID;for(;c&&c.tileID.overscaledZ>i+1;){const _=c.tileID.scaledTo(c.tileID.overscaledZ-1);c=this._tiles[_.key],c&&c.hasData()&&(d=_)}let f=d;for(;f.overscaledZ>i;)if(f=f.scaledTo(f.overscaledZ-1),e[f.key]){o[d.key]=d;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=i?n:null}for(let n=e.overscaledZ-1;n>=i;n--){const o=e.scaledTo(n),l=this._getLoadedTile(o);if(l)return l}}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;const n=Math.ceil(e.width/i)+1,o=Math.ceil(e.height/i)+1,l=Math.floor(n*o*5),c=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,l):l,d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(d)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const n={};for(const o in this._tiles){const l=this._tiles[o];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+i),n[l.tileID.key]=l}this._tiles=n;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}update(e,i,n,o){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(e,i),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const l=this._source.type==="batched-model";let c;if(this.used||this.usedForTerrain){if(this._source.tileID)c=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(_=>new Pi(_.canonical.z,_.wrap,_.canonical.z,_.canonical.x,_.canonical.y));else if(this.tileCoverLift!==0){const _=e.clone();_.tileCoverLift=this.tileCoverLift,c=_.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.minzoom<=1&&e.projection.name==="globe"&&(c.push(new Pi(1,0,1,0,0)),c.push(new Pi(1,0,1,1,0)),c.push(new Pi(1,0,1,0,1)),c.push(new Pi(1,0,1,1,1)))}else if(c=e.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.hasTile){const _=this._source.hasTile.bind(this._source);c=c.filter(y=>_(y))}}else c=[];if(c.length>0&&this.castsShadows&&o&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!_m(this._source.type)){const _=e.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),y=Math.min(_,this._source.maxzoom);if(l){const v=e.extendTileCover(c,y);for(const b of v)c.push(b)}else{const v=e.extendTileCover(c,y,o);for(const b of v)this._shadowCasterTiles[b.key]=!0,c.push(b)}}const d=this._updateRetainedTiles(c);if(_m(this._source.type)&&c.length!==0){const _={},y={},v=Object.keys(d);for(const E of v){const M=d[E],A=this._tiles[E];if(!A||A.fadeEndTime&&A.fadeEndTime<=Zi.now())continue;const C=this.findLoadedParent(M,Math.max(M.overscaledZ-qa.maxOverzooming,this._source.minzoom));C&&(this._addTile(C.tileID),_[C.tileID.key]=C.tileID),y[E]=M}const b=c[c.length-1].overscaledZ;for(const E in this._tiles){const M=this._tiles[E];if(d[E]||!M.hasData())continue;let A=M.tileID;for(;A.overscaledZ>b;){A=A.scaledTo(A.overscaledZ-1);const C=this._tiles[A.key];if(C&&C.hasData()&&y[A.key]){d[E]=M.tileID;break}}}for(const E in _)d[E]||(this._coveredTiles[E]=!0,d[E]=_[E])}for(const _ in d)this._tiles[_].clearFadeHold();const f=function(_,y){const v=[];for(const b in _)b in y||v.push(b);return v}(this._tiles,d);for(const _ of f){const y=this._tiles[_];y.hasSymbolBuckets&&!y.holdingForFade()?y.setHoldDuration(this.map._fadeDuration):y.hasSymbolBuckets&&!y.symbolFadeFinished()||this._removeTile(+_)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const i={};if(e.length===0)return i;const n={},o=e.reduce((_,y)=>Math.min(_,y.overscaledZ),1/0),l=e[0].overscaledZ,c=Math.max(l-qa.maxOverzooming,this._source.minzoom),d=Math.max(l+qa.maxUnderzooming,this._source.minzoom),f={};for(const _ of e){const y=this._addTile(_);i[_.key]=_,y.hasData()||o=this._source.maxzoom){const b=_.children(this._source.maxzoom)[0],E=this.getTile(b);if(E&&E.hasData()){i[b.key]=b;continue}}else{const b=_.children(this._source.maxzoom);if(i[b[0].key]&&i[b[1].key]&&i[b[2].key]&&i[b[3].key])continue}let v=y.wasRequested();for(let b=_.overscaledZ-1;b>=c;--b){const E=_.scaledTo(b);if(n[E.key]||(n[E.key]=!0,y=this.getTile(E),!y&&v&&(y=this._addTile(E)),y&&(i[E.key]=E,v=y.wasRequested(),y.hasData())))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let n,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}i.push(o.key);const l=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(l),n)break;o=l}for(const l of i)this._loadedParentTiles[l]=n}}_addTile(e){let i=this._tiles[e.key];if(i)return i.isExtraShadowCaster!==!0||this._shadowCasterTiles[e.key]||this._reloadTile(e.key,"reloading"),i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=!!i;if(!n){const o=this.map?this.map.painter:null,l=this._source.tileSize*e.overscaleFactor();i=this._source.type==="raster-array"?new qy(e,l,this.transform.tileZoom,o,this._isRaster):new op(e,l,this.transform.tileZoom,o,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))}return i?(i.uses++,this._tiles[e.key]=i,n||this._source.fire(new en("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=i.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"||i.state==="empty"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,i,n){const o=[],l=this.transform;if(!l)return o;const c=l.projection.name==="globe",d=Hn(l.center.lng);for(const f in this._tiles){const _=this._tiles[f];if(n&&_.clearQueryDebugViz(),_.holdingForFade())continue;let y;if(c){const v=_.tileID.canonical;if(v.z===0){const b=[Math.abs(Et(d,...sh(v,-1))-d),Math.abs(Et(d,...sh(v,1))-d)];y=[0,2*b.indexOf(Math.min(...b))-1]}else{const b=[Math.abs(Et(d,...sh(v,-1))-d),Math.abs(Et(d,...sh(v,0))-d),Math.abs(Et(d,...sh(v,1))-d)];y=[b.indexOf(Math.min(...b))-1]}}else y=[0];for(const v of y){const b=e.containsTile(_,l,i,v);b&&o.push(b)}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){const n=this.getRenderableIds(e,i).map(l=>this._tiles[l].tileID),o=this.transform.projection.name==="globe";for(const l of n)l.projMatrix=this.transform.calculateProjMatrix(l.toUnwrapped()),l.expandedProjMatrix=o?this.transform.calculateProjMatrix(l.toUnwrapped(),!1,!0):l.projMatrix;return n}sortCoordinatesByDistance(e){const i=e.slice(),n=this.transform._camera.position,o=this.transform._camera.forward(),l={};for(const c of i){const d=1/(1<l[c.key]-l[d.key]),i}hasTransition(){if(this._source.hasTransition())return!0;if(_m(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(i.fadeEndTime!==void 0&&i.fadeEndTime>=Zi.now())return!0}return!1}setFeatureState(e,i,n){this._state.updateState(e=e||"_geojsonTileLayer",i,n)}removeFeatureState(e,i,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,n)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,n){const o=this._tiles[e];o&&o.setDependencies(i,n)}reloadTilesForDependencies(e,i){for(const n in this._tiles)this._tiles[n].hasDependency(e,i)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(e,i))}_preloadTiles(e,i){if(!this._sourceLoaded){const d=()=>{this._sourceLoaded&&(this._source.off("data",d),this._preloadTiles(e,i))};return void this._source.on("data",d)}const n=new Map,o=Array.isArray(e)?e:[e],l=this.map.painter.terrain,c=this.usedForTerrain&&l?l.getScaledDemTileSize():this._source.tileSize;for(const d of o){const f=d.coveringTiles({tileSize:c,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const _ of f)n.set(_.key,_);this.usedForTerrain&&d.updateElevation(!1)}Js(Array.from(n.values()),(d,f)=>{const _=new op(d,this._source.tileSize*d.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(_,y=>{this._source.type==="raster-dem"&&_.dem&&this._backfillDEM(_),f(y,_)})},i)}}function Zy(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function _m(t){return t==="raster"||t==="image"||t==="video"||t==="custom"}function sh(t,e){const i=1<mm||(mm={layout:Gg||(Gg=new ei({"line-cap":new Ye(me.layout_line["line-cap"]),"line-join":new Ye(me.layout_line["line-join"]),"line-miter-limit":new Le(me.layout_line["line-miter-limit"]),"line-round-limit":new Le(me.layout_line["line-round-limit"]),"line-sort-key":new Ye(me.layout_line["line-sort-key"]),"line-z-offset":new Ye(me.layout_line["line-z-offset"]),visibility:new Le(me.layout_line.visibility)})),paint:$g||($g=new ei({"line-opacity":new Ye(me.paint_line["line-opacity"]),"line-color":new Ye(me.paint_line["line-color"]),"line-translate":new Le(me.paint_line["line-translate"]),"line-translate-anchor":new Le(me.paint_line["line-translate-anchor"]),"line-width":new Ye(me.paint_line["line-width"]),"line-gap-width":new Ye(me.paint_line["line-gap-width"]),"line-offset":new Ye(me.paint_line["line-offset"]),"line-blur":new Ye(me.paint_line["line-blur"]),"line-dasharray":new Ye(me.paint_line["line-dasharray"]),"line-pattern":new Ye(me.paint_line["line-pattern"]),"line-gradient":new rr(me.paint_line["line-gradient"]),"line-trim-offset":new Le(me.paint_line["line-trim-offset"]),"line-trim-fade-range":new Le(me.paint_line["line-trim-fade-range"]),"line-trim-color":new Le(me.paint_line["line-trim-color"]),"line-emissive-strength":new Le(me.paint_line["line-emissive-strength"]),"line-border-width":new Ye(me.paint_line["line-border-width"]),"line-border-color":new Ye(me.paint_line["line-border-color"]),"line-occlusion-opacity":new Le(me.paint_line["line-occlusion-opacity"])}))},mm);class X1 extends Ye{possiblyEvaluate(e,i){return i=new at(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,n,o){return i=Gi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,n,o)}}let ah,Hy,Xy,gm;function Yy(t,e){return e>0?e+2*t:t}class Jy{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:mr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}se(Jy,"FormatSectionOverride",{omit:["defaultValue"]});const ym=()=>gm||(gm={layout:Hy||(Hy=new ei({"symbol-placement":new Le(me.layout_symbol["symbol-placement"]),"symbol-spacing":new Le(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Le(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ye(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Le(me.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Le(me.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new Le(me.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Le(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new Le(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Le(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ye(me.layout_symbol["icon-size"]),"icon-text-fit":new Ye(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ye(me.layout_symbol["icon-image"]),"icon-rotate":new Ye(me.layout_symbol["icon-rotate"]),"icon-padding":new Le(me.layout_symbol["icon-padding"]),"icon-keep-upright":new Le(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Ye(me.layout_symbol["icon-offset"]),"icon-anchor":new Ye(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Le(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Le(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Le(me.layout_symbol["text-rotation-alignment"]),"text-field":new Ye(me.layout_symbol["text-field"]),"text-font":new Ye(me.layout_symbol["text-font"]),"text-size":new Ye(me.layout_symbol["text-size"]),"text-max-width":new Ye(me.layout_symbol["text-max-width"]),"text-line-height":new Ye(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Ye(me.layout_symbol["text-letter-spacing"]),"text-justify":new Ye(me.layout_symbol["text-justify"]),"text-radial-offset":new Ye(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Le(me.layout_symbol["text-variable-anchor"]),"text-anchor":new Ye(me.layout_symbol["text-anchor"]),"text-max-angle":new Le(me.layout_symbol["text-max-angle"]),"text-writing-mode":new Le(me.layout_symbol["text-writing-mode"]),"text-rotate":new Ye(me.layout_symbol["text-rotate"]),"text-padding":new Le(me.layout_symbol["text-padding"]),"text-keep-upright":new Le(me.layout_symbol["text-keep-upright"]),"text-transform":new Ye(me.layout_symbol["text-transform"]),"text-offset":new Ye(me.layout_symbol["text-offset"]),"text-allow-overlap":new Le(me.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Le(me.layout_symbol["text-ignore-placement"]),"text-optional":new Le(me.layout_symbol["text-optional"]),visibility:new Le(me.layout_symbol.visibility)})),paint:Xy||(Xy=new ei({"icon-opacity":new Ye(me.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ye(me.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ye(me.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ye(me.paint_symbol["text-emissive-strength"]),"icon-color":new Ye(me.paint_symbol["icon-color"]),"icon-halo-color":new Ye(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ye(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ye(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Le(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new Le(me.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ye(me.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ye(me.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ye(me.paint_symbol["text-occlusion-opacity"]),"text-color":new Ye(me.paint_symbol["text-color"],{runtimeType:Rr,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Ye(me.paint_symbol["text-halo-color"]),"text-halo-width":new Ye(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Ye(me.paint_symbol["text-halo-blur"]),"text-translate":new Le(me.paint_symbol["text-translate"]),"text-translate-anchor":new Le(me.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Le(me.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Le(me.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Le(me.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Le(me.paint_symbol["icon-color-brightness-max"])}))},gm);class sp extends Tr{constructor(e,i,n,o){super(e,ym(),i,n,o),this._colorAdjustmentMatrix=s.ae.identity([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const o=[];for(const l of n)o.indexOf(l)<0&&o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,o){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===o||(this._colorAdjustmentMatrix=function(l,c,d,f){l=Eh(l),c=Th(c);const _=s.ae.create(),y=l/3,v=1-2*y,b=[v,y,y,0,y,v,y,0,y,y,v,0,0,0,0,1],E=.5-.5*c,M=f-d;return s.ae.multiply(_,[M,0,0,0,0,M,0,0,0,0,M,0,d,d,d,1],[c,0,0,0,0,c,0,0,0,0,c,0,E,E,E,1]),s.ae.multiply(_,_,b),_}(e,i,n,o),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=o),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,o){const l=this.layout.get(e).evaluate(i,{},n,o),c=this._unevaluatedLayout._values[e];return c.isDataDriven()||$(c.value)||!l?l:function(d,f){return f.replace(/{([^{}]+)}/g,(_,y)=>y in d?String(d[y]):"")}(i.properties,l)}createBucket(e){return new xc(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of ym().paint.overridableProperties){if(!sp.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Jy(i),o=new G(n,i.property.specification,this.scope,this.options);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new J("source",o):new Z("composite",o,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new Li(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&sp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),o=ym().paint.properties[i];let l=!1;const c=d=>{for(const f of d)if(o.overrides&&o.overrides.hasOverride(f))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof ir)c(n.value.value.sections);else if(n.value.kind==="source"){const d=_=>{l||(_ instanceof Zr&&Ii(_.value)===as?c(_.value.sections):_ instanceof go?c(_.sections):_.eachChild(d))},f=n.value;f._styleExpression&&d(f._styleExpression.expression)}return l}getProgramIds(){const e=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,n=[];return e&&n.push("symbolIcon"),i&&n.push("symbolSDF"),n}getDefaultProgramParams(e,i,n){return{config:new Ba(this,{zoom:i,lut:n}),overrideFog:!1}}}let Ky,Qy,e0,t0;function ap(t,e,i,n,o,l,c,d){const f=[t,e,1,i,n,1,o,l,1],_=[c,d,1],y=s.bE.adjoint([],f),[v,b,E]=s.$.transformMat3(_,_,y);return s.bE.multiply(f,f,[v,0,0,0,b,0,0,0,E])}function i0(t,e,i,n,o,l,c,d){const f=function(_,y,v,b,E,M,A,C){const D=ap(0,0,1,0,1,1,0,1),V=ap(_,y,v,b,E,M,A,C),N=s.bE.adjoint([],D);return s.bE.multiply(V,V,N)}(t,e,i,n,o,l,c,d);return[f[2]/f[8]/Fe,f[5]/f[8]/Fe]}function lp(t){return[t[0],Math.min(Math.max(t[1],-Ti),Ti)]}class r0 extends mo{constructor(e,i,n,o){super(),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(o),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new en("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ca(this.map._requestManager.transformRequest(this.url,aa.Image),(n,o)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new pa(n)):o&&(this.image=o instanceof HTMLImageElement?Zi.getImageData(o):o,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new ip(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new en("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof ip||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]Ti?this.onNorthPole=!0:o<-Ti&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(nr.fromLngLat);this.tileID=function(c){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const A of c)d=Math.min(d,A.x),f=Math.min(f,A.y),_=Math.max(_,A.x),y=Math.max(y,A.y);const v=Math.max(_-d,y-f),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,b);let M=Math.floor((d+_)/2*E);return M>1&&(M-=1),new Na(b,M,Math.floor((f+y)/2*E))}(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new en("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const C in this.tiles){const D=this.tiles[C];D.state!=="loaded"&&(D.state="loaded",D.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ga(new Na(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(C){const D=C[1].x-C[0].x,V=C[1].y-C[0].y,N=C[2].x-C[1].x,U=C[2].y-C[1].y,H=C[3].x-C[2].x,X=C[3].y-C[2].y,Q=C[0].x-C[3].x,ae=C[0].y-C[3].y,de=D*U-N*V,ye=N*X-H*U,pe=H*ae-Q*X,we=Q*V-D*ae;return de>0&&ye>0&&pe>0&&we>0||de<0&&ye<0&&pe<0&&we<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const o=Ga(this.tileID,this.map.transform.projection),[l,c,d,f]=this.coordinates.map(C=>{const D=o.projection.project(C[0],C[1]);return Ay(o,D)._round()});this.perspectiveTransform=i0(l.x,l.y,c.x,c.y,d.x,d.y,f.x,f.y);const _=this._boundsArray=new To;_.emplaceBack(l.x,l.y,0,0),_.emplaceBack(c.x,c.y,Fe,0),_.emplaceBack(f.x,f.y,0,Fe),_.emplaceBack(d.x,d.y,Fe,Fe),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(_,np.members),this.boundsSegments=hi.simpleSegment(0,0,4,2);const y=[],v=function(C){return[lp(C[0]),lp(C[1]),lp(C[2]),lp(C[3])]}(this.coordinates),[b,E,M,A]=function(C){let D=C[0][0],V=D,N=C[0][1],U=N;for(let H=1;HV&&(V=C[H][0]),C[H][1]U&&(U=C[H][1]);return[D,N,V-D,U-N]}(v);{const C=new To,[D,V,N,U]=function(be){let Ie=be[0].x,Be=Ie,Ee=be[0].y,Ve=Ee;for(let Oe=1;OeBe&&(Be=be[Oe].x),be[Oe].yVe&&(Ve=be[Oe].y);return[Ie,Ee,Be-Ie,Ve-Ee]}(n),H=be=>[(be.x-D)/N,(be.y-V)/U],[X,Q,ae,de]=n.map(H),ye=function(be,Ie,Be,Ee,Ve,Oe,Re,et){const Ke=ap(0,0,1,0,1,1,0,1),Ze=ap(be,Ie,Be,Ee,Ve,Oe,Re,et),Ne=s.bE.adjoint([],Ze);return s.bE.multiply(Ke,Ke,Ne)}(X[0],X[1],Q[0],Q[1],ae[0],ae[1],de[0],de[1]);this.elevatedGlobePerspectiveTransform=i0(X[0],X[1],Q[0],Q[1],ae[0],ae[1],de[0],de[1]);const pe=(be,Ie)=>{y.push(be.lng);const Be=Math.round((be.lng-b)/M*Fe),Ee=Math.round((be.lat-E)/A*Fe),Ve=H(Ie),Oe=s.$.transformMat3([],[Ve[0],Ve[1],1],ye),Re=Math.round(Oe[0]/Oe[2]*Fe),et=Math.round(Oe[1]/Oe[2]*Fe);C.emplaceBack(Be,Ee,Re,et)},we=n[3].x-n[0].x,De=n[3].y-n[0].y,Te=n[2].x-n[1].x,ke=n[2].y-n[1].y;for(let be=0;be<65;be++){const Ie=be/64,Be=[n[0].x+Ie*we,n[0].y+Ie*De],Ee=[n[1].x+Ie*Te,n[1].y+Ie*ke],Ve=Ee[0]-Be[0],Oe=Ee[1]-Be[1];for(let Re=0;Re<65;Re++){const et=Re/64,Ke={x:Be[0]+Ve*et,y:Be[1]+Oe*et,z:0};pe(i.projection.unproject(Ke.x,Ke.y),Ke)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(C,np.members)}{this.maxLongitudeTriangleSize=0;let C=[],D=new ki;const V=(N,U,H)=>{D.emplaceBack(N,U,H);const X=y[N],Q=y[U],ae=y[H],de=Math.min(Math.min(X,Q),ae),ye=Math.max(Math.max(X,Q),ae)-de;ye>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=ye),C.push(de+ye/2)};for(let N=0;N<64;N++)for(let U=0;U<64;U++){const H=65*N+U,X=H+1,Q=H+65,ae=Q+1;V(H,Q,X),V(X,Q,ae)}[C,D]=function(N,U){const H=Array.from({length:N.length},(ae,de)=>de);H.sort((ae,de)=>N[ae]-N[de]);const X=[],Q=new ki;for(let ae=0;ae{c.segments.push({vertexOffset:0,primitiveOffset:v,vertexLength:i.segments[0].vertexLength,primitiveLength:b,sortKey:void 0,vaos:{}})},f=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=f){const v=wl(n,0,n.length,o+f);return v===n.length||d(v,bl(n,v+1,n.length,o+360-f)-v),c}o0){const l=function(c,d){const f=d.worldSize,_=dr(1,0)*f*Va(d.center.lat,d.zoom)/Ff(f),y=dr(1,d.center.lat)*f,v=s.ae.identity([]);return s.ae.rotateY(v,v,At(d.center.lng)),s.ae.rotateX(v,v,At(d.center.lat)),s.ae.translate(v,v,[0,0,hr]),s.ae.scale(v,v,[_,_,_*y]),s.ae.translate(v,v,[d.point.x-.5*f,d.point.y-.5*f,0]),s.ae.multiply(v,v,c),s.ae.multiply(v,d.globeMatrix,v)}(t,e);return function(c,d,f){const _=(M,A,C)=>{const D=s.$.length(M),V=s.$.length(A),N=Ao(M,A,C);return s.$.scale(N,N,1/s.$.length(N)*rt(D,V,C))},y=_([c[0],c[1],c[2]],[d[0],d[1],d[2]],f),v=_([c[4],c[5],c[6]],[d[4],d[5],d[6]],f),b=_([c[8],c[9],c[10]],[d[8],d[9],d[10]],f),E=Ao([c[12],c[13],c[14]],[d[12],d[13],d[14]],f);return[y[0],y[1],y[2],0,v[0],v[1],v[2],0,b[0],b[1],b[2],0,E[0],E[1],E[2],1]}(o,l,n)}return o}function _0(t,e,i,n){const o=ci.projectAabbCorners(n,i);let l=Number.MAX_VALUE,c=-1;for(let _=0;_new je(o[_][0],o[_][1]);let f;switch(c){case 0:case 6:f=[d(1),d(5),d(4),d(7),d(3),d(2),d(1)];break;case 1:case 7:f=[d(0),d(4),d(5),d(6),d(2),d(3),d(0)];break;case 3:case 5:f=[d(1),d(0),d(4),d(7),d(6),d(2),d(1)];break;default:f=[d(1),d(5),d(6),d(7),d(3),d(0),d(1)]}if(Af(t,f))return l}const K1=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),Q1=$t([{name:"a_color_3f",components:3,type:"Float32"}]),eb=$t([{name:"a_color_4f",components:4,type:"Float32"}]),tb=$t([{name:"a_uv_2f",components:2,type:"Float32"}]),ib=$t([{name:"a_normal_3f",components:3,type:"Float32"}]),rb=$t([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),nb=$t([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class hp{constructor(e,i,n,o){this.message=(e?`${e}: `:"")+n,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function g0(t,e){const i=t.indexOf("://")===-1;try{return new URL(t,i&&e?"http://example.com":void 0),!0}catch{return!1}}class y0{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class x0{constructor(){this.instancedDataArray=new hf,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class bm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,i){}populate(e,i,n,o){this.tileToMeter=vd(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:c,id:d,index:f,sourceLayerIndex:_}of e){const y=d??(c.properties&&c.properties.hasOwnProperty("id")?c.properties.id:void 0),v=Io(c,l);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),v,n))continue;const b={id:y,sourceLayerIndex:_,index:f,geometry:l?v.geometry:Tn(c,n,o),properties:c.properties,type:c.type,patterns:{}},E=this.addFeature(b,b.geometry,v);E&&i.featureIndex.insert(c,b.geometry,f,_,this.index,this.instancesPerModel[E].instancedDataArray.length,Fe/32)}this.lookup=null}update(e,i,n,o){for(const l in this.instancesPerModel){const c=this.instancesPerModel[l];for(const d in e)c.idToFeaturesIndex.hasOwnProperty(d)&&(this.evaluate(c.features[c.idToFeaturesIndex[d]],e[d],c,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const o of n.features){const l=this.layers[0],c=o.feature,d=this.canonical,f=l.paint.get("model-rotation").evaluate(c,{},d),_=l.paint.get("model-scale").evaluate(c,{},d),y=l.paint.get("model-translation").evaluate(c,{},d);s.$.exactEquals(o.rotation,f)&&s.$.exactEquals(o.scale,_)&&s.$.exactEquals(o.translation,y)||(this.evaluate(o,o.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n,o){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Hf(this.activeReplacements,l))return!1;this.activeReplacements=l;let c=!1;for(const d in this.instancesPerModel){const f=this.instancesPerModel[d],_=f.instancedDataArray;for(const y of f.features){const v=y.instancedDataOffset,b=y.instancedDataCount;for(let E=0;EFe?A-Fe:A;const C=Math.floor(A),D=_.float32[M+1];let V=!1;for(const N of this.activeReplacements)if(!ag(N,n,bg.Model,o)&&!(N.min.x>C||C>N.max.x||N.min.y>D||D>N.max.y)&&(V=pg(dg(C,D,e.canonical,N.footprintTileId.canonical),N),V))break;_.float32[M]=V?A+Fe:A,c=c||V}}}return c}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,rb.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length!==0&&n.instancedDataBuffer&&n.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,n){const o=this.layers[0],l=o.layout.get("model-id").evaluate(n,{},this.canonical);if(!l)return vi(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;g0(l,!1)&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new x0);const c=this.instancesPerModel[l],d=c.instancedDataArray,f=new y0(n,d.length);for(const _ of i)for(const y of _){if(y.x<0||y.x>=Fe||y.y<0||y.y>=Fe)continue;const v=(this.lookupDim-1)/Fe,b=this.lookupDim*(y.y*v|0)+y.x*v|0;if(this.lookup){if(this.lookup[b]!==0)continue;this.lookup[b]=1}this.instanceCount++;const E=d.length;d.resize(E+1),c.instancesEvaluatedElevation.push(0),d.float32[16*E]=y.x,d.float32[16*E+1]=y.y}return f.instancedDataCount=c.instancedDataArray.length-f.instancedDataOffset,f.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(f),this.evaluate(f,{},c,!1)),l}getModelUris(){return this.modelUris}evaluate(e,i,n,o){const l=this.layers[0],c=e.feature,d=this.canonical,f=e.rotation=l.paint.get("model-rotation").evaluate(c,i,d),_=e.scale=l.paint.get("model-scale").evaluate(c,i,d),y=e.translation=l.paint.get("model-translation").evaluate(c,i,d),v=l.paint.get("model-color").evaluate(c,i,d);v.a=l.paint.get("model-color-mix-intensity").evaluate(c,i,d);const b=[];this.maxVerticalOffset10?this.tileToMeter:vd(d,N)),D[C+4]=y[0],D[C+5]=y[1],D[C+6]=y[2]+V,D[C+7]=b[0],D[C+8]=b[1],D[C+9]=b[2],D[C+10]=b[4],D[C+11]=b[5],D[C+12]=b[6],D[C+13]=b[8],D[C+14]=b[9],D[C+15]=b[10],n.instancesEvaluatedElevation[A]=y[2]}}}let v0,b0;se(bm,"ModelBucket",{omit:["layers"]}),se(x0,"PerModelAttributes"),se(y0,"ModelFeature");const Za=64,wc={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function w0(t,e,i,n,o,l,c,d,f,_=!1){const y=i.zoom,v=i.project(n),b=Va(n.lat,y),E=1/b;s.ae.identity(t),s.ae.translate(t,t,[v.x+c[0]*E,v.y+c[1]*E,c[2]]);let M=1,A=1;const C=i.worldSize;if(_){if(i.projection.name==="mercator"){let U=0;i.elevation&&(U=i.elevation.getAtPointOrZero(new nr(v.x/C,v.y/C),0));const H=s.aB.transformMat4([],[v.x,v.y,U,1],i.projMatrix)[3]/i.cameraToCenterDistance;M=H,A=H*Va(i.center.lat,y)}else if(i.projection.name==="globe"){const U=vm(t,i),H=s.ae.multiply([],i.projMatrix,U),X=[0,0,0,1];s.aB.transformMat4(X,X,H);const Q=X[3]/i.cameraToCenterDistance,ae=Co(y),de=i.projection.pixelsPerMeter(n.lat,C)*Va(n.lat,y),ye=i.projection.pixelsPerMeter(i.center.lat,C)*Va(i.center.lat,y);M=Q/rt(de,u_(i.center.lat),ae),A=Q*b/de,M*=ye,A*=ye}}else M=E;s.ae.scale(t,t,[M,M,A]);const D=[...t],V=e.orientation,N=[];if(m0(N,[V[0]+o[0],V[1]+o[1],V[2]+o[2]],l),s.ae.multiply(t,D,N),d&&i.elevation){let U=0;const H=[];if(f&&i.elevation){U=function(ae,de,ye,pe,we){const De=de.elevation;if(!De)return 0;const Te=ci.projectAabbCorners(ye,pe),ke=dr(1,we.lat)*de.worldSize,be=function(st,Qe){const Xe=[0,0,1],ut=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const ft of ut){const ht=st[ft.corners[0]],vt=st[ft.corners[1]],zt=st[ft.corners[2]],It=[vt[0]-ht[0],vt[1]-ht[1],Qe*(vt[2]-ht[2])],Kt=s.$.cross(It,It,[zt[0]-ht[0],zt[1]-ht[1],Qe*(zt[2]-ht[2])]);s.$.normalize(Kt,Kt),ft.dotProductWithUp=s.$.dot(Kt,Xe)}return ut.sort((ft,ht)=>ft.dotProductWithUp-ht.dotProductWithUp),ut[0].corners}(Te,ke),Ie=Te[be[0]],Be=Te[be[1]],Ee=Te[be[2]],Ve=Te[be[3]],Oe=De.getAtPointOrZero(new nr(Ie[0]/de.worldSize,Ie[1]/de.worldSize),0),Re=De.getAtPointOrZero(new nr(Be[0]/de.worldSize,Be[1]/de.worldSize),0),et=De.getAtPointOrZero(new nr(Ee[0]/de.worldSize,Ee[1]/de.worldSize),0),Ke=De.getAtPointOrZero(new nr(Ve[0]/de.worldSize,Ve[1]/de.worldSize),0),Ze=(Oe+Ke)/2,Ne=(Re+et)/2;return Ze>Ne?Re=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function ob(t,e,i){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,K1.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,ib.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,tb.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(t.colorArray.bytesPerElement===12?Q1:eb).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,nb.members,!0)),t.segments=hi.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&lh(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&lh(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&lh(n.normalTexture,e),n.occlusionTexture&&lh(n.occlusionTexture,e,i),n.emissionTexture&&lh(n.emissionTexture,e)}function wm(t,e,i){if(t.meshes)for(const n of t.meshes)ob(n,e,i);if(t.children)for(const n of t.children)wm(n,e,i)}function dp(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)dp(e)}function Tm(t){if(t.meshes)for(const i of t.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const i of t.children)Tm(i)}class sb{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class ab{constructor(){this.tasks={},this.taskQueue=[],xl(["process"],this),this.invoker=new sb(this.process),this.nextId=0}add(e,i){const n=this.nextId++,o=function({type:l,isSymbolTile:c,zoom:d}){return d=d||0,l==="message"?0:l!=="maybePrepare"||c?l!=="parseTile"||c?l==="parseTile"&&c?300-d:l==="maybePrepare"&&c?400-d:500:200-d:100-d}(i);if(o===0){try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:i,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let o=0;o{n&&delete this.callbacks[d],this.target.postMessage({id:d,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(e){const i=e.data,n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type===""){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(i.mustQueue||es()){const o=this.callbacks[n],l=this.scheduler.add(()=>this.processTask(n,i),o&&o.metadata||{type:"message"});l&&(this.cancelCallbacks[n]=l)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type===""){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(ve(i.error)):n(null,ve(i.data)))}else{const n=new Set,o=i.hasCallback?(c,d)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:c?he(c):null,data:he(d,n)},n)}:c=>{},l=ve(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,l,o);else if(this.parent.getWorkerSource){const c=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,c[0],l.source,l.scope)[c[1]](l,o)}else o(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class Tc{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=yl();const n=this.workerPool.acquire(this.id);for(let o=0;o{this.ready=!0})}broadcast(e,i,n){Js(this.actors,(o,l)=>{o.send(e,i,l)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}Tc.Actor=T0;var ch={workerUrl:"",workerClass:null,workerParams:void 0};function lb(){return ch.workerClass!=null?new ch.workerClass:new self.Worker(ch.workerUrl,ch.workerParams)}const Em="mapboxgl_preloaded_worker_pool";class uh{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Em]}numActive(){return Object.keys(this.active).length}}let hh;function pp(){return hh||(hh=new uh),hh}uh.workerCount=2;let fp,Sm,Cn,Ec,Mm,Sc=null;function E0(){return es()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Sm||bt.DRACO_URL}function S0(){if(es()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Ec)return Ec;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Ec=WebAssembly.validate(t)?bt.MESHOPT_SIMD_URL:bt.MESHOPT_URL,Ec}const mp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},cb={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},dh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function M0(t,e,i){const n=i.json.bufferViews.length,o=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:o,byteLength:t.byteLength},i.buffers[o]=t}const Im="KHR_draco_mesh_compression";function ub(t,e){const i=t.extensions&&t.extensions[Im];if(!i)return;const n=new Cn.Decoder,o=P0(e,i.bufferView),l=new Cn.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,l))throw new Error("Failed to decode Draco mesh");const c=e.json.accessors[t.indices],d=mp[c.componentType],f=c.count*d.BYTES_PER_ELEMENT,_=Cn._malloc(f);d===Uint16Array?n.GetTrianglesUInt16Array(l,f,_):n.GetTrianglesUInt32Array(l,f,_),M0(Cn.memory.buffer.slice(_,_+f),c,e),Cn._free(_);for(const y of Object.keys(i.attributes)){const v=n.GetAttributeByUniqueId(l,i.attributes[y]),b=e.json.accessors[t.attributes[y]],E=cb[b.componentType],M=b.count*dh[b.type]*mp[b.componentType].BYTES_PER_ELEMENT,A=Cn._malloc(M);n.GetAttributeDataArrayForAllPoints(l,v,Cn[E],M,A),M0(Cn.memory.buffer.slice(A,A+M),b,e),Cn._free(A)}n.destroy(),l.destroy(),delete t.extensions[Im]}const _p="EXT_meshopt_compression";function hb(t,e){if(!t.extensions||!t.extensions[_p])return;const i=t.extensions[_p],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),o=new Uint8Array(i.count*i.byteStride);Mm.decodeGltfBuffer(o,i.count,i.byteStride,n,i.mode,i.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=o.buffer,delete t.extensions[_p]}const I0=1179937895,A0=new TextDecoder("utf8");function C0(t,e){return new URL(t,e).href}function db(t,e,i,n){return fetch(C0(t.uri,n)).then(o=>o.arrayBuffer()).then(o=>{e.buffers[i]=o})}function P0(t,e){const i=t.json.bufferViews[e];return new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function pb(t,e,i,n){if(t.uri){const o=C0(t.uri,n);return fetch(o).then(l=>l.blob()).then(l=>createImageBitmap(l)).then(l=>{e.images[i]=l})}if(t.bufferView!==void 0){const o=P0(e,t.bufferView),l=new Blob([o],{type:t.mimeType});return createImageBitmap(l).then(c=>{e.images[i]=c})}}function z0(t,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===I0){const y=new Uint32Array(t,e);let v=2;const b=(y[v++]>>2)-3,E=y[v++]>>2;if(v++,n.json=JSON.parse(A0.decode(y.subarray(v,v+E))),v+=E,v{const y=[],v=d&&d.includes(Im),b=d&&d.includes(_p);if(v&&y.push(function(){if(!Cn)return fp||(fp=function(E){let M,A=null;function C(){M=new Uint8Array(A.buffer)}function D(){throw new Error("Unexpected Draco error.")}const V={a:{a:D,d:function(N,U,H){return M.copyWithin(N,U,U+H)},c:function(N){const U=M.length,H=Math.max(N>>>0,Math.ceil(1.2*U)),X=Math.ceil((H-U)/65536);try{return A.grow(X),C(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,V):E.then(N=>N.arrayBuffer()).then(N=>WebAssembly.instantiate(N,V))).then(N=>{const{Rb:U,Qb:H,P:X,T:Q,X:ae,Ja:de,La:ye,Qa:pe,Va:we,Wa:De,eb:Te,jb:ke,f:be,e:Ie,yb:Be,zb:Ee,Ab:Ve,Bb:Oe,Db:Re,Gb:et}=N.instance.exports;A=Ie;const Ke=(()=>{let Ze=0,Ne=0,st=0,Qe=0;return Xe=>{st&&(U(Qe),U(Ze),Ne+=st,st=Ze=0),Ze||(Ne+=128,Ze=H(Ne));const ut=Xe.length+7&-8;let ft=Ze;ut>=Ne&&(st=ut,ft=Qe=H(ut));for(let ht=0;ht{Cn=E,fp=void 0}))}()),b&&y.push(function(){if(Mm)return;const E=function(M){let A;const C=WebAssembly.instantiateStreaming(M,{}).then(N=>{A=N.instance,A.exports.__wasm_call_ctors()}),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},V={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:C,supported:!0,decodeGltfBuffer(N,U,H,X,Q,ae){(function(de,ye,pe,we,De,Te,ke){const be=de.exports.sbrk,Ie=we+3&-4,Be=be(Ie*De),Ee=be(Te.length),Ve=new Uint8Array(de.exports.memory.buffer);Ve.set(Te,Ee);const Oe=ye(Be,we,De,Ee,Te.length);if(Oe===0&&ke&&ke(Be,Ie,De),pe.set(Ve.subarray(Be,Be+we*De)),be(Be-be(0)),Oe!==0)throw new Error(`Malformed buffer data: ${Oe}`)})(A,A.exports[V[Q]],N,U,H,X,A.exports[D[ae]])}}}(fetch(S0()));return E.ready.then(()=>{Mm=E})}()),l)for(let E=0;E{if(v&&c)for(const{primitives:E}of c)for(const M of E)ub(M,n);if(b&&c&&f)for(const E of f)hb(E,n);return n})})}function Wa(t,e){const i=t.json.bufferViews[e.bufferView],n=mp[e.componentType];return new n(t.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==dh[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:dh[e.type]))}function Am(t,e,i,n){const o=mp[e.componentType],l=function(y){switch(y){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),c=t.json.bufferViews[e.bufferView],d=c.byteStride?c.byteStride/o.BYTES_PER_ELEMENT:dh[e.type],f=i.float32,_=f.length/i.capacity;for(let y=0,v=0;y0){for(let C=0;C0){l.texcoordArray=new Cu;const b=e.json.accessors[o.TEXCOORD_0];l.texcoordArray.resize(b.count);const E=Wa(e,b);Am(e,b,l.texcoordArray,E)}if(o._FEATURE_ID_RGBA4444!==void 0){const b=e.json.accessors[o._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Wa(e,b))}o._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Wa(e,e.json.accessors[o._FEATURE_RGBA4444]).buffer));const v=t.material;return l.material=function(b,E){const{emissiveFactor:M=[0,0,0],alphaMode:A="OPAQUE",alphaCutoff:C=.5,normalTexture:D,occlusionTexture:V,emissiveTexture:N,doubleSided:U}=b,{baseColorFactor:H=[1,1,1,1],metallicFactor:X=1,roughnessFactor:Q=1,baseColorTexture:ae,metallicRoughnessTexture:de}=b.pbrMetallicRoughness||{},ye=V?E[V.index]:void 0;if(V&&V.extensions&&V.extensions.KHR_texture_transform&&ye){const pe=V.extensions.KHR_texture_transform;ye.offsetScale=[pe.offset[0],pe.offset[1],pe.scale[0],pe.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Ut(...H),metallicFactor:X,roughnessFactor:Q,baseColorTexture:ae?E[ae.index]:void 0,metallicRoughnessTexture:de?E[de.index]:void 0},doubleSided:U,emissiveFactor:M,alphaMode:A,alphaCutoff:C,normalTexture:D?E[D.index]:void 0,occlusionTexture:ye,emissionTexture:N?E[N.index]:void 0,defined:b.defined===void 0}}(v!==void 0?e.json.materials[v]:{defined:!1},i),l}function D0(t,e,i){const{matrix:n,rotation:o,translation:l,scale:c,mesh:d,extras:f,children:_}=t,y={};if(y.matrix=n||s.ae.fromRotationTranslationScale([],o||[0,0,0,1],l||[0,0,0],c||[1,1,1]),d!==void 0){y.meshes=i[d];const v=y.anchor=[0,0];for(const b of y.meshes){const{min:E,max:M}=b.aabb;v[0]+=E[0]+M[0],v[1]+=E[1]+M[1]}v[0]=Math.floor(v[0]/y.meshes.length/2),v[1]=Math.floor(v[1]/y.meshes.length/2)}if(f&&(f.id&&(y.id=f.id),f.lights&&(y.lights=function(v){if(!v.length)return[];const b=function(D){const V=atob(D),N=new Uint8Array(V.length);for(let U=0;U1&&n[n.length-1].equals(n[0])&&n.pop();let o=0;for(let c=0;c0&&n.reverse();const l=Fu(n.flatMap(c=>[c.x,c.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function gb(t,e){const i=[],n=[];let o=0;const l=[];for(const c of t){o=i.length;const d=c.vertexArray.float32,f=c.indexArray.uint16;for(let _=0;_0&&([n[c+1],n[c+2]]=[n[c+2],n[c+1]])}return{vertices:i,indices:n}}function R0(t){const e=function(f,_){const y=[],v=WebGL2RenderingContext;if(f.json.textures)for(const b of f.json.textures){const E={magFilter:v.LINEAR,minFilter:v.NEAREST,wrapS:v.REPEAT,wrapT:v.REPEAT};b.sampler!==void 0&&Object.assign(E,f.json.samplers[b.sampler]),y.push({image:_[b.source],sampler:E,uploaded:!1})}return y}(t,t.images),i=function(f,_){const y=[];for(const v of f.json.meshes){const b=[];for(const E of v.primitives)b.push(fb(E,f,_));y.push(b)}return y}(t,e),{scenes:n,scene:o,nodes:l}=t.json,c=n?n[o||0].nodes:l,d=[];for(const f of c)d.push(D0(l[f],t,i));return function(f,_,y){const v={},b=new Set;for(let E=0;E0){const E=Array.from(b.values()).sort((M,A)=>M-A);for(let M=E.length-1;M>=0;M--)f.splice(E[M],1)}}(d,c,t.json.nodes),d}function yb(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,i=t.aabb.min[0]-1,n=t.aabb.min[1]-1,o=Za/(t.aabb.max[0]-i+2),l=Za/(t.aabb.max[1]-n+2);for(let c=0;ct.heightmap[_*Za+f]&&(t.heightmap[_*Za+f]=d)}}function xb(t,e){const i={};i.indexArray=new ki,i.indexArray.reserve(4*t.length),i.vertexArray=new gs,i.vertexArray.reserve(10*t.length),i.colorArray=new _s,i.vertexArray.reserve(10*t.length);let n=0;for(const c of t){const d=Math.min(10,Math.max(4,1.3*c.height))*e,f=[-c.normal[1],c.normal[0],0],_=Math.min(.29,.1*c.width/c.depth),y=c.width-2*c.depth*e*(_+.01),v=s.$.scaleAndAdd([],c.pos,f,y/2),b=s.$.scaleAndAdd([],c.pos,f,-y/2),E=[v[0],v[1],v[2]+c.height],M=[b[0],b[1],b[2]+c.height],A=s.$.scaleAndAdd([],c.normal,f,_);s.$.scale(A,A,d);const C=s.$.scaleAndAdd([],c.normal,f,-_);s.$.scale(C,C,d),s.$.add(A,v,A),s.$.add(C,b,C),v[2]+=.1,b[2]+=.1,i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(M[0],M[1],M[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]);const D=y/d/2;i.colorArray.emplaceBack(-D-_,-1,D,.8),i.colorArray.emplaceBack(D+_,-1,D,.8),i.colorArray.emplaceBack(-D,0,D,1.3),i.colorArray.emplaceBack(D,0,D,1.3),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.indexArray.emplaceBack(6+n,4+n,8+n),i.indexArray.emplaceBack(7+n,9+n,5+n),i.indexArray.emplaceBack(0+n,1+n,2+n),i.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const o={defined:!0,emissiveFactor:[0,0,0]},l={};return l.baseColorFactor=Ut.white,o.pbrMetallicRoughness=l,i.material=o,i.aabb=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Cm=new Float32Array(262144),Ha=new Uint8Array(262144);function L0(t){let e=0;if(t.meshes)for(const i of t.meshes)e=Math.max(e,i.aabb.max[2]);if(t.children)for(const i of t.children)e=Math.max(e,L0(i));return e}function k0(t,e,i){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&i.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)k0(n,e,i)}const O0=["","wall","door","roof","window","lamp","logo"];class B0{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:L0(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=ci.applyTransformFast(n.aabb,this.node.matrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class gp{constructor(e,i,n,o,l,c){this.id=i,this.modelTraits|=wc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=wc.HasMapboxMeshFeatures),o&&(this.modelTraits|=wc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=l,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const d of e)this.nodesInfo.push(new B0(d)),k0(d,c.featureIndexArray.length,c.grid),c.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,c.bucketLayerIDs.length-1,0)}updateFootprints(e,i){for(const n of this.getNodesInfo()){const o=n.node;o.footprint&&i.push({footprint:o.footprint,id:e})}}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const o=n.node;this.uploaded?this.updatePbrBuffer(o):wm(o,e,!0)}for(const n of i)dp(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const o=e.transform.projectionOptions,l=e.style.getBrightness(),c=this.brightness!==l;return!!(!this.uploaded||this.dirty||o.name!==this.projection.name||ph(n.paint.get("model-color").value,c)||ph(n.paint.get("model-color-mix-intensity").value,c)||ph(n.paint.get("model-roughness").value,c)||ph(n.paint.get("model-emissive-strength").value,c)||ph(n.paint.get("model-height-based-emissive-strength-multiplier").value,c))&&(this.projection=o,this.brightness=l,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),o=this.id.canonical;for(const l of n){const c=l.feature;l.evaluatedScale=i.paint.get("model-scale").evaluate(c,{},o)}}evaluate(e){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const o=n.feature,l=n.node.meshes&&n.node.meshes[0].featureData,c=n.evaluatedColor[2],d=n.evaluatedRMEA[2],f=this.id.canonical;if(n.hasTranslucentParts=!1,l){for(let _=0;_=X)continue;const Ie=Cm[be],Be=Math.abs(Ie);Be>pe&&(ye=Ie,pe=Be,we=ke,De=Te)}if(pe>.1){const Te=1-(X+.5*Math.abs(we*De))/M;let ke=i._dem.get(ae,Q)+ye*Te;const be=i._dem.get(ae+we,Q+De),Ie=i._dem.get(ae-we,Q-De,!0);(ke-be)*(ke-Ie)>0&&(ke=(be+Ie)/2),Cm[de]=i._dem.set(ae,Q,ke),Ha[de]=X}}}}}d&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Zi.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)dp(i.node),Tm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped()),o=this.getNodesInfo();for(let l=0;ld.footprint===c.footprint)}}getHeightAtTileCoord(e,i){const n=this.getNodesInfo(),o=[],l=[0,0,0],c=s.ae.identity([]);for(let d=0;dy.max[0]||i>y.max[1])continue;if(f.node.hidden===!0)return{height:0,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};s.ae.invert(c,f.node.matrix),l[0]=e,l[1]=i,s.$.transformMat4(l,l,c);const v=(l[0]-_.aabb.min[0])/(_.aabb.max[0]-_.aabb.min[0])*Za|0,b=Math.min(63,(l[1]-_.aabb.min[1])/(_.aabb.max[1]-_.aabb.min[1])*Za|0)*Za+Math.min(63,v),E=_.heightmap[b];if(!(E<0&&f.node.footprint))return f.hiddenByReplacement?void 0:{height:E,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};if(f.node.footprint.grid.query(new je(e,i),new je(e,i),o),o.length>0)return{height:void 0,maxHeight:f.feature.properties.height,hidden:f.hiddenByReplacement,verticalScale:f.evaluatedScale[2]}}}}function ph(t,e){return!t.isLightConstant&&e}function vb(t,e,i,n,o,l,c,d){let f=(61440&e|(61440&e)>>4)>>8,_=(3840&e|(3840&e)>>4)>>4,y=240&e|(240&e)>>4;i[3]>0&&(f=rt(f,255*i[0],i[3]),_=rt(_,255*i[1],i[3]),y=rt(y,255*i[2],i[3]));const v=f<<8|_,b=y<<8|Math.floor(255*n[3]),E=function(X){const Q=Et(X,0,2);return Math.min(Math.round(.5*Q*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],M=Et(o[0],0,1),A=Et(o[1],0,1),C=Et(o[2],0,1),D=Et(o[3],0,1);let V,N,U,H;if(M!==A&&c!==l&&A!==M){const X=c-l;N=1/(X*(A-M)),U=-(l+X*M)/(X*(A-M));const Q=Et(o[4],-1,1);H=Math.pow(10,Q),V=255*C<<8|255*D}else V=65535,N=0,U=1,H=1;if(t.emplaceBack(v,b,E,V,N,U,H),d){const X=d.length;d.clear();for(let Q=0;Q>16&65535,y=l?f>>16&65535:65535&f,v=(15&y)<8?15&y:0,b=t.evaluatedRMEA[v],E=t.evaluatedColor[v],M=t.emissionHeightBasedParams[v];let A;if(d&&v===2&&n.lights&&(A=new gd,A.resize(10*n.lights.length)),vb(c.featureArray,_,E,b,M,c.aabb.min[2],c.aabb.max[2],A),A&&d){d=!1;const C=n.meshes[n.lightMeshIndex];C.featureArray=A,C.featureArray._trim()}}c.featureArray._trim(),o++}}function F0(t,e,i,n){const o=1<U.polygon).flat());const C=E?d:null,[D,V]=function(U,H,X,Q,ae,de,ye,pe,we,De,Te){return U.projection.name==="globe"?function(ke,be,Ie,Be,Ee,Ve,Oe,Re,et,Ke,Ze){const Ne=[],st=[],Qe=ke.projection.upVectorScale(Ze,ke.center.lat,ke.worldSize).metersToTile,Xe=[0,0,0,1],ut=[0,0,0,1],ft=(vt,zt,It,Kt)=>{vt[0]=zt,vt[1]=It,vt[2]=Kt,vt[3]=1},ht=Rg();Ie>0&&(Ie+=ht),Be+=ht;for(const vt of be){const zt=[],It=[];for(const Kt of vt){const ti=Kt.x+Ee.x,mt=Kt.y+Ee.y,qt=ke.projection.projectTilePoint(ti,mt,Ze),Wt=ke.projection.upVector(Ze,Kt.x,Kt.y);let oi=Ie,_i=Be;if(Oe){const Si=Fg(ti,mt,Ie,Be,Oe,Re,et,Ke);oi+=Si.base,_i+=Si.top}Ie!==0?ft(Xe,qt.x+Wt[0]*Qe*oi,qt.y+Wt[1]*Qe*oi,qt.z+Wt[2]*Qe*oi):ft(Xe,qt.x,qt.y,qt.z),ft(ut,qt.x+Wt[0]*Qe*_i,qt.y+Wt[1]*Qe*_i,qt.z+Wt[2]*Qe*_i),s.$.transformMat4(Xe,Xe,Ve),s.$.transformMat4(ut,ut,Ve),zt.push(new ja(Xe[0],Xe[1],Xe[2])),It.push(new ja(ut[0],ut[1],ut[2]))}Ne.push(zt),st.push(It)}return[Ne,st]}(U,H,X,Q,ae,de,ye,pe,we,De,Te):ye?function(ke,be,Ie,Be,Ee,Ve,Oe,Re,et){const Ke=[],Ze=[],Ne=[0,0,0,1];for(const st of ke){const Qe=[],Xe=[];for(const ut of st){const ft=ut.x+Be.x,ht=ut.y+Be.y,vt=Fg(ft,ht,be,Ie,Ve,Oe,Re,et);Ne[0]=ft,Ne[1]=ht,Ne[2]=vt.base,Ne[3]=1,s.aB.transformMat4(Ne,Ne,Ee),Ne[3]=Math.max(Ne[3],1e-5);const zt=new ja(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Ne[0]=ft,Ne[1]=ht,Ne[2]=vt.top,Ne[3]=1,s.aB.transformMat4(Ne,Ne,Ee),Ne[3]=Math.max(Ne[3],1e-5);const It=new ja(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Qe.push(zt),Xe.push(It)}Ke.push(Qe),Ze.push(Xe)}return[Ke,Ze]}(H,X,Q,ae,de,ye,pe,we,De):function(ke,be,Ie,Be,Ee){const Ve=[],Oe=[],Re=Ee[8]*be,et=Ee[9]*be,Ke=Ee[10]*be,Ze=Ee[11]*be,Ne=Ee[8]*Ie,st=Ee[9]*Ie,Qe=Ee[10]*Ie,Xe=Ee[11]*Ie;for(const ut of ke){const ft=[],ht=[];for(const vt of ut){const zt=vt.x+Be.x,It=vt.y+Be.y,Kt=Ee[0]*zt+Ee[4]*It+Ee[12],ti=Ee[1]*zt+Ee[5]*It+Ee[13],mt=Ee[2]*zt+Ee[6]*It+Ee[14],qt=Ee[3]*zt+Ee[7]*It+Ee[15],Wt=Kt+Re,oi=ti+et,_i=mt+Ke,Si=Math.max(qt+Ze,1e-5),gi=Kt+Ne,pi=ti+st,Oi=mt+Qe,Ai=Math.max(qt+Xe,1e-5);ft.push(new ja(Wt/Si,oi/Si,_i/Si)),ht.push(new ja(gi/Ai,pi/Ai,Oi/Ai))}Ve.push(ft),Oe.push(ht)}return[Ve,Oe]}(H,X,Q,ae,de)}(l,n,v,y,_,c,C,b,M,l.center.lat,t.tileID.canonical),N=t.queryGeometry;return function(U,H,X){let Q=1/0;f_(X,H)&&(Q=Bg(X,H[0]));for(let ae=0;ae{if(ah)return ah;const i=Wy();return ah=new X1(i.paint.properties["line-width"].specification),ah.useIntegerZoom=!0,ah})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ud(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e,i){const n=Hg(this);return{config:new Ba(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(t){const e=t,i=Yy(lc("line-width",this,e),lc("line-gap-width",this,e)),n=lc("line-offset",this,e);return i/2+Math.abs(n)+Td(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,o,l){if(t.queryGeometry.isAboveHorizon)return!1;const c=y_(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),d=t.pixelToTileUnitsFactor/2*Yy(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),f=this.paint.get("line-offset").evaluate(e,i);return f&&(n=function(_,y){const v=[],b=new je(0,0);for(let E=0;E<_.length;E++){const M=_[E],A=[];for(let C=0;C=3){for(let M=0;M>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=N0[15&n];if(!l)throw new Error("Unrecognized array type.");const[c]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new Pm(d,c,l,e)}constructor(e,i=64,n=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=N0.indexOf(this.ArrayType),c=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,f=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+c+d+f),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return zm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:d}=this,f=[0,l.length-1,0],_=[];for(;f.length;){const y=f.pop()||0,v=f.pop()||0,b=f.pop()||0;if(v-b<=d){for(let C=b;C<=v;C++){const D=c[2*C],V=c[2*C+1];D>=e&&D<=n&&V>=i&&V<=o&&_.push(l[C])}continue}const E=b+v>>1,M=c[2*E],A=c[2*E+1];M>=e&&M<=n&&A>=i&&A<=o&&_.push(l[E]),(y===0?e<=M:i<=A)&&(f.push(b),f.push(E-1),f.push(1-y)),(y===0?n>=M:o>=A)&&(f.push(E+1),f.push(v),f.push(1-y))}return _}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:c}=this,d=[0,o.length-1,0],f=[],_=n*n;for(;d.length;){const y=d.pop()||0,v=d.pop()||0,b=d.pop()||0;if(v-b<=c){for(let C=b;C<=v;C++)U0(l[2*C],l[2*C+1],e,i)<=_&&f.push(o[C]);continue}const E=b+v>>1,M=l[2*E],A=l[2*E+1];U0(M,A,e,i)<=_&&f.push(o[E]),(y===0?e-n<=M:i-n<=A)&&(d.push(b),d.push(E-1),d.push(1-y)),(y===0?e+n>=M:i+n>=A)&&(d.push(E+1),d.push(v),d.push(1-y))}return f}}function zm(t,e,i,n,o,l){if(o-n<=i)return;const c=n+o>>1;V0(t,e,c,n,o,l),zm(t,e,i,n,c-1,1-l),zm(t,e,i,c+1,o,1-l)}function V0(t,e,i,n,o,l){for(;o>n;){if(o-n>600){const _=o-n+1,y=i-n+1,v=Math.log(_),b=.5*Math.exp(2*v/3),E=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);V0(t,e,i,Math.max(n,Math.floor(i-y*b/_+E)),Math.min(o,Math.floor(i+(_-y)*b/_+E)),l)}const c=e[2*i+l];let d=n,f=o;for(fh(t,e,n,i),e[2*o+l]>c&&fh(t,e,n,o);dc;)f--}e[2*n+l]===c?fh(t,e,n,f):(f++,fh(t,e,f,o)),f<=i&&(n=f+1),i<=f&&(o=f-1)}}function fh(t,e,i,n){Dm(t,i,n),Dm(e,2*i,2*n),Dm(e,2*i+1,2*n+1)}function Dm(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function U0(t,e,i,n){const o=t-i,l=e-n;return o*o+l*l}s.A=Gl,s.B=Aa,s.C=Ut,s.D=Ma,s.E=mo,s.F=cr,s.H=xn,s.I=$a,s.J=S,s.K=x,s.L=function(t){const e=t.value;let i=[];if(!e)return i;const n=jn(e);return n!=="string"?(i=i.concat([new hp(t.key,e,`string expected, "${n}" found`)]),i):(g0(e,!0)||(i=i.concat([new hp(t.key,e,`invalid url "${e}"`)])),i)},s.M=class{constructor(t,e,i,n){this.id=t,this.position=e!=null?new Vt(e[0],e[1]):new Vt(0,0),this.orientation=i??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){if(s.ae.multiply(t.matrix,e,t.matrix),t.meshes)for(const i of t.meshes){const n=ci.applyTransformFast(i.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const i of t.children)this._applyTransformations(i,t.matrix)}computeBoundsAndApplyParent(){const t=s.ae.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,i,n,o,l,c=!1){w0(this.matrix,this,t.transform,this.position,e,i,n,o,l,c)}upload(t){if(!this.uploaded){for(const e of this.nodes)wm(e,t);for(const e of this.nodes)dp(e);this.uploaded=!0}}destroy(){for(const t of this.nodes)Tm(t)}},s.N=me,s.O=Xi,s.P=je,s.Q=Gi,s.R=aa,s.S=df,s.T=sn,s.U=ei,s.V=hp,s.W=Le,s.X=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Qo(t.expression.evaluate(e))}interpolate(t,e,i){return{x:rt(t.x,e.x,i),y:rt(t.y,e.y,i),z:rt(t.z,e.z,i),azimuthal:rt(t.azimuthal,e.azimuthal,i),polar:rt(t.polar,e.polar,i)}}},s.Y=at,s.Z=Z,s._=nr,s.a=Or,s.a$=Rf,s.a0=Uc,s.a1=Ni,s.a2=Co,s.a3=rt,s.a4=Fe,s.a5=ou,s.a6=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([i,n]){const o=Qo([1,i,n]);return{x:o.x,y:o.y,z:o.z}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:rt(t.x,e.x,i),y:rt(t.y,e.y,i),z:rt(t.z,e.z,i)}}},s.a7=zu,s.a8=xd,s.a9=So,s.aA=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},s.aC=function(t,e){const{x:i,y:n}=t.point,o=D_(i,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return s.ae.multiply(o,o,Bf(Yn(e)))},s.aE=fc,s.aF=Xr,s.aG=$d,s.aH=function(t,e,i,n,o){const l=5*e+2;t.float32[l+0]=i,t.float32[l+1]=n,t.float32[l+2]=o},s.aI=tp,s.aJ=Vt,s.aK=Ry,s.aL=l_,s.aM=Lf,s.aN=d0,s.aO=Na,s.aP=C_,s.aQ=Pi,s.aR=function(t,e,i,n,o,l,c,d,f){if(f.name==="globe")return C_(t,e,new Na(i,n,o),!1);const _=Ga({z:i,x:n,y:o},f);return new ci([(l+_.x/_.scale)*e,e*(_.y/_.scale),c],[(l+_.x2/_.scale)*e,e*(_.y2/_.scale),d])},s.aS=function(t,e,i){let n=0;for(let o=0;o<2;++o)t[o]>0&&(n+=(t[o]-0)*(t[o]-0)),e[o]<0&&(n+=(0-e[o])*(0-e[o]));return n},s.aT=Ti,s.aU=Df,s.aV=s_,s.aW=function(t){const e=s.ae.identity(new Float64Array(16));s.ae.multiply(e,t.pixelMatrix,t.globeMatrix);const i=[0,nn,0],n=[0,on,0];return s.$.transformMat4(i,i,e),s.$.transformMat4(n,n,e),[i[0]>0&&i[0]<=t.width&&i[1]>0&&i[1]<=t.height&&!Nf(t,new Vt(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!Nf(t,new Vt(t.center.lat,-90))]},s.aX=function(t,e){const{scale:i}=t.tileTransform,n=i*Fe/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return s.aD.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},s.aY=cp,s.aZ=h0,s.a_=function(t){const e=h0(t,!0);return s.aD.invert([],[e[0],e[1],e[4],e[5]])},s.aa=n_,s.ab=ur,s.ac=At,s.ad=function(t,e,i){const n=Math.sqrt(t*t+e*e+i*i),o=n>0?Math.acos(i/n)*Yo:0;let l=t!==0||e!==0?Math.atan2(-e,-t)*Yo+90:0;return l<0&&(l+=360),[n,l,o]},s.af=vc,s.ag=Mn,s.ah=cm,s.ai=function(t,e){const i={};for(let n=0;nHc&&(t.getActor().send("enforceCacheSizeLimit",Wc),El=0)},s.ao=eu,s.ap=class{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,n){const o=this.entries[t]=this.entries[t]||{callbacks:[]};if(o.result){const[l,c]=o.result;return this.scheduler?this.scheduler.add(()=>{n(l,c)},e):n(l,c),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=i((l,c)=>{o.result=[l,c];for(const d of o.callbacks)this.scheduler?this.scheduler.add(()=>{d(l,c)},e):d(l,c);setTimeout(()=>delete this.entries[t],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(l=>l!==n),o.callbacks.length||(o.cancel(),delete this.entries[t]))}}},s.aq=function(t,e,i){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},o=>{const l=uo(t.request,(c,d,f,_)=>{c?o(c):d&&o(null,{vectorTile:i?void 0:new Zf(new Zu(d)),rawData:d,cacheControl:f,expires:_})});return()=>{l.cancel(),o()}},e)},s.ar=_f,s.as=class extends Eo{constructor(t){super(t),this.current=ax}set(t,e,i){if(this.fetchUniformLocation(t,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.at=gf,s.au=Et,s.av=Jo,s.ax=Un,s.ay=dr,s.az=Vi,s.b=hi,s.b$=mx,s.b0=function(t){const{x:e,y:i}=t.point,{lng:n,lat:o}=t._center;return D_(e,i,t.worldSize,n,o)},s.b1=sr,s.b2=sc,s.b3=vf,s.b4=function(t){const e=Math.round((t+45+360)%360/90)%4;return Ys[e]},s.b5=45,s.b6=Tf,s.b7=vd,s.b8=ci,s.b9=Qo,s.bA=op,s.bB=U_,s.bC=function(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},s.bD=qg,s.bF=z_,s.bG=Eh,s.bH=Th,s.bI=256,s.bJ=function(t,e){const i=[0,0,0],n=Ou(Yn(e.canonical));return s.$.transformMat4(i,i,n),s.$.transformMat4(i,i,t),i},s.bK=t=>({u_camera_to_center_distance:new ur(t),u_extrude_scale:new yf(t),u_device_pixel_ratio:new ur(t),u_matrix:new zu(t),u_inv_rot_matrix:new zu(t),u_merc_center:new So(t),u_tile_id:new _f(t),u_zoom_transition:new ur(t),u_up_dir:new _f(t),u_emissive_strength:new ur(t)}),s.bL=t=>({u_matrix:new zu(t),u_pixels_to_tile_units:new yf(t),u_device_pixel_ratio:new ur(t),u_units_to_pixels:new So(t),u_dash_image:new xd(t),u_gradient_image:new xd(t),u_image_height:new ur(t),u_texsize:new So(t),u_tile_units_to_pixels:new ur(t),u_alpha_discard_threshold:new ur(t),u_trim_offset:new So(t),u_trim_fade_range:new So(t),u_trim_color:new gf(t),u_emissive_strength:new ur(t)}),s.bM=t=>({u_matrix:new zu(t),u_texsize:new So(t),u_pixels_to_tile_units:new yf(t),u_device_pixel_ratio:new ur(t),u_image:new xd(t),u_units_to_pixels:new So(t),u_tile_units_to_pixels:new ur(t),u_alpha_discard_threshold:new ur(t),u_trim_offset:new So(t)}),s.bN=of,s.bO=Pv,s.bP=Ki,s.bQ=Wv,s.bR=Ey,s.bS=em,s.bT=k_,s.bU=(t,e,i,n,o,l)=>{const c=t.transform,d=c.projection.name==="globe";let f;if(l.paint.get("circle-pitch-alignment")==="map")if(d){const y=z_(c.zoom,e.canonical)*c._pixelsPerMercatorPixel;f=Float32Array.from([y,0,0,y])}else f=c.calculatePixelsToTileUnitsMatrix(i);else f=new Float32Array([c.pixelsToGLUnits[0],0,0,c.pixelsToGLUnits[1]]);const _={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(c.projection),u_matrix:t.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Zi.devicePixelRatio,u_extrude_scale:f,u_inv_rot_matrix:Cx,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(d){_.u_inv_rot_matrix=n,_.u_merc_center=o,_.u_tile_id=[e.canonical.x,e.canonical.y,1<{const c=t.transform;return{u_matrix:Wg(t,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:o,u_image:0,u_tile_units_to_pixels:Zg(e,c),u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l}},s.bX=(t,e,i,n,o,l,c)=>{const d=t.transform,f=d.calculatePixelsToTileUnitsMatrix(e);return{u_matrix:Wg(t,e,i,n),u_pixels_to_tile_units:f,u_device_pixel_ratio:l,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:Xg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Zg(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:c,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength")}},s.bY=co,s.bZ=Bu,s.b_=Rg,s.ba=function(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},s.bb=_l,s.bc=function(t,e,i){const n=Co(i.zoom),o=t.style.map._antialias,l=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return n===0&&!o&&!l},s.bd=function(t){const e=t.pixelsPerMeter,i=e/dr(1,t.center.lat),n=s.ae.identity(new Float64Array(16));return s.ae.translate(n,n,[t.point.x,t.point.y,0]),s.ae.scale(n,n,[i,i,e]),Float32Array.from(n)},s.be=Md,s.bf=function(t){const e=Ti-5;t=Et(t,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(At(t))),3);return Math.round(i*(bf.length-1))},s.bg=function(t,e,i,n){const o=e.getNorth(),l=e.getSouth(),c=e.getWest(),d=e.getEast(),f=1<0){const M=180/n;s.bE.multiply(E,E,[M/_+1,0,0,0,M/y+1,0,-.5*M/v,.5*M/b,1])}return E[2]=f,E[5]=t.x,E[8]=t.y,E},s.bh=Ou,s.bi=Yn,s.bj=function(t,e,i){const n=s.ae.identity(new Float64Array(16)),o=(e/(1<{}}},s.bq=ip,s.br=xl,s.bs=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,n=1<1)return e;const o=n.getSource().maxzoom,l=1<{const l=this.getAtTileOffset(t,o.x,o.y),c=n.upVector(t.canonical,o.x,o.y),d=n.upVectorScale(t.canonical,e,i).metersToTile;return s.$.scale(c,c,l*d),c}}getForTilePoints(t,e,i,n){if(this.isUsingMockSource())return!1;const o=hc.create(this,t,n);return!!o&&(e.forEach(l=>{l[2]=this.exaggeration()*o.getElevationAt(l[0],l[1],i)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,o=1<=0?t.slice(0,e):t},s.cY=function(t){return t.indexOf(dd)>=0},s.cZ=function(t){const e=t.indexOf(dd);return e>=0?t.slice(e+1):""},s.c_=function(t){const e=[],i=t.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.ca=gs,s.cb=Oa,s.cc=1,s.cd=th,s.ce=0,s.cf=cf,s.cg=function(t,e,i,n,o){return Et((t-e)/(i-e)*(o-n)+n,n,o)},s.ch=cd,s.ci=Va,s.cj=class{constructor(t,e,i,n){this.context=t,this.format=n,this.size=i,this.texture=t.gl.createTexture();const[o,l,c]=this.size,{gl:d}=t;d.bindTexture(d.TEXTURE_3D,this.texture),t.pixelStoreUnpackFlipY.set(!1),t.pixelStoreUnpack.set(1),t.pixelStoreUnpackPremultiplyAlpha.set(!1);let f=this.format,_=d.UNSIGNED_BYTE;this.format===d.DEPTH_COMPONENT&&(f=d.DEPTH_COMPONENT16,_=d.UNSIGNED_SHORT),this.format===d.R8&&(n=d.RED),this.format===d.R32F&&(_=d.FLOAT,n=d.RED),d.texImage3D(d.TEXTURE_3D,0,f,o,l,c,0,n,_,e.data)}bind(t,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}},s.ck=vm,s.cl=[1,1,1],s.cm=hc,s.cn=wc,s.co=xs,s.cp=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new je(1/0,1/0),max:new je(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t,e=!1){const i=cg(new je(0,0),new je(Fe,Fe),t),n=[];if(e&&!Wf(i,this._globalClipBounds))return n;for(const o of this._activeRegions){if(o.hiddenByOverlap||!Wf(i,o))continue;const l=ov(o.min,o.max,t);n.push({min:l.min,max:l.max,sourceId:this._sourceIds[o.priority],footprint:o.footprint,footprintTileId:o.tileId,order:o.order,clipMask:o.clipMask,clipScope:o.clipScope})}return n}setSources(t){this._setSources(t.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const o=e.cache.getTile(n).buckets[e.layer];o&&o.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(t){const e=t.getFootprints();if(e.length===0)return;const i=t.getOrder(),n=t.getClipMask(),o=t.getClipScope();for(const l of e){if(!l.footprint)continue;const c=cg(l.footprint.min,l.footprint.max,l.id);this._activeRegions.push({min:c.min,max:c.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:l.id,footprint:l.footprint,order:i,clipMask:n,clipScope:o})}this._sourceIds.push(t.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Bd(e.min,i.min)||Bd(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(n,o){const l=(c,d)=>c+d;return n.length-o.length||n.reduce(l,"").localeCompare(o.reduce(l,""))}(e.clipScope,i.clipScope));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0;for(;!t&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];t=i.priority!==n.priority||!lg(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!Xo(i.clipScope,n.clipScope),++e}}if(t){++this._updateTime;for(const i of this._activeRegions)i.order!==Od&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const o=n[i].priority;for(;i1){let i=0,n=e(i);for(;i!==n;){let o=i;const l=i;for(;o!==n;){const c=this._activeRegions[o];c.hiddenByOverlap=!1;for(let d=0;d=0;e--)this._addSource(t[e]);this._computeReplacement()}},s.cq=To,s.cr=np,s.cs=Au,s.ct=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const i=new bn,n=new ki,o=[],l=t+1+2,c=e[0]+1,d=e[0]+1+(1+e.length),f=(_,y,v)=>{let b=_===l-1?_-2:_===0?_:_-1;return b+=v?24575:0,[b,y]};for(let _=0;_t())},s.dE=ch,s.dF=E0,s.dG=function(t){Sm=Zi.resolveURL(t),Sc||(Sc=new Tc(pp(),new mo)),Sc.broadcast("setDracoUrl",Sm)},s.dH=S0,s.dI=function(t){Ec=Zi.resolveURL(t),Sc||(Sc=new Tc(pp(),new mo)),Sc.broadcast("setMeshoptUrl",Ec)},s.dJ=jc,s.dK=se,s.dL=Es,s.dM=Sn,s.dN=Ga,s.dO=ff,s.dP=Yg,s.dQ=ry,s.dR=Ug,s.dS=Qs,s.dT=xy,s.dU=xc,s.dV=function(t,e,i,n,o,l,c,d,f,_,y){t.createArrays(),t.tilePixelRatio=Fe/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const v=t.layers[0].layout,b=t.layers[0]._unevaluatedLayout._values,E={};if(t.textSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new at(D),d),b["text-size"].possiblyEvaluate(new at(V),d)]}if(t.iconSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new at(D),d),b["icon-size"].possiblyEvaluate(new at(V),d)]}E.layoutTextSize=b["text-size"].possiblyEvaluate(new at(f+1),d),E.layoutIconSize=b["icon-size"].possiblyEvaluate(new at(f+1),d),E.textMaxSize=b["text-size"].possiblyEvaluate(new at(18),d);const M=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",A=v.get("text-size");let C=!1;for(const D of t.features)if(D.icon&&D.icon.nameSecondary){C=!0;break}for(const D of t.features){const V=v.get("text-font").evaluate(D,{},d).join(","),N=A.evaluate(D,{},d),U=E.layoutTextSize.evaluate(D,{},d),H=(E.layoutIconSize.evaluate(D,{},d),{horizontal:{},vertical:void 0}),X=D.text;let Q,ae=[0,0];if(X){const pe=X.toString(),we=v.get("text-letter-spacing").evaluate(D,{},d)*Ki,De=v.get("text-line-height").evaluate(D,{},d)*Ki,Te=Ae(pe)?we:0,ke=v.get("text-anchor").evaluate(D,{},d),be=v.get("text-variable-anchor");if(!be){const Oe=v.get("text-radial-offset").evaluate(D,{},d);ae=Oe?Ey(ke,[Oe*Ki,rm]):v.get("text-offset").evaluate(D,{},d).map(Re=>Re*Ki)}let Ie=M?"center":v.get("text-justify").evaluate(D,{},d);const Be=v.get("symbol-placement")==="point",Ee=Be?v.get("text-max-width").evaluate(D,{},d)*Ki:1/0,Ve=Oe=>{t.allowVerticalPlacement&&Me(pe)&&(H.vertical=Qf(X,e,i,o,V,Ee,De,ke,Oe,Te,ae,Xr.vertical,!0,U,N))};if(!M&&be){const Oe=Ie==="auto"?be.map(et=>nm(et)):[Ie];let Re=!1;for(let et=0;et=0||!Me(pe)){const Oe=Qf(X,e,i,o,V,Ee,De,ke,Ie,Te,ae,Xr.horizontal,!1,U,N);Oe&&(H.horizontal[Ie]=Oe)}Ve(Be?"left":Ie)}}let de=!1;if(D.icon&&D.icon.namePrimary){const pe=n[D.icon.namePrimary];pe&&(Q=i1(o[D.icon.namePrimary],D.icon.nameSecondary?o[D.icon.nameSecondary]:void 0,v.get("icon-offset").evaluate(D,{},d),v.get("icon-anchor").evaluate(D,{},d)),de=pe.sdf,t.sdfIcons===void 0?t.sdfIcons=pe.sdf:t.sdfIcons!==pe.sdf&&vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(pe.pixelRatio!==t.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}const ye=My(H.horizontal)||H.vertical;t.iconsInText||(t.iconsInText=!!ye&&ye.iconsInText),(ye||Q)&&c1(t,D,H,Q,n,E,U,0,ae,de,c,d,_,y,C)}l&&t.generateCollisionDebugBuffers(f,t.collisionBoxArray)},s.dW=Ud,s.dX=Dd,s.dY=Zf,s.dZ=Zu,s.d_=Fd,s.da=oc,s.db=bt,s.dc=Nf,s.dd=R_,s.de=function(t){const e=[0,0,0],i=s.ae.identity(new Float64Array(16));return s.ae.multiply(i,t.pixelMatrix,t.globeMatrix),s.$.transformMat4(e,e,i),new je(e[0],e[1])},s.df=el,s.dg=Dn,s.dh=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(i){if(na==null){const n=i.navigator?i.navigator.userAgent:null;na=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return na}(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},s.di=yl,s.dj=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Jc,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.params.push(`sdk=js-${pr}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeModelURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeSourceURL(t,e,i,n){if(!Di(t))return t;const o=Dr(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),i&&o.params.push(`language=${i}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,n){const o=Dr(t);return Di(t)?(o.path=`/styles/v1${o.path}/sprite${e}${i}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${e}${i}`,ho(o))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Di(t))return t;const n=Dr(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||i&&n.authority!=="raster"&&i===512?"@2x":""}${Sl.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${bt.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${bt.RASTERARRAYS_URL_PREFIX}${n.path}`:n.authority==="3dtiles"?n.path=`/${bt.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${bt.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(l){for(const c of l){const d=c.match(/^access_token=(.*)$/);if(d)return d[1]}return null}(n.params)||bt.ACCESS_TOKEN;return bt.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,e){const i=Dr(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${bt.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${bt.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${bt.TILE_URL_VERSION}/`,"")}`;let o=i.params;return e&&(o=o.filter(l=>!l.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,e){const i=!!e&&Di(e),n=[];for(const o of t.tiles||[])Zt(o)?n.push(this.canonicalizeTileURL(o,i)):n.push(o);return n}_makeAPIURL(t,e){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Dr(bt.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const o=t.params.indexOf("secure");o>=0&&t.params.splice(o,1)}if(n.path!=="/"&&(t.path=`${n.path}${t.path}`),!bt.REQUIRE_ACCESS_TOKEN)return ho(t);if(e=e||bt.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter(o=>o.indexOf("access_token")===-1),t.params.push(`access_token=${e||""}`),ho(t)}},s.dk=function(t,e){e?da.add(t):da.delete(t)},s.dl=Sl,s.dm=Ip,s.dn=tu,s.dp=Kc,s.dq=Lh,s.dr=kh,s.ds=function(t){da.delete(t)},s.dt=ha,s.du=rs,s.dv=Js,s.dw=pr,s.dx=function(t,e){Wc=t,Hc=e},s.dy=function(t,e,i=!1){if(Jt===nt||Jt===xt||Jt===Ct)throw new Error("setRTLTextPlugin cannot be called multiple times.");Pt=Zi.resolveURL(t),Jt=nt,ii=e,Tt(),i||Ot()},s.dz=gt,s.e=Zi,s.e0=Ld,s.e1=Rd,s.e2=Xs,s.e3=Jg,s.e4=Jr,s.e5=uo,s.e6=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==I0){const i=new Uint32Array(t,0,7),[,,n,o,l,c]=i;e=i.byteLength+o+l+c+l,(n!==t.byteLength||e>=t.byteLength)&&vi("Invalid b3dm header information.")}return z0(t,e)},s.e7=function(t,e){const i=R0(t);for(const n of i){for(const o of n.meshes)yb(o);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(xb(n.lights,e)))}return i},s.e8=gp,s.e9=T0,s.ea=Mt,s.eb=function(t){oa(),Kr&&Kr.then(e=>{e.keys().then(i=>{for(let n=0;ne.arrayBuffer()).then(e=>z0(e,0,t))},s.m=tm,s.n=class extends hp{},s.o=jn,s.p=w1,s.q=os,s.r=g,s.s=T,s.t=w,s.u=yn,s.v=$,s.w=vi,s.x=Wr,s.y=W,s.z=j}),xp(["./shared"],function(s){function pr(oe){const R=oe?oe.url.toString():void 0;return R?performance.getEntriesByName(R):[]}function Mr(oe){if(typeof oe=="number"||typeof oe=="boolean"||typeof oe=="string"||oe==null)return JSON.stringify(oe);if(Array.isArray(oe)){let F="[";for(const q of oe)F+=`${Mr(q)},`;return`${F}]`}let R="{";for(const F of Object.keys(oe).sort())R+=`${F}:${Mr(oe[F])},`;return`${R}}`}function bt(oe){let R="";for(const F of s.cG)R+=`/${Mr(oe[F])}`;return R}class Zt{constructor(R){this.keyCache={},this._layers={},this._layerConfigs={},R&&this.replace(R)}replace(R,F){this._layerConfigs={},this._layers={},this.update(R,[],F)}update(R,F,q){this._options=q;for(const K of R)this._layerConfigs[K.id]=K,(this._layers[K.id]=s.c$(K,this.scope,null,this._options)).compileFilter(),this.keyCache[K.id]&&delete this.keyCache[K.id];for(const K of F)delete this.keyCache[K],delete this._layerConfigs[K],delete this._layers[K];this.familiesBySource={};const te=function(K,ce){const xe={};for(let ge=0;gethis._layers[qe.id]),xe=ce[0];if(xe.visibility==="none")continue;const le=xe.source||"";let ge=this.familiesBySource[le];ge||(ge=this.familiesBySource[le]={});const ze=xe.sourceLayer||"_geojsonTileLayer";let Pe=ge[ze];Pe||(Pe=ge[ze]=[]),Pe.push(ce)}}}const Di=1*s.dM;class Nr{constructor(R){const F={},q=[];for(const xe in R){const le=R[xe],ge=F[xe]={};for(const ze in le.glyphs){const Pe=le.glyphs[+ze];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const qe=Pe.metrics.localGlyph?Di:1,tt={x:0,y:0,w:Pe.bitmap.width+2*qe,h:Pe.bitmap.height+2*qe};q.push(tt),ge[ze]=tt}}const{w:te,h:K}=s.k(q),ce=new s.dL({width:te||1,height:K||1});for(const xe in R){const le=R[xe];for(const ge in le.glyphs){const ze=le.glyphs[+ge];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Pe=F[xe][ge],qe=ze.metrics.localGlyph?Di:1;s.dL.copy(ze.bitmap,ce,{x:0,y:0},{x:Pe.x+qe,y:Pe.y+qe},ze.bitmap)}}this.image=ce,this.positions=F}}s.dK(Nr,"GlyphAtlas");class zn{constructor(R){this.tileID=new s.aQ(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.tileZoom=R.tileZoom,this.uid=R.uid,this.zoom=R.zoom,this.lut=R.lut,this.canonical=R.tileID.canonical,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.scope=R.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.promoteId=R.promoteId,this.isSymbolTile=R.isSymbolTile,this.tileTransform=s.dN(R.tileID.canonical,R.projection),this.projection=R.projection,this.brightness=R.brightness,this.extraShadowCaster=!!R.extraShadowCaster,this.tessellationStep=R.tessellationStep}parse(R,F,q,te,K){this.status="parsing",this.data=R,this.collisionBoxArray=new s.dO;const ce=new s.dP(Object.keys(R.layers).sort()),xe=new s.dQ(this.tileID,this.promoteId);xe.bucketLayerIDs=[];const le={},ge=new s.dR(256,256),ze={featureIndex:xe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:ge,availableImages:q,brightness:this.brightness},Pe=F.familiesBySource[this.source];for(const Je in Pe){const si=R.layers[Je];if(!si)continue;let Ft=!1,Dt=!1,yi=!1;for(const ji of Pe[Je])ji[0].type==="symbol"?Ft=!0:Dt=!0,ji[0].is3D()&&ji[0].type!=="model"&&(yi=!0);if(this.extraShadowCaster&&!yi||this.isSymbolTile===!0&&!Ft||this.isSymbolTile===!1&&!Dt)continue;si.version===1&&s.w(`Vector tile source "${this.source}" layer "${Je}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const xi=ce.encode(Je),Ri=[];for(let ji=0;ji=tr.maxzoom||tr.visibility!=="none"&&(to(ji,this.zoom,ze.brightness,q),(le[tr.id]=tr.createBucket({index:xe.bucketLayerIDs.length,layers:ji,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:xi,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(Ri,ze,this.tileID.canonical,this.tileTransform),xe.bucketLayerIDs.push(ji.map(ao=>ao.id))))}}let qe,tt,ot,Bt;ge.trim();const yt={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},kt=()=>{if(qe)return this.status="done",K(qe);if(this.extraShadowCaster)this.status="done",K(null,{buckets:s.dJ(le).filter(Je=>!Je.isEmpty()),featureIndex:xe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ze.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(tt&&ot&&Bt){const Je=new Nr(tt),si=new s.dT(ot,Bt,this.lut);for(const Ft in le){const Dt=le[Ft];Dt instanceof s.dU?(to(Dt.layers,this.zoom,ze.brightness,q),s.dV(Dt,tt,Je.positions,ot,si.iconPositions,this.showCollisionBoxes,q,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):Dt.hasPattern&&(Dt instanceof s.dW||Dt instanceof s.dX||Dt instanceof s.c0)&&(to(Dt.layers,this.zoom,ze.brightness,q),Dt.addFeatures(ze,this.tileID.canonical,si.patternPositions,q,this.tileTransform,this.brightness))}this.status="done",K(null,{buckets:s.dJ(le).filter(Ft=>!Ft.isEmpty()),featureIndex:xe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Je.image,lineAtlas:ge,imageAtlas:si,brightness:ze.brightness})}};if(!this.extraShadowCaster){const Je=s.dS(ze.glyphDependencies,Dt=>Object.keys(Dt).map(Number));Object.keys(Je).length?te.send("getGlyphs",{uid:this.uid,stacks:Je,scope:this.scope},(Dt,yi)=>{qe||(qe=Dt,tt=yi,kt())},void 0,!1,yt):tt={};const si=Object.keys(ze.iconDependencies);si.length?te.send("getImages",{icons:si,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Dt,yi)=>{qe||(qe=Dt,ot=yi,kt())},void 0,!1,yt):ot={};const Ft=Object.keys(ze.patternDependencies);Ft.length?te.send("getImages",{icons:Ft,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Dt,yi)=>{qe||(qe=Dt,Bt=yi,kt())},void 0,!1,yt):Bt={}}kt()}}function to(oe,R,F,q){const te=new s.Y(R,{brightness:F});for(const K of oe)K.recalculate(te,q)}class Dn extends s.E{constructor(R,F,q,te,K,ce){super(),this.actor=R,this.layerIndex=F,this.availableImages=q,this.loadVectorData=K||s.aq,this.loading={},this.loaded={},this.deduped=new s.ap(R.scheduler),this.isSpriteLoaded=te,this.scheduler=R.scheduler,this.brightness=ce}loadTile(R,F){const q=R.uid,te=R&&R.request,K=te&&te.collectResourceTiming,ce=this.loading[q]=new zn(R);ce.abort=this.loadVectorData(R,(xe,le)=>{const ge=!this.loading[q];if(delete this.loading[q],ge||xe||!le)return ce.status="done",ge||(this.loaded[q]=ce),F(xe);const ze=le.rawData,Pe={};le.expires&&(Pe.expires=le.expires),le.cacheControl&&(Pe.cacheControl=le.cacheControl),ce.vectorTile=le.vectorTile||new s.dY(new s.dZ(ze));const qe=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,(tt,ot)=>{if(tt||!ot)return F(tt);const Bt={};if(K){const yt=pr(te);yt.length>0&&(Bt.resourceTiming=JSON.parse(JSON.stringify(yt)))}F(null,s.Q({rawTileData:ze.slice(0)},ot,Pe,Bt))})};this.isSpriteLoaded?qe():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(qe,{type:"parseTile",isSymbolTile:R.isSymbolTile,zoom:R.tileZoom}):qe()}),this.loaded=this.loaded||{},this.loaded[q]=ce})}reloadTile(R,F){const q=this.loaded,te=R.uid;if(q&&q[te]){const K=q[te];K.showCollisionBoxes=R.showCollisionBoxes,K.projection=R.projection,K.brightness=R.brightness,K.tileTransform=s.dN(R.tileID.canonical,R.projection),K.extraShadowCaster=R.extraShadowCaster,K.lut=R.lut;const ce=(xe,le)=>{const ge=K.reloadCallback;ge&&(delete K.reloadCallback,K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,ge)),F(xe,le)};K.status==="parsing"?K.reloadCallback=ce:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,ce):ce())}else F(null,void 0)}abortTile(R,F){const q=R.uid,te=this.loading[q];te&&(te.abort&&te.abort(),delete this.loading[q]),F()}removeTile(R,F){const q=this.loaded,te=R.uid;q&&q[te]&&delete q[te],F()}}class el{loadTile(R,F){const{uid:q,encoding:te,rawImageData:K,padding:ce}=R,xe=ImageBitmap&&K instanceof ImageBitmap?this.getImageData(K,ce):K;F(null,new s.d_(q,xe,te,ce<1))}getImageData(R,F){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(R.width,R.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=R.width,this.offscreenCanvas.height=R.height,this.offscreenCanvasContext.drawImage(R,0,0,R.width,R.height);const q=this.offscreenCanvasContext.getImageData(-F,-F,R.width+2*F,R.height+2*F);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),q}}s.d$.setPbf(s.dZ);class Os{decodeRasterArray({task:R,buffer:F},q){s.d$.performDecoding(F,R).then(te=>{q(null,te)},te=>{q(te)})}}const Jr=s.e0.prototype.toGeoJSON;let di=class{constructor(oe){this._feature=oe,this.extent=s.a4,this.type=oe.type,this.properties=oe.tags,"id"in oe&&!isNaN(oe.id)&&(this.id=parseInt(oe.id,10))}loadGeometry(){if(this._feature.type===1){const oe=[];for(const R of this._feature.geometry)oe.push([new s.P(R[0],R[1])]);return oe}{const oe=[];for(const R of this._feature.geometry){const F=[];for(const q of R)F.push(new s.P(q[0],q[1]));oe.push(F)}return oe}}toGeoJSON(oe,R,F){return Jr.call(this,oe,R,F)}},fi=class{constructor(oe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=s.a4,this.length=oe.length,this._features=oe}feature(oe){return new di(this._features[oe])}};const Rn=64/4096,Do=128;class Ac{constructor(){this.features=new Map}clear(){this.features.clear()}load(R=[],F){for(const q of R){const te=q.id;if(te==null)continue;let K=this.features.get(te);K&&this.updateCache(K,F),q.geometry?(K=ni(q),this.updateCache(K,F),this.features.set(te,K)):this.features.delete(te),this.updateCache(K,F)}}updateCache(R,F){for(const{canonical:q,uid:te}of Object.values(F)){const{z:K,x:ce,y:xe}=q;tl(R,Math.pow(2,K),ce,xe)&&delete F[te]}}getTile(R,F,q){const te=Math.pow(2,R),K=[];for(const ce of this.features.values())tl(ce,te,F,q)&&K.push(il(ce,te,F,q));return{features:K}}getFeatures(){return[...this.features.values()]}}function tl({minX:oe,minY:R,maxX:F,maxY:q},te,K,ce){return oe<(K+1+Rn)/te&&R<(ce+1+Rn)/te&&F>(K-Rn)/te&&q>(ce-Rn)/te}function ni(oe){const{id:R,geometry:F,properties:q}=oe;if(!F)return;if(F.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:te,coordinates:K}=F,ce={id:R,type:1,geometry:[],tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},xe=ce.geometry;if(te==="Point")Yt(K,xe,ce);else if(te==="MultiPoint")for(const le of K)Yt(le,xe,ce);else if(te==="LineString")ce.type=2,Vr(K,xe,ce);else if(te==="MultiLineString")ce.type=2,Ro(K,xe,ce);else if(te==="Polygon")ce.type=3,Ro(K,xe,ce,!0);else{if(te!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const le of K)Ro(le,xe,ce,!0)}return ce}function Yt([oe,R],F,q){const te=s.ak(oe);let K=s.al(R);K=K<0?0:K>1?1:K,F.push(te,K),q.minX=Math.min(q.minX,te),q.minY=Math.min(q.minY,K),q.maxX=Math.max(q.maxX,te),q.maxY=Math.max(q.maxY,K)}function Vr(oe,R,F,q=!1,te=!1){const K=[];for(const ce of oe)Yt(ce,K,F);R.push(K),q&&function(ce,xe){let le=0;for(let ge=0,ze=ce.length,Pe=ze-2;ge0===xe)for(let ge=0,ze=ce.length;ge=ce&&Pe>=ce||(ge>=ce?(ze+=Math.round(ot*((ce-ge)/tt)),ge=ce):Pe>=ce&&(qe=ze+Math.round(ot*((ce-ge)/tt)),Pe=ce),ze>=ce&&qe>=ce||(ze>=ce?(ge+=Math.round(tt*((ce-ze)/ot)),ze=ce):qe>=ce&&(Pe=ge+Math.round(tt*((ce-ze)/ot)),qe=ce),xe&&ge===xe[xe.length-1][0]&&ze===xe[xe.length-1][1]||(xe=[[ge,ze]],te.push(xe)),xe.push([Pe,qe])))))}}var Qt={exports:{}},Bs=s.e2,Ir=s.e1.VectorTileFeature,nl=Fs;function Fs(oe,R){this.options=R||{},this.features=oe,this.length=oe.length}function io(oe,R){this.id=typeof oe.id=="number"?oe.id:void 0,this.type=oe.type,this.rawGeometry=oe.type===1?[oe.geometry]:oe.geometry,this.properties=oe.tags,this.extent=R||4096}Fs.prototype.feature=function(oe){return new io(this.features[oe],this.options.extent)},io.prototype.loadGeometry=function(){var oe=this.rawGeometry;this.geometry=[];for(var R=0;R>31}function ai(oe,R){for(var F=oe.loadGeometry(),q=oe.type,te=0,K=0,ce=F.length,xe=0;xeoe},Ns=Math.fround||(Oo=new Float32Array(1),oe=>(Oo[0]=+oe,Oo[0]));var Oo;const Ur=3,jr=5,Vs=6;class lt{constructor(R){this.options=Object.assign(Object.create(ul),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:F,minZoom:q,maxZoom:te}=this.options;F&&console.time("total time");const K=`prepare ${R.length} points`;F&&console.time(K),this.points=R;const ce=[];for(let le=0;le=q;le--){const ge=+Date.now();xe=this.trees[le]=this._createTree(this._cluster(xe,le)),F&&console.log("z%d: %d clusters in %dms",le,xe.numItems,+Date.now()-ge)}return F&&console.timeEnd("total time"),this}getClusters(R,F){let q=((R[0]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,R[1]));let K=R[2]===180?180:((R[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)q=-180,K=180;else if(q>K){const Pe=this.getClusters([q,te,180,ce],F),qe=this.getClusters([-180,te,K,ce],F);return Pe.concat(qe)}const xe=this.trees[this._limitZoom(F)],le=xe.range(lr(q),pn(ce),lr(K),pn(te)),ge=xe.data,ze=[];for(const Pe of le){const qe=this.stride*Pe;ze.push(ge[qe+jr]>1?pt(ge,qe,this.clusterProps):this.points[ge[qe+Ur]])}return ze}getChildren(R){const F=this._getOriginId(R),q=this._getOriginZoom(R),te="No cluster with the specified id.",K=this.trees[q];if(!K)throw new Error(te);const ce=K.data;if(F*this.stride>=ce.length)throw new Error(te);const xe=this.options.radius/(this.options.extent*Math.pow(2,q-1)),le=K.within(ce[F*this.stride],ce[F*this.stride+1],xe),ge=[];for(const ze of le){const Pe=ze*this.stride;ce[Pe+4]===R&&ge.push(ce[Pe+jr]>1?pt(ce,Pe,this.clusterProps):this.points[ce[Pe+Ur]])}if(ge.length===0)throw new Error(te);return ge}getLeaves(R,F,q){const te=[];return this._appendLeaves(te,R,F=F||10,q=q||0,0),te}getTile(R,F,q){const te=this.trees[this._limitZoom(R)],K=Math.pow(2,R),{extent:ce,radius:xe}=this.options,le=xe/ce,ge=(q-le)/K,ze=(q+1+le)/K,Pe={features:[]};return this._addTileFeatures(te.range((F-le)/K,ge,(F+1+le)/K,ze),te.data,F,q,K,Pe),F===0&&this._addTileFeatures(te.range(1-le/K,ge,1,ze),te.data,K,q,K,Pe),F===K-1&&this._addTileFeatures(te.range(0,ge,le/K,ze),te.data,-1,q,K,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(R){let F=this._getOriginZoom(R)-1;for(;F<=this.options.maxZoom;){const q=this.getChildren(R);if(F++,q.length!==1)break;R=q[0].properties.cluster_id}return F}_appendLeaves(R,F,q,te,K){const ce=this.getChildren(F);for(const xe of ce){const le=xe.properties;if(le&&le.cluster?K+le.point_count<=te?K+=le.point_count:K=this._appendLeaves(R,le.cluster_id,q,te,K):K1;let ze,Pe,qe;if(ge)ze=Bo(F,le,this.clusterProps),Pe=F[le],qe=F[le+1];else{const Bt=this.points[F[le+Ur]];ze=Bt.properties;const[yt,kt]=Bt.geometry.coordinates;Pe=lr(yt),qe=pn(kt)}const tt={type:1,geometry:[[Math.round(this.options.extent*(Pe*K-q)),Math.round(this.options.extent*(qe*K-te))]],tags:ze};let ot;ot=ge||this.options.generateId?F[le+Ur]:this.points[F[le+Ur]].id,ot!==void 0&&(tt.id=ot),ce.features.push(tt)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,F){const{radius:q,extent:te,reduce:K,minPoints:ce}=this.options,xe=q/(te*Math.pow(2,F)),le=R.data,ge=[],ze=this.stride;for(let Pe=0;PeF&&(yt+=le[Je+jr])}if(yt>Bt&&yt>=ce){let kt,Je=qe*Bt,si=tt*Bt,Ft=-1;const Dt=(Pe/ze<<5)+(F+1)+this.points.length;for(const yi of ot){const xi=yi*ze;if(le[xi+2]<=F)continue;le[xi+2]=F;const Ri=le[xi+jr];Je+=le[xi]*Ri,si+=le[xi+1]*Ri,le[xi+4]=Dt,K&&(kt||(kt=this._map(le,Pe,!0),Ft=this.clusterProps.length,this.clusterProps.push(kt)),K(kt,this._map(le,xi)))}le[Pe+4]=Dt,ge.push(Je/yt,si/yt,1/0,Dt,-1,yt),K&&ge.push(Ft)}else{for(let kt=0;kt1)for(const kt of ot){const Je=kt*ze;if(!(le[Je+2]<=F)){le[Je+2]=F;for(let si=0;si>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,F,q){if(R[F+jr]>1){const ce=this.clusterProps[R[F+Vs]];return q?Object.assign({},ce):ce}const te=this.points[R[F+Ur]].properties,K=this.options.map(te);return q&&K===te?Object.assign({},K):K}}function pt(oe,R,F){return{type:"Feature",id:oe[R+Ur],properties:Bo(oe,R,F),geometry:{type:"Point",coordinates:[(q=oe[R],360*(q-.5)),hl(oe[R+1])]}};var q}function Bo(oe,R,F){const q=oe[R+jr],te=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q,K=oe[R+Vs],ce=K===-1?{}:Object.assign({},F[K]);return Object.assign(ce,{cluster:!0,cluster_id:oe[R+Ur],point_count:q,point_count_abbreviated:te})}function lr(oe){return oe/360+.5}function pn(oe){const R=Math.sin(oe*Math.PI/180),F=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return F<0?0:F>1?1:F}function hl(oe){const R=(180-360*oe)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function ro(oe,R,F,q){let te=q;const K=R+(F-R>>1);let ce,xe=F-R;const le=oe[R],ge=oe[R+1],ze=oe[F],Pe=oe[F+1];for(let qe=R+3;qete)ce=qe,te=tt;else if(tt===te){const ot=Math.abs(qe-K);otq&&(ce-R>3&&ro(oe,R,ce,q),oe[ce+2]=te,F-ce>3&&ro(oe,ce,F,q))}function dl(oe,R,F,q,te,K){let ce=te-F,xe=K-q;if(ce!==0||xe!==0){const le=((oe-F)*ce+(R-q)*xe)/(ce*ce+xe*xe);le>1?(F=te,q=K):le>0&&(F+=ce*le,q+=xe*le)}return ce=oe-F,xe=R-q,ce*ce+xe*xe}function Ln(oe,R,F,q){const te={id:oe??null,type:R,geometry:F,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(R==="Point"||R==="MultiPoint"||R==="LineString")kn(te,F);else if(R==="Polygon")kn(te,F[0]);else if(R==="MultiLineString")for(const K of F)kn(te,K);else if(R==="MultiPolygon")for(const K of F)kn(te,K[0]);return te}function kn(oe,R){for(let F=0;F0&&(ce+=q?(te*ze-ge*K)/2:Math.sqrt(Math.pow(ge-te,2)+Math.pow(ze-K,2))),te=ge,K=ze}const xe=R.length-3;R[2]=1,ro(R,0,xe,F),R[xe+2]=1,R.size=Math.abs(ce),R.start=0,R.end=R.size}function Vo(oe,R,F,q){for(let te=0;te1?1:F}function ct(oe,R,F,q,te,K,ce,xe){if(q/=R,K>=(F/=R)&&ce=q)return null;const le=[];for(const ge of oe){const ze=ge.geometry;let Pe=ge.type;const qe=te===0?ge.minX:ge.minY,tt=te===0?ge.maxX:ge.maxY;if(qe>=F&&tt=q)continue;let ot=[];if(Pe==="Point"||Pe==="MultiPoint")Uo(ze,ot,F,q,te);else if(Pe==="LineString")er(ze,ot,F,q,te,!1,xe.lineMetrics);else if(Pe==="MultiLineString")no(ze,ot,F,q,te,!1);else if(Pe==="Polygon")no(ze,ot,F,q,te,!0);else if(Pe==="MultiPolygon")for(const Bt of ze){const yt=[];no(Bt,yt,F,q,te,!0),yt.length&&ot.push(yt)}if(ot.length){if(xe.lineMetrics&&Pe==="LineString"){for(const Bt of ot)le.push(Ln(ge.id,Pe,Bt,ge.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(ot.length===1?(Pe="LineString",ot=ot[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=ot.length===3?"Point":"MultiPoint"),le.push(Ln(ge.id,Pe,ot,ge.tags))}}return le.length?le:null}function Uo(oe,R,F,q,te){for(let K=0;K=F&&ce<=q&&Cr(R,oe[K],oe[K+1],oe[K+2])}}function er(oe,R,F,q,te,K,ce){let xe=Gr(oe);const le=te===0?jo:js;let ge,ze,Pe=oe.start;for(let yt=0;ytF&&(ze=le(xe,kt,Je,Ft,Dt,F),ce&&(xe.start=Pe+ge*ze)):yi>q?xi=F&&(ze=le(xe,kt,Je,Ft,Dt,F),Ri=!0),xi>q&&yi<=q&&(ze=le(xe,kt,Je,Ft,Dt,q),Ri=!0),!K&&Ri&&(ce&&(xe.end=Pe+ge*ze),R.push(xe),xe=Gr(oe)),ce&&(Pe+=ge)}let qe=oe.length-3;const tt=oe[qe],ot=oe[qe+1],Bt=te===0?tt:ot;Bt>=F&&Bt<=q&&Cr(xe,tt,ot,oe[qe+2]),qe=xe.length-3,K&&qe>=3&&(xe[qe]!==xe[0]||xe[qe+1]!==xe[1])&&Cr(xe,xe[0],xe[1],xe[2]),xe.length&&R.push(xe)}function Gr(oe){const R=[];return R.size=oe.size,R.start=oe.start,R.end=oe.end,R}function no(oe,R,F,q,te,K){for(const ce of oe)er(ce,R,F,q,te,K,!1)}function Cr(oe,R,F,q){oe.push(R,F,q)}function jo(oe,R,F,q,te,K){const ce=(K-R)/(q-R);return Cr(oe,K,F+(te-F)*ce,1),ce}function js(oe,R,F,q,te,K){const ce=(K-F)/(te-F);return Cr(oe,R+(q-R)*ce,K,1),ce}function Go(oe,R){const F=[];for(let q=0;q0&&R.size<(te?ce:q))return void(F.numPoints+=R.length/3);const xe=[];for(let le=0;lece)&&(F.numSimplified++,xe.push(R[le],R[le+1])),F.numPoints++;te&&function(le,ge){let ze=0;for(let Pe=0,qe=le.length,tt=qe-2;Pe0===ge)for(let Pe=0,qe=le.length;Pe24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let te=function(K,ce){const xe=[];if(K.type==="FeatureCollection")for(let le=0;le1&&console.time("creation"),tt=this.tiles[qe]=On(R,F,q,te,ge),this.tileCoords.push({z:F,x:q,y:te}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,q,te,tt.numFeatures,tt.numPoints,tt.numSimplified),console.timeEnd("creation"));const Ri=`z${F}`;this.stats[Ri]=(this.stats[Ri]||0)+1,this.total++}if(tt.source=R,K==null){if(F===ge.indexMaxZoom||tt.numPoints<=ge.indexMaxPoints)continue}else{if(F===ge.maxZoom||F===K)continue;if(K!=null){const Ri=K-F;if(q!==ce>>Ri||te!==xe>>Ri)continue}}if(tt.source=null,R.length===0)continue;ze>1&&console.time("clipping");const ot=.5*ge.buffer/ge.extent,Bt=.5-ot,yt=.5+ot,kt=1+ot;let Je=null,si=null,Ft=null,Dt=null,yi=ct(R,Pe,q-ot,q+yt,0,tt.minX,tt.maxX,ge),xi=ct(R,Pe,q+Bt,q+kt,0,tt.minX,tt.maxX,ge);R=null,yi&&(Je=ct(yi,Pe,te-ot,te+yt,1,tt.minY,tt.maxY,ge),si=ct(yi,Pe,te+Bt,te+kt,1,tt.minY,tt.maxY,ge),yi=null),xi&&(Ft=ct(xi,Pe,te-ot,te+yt,1,tt.minY,tt.maxY,ge),Dt=ct(xi,Pe,te+Bt,te+kt,1,tt.minY,tt.maxY,ge),xi=null),ze>1&&console.timeEnd("clipping"),le.push(Je||[],F+1,2*q,2*te),le.push(si||[],F+1,2*q,2*te+1),le.push(Ft||[],F+1,2*q+1,2*te),le.push(Dt||[],F+1,2*q+1,2*te+1)}}getTile(R,F,q){R=+R,F=+F,q=+q;const te=this.options,{extent:K,debug:ce}=te;if(R<0||R>24)return null;const xe=1<1&&console.log("drilling down to z%d-%d-%d",R,F,q);let ge,ze=R,Pe=F,qe=q;for(;!ge&&ze>0;)ze--,Pe>>=1,qe>>=1,ge=this.tiles[Bi(ze,Pe,qe)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",ze,Pe,qe),console.time("drilling down")),this.splitTile(ge.source,ze,Pe,qe,R,F,q),ce>1&&console.timeEnd("drilling down"),this.tiles[le]?$o(this.tiles[le],K):null):null}}function Bi(oe,R,F){return 32*((1<{if(K||!ce)return F(K);if(typeof ce!="object")return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`));{try{if(R.filter){const le=s.z(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(le.result==="error")throw new Error(le.value.map(ge=>`${ge.key}: ${ge.message}`).join(", "));ce.features=ce.features.filter(ge=>le.value.evaluate({zoom:0},ge))}R.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),R.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),R.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=R.cluster?new lt(function({superclusterOptions:le,clusterProperties:ge}){if(!ge||!le)return le;const ze={},Pe={},qe={accumulated:null,zoom:0},tt={properties:null},ot=Object.keys(ge);for(const Bt of ot){const[yt,kt]=ge[Bt],Je=s.z(kt),si=s.z(typeof yt=="string"?[yt,["accumulated"],["get",Bt]]:yt);ze[Bt]=Je.value,Pe[Bt]=si.value}return le.map=Bt=>{tt.properties=Bt;const yt={};for(const kt of ot)yt[kt]=ze[kt].evaluate(qe,tt);return yt},le.reduce=(Bt,yt)=>{tt.properties=yt;for(const kt of ot)qe.accumulated=Bt[kt],Bt[kt]=Pe[kt].evaluate(qe,tt)},le}(R)).load(ce.features):R.dynamic?this._dynamicIndex:function(le,ge){return new zr(le,ge)}(ce,R.geojsonVtOptions)}catch(le){return F(le)}const xe={};if(te){const le=pr(q);le&&(xe.resourceTiming={},xe.resourceTiming[R.source]=JSON.parse(JSON.stringify(le)))}F(null,xe)}})}reloadTile(R,F){const q=this.loaded;return q&&q[R.uid]?R.partial?F(null,void 0):super.reloadTile(R,F):this.loadTile(R,F)}loadGeoJSON(R,F){if(R.request)s.h(R.request,F);else{if(typeof R.data!="string")return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`));try{return F(null,JSON.parse(R.data))}catch{return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(R,F){try{F(null,this._geoJSONIndex.getClusterExpansionZoom(R.clusterId))}catch(q){F(q)}}getClusterChildren(R,F){try{F(null,this._geoJSONIndex.getChildren(R.clusterId))}catch(q){F(q)}}getClusterLeaves(R,F){try{F(null,this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset))}catch(q){F(q)}}}class Wo{constructor(R,F){this.tileID=new s.aQ(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.tileZoom=R.tileZoom,this.uid=R.uid,this.zoom=R.zoom,this.canonical=R.tileID.canonical,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=R.projection,this.brightness=F}parse(R,F,q,te){this.status="parsing";const K=new s.aQ(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),ce={},xe=F.familiesBySource[q.source],le=new s.dQ(K,q.promoteId);return le.bucketLayerIDs=[],le.is3DTile=!0,s.e6(R).then(ge=>{if(!ge)return te(new Error("Could not parse tile"));const ze=s.e7(ge,1/s.b7(q.tileID.canonical)),Pe=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,qe=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),tt=new s.Y(this.zoom,{brightness:this.brightness});for(const ot in xe)for(const Bt of xe[ot]){const yt=Bt[0];le.bucketLayerIDs.push(Bt.map(Je=>Je.id)),yt.recalculate(tt,[]);const kt=new s.e8(ze,K,Pe,qe,this.brightness,le);Pe||(kt.needsUpload=!0),ce[yt.fqid]=kt,kt.evaluate(yt)}this.status="done",te(null,{buckets:ce,featureIndex:le})}).catch(ge=>te(new Error(ge.message)))}}class Mi{constructor(R,F,q,te,K,ce){this.actor=R,this.layerIndex=F,this.brightness=ce,this.loading={},this.loaded={}}loadTile(R,F){const q=R.uid,te=this.loading[q]=new Wo(R,this.brightness);s.e5(R.request,(K,ce)=>{const xe=!this.loading[q];return delete this.loading[q],xe||K?(te.status="done",xe||(this.loaded[q]=te),F(K)):ce&&ce.byteLength!==0?void te.parse(ce,this.layerIndex,R,(le,ge)=>{te.status="done",this.loaded=this.loaded||{},this.loaded[q]=te,le||!ge?F(le):F(null,ge)}):(te.status="done",this.loaded[q]=te,F())})}reloadTile(R,F){const q=this.loaded,te=R.uid;if(q&&q[te]){const K=q[te];K.projection=R.projection,K.brightness=R.brightness;const ce=(xe,le)=>{K.reloadCallback&&(delete K.reloadCallback,this.loadTile(R,F)),F(xe,le)};K.status==="parsing"?K.reloadCallback=ce:K.status==="done"&&this.loadTile(R,F)}}abortTile(R,F){const q=R.uid;this.loading[q]&&delete this.loading[q],F()}removeTile(R,F){const q=this.loaded,te=R.uid;q&&q[te]&&delete q[te],F()}}class $s{constructor(R){this.self=R,this.actor=new s.e9(R,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=s.aK({name:"mercator"}),this.workerSourceTypes={vector:Dn,geojson:so,"batched-model":Mi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(F,q)=>{if(this.workerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.workerSourceTypes[F]=q},this.self.registerRTLTextPlugin=F=>{if(s.ea.isParsed())throw new Error("RTL text plugin already registered.");s.ea.applyArabicShaping=F.applyArabicShaping,s.ea.processBidirectionalText=F.processBidirectionalText,s.ea.processStyledBidirectionalText=F.processStyledBidirectionalText}}clearCaches(R,F,q){delete this.layerIndexes[R],delete this.availableImages[R],delete this.workerSources[R],delete this.demWorkerSources[R],delete this.rasterArrayWorkerSource,q()}checkIfReady(R,F,q){q()}setReferrer(R,F){this.referrer=F}spriteLoaded(R,{scope:F,isLoaded:q}){if(this.isSpriteLoaded[R]||(this.isSpriteLoaded[R]={}),this.isSpriteLoaded[R][F]=q,this.workerSources[R]&&this.workerSources[R][F])for(const te in this.workerSources[R][F]){const K=this.workerSources[R][F][te];for(const ce in K){const xe=K[ce];xe instanceof Dn&&(xe.isSpriteLoaded=q,xe.fire(new s.g("isSpriteLoaded")))}}}setImages(R,{scope:F,images:q},te){if(this.availableImages[R]||(this.availableImages[R]={}),this.availableImages[R][F]=q,this.workerSources[R]&&this.workerSources[R][F]){for(const K in this.workerSources[R][F]){const ce=this.workerSources[R][F][K];for(const xe in ce)ce[xe].availableImages=q}te()}else te()}setProjection(R,F){this.projections[R]=s.aK(F)}setBrightness(R,F,q){this.brightness=F,q()}setLayers(R,F,q){this.getLayerIndex(R,F.scope).replace(F.layers,F.options),q()}updateLayers(R,F,q){this.getLayerIndex(R,F.scope).update(F.layers,F.removedIds,F.options),q()}loadTile(R,F,q){F.projection=this.projections[R]||this.defaultProjection,this.getWorkerSource(R,F.type,F.source,F.scope).loadTile(F,q)}loadDEMTile(R,F,q){this.getDEMWorkerSource(R,F.source,F.scope).loadTile(F,q)}decodeRasterArray(R,F,q){this.getRasterArrayWorkerSource().decodeRasterArray(F,q)}reloadTile(R,F,q){F.projection=this.projections[R]||this.defaultProjection,this.getWorkerSource(R,F.type,F.source,F.scope).reloadTile(F,q)}abortTile(R,F,q){this.getWorkerSource(R,F.type,F.source,F.scope).abortTile(F,q)}removeTile(R,F,q){this.getWorkerSource(R,F.type,F.source,F.scope).removeTile(F,q)}removeSource(R,F,q){if(!(this.workerSources[R]&&this.workerSources[R][F.scope]&&this.workerSources[R][F.scope][F.type]&&this.workerSources[R][F.scope][F.type][F.source]))return;const te=this.workerSources[R][F.scope][F.type][F.source];delete this.workerSources[R][F.scope][F.type][F.source],te.removeSource!==void 0?te.removeSource(F,q):q()}loadWorkerSource(R,F,q){try{this.self.importScripts(F.url),q()}catch(te){q(te.toString())}}syncRTLPluginState(R,F,q){try{s.ea.setState(F);const te=s.ea.getPluginURL();if(s.ea.isLoaded()&&!s.ea.isParsed()&&te!=null){this.self.importScripts(te);const K=s.ea.isParsed();q(K?void 0:new Error(`RTL Text Plugin failed to import scripts from ${te}`),K)}}catch(te){q(te.toString())}}setDracoUrl(R,F){this.dracoUrl=F}getAvailableImages(R,F){this.availableImages[R]||(this.availableImages[R]={});let q=this.availableImages[R][F];return q||(q=[]),q}getLayerIndex(R,F){this.layerIndexes[R]||(this.layerIndexes[R]={});let q=this.layerIndexes[R][F];return q||(q=this.layerIndexes[R][F]=new Zt,q.scope=F),q}getWorkerSource(R,F,q,te){return this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][te]||(this.workerSources[R][te]={}),this.workerSources[R][te][F]||(this.workerSources[R][te][F]={}),this.isSpriteLoaded[R]||(this.isSpriteLoaded[R]={}),this.workerSources[R][te][F][q]||(this.workerSources[R][te][F][q]=new this.workerSourceTypes[F]({send:(K,ce,xe,le,ge,ze)=>{this.actor.send(K,ce,xe,R,ge,ze)},scheduler:this.actor.scheduler},this.getLayerIndex(R,te),this.getAvailableImages(R,te),this.isSpriteLoaded[R][te],void 0,this.brightness)),this.workerSources[R][te][F][q]}getDEMWorkerSource(R,F,q){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][q]||(this.demWorkerSources[R][q]={}),this.demWorkerSources[R][q][F]||(this.demWorkerSources[R][q][F]=new el),this.demWorkerSources[R][q][F]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new Os),this.rasterArrayWorkerSource}enforceCacheSizeLimit(R,F){s.eb(F)}getWorkerPerformanceMetrics(R,F,q){q(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new $s(self)),$s}),xp(["./shared"],function(s){var pr=Mr;function Mr(u){return!function(r){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var h,p,m=new Blob([""],{type:"text/javascript"}),g=URL.createObjectURL(m);try{p=new Worker(g),h=!0}catch{h=!1}return p&&p.terminate(),URL.revokeObjectURL(g),h}()?function(){var h=document.createElement("canvas");h.width=h.height=1;var p=h.getContext("2d");if(!p)return!1;var m=p.getImageData(0,0,1,1);return m&&m.width===h.width}()?(bt[a=r&&r.failIfMajorPerformanceCaveat]===void 0&&(bt[a]=function(h){var p,m=function(g){var x=document.createElement("canvas"),w=Object.create(Mr.webGLContextAttributes);return w.failIfMajorPerformanceCaveat=g,x.getContext("webgl2",w)}(h);if(!m)return!1;try{p=m.createShader(m.VERTEX_SHADER)}catch{return!1}return!(!p||m.isContextLost())&&(m.shaderSource(p,"void main() {}"),m.compileShader(p),m.getShaderParameter(p,m.COMPILE_STATUS)===!0)}(a)),bt[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var a}(u)}var bt={};function Zt(u,r,a){const h=document.createElement(u);return r!=null&&(h.className=r),a&&a.appendChild(h),h}function Di(u,r,a){const h=document.createElementNS("http://www.w3.org/2000/svg",u);for(const p of Object.keys(r))h.setAttributeNS(null,p,String(r[p]));return a&&a.appendChild(h),h}Mr.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const Nr=typeof document<"u"?document.documentElement&&document.documentElement.style:null,zn=Nr&&Nr.userSelect!==void 0?"userSelect":"WebkitUserSelect";let to;function Dn(){Nr&&zn&&(to=Nr[zn],Nr[zn]="none")}function el(){Nr&&zn&&(Nr[zn]=to)}function Os(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",Os,!0)}function Jr(){window.addEventListener("click",Os,!0),window.setTimeout(()=>{window.removeEventListener("click",Os,!0)},0)}function di(u,r){const a=u.getBoundingClientRect();return Do(u,a,r)}function fi(u,r){const a=u.getBoundingClientRect(),h=[];for(let p=0;p=0?0:u.button}function Do(u,r,a){const h=u.offsetWidth===r.width?1:u.offsetWidth/r.width;return new s.P((a.clientX-r.left)*h,(a.clientY-r.top)*h)}class Ac{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,a){this._updatedSourceCaches[r]=a,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const a=r.scope;this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._updatedLayers[a].add(r.id),this.setDirty()}removeLayer(r){const a=r.scope;this._removedLayers[a]=this._removedLayers[a]||{},this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._removedLayers[a][r.id]=r,this._updatedLayers[a].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const a in this._updatedLayers)r[a]=r[a]||{},r[a].updatedIds=Array.from(this._updatedLayers[a].values());for(const a in this._removedLayers)r[a]=r[a]||{},r[a].removedIds=Object.keys(this._removedLayers[a]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(r){this._updatedImages.add(r),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}const tl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ni{constructor(r,a,h,p,m,g){this.length=a.length,this.attributes=h,this.itemSize=a.bytesPerElement,this.dynamicDraw=p,this.instanceCount=g,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||m||a.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,a){for(let h=0;h0&&r.vertexAttribDivisor(m,h)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Yt{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Vr extends Yt{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Ro extends Yt{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class il extends Yt{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class rl extends Yt{getDefault(){return[!0,!0,!0,!0]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Qt extends Yt{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class Bs extends Yt{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class Ir extends Yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const a=this.current;(r.func!==a.func||r.ref!==a.ref||r.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class nl extends Yt{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class Fs extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=r,this.dirty=!1}}class io extends Yt{getDefault(){return[0,1]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Ht extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=r,this.dirty=!1}}class Lo extends Yt{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Ui extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.BLEND):a.disable(a.BLEND),this.current=r,this.dirty=!1}}class ol extends Yt{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class sl extends Yt{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class al extends Yt{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class dt extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=r,this.dirty=!1}}class ko extends Yt{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class ai extends Yt{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let ll=class extends Yt{getDefault(){return null}set(u){(u!==this.current||this.dirty)&&(this.gl.useProgram(u),this.current=u,this.dirty=!1)}};class cl extends Yt{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class ul extends Yt{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Ns extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Oo extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Ur extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class jr extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Vs extends Yt{getDefault(){return null}set(r){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class lt extends Yt{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class pt extends Yt{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class Bo extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class lr extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class pn extends Yt{constructor(r,a){super(r),this.context=r,this.parent=a}getDefault(){return null}}class hl extends pn{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class ro extends pn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,this.attachment(),a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class dl extends pn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,this.attachment(),a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Ln extends ro{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class kn{constructor(r,a,h,p,m){this.context=r,this.width=a,this.height=h;const g=this.framebuffer=r.gl.createFramebuffer();p&&(this.colorAttachment=new hl(r,g)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new ro(r,g):new dl(r,g))}destroy(){const r=this.context.gl;if(this.colorAttachment){const a=this.colorAttachment.get();a&&r.deleteTexture(a)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const a=this.depthAttachment.get();a&&r.deleteRenderbuffer(a)}else{const a=this.depthAttachment.get();a&&r.deleteTexture(a)}r.deleteFramebuffer(this.framebuffer)}}class Fo{constructor(r,a){this.gl=r,this.clearColor=new Vr(this),this.clearDepth=new Ro(this),this.clearStencil=new il(this),this.colorMask=new rl(this),this.depthMask=new Qt(this),this.stencilMask=new Bs(this),this.stencilFunc=new Ir(this),this.stencilOp=new nl(this),this.stencilTest=new Fs(this),this.depthRange=new io(this),this.depthTest=new Ht(this),this.depthFunc=new Lo(this),this.blend=new Ui(this),this.blendFunc=new ol(this),this.blendColor=new sl(this),this.blendEquation=new al(this),this.cullFace=new dt(this),this.cullFaceSide=new ko(this),this.frontFace=new ai(this),this.program=new ll(this),this.activeTexture=new cl(this),this.viewport=new ul(this),this.bindFramebuffer=new Ns(this),this.bindRenderbuffer=new Oo(this),this.bindTexture=new Ur(this),this.bindVertexBuffer=new jr(this),this.bindElementBuffer=new Vs(this),this.bindVertexArrayOES=new lt(this),this.pixelStoreUnpack=new pt(this),this.pixelStoreUnpackPremultiplyAlpha=new Bo(this),this.pixelStoreUnpackFlipY=new lr(this),this.options=a?{...a}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxPointSize=r.getParameter(r.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,a,h){return new s.I(this,r,a,h)}createVertexBuffer(r,a,h,p,m){return new ni(this,r,a,h,p,m)}createRenderbuffer(r,a,h){const p=this.gl,m=p.createRenderbuffer();return this.bindRenderbuffer.set(m),p.renderbufferStorage(p.RENDERBUFFER,r,a,h),this.bindRenderbuffer.set(null),m}createFramebuffer(r,a,h,p){return new kn(this,r,a,h,p)}clear({color:r,depth:a,stencil:h,colorMask:p}){const m=this.gl;let g=0;r&&(g|=m.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set(p||[!0,!0,!0,!0])),a!==void 0&&(g|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),h!==void 0&&(g|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),m.clear(g)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){s.d(r.blendFunction,s.a.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}class Us{constructor(r,a,h,p){const m={width:h[0],height:h[1],data:null},g=r.gl;this.targetColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,p),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const h=this.context.gl,p=a.width*a.height;this.particleTexture0=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1});const m=new s.S;m.reserve(p);for(let g=0;g{if(!h)return;const p=s.c(h),m=new s.M(r,void 0,void 0,p);return m.computeBoundsAndApplyParent(),m}).catch(h=>{if(h&&h.status===404)return null;this.fire(new s.f(new Error(`Could not load model ${r} from ${a}: ${h.message}`)))})}load(r,a){this.models[a]||(this.models[a]={});const h=Object.keys(r);this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+h.length;const p=[];for(const m of h)p.push(this.loadModel(m,r[m]));Promise.allSettled(p).then(m=>{for(let g=0;g{this.fire(new s.f(new Error(`Could not load models: ${m.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,a){return!!this.getModel(r,a)}getModel(r,a){return this.models[a]||(this.models[a]={}),this.models[a][r]?this.models[a][r].model:void 0}addModel(r,a,h){this.models[h]||(this.models[h]={}),this.hasModel(r,h)&&this.models[h][r].numReferences++,this.load({[r]:this.requestManager.normalizeModelURL(a)},h)}addModels(r,a){this.models[a]||(this.models[a]={});const h={};for(const p in r)this.models[a][p]={},h[p]=this.requestManager.normalizeModelURL(r[p]);this.load(h,a)}addModelsFromBucket(r,a){this.models[a]||(this.models[a]={});const h={};for(const p of r)this.hasModel(p,a)?this.models[a][p].numReferences++:h[p]=this.requestManager.normalizeModelURL(p);this.load(h,a)}removeModel(r,a){if(this.models[a]&&this.models[a][r]&&(this.models[a][r].numReferences--,this.models[a][r].numReferences===0)){const h=this.models[a][r].model;delete this.models[a][r],h.destroy()}}listModels(r){return this.models[r]||(this.models[r]={}),Object.keys(this.models[r])}upload(r,a){this.models[a]||(this.models[a]={});for(const h in this.models[a])this.models[a][h].model&&this.models[a][h].model.upload(r.context)}}function Vo(u){const{userImage:r}=u;return!!(r&&r.render&&r.render())&&(u.data.replace(new Uint8Array(r.data.buffer)),!0)}class Ar extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(r){this.images[r]={},this.loaded[r]=!1,this.updatedImages[r]={},this.patterns[r]={},this.callbackDispatchedThisFrame[r]={},this.atlasImage[r]=new s.j({width:1,height:1})}isLoaded(){for(const r in this.loaded)if(!this.loaded[r])return!1;return!0}setLoaded(r,a){if(this.loaded[a]!==r&&(this.loaded[a]=r,r)){for(const{ids:h,callback:p}of this.requestors)this._notify(h,a,p);this.requestors=[]}}hasImage(r,a){return!!this.getImage(r,a)}getImage(r,a){return this.images[a][r]}addImage(r,a,h){this._validate(r,h)&&(this.images[a][r]=h)}_validate(r,a){let h=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "stretchX" value`))),h=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "stretchY" value`))),h=!1),this._validateContent(a.content,a)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "content" value`))),h=!1),h}_validateStretch(r,a){if(!r)return!0;let h=0;for(const p of r){if(p[0]m)return[new s.V(r,a,`${a} is greater than the maximum value ${m}`)]}return[]}function er(u){const r=u.valueSpec,a=s.u(u.value.type);let h,p,m,g={};const x=a!=="categorical"&&u.value.property===void 0,w=!x,T=s.o(u.value.stops)==="array"&&s.o(u.value.stops[0])==="array"&&s.o(u.value.stops[0][0])==="object",S=or({key:u.key,value:u.value,valueSpec:u.styleSpec.function,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(z){if(a==="identity")return[new s.V(z.key,z.value,'identity function may not have a "stops" property')];let L=[];const k=z.value;return L=L.concat(ct({key:z.key,value:k,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:I})),s.o(k)==="array"&&k.length===0&&L.push(new s.V(z.key,k,"array must have at least one stop")),L},default:function(z){return Mi({key:z.key,value:z.value,valueSpec:r,style:z.style,styleSpec:z.styleSpec})}}});return a==="identity"&&x&&S.push(new s.V(u.key,u.value,'missing required property "property"')),a==="identity"||u.value.stops||S.push(new s.V(u.key,u.value,'missing required property "stops"')),a==="exponential"&&u.valueSpec.expression&&!s.s(u.valueSpec)&&S.push(new s.V(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(w&&!s.r(u.valueSpec)?S.push(new s.V(u.key,u.value,"property functions not supported")):x&&!s.t(u.valueSpec)&&S.push(new s.V(u.key,u.value,"zoom functions not supported"))),a!=="categorical"&&!T||u.value.property!==void 0||S.push(new s.V(u.key,u.value,'"property" property is required')),S;function I(z){let L=[];const k=z.value,O=z.key;if(s.o(k)!=="array")return[new s.V(O,k,`array expected, ${s.o(k)} found`)];if(k.length!==2)return[new s.V(O,k,`array length 2 expected, length ${k.length} found`)];if(T){if(s.o(k[0])!=="object")return[new s.V(O,k,`object expected, ${s.o(k[0])} found`)];if(k[0].zoom===void 0)return[new s.V(O,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new s.V(O,k,"object stop key must have value")];const B=s.u(k[0].zoom);if(typeof B!="number")return[new s.V(O,k[0].zoom,"stop zoom values must be numbers")];if(m&&m>B)return[new s.V(O,k[0].zoom,"stop zoom values must appear in ascending order")];B!==m&&(m=B,p=void 0,g={}),L=L.concat(or({key:`${O}[0]`,value:k[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Uo,value:P}}))}else L=L.concat(P({key:`${O}[0]`,value:k[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},k));return s.v(s.x(k[1]))?L.concat([new s.V(`${O}[1]`,k[1],"expressions are not allowed in function stops.")]):L.concat(Mi({key:`${O}[1]`,value:k[1],valueSpec:r,style:z.style,styleSpec:z.styleSpec}))}function P(z,L){const k=s.o(z.value),O=s.u(z.value),B=z.value!==null?z.value:L;if(h){if(k!==h)return[new s.V(z.key,B,`${k} stop domain type must match previous stop domain type ${h}`)]}else h=k;if(k!=="number"&&k!=="string"&&k!=="boolean"&&typeof O!="number"&&typeof O!="string"&&typeof O!="boolean")return[new s.V(z.key,B,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&a!=="categorical"){let G=`number expected, ${k} found`;return s.r(r)&&a===void 0&&(G+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(z.key,B,G)]}return a!=="categorical"||k!=="number"||typeof O=="number"&&isFinite(O)&&Math.floor(O)===O?a!=="categorical"&&k==="number"&&typeof O=="number"&&typeof p=="number"&&p!==void 0&&Onew s.V(`${u.key}${h.key}`,u.value,h.message));const a=r.value.expression||r.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!a.outputDefined())return[new s.V(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!s.A(a))return[new s.V(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter")return no(a,u);if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!s.B(a,["zoom","feature-state"]))return[new s.V(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!s.D(a))return[new s.V(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function no(u,r){const a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const p of r.valueSpec.expression.parameters)a.delete(p);if(a.size===0)return[];const h=[];return u instanceof s.F&&a.has(u.name)?[new s.V(r.key,r.value,`["${u.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(u.eachChild(p=>{h.push(...no(p,r))}),h)}function Cr(u){const r=u.key,a=u.value,h=u.valueSpec,p=[];return Array.isArray(h.values)?h.values.indexOf(s.u(a))===-1&&p.push(new s.V(r,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(s.u(a))===-1&&p.push(new s.V(r,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),p}function jo(u){return s.H(s.x(u.value))?Gr(s.q({},u,{expressionContext:"filter",valueSpec:u.styleSpec[`filter_${u.layerType||"fill"}`]})):js(u)}function js(u){const r=u.value,a=u.key;if(s.o(r)!=="array")return[new s.V(a,r,`array expected, ${s.o(r)} found`)];const h=u.styleSpec;let p,m=[];if(r.length<1)return[new s.V(a,r,"filter array must have at least 1 element")];switch(m=m.concat(Cr({key:`${a}[0]`,value:r[0],valueSpec:h.filter_operator,style:u.style,styleSpec:u.styleSpec})),s.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&s.u(r[1])==="$type"&&m.push(new s.V(a,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&m.push(new s.V(a,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(p=s.o(r[1]),p!=="string"&&m.push(new s.V(`${a}[1]`,r[1],`string expected, ${p} found`)));for(let g=2;g{T in a&&r.push(new s.V(h,a[T],`"${T}" is prohibited for ref layers`))}),p.layers.forEach(T=>{s.u(T.id)===x&&(w=T)}),w?w.ref?r.push(new s.V(h,a.ref,"ref cannot reference another ref layer")):g=s.u(w.type):typeof x=="string"&&r.push(new s.V(h,a.ref,`ref layer "${x}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(a.source){const w=p.sources&&p.sources[a.source],T=w&&s.u(w.type);w?T==="vector"&&g==="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a raster source`)):T==="raster"&&g!=="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a vector source`)):T!=="vector"||a["source-layer"]?T==="raster-dem"&&g!=="hillshade"?r.push(new s.V(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(g)?g!=="line"||!a.paint||!a.paint["line-gradient"]&&!a.paint["line-trim-offset"]||T==="geojson"&&w.lineMetrics?g==="raster-particle"&&T!=="raster-array"&&r.push(new s.V(h,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new s.V(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new s.V(h,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new s.V(h,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new s.V(h,a.source,`source "${a.source}" not found`))}else r.push(new s.V(h,a,'missing required property "source"'));return r=r.concat(or({key:h,value:a,valueSpec:m.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Mi({key:`${h}.type`,value:a.type,valueSpec:m.layer.type,style:u.style,styleSpec:u.styleSpec,object:a,objectKey:"type"}),filter:w=>jo(s.q({layerType:g},w)),layout:w=>or({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>$o(s.q({layerType:g},T))}}),paint:w=>or({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>oo(s.q({layerType:g,layer:a},T))}})}})),r}function On(u){const r=u.value,a=u.key,h=s.o(r);return h!=="string"?[new s.V(a,r,`string expected, ${h} found`)]:[]}const Zo={promoteId:function({key:u,value:r}){if(s.o(r)==="string")return On({key:u,value:r});{const a=[];for(const h in r)a.push(...On({key:`${u}.${h}`,value:r[h]}));return a}}};function Pr(u){const r=u.value,a=u.key,h=u.styleSpec,p=u.style;if(!r.type)return[new s.V(a,r,'"type" is required')];const m=s.u(r.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&(r.url||r.tiles||g.push(new s.n(a,r,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(or({key:a,value:r,valueSpec:h[`source_${m.replace("-","_")}`],style:u.style,styleSpec:h,objectElementValidators:Zo})),g;case"geojson":if(g=or({key:a,value:r,valueSpec:h.source_geojson,style:p,styleSpec:h,objectElementValidators:Zo}),r.cluster)for(const x in r.clusterProperties){const[w,T]=r.clusterProperties[x],S=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...Gr({key:`${a}.${x}.map`,value:T,expressionContext:"cluster-map"})),g.push(...Gr({key:`${a}.${x}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return g;case"video":return or({key:a,value:r,valueSpec:h.source_video,style:p,styleSpec:h});case"image":return or({key:a,value:r,valueSpec:h.source_image,style:p,styleSpec:h});case"canvas":return[new s.V(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Cr({key:`${a}.type`,value:r.type,valueSpec:{values:Cc(h)},style:p,styleSpec:h})}}function Cc(u){return u.source.reduce((r,a)=>{const h=u[a];return h.type.type==="enum"&&(r=r.concat(Object.keys(h.type.values))),r},[])}function zr(u){const r=u.value,a=u.styleSpec,h=a.light,p=u.style;let m=[];const g=s.o(r);if(r===void 0)return m;if(g!=="object")return m=m.concat([new s.V("light",r,`object expected, ${g} found`)]),m;for(const x in r){const w=x.match(/^(.*)-transition$/);m=m.concat(w&&h[w[1]]&&h[w[1]].transition?Mi({key:x,value:r[x],valueSpec:a.transition,style:p,styleSpec:a}):h[x]?Mi({key:x,value:r[x],valueSpec:h[x],style:p,styleSpec:a}):[new s.V(x,r[x],`unknown property "${x}"`)])}return m}function Bi(u){const r=u.value;let a=[];if(!r)return a;const h=s.o(r);if(h!=="object")return a=a.concat([new s.V("light-3d",r,`object expected, ${h} found`)]),a;const p=u.styleSpec,m=p["light-3d"],g=u.key,x=u.style,w=u.style.lights;for(const I of["type","id"])if(!(I in r))return a=a.concat([new s.V("light-3d",r,`missing property ${I} on light`)]),a;if(r.type&&w)for(let I=0;I[],array:ct,boolean:function(u){const r=u.value,a=u.key,h=s.o(r);return h!=="boolean"?[new s.V(a,r,`boolean expected, ${h} found`)]:[]},number:Uo,color:function(u){const r=u.key,a=u.value,h=s.o(a);return h!=="string"?[new s.V(r,a,`color expected, ${h} found`)]:s.G(a)===null?[new s.V(r,a,`color expected, "${a}" found`)]:[]},enum:Cr,filter:jo,function:er,layer:qo,object:or,source:Pr,model:s.L,light:zr,"light-3d":Bi,terrain:Gs,fog:so,string:On,formatted:function(u){return On(u).length===0?[]:Gr(u)},resolvedImage:function(u){return On(u).length===0?[]:Gr(u)},projection:function(u){const r=u.value,a=u.styleSpec,h=a.projection,p=u.style;let m=[];const g=s.o(r);if(g==="object")for(const x in r)m=m.concat(Mi({key:x,value:r[x],valueSpec:h[x],style:p,styleSpec:a}));else g!=="string"&&(m=m.concat([new s.V("projection",r,`object or string expected, ${g} found`)]));return m},import:function(u){const{value:r,styleSpec:a}=u,{data:h,...p}=r;Object.defineProperty(p,"__line__",{value:r.__line__,enumerable:!1});let m=or(s.q({},u,{value:p,valueSpec:a.import}));return s.u(p.id)===""&&m.push(new s.V(`${u.key}.id`,p,"import id can't be an empty string")),h&&(m=m.concat(oe(h,a,{key:`${u.key}.data`}))),m}};function Mi(u,r=!1){const a=u.value,h=u.valueSpec,p=u.styleSpec;if(h.expression&&s.J(s.u(a)))return er(u);if(h.expression&&s.v(s.x(a)))return Gr(u);if(h.type&&Wo[h.type]){const m=Wo[h.type](u);return r===!0&&m.length>0&&s.o(u.value)==="array"?Gr(u):m}return or(s.q({},u,{valueSpec:h.type?p[h.type]:h}))}function $s(u){const r=u.value,a=u.key,h=On(u);return h.length||(r.indexOf("{fontstack}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{range}" token'))),h}function oe(u,r=s.N,a={}){return Mi({key:a.key||"",value:u,valueSpec:r.$root,styleSpec:r,style:u,objectElementValidators:{glyphs:$s,"*":()=>[]}})}function R(u,r=s.N){return qe(oe(u,r))}const F=u=>qe(Pr(u)),q=u=>qe(zr(u)),te=u=>qe(Bi(u)),K=u=>qe(Gs(u)),ce=u=>qe(so(u)),xe=u=>qe(qo(u)),le=u=>qe(jo(u)),ge=u=>qe(oo(u)),ze=u=>qe($o(u)),Pe=u=>qe(s.L(u));function qe(u){return u.slice().sort((r,a)=>r.line&&a.line?r.line-a.line:0)}function tt(u,r){let a=!1;if(r&&r.length)for(const h of r)h instanceof s.n?s.w(h.message):(u.fire(new s.f(new Error(h.message))),a=!0);return a}let ot;class Bt extends s.E{constructor(r,a="flat"){super(),this._transitionable=new s.O(ot||(ot=new s.U({anchor:new s.W(s.N.light.anchor),position:new s.X(s.N.light.position),color:new s.W(s.N.light.color),intensity:new s.W(s.N.light.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,a,h={}){this._validate(q,r,h)||(this._transitionable.setTransitionOrValue(r),this.id=a)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&tt(this,r.call(R,s.Q({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.N})))}}const yt=new s.U({source:new s.W(s.N.terrain.source),exaggeration:new s.W(s.N.terrain.exaggeration)});let kt=class extends s.E{constructor(u,r,a,h){super(),this.scope=a,this._transitionable=new s.O(yt,a,h),this._transitionable.setTransitionOrValue(u,h),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(u,r){this._transitionable.setTransitionOrValue(u,r)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}getExaggeration(u){return this._transitioning.possiblyEvaluate(new s.Y(u)).get("exaggeration")}isZoomDependent(){const u=this._transitionable._values.exaggeration;return u!=null&&u.value!=null&&u.value.expression!=null&&u.value.expression instanceof s.Z}};const Je=45,si=65,Ft=.05;function Dt(u,r,a,h){const p=s.a0(Je,si,a),[m,g]=yi(u,h);let x=1-Math.min(1,Math.exp((r-m)/(g-m)*-6));return x*=x*x,x=Math.min(1,1.00747*x),x*p*u.alpha}function yi(u,r){const a=.5/Math.tan(.5*r);return[u.range[0]+a,u.range[1]+a]}function xi(u,r,a,h,p){const m=s.$.transformMat4([],[r,a,h],p.mercatorFogMatrix);return Dt(u,s.$.length(m),p.pitch,p._fov)}function Ri(u,r,a,h,p,m,g){const x=[[a,h,0],[p,h,0],[p,m,0],[a,m,0]];let w=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of x){const I=s.$.transformMat4([],S,r),P=s.$.length(I);w=Math.min(w,P),T=Math.max(T,P)}return[Dt(u,w,g.pitch,g._fov),Dt(u,T,g.pitch,g._fov)]}const ji=new s.U({range:new s.W(s.N.fog.range),color:new s.W(s.N.fog.color),"high-color":new s.W(s.N.fog["high-color"]),"space-color":new s.W(s.N.fog["space-color"]),"horizon-blend":new s.W(s.N.fog["horizon-blend"]),"star-intensity":new s.W(s.N.fog["star-intensity"]),"vertical-range":new s.W(s.N.fog["vertical-range"])});class tr extends s.E{constructor(r,a,h,p){super(),this._transitionable=new s.O(ji,h,new Map(p)),this.set(r,p),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new s.a1(ji),this.scope=h}get state(){const r=this._transform,a=r.projection.name==="globe",h=s.a2(r.zoom),p=this.properties.get("range"),m=[.5,3];return{range:a?[s.a3(m[0],p[0],h),s.a3(m[1],p[1],h)]:p,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,a,h={}){if(this._validate(ce,r,h))return;const p=s.Q({},r);for(const m of Object.keys(s.N.fog))p[m]===void 0&&(p[m]=s.N.fog[m].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,a)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const a=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.a0(Je,si,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?function(h,p,m){const g=s._.fromLngLat(p),x=m.elevation?m.elevation.getAtPointOrZero(g):0;return xi(h,g.x,g.y,x,m)}(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return Ri(this.state,a,0,0,s.a4,s.a4,this._transform)}getOpacityForBounds(r,a,h,p,m){return this._transform.projection.supportsFog?Ri(this.state,r,a,h,p,m,this._transform):[1,1]}getFovAdjustedRange(r){return this._transform.projection.supportsFog?yi(this.state,r):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const a=[4,5,6,7];for(const h of a){const p=r.points[h];let m;if(p[2]>=0)m=p;else{const g=r.points[h-4];m=s.a5(g,p,g[2]/(g[2]-p[2]))}if(xi(this.state,m[0],m[1],0,this._transform)>=Ft)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&tt(this,r.call(R,s.Q({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.N})))}}class ao extends s.E{constructor(r,a,h,p){super(),this.scope=h,this._options=r,this.properties=new s.a1(a),this._transitionable=new s.O(a,h,new Map(p)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,a){this._options=r,this._transitionable.setTransitionOrValue(r.properties,a)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let Pc,zc;var qs=` -#define EPSILON 0.0000001 -#define PI 3.141592653589793 -#ifdef RENDER_CUTOFF -float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} -#endif`,wt=` -out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} -#ifdef INDICATOR_CUTOUT -uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; -#endif -vec4 applyCutout(vec4 color) { -#ifdef INDICATOR_CUTOUT -float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); -#else -return color; -#endif -} -#ifdef DEBUG_WIREFRAME -#define HANDLE_WIREFRAME_DEBUG \\ -glFragColor=vec4(0.7,0.0,0.0,0.7); \\ -gl_FragDepth=gl_FragCoord.z-0.0001; -#else -#define HANDLE_WIREFRAME_DEBUG -#endif -#ifdef RENDER_CUTOFF -uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; -#endif -vec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,pl=` -#define EXTENT 8192.0 -#define RAD_TO_DEG 180.0/PI -#define DEG_TO_RAD PI/180.0 -#define GLOBE_RADIUS EXTENT/PI/2.0 -float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} -#ifdef PROJECTION_GLOBE_VIEW -vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { -#ifndef PROJECTED_POS_ON_VIEWPORT -float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; -#else -return vec3(0.0); -#endif -}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} -#endif -vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( -unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 -);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} -#ifdef RENDER_CUTOFF -uniform vec4 u_cutoff_params;out float v_cutoff_opacity; -#endif -const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) -{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Bn="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Dc=` -#define ELEVATION_SCALE 7.0 -#define ELEVATION_OFFSET 450.0 -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( -mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} -#else -vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } -#endif -#ifdef TERRAIN -uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { -#ifdef TERRAIN_DEM_FLOAT_FORMAT -vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; -#else -float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); -#endif -}float prevElevation(vec2 apos) { -#ifdef TERRAIN_DEM_FLOAT_FORMAT -vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; -#else -float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); -#endif -} -#ifdef TERRAIN_VERTEX_MORPHING -float elevation(vec2 apos) { -#ifdef ZERO_EXAGGERATION -return 0.0; -#endif -float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} -#else -float elevation(vec2 apos) { -#ifdef ZERO_EXAGGERATION -return 0.0; -#endif -return currentElevation(apos);} -#endif -vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} -#else -float elevation(vec2 pos) { return 0.0; } -#endif -#ifdef DEPTH_OCCLUSION -uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; -#ifdef DEPTH_D24 -float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} -#else -highp float unpack_depth_rgba(vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} -#endif -bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; -#ifdef DEPTH_D24 -float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); -#else -float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); -#endif -return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; -#ifdef DEPTH_D24 -highp vec4 depth=vec4( -texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r -);depth=unpack_depth4(depth); -#else -highp vec4 depth=vec4( -unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) -); -#endif -return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { -#ifdef DEPTH_D24 -highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); -#else -highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); -#endif -res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} -#else -bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } -#endif//DEPTH_OCCLUSION`,Rc=`#ifdef FOG -uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} -#endif`,Lc=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;} -#ifdef FOG -uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) { -#ifdef FOG_DITHERING -vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed); -#else -return color; -#endif -}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} -#endif`,kc=`#ifdef RASTER_ARRAY -uniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) -);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) -);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} -#endif`,Oc=`#ifdef RASTER_ARRAY -uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} -#endif -uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Bc=`#ifdef RENDER_SHADOWS -uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} -#endif//RENDER_SHADOWS`,Fc=`#ifdef RENDER_SHADOWS -#ifdef DEPTH_TEXTURE -uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1; -#else -uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1; -#endif -uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth; -#ifdef DEPTH_TEXTURE -shadow_depth=texture(u_shadowmap_1,uv).r; -#else -shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5; -#endif -return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth; -#ifdef DEPTH_TEXTURE -shadow_depth=texture(u_shadowmap_0,uv).r; -#else -shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5; -#endif -return step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias; -#ifdef NATIVE -highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0)); -#else -highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4( -shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0) -); -#endif -vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) { -#ifdef SHADOWS_SINGLE_CASCADE -light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias); -#else -light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)); -#endif -}highp float calculate_shadow_bias(float NDotL) { -#ifdef NORMAL_OFFSET -return 0.5*u_shadow_bias.x; -#else -return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); -#endif -}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} -#endif`;const Zs=[];Ho(qs,Zs),Ho(pl,Zs),Ho(wt,Zs);const Ws={"_prelude_fog.vertex.glsl":Rc,"_prelude_terrain.vertex.glsl":Dc,"_prelude_shadow.vertex.glsl":Bc,"_prelude_fog.fragment.glsl":Lc,"_prelude_shadow.fragment.glsl":Fc,"_prelude_lighting.glsl":` -#ifdef LIGHTING_3D_MODE -uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} -#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":kc,"_prelude_raster_particle.glsl":Oc},fl={};Rt("",Dc),Rt(Lc,Rc),Rt(Fc,Bc),Rt(kc,""),Rt(Oc,"");const ml=Rt(wt,pl),_h=qs;var gh={background:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec4 u_color;uniform float u_opacity; -#ifdef LIGHTING_3D_MODE -in vec4 v_color; -#endif -void main() {vec4 out_color; -#ifdef LIGHTING_3D_MODE -out_color=v_color; -#else -out_color=u_color; -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_lighting.glsl" -in vec2 a_pos;uniform mat4 u_matrix; -#ifdef LIGHTING_3D_MODE -uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; -#endif -void main() {gl_Position=u_matrix*vec4(a_pos,0,1); -#ifdef LIGHTING_3D_MODE -v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); -#endif -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),backgroundPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),circle:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -in vec3 v_data;in float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -uniform float u_emissive_strength;void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( -antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) -);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_apply_premultiplied(out_color,v_fog_pos); -#endif -glFragColor=out_color*(v_visibility*opacity_t); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define NUM_VISIBILITY_RINGS 2 -#define INV_SQRT2 0.70710678 -#define ELEVATION_BIAS 0.0001 -#define NUM_SAMPLES_PER_RING 16 -uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; -#endif -out vec3 v_data;out float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { -#if defined(TERRAIN) -return elevation(pos)+ELEVATION_BIAS; -#else -return 0.0; -#endif -}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); -#ifdef PITCH_WITH_MAP -#ifdef PROJECTION_GLOBE_VIEW -return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); -#else -return u_matrix*( world_center+vec4(sample_offset,0,0) ); -#endif -#else -return projected_center+vec4(sample_offset,0,0); -#endif -}float get_sample_step() { -#ifdef PITCH_WITH_MAP -return 2.0*PI/float(NUM_SAMPLES_PER_RING); -#else -return PI/float(NUM_SAMPLES_PER_RING); -#endif -}void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; -#ifdef PROJECTION_GLOBE_VIEW -vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); -#else -surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); -#endif -vec4 projected_center=u_matrix*world_center;float view_scale=0.0; -#ifdef PITCH_WITH_MAP -#ifdef SCALE_WITH_MAP -view_scale=1.0; -#else -view_scale=projected_center.w/u_camera_to_center_distance; -#endif -#else -#ifdef SCALE_WITH_MAP -view_scale=u_camera_to_center_distance; -#else -view_scale=projected_center.w; -#endif -#endif -gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; -#ifdef TERRAIN -float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; -#ifdef PITCH_WITH_MAP -float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; -#else -occlusion_world_center=world_center;occlusion_projected_center=projected_center; -#endif -for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); -#else -visibility=1.0; -#endif -#ifdef PROJECTION_GLOBE_VIEW -visibility=1.0; -#endif -v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); -#ifdef FOG -v_fog_pos=fog_position(world_center.xyz); -#endif -}`),clippingMask:Rt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Rt(`#include "_prelude_fog.fragment.glsl" -uniform highp float u_intensity;in vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); -#ifdef FOG -if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; -#endif -out vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -void main(void) { -#pragma mapbox: initialize highp float weight -#pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#else -pos=vec3(tilePos+extrude,elevation(tilePos)); -#endif -gl_Position=u_matrix*vec4(pos,1); -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),heatmapTexture:Rt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(0.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Rt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" -in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( -0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Rt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( -mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( -0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" -in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3; -#endif -out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; -#ifdef PROJECTION_GLOBE_VIEW -gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); -#else -gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); -#endif -}`),fill:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -uniform float u_emissive_strength;void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -vec4 out_color=color; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -in vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillOutline:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -in highp vec2 v_pos;uniform float u_emissive_strength; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillOutlinePattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -#pragma mapbox: define lowp float pixel_ratio -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize lowp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -#pragma mapbox: define lowp float pixel_ratio -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize lowp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillExtrusion:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -in vec4 v_color;in vec4 v_flat; -#ifdef RENDER_SHADOWS -in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; -#endif -uniform lowp float u_opacity; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;in vec2 v_ao; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -in vec4 v_roof_color; -#endif -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -in highp vec3 v_normal; -#endif -uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; -#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) -in float v_flood_radius;in float v_has_floodlight; -#endif -uniform float u_emissive_strength;in float v_height;void main() { -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -vec3 normal=normalize(v_normal); -#endif -float z;vec4 color=v_color; -#ifdef ZERO_ROOF_RADIUS -z=float(normal.z > 0.00001); -#ifdef LIGHTING_3D_MODE -normal=mix(normal,vec3(0.0,0.0,1.0),z); -#else -color=mix(v_color,v_roof_color,z); -#endif -#endif -float h=max(0.0,v_height);float ao_shade=1.0; -#ifdef FAUX_AO -float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; -#ifdef ZERO_ROOF_RADIUS -concave*=(1.0-z); -#endif -float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); -#ifdef LIGHTING_3D_MODE -#ifdef FLOOD_LIGHT -color.rgb*=mix(ao_shade,1.0,v_has_floodlight); -#else -color.rgb*=ao_shade; -#endif -#else -color.rgb*=ao_shade; -#endif -#endif -#ifdef LIGHTING_3D_MODE -float flood_radiance=0.0; -#ifdef FLOOD_LIGHT -flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; -#endif -#ifdef RENDER_SHADOWS -#ifdef FLOOD_LIGHT -float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); -#else -float shadowed_lighting_factor; -#ifdef RENDER_CUTOFF -shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} -#else -shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); -#endif -color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); -#endif -#else -color.rgb=apply_lighting(color.rgb,normal); -#ifdef FLOOD_LIGHT -color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); -#endif -#endif -color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity; -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); -#endif -#ifdef INDICATOR_CUTOUT -color=applyCutout(color); -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#include "_prelude_shadow.vertex.glsl" -#include "_prelude_lighting.glsl" -uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; -#endif -uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -out vec4 v_roof_color; -#endif -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -out highp vec3 v_normal; -#endif -#ifdef FAUX_AO -uniform lowp vec2 u_ao;out vec2 v_ao; -#endif -#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) -out float v_flood_radius;out float v_has_floodlight; -#endif -out float v_height; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -#pragma mapbox: define highp float flood_light_wall_radius -#pragma mapbox: define highp float line_width -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize highp float flood_light_wall_radius -#pragma mapbox: initialize highp float line_width -base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -v_normal=normal; -#endif -base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h); -#else -h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); -#endif -#ifdef PROJECTION_GLOBE_VIEW -float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#endif -float cutoff=1.0;vec3 scaled_pos=pos; -#ifdef RENDER_CUTOFF -vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); -#endif -float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0)); -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);scaled_pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);scaled_pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; -#ifdef RENDER_SHADOWS -vec3 shd_pos0=pos;vec3 shd_pos1=pos; -#ifdef NORMAL_OFFSET -vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); -#endif -v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); -#endif -float NdotL=0.0;float colorvalue=0.0; -#ifndef LIGHTING_3D_MODE -colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( -(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} -#endif -#ifdef FAUX_AO -float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; -#ifdef TERRAIN -top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); -#endif -v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); -#ifdef PROJECTION_GLOBE_VIEW -top_height+=u_height_lift; -#endif -gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; -#endif -#ifdef LIGHTING_3D_MODE -#ifdef FLOOD_LIGHT -float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; -#endif -v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0); -#else -v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; -#endif -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),fillExtrusionDepth:Rt(`in highp float v_depth;void main() { -#ifndef DEPTH_TEXTURE -glFragColor=pack_depth(v_depth); -#endif -}`,`#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp float line_width -out highp float v_depth;void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp float line_width -base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -vec3 pos; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h); -#else -pos=vec3(pos_nx.xy,t > 0.0 ? height : base); -#endif -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;in vec3 v_ao; -#endif -#ifdef LIGHTING_3D_MODE -in vec3 v_normal; -#endif -in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define highp float pixel_ratio -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize highp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; -#else -out_color=out_color*v_lighting; -#endif -#ifdef FAUX_AO -float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -#ifdef INDICATOR_CUTOUT -out_color=applyCutout(out_color); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#include "_prelude_lighting.glsl" -uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_alignment;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; -#endif -out vec2 v_pos;out vec4 v_lighting; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;out vec3 v_ao; -#endif -#ifdef LIGHTING_3D_MODE -out vec3 v_normal; -#endif -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define highp float pixel_ratio -#pragma mapbox: define highp float line_width -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize highp float pixel_ratio -#pragma mapbox: initialize highp float line_width -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -float ele=0.0;float h=z;vec3 p;float c_ele; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h); -#else -p=vec3(pos_nx.xy,z); -#endif -#ifdef PROJECTION_GLOBE_VIEW -float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#endif -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);p.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);p.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 -? pos_nx.xy -: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; -#ifdef LIGHTING_3D_MODE -NdotL=calculate_NdotL(normal); -#else -NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); -#endif -if (normal.y !=0.0) {float r=0.84; -#ifndef LIGHTING_3D_MODE -r=mix(0.7,0.98,1.0-u_lightintensity); -#endif -NdotL*=( -(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} -#ifdef FAUX_AO -float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; -#ifdef TERRAIN -top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); -#endif -v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); -#ifdef PROJECTION_GLOBE_VIEW -top_height+=u_height_lift; -#endif -gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; -#endif -#ifdef LIGHTING_3D_MODE -v_normal=normal; -#else -v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; -#endif -#ifdef FOG -v_fog_pos=fog_position(p); -#endif -}`),groundShadow:Rt(`#include "_prelude_shadow.fragment.glsl" -precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; -#ifdef FOG -in float v_fog_opacity; -#endif -void main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); -#ifdef RENDER_CUTOFF -shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); -#endif -#ifdef FOG -shadow=mix(shadow,vec3(1.0),v_fog_opacity); -#endif -#ifdef INDICATOR_CUTOUT -shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r); -#endif -glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; -#ifdef FOG -out float v_fog_opacity; -#endif -void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); -#ifdef FOG -v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); -#endif -}`),fillExtrusionGroundEffect:Rt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; -#ifdef SDF_SUBPASS -in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} -#ifdef FOG -in highp float v_fog; -#endif -#endif -void main() { -#ifdef CLEAR_SUBPASS -vec4 color=vec4(1.0); -#ifdef CLEAR_FROM_TEXTURE -color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); -#endif -glFragColor=color; -#else -#ifdef SDF_SUBPASS -highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; -#ifdef FOG -fog=v_fog; -#endif -#ifdef RENDER_CUTOFF -fog*=v_cutoff_opacity; -#endif -glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); -#else -vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); -#ifdef OVERDRAW_INSPECTOR -color=vec4(1.0); -#endif -glFragColor=color; -#endif -HANDLE_WIREFRAME_DEBUG; -#endif -}`,`#include "_prelude_fog.vertex.glsl" -in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; -#ifdef SDF_SUBPASS -out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; -#ifdef FOG -out highp float v_fog; -#endif -#endif -uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao; -#pragma mapbox: define highp float flood_light_ground_radius -const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { -#pragma mapbox: initialize highp float flood_light_ground_radius -vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; -#ifdef SDF_SUBPASS -v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); -#ifdef FOG -v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); -#endif -#endif -float hidden_by_landmark=0.0; -#ifdef HAS_CENTROID -hidden_by_landmark=a_hidden_by_landmark; -#endif -float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); -#ifdef RENDER_CUTOFF -v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); -#endif -}`),hillshadePrepare:Rt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( -(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) -)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( -deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef LIGHTING_3D_MODE -glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); -#endif -#ifdef FOG -glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),line:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv; -#ifdef RENDER_LINE_DASH -uniform sampler2D u_dash_image;in vec2 v_tex; -#endif -#ifdef RENDER_LINE_GRADIENT -uniform sampler2D u_gradient_image; -#endif -float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 dash -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float border_width -#pragma mapbox: define lowp vec4 border_color -float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize lowp vec4 dash -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float border_width -#pragma mapbox: initialize lowp vec4 border_color -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0); -#ifdef RENDER_LINE_DASH -float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); -#endif -highp vec4 out_color; -#ifdef RENDER_LINE_GRADIENT -out_color=texture(u_gradient_image,v_uv.xy); -#else -out_color=color; -#endif -float trim_alpha=1.0; -#ifdef RENDER_LINE_TRIM_OFFSET -highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;} -#endif -if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} -#ifdef RENDER_LINE_BORDER -float edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}} -#endif -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -out_color*=(alpha*opacity); -#ifdef INDICATOR_CUTOUT -out_color=applyCutout(out_color); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define EXTRUDE_SCALE 0.015873016 -in vec2 a_pos_normal;in vec4 a_data; -#if defined(ELEVATED) -in float a_z_offset; -#endif -#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) -in highp vec4 a_packed; -#endif -#ifdef RENDER_LINE_DASH -in float a_linesofar; -#endif -uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv; -#ifdef RENDER_LINE_DASH -uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; -#endif -#ifdef RENDER_LINE_GRADIENT -uniform float u_image_height; -#endif -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 dash -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float border_width -#pragma mapbox: define lowp vec4 border_color -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize lowp vec4 dash -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float border_width -#pragma mapbox: initialize lowp vec4 border_color -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0); -#if defined(ELEVATED) -vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias); -#else -gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; -#endif -#ifndef RENDER_TO_TEXTURE -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#else -v_gamma_scale=1.0; -#endif -#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) -float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; -#ifdef RENDER_LINE_GRADIENT -highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); -#else -v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); -#endif -#endif -#ifdef RENDER_LINE_DASH -float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y); -#endif -v_width2=vec2(outset,inset); -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),linePattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform highp float u_device_pixel_ratio;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; -#ifdef RENDER_LINE_TRIM_OFFSET -in highp vec4 v_uv; -#endif -#ifdef LINE_JOIN_NONE -in vec2 v_pattern_data; -#endif -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define mediump float pixel_ratio -#pragma mapbox: define mediump float blur -#pragma mapbox: define mediump float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize mediump float pixel_ratio -#pragma mapbox: initialize mediump float blur -#pragma mapbox: initialize mediump float opacity -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); -#ifdef RENDER_LINE_TRIM_OFFSET -highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}} -#endif -#ifdef LINE_JOIN_NONE -float pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} -#endif -#ifdef LIGHTING_3D_MODE -color=apply_lighting_ground(color); -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#endif -color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} -#ifdef INDICATOR_CUTOUT -color=applyCutout(color); -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define scale 0.015873016 -in vec2 a_pos_normal;in vec4 a_data; -#if defined(ELEVATED) -in float a_z_offset; -#endif -#ifdef RENDER_LINE_TRIM_OFFSET -in highp vec4 a_packed; -#endif -in highp float a_linesofar; -#ifdef LINE_JOIN_NONE -in highp vec3 a_pattern_data;out vec2 v_pattern_data; -#endif -uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; -#ifdef RENDER_LINE_TRIM_OFFSET -out highp vec4 v_uv; -#endif -#pragma mapbox: define mediump float blur -#pragma mapbox: define mediump float opacity -#pragma mapbox: define mediump float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define mediump float floorwidth -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define mediump float pixel_ratio -void main() { -#pragma mapbox: initialize mediump float blur -#pragma mapbox: initialize mediump float opacity -#pragma mapbox: initialize mediump float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize mediump float floorwidth -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize mediump float pixel_ratio -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0); -#if defined(ELEVATED) -vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias); -#else -gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; -#endif -#ifndef RENDER_TO_TEXTURE -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#else -v_gamma_scale=1.0; -#endif -#ifdef RENDER_LINE_TRIM_OFFSET -float a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; -#ifdef LINE_JOIN_NONE -v_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); -#endif -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),raster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -#include "_prelude_raster_array.glsl" -uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; -#ifdef PROJECTION_GLOBE_VIEW -in float v_split_fade; -#endif -uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; -#ifndef RASTER_ARRAY -uniform sampler2D u_image0;uniform sampler2D u_image1; -#endif -#ifdef RASTER_COLOR -uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; -#endif -void main() {vec4 color0,color1,color;vec2 value; -#ifdef RASTER_COLOR -#ifdef RASTER_ARRAY -#ifdef RASTER_ARRAY_LINEAR -value=mix( -raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t -); -#else -value=mix( -raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t -); -#endif -if (value.y > 0.0) value.x/=value.y; -#else -color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); -#endif -color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; -#else -color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); -#endif -color.a*=u_opacity; -#ifdef GLOBE_POLES -color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); -#endif -vec3 rgb=color.rgb;rgb=vec3( -dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; -#endif -#ifdef FOG -highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); -#endif -glFragColor=vec4(out_color*color.a,color.a); -#ifdef PROJECTION_GLOBE_VIEW -glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); -#endif -#ifdef RENDER_CUTOFF -glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; -#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 -#ifdef GLOBE_POLES -in vec3 a_globe_pos;in vec2 a_uv; -#else -in vec2 a_pos;in vec2 a_texture_pos; -#endif -out vec2 v_pos0;out vec2 v_pos1;out float v_depth; -#ifdef PROJECTION_GLOBE_VIEW -out float v_split_fade; -#endif -void main() {vec2 uv; -#ifdef GLOBE_POLES -vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); -#endif -#else -float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; -#ifdef PROJECTION_GLOBE_VIEW -vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); -v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -#else -gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -#endif -#endif -v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; -#ifdef RENDER_CUTOFF -v_depth=gl_Position.z; -#endif -}`),rasterParticle:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; -#endif -#ifdef FOG -highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); -#endif -glFragColor=vec4(out_color*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; -#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 -in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; -#ifdef PROJECTION_GLOBE_VIEW -vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -#else -uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -#endif -v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Rt("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" -in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( -mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Rt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Rt(`#include "_prelude_raster_particle.glsl" -uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( -linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) -);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbolIcon:Rt(`#include "_prelude_lighting.glsl" -uniform sampler2D u_texture; -#ifdef ICON_TRANSITION -uniform float u_icon_transition; -#endif -in float v_fade_opacity;in vec2 v_tex_a; -#ifdef ICON_TRANSITION -in vec2 v_tex_b; -#endif -#ifdef COLOR_ADJUSTMENT -uniform mat4 u_color_adj_mat; -#endif -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float emissive_strength -lowp float alpha=opacity*v_fade_opacity;vec4 out_color; -#ifdef ICON_TRANSITION -vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); -#else -out_color=texture(u_texture,v_tex_a); -#endif -#ifdef COLOR_ADJUSTMENT -out_color=u_color_adj_mat*out_color; -#endif -out_color*=alpha; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -#ifdef ICON_TRANSITION -in vec2 a_texb; -#endif -uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out vec2 v_tex_a; -#ifdef ICON_TRANSITION -out vec2 v_tex_b; -#endif -out float v_fade_opacity; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;vec2 a; -#ifdef PROJECTION_GLOBE_VIEW -vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; -#else -offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; -#endif -vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -v_tex_a=a_tex/u_texsize; -#ifdef ICON_TRANSITION -v_tex_b=a_texb/u_texsize; -#endif -v_fade_opacity=out_fade_opacity; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);v_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);v_fade_opacity*=occludedFadeMultiplier; -#endif -}`),symbolSDF:Rt(`#include "_prelude_lighting.glsl" -#define SDF_PX 8.0 -uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out float v_draw_halo;out vec2 v_data0;out vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; -#ifdef PROJECTION_GLOBE_VIEW -vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; -#else -offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; -#endif -vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; -#endif -float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:Rt(`#include "_prelude_lighting.glsl" -#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out float v_draw_halo;out vec4 v_data0;out vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; -#endif -float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+ xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image0;in vec2 v_pos0; -#ifdef FOG -in float v_fog_opacity; -#endif -#ifdef RENDER_SHADOWS -in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; -#endif -uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; -#ifdef LIGHTING_3D_MODE -const vec3 normal=vec3(0.0,0.0,1.0); -#ifdef RENDER_SHADOWS -float cutoffOpacity=1.0; -#ifdef RENDER_CUTOFF -cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); -#endif -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; -#else -float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); -#endif -#else -float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; -#endif -#endif -#else -color=image_color; -#endif -#ifdef FOG -#ifdef ZERO_EXAGGERATION -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#else -color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); -#endif -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; -#ifdef FOG -out float v_fog_opacity; -#endif -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; -#endif -void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); -#ifdef FOG -#ifdef ZERO_EXAGGERATION -v_fog_pos=fog_position(decodedPos); -#else -v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); -#endif -#endif -#ifdef RENDER_SHADOWS -vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); -#endif -}`),terrainDepth:Rt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Rt(`#include "_prelude_fog.fragment.glsl" -in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( -cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; -#ifdef FOG -sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); -#endif -sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,Bn),skyboxGradient:Rt(`#include "_prelude_fog.fragment.glsl" -in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); -#ifdef FOG -color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; -#endif -color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,Bn),skyboxCapture:Rt(` -in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; -#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) -#define BETA_M vec3(21e-6,21e-6,21e-6) -#define MIE_G 0.76 -#define DENSITY_HEIGHT_SCALE_R 8000.0 -#define DENSITY_HEIGHT_SCALE_M 1200.0 -#define PLANET_RADIUS 6360e3 -#define ATMOSPHERE_RADIUS 6420e3 -#define SAMPLE_STEPS 10 -#define DENSITY_STEPS 4 -float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; -#ifndef FOG -uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; -#endif -void main() {vec4 color; -#ifdef CUSTOM_ANTIALIASING -vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); -#ifdef LIGHTING_3D_MODE -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias); -#else -raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); -#endif -#else -color=vec4(raster.rgb*antialias,raster.a*antialias); -#endif -#else -color=texture(u_image0,v_pos0); -#ifdef LIGHTING_3D_MODE -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; -#else -color=apply_lighting_ground(color); -#endif -#endif -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#endif -color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; -#ifdef GLOBE_POLES -in vec3 a_globe_pos;in vec2 a_uv; -#else -in vec2 a_pos; -#endif -out vec2 v_pos0;void main() { -#ifdef GLOBE_POLES -vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; -#else -float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); -#endif -v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; -#ifdef GLOBE_POLES -vec3 up_vector=globe_derived_up_vector; -#else -vec3 up_vector=elevationVector(tile_pos); -#endif -float height=elevation(tile_pos);globe_pos+=up_vector*height; -#ifndef GLOBE_POLES -globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; -#endif -#ifdef GLOBE_POLES -vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); -#else -vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); -#endif -gl_Position=u_proj_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -}`),globeAtmosphere:Rt(`#include "_prelude_fog.fragment.glsl" -uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; -#ifdef PROJECTION_GLOBE_VIEW -globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { -#ifdef ALPHA_PASS -glFragColor=vec4(0,0,0,0);return; -#else -#ifdef NATIVE -glFragColor=vec4(1,1,1,1); -#else -glFragColor=vec4(0,0,0,1); -#endif -return; -#endif -} -#endif -highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? -0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; -#ifdef PROJECTION_GLOBE_VIEW -highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? -PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); -#else -horizon_angle=horizon_angle_mercator; -#endif -horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; -#ifdef ALPHA_PASS -float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); -#else -vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2; -#ifndef NATIVE -c=dither(c,gl_FragCoord.xy+u_temporal_offset); -#endif -glFragColor=vec4(c*t,t); -#endif -}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( -mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; -#ifdef RENDER_SHADOWS -in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; -#endif -#ifdef OCCLUSION_TEXTURE_TRANSFORM -uniform vec4 u_occlusionTextureTransform; -#endif -#pragma mapbox: define-attribute highp vec3 normal_3f -#pragma mapbox: define-attribute highp vec3 color_3f -#pragma mapbox: define-attribute highp vec4 color_4f -#pragma mapbox: define-attribute highp vec2 uv_2f -#pragma mapbox: initialize-attribute highp vec3 normal_3f -#pragma mapbox: initialize-attribute highp vec3 color_3f -#pragma mapbox: initialize-attribute highp vec4 color_4f -#pragma mapbox: initialize-attribute highp vec2 uv_2f -#ifdef HAS_ATTRIBUTE_a_pbr -in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; -#endif -#ifdef HAS_TEXTURE_u_baseColorTexture -uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; -#endif -#ifdef HAS_TEXTURE_u_metallicRoughnessTexture -uniform sampler2D u_metallicRoughnessTexture; -#endif -#ifdef HAS_TEXTURE_u_occlusionTexture -uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; -#endif -#ifdef HAS_TEXTURE_u_normalTexture -uniform sampler2D u_normalTexture; -#endif -#ifdef HAS_TEXTURE_u_emissionTexture -uniform sampler2D u_emissionTexture; -#endif -#ifdef APPLY_LUT_ON_GPU -uniform highp sampler3D u_lutTexture; -#endif -#ifdef TERRAIN_FRAGMENT_OCCLUSION -in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;uniform vec2 u_depth_range_unpack; -#ifdef DEPTH_D24 -float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} -#else -highp float unpack_depth_rgba(highp vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} -#endif -bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size; -#ifdef DEPTH_D24 -highp float depth=unpack_depth(texture(u_depthTexture,coord).r); -#else -highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); -#endif -return v_depth > depth+0.0005;} -#endif -#define saturate(_x) clamp(_x,0.,1.) -vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) -{ -#ifdef LIGHTING_3D_MODE -vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; -#ifdef RENDER_SHADOWS -lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); -#else -lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); -#endif -return apply_lighting(albedo,transformed_normal,lighting_factor); -#else -vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; -#endif -}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; -#ifdef HAS_ATTRIBUTE_a_color_3f -albedo*=vec4(color_3f,1.0); -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -#else -#ifdef HAS_ATTRIBUTE_a_color_4f -albedo*=color_4f; -#endif -#endif -#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) -vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} -#ifdef UNPREMULT_TEXTURE_IN_SHADER -if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; -#endif -if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} -#endif -vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); -#ifdef APPLY_LUT_ON_GPU -color=applyLUT(u_lutTexture,color); -#endif -return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { -#ifdef HAS_TEXTURE_u_normalTexture -highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; -#else -return mat3(1.0); -#endif -}highp vec3 getNormal(){highp vec3 n; -#ifdef HAS_ATTRIBUTE_a_normal_3f -n=normalize(normal_3f); -#else -highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; -#endif -#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); -#endif -return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; -#ifdef HAS_ATTRIBUTE_a_pbr -mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; -#endif -#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; -#endif -const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) -{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) -{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) -{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) -{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) -{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) -{ -#ifdef LIGHTING_3D_MODE -return mat.diffuseColor; -#else -return mat.diffuseColor/PI; -#endif -}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) -{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) -{vec3 env_light=vec3(0.65,0.65,0.65); -#ifdef LIGHTING_3D_MODE -float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; -#endif -vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) -{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; -#ifdef RENDER_SHADOWS -lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); -#else -lighting_factor=NdotL; -#endif -vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; -#if !defined(LIGHTING_3D_MODE) -const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); -#endif -color*=intensityFactor;return color;}void main() { -#ifdef TERRAIN_FRAGMENT_OCCLUSION -if (isOccluded()) {discard;} -#endif -vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; -#ifdef LIGHTING_3D_MODE -lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; -#endif -vec4 finalColor; -#ifdef DIFFUSE_SHADED -vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); -#ifdef HAS_TEXTURE_u_occlusionTexture -float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; -#endif -finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; -#else -Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; -#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -#ifdef OCCLUSION_TEXTURE_TRANSFORM -vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; -#else -vec2 uv=uv_2f; -#endif -ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; -#endif -vec4 emissive=u_emissiveFactor; -#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); -#endif -#ifdef APPLY_LUT_ON_GPU -float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; -#endif -color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; -#ifdef HAS_ATTRIBUTE_a_pbr -float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; -#ifdef APPLY_LUT_ON_GPU -color_mix=applyLUT(u_lutTexture,color_mix); -#endif -color=mix(color,color_mix,min(1.0,resEmission)); -#ifdef HAS_ATTRIBUTE_a_color_4f -float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); -#endif -#endif -vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); -#endif -#ifdef FOG -finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); -#endif -#ifdef RENDER_CUTOFF -finalColor*=v_cutoff_opacity; -#endif -#ifdef INDICATOR_CUTOUT -finalColor=applyCutout(finalColor); -#endif -glFragColor=finalColor; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_shadow.vertex.glsl" -in vec3 a_pos_3f; -#pragma mapbox: define-attribute highp vec3 normal_3f -#pragma mapbox: define-attribute highp vec2 uv_2f -#pragma mapbox: define-attribute highp vec3 color_3f -#pragma mapbox: define-attribute highp vec4 color_4f -#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr -#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength -uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; -#ifdef INSTANCED_ARRAYS -in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; -#else -uniform highp mat4 u_normal_matrix; -#endif -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; -#endif -out vec4 v_position_height;out lowp vec4 v_color_mix; -#ifdef TERRAIN_FRAGMENT_OCCLUSION -out highp float v_depth; -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; -#endif -vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { -#pragma mapbox: initialize-attribute highp vec3 normal_3f -#pragma mapbox: initialize-attribute highp vec2 uv_2f -#pragma mapbox: initialize-attribute highp vec3 color_3f -#pragma mapbox: initialize-attribute highp vec4 color_4f -#pragma mapbox: initialize-attribute-custom highp vec4 pbr -#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength -highp mat4 normal_matrix; -#ifdef INSTANCED_ARRAYS -normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); -#else -normal_matrix=u_normal_matrix; -#endif -vec3 local_pos;mat3 rs; -#ifdef MODEL_POSITION_ON_GPU -vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; -#else -local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); -#endif -v_position_height.w=a_pos_3f.z; -#ifdef HAS_ATTRIBUTE_a_pbr -vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; -#endif -#ifdef FOG -v_fog_pos=fog_position(local_pos); -#endif -#ifdef RENDER_CUTOFF -v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); -#endif -#ifdef TERRAIN_FRAGMENT_OCCLUSION -v_depth=gl_Position.z/gl_Position.w; -#endif -#ifdef HAS_ATTRIBUTE_a_normal_3f -#ifdef MODEL_POSITION_ON_GPU -float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); -#else -normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); -#endif -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -#ifdef HAS_ATTRIBUTE_a_color_4f -v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); -#endif -#endif -#ifdef RENDER_SHADOWS -vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); -#ifdef NORMAL_OFFSET -#ifdef HAS_ATTRIBUTE_a_normal_3f -#ifdef MODEL_POSITION_ON_GPU -vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); -#else -vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); -#endif -#endif -#endif -v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; -#endif -}`),modelDepth:Rt(`in highp float v_depth;void main() { -#ifndef DEPTH_TEXTURE -glFragColor=pack_depth(v_depth); -#endif -}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; -#ifdef MODEL_POSITION_ON_GPU -#ifdef INSTANCED_ARRAYS -in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; -#else -uniform highp mat4 u_instance; -#endif -uniform highp mat4 u_node_matrix; -#endif -void main() { -#ifdef MODEL_POSITION_ON_GPU -highp mat4 instance; -#ifdef INSTANCED_ARRAYS -instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); -#else -instance=u_instance; -#endif -vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); -#else -gl_Position=u_matrix*vec4(a_pos_3f,1); -#endif -v_depth=gl_Position.z/gl_Position.w;}`),stars:Rt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) -{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` -in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),occlusion:Rt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" -in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; -#ifdef TERRAIN -float e=elevation(world_pos.xy);world_pos.z+=e; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Ho(u,r){const a=u.replace(/\s*\/\/[^\n]*\n/g,` -`).split(` -`);for(let h of a)if(h=h.trim(),h[0]==="#"&&h.includes("if")&&!h.includes("endif")){h=h.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const p=h.split(" ");for(const m of p)r.includes(m)||r.push(m)}}function Rt(u,r){const a=/#include\s+"([^"]+)"/g,h=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let p=r.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);p&&(p=p.map(T=>{const S=T.split(" ");return S[S.length-1]}),p=[...new Set(p)]);const m={},g=[],x=[];if(u=u.replace(a,(T,S)=>(x.push(S),"")),(r=r.replace(a,(T,S)=>(g.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let w=[...Zs];Ho(u,w),Ho(r,w);for(const T of[...g,...x])Ws[T]||console.error(`Undefined include: ${T}`),fl[T]||(fl[T]=[],Ho(Ws[T],fl[T])),w=[...w,...fl[T]];return{fragmentSource:u=u.replace(h,(T,S,I,P,z)=>(m[z]=!0,S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -in ${I} ${P} ${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize"?` -#ifdef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = u_${z}; -#endif -`:S==="define-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - in ${I} ${P} ${z}; -#endif -`:S==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(h,(T,S,I,P,z)=>{const L=P==="float"?"vec2":P,k=z.match(/color/)?"color":L;return S==="define-attribute-vertex-shader-only"?` -#ifdef HAS_ATTRIBUTE_a_${z} -in ${I} ${P} a_${z}; -#endif -`:m[z]?S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -in ${I} ${L} a_${z}; -out ${I} ${P} ${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize"?k==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${z} = a_${z}; -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${z} - ${z} = unpack_mix_${k}(a_${z}, u_${z}_t); -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:S==="define-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - in ${I} ${P} a_${z}; - out ${I} ${P} ${z}; -#endif -`:S==="initialize-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - ${z} = a_${z}; -#endif -`:void 0:S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -in ${I} ${L} a_${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="define-instanced"?k==="mat4"?` -#ifdef INSTANCED_ARRAYS -in vec4 a_${z}0; -in vec4 a_${z}1; -in vec4 a_${z}2; -in vec4 a_${z}3; -#else -uniform ${I} ${P} u_${z}; -#endif -`:` -#ifdef INSTANCED_ARRAYS -in ${I} ${L} a_${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize-attribute-custom"?` -#ifdef HAS_ATTRIBUTE_a_${z} - ${I} ${P} ${z} = a_${z}; -#endif -`:k==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = a_${z}; -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = unpack_mix_${k}(a_${z}, u_${z}_t); -#else - ${I} ${P} ${z} = u_${z}; -#endif -`}),staticAttributes:p,usedDefines:w,vertexIncludes:g,fragmentIncludes:x}}class vp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,a,h,p,m,g,x,w){this.context=r;let T=this.boundPaintVertexBuffers.length!==p.length;for(let I=0;!T&&I{const j=G.paint.get("hillshade-shadow-color"),J=G.paint.get("hillshade-highlight-color"),Z=G.paint.get("hillshade-accent-color"),W=G.paint.get("hillshade-emissive-strength");let ee=s.ac(G.paint.get("hillshade-illumination-direction"));if(G.paint.get("hillshade-illumination-anchor")==="viewport")ee-=O.transform.angle;else if(O.style&&O.style.enable3dLights()&&O.style.directionalLight){const ue=O.style.directionalLight.properties.get("direction"),re=s.ad(ue.x,ue.y,ue.z);ee=s.ac(re[1])}const ie=!O.options.moving;return{u_matrix:$||O.transform.calculateProjMatrix(B.tileID.toUnwrapped(),ie),u_image:0,u_latrange:bp(0,B.tileID),u_light:[G.paint.get("hillshade-exaggeration"),ee],u_shadow:j.toRenderColor(G.lut),u_highlight:J.toRenderColor(G.lut),u_emissive_strength:W,u_accent:Z.toRenderColor(G.lut)}})(u,a,h,u.terrain?r.projMatrix:null);u.uploadCommonUniforms(x,I,r.toUnwrapped());const{tileBoundsBuffer:z,tileBoundsIndexBuffer:L,tileBoundsSegments:k}=u.getTileBoundsBuffers(a);I.draw(u,w.TRIANGLES,p,m,g,s.ag.disabled,P,h.id,z,L,k)}function yh(u,r,a){if(!r.needsDEMTextureUpload)return;const h=u.context,p=h.gl;h.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||u.getTileTexture(a.stride);const m=a.getPixels();r.demTexture?r.demTexture.update(m,{premultiply:!1}):r.demTexture=new s.T(h,m,p.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function Tp(u,r,a){const h=u.context,p=h.gl;if(!r.dem)return;const m=r.dem;if(h.activeTexture.set(p.TEXTURE1),yh(u,r,m),!r.demTexture)return;r.demTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE);const g=m.dim;h.activeTexture.set(p.TEXTURE0);let x=r.hillshadeFBO;if(!x){const P=new s.T(h,{width:g,height:g,data:null},p.RGBA);P.bind(p.LINEAR,p.CLAMP_TO_EDGE),x=r.hillshadeFBO=h.createFramebuffer(g,g,!0,"renderbuffer"),x.colorAttachment.set(P.texture)}h.bindFramebuffer.set(x.framebuffer),h.viewport.set([0,0,g,g]);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=u.getMercatorTileBoundsBuffers(),I=[];u.linearFloatFilteringSupported()&&I.push("TERRAIN_DEM_FLOAT_FORMAT"),u.getOrCreateProgram("hillshadePrepare",{defines:I}).draw(u,p.TRIANGLES,s.af.disabled,s.ah.disabled,s.a.unblended,s.ag.disabled,((P,z)=>{const L=z.stride,k=s.ae.create();return s.ae.ortho(k,0,s.a4,-s.a4,0,0,1),s.ae.translate(k,k,[0,-s.a4,0]),{u_matrix:k,u_image:1,u_dimension:[L,L],u_zoom:P.overscaledZ}})(r.tileID,m),a.id,w,T,S),r.needsHillshadePrepare=!1}function Nc(u,r,a,h,p){const m=function(x,w){if(x)return p(x);if(w){if(u.url&&w.tiles&&u.tiles&&delete u.tiles,w.variants){if(!Array.isArray(w.variants))return p(new Error("variants must be an array"));for(const S of w.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return p(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return p(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){w=s.Q(w,S);break}}}const T=s.ai(s.Q(w,u),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);w.vector_layers&&(T.vectorLayers=w.vector_layers,T.vectorLayerIds=T.vectorLayers.map(S=>S.id)),w.raster_layers&&(T.rasterLayers=w.raster_layers,T.rasterLayerIds=T.rasterLayers.map(S=>S.id)),T.tiles=r.canonicalizeTileset(T,u.url),p(null,T)}},g=function(x,w,T){if(!x)return null;if(!w&&!T)return x;T=T||x.worldview_default;const S=Object.values(x.language||{});if(S.length===0)return null;const I=Object.values(x.worldview||{});if(I.length===0)return null;const P=S.every(L=>L===w),z=I.every(L=>L===T);return P&&z?x:w in(x.language_options||{})||T in(x.worldview_options||{})?null:x.language_options&&x.worldview_options?x:null}(u.data,a,h);return g?s.e.frame(()=>m(null,g)):u.url?s.h(r.transformRequest(r.normalizeSourceURL(u.url,null,a,h),s.R.Source),m):s.e.frame(()=>{const{data:x,...w}=u;m(null,w)})}class Hs{constructor(r,a,h){this.bounds=s.aj.convert(this.validateBounds(r)),this.minzoom=a||0,this.maxzoom=h||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const a=Math.pow(2,r.z),h=Math.floor(s.ak(this.bounds.getWest())*a),p=Math.floor(s.al(this.bounds.getNorth())*a),m=Math.ceil(s.ak(this.bounds.getEast())*a),g=Math.ceil(s.al(this.bounds.getSouth())*a);return r.x>=h&&r.x=p&&r.y{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new s.f(a)):h&&(s.Q(this,h),h.bounds&&(this.tileBounds=new Hs(h.bounds,this.minzoom,this.maxzoom)),s.ao(h.tiles),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.am(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.Q({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,a){const h=s.e.devicePixelRatio>=2,p=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),h,this.tileSize);r.request=s.i(this.map._requestManager.transformRequest(p,s.R.Tile),(m,g,x,w)=>(delete r.request,r.aborted?(r.state="unloaded",a(null)):m?(r.state="errored",a(m)):g?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:w}),r.setTexture(g,this.map.painter),r.state="loaded",s.an(this.dispatcher),void a(null)):a(null)))}abortTile(r,a){r.request&&(r.request.cancel(),delete r.request),a&&a()}unloadTile(r,a){r.texture&&r.texture instanceof s.T?(r.destroy(!0),r.texture&&r.texture instanceof s.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class xh extends s.E{constructor(r,a,h,p){if(super(),this.id=r,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.Q(this,s.ai(a,["url","scheme","tileSize","promoteId"])),this._options=s.Q({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p),this._tileWorkers={},this._deduped=new s.ap}load(r){this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,h=this.map._worldview;this._tileJSONRequest=Nc(this._options,this.map._requestManager,a,h,(p,m)=>{this._tileJSONRequest=null,this._loaded=!0,p?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),h&&h.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${h}`),this.fire(new s.f(p))):m&&(s.Q(this,m),m.bounds&&(this.tileBounds=new Hs(m.bounds,this.minzoom,this.maxzoom)),s.ao(m.tiles,this.map._requestManager._customAccessToken),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),r&&r(p)})}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.am(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.Q({},this._options)}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),p=this.map._requestManager.transformRequest(h,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,g={request:p,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,lut:m?{image:m.image.clone()}:null,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,tessellationStep:this.map._tessellationStep};if(g.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=a:r.request=r.actor.send("reloadTile",g,x.bind(this));else if(r.actor=this._tileWorkers[h]=this._tileWorkers[h]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",g,x.bind(this),void 0,!0);else{const w=s.aq.call({deduped:this._deduped},g,(T,S)=>{T||!S?x.call(this,T):(g.data={cacheControl:S.cacheControl,expires:S.expires,rawData:S.rawData.slice(0)},r.actor&&r.actor.send("loadTile",g,x.bind(this),void 0,!0))},!0);r.request={cancel:w}}function x(w,T){return delete r.request,r.aborted?a(null):w&&w.status!==404?a(w):(T&&T.resourceTiming&&(r.resourceTiming=T.resourceTiming),this.map._refreshExpiredTiles&&T&&r.setExpiryData(T),r.loadVectorData(T,this.map.painter),s.an(this.dispatcher),a(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(r,a){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}const vh=(u,r,a)=>({u_matrix:u,u_image0:0,u_skirt_height:r,u_ground_shadow_factor:a}),Vc=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>({u_proj_matrix:Float32Array.from(u),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(h),u_merc_matrix:a,u_zoom_transition:p,u_merc_center:m,u_image0:0,u_frustum_tl:g,u_frustum_tr:x,u_frustum_br:w,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:I,u_viewport:P,u_grid_matrix:k?Float32Array.from(k):new Float32Array(9),u_skirt_height:z,u_far_z_cutoff:L});class Xs{constructor(r=0,a=0,h=0,p=0){if(isNaN(r)||r<0||isNaN(a)||a<0||isNaN(h)||h<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=a,this.left=h,this.right=p}interpolate(r,a,h){return a.top!=null&&r.top!=null&&(this.top=s.a3(r.top,a.top,h)),a.bottom!=null&&r.bottom!=null&&(this.bottom=s.a3(r.bottom,a.bottom,h)),a.left!=null&&r.left!=null&&(this.left=s.a3(r.left,a.left,h)),a.right!=null&&r.right!=null&&(this.right=s.a3(r.right,a.right,h)),this}getCenter(r,a){const h=s.au((this.left+r-this.right)/2,0,r),p=s.au((this.top+a-this.bottom)/2,0,a);return new s.P(h,p)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Xs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function lo(u,r){const a=s.ax(u,3);s.ae.fromQuat(u,r),s.aA(u,3,a)}function je(u,r){const a=s.aw.identity([]);return s.aw.rotateZ(a,a,-r),s.aw.rotateX(a,a,-u),a}function Xo(u,r){const a=[u[0],u[1],0],h=[r[0],r[1],0];if(s.$.length(a)>=1e-15){const g=s.$.normalize([],a);s.$.scale(h,g,s.$.dot(h,g)),r[0]=h[0],r[1]=h[1]}const p=s.$.cross([],r,u);if(s.$.len(p)<1e-15)return null;const m=Math.atan2(-p[1],p[0]);return je(Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2]),m)}class bh{constructor(r,a){this.position=r,this.orientation=a}get position(){return this._position}set position(r){if(r){const a=r instanceof s._?r:new s._(r[0],r[1],r[2]);this._renderWorldCopies&&(a.x=s.av(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a){if(this.orientation=null,!this.position)return;const h=this.position,p=this._elevation?this._elevation.getAtPointOrZero(s._.fromLngLat(r)):0,m=s._.fromLngLat(r,p),g=[m.x-h.x,m.y-h.y,m.z-h.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=Xo(g,a)}setPitchBearing(r,a){this.orientation=je(s.ac(r),s.ac(-a))}}class Yo{constructor(r,a){this._transform=s.ae.identity([]),this.orientation=a,this.position=r}get mercatorPosition(){const r=this.position;return new s._(r[0],r[1],r[2])}get position(){const r=s.ax(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var a;r&&s.aA(this._transform,3,[(a=r)[0],a[1],a[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||s.aw.identity([]),r&&lo(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),a=this.right();return{bearing:Math.atan2(-a[1],a[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,a){this._orientation=je(r,a),lo(this._transform,this._orientation)}forward(){const r=s.ax(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=s.ax(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=s.ax(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){const h=new Float64Array(16);return s.ae.invert(h,this.getWorldToCamera(r,a)),h}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,h){const p=this.position;s.$.scale(p,p,-r);const m=new Float64Array(16);return s.ae.fromScaling(m,[h,h,h]),s.ae.translate(m,m,p),m[10]*=a,m}getWorldToCamera(r,a){const h=new Float64Array(16),p=new Float64Array(4),m=this.position;return s.aw.conjugate(p,this._orientation),s.$.scale(m,m,-r),s.ae.fromQuat(h,p),s.ae.translate(h,h,m),h[1]*=-1,h[5]*=-1,h[9]*=-1,h[13]*=-1,h[8]*=a,h[9]*=a,h[10]*=a,h[11]*=a,h}getCameraToClipPerspective(r,a,h,p){const m=new Float64Array(16);return s.ae.perspective(m,r,a,h,p),m}getCameraToClipOrthographic(r,a,h,p,m,g){const x=new Float64Array(16);return s.ae.ortho(x,r,a,h,p,m,g),x}getDistanceToElevation(r,a=!1){const h=r===0?0:s.ay(r,a?s.az(this.position[1]):this.position[1]),p=this.forward();return(h-this.position[2])/p[2]}clone(){return new Yo([...this.position],[...this.orientation])}}const At={unknown:0,flipRequired:1,flipNotRequired:2},sr=Math.tan(85*Math.PI/180);function Ys(u,r,a,h,p,m,g){const x=s.ae.create();if(a)if(m.name==="globe"){const w=s.aC(p,r);s.ae.multiply(x,x,w)}else{const w=s.aD.invert([],g);x[0]=w[0],x[1]=w[1],x[4]=w[2],x[5]=w[3],h||s.ae.rotateZ(x,x,p.angle)}else s.ae.multiply(x,p.labelPlaneMatrix,u);return x}function _l(u,r,a,h,p,m,g){const x=Ys(u,r,a,h,p,m,g);return m.name==="globe"&&a||(x[2]=x[6]=x[10]=x[14]=0),x}function gl(u,r,a,h,p,m,g){if(a){if(m.name==="globe"){const x=Ys(u,r,a,h,p,m,g);return s.ae.invert(x,x),s.ae.multiply(x,u,x),x}{const x=s.ae.clone(u),w=s.ae.identity([]);return w[0]=g[0],w[1]=g[1],w[4]=g[2],w[5]=g[3],s.ae.multiply(x,x,w),h||s.ae.rotateZ(x,x,-p.angle),x}}return p.glCoordMatrix}function $r(u,r,a,h){const p=[u,r,a,1];a?s.aB.transformMat4(p,p,h):Gc(p,p,h);const m=p[3];return p[0]/=m,p[1]/=m,p[2]/=m,p}function Et(u,r){return Math.min(.5+u/r*.5,1.5)}function Uc(u,r){const a=u[0]/u[3],h=u[1]/u[3];return a>=-r[0]&&a<=r[0]&&h>=-r[1]&&h<=r[1]}function Jo(u,r,a,h,p,m,g,x,w,T){const S=a.transform,I=h?u.textSizeData:u.iconSizeData,P=s.aE(I,a.transform.zoom),z=S.projection.name==="globe",L=[256/a.width*2+1,256/a.height*2+1],k=h?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;k.clear();let O=null;z&&(O=h?u.text.globeExtVertexArray:u.icon.globeExtVertexArray);const B=u.lineVertexArray,G=h?u.text.placedSymbolArray:u.icon.placedSymbolArray,$=a.transform.width/a.transform.height;let j,J=!1;for(let Z=0;ZMath.abs(a)?{useVertical:!0}:u===s.aF.vertical?h>0?{needsFlipping:!0}:null:r!==At.unknown&&function(p,m){return p===0||Math.abs(m/p)>sr}(a,h)?r===At.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function Gi(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const $=r/24,j=u.lineOffsetX*$,J=u.lineOffsetY*$,{lineStartIndex:Z,glyphStartIndex:W,numGlyphs:ee,segment:ie,writingMode:ue,flipState:re}=u,Y=Z+u.lineLength,_e=fe=>{if(S){const[he,ve,ne]=fe.up,Me=T.length;s.aH(S,Me+0,he,ve,ne),s.aH(S,Me+1,he,ve,ne),s.aH(S,Me+2,he,ve,ne),s.aH(S,Me+3,he,ve,ne)}const[se,Ce,Se]=fe.point;s.aI(T,se,Ce,Se,fe.angle)};if(ee>1){const fe=Js($,x,j,J,a,I,P,u,w,m,z,k,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};if(h&&!a){let[se,Ce,Se]=fe.first.point,[he,ve,ne]=fe.last.point;[se,Ce]=$r(se,Ce,Se,g),[he,ve]=$r(he,ve,ne,g);const Me=jc(ue,re,(he-se)*L,ve-Ce);if(u.flipState=Me&&Me.needsFlipping?At.flipRequired:At.flipNotRequired,Me)return Me}_e(fe.first);for(let se=W+1;se0?he:yl(P,Se,se,1,p,void 0,O,B.canonical),ne=jc(ue,re,(ve[0]-se[0])*L,ve[1]-se[1]);if(u.flipState=ne&&ne.needsFlipping?At.flipRequired:At.flipNotRequired,ne)return ne}const fe=Ko($*x.getoffsetX(W),j,J,a,I,P,ie,Z,Y,w,m,z,k,!1,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};_e(fe)}return{}}function wh(u,r,a,h,p){const{x:m,y:g,z:x}=h.projectTilePoint(u.x,u.y,r);if(!p)return $r(m,g,x,a);const[w,T,S]=p(u);return $r(m+w,g+T,x+S,a)}function yl(u,r,a,h,p,m,g,x){const w=wh(u.sub(r)._unit()._add(u),x,p,g,m);return s.$.sub(w,a,w),s.$.normalize(w,w),s.$.scaleAndAdd(w,a,w,h)}function Ko(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B){const G=h?u-r:u+r;let $=G>0?1:-1,j=0;h&&($*=-1,j=Math.PI),$<0&&(j+=Math.PI);let J=x+g+($>0?0:1)|0,Z=p,W=p,ee=0,ie=0;const ue=Math.abs(G),re=[],Y=[];let _e=m,fe=_e;const se=()=>yl(fe,_e,W,ue-ee+1,S,P,k,O.canonical);for(;ee+ie<=ue;){if(J+=$,J=w)return null;if(W=Z,fe=_e,re.push(W),z&&Y.push(fe),_e=new s.P(T.getx(J),T.gety(J)),Z=I[J],!Z){const Ge=wh(_e,O.canonical,S,k,P);Z=Ge[3]>0?I[J]=Ge:se()}ee+=ie,ie=s.$.distance(W,Z)}L&&P&&(I[J]&&(Z=se(),ie=s.$.distance(W,Z)),I[J]=Z);const Ce=(ue-ee)/ie,Se=_e.sub(fe)._mult(Ce)._add(fe),he=s.$.sub([],Z,W),ve=s.$.scaleAndAdd([],W,he,Ce);let ne=[0,0,1],Me=he[0],Ae=he[1];if(B&&(ne=k.upVector(O.canonical,Se.x,Se.y),ne[0]!==0||ne[1]!==0||ne[2]!==1)){const Ge=[ne[2],0,-ne[0]],He=s.$.cross([],ne,Ge);s.$.normalize(Ge,Ge),s.$.normalize(He,He),Me=s.$.dot(he,Ge),Ae=s.$.dot(he,He)}if(a){const Ge=s.$.cross([],ne,he);s.$.normalize(Ge,Ge),s.$.scaleAndAdd(ve,ve,Ge,a*$)}const Ue=j+Math.atan2(Ae,Me);return re.push(ve),z&&Y.push(Se),{point:ve,angle:Ue,path:re,tilePath:Y,up:ne}}function co(u,r){const a=r.length,h=a+4*u;r.resize(h),r.float32.fill(-1/0,4*a,4*h)}function Gc(u,r,a){const h=r[0],p=r[1];return u[0]=a[0]*h+a[4]*p+a[12],u[1]=a[1]*h+a[5]*p+a[13],u[3]=a[3]*h+a[7]*p+a[15],u}const xl=(u,r,a)=>(1-a)*u+a*r,Ks=u=>u*u*u*u*u;class Qs{constructor(r,a,h,p,m,g,x){this.tileSize=512,this._renderWorldCopies=m===void 0||m,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=h??0,this._maxPitch=p??60,this.setProjection(g),this.setMaxBounds(x),this.width=0,this.height=0,this._center=new s.aJ(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Xs,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Yo,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const r=new Qs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,a=!1){const h=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||h)&&this._updateCameraOnTerrain(),(r||h)&&this._constrainCamera(a),this._calcMatrices()}getProjection(){return s.ai(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const a=this.projection?this.getProjection():void 0;this.projection=s.aK(this.projectionOptions);const h=this.getProjection(),p=!s.d(a,h);return p&&this._calcMatrices(),this.mercatorFromTransition=!1,p}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.aK({name:"mercator"});const a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.ay(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.av(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const a=-r*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=s.aD.create(),s.aD.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const a=s.au(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=s.ac(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const a=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,a=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!a||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const h=this._elevation;a||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&h.exaggeration()&&this._centerAltitudeValidForExaggeration!==h.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*h.exaggeration(),this._centerAltitudeValidForExaggeration=h.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=h.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],h=this.horizonLineFromTop();let p=0,m=0;for(let g=0;g{const k=s.b2(I,S,P,z,L);x.has(k)||(p.push(new s.aQ(S,I,P,z,L)),x.add(k))};for(let S=0;S0,G=P.y+10,j=I.wrap-(B?0:1),J=I.wrap+(O?0:1),Z=B?P.x-1:k-1,W=O?P.x+1:0;if(m)h[0]<0?(w(z,J,P.z,W,P.y),h[1]<0&&G&&(w(z,L,P.z,P.x,P.y+1),w(z,J,P.z,W,P.y+1)),h[1]>0&&$&&(w(z,L,P.z,P.x,P.y-1),w(z,J,P.z,W,P.y-1))):h[0]>0?(w(z,j,P.z,Z,P.y),h[1]<0&&G&&(w(z,L,P.z,P.x,P.y+1),w(z,j,P.z,Z,P.y+1)),h[1]>0&&$&&(w(z,L,P.z,P.x,P.y-1),w(z,j,P.z,Z,P.y-1))):h[1]<0&&G?w(z,L,P.z,P.x,P.y+1):$&&w(z,L,P.z,P.x,P.y-1);else{const ee=I.visibleQuadrants;1&ee&&(w(z,j,P.z,Z,P.y),$&&(w(z,L,P.z,P.x,P.y-1),w(z,j,P.z,Z,P.y-1))),2&ee&&(w(z,J,P.z,W,P.y),$&&(w(z,L,P.z,P.x,P.y-1),w(z,J,P.z,W,P.y-1))),4&ee&&(w(z,j,P.z,Z,P.y),G&&(w(z,L,P.z,P.x,P.y+1),w(z,j,P.z,Z,P.y+1))),8&ee&&(w(z,J,P.z,W,P.y),G&&(w(z,L,P.z,P.x,P.y+1),w(z,J,P.z,W,P.y+1)))}}const T=[];for(const S of p)p.some(I=>S.isChildOf(I))||T.push(S);if(p=T.filter(S=>!r.some(I=>!!(S.overscaledZ{const O=k.canonical.x+.5-P[0],B=k.canonical.y+.5-P[1];return O*O+B*Br.maxzoom&&(a=r.maxzoom);const x=this.locationCoordinate(this.center),w=this.center.lat,T=1<{const ne=new s._(he.x+25e-6,he.y,he.z),Me=new s._(he.x,he.y+25e-6,he.z),Ae=he.toLngLat(),Ue=ne.toLngLat(),Ge=Me.toLngLat(),He=this.locationCoordinate(Ae),$e=this.locationCoordinate(Ue),it=this.locationCoordinate(Ge),_t=Math.hypot($e.x-He.x,$e.y-He.y),nt=Math.hypot(it.x-He.x,it.y-He.y);return Math.sqrt(_t*nt)*W/25e-6},ie=he=>{const ve=J,ne=Z;return{aabb:s.aR(this,T,0,0,0,he,ne,ve,this.projection),zoom:0,x:0,y:0,minZ:ne,maxZ:ve,wrap:he,fullyVisible:!1}},ue=[];let re=[];const Y=a,_e=r.reparseOverscaled?h:a,fe=(O-this._centerAltitude)*k,se=he=>{if(!this._elevation||!he.tileID||!g)return;const ve=this._elevation.getMinMaxForTile(he.tileID),ne=he.aabb;ve?(ne.min[2]=ve.min,ne.max[2]=ve.max,ne.center[2]=(ne.min[2]+ne.max[2])/2):(he.shouldSplit=Se(he),he.shouldSplit||(ne.min[2]=ne.max[2]=ne.center[2]=this._centerAltitude))},Ce=(he,ve)=>{if(.707*ve{if(he.zoom=.9)return!0}else if(m&&(Me=he.aabb.distanceZ(B)*k),this.projection.isReprojectedInTileSpace&&h<=5){const nt=Math.pow(2,he.zoom),xt=ee(new s._((he.x+.5)/nt,(he.y+.5)/nt));Ae=xt>.85?1:xt}if(!g){const nt=Math.sqrt(ve*ve+ne*ne+Me*Me);let xt=(1<0;){const he=ue.pop(),ve=he.x,ne=he.y;let Me=he.fullyVisible;const Ae=()=>this.projection.name==="globe"&&(he.y===0||he.y===(1<>1),$e={aabb:g?he.aabb.quadrant(Ue):s.aR(this,T,he.zoom+1,Ge,He,he.wrap,he.minZ,he.maxZ,this.projection),zoom:he.zoom+1,x:Ge,y:He,wrap:he.wrap,fullyVisible:Me,tileID:void 0,shouldSplit:void 0,minZ:he.minZ,maxZ:he.maxZ};m&&!I&&($e.tileID=new s.aQ(he.zoom+1===Y?_e:he.zoom+1,he.wrap,he.zoom+1,Ge,He),se($e)),ue.push($e)}else{const Ue=he.zoom===Y?_e:he.zoom;if(r.minzoom&&r.minzoom>Ue)continue;let Ge=0;if(!Me){let _t=G?he.aabb.intersectsPrecise(z):he.aabb.intersectsPreciseFlat(z);if(_t===0&&Ae()){const nt=new s.aO(he.zoom,ve,ne);_t=s.aP(this,T,nt,!0).intersectsPrecise(z)}if(_t===0)continue;if(r.calculateQuadrantVisibility)if(z.containsPoint(he.aabb.center))Ge=15;else for(let nt=0;nt<4;nt++)he.aabb.quadrant(nt).intersects(z)!==0&&(Ge|=1<{const Me=[0,0,0,1],Ae=[s.a4,s.a4,0,1],Ue=this.calculateFogTileMatrix(ne.tileID.toUnwrapped());s.aB.transformMat4(Me,Me,Ue),s.aB.transformMat4(Ae,Ae,Ue);const Ge=s.aB.min([],Me,Ae),He=s.aB.max([],Me,Ae),$e=s.aS(Ge,He);if($e===0)return!0;let it=!1;const _t=this._elevation;if(_t&&$e>he&&ve!==0){const nt=this.calculateProjMatrix(ne.tileID.toUnwrapped());let xt;r.isTerrainDEM||(xt=_t.getMinMaxForTile(ne.tileID)),xt||(xt={min:Z,max:J});const Ct=s.b4(this.rotation),ii=[Ct[0]*s.a4,Ct[1]*s.a4,xt.max];s.$.transformMat4(ii,ii,nt),it=(1-ii[1])*this.height*.5he.distanceSq-ve.distanceSq).map(he=>he.tileID)}resize(r,a){this.width=r,this.height=a,this.pixelsToGLUnits=[2/r,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const a=s.au(r.lat,-s.aT,s.aT),h=this.projection.project(r.lng,a);return new s.P(h.x*this.worldSize,h.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.ay(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let h,p;const m=this.centerPoint;if(this.projection.name==="globe"){const x=this.worldSize;h=(a.x-m.x)/x,p=(a.y-m.y)/x}else{const x=this.pointCoordinate(a),w=this.pointCoordinate(m);h=x.x-w.x,p=x.y-w.y}const g=this.locationCoordinate(r);this.setLocation(new s._(g.x-h,g.y-p))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r){return this.projection.locationPoint(this,r)}locationPoint3D(r){return this.projection.locationPoint(this,r,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r){return this.coordinateLocation(this.pointCoordinate3D(r))}locationCoordinate(r,a){const h=a?s.ay(a,r.lat):void 0,p=this.projection.project(r.lng,r.lat);return new s._(p.x,p.y,h)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,a){const h=a??this._centerAltitude,p=[r.x,r.y,0,1],m=[r.x,r.y,1,1];s.aB.transformMat4(p,p,this.pixelMatrixInverse),s.aB.transformMat4(m,m,this.pixelMatrixInverse);const g=m[3];s.aB.scale(p,p,1/p[3]),s.aB.scale(m,m,1/g);const x=p[2],w=m[2];return{p0:p,p1:m,t:x===w?0:(h-x)/(w-x)}}screenPointToMercatorRay(r){const a=[r.x,r.y,0,1],h=[r.x,r.y,1,1];return s.aB.transformMat4(a,a,this.pixelMatrixInverse),s.aB.transformMat4(h,h,this.pixelMatrixInverse),s.aB.scale(a,a,1/a[3]),s.aB.scale(h,h,1/h[3]),a[2]=s.ay(a[2],this._center.lat)*this.worldSize,h[2]=s.ay(h[2],this._center.lat)*this.worldSize,s.aB.scale(a,a,1/this.worldSize),s.aB.scale(h,h,1/this.worldSize),new s.aU([a[0],a[1],a[2]],s.$.normalize([],s.$.sub([],h,a)))}rayIntersectionCoordinate(r){const{p0:a,p1:h,t:p}=r,m=s.ay(a[2],this._center.lat),g=s.ay(h[2],this._center.lat);return new s._(s.a3(a[0],h[0],p)/this.worldSize,s.a3(a[1],h[1],p)/this.worldSize,s.a3(m,g,p))}pointCoordinate(r,a=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,a)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let a=this.projection.pointCoordinate3D(this,r.x,r.y);if(a)return new s._(a[0],a[1],a[2]);let h=0,p=this.horizonLineFromTop();if(r.y>p)return this.pointCoordinate(r);const m=.02*p,g=r.clone();for(let x=0;x<10&&p-h>m;x++){g.y=s.a3(h,p,.66);const w=this.projection.pointCoordinate3D(this,g.x,g.y);w?(p=g.y,a=w):h=g.y}return a?new s._(a[0],a[1],a[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=s.aV)return!this.isPointAboveHorizon(r);const a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){const h=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,p=[r.x*this.worldSize,r.y*this.worldSize,h+r.toAltitude(),1];return s.aB.transformMat4(p,p,this.pixelMatrix),p[3]>0?new s.P(p[0]/p[3],p[1]/p[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:a}=this._edgeInsets,h=this.height-this._edgeInsets.bottom,p=this.width-this._edgeInsets.right,m=this.pointLocation3D(new s.P(a,r)),g=this.pointLocation3D(new s.P(p,r)),x=this.pointLocation3D(new s.P(p,h)),w=this.pointLocation3D(new s.P(a,h));let T=Math.min(m.lng,g.lng,x.lng,w.lng),S=Math.max(m.lng,g.lng,x.lng,w.lng),I=Math.min(m.lat,g.lat,x.lat,w.lat),P=Math.max(m.lat,g.lat,x.lat,w.lat);const z=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,k=(O,B,G,$,j)=>{const J=(O+G)/2,Z=(B+$)/2,W=new s.P(J,Z),{lng:ee,lat:ie}=this.pointLocation3D(W),ue=Math.max(0,T-ee,I-ie,ee-S,ie-P);T=Math.min(T,ee),S=Math.max(S,ee),I=Math.min(I,ie),P=Math.max(P,ie),(jz)&&(k(O,B,J,Z,j+1),k(J,Z,G,$,j+1))};if(k(a,r,p,r,1),k(p,r,p,h,1),k(p,h,a,h,1),k(a,h,a,r,1),this.projection.name==="globe"){const[O,B]=s.aW(this);O?(P=90,S=180,T=-180):B&&(I=-90,S=180,T=-180)}return new s.aj(new s.aJ(T,I),new s.aJ(S,P))}_getBoundsRectangular(r,a){const{top:h,left:p}=this._edgeInsets,m=this.height-this._edgeInsets.bottom,g=this.width-this._edgeInsets.right,x=new s.P(p,h),w=new s.P(g,h),T=new s.P(g,m),S=new s.P(p,m);let I=this.pointCoordinate(x,r),P=this.pointCoordinate(w,r);const z=this.pointCoordinate(T,a),L=this.pointCoordinate(S,a),k=(O,B)=>(B.y-O.y)/(B.x-O.x);return I.y>1&&P.y>=0?I=new s._((1-L.y)/k(L,I)+L.x,1):I.y<0&&P.y<=1&&(I=new s._(-L.y/k(L,I)+L.x,0)),P.y>1&&I.y>=0?P=new s._((1-z.y)/k(z,P)+z.x,1):P.y<0&&I.y<=1&&(P=new s._(-z.y/k(z,P)+z.x,0)),new s.aj().extend(this.coordinateLocation(I)).extend(this.coordinateLocation(P)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(z))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const a=r.visibleDemTiles.reduce((h,p)=>{if(p.dem){const m=p.dem.tree;h.min=Math.min(h.min,m.minimums[0]),h.max=Math.max(h.max,m.maximums[0])}return h},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(a.min*r.exaggeration(),a.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const a=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,h=this.height/2-a*(1-this._horizonShift);return r?Math.max(0,h):h}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-s.aT,this.maxLat=s.aT,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngI&&(x=I-T),I-Sz&&(g=z-w),z-P{for(let Se=0;Se<16;Se++)_e[Se]=xl(fe[Se],se[Se],Ce)})(x,x,w,Ks(this.pitch>=15?1:this.pitch/15))}else x=w;const T=s.ae.mul([],w,g);let S=s.ae.mul([],x,g);if(this.projection.isReprojectedInTileSpace){const ie=this.locationCoordinate(this.center),ue=s.ae.identity([]);s.ae.translate(ue,ue,[ie.x*this.worldSize,ie.y*this.worldSize,0]),s.ae.multiply(ue,ue,s.aZ(this)),s.ae.translate(ue,ue,[-ie.x*this.worldSize,-ie.y*this.worldSize,0]),s.ae.multiply(S,S,ue),s.ae.multiply(T,T,ue),this.inverseAdjustmentMatrix=s.a_(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.ae.scale([],S,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=S,this.invProjMatrix=s.ae.invert(new Float64Array(16),this.projMatrix),a){const ie=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ie[8]=2*-r.x/this.width,ie[9]=2*r.y/this.height,this.expandedFarZProjMatrix=s.ae.mul([],ie,g)}else this.expandedFarZProjMatrix=this.projMatrix;const I=s.ae.invert([],x);this.frustumCorners=s.a$.fromInvProjectionMatrix(I,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);const P=new Float32Array(16);s.ae.identity(P),s.ae.scale(P,P,[1,-1,1]),s.ae.rotateX(P,P,this._pitch),s.ae.rotateZ(P,P,this.angle);const z=s.ae.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.ae.clone(z);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;z[8]=2*-r.x/this.width,z[9]=2*(r.y+L)/this.height,this.skyboxMatrix=s.ae.multiply(P,z,P);const k=this.point,O=k.x,B=k.y,G=this.width%2/2,$=this.height%2/2,j=Math.cos(this.angle),J=Math.sin(this.angle),Z=O-Math.round(O)+j*G+J*$,W=B-Math.round(B)+j*$+J*G,ee=new Float64Array(S);if(s.ae.translate(ee,ee,[Z>.5?Z-1:Z,W>.5?W-1:W,0]),this.alignedProjMatrix=ee,S=s.ae.create(),s.ae.scale(S,S,[this.width/2,-this.height/2,1]),s.ae.translate(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.ae.create(),s.ae.scale(S,S,[1,-1,1]),s.ae.translate(S,S,[-1,-1,0]),s.ae.scale(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.ae.multiply(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.ae.invert(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.b0(this);const ie=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.$.transformMat4(ie,ie,g),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,h=this._camera.position,p=1/this.height/this._pixelsPerMercatorPixel,m=[r,r,a];s.$.scale(m,m,p),s.$.scale(h,h,-1),s.$.multiply(h,h,m);const g=s.ae.create();s.ae.translate(g,g,h),s.ae.scale(g,g,m),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,p)}_computeCameraPosition(r){const a=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,h=this._camera.forward(),p=this.point,m=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*a-r/this.worldSize*this._centerAltitude;return[p.x/this.worldSize-h[0]*m,p.y/this.worldSize-h[1]*m,r/this.worldSize*this._centerAltitude-h[2]*m]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),h=this._camera.position[2],p=r[2];let m=1;this.projection.wrap&&(this.center=this.center.wrap()),p>0&&(m=Math.min((a-h)/p,1)),this._camera.position=s.$.scaleAndAdd([],this._camera.position,r,m),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,a=this._camera.forward(),{pitch:h,bearing:p}=this._camera.getPitchBearing(),m=s.ay(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.ac(this._maxPitch)),x=Math.max((r[2]-m)/Math.cos(h),g),w=this._zoomFromMercatorZ(x);s.$.scaleAndAdd(r,r,a,x),this._pitch=s.au(h,s.ac(this.minPitch),s.ac(this.maxPitch)),this.angle=s.av(p,-Math.PI,Math.PI),this._setZoom(s.au(w,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s._(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(r*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,h=s.aV,p=0,m=1/0;for(;h-a>1e-6&&h>a;){const g=a+.5*(h-a),x=this.tileSize*Math.pow(2,g),w=this.getCameraToCenterDistance(this.projection,g,x),T=this.scaleZoom(w/(r*this.tileSize)),S=Math.abs(g-T);ST||P.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.b1(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(r,a){const h=s.$.length(s.$.sub([],this._camera.position,r)),p=this._zoomFromMercatorZ(h)+a;return h-this._mercatorZfromZoom(p)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([a,h,p],m){const g=[a,h,p,1];s.aB.transformMat4(g,g,m);const x=g[3]=Math.max(g[3],1e-6);return g[0]/=x,g[1]/=x,g[2]/=x,g}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,r))}}getCameraToCenterDistance(r,a=this.zoom,h=this.worldSize){const p=s.aY(r,a,this.width,this.height,1024),m=r.pixelSpaceConversion(this.center.lat,h,p);let g=.5/Math.tan(.5*this._fov)*this.height*m;return this.isOrthographic&&(g=xl(1,g,Ks(this.pitch>=15?1:this.pitch/15))),g}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.ae.multiply(r,r,this.globeMatrix),r}getFrustum(r){return s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const $i={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},ar=(u,r)=>{if(r>0&&u.terrain&&s.w("Cutoff is currently disabled on terrain"),r<=0||u.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const a=u.transform,h=Math.max(Math.abs(a._zoom-(u.minCutoffZoom-1)),1),p=a.isLODDisabled(!1)?s.a0(60,45,a.pitch):s.a0(30,15,a.pitch),m=a._farZ-a._nearZ,g=r*a.height,x=((1-(w=p))*a.cameraToCenterDistance+w*(a._farZ+g))*h;var w;return{shouldRenderCutoff:p<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(x-a._nearZ)/m,(x-g-a._nearZ)/m]}}},qi={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class vi{constructor(r,a){this.aabb=r,this.lastCascade=a}}class Fn{add(r,a){const h=this.receivers[r.key];h!==void 0?(h.aabb.min[0]=Math.min(h.aabb.min[0],a.min[0]),h.aabb.min[1]=Math.min(h.aabb.min[1],a.min[1]),h.aabb.min[2]=Math.min(h.aabb.min[2],a.min[2]),h.aabb.max[0]=Math.max(h.aabb.max[0],a.max[0]),h.aabb.max[1]=Math.max(h.aabb.max[1],a.max[1]),h.aabb.max[2]=Math.max(h.aabb.max[2],a.max[2])):this.receivers[r.key]=new vi(a,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,a,h){const p=s.b8.fromPoints(r.points);let m=0;for(const g in this.receivers){const x=this.receivers[g];if(!x||!p.intersectsAabb(x.aabb))continue;x.aabb.min=p.closestPoint(x.aabb.min),x.aabb.max=p.closestPoint(x.aabb.max);const w=x.aabb.getCorners();for(let T=0;T1||P[1]<-1||P[1]>1){S=!1;break}}if(x.lastCascade=T,m=Math.max(m,T),S)break}}return m+1}}class Ep{constructor(r){this.painter=r,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Fn,this._depthMode=new s.af(r.context.gl.LEQUAL,s.af.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,r.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),r.tp.registerParameter(qi,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),r.tp.registerParameter(qi,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),r.tp.registerParameter(qi,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),r.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){const h=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!a||!a.properties)return;const p=a.properties.get("shadow-intensity");if(!a.shadowsEnabled()||p<=0||(this._shadowLayerCount=h.style.order.reduce((L,k)=>{const O=h.style._mergedLayers[k];return L+(O.hasShadowPass()&&!O.isHidden(r.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const m=h.context,g=qi.shadowMapResolution,x=qi.shadowMapResolution;if(this._cascades.length===0||qi.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let L=0;LO.dem).forEach(O=>{const B=O.dem.tree;k[0]=Math.min(k[0],B.minimums[0]),k[1]=Math.max(k[1],B.maximums[0])}),k[0]!==1e4&&(w=(k[1]-k[0])*L.exaggeration())}const T=1.5*r.cameraToCenterDistance,S=3*T,I=new Float64Array(16);for(let L=0;L=0)return{};const m=function(w,T,S){const I=S/(1<0&&(s.$.add(m[1],m[1],[p[0]*g,0,0]),s.$.add(m[2],m[2],[p[0]*g,0,0])),p[1]<0?(s.$.add(m[0],m[0],[0,p[1]*g,0]),s.$.add(m[1],m[1],[0,p[1]*g,0])):p[1]>0&&(s.$.add(m[2],m[2],[0,p[1]*g,0]),s.$.add(m[3],m[3],[0,p[1]*g,0]));const x={};return x.vertices=m,x.planes=[Qo(m[1],m[0],m[4]),Qo(m[2],m[1],m[5]),Qo(m[3],m[2],m[6]),Qo(m[0],m[3],m[7])],x}addShadowReceiver(r,a,h){this._receivers.add(r,s.b8.fromTileIdAndHeight(r,a,h))}getMaxCascadeForTile(r){const a=this._receivers.get(r);return a&&a.lastCascade?a.lastCascade:0}}function Qo(u,r,a){const h=s.$.sub([],a,r),p=s.$.sub([],u,r),m=s.$.cross([],h,p),g=s.$.length(m);return g===0?[0,0,1,0]:(s.$.scale(m,m,1/g),[m[0],m[1],m[2],-s.$.dot(m,r)])}function es(u){const r=u.properties.get("direction"),a=s.ad(r.x,r.y,r.z);a[2]=s.au(a[2],0,75);const h=s.b9([a[0],a[1],a[2]]);return s.$.fromValues(h.x,h.y,h.z)}function ea(u,r,a){const h=r.properties.get("color"),p=r.properties.get("intensity"),m=r.properties.get("direction"),g=[m.x,m.y,m.z],x=a.properties.get("color"),w=a.properties.get("intensity"),T=Math.max(s.$.dot([0,0,1],g),0),S=[0,0,0];s.$.scale(S,x.toRenderColor(u.getLut(r.scope)).toArray01Linear().slice(0,3),w);const I=[0,0,0];return s.$.scale(I,h.toRenderColor(u.getLut(a.scope)).toArray01Linear().slice(0,3),T*p),s.ba([S[0]>0?S[0]/(S[0]+I[0]):0,S[1]>0?S[1]/(S[1]+I[1]):0,S[2]>0?S[2]/(S[2]+I[2]):0])}function $c(u,r,a,h,p,m){const g=u.zoom,x=u.scale,w=u.worldSize,T=1/w,S=u.aspect,I=Math.sqrt(1+S*S)*Math.tan(.5*u.fovX),P=I*I,z=h-a,L=h+a;let k,O;P>z/L?(k=h,O=h*I):(k=.5*L*(1+P),O=.5*Math.sqrt(z*z+2*(h*h+a*a)*P+L*L*P*P));const B=u.projection.pixelsPerMeter(u.center.lat,w),G=u._camera.getCameraToWorldMercator(),$=[0,0,-k*T];s.$.transformMat4($,$,G);let j=O*T;const J=u._edgeInsets;if(!(J.left===0&&J.top===0&&J.right===0&&J.bottom===0||J.left===J.right&&J.top===J.bottom)){const Me=u._camera.getWorldToCamera(u.worldSize,u.projection.zAxisUnit==="meters"?B:1),Ae=u._camera.getCameraToClipPerspective(u._fov,u.width/u.height,a,h);Ae[8]=2*-u.centerOffset.x/u.width,Ae[9]=2*u.centerOffset.y/u.height;const Ue=new Float64Array(16);s.ae.mul(Ue,Ae,Me);const Ge=new Float64Array(16);s.ae.invert(Ge,Ue);const He=s.aM.fromInvProjectionMatrix(Ge,w,g,!0);for(const $e of He.points){const it=((Z=$e)[0]/=x,Z[1]/=x,Z[2]=s.ay(Z[2],u._center.lat),Z);j=Math.max(j,s.$.len(s.$.subtract([],$,it)))}}var Z;j*=p/(p-1);const W=Math.acos(r[2]),ee=Math.atan2(-r[0],-r[1]),ie=new Yo;ie.position=$,ie.setPitchBearing(W,ee);const ue=ie.getWorldToCamera(w,B),re=j*w,Y=Math.min(u._mercatorZfromZoom(17)*w*-2,-2*re),_e=ie.getCameraToClipOrthographic(-re,re,-re,re,Y,(re+m*B)/r[2]),fe=new Float64Array(16);s.ae.multiply(fe,_e,ue);const se=s.$.fromValues(Math.floor(1e6*$[0])/1e6*w,Math.floor(1e6*$[1])/1e6*w,0),Ce=.5*p,Se=[0,0,0];s.$.transformMat4(Se,se,fe),s.$.scale(Se,Se,Ce);const he=[Math.floor(Se[0]),Math.floor(Se[1]),Math.floor(Se[2])],ve=[0,0,0];s.$.sub(ve,Se,he),s.$.scale(ve,ve,-1/Ce);const ne=new Float64Array(16);return s.ae.identity(ne),s.ae.translate(ne,ne,ve),s.ae.multiply(fe,ne,fe),[fe,re]}function ta(u,r){return u!=null&&r!=null&&!(!u.hasData()||!r.hasData())&&u.demTexture!=null&&r.demTexture!=null&&u.tileID.key!==r.tileID.key}const Nn=new class{constructor(){this.operations={}}newMorphing(u,r,a,h,p){if(u in this.operations){const m=this.operations[u];m.to.tileID.key!==a.tileID.key&&(m.queued=a)}else this.operations[u]={startTime:h,phase:0,duration:p,from:r,to:a,queued:null}}getMorphValuesForProxy(u){if(!(u in this.operations))return null;const r=this.operations[u];return{from:r.from,to:r.to,phase:r.phase}}update(u){for(const r in this.operations){const a=this.operations[r];for(a.phase=(u-a.startTime)/a.duration;a.phase>=1||!this._validOp(a);)if(!this._nextOp(a,u)){delete this.operations[r];break}}}_nextOp(u,r){return!!u.queued&&(u.from=u.to,u.to=u.queued,u.queued=null,u.phase=0,u.startTime=r,!0)}_validOp(u){return u.from.hasData()&&u.to.hasData()}},ia={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Vn(u,r,a){if(r===0)return 0;const h=r<1&&a===514?.25/r:1;return 6*Math.pow(1.5,22-u)*Math.max(r,1)*h}function ra(u,r){const a=1<({u_matrix:u});function vl(u,r,a,h,p){if(p>0){const m=s.e.now(),g=(m-u.timeAdded)/p,x=r?(m-r.timeAdded)/p:-1,w=a.getSource(),T=h.coveringZoomLevel({tileSize:w.tileSize,roundZoom:w.roundZoom}),S=!r||Math.abs(r.tileID.overscaledZ-T)>Math.abs(u.tileID.overscaledZ-T),I=S&&u.refreshedUponExpiration?1:s.au(S?g:1-x,0,1);return u.refreshedUponExpiration&&g>=1&&(u.refreshedUponExpiration=!1),r?{opacity:1,mix:1-I}:{opacity:I,mix:0}}return{opacity:1,mix:0}}class Un extends fr{constructor(r,a,h,p){super(r,a,h,p),this.type="raster-array",this.maxzoom=22,this._options=s.Q({type:"raster-array"},a)}triggerRepaint(r){const a=this.map.painter._terrain,h=this.map.style.getSourceCache(this.id);a&&a.enabled&&h&&a._clearRenderCacheForTile(h.id,r.tileID),this.map.triggerRepaint()}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(h,s.R.Tile);r.requestParams=p,r.actor||(r.actor=this.dispatcher.getActor()),r.request=r.fetchHeader(void 0,(m,g,x,w)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(m)return m.code===20?void 0:(r.state="errored",a(m));this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:w}),r.state="empty",a(null)})}unloadTile(r,a){const h=r.texture;h&&h instanceof s.T?(r.destroy(!0),this.map.painter.saveTileTexture(h)):(r.destroy(),r.flushQueues(),r._isHeaderLoaded=!1,delete r._mrt,delete r.textureDescriptor),r.fbo&&(r.fbo.destroy(),delete r.fbo),delete r.request,delete r.requestParams,delete r.neighboringTiles,r.state="unloaded"}prepareTile(r,a,h){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBand(a,h,(p,m)=>{if(p)return r.state="errored",this.fire(new s.f(p)),void this.triggerRepaint(r);m&&(r.setTexture(m,this.map.painter),r.state="loaded",this.triggerRepaint(r))}))}getInitialBand(r){if(!this.rasterLayers)return 0;const a=this.rasterLayers.find(({id:m})=>m===r),h=a&&a.fields,p=h&&h.bands&&h.bands;return p?p[0]:0}getTextureDescriptor(r,a,h){if(!r)return;const p=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!p)return;let m=null;a instanceof s.bm?m=a.paint.get("raster-array-band"):a instanceof s.bn&&(m=a.paint.get("raster-particle-array-band"));const g=m||this.getInitialBand(p);if(g!=null)if(r.textureDescriptor){if(!r.updateNeeded(p,g)||h)return Object.assign({},r.textureDescriptor,{texture:r.texture})}else this.prepareTile(r,p,g)}}const bl={vector:xh,raster:fr,"raster-dem":class extends fr{constructor(u,r,a,h){super(u,r,a,h),this.type="raster-dem",this.maxzoom=22,this._options=s.Q({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function h(p,m){p&&(u.state="errored",r(p)),m&&(u.dem=m,u.dem.onDeserialize(),u.needsHillshadePrepare=!0,u.needsDEMTextureUpload=!0,u.state="loaded",r(null))}u.request=s.i(this.map._requestManager.transformRequest(a,s.R.Tile),function(p,m,g,x){if(delete u.request,u.aborted)u.state="unloaded",r(null);else if(p)u.state="errored",r(p);else if(m){this.map._refreshExpiredTiles&&u.setExpiryData({cacheControl:g,expires:x});const w=ImageBitmap&&m instanceof ImageBitmap&&s.bk(),T=1-(m.width-s.bl(m.width))/2;T<1||u.neighboringTiles||(u.neighboringTiles=this._getNeighboringTiles(u.tileID));const S=w?m:s.e.getImageData(m,T),I={uid:u.uid,coord:u.tileID,source:this.id,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};u.actor&&u.state!=="expired"||(u.actor=this.dispatcher.getActor(),u.actor.send("loadDEMTile",I,h.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(u){const r=u.canonical,a=Math.pow(2,r.z),h=(r.x-1+a)%a,p=r.x===0?u.wrap-1:u.wrap,m=(r.x+1+a)%a,g=r.x+1===a?u.wrap+1:u.wrap,x={};return x[new s.aQ(u.overscaledZ,p,r.z,h,r.y).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,g,r.z,m,r.y).key]={backfilled:!1},r.y>0&&(x[new s.aQ(u.overscaledZ,p,r.z,h,r.y-1).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,u.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,g,r.z,m,r.y-1).key]={backfilled:!1}),r.y+1{if(this._loaded=!0,this._pendingLoad=null,h)this.fire(new s.f(h));else{const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&p&&p.resourceTiming&&p.resourceTiming[this.id]&&(m.resourceTiming=p.resourceTiming[this.id]),u&&(this._partialReload=!0),this.fire(new s.g("data",m)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(u),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(u,r){const a=u.actor?"reloadTile":"loadTile";u.actor=this.actor;const h=this.map.style?this.map.style.getLut(this.scope):null,p=this._partialReload,m={type:this.type,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:h?{image:h.image.clone()}:null,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:p};u.request=this.actor.send(a,m,(g,x)=>p&&!x?(u.state="loaded",r(null)):(delete u.request,u.destroy(),u.aborted?r(null):g?r(g):(u.loadVectorData(x,this.map.painter,a==="reloadTile"),r(null))),void 0,a==="loadTile")}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.aborted=!0}unloadTile(u,r){this.actor.send("removeTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),u.destroy()}onRemove(u){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.Q({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.bo{constructor(u,r,a,h){super(u,r,a,h),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const u=this.options;this.urls=[];for(const r of u.urls)this.urls.push(this.map._requestManager.transformRequest(r,s.R.Source).url);s.bp(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new s.f(r)):a&&(this.video=a,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(u){if(this.video){const r=this.video.seekable;ur.end(0)?this.fire(new s.f(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const u=this.map.painter.context,r=u.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(u,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(u)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.bo,model:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="model",this.models=[],this._loaded=!1,this._options=r}load(){const u=[];for(const r in this._options.models){const a=this._options.models[r],h=s.l(this.map._requestManager.transformRequest(a.uri,s.R.Model).url).then(p=>{if(!p)return;const m=s.c(p),g=new s.M(r,a.position,a.orientation,m);g.computeBoundsAndApplyParent(),this.models.push(g)}).catch(p=>{this.fire(new s.f(new Error(`Could not load model ${r} from ${a.uri}: ${p.message}`)))});u.push(h)}return Promise.allSettled(u).then(()=>{this._loaded=!0,this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(r=>{this.fire(new s.f(new Error(`Could not load models: ${r.message}`)))})}onAdd(u){this.map=u,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(u,r){}serialize(){return{type:"model"}}},"batched-model":class extends s.E{constructor(u,r,a,h){super(),this.type="batched-model",this.id=u,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(h)}onAdd(u){this.map=u,this.load()}load(u){this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=Nc(this._options,this.map._requestManager,r,a,(h,p)=>{this._tileJSONRequest=null,this._loaded=!0,h?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&a.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new s.f(h))):p&&(s.Q(this,p),p.bounds&&(this.tileBounds=new Hs(p.bounds,this.minzoom,this.maxzoom)),s.ao(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),u&&u(h)})}hasTransition(){return!1}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loaded(){return this._loaded}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme)),h={request:this.map._requestManager.transformRequest(a,s.R.Tile),data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:u.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(u.actor&&u.state!=="expired")if(u.state==="loading")u.reloadCallback=r;else{if(u.buckets){const m=Object.values(u.buckets);for(const g of m)g.dirty=!0;return void(u.state="loaded")}u.request=u.actor.send("reloadTile",h,p.bind(this))}else u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",h,p.bind(this),void 0,!0);function p(m,g){return u.aborted?r(null):m&&m.status!==404?r(m):(g&&(g.resourceTiming&&(u.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&u.setExpiryData(g),u.buckets={...u.buckets,...g.buckets},g.featureIndex&&(u.latestFeatureIndex=g.featureIndex)),u.state="loaded",void r(null))}}serialize(){return s.Q({},this._options)}},canvas:class extends s.bo{constructor(u,r,a,h){super(u,r,a,h),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new s.f(new s.V(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.f(new s.V(`sources.${u}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new s.f(new s.V(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new s.f(new s.V(`sources.${u}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.f(new s.V(`sources.${u}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.f(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(u){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!u&&!this._playing||this.texture instanceof s.bq||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}},custom:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(h),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.f(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.f(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Hs(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),s.Q(this,s.ai(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.ai(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(u){this.map=u,this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(u),this.load()}onRemove(u){this._implementation.onRemove&&this._implementation.onRemove(u)}hasTile(u){if(this._implementation.hasTile){const{x:r,y:a,z:h}=u.canonical;return this._implementation.hasTile({x:r,y:a,z:h})}return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,r){const{x:a,y:h,z:p}=u.tileID.canonical,m=new AbortController;u.request=Promise.resolve(this._implementation.loadTile({x:a,y:h,z:p},{signal:m.signal})).then(function(g){return delete u.request,u.aborted?(u.state="unloaded",r(null)):g===void 0?(u.state="errored",r(null)):g===null?(this.loadTileData(u,{width:this.tileSize,height:this.tileSize,data:null}),u.state="loaded",r(null)):function(x){return x instanceof ImageData||x instanceof HTMLCanvasElement||x instanceof ImageBitmap||x instanceof HTMLImageElement}(g)?(this.loadTileData(u,g),u.state="loaded",void r(null)):(u.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(g=>{g.code!==20&&(u.state="errored",r(g))}),u.request.cancel=()=>m.abort()}loadTileData(u,r){u.setTexture(r,this.map.painter)}unloadTile(u,r){if(u.texture&&u.texture instanceof s.T?(u.destroy(!0),u.texture&&u.texture instanceof s.T&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),this._implementation.unloadTile){const{x:a,y:h,z:p}=u.tileID.canonical;this._implementation.unloadTile({x:a,y:h,z:p})}r&&r()}abortTile(u,r){u.request&&u.request.cancel&&(u.request.cancel(),delete u.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(u=>({x:u.canonical.x,y:u.canonical.y,z:u.canonical.z}))}_clearTiles(){const u=s.am(this.id,this.scope);this.map.style.clearSource(u)}_update(){this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))}}},wl=function(u,r,a,h){const p=new bl[r.type](u,r,a,h);if(p.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${p.id}`);return s.br(["load","abort","unload","serialize","prepare"],p),p};class Th extends s.bx{constructor(r){const a={type:"raster-dem",maxzoom:r.transform.maxZoom},h=new s.by(s.bz(),null),p=wl("mock-dem",a,h,r.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,a){r.state="loaded",a(null)}}class Eh extends s.bx{constructor(r){const a=wl("proxy",{type:"geojson",maxzoom:r.transform.maxZoom},new s.by(s.bz(),null),r.style);super("proxy",a,!1),a.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,h){if(r.freezeTileCoverage)return;this.transform=r;const p=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,g)=>{if(m[g.key]="",!this._tiles[g.key]){const x=new s.bA(g,this._source.tileSize*g.overscaleFactor(),r.tileZoom);x.state="loaded",this._tiles[g.key]=x}return m},{});for(const m in this._tiles)m in p||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(r){const a=this.proxyCachedFBO[r];if(a!==void 0){const h=Object.values(a);this.renderCachePool.push(...h),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class qc extends s.aQ{constructor(r,a,h){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=a,this.projMatrix=h}}class Zi extends s.bs{constructor(r,a){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},r.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[h,p,m]=function(w){const T=new s.bv,S=new s.bw,I=131;T.reserve(17161),S.reserve(33800);const P=s.a4/128,z=s.a4+P/2,L=z+P;for(let O=-P;Oz||O<0||O>z?24575:0,$=s.au(Math.round(B),0,s.a4),j=s.au(Math.round(O),0,s.a4);T.emplaceBack($+G,j)}const k=(O,B)=>{const G=B*I+O;S.emplaceBack(G+1,G,G+I),S.emplaceBack(G+I,G+I+1,G+1)};for(let O=1;O<129;O++)for(let B=1;B<129;B++)k(B,O);return[0,129].forEach(O=>{for(let B=0;B<130;B++)k(B,O),k(O,B)}),[T,S,32768]}(),g=r.context;this.gridBuffer=g.createVertexBuffer(h,s.bt.members),this.gridIndexBuffer=g.createIndexBuffer(p),this.gridSegments=s.b.simpleSegment(0,0,h.length,p.length),this.gridNoSkirtSegments=s.b.simpleSegment(0,0,h.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Eh(a.map),this.orthoMatrix=s.ae.create(),s.ae.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.a4,0,s.a4,0,1);const x=g.gl;this._overlapStencilMode=new s.ah({func:x.GEQUAL,mask:255},0,255,x.KEEP,x.KEEP,x.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Th(a.map),this._pendingGroundEffectLayers=[]}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,h){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const p=r.terrain.properties,m=r.terrain.drapeRenderMode===0,g=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.e.now();const x=r.terrain&&r.terrain.scope,w=p.get("source"),T=m?this._mockSourceCache:r.getSourceCache(w,x);if(!T)return void s.w(`Couldn't find terrain source "${w}".`);if(this.sourceCache=T,this._exaggeration=g?this.calculateExaggeration(a):p.get("exaggeration"),!a.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. -This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const I=this.getScaledDemTileSize();this.sourceCache.update(a,I,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),a.updateElevation(!0,h),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){const a=this._previousCameraAltitude,h=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=h;const p=a!=null?h-a:Number.MAX_VALUE;if(Math.abs(p)<2)return this._exaggeration;const m=r.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(m);let x=m-this._previousZoom;const w=this._previousUpdateTimestamp;let T=m;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(m-T)>.5&&(x=.5*(m-T+x)),x*p<0&&(T+=x)),this._evaluationZoom=T;const S=g.getExaggeration(T),I=S===g.getExaggeration(Math.max(0,T-.1));if(I&&Math.abs(S-this._exaggeration)<.01)return S;let P=Math.min(.1,.00375*(this._updateTimestamp-w));return(I||S<.1||Math.abs(x)<1e-4)&&(P=Math.min(.2,4*P)),s.a3(this._exaggeration,S,P)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.coord&&r.dataType==="source"?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const a=this.proxySourceCache,h=this.painter.transform;this._initializing&&(this._initializing=h._centerAltitude===0&&this.getAtPointOrZero(s._.fromLngLat(h.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const p=this.proxyCoords=a.getIds().map(w=>{const T=a.getTileByID(w).tileID;return T.projMatrix=h.calculateProjMatrix(T.toUnwrapped()),T});(function(w,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),I=new s.P(S.x,S.y);w.sort((P,z)=>{if(z.overscaledZ-P.overscaledZ)return z.overscaledZ-P.overscaledZ;const L=new s.P(P.canonical.x+(1<{this.proxyToSource[w.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const w in g){const T=g[w];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,r[w],m),T.usedForTerrain))continue;const S=r[w];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[a.id]=p.map(w=>new qc(w,w.key,this.orthoMatrix)),this._assignTerrainTiles(p),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const x={};this._visibleDemTiles=[];for(const w of this.proxyCoords){const T=this.terrainTileForTile[w.key];if(!T)continue;const S=T.tileID.key;S in x||(this._visibleDemTiles.push(T),x[S]=S)}}_assignTerrainTiles(r){this._initializing||r.forEach(a=>{if(this.terrainTileForTile[a.key])return;const h=this._findTileCoveringTileID(a,this.sourceCache);h&&(this.terrainTileForTile[a.key]=h)})}_prepareDEMTextures(){const r=this.painter.context,a=r.gl;for(const h in this.terrainTileForTile){const p=this.terrainTileForTile[h],m=p.dem;!m||p.demTexture&&!p.needsDEMTextureUpload||(r.activeTexture.set(a.TEXTURE1),yh(this.painter,p,m))}}_prepareDemTileUniforms(r,a,h,p){if(!a||a.demTexture==null)return!1;const m=r.tileID.canonical,g=Math.pow(2,a.tileID.canonical.z-m.z),x=p||"";return h[`u_dem_tl${x}`]=[m.x*g%1,m.y*g%1],h[`u_dem_scale${x}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let r=0;const a=this._visibleDemTiles.reduce((h,p)=>{if(!p.dem)return h;const m=p.dem.tree.minimums[0];return m>0&&r++,h+m},0);return r?a/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);const h=this._getLoadedAreaMinimum(),[p,m]=(()=>{const x=new s.bB({width:1,height:1},new Float32Array([h]));return[a.R32F,x]})();this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(m,{premultiply:!1}):g=this._emptyDEMTexture=new s.T(r,m,p,{premultiply:!1}),g}setupElevationDraw(r,a,h){const p=this.painter.context,m=p.gl,g={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};g.u_exaggeration=this.exaggeration();let x=null,w=null,T=1;if(h&&h.morphing&&this._useVertexMorphing){const z=h.morphing.srcDemTile,L=h.morphing.dstDemTile;T=h.morphing.phase,z&&L&&(this._prepareDemTileUniforms(r,z,g,"_prev")&&(w=z),this._prepareDemTileUniforms(r,L,g)&&(x=L))}const S=z=>z&&z.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let I=null;var P;if(this.enabled?w&&x?(I=x.demTexture,p.activeTexture.set(m.TEXTURE4),w.demTexture.bind(S(w),m.CLAMP_TO_EDGE),g.u_dem_lerp=T):(x=this.terrainTileForTile[r.tileID.key],I=this._prepareDemTileUniforms(r,x,g)?x.demTexture:this.emptyDEMTexture):I=this.emptyDEMTexture,p.activeTexture.set(m.TEXTURE2),I&&(g.u_dem_size=(P=I).size[0]===1?1:P.size[0]-2,I.bind(S(x),m.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(h&&h.useDepthForOcclusion,a,g),h&&h.useMeterToDem&&x){const z=(1<{if(B===fe)return;const se=[ia[fe],"PROJECTION_GLOBE_VIEW"];$&&se.push("CUSTOM_ANTIALIASING");const Ce=T.isTileAffectedByFog(_e);O=T.getOrCreateProgram("globeRaster",{defines:se,overrideFog:Ce}),B=fe},J=T.colorModeForRenderPass(),Z=new s.af(k.LEQUAL,s.af.ReadWrite,T.depthRangeFor3D);Nn.update(z);const W=s.bd(G),ee=[s.ak(G.center.lng),s.al(G.center.lat)],ie=T.globeSharedBuffers,ue=[G.width*s.e.devicePixelRatio,G.height*s.e.devicePixelRatio],re=Float32Array.from(G.globeMatrix),Y={useDenormalizedUpVectorScale:!0};{const _e=T.transform,fe=Vn(_e.zoom,S.exaggeration(),S.sourceCache._source.tileSize);B=-1;const se=k.TRIANGLES;for(const Ce of P){const Se=I.getTile(Ce),he=s.ah.disabled,ve=S.prevTerrainTileForTile[Ce.key],ne=S.terrainTileForTile[Ce.key];ta(ve,ne)&&Nn.newMorphing(Ce.key,ve,ne,z,250),L.activeTexture.set(k.TEXTURE0),Se.texture&&Se.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE);const Me=Nn.getMorphValuesForProxy(Ce.key),Ae=Me?1:0;Me&&s.q(Y,{morphing:{srcDemTile:Me.from,dstDemTile:Me.to,phase:s.bb(Me.phase)}});const Ue=s.be(Ce.canonical),Ge=s.bf(Ue.getCenter().lat),He=s.bg(Ce.canonical,Ue,Ge,_e.worldSize/_e._pixelsPerMercatorPixel),$e=s.bh(s.bi(Ce.canonical)),it=Vc(_e.expandedFarZProjMatrix,re,W,$e,s.a2(_e.zoom),ee,_e.frustumCorners.TL,_e.frustumCorners.TR,_e.frustumCorners.BR,_e.frustumCorners.BL,_e.globeCenterInViewSpace,_e.globeRadius,ue,fe,_e._farZ,He);if(j(Ce,Ae),O&&(S.setupElevationDraw(Se,O,Y),T.uploadCommonUniforms(L,O,Ce.toUnwrapped()),ie)){const[_t,nt,xt]=ie.getGridBuffers(Ge,fe!==0);O.draw(T,se,Z,he,J,s.ag.backCCW,it,"globe_raster",_t,nt,xt)}}}if(ie&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const _e=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];$&&_e.push("CUSTOM_ANTIALIASING"),O=T.getOrCreateProgram("globeRaster",{defines:_e});for(const fe of P){const{x:se,y:Ce,z:Se}=fe.canonical,he=Ce===0,ve=Ce===(1<_t.draw(T,k.TRIANGLES,Z,s.ah.disabled,J,s.ag.disabled,Vc(G.expandedFarZProjMatrix,He,He,$e,0,ee,G.frustumCorners.TL,G.frustumCorners.TR,G.frustumCorners.BR,G.frustumCorners.BL,G.globeCenterInViewSpace,G.globeRadius,ue,0,G._farZ),"globe_pole_raster",nt,Ae,Ue);S.setupElevationDraw(Ge,O,Y),T.uploadCommonUniforms(L,O,fe.toUnwrapped()),he&&T.renderDefaultNorthPole&&it(O,ne),ve&&T.renderDefaultSouthPole&&(He=s.ae.scale(s.ae.create(),He,[1,-1,1]),it(O,Me))}}}})(p,m,g,x,w);else{const T=p.context,S=T.gl;let I,P;const z=p.shadowRenderer,L=ar(p,p.longestCutoffRange),k=J=>{if(P===J)return;const Z=[];Z.push(ia[J]),L.shouldRenderCutoff&&Z.push("RENDER_CUTOFF"),I=p.getOrCreateProgram("terrainRaster",{defines:Z}),P=J},O=p.colorModeForRenderPass(),B=new s.af(S.LEQUAL,s.af.ReadWrite,p.depthRangeFor3D);Nn.update(w);const G=p.transform,$=Vn(G.zoom,m.exaggeration(),m.sourceCache._source.tileSize);let j=[0,0,0];if(z){const J=p.style.directionalLight,Z=p.style.ambientLight;J&&Z&&(j=ea(p.style,J,Z))}{P=-1;const J=S.TRIANGLES,[Z,W]=[m.gridIndexBuffer,m.gridSegments];for(const ee of x){const ie=g.getTile(ee),ue=s.ah.disabled,re=m.prevTerrainTileForTile[ee.key],Y=m.terrainTileForTile[ee.key];ta(re,Y)&&Nn.newMorphing(ee.key,re,Y,w,250),T.activeTexture.set(S.TEXTURE0),ie.texture&&ie.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const _e=Nn.getMorphValuesForProxy(ee.key),fe=_e?1:0;let se;_e&&(se={morphing:{srcDemTile:_e.from,dstDemTile:_e.to,phase:s.bb(_e.phase)}});const Ce=vh(ee.projMatrix,ra(ee.canonical,G.renderWorldCopies)?$/10:$,j);if(k(fe),!I)continue;m.setupElevationDraw(ie,I,se);const Se=ee.toUnwrapped();z&&z.setupShadows(Se,I),p.uploadCommonUniforms(T,I,Se,null,L),I.draw(p,J,B,ue,O,s.ag.backCCW,Ce,"terrain_raster",m.gridBuffer,Z,W)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const a=this.painter,h=this.painter.context,p=this.proxySourceCache,m=this.proxiedCoords[p.id],g=this._drapedRenderBatches.shift(),x=a.style.order,w=[];let T=0;for(const S of m){const I=p.getTileByID(S.proxyTileKey),P=p.proxyCachedFBO[S.key]?p.proxyCachedFBO[S.key][r]:void 0,z=P!==void 0?p.renderCache[P]:this.pool[T++],L=P!==void 0;if(I.texture=z.tex,L&&!z.dirty){w.push(I.tileID);continue}let k;h.bindFramebuffer.set(z.fb.framebuffer),this.renderedToTile=!1,z.dirty&&(h.clear({color:s.C.transparent,stencil:0}),z.dirty=!1);for(let O=g.start;O<=g.end;++O){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),$=G?this.proxyToSource[S.key][G.id]:[S];if(!$)continue;const j=$;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,$,B,G),k=G?G.id:null),a.renderLayer(a,G,B,j)}if(this._drapedRenderBatches.length===0)for(const O of this._pendingGroundEffectLayers){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),$=G?this.proxyToSource[S.key][G.id]:[S];if(!$)continue;const j=$;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,$,B,G),k=G?G.id:null),a.renderLayer(a,G,B,j)}this.renderedToTile?(z.dirty=!0,w.push(I.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(w))}return this.renderToBackBuffer(w),this.renderingToTexture=!1,h.bindFramebuffer.set(null),h.viewport.set([0,0,a.width,a.height]),g.end+1}postRender(){}isLayerOrderingCorrect(r){const a=r.order.length;let h=-1,p=a;for(let m=0;mh}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(a=>a.dem).forEach(a=>{r=Math.min(r,a.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,a,h){if(!this._visibleDemTiles)return null;const p=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const g=m.tileID,x=1<(m.t!==null?m.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const m of p){if(m.t==null)return null;const g=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,r,a,h);if(g!=null)return g}return null}_createFBO(){const r=this.painter.context,a=r.gl,h=this.drapeBufferSize;r.activeTexture.set(a.TEXTURE0);const p=new s.T(r,{width:h[0],height:h[1],data:null},a.RGBA);p.bind(a.LINEAR,a.CLAMP_TO_EDGE);const m=r.createFramebuffer(h[0],h[1],!0,null);return m.colorAttachment.set(p.texture),m.depthAttachment=new Ln(r,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,h[0],h[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:m,tex:p,dirty:!1}}_initFBOPool(){for(;this.pool.length{const a=this._style._mergedLayers[r],h=a.isHidden(this.painter.transform.zoom);return a.type==="custom"?!h&&a.shouldRedrape():!h&&a.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const h of this._style.getSources())if(h instanceof xh){r=!0;break}if(!r)return;const a={};for(let h=0;hw>x.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=h}_setupRenderCache(r){const a=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,a.renderCache.length>a.renderCachePool.length){const g=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let x=0;x=0;g--){const x=h[g];if(a.getTileByID(x.key),a.proxyCachedFBO[x.key]!==void 0){const w=r[x.key],T=this.proxyToSource[x.key];let S=0;for(const I in T){const P=T[I],z=w[I];if(!z||z.length!==P.length||P.some((L,k)=>L!==z[k]||p[I]&&p[I].hasOwnProperty(L.key))){S=-1;break}++S}for(const I in a.proxyCachedFBO[x.key])a.renderCache[a.proxyCachedFBO[x.key][I]].dirty=S<0||S!==Object.values(w).length}}const m=[...this._drapedRenderBatches];m.sort((g,x)=>x.end-x.start-(g.end-g.start));for(const g of m)for(const x of h){if(a.proxyCachedFBO[x.key])continue;let w=a.renderCachePool.pop();w===void 0&&a.renderCache.length<50&&(w=a.renderCache.length,a.renderCache.push(this._createFBO())),w!==void 0&&(a.proxyCachedFBO[x.key]={},a.proxyCachedFBO[x.key][g.start]=w,a.renderCache[w].dirty=!0)}this._tilesDirty={}}_setupStencil(r,a,h,p){if(!p||!this._sourceTilesOverlap[p.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,g=m.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let x;if(h.isTileClipped())x=a.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a[a.length-1].overscaledZ))return void(this._overlapStencilType=!1);x=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+x>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=x,this._overlapStencilMode.ref=this._stencilRef,h.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):s.ah.disabled}_renderTileClippingMasks(r,a){const h=this.painter,p=this.painter.context,m=p.gl;h._tileClippingMaskIDs={},p.setColorMode(s.a.disabled),p.setDepthMode(s.af.disabled);const g=h.getOrCreateProgram("clippingMask");for(const x of r){const w=h._tileClippingMaskIDs[x.key]=--a;g.draw(h,m.TRIANGLES,s.af.disabled,new s.ah({func:m.ALWAYS,mask:0},w,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.ag.disabled,na(x.projMatrix),"$clipping",h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}}pointCoordinate(r){const a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;const h=[r.x,r.y,1,1];s.aB.transformMat4(h,h,a.pixelMatrixInverse),s.aB.scale(h,h,1/h[3]),h[0]/=a.worldSize,h[1]/=a.worldSize;const p=a._camera.position,m=s.ay(1,a.center.lat),g=[p[0],p[1],p[2]/m,0],x=s.$.subtract([],h.slice(0,3),g);s.$.normalize(x,x);const w=this.raycast(g,x,this._exaggeration);return w!==null&&w?(s.$.scaleAndAdd(g,g,x,w),g[3]=g[2],g[2]*=m,g):null}_setupProxiedCoordsForOrtho(r,a,h){if(r.getSource()instanceof s.bo)return this._setupProxiedCoordsForImageSource(r,a,h);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const p=this.proxiedCoords[r.id]=[],m=this.proxyCoords;for(let w=0;wS.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,h){if(!r.getSource().loaded())return;const p=this.proxiedCoords[r.id]=[],m=this.proxyCoords,g=r.getSource(),x=g.tileID;if(!x)return;const w=new s.P(x.x,x.y)._div(1<(I.min.x=Math.min(I.min.x,P.x-w.x),I.min.y=Math.min(I.min.y,P.y-w.y),I.max.x=Math.max(I.max.x,P.x-w.x),I.max.y=Math.max(I.max.y,P.y-w.y),I),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(I,P)=>{const z=I.wrap+I.canonical.x/(1<O+T.max.x||L+kB+T.max.y};for(let I=0;Ig.key===a.tileID.key);if(m)return m}if(a.tileID.key!==r.key){const m=r.canonical.z-a.tileID.canonical.z;let g,x,w;p=s.ae.create();const T=a.tileID.wrap-r.wrap<0?(g=s.a4>>m,x=g*((a.tileID.canonical.x<=I){const P=r.canonical.z-I;a.getSource().reparseOverscaled?(x=Math.max(r.canonical.z+2,a.transform.tileZoom),g=new s.aQ(x,r.wrap,I,r.canonical.x>>P,r.canonical.y>>P)):P!==0&&(x=I,g=new s.aQ(x,r.wrap,I,r.canonical.x>>P,r.canonical.y>>P))}g.key!==r.key&&(T.push(g.key),h=a.getTile(g))}const S=I=>{T.forEach(P=>{p[P]=I}),T.length=0};for(x-=1;x>=w&&(!h||!h.hasData());x--){h&&S(h.tileID.key);const I=g.calculateScaledKey(x);if(h=a.getTileByID(I),h&&h.hasData())break;const P=p[I];if(P===null)break;P===void 0?T.push(I):h=a.getTileByID(P)}return S(h?h.tileID.key:null),h&&h.hasData()?h:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,a){let h=this._tilesDirty[r];h||(h=this._tilesDirty[r]={}),h[a.key]=!0}}function Sh(u,r,a){const h=function(x,w,T){const S=s.$.dot(w,x),I=s.$.dot(T,[.2126,.7152,.0722]),P=(L,k,O)=>(1-O)*L+O*k,z=P(1-.3*Math.min(I,1),1,Math.min(S+1,1));return P(.92,1,Math.asin(s.au(w[2],-1,1))/Math.PI+.5)*z}(u,[0,0,1],r),p=[0,0,0];s.$.scale(p,a.slice(0,3),h);const m=[0,0,0];s.$.scale(m,r.slice(0,3),u[2]);const g=[0,0,0];return s.$.add(g,p,m),s.ba(g)}const Zc=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Mh=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class Wc{static cacheKey(r,a,h,p){let m=`${a}${p?p.cacheKey:""}`;for(const g of h)r.usedDefines.includes(g)&&(m+=`/${g}`);return m}constructor(r,a,h,p,m,g){const x=r.gl;this.program=x.createProgram(),this.configuration=p,this.name=a,this.fixedDefines=[...g];const w=p?p.getBinderAttributes():[],T=(h.staticAttributes||[]).concat(w);let S=p?p.defines():[];S=S.concat(g.map(O=>`#define ${O}`));const I=`#version 300 es -`;let P=I+S.concat("precision mediump float;",_h,ml.fragmentSource).join(` -`);for(const O of h.fragmentIncludes)P+=` -${Ws[O]}`;P+=` -${h.fragmentSource}`;let z=I+S.concat("precision highp float;",_h,ml.vertexSource).join(` -`);for(const O of h.vertexIncludes)z+=` -${Ws[O]}`;z+=` -${h.vertexSource}`;const L=x.createShader(x.FRAGMENT_SHADER);if(x.isContextLost())return void(this.failedToCreate=!0);x.shaderSource(L,P),x.compileShader(L),x.attachShader(this.program,L);const k=x.createShader(x.VERTEX_SHADER);if(x.isContextLost())this.failedToCreate=!0;else{x.shaderSource(k,z),x.compileShader(k),x.attachShader(this.program,k),this.attributes={},this.numAttributes=T.length;for(let O=0;O({u_dem:new s.a8(O),u_dem_prev:new s.a8(O),u_dem_tl:new s.a9(O),u_dem_scale:new s.ab(O),u_dem_tl_prev:new s.a9(O),u_dem_scale_prev:new s.ab(O),u_dem_size:new s.ab(O),u_dem_lerp:new s.ab(O),u_exaggeration:new s.ab(O),u_depth:new s.a8(O),u_depth_size_inv:new s.a9(O),u_depth_range_unpack:new s.a9(O),u_occluder_half_size:new s.ab(O),u_occlusion_depth_offset:new s.ab(O),u_meter_to_dem:new s.ab(O),u_label_plane_matrix_inv:new s.a7(O)}))(r)),g.includes("GLOBE")&&(this.globeUniforms=(O=>({u_tile_tl_up:new s.ar(O),u_tile_tr_up:new s.ar(O),u_tile_br_up:new s.ar(O),u_tile_bl_up:new s.ar(O),u_tile_up_scale:new s.ab(O)}))(r)),g.includes("FOG")&&(this.fogUniforms=(O=>({u_fog_matrix:new s.a7(O),u_fog_range:new s.a9(O),u_fog_color:new s.at(O),u_fog_horizon_blend:new s.ab(O),u_fog_vertical_limit:new s.a9(O),u_fog_temporal_offset:new s.ab(O),u_frustum_tl:new s.ar(O),u_frustum_tr:new s.ar(O),u_frustum_br:new s.ar(O),u_frustum_bl:new s.ar(O),u_globe_pos:new s.ar(O),u_globe_radius:new s.ab(O),u_globe_transition:new s.ab(O),u_is_globe:new s.a8(O),u_viewport:new s.a9(O)}))(r)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(O=>({u_cutoff_params:new s.at(O)}))(r)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(O=>({u_lighting_ambient_color:new s.ar(O),u_lighting_directional_dir:new s.ar(O),u_lighting_directional_color:new s.ar(O),u_ground_radiance:new s.ar(O)}))(r)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(O=>({u_light_matrix_0:new s.a7(O),u_light_matrix_1:new s.a7(O),u_fade_range:new s.a9(O),u_shadow_normal_offset:new s.ar(O),u_shadow_intensity:new s.ab(O),u_shadow_texel_size:new s.ab(O),u_shadow_map_resolution:new s.ab(O),u_shadow_direction:new s.ar(O),u_shadow_bias:new s.ar(O),u_shadowmap_0:new s.a8(O),u_shadowmap_1:new s.a8(O)}))(r))}}setTerrainUniformValues(r,a){if(!this.terrainUniforms)return;const h=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p]&&h[p].set(this.program,p,a[p])}}setGlobeUniformValues(r,a){if(!this.globeUniforms)return;const h=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p]&&h[p].set(this.program,p,a[p])}}setFogUniformValues(r,a){if(!this.fogUniforms)return;const h=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setCutoffUniformValues(r,a){if(!this.cutoffUniforms)return;const h=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setLightsUniformValues(r,a){if(!this.lightsUniforms)return;const h=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setShadowUniformValues(r,a){if(this.failedToCreate||!this.shadowUniforms)return;const h=this.shadowUniforms;r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}_drawDebugWireframe(r,a,h,p,m,g,x,w,T,S){const I=r.options.wireframe;if(I.terrain===!1&&I.layers2D===!1&&I.layers3D===!1)return;const P=r.context;if(!(!(!I.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!I.layers2D||r._terrain&&r._terrain.renderingToTexture||!Zc.includes(this.name))||!(!I.layers3D||!Mh.includes(this.name))))return;const z=P.gl,L=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,m,P);if(!L)return;const k=[...this.fixedDefines];k.push("DEBUG_WIREFRAME");const O=r.getOrCreateProgram(this.name,{config:this.configuration,defines:k});P.program.set(O.program);const B=(j,J,Z)=>{if(J[j]&&Z[j])for(const W in J[j])Z[j][W]&&Z[j][W].set(Z.program,W,J[j][W].current)};T&&T.setUniforms(O.program,P,O.binderUniforms,x,{zoom:w}),B("fixedUniforms",this,O),B("terrainUniforms",this,O),B("globeUniforms",this,O),B("fogUniforms",this,O),B("lightsUniforms",this,O),B("shadowUniforms",this,O),L.bind(),P.setColorMode(new s.a([z.ONE,z.ONE_MINUS_SRC_ALPHA,z.ZERO,z.ONE],s.C.transparent,[!0,!0,!0,!1])),P.setDepthMode(new s.af(a.func===z.LESS?z.LEQUAL:a.func,s.af.ReadOnly,a.range)),P.setStencilMode(s.ah.disabled);const G=3*g.primitiveLength*2,$=3*g.primitiveOffset*2*2;S&&S>1?z.drawElementsInstanced(z.LINES,G,z.UNSIGNED_SHORT,$,S):z.drawElements(z.LINES,G,z.UNSIGNED_SHORT,$),m.bind(),P.program.set(this.program),P.setDepthMode(a),P.setStencilMode(h),P.setColorMode(p)}draw(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O){const B=r.context,G=B.gl;if(this.failedToCreate)return;B.program.set(this.program),B.setDepthMode(h),B.setStencilMode(p),B.setColorMode(m),B.setCullFace(g);for(const J of Object.keys(this.fixedUniforms))this.fixedUniforms[J].set(this.program,J,x[J]);L&&L.setUniforms(this.program,B,this.binderUniforms,P,{zoom:z});const $={[G.POINTS]:1,[G.LINES]:2,[G.TRIANGLES]:3,[G.LINE_STRIP]:1}[a],j=O&&O>0?1:void 0;for(const J of I.get()){const Z=J.vaos||(J.vaos={});(Z[w]||(Z[w]=new vp)).bind(B,this,T,L?L.getPaintVertexBuffers():[],S,J.vertexOffset,k||[],j),O&&O>1?G.drawElementsInstanced(a,J.primitiveLength*$,G.UNSIGNED_SHORT,J.primitiveOffset*$*2,O):S?G.drawElements(a,J.primitiveLength*$,G.UNSIGNED_SHORT,J.primitiveOffset*$*2):G.drawArrays(a,J.vertexOffset,J.vertexLength),a===G.TRIANGLES&&S&&this._drawDebugWireframe(r,h,p,m,S,J,P,z,L,O)}}}function Hc(u,r){const a=Math.pow(2,r.tileID.overscaledZ),h=r.tileSize*Math.pow(2,u.transform.tileZoom)/a,p=h*(r.tileID.canonical.x+r.tileID.wrap*a),m=h*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.bD(r,1,u.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m]}}const Ih=s.ae.create(),Kr=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B)=>{const G=r.style.light,$=G.properties.get("position"),j=[$.x,$.y,$.z],J=s.bE.create();G.properties.get("anchor")==="viewport"&&(s.bE.fromRotation(J,-r.transform.angle),s.$.transformMat3(j,j,J));const Z=G.properties.get("color"),W=r.transform,ee={u_matrix:u,u_lightpos:j,u_lightintensity:G.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_vertical_gradient:+a,u_opacity:h,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ih,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:p,u_edge_radius:m,u_alignment:g,u_width_scale:x,u_flood_light_color:z,u_vertical_scale:L,u_flood_light_intensity:k,u_ground_shadow_factor:O,u_emissive_strength:B};return W.projection.name==="globe"&&(ee.u_tile_id=[w.canonical.x,w.canonical.y,1<({u_matrix:u,u_edge_radius:r,u_alignment:a,u_width_scale:h,u_vertical_scale:p}),Ah=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>{const O=Kr(u,r,a,h,p,m,g,x,w,S,I,P,z,L,k,1,[0,0,0],0),B={u_height_factor:-Math.pow(2,w.overscaledZ)/T.tileSize/8};return s.Q(O,Hc(r,T),B)},oa=(u,r)=>({u_matrix:u,u_emissive_strength:r}),El=(u,r,a,h)=>s.Q(oa(u,r),Hc(a,h)),Sl=(u,r,a)=>({u_matrix:u,u_world:a,u_emissive_strength:r}),sa=(u,r,a,h,p)=>s.Q(El(u,r,a,h),{u_world:p}),ts=(u,r,a,h)=>{const p=s.a4/a.tileSize;return{u_matrix:u,u_camera_to_center_distance:r.getCameraToCenterDistance(h),u_extrude_scale:[r.pixelsToGLUnits[0]/p,r.pixelsToGLUnits[1]/p]}},Ml=(u,r,a=1)=>({u_matrix:u,u_color:r.toRenderColor(null),u_overlay:0,u_overlay_scale:a}),Ch=s.ae.create(),Ph=(u,r,a,h,p,m,g)=>{const x=u.transform,w=x.projection.name==="globe",T=w?s.bF(x.zoom,r.canonical)*x._pixelsPerMercatorPixel:s.bD(a,1,m),S={u_matrix:r.projMatrix,u_extrude_scale:T,u_intensity:g,u_inv_rot_matrix:Ch,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(w){S.u_inv_rot_matrix=h,S.u_merc_center=p,S.u_tile_id=[r.canonical.x,r.canonical.y,1<({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:p,u_tl_parent:m,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*I.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:I.paint.get("raster-brightness-min"),u_brightness_high:I.paint.get("raster-brightness-max"),u_saturation_factor:s.bG(I.paint.get("raster-saturation")),u_contrast_factor:s.bH(I.paint.get("raster-contrast")),u_spin_weights:Yc(I.paint.get("raster-hue-rotate")),u_perspective_transform:P,u_raster_elevation:z,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w,u_colorization_mix:Xc(s.bI,k,B),u_colorization_offset:aa(s.bI,O,B),u_color_ramp:L,u_texture_offset:[$/(G+2*$),G/(G+2*$)],u_texture_res:[G+2*$,G+2*$],u_emissive_strength:j});function Yc(u){u*=Math.PI/180;const r=Math.sin(u),a=Math.cos(u);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}const Qr=.05,uo=(u,r,a,h,p,m,g,x,w,T,S,I)=>({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:p,u_tl_parent:m,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:I,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w}),Sp=(u,r,a,h,p,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:h,u_color_ramp:m,u_velocity_res:p,u_max_speed:g,u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Qr,Qr]}),zh=(u,r,a,h,p,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:h,u_max_speed:p,u_speed_factor:m,u_reset_rate:g,u_rand_seed:Math.random(),u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Qr,Qr]}),la=s.ae.create(),is=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B)=>{const G=p.transform,$={u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:G.getCameraToCenterDistance(k),u_rotate_symbol:+a,u_aspect_ratio:G.width/G.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:g,u_coord_matrix:x,u_is_text:+w,u_pitch_with_map:+h,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:la,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:la,u_up_vector:[0,-1,0],u_color_adj_mat:O,u_icon_transition:B||0};return k.name==="globe"&&($.u_tile_id=[S.canonical.x,S.canonical.y,1<s.Q(is(u,r,a,h,p,m,g,x,w,T,I,P,z,L,k,O),{u_gamma_scale:h?p.transform.getCameraToCenterDistance(O)*Math.cos(p.terrain?0:p.transform._pitch):1,u_device_pixel_ratio:s.e.devicePixelRatio,u_is_halo:+S,undefined:void 0}),Jc=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>s.Q(ca(u,r,a,h,p,m,g,x,!0,w,!0,S,I,P,z,L,k),{u_texsize_icon:T,u_texture_icon:1}),Kc=(u,r,a,h)=>({u_matrix:u,u_emissive_strength:r,u_opacity:a,u_color:h}),Mp=(u,r,a,h,p,m,g,x)=>s.Q(function(w,T,S,I,P){const{width:z,height:L}=I.imageManager.getPixelSize(T),k=Math.pow(2,P.tileID.overscaledZ),O=P.tileSize*Math.pow(2,I.transform.tileZoom)/k,B=O*(P.tileID.canonical.x+P.tileID.wrap*k),G=O*P.tileID.canonical.y;return{u_image:0,u_pattern_tl:S.tl,u_pattern_br:S.br,u_texsize:[z,L],u_pattern_size:S.displaySize,u_tile_units_to_pixels:1/s.bD(P,1,I.transform.tileZoom),u_pixel_coord_upper:[B>>16,G>>16],u_pixel_coord_lower:[65535&B,65535&G]}}(0,m,g,h,x),{u_matrix:u,u_emissive_strength:r,u_opacity:a}),Dr=new Float32Array(s.ae.identity([])),ho=(u,r,a,h,p,m,g,x,w,T,S,I,P,z=[0,0,0],L)=>{const k=p.style.light,O=k.properties.get("position"),B=[-O.x,-O.y,O.z],G=s.bE.create();k.properties.get("anchor")==="viewport"&&(s.bE.fromRotation(G,-p.transform.angle),s.$.transformMat3(B,B,G));const $=S.alphaMode==="MASK",j=k.properties.get("color").toRenderColor(null),J=P.paint.get("model-ambient-occlusion-intensity"),Z=P.paint.get("model-color").constantOr(s.C.white).toRenderColor(null),W=P.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:u,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:h||Dr,u_lightpos:B,u_lightintensity:k.properties.get("intensity"),u_lightcolor:[j.r,j.g,j.b],u_camera_pos:z,u_opacity:m,u_baseTextureIsAlpha:0,u_alphaMask:+$,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:[g.r,g.g,g.b,g.a],u_emissiveFactor:[x[0],x[1],x[2],1],u_metallicFactor:w,u_roughnessFactor:T,u_baseColorTexture:$i.BaseColor,u_metallicRoughnessTexture:$i.MetallicRoughness,u_normalTexture:$i.Normal,u_occlusionTexture:$i.Occlusion,u_emissionTexture:$i.Emission,u_lutTexture:$i.LUT,u_color_mix:[Z.r,Z.g,Z.b,W],u_aoIntensity:J,u_emissive_strength:I,u_occlusionTextureTransform:L||[0,0,0,0]}},Qc=(u,r=Dr,a=Dr)=>({u_matrix:u,u_instance:r,u_node_matrix:a}),Dh={fillExtrusion:u=>({u_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_vertical_gradient:new s.ab(u),u_opacity:new s.ab(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_ao:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_up_dir:new s.ar(u),u_height_lift:new s.ab(u),u_flood_light_color:new s.ar(u),u_vertical_scale:new s.ab(u),u_flood_light_intensity:new s.ab(u),u_ground_shadow_factor:new s.ar(u),u_emissive_strength:new s.ab(u)}),fillExtrusionDepth:u=>({u_matrix:new s.a7(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_vertical_scale:new s.ab(u)}),fillExtrusionPattern:u=>({u_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_vertical_gradient:new s.ab(u),u_height_factor:new s.ab(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_ao:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_up_dir:new s.ar(u),u_height_lift:new s.ab(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u),u_opacity:new s.ab(u)}),fillExtrusionGroundEffect:u=>({u_matrix:new s.a7(u),u_opacity:new s.ab(u),u_ao_pass:new s.ab(u),u_meter_to_tile:new s.ab(u),u_ao:new s.a9(u),u_flood_light_intensity:new s.ab(u),u_flood_light_color:new s.ar(u),u_attenuation:new s.ab(u),u_edge_radius:new s.ab(u),u_fb:new s.a8(u),u_fb_size:new s.ab(u)}),fill:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u)}),fillPattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),fillOutline:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_world:new s.a9(u)}),fillOutlinePattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_world:new s.a9(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),circle:s.bK,collisionBox:u=>({u_matrix:new s.a7(u),u_camera_to_center_distance:new s.ab(u),u_extrude_scale:new s.a9(u)}),collisionCircle:u=>({u_matrix:new s.a7(u),u_inv_matrix:new s.a7(u),u_camera_to_center_distance:new s.ab(u),u_viewport_size:new s.a9(u)}),debug:u=>({u_color:new s.aa(u),u_matrix:new s.a7(u),u_overlay:new s.a8(u),u_overlay_scale:new s.ab(u)}),clippingMask:u=>({u_matrix:new s.a7(u)}),heatmap:u=>({u_extrude_scale:new s.ab(u),u_intensity:new s.ab(u),u_matrix:new s.a7(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_up_dir:new s.ar(u)}),heatmapTexture:u=>({u_image:new s.a8(u),u_color_ramp:new s.a8(u),u_opacity:new s.ab(u)}),hillshade:u=>({u_matrix:new s.a7(u),u_image:new s.a8(u),u_latrange:new s.a9(u),u_light:new s.a9(u),u_shadow:new s.aa(u),u_highlight:new s.aa(u),u_emissive_strength:new s.ab(u),u_accent:new s.aa(u)}),hillshadePrepare:u=>({u_matrix:new s.a7(u),u_image:new s.a8(u),u_dimension:new s.a9(u),u_zoom:new s.ab(u)}),line:s.bL,linePattern:s.bM,raster:u=>({u_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_grid_matrix:new s.as(u),u_tl_parent:new s.a9(u),u_scale_parent:new s.ab(u),u_fade_t:new s.ab(u),u_opacity:new s.ab(u),u_image0:new s.a8(u),u_image1:new s.a8(u),u_brightness_low:new s.ab(u),u_brightness_high:new s.ab(u),u_saturation_factor:new s.ab(u),u_contrast_factor:new s.ab(u),u_spin_weights:new s.ar(u),u_perspective_transform:new s.a9(u),u_raster_elevation:new s.ab(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_cutoff_params:new s.at(u),u_colorization_mix:new s.at(u),u_colorization_offset:new s.ab(u),u_color_ramp:new s.a8(u),u_texture_offset:new s.a9(u),u_texture_res:new s.a9(u),u_emissive_strength:new s.ab(u)}),rasterParticle:u=>({u_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_grid_matrix:new s.as(u),u_tl_parent:new s.a9(u),u_scale_parent:new s.ab(u),u_fade_t:new s.ab(u),u_opacity:new s.ab(u),u_image0:new s.a8(u),u_image1:new s.a8(u),u_raster_elevation:new s.ab(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_cutoff_params:new s.at(u)}),rasterParticleTexture:u=>({u_texture:new s.a8(u),u_opacity:new s.ab(u)}),rasterParticleDraw:u=>({u_particle_texture:new s.a8(u),u_particle_texture_side_len:new s.ab(u),u_tile_offset:new s.a9(u),u_velocity:new s.a8(u),u_color_ramp:new s.a8(u),u_velocity_res:new s.a9(u),u_max_speed:new s.ab(u),u_uv_offset:new s.a9(u),u_data_scale:new s.a9(u),u_data_offset:new s.ab(u),u_particle_pos_scale:new s.ab(u),u_particle_pos_offset:new s.a9(u)}),rasterParticleUpdate:u=>({u_particle_texture:new s.a8(u),u_particle_texture_side_len:new s.ab(u),u_velocity:new s.a8(u),u_velocity_res:new s.a9(u),u_max_speed:new s.ab(u),u_speed_factor:new s.ab(u),u_reset_rate:new s.ab(u),u_rand_seed:new s.ab(u),u_uv_offset:new s.a9(u),u_data_scale:new s.a9(u),u_data_offset:new s.ab(u),u_particle_pos_scale:new s.ab(u),u_particle_pos_offset:new s.a9(u)}),symbolIcon:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_camera_forward:new s.ar(u),u_tile_matrix:new s.a7(u),u_up_vector:new s.ar(u),u_ecef_origin:new s.ar(u),u_texture:new s.a8(u),u_icon_transition:new s.ab(u),u_color_adj_mat:new s.a7(u)}),symbolSDF:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_texture:new s.a8(u),u_gamma_scale:new s.ab(u),u_device_pixel_ratio:new s.ab(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_camera_forward:new s.ar(u),u_tile_matrix:new s.a7(u),u_up_vector:new s.ar(u),u_ecef_origin:new s.ar(u),u_is_halo:new s.a8(u)}),symbolTextAndIcon:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_texsize_icon:new s.a9(u),u_texture:new s.a8(u),u_texture_icon:new s.a8(u),u_gamma_scale:new s.ab(u),u_device_pixel_ratio:new s.ab(u),u_is_halo:new s.a8(u)}),background:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_opacity:new s.ab(u),u_color:new s.aa(u)}),backgroundPattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_opacity:new s.ab(u),u_image:new s.a8(u),u_pattern_tl:new s.a9(u),u_pattern_br:new s.a9(u),u_texsize:new s.a9(u),u_pattern_size:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),terrainRaster:u=>({u_matrix:new s.a7(u),u_image0:new s.a8(u),u_skirt_height:new s.ab(u),u_ground_shadow_factor:new s.ar(u)}),skybox:u=>({u_matrix:new s.a7(u),u_sun_direction:new s.ar(u),u_cubemap:new s.a8(u),u_opacity:new s.ab(u),u_temporal_offset:new s.ab(u)}),skyboxGradient:u=>({u_matrix:new s.a7(u),u_color_ramp:new s.a8(u),u_center_direction:new s.ar(u),u_radius:new s.ab(u),u_opacity:new s.ab(u),u_temporal_offset:new s.ab(u)}),skyboxCapture:u=>({u_matrix_3f:new s.as(u),u_sun_direction:new s.ar(u),u_sun_intensity:new s.ab(u),u_color_tint_r:new s.at(u),u_color_tint_m:new s.at(u),u_luminance:new s.ab(u)}),globeRaster:u=>({u_proj_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_image0:new s.a8(u),u_grid_matrix:new s.as(u),u_skirt_height:new s.ab(u),u_far_z_cutoff:new s.ab(u),u_frustum_tl:new s.ar(u),u_frustum_tr:new s.ar(u),u_frustum_br:new s.ar(u),u_frustum_bl:new s.ar(u),u_globe_pos:new s.ar(u),u_globe_radius:new s.ab(u),u_viewport:new s.a9(u)}),globeAtmosphere:u=>({u_frustum_tl:new s.ar(u),u_frustum_tr:new s.ar(u),u_frustum_br:new s.ar(u),u_frustum_bl:new s.ar(u),u_horizon:new s.ab(u),u_transition:new s.ab(u),u_fadeout_range:new s.ab(u),u_color:new s.at(u),u_high_color:new s.at(u),u_space_color:new s.at(u),u_temporal_offset:new s.ab(u),u_horizon_angle:new s.ab(u)}),model:u=>({u_matrix:new s.a7(u),u_lighting_matrix:new s.a7(u),u_normal_matrix:new s.a7(u),u_node_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_camera_pos:new s.ar(u),u_opacity:new s.ab(u),u_baseColorFactor:new s.at(u),u_emissiveFactor:new s.at(u),u_metallicFactor:new s.ab(u),u_roughnessFactor:new s.ab(u),u_baseTextureIsAlpha:new s.a8(u),u_alphaMask:new s.a8(u),u_alphaCutoff:new s.ab(u),u_baseColorTexture:new s.a8(u),u_metallicRoughnessTexture:new s.a8(u),u_normalTexture:new s.a8(u),u_occlusionTexture:new s.a8(u),u_emissionTexture:new s.a8(u),u_lutTexture:new s.a8(u),u_color_mix:new s.at(u),u_aoIntensity:new s.ab(u),u_emissive_strength:new s.ab(u),u_occlusionTextureTransform:new s.at(u)}),modelDepth:u=>({u_matrix:new s.a7(u),u_instance:new s.a7(u),u_node_matrix:new s.a7(u)}),groundShadow:u=>({u_matrix:new s.a7(u),u_ground_shadow_factor:new s.ar(u)}),stars:u=>({u_matrix:new s.a7(u),u_up:new s.ar(u),u_right:new s.ar(u),u_intensity_multiplier:new s.ab(u)}),occlusion:u=>({u_matrix:new s.a7(u),u_anchorPos:new s.ar(u),u_screenSizePx:new s.a9(u),u_occluderSizePx:new s.a9(u),u_color:new s.at(u)})};function po(u,r,a){const h=r.createTileMatrix(u,u.worldSize,a.toUnwrapped());return s.ae.multiply(new Float32Array(16),u.projMatrix,h)}function Rh(u,r,a){if(r.projection.name===a.projection.name)return u.projMatrix;const h=a.clone();return h.setProjection(r.projection),po(h,r.getProjection(),u)}function eu(u,r,a){return r.name===a.projection.name?u.projMatrix:po(a,r,u)}let rs;function Lh(u,r,a,h,p,m,g){const x=u.context,w=x.gl,T=u.transform,S=u.getOrCreateProgram("collisionBox"),I=[];let P=0,z=0;for(let j=0;j0){const Y=s.ae.create(),_e=ie;s.ae.mul(Y,W.placementInvProjMatrix,T.glCoordMatrix),s.ae.mul(Y,Y,W.placementViewportMatrix),I.push({circleArray:re,circleOffset:z,transform:_e,invTransform:Y,projection:W.getProjection()}),P+=re.length/4,z=P}ue&&(u.terrain&&u.terrain.setupElevationDraw(Z,S),S.draw(u,w.LINES,s.af.disabled,s.ah.disabled,u.colorModeForRenderPass(),s.ag.disabled,ts(ie,T,Z,W.getProjection()),a.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,null,T.zoom,null,[ue.collisionVertexBuffer,ue.collisionVertexBufferExt]))}if(!g||!I.length)return;const L=u.getOrCreateProgram("collisionCircle"),k=new s.bN;k.resize(4*P),k._trim();let O=0;for(const j of I)for(let J=0;J=0&&(L[j.associatedIconIndex]={x:Y,y:_e,z:fe,angle:ve})}else co(W,P)}if(S){z.clear();const $=u.icon.placedSymbolArray;for(let j=0;j<$.length;j++){const J=$.get(j),{numGlyphs:Z}=J,W=L[j];if(J.hidden||!W)co(Z,z);else{const{x:ee,y:ie,z:ue,angle:re}=W;for(let Y=0;Y{W.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||u.terrain)&&(Ot.push("DEPTH_D24"),Ot.push("DEPTH_OCCLUSION"))},Ct=()=>{const Ot=ee&&a.layout.get("symbol-placement")!=="point",Mt=[];xt(Mt);const at=Ot||_t,bi=a.paint.get("icon-image-cross-fade").constantOr(0);u.terrainRenderModeElevated()&&ue&&Mt.push("PITCH_WITH_MAP_TERRAIN"),Ue&&(Mt.push("PROJECTION_GLOBE_VIEW"),at&&Mt.push("PROJECTED_POS_ON_VIEWPORT")),bi>0&&Mt.push("ICON_TRANSITION"),Ae.icon.zOffsetVertexBuffer&&Mt.push("Z_OFFSET"),B===0&&G===0&&$===0&&j===1||Mt.push("COLOR_ADJUSTMENT");const wi=Ae.icon.programConfigurations.get(a.id),Xi=u.getOrCreateProgram(Ae.sdfIcons?"symbolSDF":"symbolIcon",{config:wi,defines:Mt});let Yi;const Fi=Me.imageAtlasTexture?Me.imageAtlasTexture.size:[0,0],Ji=Ae.iconSizeData,Li=s.aE(Ji,W.zoom),Ni=ue||W.pitch!==0,Le=Ys(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e),Ye=gl(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e),rr=u.translatePosMatrix(Ye,Me,x,T,!0),ei=u.translatePosMatrix(He,Me,x,T),me=at?ua:Le,yn=ee&&!ue&&!Ot;let Wr=ve;!Se&&!W.mercatorFromTransition||ee||(Wr=kh(W));const xn=Ue?Wr:ve;if(Ae.sdfIcons&&!Ae.iconsInText)Yi=ca(Ji.kind,Li,yn,ue,u,ei,me,rr,!1,Fi,!0,ne,Ge,se,nt,xn,Ae.getProjection());else{const wo=a.getColorAdjustmentMatrix(B,G,$,j);Yi=is(Ji.kind,Li,yn,ue,u,ei,me,rr,!1,Fi,ne,Ge,se,nt,xn,Ae.getProjection(),wo,bi)}const vn=Me.imageAtlasTexture?Me.imageAtlasTexture:null,Kl=a.layout.get("icon-size").constantOr(0)!==1||Ae.iconsNeedLinear,Ql=Ae.sdfIcons||u.options.rotating||u.options.zooming||Kl||Ni?Z.LINEAR:Z.NEAREST,Wn=Ae.sdfIcons&&a.paint.get("icon-halo-width").constantOr(1)!==0,Mu=u.terrain&&ue&&Ot?s.ae.invert(s.ae.create(),Le):ua;if(Ot&&Ae.icon){const wo=W.elevation,ec=wo?wo.getAtTileOffsetFunc(ne,W.center.lat,W.worldSize,Ae.getProjection()):null,ms=_l(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e);Jo(Ae,He,u,!1,ms,Ye,ue,k,ec,ne)}return{program:Xi,buffers:Ae.icon,uniformValues:Yi,atlasTexture:vn,atlasTextureIcon:null,atlasInterpolation:Ql,atlasInterpolationIcon:null,isSDF:Ae.sdfIcons,hasHalo:Wn,tile:Me,labelPlaneMatrixInv:Mu}},ii=()=>{const Ot=ie&&a.layout.get("symbol-placement")!=="point",Mt=[],at=Ot||Ce||_t;u.terrainRenderModeElevated()&&re&&Mt.push("PITCH_WITH_MAP_TERRAIN"),Ue&&(Mt.push("PROJECTION_GLOBE_VIEW"),at&&Mt.push("PROJECTED_POS_ON_VIEWPORT")),Ae.text.zOffsetVertexBuffer&&Mt.push("Z_OFFSET"),xt(Mt);const bi=Ae.text.programConfigurations.get(a.id),wi=u.getOrCreateProgram(Ae.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:bi,defines:Mt});let Xi,Yi=[0,0],Fi=null;const Ji=Ae.textSizeData;Ae.iconsInText&&(Yi=Me.imageAtlasTexture?Me.imageAtlasTexture.size:[0,0],Fi=Me.imageAtlasTexture?Me.imageAtlasTexture:null,Xi=re||W.pitch!==0||u.options.rotating||u.options.zooming||Ji.kind==="composite"||Ji.kind==="camera"?Z.LINEAR:Z.NEAREST);const Li=Me.glyphAtlasTexture?Me.glyphAtlasTexture.size:[0,0],Ni=s.aE(Ji,W.zoom),Le=Ys(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e),Ye=gl(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e),rr=u.translatePosMatrix(Ye,Me,w,S,!0),ei=u.translatePosMatrix(He,Me,w,S),me=at?ua:Le,yn=ie&&!re&&!Ot;let Wr=ve;!Se&&!W.mercatorFromTransition||ie||(Wr=kh(W));const xn=Ue?Wr:ve;let vn;vn=Ae.iconsInText?Jc(Ji.kind,Ni,yn,re,u,ei,me,rr,Li,Yi,ne,Ge,se,nt,xn,Ae.getProjection()):ca(Ji.kind,Ni,yn,re,u,ei,me,rr,!0,Li,!0,ne,Ge,se,nt,xn,Ae.getProjection());const Kl=Me.glyphAtlasTexture?Me.glyphAtlasTexture:null,Ql=Z.LINEAR,Wn=a.paint.get("text-halo-width").constantOr(1)!==0,Mu=u.terrain&&re&&Ot?s.ae.invert(s.ae.create(),Le):ua;if(Ot&&Ae.text){const wo=W.elevation,ec=wo?wo.getAtTileOffsetFunc(ne,W.center.lat,W.worldSize,Ae.getProjection()):null,ms=_l(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e);Jo(Ae,He,u,!0,ms,Ye,re,O,ec,ne)}return{program:wi,buffers:Ae.text,uniformValues:vn,atlasTexture:Kl,atlasTextureIcon:Fi,atlasInterpolation:Ql,atlasInterpolationIcon:Xi,isSDF:!0,hasHalo:Wn,tile:Me,labelPlaneMatrixInv:Mu}},Jt=Ae.icon.segments.get().length,Pt=Ae.text.segments.get().length,Xt=Jt&&!g.onlyText?Ct():null,Tt=Pt&&!g.onlyIcons?ii():null,St=a.paint.get("icon-opacity").constantOr(1),gt=a.paint.get("text-opacity").constantOr(1);if(Y&&Ae.canOverlap){_e=!0;const Ot=St&&!g.onlyText?Ae.icon.segments.get():[],Mt=gt&&!g.onlyIcons?Ae.text.segments.get():[];for(const at of Ot)he.push({segments:new s.b([at]),sortKey:at.sortKey,state:Xt});for(const at of Mt)he.push({segments:new s.b([at]),sortKey:at.sortKey,state:Tt})}else g.onlyText||he.push({segments:St?Ae.icon.segments:new s.b([]),sortKey:0,state:Xt}),g.onlyIcons||he.push({segments:gt?Ae.text.segments:new s.b([]),sortKey:0,state:Tt})}_e&&he.sort((ne,Me)=>ne.sortKey-Me.sortKey);for(const ne of he){const Me=ne.state;if(Me)if(u.terrain?u.terrain.setupElevationDraw(Me.tile,Me.program,{useDepthForOcclusion:W.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Me.labelPlaneMatrixInv}):u.setupDepthForOcclusion(W.depthOcclusionForSymbolsAndCircles,Me.program),J.activeTexture.set(Z.TEXTURE0),Me.atlasTexture&&Me.atlasTexture.bind(Me.atlasInterpolation,Z.CLAMP_TO_EDGE,!0),Me.atlasTextureIcon&&(J.activeTexture.set(Z.TEXTURE1),Me.atlasTextureIcon&&Me.atlasTextureIcon.bind(Me.atlasInterpolationIcon,Z.CLAMP_TO_EDGE,!0)),u.uploadCommonLightUniforms(u.context,Me.program),Me.hasHalo){const Ae=Me.uniformValues;Ae.u_is_halo=1,tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Ae,2),Ae.u_is_halo=0}else{if(Me.isSDF){const Ae=Me.uniformValues;Me.hasHalo&&(Ae.u_is_halo=1,tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Ae,1)),Ae.u_is_halo=0}tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Me.uniformValues,1)}}}function tu(u,r,a,h,p,m,g,x,w,T){const S=[u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer,u.iconTransitioningVertexBuffer,u.globeExtVertexBuffer,u.zOffsetVertexBuffer];p.draw(h,h.context.gl.TRIANGLES,m,g,x,s.ag.disabled,w,a.id,u.layoutVertexBuffer,u.indexBuffer,r,a.paint,h.transform.zoom,u.programConfigurations.get(a.id),S,T)}function da(u,r,a,h,p,m,g){const x=u.context.gl,w=a.paint.get("fill-pattern"),T=w&&w.constantOr(1);let S,I,P,z,L;g?(I=T&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",S=x.LINES):(I=T?"fillPattern":"fill",S=x.TRIANGLES);for(const k of h){const O=r.getTile(k);if(T&&!O.patternsLoaded())continue;const B=O.getBucket(a);if(!B)continue;u.prepareDrawTile();const G=B.programConfigurations.get(a.id),$=u.isTileAffectedByFog(k),j=u.getOrCreateProgram(I,{config:G,overrideFog:$});T&&(u.context.activeTexture.set(x.TEXTURE0),O.imageAtlasTexture&&O.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),G.updatePaintBuffers());const J=w.constantOr(null);if(J&&O.imageAtlas){const ee=O.imageAtlas.patternPositions[J.toString()];ee&&G.setConstantPatternPositions(ee)}const Z=u.translatePosMatrix(k.projMatrix,O,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),W=a.paint.get("fill-emissive-strength");if(g){z=B.indexBuffer2,L=B.segments2;const ee=u.terrain&&u.terrain.renderingToTexture?u.terrain.drapeBufferSize:[x.drawingBufferWidth,x.drawingBufferHeight];P=I==="fillOutlinePattern"&&T?sa(Z,W,u,O,ee):Sl(Z,W,ee)}else z=B.indexBuffer,L=B.segments,P=T?El(Z,W,u,O):oa(Z,W);u.uploadCommonUniforms(u.context,j,k.toUnwrapped()),j.draw(u,S,p,u.stencilModeForClipping(k),m,s.ag.disabled,P,a.id,B.layoutVertexBuffer,z,L,a.paint,u.transform.zoom,G,void 0)}}function fo(u,r,a,h,p,m,g,x){a.resetLayerRenderingStats(u);const w=u.context,T=w.gl,S=u.transform,I=a.paint.get("fill-extrusion-pattern"),P=I.constantOr(1),z=a.paint.get("fill-extrusion-opacity"),L=u.style.enable3dLights(),k=a.paint.get(L&&!P?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),O=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k],B=a.layout.get("fill-extrusion-edge-radius"),G=B>0&&!a.paint.get("fill-extrusion-rounded-roof"),$=G?0:B,j=S.projection.name==="globe"?s.b_():0,J=S.projection.name==="globe",Z=J?s.a2(S.zoom):0,W=[s.ak(S.center.lng),s.al(S.center.lat)],ee=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),ie=a.paint.get("fill-extrusion-flood-light-intensity"),ue=a.paint.get("fill-extrusion-vertical-scale"),re=a.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Y=ar(u,a.paint.get("fill-extrusion-cutoff-fade-range")),_e=a.paint.get("fill-extrusion-emissive-strength"),fe=[];J&&fe.push("PROJECTION_GLOBE_VIEW"),O[0]>0&&fe.push("FAUX_AO"),G&&fe.push("ZERO_ROOF_RADIUS"),x&&fe.push("HAS_CENTROID"),ie>0&&fe.push("FLOOD_LIGHT"),Y.shouldRenderCutoff&&fe.push("RENDER_CUTOFF"),re&&fe.push("RENDER_WALL_MODE");const se=(()=>{const Ue=a.paint.get("fill-extrusion-line-alignment");switch(Ue){case"inside":return 1;case"outside":return-1;case"center":return 0;default:return s.w(`Unsupported value for fill-extrusion-line-alignment: ${Ue}`),0}})();let Ce;const Se=u.renderPass==="shadow",he=u.shadowRenderer,ve=Se&&!!he;u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0);let ne=[0,0,0];if(he){const Ue=u.style.directionalLight,Ge=u.style.ambientLight;Ue&&Ge&&(ne=ea(u.style,Ue,Ge)),Ce=fe.concat(["SHADOWS_SINGLE_CASCADE"])}const Me=ve?"fillExtrusionDepth":P?"fillExtrusionPattern":"fillExtrusion",Ae=a.getLayerRenderingStats();for(const Ue of h){const Ge=r.getTile(Ue),He=Ge.getBucket(a);if(!He||He.projection.name!==S.projection.name)continue;let $e=!1;he&&($e=he.getMaxCascadeForTile(Ue.toUnwrapped())===0);const it=u.isTileAffectedByFog(Ue),_t=He.programConfigurations.get(a.id),nt=u.getOrCreateProgram(Me,{config:_t,defines:$e?Ce:fe,overrideFog:it});if(u.terrain&&u.terrain.setupElevationDraw(Ge,nt,{useMeterToDem:!0}),!He.centroidVertexBuffer){const Tt=nt.attributes.a_centroid_pos;Tt!==void 0&&T.vertexAttrib2f(Tt,0,0)}!Se&&he&&he.setupShadows(Ge.tileID.toUnwrapped(),nt,"vector-tile",Ge.tileID.overscaledZ),P&&(u.context.activeTexture.set(T.TEXTURE0),Ge.imageAtlasTexture&&Ge.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),_t.updatePaintBuffers());const xt=I.constantOr(null);if(xt&&Ge.imageAtlas){const Tt=Ge.imageAtlas.patternPositions[xt.toString()];Tt&&_t.setConstantPatternPositions(Tt)}const Ct=a.paint.get("fill-extrusion-vertical-gradient"),ii=1/He.tileToMeter;let Jt;if(Se&&he){if(en(Ge.tileID,He,u))continue;const Tt=he.calculateShadowPassMatrixFromTile(Ge.tileID.toUnwrapped());Jt=Tl(Tt,$,se,ii,ue)}else{const Tt=u.translatePosMatrix(Ue.expandedProjMatrix,Ge,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),St=S.projection.createInversionMatrix(S,Ue.canonical);Jt=P?Ah(Tt,u,Ct,z,O,$,se,ii,Ue,Ge,j,Z,W,St,ee,ue):Kr(Tt,u,Ct,z,O,$,se,ii,Ue,j,Z,W,St,ee,ue,ie,ne,_e)}u.uploadCommonUniforms(w,nt,Ue.toUnwrapped(),null,Y);let Pt=He.segments;if(S.projection.name==="mercator"&&!Se&&(Pt=He.getVisibleSegments(Ge.tileID,u.terrain,u.transform.getFrustum(0)),!Pt.get().length))continue;if(Ae)if(Se)for(const Tt of Pt.get())Ae.numRenderedVerticesInShadowPass+=Tt.primitiveLength;else for(const Tt of Pt.get())Ae.numRenderedVerticesInTransparentPass+=Tt.primitiveLength;const Xt=[];(u.terrain||x)&&Xt.push(He.centroidVertexBuffer),J&&Xt.push(He.layoutVertexExtBuffer),re&&Xt.push(He.wallVertexBuffer),nt.draw(u,w.gl.TRIANGLES,p,m,g,s.ag.backCCW,Jt,a.id,He.layoutVertexBuffer,He.indexBuffer,Pt,a.paint,u.transform.zoom,_t,Xt)}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1)}function ns(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const $=u.context,j=$.gl,J=u.transform,Z=u.transform.zoom,W=[],ee=ar(u,a.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(W.push("CLEAR_SUBPASS"),G&&(W.push("CLEAR_FROM_TEXTURE"),$.activeTexture.set(j.TEXTURE0),G.bind(j.LINEAR,j.CLAMP_TO_EDGE))):T==="sdf"&&W.push("SDF_SUBPASS"),O&&W.push("HAS_CENTROID"),ee.shouldRenderCutoff&&W.push("RENDER_CUTOFF");const ie=a.layout.get("fill-extrusion-edge-radius"),ue=(re,Y,_e,fe,se)=>{const Ce=Y.programConfigurations.get(a.id),Se=u.isTileAffectedByFog(re),he=u.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ce,defines:W,overrideFog:Se}),ve=((Me,Ae,Ue,Ge,He,$e,it,_t,nt,xt,Ct)=>({u_matrix:Ae,u_opacity:Ue,u_ao_pass:Ge?1:0,u_meter_to_tile:He,u_ao:$e,u_flood_light_intensity:it,u_flood_light_color:_t,u_attenuation:nt,u_edge_radius:xt,u_fb:0,u_fb_size:Ct}))(0,fe,S,w,se,[I,P*se],z,L,k,Z>=17?0:ie*se,G?G.size[0]:0),ne=[];O&&ne.push(Y.hiddenByLandmarkVertexBuffer),u.uploadCommonUniforms($,he,re.toUnwrapped(),null,ee),he.draw(u,$.gl.TRIANGLES,p,m,g,x,ve,a.id,Y.vertexBuffer,Y.indexBuffer,_e,a.paint,Z,Ce,ne)};for(const re of h){const Y=r.getTile(re),_e=Y.getBucket(a);if(!_e||_e.projection.name!==J.projection.name||!_e.groundEffect||_e.groundEffect&&!_e.groundEffect.hasData())continue;const fe=_e.groundEffect,se=1/_e.tileToMeter;{const Ce=u.translatePosMatrix(re.projMatrix,Y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),Se=fe.getDefaultSegment();ue(re,fe,Se,Ce,se)}if(B)for(let Ce=0;Ce<4;Ce++){const Se=s.b$[Ce](re),he=r.getTile(Se);if(!he)continue;const ve=he.getBucket(a);if(!ve||ve.projection.name!==J.projection.name||!ve.groundEffect||ve.groundEffect&&!ve.groundEffect.hasData())continue;const ne=ve.groundEffect;let Me,Ae;Ce===0?(Me=[-s.a4,0,0],Ae=1):Ce===1?(Me=[s.a4,0,0],Ae=0):Ce===2?(Me=[0,-s.a4,0],Ae=3):(Me=[0,s.a4,0],Ae=2);const Ue=ne.regionSegments[Ae];if(!Ue)continue;const Ge=new Float32Array(16);s.ae.translate(Ge,re.projMatrix,Me),ue(re,ne,Ue,u.translatePosMatrix(Ge,Y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),se)}}}function Ap(u,r,a,h,p,m,g){h.centroidVertexArray.length===0&&h.createCentroidsBuffer();const x=m?m.findDEMTileFor(a):null;if(!(x&&x.dem||g))return;const w=B=>new s.P(Math.ceil((B+s.c2)*s.c3),0),T=B=>{const G=r.getSource().minzoom,$=J=>{const Z=r.getTileByID(J);if(Z&&Z.hasData())return Z.getBucket(p)},j=[0,-1,1];for(const J of j){if(B.overscaledZ+J(S[0]=Math.min(B.min.y,G.min.y),S[1]=Math.max(B.max.y,G.max.y),S[2]=s.a4-G.min.x>B.max.x?G.min.x-s.a4:B.max.x,S),P=(B,G)=>(S[0]=Math.min(B.min.x,G.min.x),S[1]=Math.max(B.max.x,G.max.x),S[2]=s.a4-G.min.y>B.max.y?G.min.y-s.a4:B.max.y,S),z=[(B,G)=>I(B,G),(B,G)=>I(G,B),(B,G)=>P(B,G),(B,G)=>P(G,B)],L=(B,G,$,j,J,Z,W)=>{if(!m)return 0;const ee=[[Z?$:B,Z?B:$,0],[Z?$:G,Z?G:$,0]],ie=W<0?s.a4+W:W,ue=[Z?ie:(B+G)/2,Z?(B+G)/2:ie,0];return $===0&&W<0||$!==0&&W>0?m.getForTilePoints(J,[ue],!0,j):ee.push(ue),m.getForTilePoints(a,ee,!0,x),Math.max(ee[0][2],ee[1][2],ue[2])/m.exaggeration()};for(let B=0;B<4;B++){const G=h.borderFeatureIndices[B];if(G.length===0)continue;const $=s.b$[B](a),j=T($);if(!(j&&j instanceof s.c0)||h.borderDoneWithNeighborZ[B]===j.canonical.z)continue;j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const J=m?m.findDEMTileFor($):null;if(!(J&&J.dem||g))continue;const Z=(B<2?1:5)-B,W=j.borderDoneWithNeighborZ[Z]!==h.canonical.z,ee=j.borderFeatureIndices[Z];let ie=0;if(h.canonical.z!==j.canonical.z){for(const ue of G)h.showCentroid(h.featuresOnBorder[ue]);if(W)for(const ue of ee)j.showCentroid(j.featuresOnBorder[ue]);h.borderDoneWithNeighborZ[B]=j.canonical.z,j.borderDoneWithNeighborZ[Z]=h.canonical.z}for(const ue of G){const re=h.featuresOnBorder[ue],Y=h.centroidData[re.centroidDataIndex],_e=re.borders[B];let fe;for(;ie_e[0]+3||se[0]>_e[0]-3)break;j.showCentroid(fe),ie++}if(fe&&ie_e[1]-3)&&(Ce++,++ie!==ee.length);)fe=j.featuresOnBorder[ee[ie]];if(fe=j.featuresOnBorder[ee[se]],Ce>1){const ve=fe.borders[Z];Math.abs(_e[0]-ve[0])<3&&Math.abs(_e[1]-ve[1])<3&&(Ce=1,ie=se+1)}else if(Ce===0){h.showCentroid(re);continue}const Se=j.centroidData[fe.centroidDataIndex];g&&Ce===1&&(((k=Y).flags|(O=Se).flags)&s.c1?(k.flags|=s.c1,O.flags|=s.c1):(k.flags&=~s.c1,O.flags&=~s.c1));const he=re.intersectsCount()>1||fe.intersectsCount()>1;if(Ce>1)ie=se,Y.centroidXY=Se.centroidXY=new s.P(0,0);else if(J&&J.dem&&!he){const ve=z[B](Y,Se),ne=B%2?s.a4-1:0,Me=L(ve[0],Math.min(s.a4-1,ve[1]),ne,J,$,B<2,ve[2]);Y.centroidXY=Se.centroidXY=w(Me)}else he?Y.centroidXY=Se.centroidXY=new s.P(0,0):(Y.centroidXY=h.encodeBorderCentroid(re),Se.centroidXY=j.encodeBorderCentroid(fe));h.writeCentroidToBuffer(Y),j.writeCentroidToBuffer(Se)}else h.showCentroid(re)}h.borderDoneWithNeighborZ[B]=j.canonical.z,j.borderDoneWithNeighborZ[Z]=h.canonical.z}var k,O;(h.needsCentroidUpdate||!h.centroidVertexBuffer&&h.centroidVertexArray.length!==0)&&h.uploadCentroid(u)}const Bh=[1,0,0],Cp=[0,1,0],Al=[0,0,1];function en(u,r,a){const h=a.transform,p=a.shadowRenderer;if(!p)return!0;const m=u.toUnwrapped(),g=h.tileSize*p._cascades[a.currentShadowCascade].scale;let x=r.maxHeight;if(h.elevation){const k=h.elevation.getMinMaxForTile(u);k&&(x+=k.max)}const w=[...p.shadowDirection];w[2]=-w[2];const T=p.computeSimplifiedTileShadowVolume(m,x,g,w);if(!T)return!1;const S=[Bh,Cp,Al,w,[w[0],0,w[2]],[0,w[1],w[2]]],I=h.projection.name==="globe",P=h.scaleZoom(g),z=s.aM.fromInvProjectionMatrix(h.invProjMatrix,h.worldSize,P,!I),L=p.getCurrentCascadeFrustum();return z.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function pa(u){return[u[0]*s.c4,u[1]*s.c4,u[2]*s.c4,0]}function Cl(u,r,a,h,p,m,g,x,w){const T=h.getSource(),S=a.globeSharedBuffers;if(!S)return;let I,P,z;if(r&&(I=h.getTile(r)),T instanceof s.bo?(P=T.texture,z=s.bj(0,0,a.transform)):I&&r&&(P=I.texture,z=s.bj(r.canonical.z,r.canonical.x,a.transform)),!P||!z)return;u||(z=s.ae.scale(s.ae.create(),z,[1,-1,1]));const L=a.context,k=L.gl,O=p.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR,B=a.colorModeForDrapableLayerRenderPass(m),G=g.defines;G.push("GLOBE_POLES");const $=new s.af(k.LEQUAL,s.af.ReadWrite,a.depthRangeFor3D),j=Float32Array.from(a.transform.expandedFarZProjMatrix),J=Float32Array.from(s.bh(s.bi(new s.aO(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),L.activeTexture.set(k.TEXTURE0),P.bind(O,k.CLAMP_TO_EDGE),L.activeTexture.set(k.TEXTURE1),P.bind(O,k.CLAMP_TO_EDGE),P.useMipmap&&L.extTextureFilterAnisotropic&&a.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[Z,W,ee,ie]=r?S.getPoleBuffers(r.canonical.z,!1):S.getPoleBuffers(0,!0),ue=p.paint.get("raster-elevation");let re;u?(re=Z,a.renderDefaultNorthPole=ue!==0):(re=W,a.renderDefaultSouthPole=ue!==0);const Y=pa(g.mix),_e=((se,Ce,Se,he,ve,ne,Me,Ae,Ue,Ge,He,$e,it)=>Il(se,Ce,Se,new Float32Array(16),new Float32Array(9),[0,0],he,[0,0],[0,0,0,0],1,{opacity:1,mix:0},ne,[0,0],Ae,2,Ge,He,$e,1,0,it))(j,J,z,s.a2(a.transform.zoom),0,p,0,ue,0,Y,g.offset,g.range,m),fe=a.getOrCreateProgram("raster",{defines:G});a.uploadCommonUniforms(L,fe,null),fe.draw(a,k.TRIANGLES,$,w,B,x,_e,p.id,re,ee,ie)}function iu(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,p=.2*u.height,m=r+p;return[r,a,(m-p-r)/h,(m-r)/h]}function mo(u,r,a,h){if(u)return r instanceof Un&&u instanceof s.c5?r.getTextureDescriptor(u,a,!0):{texture:u.texture,mix:pa(h.mix),offset:h.offset,buffer:0,tileSize:1}}function Fh(u,r,a){if(!u)return null;const h=r.getTextureDescriptor(u,a,!0);if(!h)return null;let{texture:p,mix:m,offset:g,tileSize:x,buffer:w,format:T}=h;if(!p||!T)return null;let S=!1;return T==="uint32"&&(S=!0,m[3]=0,m=Xc(s.c6,m,[0,a.paint.get("raster-particle-max-speed")]),g=aa(s.c6,g,[0,a.paint.get("raster-particle-max-speed")])),{texture:p,textureOffset:[w/(x+2*w),x/(x+2*w)],tileSize:x,scalarData:S,scale:m,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Pl(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,p=.2*u.height,m=r+p;return[r,a,(m-p-r)/h,(m-r)/h]}const ru=new s.C(1,0,0,1),zl=new s.C(0,1,0,1),nu=new s.C(0,0,1,1),Ut=new s.C(1,0,1,1),Pp=new s.C(0,1,1,1);function rt(u,r,a,h,p,m,g){const x=u.context,w=u.transform,T=x.gl,S=w.projection.name==="globe",I=S?["PROJECTION_GLOBE_VIEW"]:[];let P=s.ae.clone(a.projMatrix);if(S&&s.a2(w.zoom)>0){const Y=s.c7(a.canonical,w),_e=s.c8(Y);P=s.ae.multiply(new Float32Array(16),w.globeMatrix,_e),s.ae.multiply(P,w.projMatrix,P)}const z=s.ae.create();z[12]+=2*p/(s.e.devicePixelRatio*w.width),z[13]+=2*m/(s.e.devicePixelRatio*w.height),s.ae.multiply(P,z,P);const L=u.getOrCreateProgram("debug",{defines:I}),k=r.getTileByID(a.key);u.terrain&&u.terrain.setupElevationDraw(k,L);const O=s.af.disabled,B=s.ah.disabled,G=u.colorModeForRenderPass(),$="$debug";x.activeTexture.set(T.TEXTURE0),u.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?k._makeGlobeTileDebugBuffers(u.context,w):k._makeDebugTileBoundsBuffers(u.context,w.projection);const j=k._tileDebugBuffer||u.debugBuffer,J=k._tileDebugIndexBuffer||u.debugIndexBuffer,Z=k._tileDebugSegments||u.debugSegments;if(L.draw(u,T.LINE_STRIP,O,B,G,s.ag.disabled,Ml(P,h),$,j,J,Z,null,null,null,[k._globeTileDebugBorderBuffer]),g){const Y=k.latestRawTileData,_e=Math.floor((Y&&Y.byteLength||0)/1024);let fe=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(fe+=` => ${a.overscaledZ}`),fe+=` ${k.state}`,fe+=` ${_e}kb`,function(se,Ce){se.initDebugOverlayCanvas();const Se=se.debugOverlayCanvas,he=se.context.gl,ve=se.debugOverlayCanvas.getContext("2d");ve.clearRect(0,0,Se.width,Se.height),ve.shadowColor="white",ve.shadowBlur=2,ve.lineWidth=1.5,ve.strokeStyle="white",ve.textBaseline="top",ve.font="bold 36px Open Sans, sans-serif",ve.fillText(Ce,5,5),ve.strokeText(Ce,5,5),se.debugOverlayTexture.update(Se),se.debugOverlayTexture.bind(he.LINEAR,he.CLAMP_TO_EDGE)}(u,fe)}const W=r.getTile(a).tileSize,ee=512/Math.min(W,512)*(a.overscaledZ/w.zoom)*.5,ie=k._tileDebugTextBuffer||u.debugBuffer,ue=k._tileDebugTextIndexBuffer||u.quadTriangleIndexBuffer,re=k._tileDebugTextSegments||u.debugSegments;L.draw(u,T.TRIANGLES,O,B,s.a.alphaBlended,s.ag.disabled,Ml(P,s.C.transparent,ee),$,ie,ue,re,null,null,null,[k._globeTileDebugTextBuffer])}function ou(u,r,a,h){os(u,0,r+a/2,u.transform.width,a,h)}function fa(u,r,a,h){os(u,r-a/2,0,a,u.transform.height,h)}function os(u,r,a,h,p,m){const g=u.context,x=g.gl;x.enable(x.SCISSOR_TEST),x.scissor(r*s.e.devicePixelRatio,a*s.e.devicePixelRatio,h*s.e.devicePixelRatio,p*s.e.devicePixelRatio),g.clear({color:m}),x.disable(x.SCISSOR_TEST)}const tn=s.c9([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:su}=tn;function mr(u,r,a,h){u.emplaceBack(r,a,h)}class We{constructor(r){this.vertexArray=new s.ca,this.indices=new s.bw,mr(this.vertexArray,-1,-1,1),mr(this.vertexArray,1,-1,1),mr(this.vertexArray,-1,1,1),mr(this.vertexArray,1,1,1),mr(this.vertexArray,-1,-1,-1),mr(this.vertexArray,1,-1,-1),mr(this.vertexArray,-1,1,-1),mr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,su),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=s.b.simpleSegment(0,0,36,12)}}function Lt(u,r,a,h,p,m){const g=u.context.gl,x=r.paint.get("sky-atmosphere-color"),w=r.paint.get("sky-atmosphere-halo-color"),T=r.paint.get("sky-atmosphere-sun-intensity"),S=((I,P,z,L,k)=>({u_matrix_3f:I,u_sun_direction:P,u_sun_intensity:z,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[k.r,k.g,k.b,k.a],u_luminance:5e-5}))(s.bE.fromMat4(s.bE.create(),h),p,T,x,w);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+m,r.skyboxTexture,0),a.draw(u,g.TRIANGLES,s.af.disabled,s.ah.disabled,s.a.unblended,s.ag.frontCW,S,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const Gt=s.c9([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Rr{constructor(r){const a=new s.cb;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const h=new s.bw;h.emplaceBack(0,1,2),h.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,Gt.members),this.indexBuffer=r.createIndexBuffer(h),this.segments=s.b.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ss=s.c9([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Nt{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Dl{constructor(r){this.colorModeAlphaBlendedWriteRGB=new s.a([s.cc,s.cd,s.cc,s.cd],s.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new s.a([s.cc,s.ce,s.cc,s.ce],s.C.transparent,[!1,!1,!1,!0]),this.params=new Nt,this.updateNeeded=!0,r.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),r.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(r){const a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Rr(a);const h=this.params.sizeRange,p=this.params.intensityRange,m=function(S){const I=s.ch(30),P=[];for(let z=0;z{const J=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];j&&J.push("ALPHA_PASS");const Z=r.getOrCreateProgram("globeAtmosphere",{defines:J}),W=((ie,ue,re,Y,_e,fe,se,Ce,Se,he,ve,ne)=>({u_frustum_tl:ie,u_frustum_tr:ue,u_frustum_br:re,u_frustum_bl:Y,u_horizon:_e,u_transition:fe,u_fadeout_range:se,u_color:Ce,u_high_color:Se,u_space_color:he,u_temporal_offset:ve,u_horizon_angle:ne}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,x,z,T,S,I,k,G);r.uploadCommonUniforms(h,Z);const ee=this.atmosphereBuffer;ee&&Z.draw(r,p.TRIANGLES,g,s.ah.disabled,j?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,s.ag.backCW,W,j?"atmosphere_glow_alpha":"atmosphere_glow",ee.vertexBuffer,ee.indexBuffer,ee.segments)};$(!1),$(!0)}drawStars(r,a){const h=s.au(a.properties.get("star-intensity"),0,1);if(h===0)return;const p=r.context,m=p.gl,g=r.transform,x=r.getOrCreateProgram("stars"),w=s.aw.identity([]);s.aw.rotateX(w,w,-g._pitch),s.aw.rotateZ(w,w,-g.angle),s.aw.rotateX(w,w,s.ac(g._center.lat)),s.aw.rotateY(w,w,-s.ac(g._center.lng));const T=s.ae.fromQuat(new Float32Array(16),w),S=s.ae.multiply([],g.starsProjMatrix,T),I=s.bE.fromMat4([],T),P=s.bE.invert([],I),z=[0,1,0];s.$.transformMat3(z,z,P),s.$.scale(z,z,this.params.sizeMultiplier);const L=[1,0,0];s.$.transformMat3(L,L,P),s.$.scale(L,L,this.params.sizeMultiplier);const k=(O=z,B=L,G=h,{u_matrix:Float32Array.from(S),u_up:O,u_right:B,u_intensity_multiplier:G});var O,B,G;r.uploadCommonUniforms(p,x),this.starsVx&&this.starsIdx&&x.draw(r,m.TRIANGLES,s.af.disabled,s.ah.disabled,this.colorModeAlphaBlendedWriteRGB,s.ag.disabled,k,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function as(u,r){const a=[...u],h=r.cameraWorldSizeForFog/r.worldSize,p=s.ae.identity([]);return s.ae.scale(p,p,[h,h,1]),s.ae.multiply(a,p,a),s.ae.multiply(a,r.worldToFogMatrix,a),a}function _o(u,r,a,h,p){const m=a.material,g=h.context,{baseColorTexture:x,metallicRoughnessTexture:w}=m.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:I}=m;function P(z,L,k){if(z&&(u.push(L),g.activeTexture.set(g.gl.TEXTURE0+k),z.gfxTexture)){const{minFilter:O,magFilter:B,wrapS:G,wrapT:$}=z.sampler;z.gfxTexture.bindExtraParam(O,B,G,$)}}P(x,"HAS_TEXTURE_u_baseColorTexture",$i.BaseColor),P(w,"HAS_TEXTURE_u_metallicRoughnessTexture",$i.MetallicRoughness),P(T,"HAS_TEXTURE_u_normalTexture",$i.Normal),P(S,"HAS_TEXTURE_u_occlusionTexture",$i.Occlusion),P(I,"HAS_TEXTURE_u_emissionTexture",$i.Emission),p&&(p.texture||(p.texture=new s.cj(h.context,p.image,[p.image.height,p.image.height,p.image.height],g.gl.RGBA)),g.activeTexture.set(g.gl.TEXTURE0+$i.LUT),p.texture&&p.texture.bind(g.gl.LINEAR,g.gl.CLAMP_TO_EDGE),u.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(u.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(u.push(a.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(u.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(u.push("HAS_ATTRIBUTE_a_pbr"),u.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),m.alphaMode!=="OPAQUE"&&m.alphaMode!=="MASK"||u.push("UNPREMULT_TEXTURE_IN_SHADER"),m.defined||u.push("DIFFUSE_SHADED"),u.push("USE_STANDARD_DERIVATIVES")}function Wi(u,r,a,h,p,m){const g=a.paint.get("model-opacity"),x=r.context,w=new s.af(r.context.gl.LEQUAL,s.af.ReadWrite,r.depthRangeFor3D),T=r.transform,S=u.mesh,I=S.material,P=I.pbrMetallicRoughness,z=r.style.fog;let L;L=r.transform.projection.zAxisUnit==="pixels"?[...u.nodeModelMatrix]:s.ae.multiply([],h.zScaleMatrix,u.nodeModelMatrix),s.ae.multiply(L,h.negCameraPosMatrix,L);const k=s.ae.invert([],L);s.ae.transpose(k,k);const O=a.paint.get("model-emissive-strength").constantOr(0),B=ho(new Float32Array(u.worldViewProjection),new Float32Array(L),new Float32Array(k),null,r,g,P.baseColorFactor.toRenderColor(null),I.emissiveFactor,P.metallicFactor,P.roughnessFactor,I,O,a),G={defines:[]},$=[];_o(G.defines,$,S,r,a.lut);const j=r.shadowRenderer;j&&(j.useNormalOffset=!1);let J=null;if(z){const ee=as(u.nodeModelMatrix,r.transform);if(J=new Float32Array(ee),T.projection.name!=="globe"){const ie=S.aabb.min,ue=S.aabb.max,[re,Y]=z.getOpacityForBounds(ee,ie[0],ie[1],ue[0],ue[1]);G.overrideFog=re>=Ft||Y>=Ft}}const Z=ar(r,a.paint.get("model-cutoff-fade-range"));Z.shouldRenderCutoff&&G.defines.push("RENDER_CUTOFF");const W=r.getOrCreateProgram("model",G);r.uploadCommonUniforms(x,W,null,J,Z),r.renderPass!=="shadow"&&j&&j.setupShadowsFromMatrix(u.nodeModelMatrix,W),W.draw(r,x.gl.TRIANGLES,w,p,m,S.material.doubleSided?s.ag.disabled:s.ag.backCCW,B,a.id,S.vertexBuffer,S.indexBuffer,S.segments,a.paint,r.transform.zoom,void 0,$)}function mi(u,r,a,h,p,m,g){let x;x=u.projection.name==="globe"?s.ck(a,u):[...a],s.ae.multiply(x,x,r.matrix);const w=s.ae.multiply([],h,x);if(r.meshes)for(const T of r.meshes){if(T.material.alphaMode!=="BLEND"){g.push({mesh:T,depth:0,modelIndex:p,worldViewProjection:w,nodeModelMatrix:x});continue}const S=s.$.transformMat4([],T.centroid,w);S[2]>0&&m.push({mesh:T,depth:S[2],modelIndex:p,worldViewProjection:w,nodeModelMatrix:x})}if(r.children)for(const T of r.children)mi(u,T,a,h,p,m,g)}function au(u,r,a,h){const p=a.shadowRenderer;if(!p)return;const m=p.getShadowPassDepthMode(),g=p.getShadowPassColorMode(),x=p.calculateShadowPassMatrixFromMatrix(r),w=Qc(x);a.getOrCreateProgram("modelDepth",{defines:a._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(a,a.context.gl.TRIANGLES,m,s.ah.disabled,g,s.ag.backCCW,w,h.id,u.vertexBuffer,u.indexBuffer,u.segments,h.paint,a.transform.zoom,void 0,void 0)}function ma(u,r,a){const h=r.updateZoomBasedPaintProperties(),p=function(m,g,x){let w,T,S,I=m.terrain?m.terrain.exaggeration():0;if(m.terrain&&I>0){const P=m.terrain,z=P.findDEMTileFor(x);z&&z.dem?w=s.cm.create(P,x,z):I=0}if(I===0&&(g.terrainElevationMin=0,g.terrainElevationMax=0),I===g.validForExaggeration&&(I===0||w&&w._demTile&&w._demTile.tileID===g.validForDEMTile.id&&w._dem._timestamp===g.validForDEMTile.timestamp))return!1;for(const P in g.instancesPerModel){const z=g.instancesPerModel[P];for(let L=0;LT&&(T=z.max)}const S=s.au(h.x,m,g)-h.x,I=s.au(h.y,x,w)-h.y,P=s.ay(T,r.center.lat)-h.z;return r._zoomFromMercatorZ(Math.sqrt(S*S+I*I+P*P))}function Rl(u,r,a,h,p,m,g){const x=u.context,w=u.renderPass==="shadow",T=u.shadowRenderer,S=w&&T?T.getShadowPassDepthMode():new s.af(x.gl.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D),I=u.isTileAffectedByFog(m);if(a.meshes)for(const P of a.meshes){const z=["MODEL_POSITION_ON_GPU"],L=[];let k,O,B;h.instancedDataArray.length>20&&z.push("INSTANCED_ARRAYS");const G=ar(u,r.paint.get("model-cutoff-fade-range"));if(G.shouldRenderCutoff&&z.push("RENDER_CUTOFF"),w&&T)k=u.getOrCreateProgram("modelDepth",{defines:z}),O=Qc(g.shadowTileMatrix,g.shadowTileMatrix,Float32Array.from(a.matrix)),B=T.getShadowPassColorMode();else{_o(z,L,P,u,r.lut),k=u.getOrCreateProgram("model",{defines:z,overrideFog:I});const j=P.material,J=j.pbrMetallicRoughness,Z=r.paint.get("model-opacity"),W=r.paint.get("model-emissive-strength").constantOr(0);O=ho(m.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,u,Z,J.baseColorFactor.toRenderColor(null),j.emissiveFactor,J.metallicFactor,J.roughnessFactor,j,W,r,p),T&&(g.shadowUniformsInitialized?k.setShadowUniformValues(x,T.getShadowUniformValues()):(T.setupShadows(m.toUnwrapped(),k,"model-tile",m.overscaledZ),g.shadowUniformsInitialized=!0)),B=G.shouldRenderCutoff||Z<1||j.alphaMode!=="OPAQUE"?s.a.alphaBlended:s.a.unblended}u.uploadCommonUniforms(x,k,m.toUnwrapped(),null,G);const $=P.material.doubleSided?s.ag.disabled:s.ag.backCCW;if(h.instancedDataArray.length>20)L.push(h.instancedDataBuffer),k.draw(u,x.gl.TRIANGLES,S,s.ah.disabled,B,$,O,r.id,P.vertexBuffer,P.indexBuffer,P.segments,r.paint,u.transform.zoom,void 0,L,h.instancedDataArray.length);else{const j=w?"u_instance":"u_normal_matrix";for(let J=0;JT[1]?x:T,g[0]=a.max[0],x=s.aB.transformMat4([],g,m),w=x[1]T[1]?x:T,g[1]=a.min[1],x=s.aB.transformMat4([],g,m),w=x[1]T[1]?x:T;const S=s.au(h[0],0,1),I=100*r.pixelsPerMeter*s.au(h[1],0,1),P=s.au(h[2],0,1),z=s.$.lerp([],w,T,S),L=Math.tan(.5*r.fovX),k=-z[2]*L;if(I===0)return z[1]<-Math.abs(k)?P:1;const O=(-Math.abs(k)-z[1])/I,B=($,j,J)=>(1-J)*$+J*j,G=s.au(B(1,P,O),P,1);return B(1,G,s.au((r.pitch-20)/20,0,1))}class ls{}class Ii{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,h){{const I=this._storage.get(a.id);if(I)return I.lastUsedFrameIdx=r,I.buf}const p=h.gl,m=p.getBufferParameter(p.ELEMENT_ARRAY_BUFFER,p.BUFFER_SIZE),g=new ArrayBuffer(m),x=new Int16Array(g);p.getBufferSubData(p.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const w=new s.co;for(let I=0;I30&&(h.buf.destroy(),this._storage.delete(a))}destroy(){for(const[r,a]of this._storage)a.buf.destroy(),this._storage.delete(r)}}class qr{constructor(r){this.occluderSize=30,this.depthOffset=-1e-4,r.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),r.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Zr={symbol:function(u,r,a,h,p){if(u.renderPass!=="translucent")return;const m=s.ah.disabled,g=u.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(T,S,I,P,z,L,k){const O=S.transform,B=z==="map",G=L==="map";for(const $ of T){const j=P.getTile($),J=j.getBucket(I);if(!J||!J.text||!J.text.segments.get().length)continue;const Z=s.aE(J.textSizeData,O.zoom),W=eu($,J.getProjection(),O),ee=O.calculatePixelsToTileUnitsMatrix(j),ie=Ys(W,j.tileID.canonical,G,B,O,J.getProjection(),ee),ue=J.hasIconTextFit()&&J.hasIconData();if(Z){const re=Math.pow(2,O.zoom-j.tileID.overscaledZ);Ip(J,B,G,k,s.bQ,O,ie,$,re,Z,ue)}}}(h,u,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),p);const x=a.paint.get("icon-opacity").constantOr(1)!==0,w=a.paint.get("text-opacity").constantOr(1)!==0;a.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(x||w)?ha(u,r,a,h,m,g):(x&&ha(u,r,a,h,m,g,{onlyIcons:!0}),w&&ha(u,r,a,h,m,g,{onlyText:!0})),r.map.showCollisionBoxes&&(Lh(u,r,a,h,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),Lh(u,r,a,h,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(u,r,a,h){if(u.renderPass!=="translucent")return;const p=a.paint.get("circle-opacity"),m=a.paint.get("circle-stroke-width"),g=a.paint.get("circle-stroke-opacity"),x=a.layout.get("circle-sort-key").constantOr(1)!==void 0,w=a.paint.get("circle-emissive-strength");if(p.constantOr(1)===0&&(m.constantOr(1)===0||g.constantOr(1)===0))return;const T=u.context,S=T.gl,I=u.transform,P=u.depthModeForSublayer(0,s.af.ReadOnly),z=s.ah.disabled,L=u.colorModeForDrapableLayerRenderPass(w),k=I.projection.name==="globe",O=[s.ak(I.center.lng),s.al(I.center.lat)],B=[];for(let $=0;$$.sortKey-j.sortKey);const G={useDepthForOcclusion:I.depthOcclusionForSymbolsAndCircles};for(const $ of B){const{programConfiguration:j,program:J,layoutVertexBuffer:Z,globeExtVertexBuffer:W,indexBuffer:ee,uniformValues:ie,tile:ue}=$.state,re=$.segments;u.terrain&&u.terrain.setupElevationDraw(ue,J,G),u.uploadCommonUniforms(T,J,ue.tileID.toUnwrapped()),J.draw(u,S.TRIANGLES,P,z,L,s.ag.disabled,ie,a.id,Z,ee,re,a.paint,I.zoom,j,[W])}},heatmap:function(u,r,a,h){if(a.paint.get("heatmap-opacity")!==0)if(u.renderPass==="offscreen"){const p=u.context,m=p.gl,g=s.ah.disabled,x=new s.a([m.ONE,m.ONE,m.ONE,m.ONE],s.C.transparent,[!0,!0,!0,!0]);(function(z,L,k,O){const B=z.gl,G=L.width*O,$=L.height*O;z.activeTexture.set(B.TEXTURE1),z.viewport.set([0,0,G,$]);let j=k.heatmapFbo;if(!j||j&&(j.width!==G||j.height!==$)){j&&j.destroy();const J=B.createTexture();B.bindTexture(B.TEXTURE_2D,J),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),j=k.heatmapFbo=z.createFramebuffer(G,$,!0,null),function(Z,W,ee,ie,ue,re){const Y=Z.gl;Y.texImage2D(Y.TEXTURE_2D,0,Z.extRenderToTextureHalfFloat?Y.RGBA16F:Y.RGBA,ue,re,0,Y.RGBA,Z.extRenderToTextureHalfFloat?Y.HALF_FLOAT:Y.UNSIGNED_BYTE,null),ie.colorAttachment.set(ee)}(z,0,J,j,G,$)}else B.bindTexture(B.TEXTURE_2D,j.colorAttachment.get()),z.bindFramebuffer.set(j.framebuffer)})(p,u,a,u.transform.projection.name==="globe"?.5:.25),p.clear({color:s.C.transparent});const w=u.transform,T=w.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],I=T?s.ag.frontCCW:s.ag.disabled,P=[s.ak(w.center.lng),s.al(w.center.lat)];for(let z=0;z({u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}))(0,m),m.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,m.paint,p.transform.zoom)}(u,a))},line:function(u,r,a,h){if(u.renderPass!=="translucent")return;const p=a.paint.get("line-opacity"),m=a.paint.get("line-width");if(p.constantOr(1)===0||m.constantOr(1)===0)return;const g=a.paint.get("line-emissive-strength"),x=a.paint.get("line-occlusion-opacity"),w=u.context,T=w.gl,S=a.layout.get("line-z-offset"),I=!S.isConstant()||!!S.constantOr(0),P=I?new s.af(u.depthOcclusion?T.GREATER:T.LEQUAL,s.af.ReadOnly,u.depthRangeFor3D):u.depthModeForSublayer(0,s.af.ReadOnly),z=u.colorModeForDrapableLayerRenderPass(g),L=u.terrain&&u.terrain.renderingToTexture,k=L?1:s.e.devicePixelRatio,O=a.paint.get("line-dasharray"),B=O.constantOr(1),G=a.layout.get("line-cap"),$=O.constantOr(null),j=G.constantOr(null),J=a.paint.get("line-pattern"),Z=J.constantOr(1),W=J.constantOr(null),ee=a.paint.get("line-opacity").constantOr(1);let ie=!Z&&ee!==1||u.depthOcclusion&&x>0&&x<1;const ue=a.paint.get("line-gradient"),re=Z?"linePattern":"line",Y=s.bV(a);let _e;if(L&&u.terrain&&u.terrain.clipOrMaskOverlapStencilType()&&(ie=!1),x!==0&&u.depthOcclusion){const se=a.paint._values["line-opacity"];se&&se.value&&se.value.kind==="constant"?_e=se.value:s.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}if(I&&(u.forceTerrainMode=!0),!I&&x!==0&&u.terrain&&!L)return void s.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has non-zero line-z-offset.`);const fe=ie&&I?u.stencilModeFor3D():s.ah.disabled;for(const se of h){const Ce=r.getTile(se);if(Z&&!Ce.patternsLoaded())continue;const Se=Ce.getBucket(a);if(!Se)continue;u.prepareDrawTile();const he=Se.programConfigurations.get(a.id),ve=u.isTileAffectedByFog(se),ne=u.getOrCreateProgram(re,{config:he,defines:I?[...Y,"ELEVATED"]:Y,overrideFog:ve});if(W&&Ce.imageAtlas){const $e=Ce.imageAtlas.patternPositions[W.toString()];$e&&he.setConstantPatternPositions($e)}if(!Z&&$&&j&&Ce.lineAtlas){const $e=Ce.lineAtlas.getDash($,j);$e&&he.setConstantPatternPositions($e)}let[Me,Ae]=a.paint.get("line-trim-offset");(j==="round"||j==="square")&&Me!==Ae&&(Me===0&&(Me-=1),Ae===1&&(Ae+=1));const Ue=L?se.projMatrix:null,Ge=Z?s.bW(u,Ce,a,Ue,k,[Me,Ae]):s.bX(u,Ce,a,Ue,Se.lineClipsArray.length,k,[Me,Ae]);if(ue){const $e=Se.gradients[a.id];let it=$e.texture;if(a.gradientVersion!==$e.version){let _t=256;if(a.stepInterpolant){const nt=r.getSource().maxzoom,xt=se.canonical.z===nt?Math.ceil(1<{_e!=null&&(_e.value=ee*x),ne.draw(u,T.TRIANGLES,P,$e,z,s.ag.disabled,Ge,a.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,a.paint,u.transform.zoom,he,[Se.layoutVertexBuffer2,Se.patternVertexBuffer,Se.zOffsetVertexBuffer]),_e!=null&&(_e.value=ee)};if(ie&&!I){const $e=u.stencilModeForClipping(se).ref;$e===0&&L&&w.clear({stencil:0});const it={func:T.EQUAL,mask:255};Ge.u_alpha_discard_threshold=.8,He(new s.ah(it,$e,255,T.KEEP,T.KEEP,T.INVERT)),Ge.u_alpha_discard_threshold=0,He(new s.ah(it,$e,255,T.KEEP,T.KEEP,T.KEEP))}else ie&&I&&(Ge.u_alpha_discard_threshold=.001),He(I?fe:u.stencilModeForClipping(se))}ie&&(u.resetStencilClippingMasks(),L&&w.clear({stencil:0})),x===0||u.depthOcclusion||L||u.layersWithOcclusionOpacity.push(u.currentLayer),I&&(u.forceTerrainMode=!1)},fill:function(u,r,a,h){const p=a.paint.get("fill-color"),m=a.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const g=a.paint.get("fill-emissive-strength"),x=u.colorModeForDrapableLayerRenderPass(g),w=a.paint.get("fill-pattern"),T=u.opaquePassEnabledForLayer()&&!w.constantOr(1)&&p.constantOr(s.C.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";if(u.renderPass===T){const S=u.depthModeForSublayer(1,u.renderPass==="opaque"?s.af.ReadWrite:s.af.ReadOnly);da(u,r,a,h,S,x,!1)}if(u.renderPass==="translucent"&&a.paint.get("fill-antialias")){const S=u.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,s.af.ReadOnly);da(u,r,a,h,S,x,!0)}},"fill-extrusion":function(u,r,a,h){const p=a.paint.get("fill-extrusion-opacity"),m=u.context,g=m.gl,x=u.terrain,w=x&&x.renderingToTexture;if(p===0)return;const T=u.conflationActive&&u.style.isLayerClipped(a,r.getSource()),S=u.style.order.indexOf(a.fqid);if(T&&function(I,P,z,L,k){for(const O of L){const B=P.getTile(O).getBucket(z);B&&(B.updateReplacement(O,I.replacementSource,k),B.uploadCentroid(I.context))}}(u,r,a,h,S),x||T)for(const I of h){const P=r.getTile(I).getBucket(a);P&&Ap(u.context,r,I,P,a,x,T)}if(u.renderPass==="shadow"&&u.shadowRenderer){const I=u.shadowRenderer;if(x&&p<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.Z)return;const P=I.getShadowPassDepthMode(),z=I.getShadowPassColorMode();fo(u,r,a,h,P,s.ah.disabled,z,T)}else if(u.renderPass==="translucent"){const I=!a.paint.get("fill-extrusion-pattern").constantOr(1),P=a.paint.get("fill-extrusion-color").constantOr(s.C.white);if(!w&&P.a!==0){const z=new s.af(u.context.gl.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D);p===1&&I?fo(u,r,a,h,z,s.ah.disabled,s.a.unblended,T):(fo(u,r,a,h,z,s.ah.disabled,s.a.disabled,T),fo(u,r,a,h,z,u.stencilModeFor3D(),u.colorModeForRenderPass(),T),u.resetStencilClippingMasks())}if(u.style.enable3dLights()&&I&&(!x&&u.transform.projection.name!=="globe"||w)){const z=a.paint.get("fill-extrusion-opacity"),L=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),O=a.paint.get("fill-extrusion-flood-light-intensity"),B=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),G=L>0&&k>0,$=O>0,j=(Z,W,ee)=>(1-ee)*Z+ee*W,J=Z=>{const W=u.depthModeForSublayer(1,s.af.ReadOnly,g.LEQUAL,!0),ee=a.paint.get(Z?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ie=j(.1,3,ee),ue=u._showOverdrawInspector;if(!ue){const re=new s.ah({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),Y=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ns(u,r,a,h,W,re,Y,s.ag.disabled,Z,"sdf",z,L,k,O,B,ie,T,!1)}{const re=ue?s.ah.disabled:new s.ah({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),Y=ue?u.colorModeForRenderPass():new s.a([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],s.C.transparent,[!0,!0,!0,!0]);ns(u,r,a,h,W,re,Y,s.ag.disabled,Z,"color",z,L,k,O,B,ie,T,!1)}};if(w){const Z=(W,ee,ie)=>{const ue=u.depthModeForSublayer(1,s.af.ReadOnly,g.LEQUAL,!1),re=a.paint.get(W?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Y=j(.1,3,re);{const _e=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0]);ns(u,r,a,h,ue,s.ah.disabled,_e,s.ag.disabled,W,"clear",z,L,k,O,B,Y,T,ee)}{const _e=new s.ah({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),fe=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ns(u,r,a,h,ue,_e,fe,s.ag.disabled,W,"sdf",z,L,k,O,B,Y,T,ee)}{const _e=W?g.ZERO:g.ONE_MINUS_DST_ALPHA,fe=new s.ah({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),se=new s.a([_e,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],s.C.transparent,[!0,!0,!0,!0]);ns(u,r,a,h,ue,fe,se,s.ag.disabled,W,"color",z,L,k,O,B,Y,T,ee)}{const _e=new s.a([g.ONE,g.ONE,g.ONE,W?g.ZERO:g.ONE],s.C.transparent,[!1,!1,!1,!0],W?g.FUNC_ADD:g.MAX);ns(u,r,a,h,ue,s.ah.disabled,_e,s.ag.disabled,W,"clear",z,L,k,O,B,Y,T,ee,ie)}};if(G||$){let W;if(u.prepareDrawTile(),x){const ee=x.drapeBufferSize[0],ie=x.drapeBufferSize[1];W=x.framebufferCopyTexture,W&&(!W||W.size[0]===ee&&W.size[1]===ie)||(W&&W.destroy(),W=x.framebufferCopyTexture=new s.T(m,new s.j({width:ee,height:ie}),g.RGBA)),W.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,0,0,ee,ie,0)}G&&Z(!0,!1,W),$&&Z(!1,!0,W)}}else G&&J(!0),$&&J(!1),(G||$)&&u.resetStencilClippingMasks()}}},hillshade:function(u,r,a,h){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent"||u.style.disableElevatedTerrain)return;const p=u.context,m=u.terrain&&u.terrain.renderingToTexture,[g,x]=u.renderPass!=="translucent"||m?[{},h]:u.stencilConfigForOverlap(h);for(const w of x){const T=r.getTile(w);if(T.needsHillshadePrepare&&u.renderPass==="offscreen")Tp(u,T,a);else if(u.renderPass==="translucent"){const S=u.depthModeForSublayer(0,s.af.ReadOnly),I=a.paint.get("hillshade-emissive-strength"),P=u.colorModeForDrapableLayerRenderPass(I),z=m&&u.terrain?u.terrain.stencilModeForRTTOverlap(w):g[w.overscaledZ];wp(u,w,T,a,S,z,P)}}p.viewport.set([0,0,u.width,u.height]),u.resetStencilClippingMasks()},raster:function(u,r,a,h,p,m){if(u.renderPass!=="translucent"||a.paint.get("raster-opacity")===0)return;const g=u.transform.projection.name==="globe",x=a.paint.get("raster-elevation")!==0,w=x&&g;if(u.renderElevatedRasterBackface&&!w)return;const T=u.context,S=T.gl,I=r.getSource(),P=function(Z,W,ee,ie){const ue=W.paint.get("raster-color"),re=Z.type==="raster-array",Y=[],_e=W.paint.get("raster-resampling"),fe=W.paint.get("raster-color-mix");let se=W.paint.get("raster-color-range");const Ce=[fe[0],fe[1],fe[2],0],Se=fe[3];let he=_e==="nearest"?ie.NEAREST:ie.LINEAR;if(re&&(Y.push("RASTER_ARRAY"),ue||Y.push("RASTER_COLOR"),_e==="linear"&&Y.push("RASTER_ARRAY_LINEAR"),he=ie.NEAREST,!se&&Z.rasterLayers)){const ve=Z.rasterLayers.find(({id:ne})=>ne===W.sourceLayer);ve&&ve.fields&&ve.fields.range&&(se=ve.fields.range)}if(se=se||[0,1],ue){Y.push("RASTER_COLOR"),ee.activeTexture.set(ie.TEXTURE2),W.updateColorRamp(se);let ve=W.colorRampTexture;ve||(ve=W.colorRampTexture=new s.T(ee,W.colorRamp,ie.RGBA)),ve.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}return{mix:Ce,range:se,offset:Se,defines:Y,resampling:he}}(I,a,T,S);if(I instanceof s.bo&&!h.length&&!g)return;const z=a.paint.get("raster-emissive-strength"),L=u.colorModeForDrapableLayerRenderPass(z),k=u.terrain&&u.terrain.renderingToTexture,O=!u.options.moving,B=a.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(I instanceof s.bo&&!h.length&&(I.onNorthPole||I.onSouthPole)){const Z=x?u.stencilModeFor3D():s.ah.disabled;return void Cl(!!I.onNorthPole,null,u,r,a,z,P,s.ag.disabled,Z)}if(!h.length)return;const[G,$]=I instanceof s.bo||k?[{},h]:u.stencilConfigForOverlap(h),j=$[$.length-1].overscaledZ;w&&P.defines.push("PROJECTION_GLOBE_VIEW"),x&&P.defines.push("RENDER_CUTOFF");const J=(Z,W,ee)=>{for(const ie of Z){const ue=ie.toUnwrapped(),re=r.getTile(ie);if(k&&(!re||!re.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const Y=mo(re,I,a,P);if(!Y||!Y.texture)continue;const{texture:_e,mix:fe,offset:se,tileSize:Ce,buffer:Se}=Y;let he,ve;k?(he=s.af.disabled,ve=ie.projMatrix):x?(he=new s.af(S.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D),ve=g?Float32Array.from(u.transform.expandedFarZProjMatrix):u.transform.calculateProjMatrix(ue,O)):(he=u.depthModeForSublayer(ie.overscaledZ-j,a.paint.get("raster-opacity")===1?s.af.ReadWrite:s.af.ReadOnly,S.LESS),ve=u.transform.calculateProjMatrix(ue,O));const ne=u.terrain&&k?u.terrain.stencilModeForRTTOverlap(ie):G[ie.overscaledZ],Me=m?0:a.paint.get("raster-fade-duration");re.registerFadeDuration(Me);const Ae=r.findLoadedParent(ie,0),Ue=vl(re,Ae,r,u.transform,Me);let Ge,He;u.terrain&&u.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),_e.bind(B,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),Ae?(Ae.texture&&Ae.texture.bind(B,S.CLAMP_TO_EDGE),Ge=Math.pow(2,Ae.tileID.overscaledZ-re.tileID.overscaledZ),He=[re.tileID.canonical.x*Ge%1,re.tileID.canonical.y*Ge%1]):_e.bind(B,S.CLAMP_TO_EDGE),_e.useMipmap&&T.extTextureFilterAnisotropic&&u.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const $e=u.transform;let it;const _t=x?iu($e):[0,0,0,0];let nt,xt,Ct,ii,Jt,Pt=0;if(w&&I instanceof s.bo&&I.coordinates.length>3)nt=Float32Array.from(s.bh(s.bi(new s.aO(0,0,0)))),xt=Float32Array.from($e.globeMatrix),Ct=Float32Array.from(s.bd($e)),ii=[s.ak($e.center.lng),s.al($e.center.lat)],it=I.elevatedGlobePerspectiveTransform,Jt=I.elevatedGlobeGridMatrix||new Float32Array(9);else if(w){const gt=s.be(ie.canonical);Pt=s.bf(gt.getCenter().lat),nt=Float32Array.from(s.bh(s.bi(ie.canonical))),xt=Float32Array.from($e.globeMatrix),Ct=Float32Array.from(s.bd($e)),ii=[s.ak($e.center.lng),s.al($e.center.lat)],it=[0,0],Jt=Float32Array.from(s.bg(ie.canonical,gt,Pt,$e.worldSize/$e._pixelsPerMercatorPixel))}else it=I instanceof s.bo?I.perspectiveTransform:[0,0],nt=new Float32Array(16),xt=new Float32Array(9),Ct=new Float32Array(16),ii=[0,0],Jt=new Float32Array(9);const Xt=Il(ve,nt,xt,Ct,Jt,He||[0,0],s.a2(u.transform.zoom),ii,_t,Ge||1,Ue,a,it,x?a.paint.get("raster-elevation"):0,2,fe,se,P.range,Ce,Se,z),Tt=u.isTileAffectedByFog(ie),St=u.getOrCreateProgram("raster",{defines:P.defines,overrideFog:Tt});if(u.uploadCommonUniforms(T,St,ue),I instanceof s.bo){const gt=I.elevatedGlobeVertexBuffer,Ot=I.elevatedGlobeIndexBuffer;if(k||!g)I.boundsBuffer&&I.boundsSegments&&St.draw(u,S.TRIANGLES,he,s.ah.disabled,L,s.ag.disabled,Xt,a.id,I.boundsBuffer,u.quadTriangleIndexBuffer,I.boundsSegments);else if(gt&&Ot){const Mt=$e.zoom<=s.b3?I.elevatedGlobeSegments:I.getSegmentsForLongitude($e.center.lng);Mt&&St.draw(u,S.TRIANGLES,he,s.ah.disabled,L,W,Xt,a.id,gt,Ot,Mt)}}else if(w){he=new s.af(S.LEQUAL,s.af.ReadOnly,u.depthRangeFor3D);const gt=u.globeSharedBuffers;if(gt){const[Ot,Mt,at]=gt.getGridBuffers(Pt,!1);St.draw(u,S.TRIANGLES,he,ee||ne,u.colorModeForRenderPass(),W,Xt,a.id,Ot,Mt,at)}}else{const{tileBoundsBuffer:gt,tileBoundsIndexBuffer:Ot,tileBoundsSegments:Mt}=u.getTileBoundsBuffers(re);St.draw(u,S.TRIANGLES,he,ne,L,s.ag.disabled,Xt,a.id,gt,Ot,Mt)}}if(!(I instanceof s.bo)&&w)for(const ie of Z){const ue=ie.canonical.y===(1<>>16,2654435769),((ie=Math.imul(ie^ie>>>16,2654435769))>>>0)/4294967296},ee=1/1.1;for(let ie=0;ies.b$[ne](_e));Se.push(_e);const he=_e.canonical.x,ve=_e.canonical.y;for(const ne of Se){const Me=j.getTile(ue?ne.wrapped():ne);if(!Me)continue;const Ae=Me.rasterParticleState;if(!Ae)continue;const Ue=ne.canonical.x+(1<j.tileID)),I&&(x.activeTexture.set(w.TEXTURE0),u.imageManager.bind(u.context,a.scope));for(const j of $){const J=u.isTileAffectedByFog(j),Z=u.getOrCreateProgram(B,{overrideFog:J}),W=j.toUnwrapped(),ee=h?j.projMatrix:u.transform.calculateProjMatrix(W);u.prepareDrawTile();const ie=r?r.getTile(j):G?G[j.key]:new s.bA(j,S,T.zoom,u),ue=I?Mp(ee,g,m,u,0,a.scope,P,{tileID:j,tileSize:S}):Kc(ee,g,m,p.toRenderColor(a.lut));u.uploadCommonUniforms(x,Z,W);const{tileBoundsBuffer:re,tileBoundsIndexBuffer:Y,tileBoundsSegments:_e}=u.getTileBoundsBuffers(ie);Z.draw(u,w.TRIANGLES,k,L,O,s.ag.disabled,ue,a.id,re,Y,_e)}},sky:function(u,r,a){const h=u._atmosphere?s.a2(u.transform.zoom):1,p=a.paint.get("sky-opacity")*h;if(p===0)return;const m=u.context,g=a.paint.get("sky-type"),x=new s.af(m.gl.LEQUAL,s.af.ReadOnly,[0,1]),w=u.frameCounter/1e3%1;g==="atmosphere"?u.renderPass==="offscreen"?a.needsSkyboxCapture(u)&&(function(T,S,I,P){const z=T.context,L=z.gl;let k=S.skyboxFbo;if(!k){k=S.skyboxFbo=z.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new We(z),S.skyboxTexture=z.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,S.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let $=0;$<6;++$)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}z.bindFramebuffer.set(k.framebuffer),z.viewport.set([0,0,32,32]);const O=S.getCenter(T,!0),B=T.getOrCreateProgram("skyboxCapture"),G=new Float64Array(16);s.ae.identity(G),s.ae.rotateY(G,G,.5*-Math.PI),Lt(T,S,B,G,O,0),s.ae.identity(G),s.ae.rotateY(G,G,.5*Math.PI),Lt(T,S,B,G,O,1),s.ae.identity(G),s.ae.rotateX(G,G,.5*-Math.PI),Lt(T,S,B,G,O,2),s.ae.identity(G),s.ae.rotateX(G,G,.5*Math.PI),Lt(T,S,B,G,O,3),s.ae.identity(G),Lt(T,S,B,G,O,4),s.ae.identity(G),s.ae.rotateY(G,G,Math.PI),Lt(T,S,B,G,O,5),z.viewport.set([0,0,T.width,T.height])}(u,a),a.markSkyboxValid(u)):u.renderPass==="sky"&&function(T,S,I,P,z){const L=T.context,k=L.gl,O=T.transform,B=T.getOrCreateProgram("skybox");L.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_CUBE_MAP,S.skyboxTexture);const G=(($,j,J,Z,W)=>({u_matrix:$,u_sun_direction:j,u_cubemap:0,u_opacity:Z,u_temporal_offset:W}))(O.skyboxMatrix,S.getCenter(T,!1),0,P,z);T.uploadCommonUniforms(L,B),B.draw(T,k.TRIANGLES,I,s.ah.disabled,T.colorModeForRenderPass(),s.ag.backCW,G,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(u,a,x,p,w):g==="gradient"&&u.renderPass==="sky"&&function(T,S,I,P,z){const L=T.context,k=L.gl,O=T.transform,B=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new We(L)),L.activeTexture.set(k.TEXTURE0);let G=S.colorRampTexture;G||(G=S.colorRampTexture=new s.T(L,S.colorRamp,k.RGBA)),G.bind(k.LINEAR,k.CLAMP_TO_EDGE);const $=((j,J,Z,W,ee)=>({u_matrix:j,u_color_ramp:0,u_center_direction:J,u_radius:s.ac(Z),u_opacity:W,u_temporal_offset:ee}))(O.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),P,z);T.uploadCommonUniforms(L,B),B.draw(T,k.TRIANGLES,I,s.ah.disabled,T.colorModeForRenderPass(),s.ag.backCW,$,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(u,a,x,p,w)},debug:function(u,r,a,h,p,m){for(let g=0;g{g&&(g.useNormalOffset=!0,x||(g.enabled=!0))},T=r.getSource();if(u.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(B,G,$,j,J){const Z=B.transform;if(Z.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${Z.projection.name} projection is not yet implemented`);const W=Z.getFreeCameraOptions().position;if(!B.modelManager)return;const ee=B.modelManager;$.modelManager=ee;const ie=B.shadowRenderer;if(!$._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ue=$._unevaluatedLayout._values["model-id"],re={...$.layout.get("model-id").parameters},Y=B.style.order.indexOf($.fqid);for(const _e of j){const fe=G.getTile(_e).getBucket($);if(!fe||fe.projection.name!==Z.projection.name)continue;const se=fe.getModelUris();se&&!fe.modelsRequested&&(ee.addModelsFromBucket(se,J),fe.modelsRequested=!0);const Ce=_a(_e,Z);re.zoom=Ce;const Se=ue.possiblyEvaluate(re);if(ma(B,fe,_e),Lr.shadowUniformsInitialized=!1,Lr.useSingleShadowCascade=!!ie&&ie.getMaxCascadeForTile(_e.toUnwrapped())===0,B.renderPass==="shadow"&&ie){if(B.currentShadowCascade===1&&fe.isInsideFirstShadowMapFrustum)continue;const ne=Z.calculatePosMatrix(_e.toUnwrapped(),Z.worldSize);if(Lr.tileMatrix.set(ne),Lr.shadowTileMatrix=Float32Array.from(ie.calculateShadowPassMatrixFromMatrix(ne)),Lr.aabb.min.fill(0),Lr.aabb.max[0]=Lr.aabb.max[1]=s.a4,Lr.aabb.max[2]=0,ir(fe,Lr,B,$.scope))continue}const he=1<<_e.canonical.z,ve=[((W.x-_e.wrap)*he-_e.canonical.x)*s.a4,(W.y*he-_e.canonical.y)*s.a4,W.z*he*s.a4];B.conflationActive&&Object.keys(fe.instancesPerModel).length>0&&B.style.isLayerClipped($,G.getSource())&&fe.updateReplacement(_e,B.replacementSource,Y,J)&&(fe.uploaded=!1,fe.upload(B.context));for(let ne in fe.instancesPerModel){const Me=fe.instancesPerModel[ne];Me.features.length>0&&(ne=Se.evaluate(Me.features[0].feature,{}));const Ae=ee.getModel(ne,J);if(Ae&&Ae.uploaded)for(const Ue of Ae.nodes)Rl(B,$,Ue,Me,ve,_e,Lr)}}}(u,r,a,h,T.type==="vector"?a.scope:""),void w();if(!T.loaded())return;if(T.type==="batched-model")return function(B,G,$,j){$.resetLayerRenderingStats(B);const J=B.context,Z=B.transform,W=B.style.fog,ee=B.shadowRenderer;if(Z.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${Z.projection.name} projection is not yet implemented`);const ie=B.transform.getFreeCameraOptions().position,ue=s.$.scale([],[ie.x,ie.y,ie.z],B.transform.worldSize);s.$.negate(ue,ue);const re=s.ae.identity([]),Y=s.ci(Z.center.lat,Z.zoom),_e=s.ae.fromScaling([],[1,1,1/Y]);s.ae.translate(re,re,ue);const fe=$.paint.get("model-opacity"),se=new s.af(J.gl.LEQUAL,s.af.ReadWrite,B.depthRangeFor3D),Ce=new s.af(J.gl.LEQUAL,s.af.ReadOnly,B.depthRangeFor3D),Se=new s.b8([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),he=B.renderPass==="shadow",ve=he&&ee?ee.getCurrentCascadeFrustum():Z.getFrustum(Z.scaleZoom(Z.worldSize)),ne=$.paint.get("model-front-cutoff"),Me=ne[2]<1,Ae=ar(B,$.paint.get("model-cutoff-fade-range")),Ue=$.getLayerRenderingStats();(function(Ge,He,$e,it){const _t=Ge.terrain?Ge.terrain.exaggeration():0,nt=Ge.transform.zoom;for(const xt of it){const Ct=He.getTile(xt).getBucket($e);Ct&&(Ge.conflationActive&&Ct.updateReplacement(xt,Ge.replacementSource),Ct.evaluateScale(Ge,$e),Ge.terrain&&_t>0&&Ct.elevationUpdate(Ge.terrain,_t,xt,$e.source),Ct.needsReEvaluation(Ge,nt,$e)&&Ct.evaluate($e))}})(B,G,$,j),function(){let Ge,He,$e;Me?(Ge=j.length-1,He=-1,$e=-1):(Ge=0,He=j.length,$e=1);for(let it=Ge;it!==He;it+=$e){const _t=j[it],nt=G.getTile(_t).getBucket($);if(!nt||!nt.uploaded)continue;let xt=!1;ee&&(xt=ee.getMaxCascadeForTile(_t.toUnwrapped())===0);const Ct=Z.calculatePosMatrix(_t.toUnwrapped(),Z.worldSize),ii=nt.modelTraits,Jt=[];for(const Pt of nt.getNodesInfo()){if(Pt.hiddenByReplacement||!Pt.node.meshes)continue;const Xt=Pt.node;let Tt=0;B.terrain&&Xt.elevation&&(Tt=Xt.elevation*B.terrain.exaggeration());const St=Pt.evaluatedScale;if(St[0]<=1&&St[1]<=1&&St[2]<=1&&(()=>{const Fi=Pt.aabb;return Se.min=[...Fi.min],Se.max=[...Fi.max],Se.min[2]+=Tt,Se.max[2]+=Tt,s.$.transformMat4(Se.min,Se.min,Ct),s.$.transformMat4(Se.max,Se.max,Ct),Se})().intersects(ve)===0)continue;const gt=[...Ct],Ot=Xt.anchor?Xt.anchor[0]:0,Mt=Xt.anchor?Xt.anchor[1]:0;s.ae.translate(gt,gt,[Ot*(St[0]-1),Mt*(St[1]-1),Tt]),s.$.exactEquals(St,s.cl)||s.ae.scale(gt,gt,St);const at=s.ae.multiply([],gt,Xt.matrix),bi=s.ae.multiply([],Z.expandedFarZProjMatrix,at),wi=s.ae.multiply([],Z.expandedFarZProjMatrix,gt),Xi=s.aB.transformMat4([],[Ot,Mt,Tt,1],bi)[2];Xt.hidden=!1;let Yi=fe;he||(Me&&(Yi*=Nh(gt,Z,Pt.aabb,ne)),Yi*=_r(Ae,Xi)),Yi!==0?Jt.push({nodeInfo:Pt,depth:Xi,opacity:Yi,wvpForNode:bi,wvpForTile:wi,nodeModelMatrix:at,tileModelMatrix:gt}):Xt.hidden=!0}he||Jt.sort((Pt,Xt)=>!Me||Pt.opacity===1&&Xt.opacity===1?Pt.depthXt.depth?-1:1);for(const Pt of Jt){const Xt=Pt.nodeInfo,Tt=Xt.node;let St=s.ae.multiply([],_e,Pt.tileModelMatrix);s.ae.multiply(St,re,St);const gt=s.ae.invert([],St);s.ae.transpose(gt,gt),s.ae.scale(gt,gt,Ll),St=s.ae.multiply(St,St,Tt.matrix);const Ot=B.renderPass==="light-beam",Mt=ii&s.cn.HasMapboxMeshFeatures,at=Mt?0:Xt.evaluatedRMEA[0][2];for(let bi=0;bi=Ft||vn>=Ft}}const Ni=wi.material;let Le;Ni.occlusionTexture&&Ni.occlusionTexture.offsetScale&&(Le=Ni.occlusionTexture.offsetScale,Fi.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!he&&ee&&(ee.useNormalOffset=!!wi.normalBuffer);const Ye=B.getOrCreateProgram("model",Fi);!he&&ee&&ee.setupShadowsFromMatrix(Pt.tileModelMatrix,Ye,ee.useNormalOffset),B.uploadCommonUniforms(J,Ye,null,Li);const rr=Ni.pbrMetallicRoughness;rr.metallicFactor=.9,rr.roughnessFactor=.5;const ei=ho(new Float32Array(Yi),new Float32Array(St),new Float32Array(gt),new Float32Array(Tt.matrix),B,Pt.opacity,rr.baseColorFactor.toRenderColor(null),Ni.emissiveFactor,rr.metallicFactor,rr.roughnessFactor,Ni,at,$,[0,0,0],Le);!Xi&&(Xt.hasTranslucentParts||Pt.opacity<1)&&Ye.draw(B,J.gl.TRIANGLES,se,s.ah.disabled,s.a.disabled,s.ag.backCCW,ei,$.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,$.paint,B.transform.zoom,void 0,Ji),Ye.draw(B,J.gl.TRIANGLES,Xi?Ce:se,s.ah.disabled,Xi||Pt.opacity<1||Xt.hasTranslucentParts?s.a.alphaBlended:s.a.unblended,s.ag.backCCW,ei,$.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,$.paint,B.transform.zoom,void 0,Ji)}}}}()}(u,r,a,h),void w();if(T.type!=="model")return;const S=T.getModels(),I=[],P=u.transform.getFreeCameraOptions().position,z=s.$.scale([],[P.x,P.y,P.z],u.transform.worldSize);s.$.negate(z,z);const L=[],k=[];let O=0;for(const B of S){const G=a.paint.get("model-rotation").constantOr(null),$=a.paint.get("model-scale").constantOr(null),j=a.paint.get("model-translation").constantOr(null);B.computeModelMatrix(u,G,$,j,!0,!0,!1);const J=s.ae.identity([]),Z=s.ci(B.position.lat,u.transform.zoom),W=s.ae.fromScaling([],[1,1,1/Z]);s.ae.translate(J,J,z),I.push({zScaleMatrix:W,negCameraPosMatrix:J});for(const ee of B.nodes)mi(u.transform,ee,B.matrix,u.transform.expandedFarZProjMatrix,O,L,k);O++}if(L.sort((B,G)=>G.depth-B.depth),u.renderPass!=="shadow"){if(p===1)for(const B of k)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,u.colorModeForRenderPass());else{for(const B of k)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,s.a.disabled);for(const B of k)Wi(B,u,a,I[B.modelIndex],u.stencilModeFor3D(),u.colorModeForRenderPass());u.resetStencilClippingMasks()}for(const B of L)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,u.colorModeForRenderPass());w()}else{for(const B of k)au(B.mesh,B.nodeModelMatrix,u,a);for(const B of L)au(B.mesh,B.nodeModelMatrix,u,a);w()}}},Ci={model:function(u,r,a){const h=r.getSource();if(!h.loaded())return;if(h.type==="vector"||h.type==="geojson")return void(a.modelManager&&a.modelManager.upload(a,h.type==="vector"?u.scope:""));if(h.type==="batched-model"||h.type!=="model")return;const p=h.getModels();for(const m of p)m.upload(a.context)},raster:function(u,r,a){const h=r.getSource();if(!(h instanceof Un&&h.loaded()))return;const p=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!p)return;const m=u.paint.get("raster-array-band")||h.getInitialBand(p);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(p,m)&&h.prepareTile(x,p,m)},"raster-particle":function(u,r,a){const h=r.getSource();if(!(h instanceof Un&&h.loaded()))return;const p=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!p)return;const m=u.paint.get("raster-particle-array-band")||h.getInitialBand(p);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(p,m)&&h.prepareTile(x,p,m)}};class lu{constructor(r,a,h,p){this.context=new Fo(r,a),this.transform=h,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=s.e.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const x of m)this._debugParams.enabledLayers[x]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const x of m)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],x);this.occlusionParams=new qr(p),this.setup(),this.numSublayers=s.bx.maxUnderzooming+s.bx.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.cp,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Ep(this),this._wireframeDebugCache=new Ii,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const g=new s.j({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new s.T(this.context,g,r.RGBA)}updateTerrain(r,a){const h=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(h||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Zi(this,r));const p=this._terrain;this.transform.elevation=h?p:null,p.update(r,this.transform,a),this.transform.elevation&&!p.enabled&&(this.transform.elevation=null)}_updateFog(r){const a=r.fog;if(!a||this.transform.projection.name==="globe"||a.getOpacity(this.transform.pitch)<1||a.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[h,p]=a.getFovAdjustedRange(this.transform._fov);if(h>p)return void(this.transform.fogCullDistSq=null);const m=h+.78*(p-h);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(r){r&&!this._terrain&&(this._terrain=new Zi(this,this.style)),this._forceTerrainMode=r}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*s.e.devicePixelRatio,this.height=a*s.e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style.order)this.style._mergedLayers[h].resize()}setup(){const r=this.context,a=new s.bv;a.emplaceBack(0,0),a.emplaceBack(s.a4,0),a.emplaceBack(0,s.a4),a.emplaceBack(s.a4,s.a4),this.tileExtentBuffer=r.createVertexBuffer(a,s.bt.members),this.tileExtentSegments=s.b.simpleSegment(0,0,4,2);const h=new s.bv;h.emplaceBack(0,0),h.emplaceBack(s.a4,0),h.emplaceBack(0,s.a4),h.emplaceBack(s.a4,s.a4),this.debugBuffer=r.createVertexBuffer(h,s.bt.members),this.debugSegments=s.b.simpleSegment(0,0,4,5);const p=new s.bv;p.emplaceBack(-1,-1),p.emplaceBack(1,-1),p.emplaceBack(-1,1),p.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(p,s.bt.members),this.viewportSegments=s.b.simpleSegment(0,0,4,2);const m=new s.cq;m.emplaceBack(0,0,0,0),m.emplaceBack(s.a4,0,s.a4,0),m.emplaceBack(0,s.a4,0,s.a4),m.emplaceBack(s.a4,s.a4,s.a4,s.a4),this.mercatorBoundsBuffer=r.createVertexBuffer(m,s.cr.members),this.mercatorBoundsSegments=s.b.simpleSegment(0,0,4,2);const g=new s.bw;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(g);const x=new s.cs;for(const T of[0,1,3,2,0])x.emplaceBack(T);this.debugIndexBuffer=r.createIndexBuffer(x),this.emptyTexture=new s.T(r,new s.j({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=s.ae.create();const w=this.context.gl;this.stencilClearMode=new s.ah({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,s.af.disabled,this.stencilClearMode,s.a.disabled,s.ag.disabled,na(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,a,h){if(!a||this.currentStencilSource===a.id||!r.isTileClipped()||!h||h.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let x=!1;for(const w of h)if(this._tileClippingMaskIDs[w.key]===void 0){x=!0;break}if(!x)return}this.currentStencilSource=a.id;const p=this.context,m=p.gl;this.nextStencilID+h.length>256&&this.clearStencil(),p.setColorMode(s.a.disabled),p.setDepthMode(s.af.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of h){const w=a.getTile(x),T=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:I,tileBoundsSegments:P}=this.getTileBoundsBuffers(w);g.draw(this,m.TRIANGLES,s.af.disabled,new s.ah({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.ag.disabled,na(x.projMatrix),"$clipping",S,I,P)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,a=this.context.gl;return new s.ah({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const a=this.context.gl;return new s.ah({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){const a=this.context.gl,h=r.sort((g,x)=>x.overscaledZ-g.overscaledZ),p=h[h.length-1].overscaledZ,m=h[0].overscaledZ-p+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const g={};for(let x=0;xthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((r,a)=>r+a/this._fpsHistory.length,0))}render(r,a){const h=s.e.now();this._dt=h-this._timeStamp,this._timeStamp=h,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=r.map.repaint,this.style=r,this.options=a;const p=this.style._mergedLayers,m=this.style.order.filter(re=>{const Y=p[re];return!(Y.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Y.type]});let g=!1,x=!1;for(const re of m){const Y=p[re];Y.type==="circle"&&(g=!0),Y.type==="symbol"&&(Y.hasInitialOcclusionOpacityProperties?x=!0:g=!0)}const w=m.map(re=>p[re]),T=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(s.e.now()),this.imageManager.beginFrame();let S=0,I=!1;for(const re in T){const Y=T[re];Y.used&&(Y.prepare(this.context),Y.getSource().usedInConflation&&++S)}let P=!1;for(const re of w)re.isHidden(this.transform.zoom)||(re.type==="clip"&&(P=!0),this.prepareLayer(re));const z={},L={},k={},O={},B={};for(const re in T){const Y=T[re];z[re]=Y.getVisibleCoordinates(),L[re]=z[re].slice().reverse(),k[re]=Y.getVisibleCoordinates(!0).reverse(),O[re]=Y.getShadowCasterCoordinates(),B[re]=Y.sortCoordinatesByDistance(z[re])}const G=re=>{const Y=this.style.getLayerSourceCache(re);return Y&&Y.used?Y.getSource():null};if(S||P){const re=[],Y=[];let _e=0;for(const fe of w)this.isSourceForClippingOrConflation(fe,G(fe))&&(re.push(fe),Y.push(_e)),_e++;if(re&&(P||re.length>1)){const fe=[];for(let se=0;se0){const fe=G(Y);fe&&(this.minCutoffZoom=Math.max(fe.minzoom,this.minCutoffZoom)),Y.minzoom&&(this.minCutoffZoom=Math.max(Y.minzoom,this.minCutoffZoom))}Y.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=re),this._lastOcclusionLayer=re)}const $=this.style&&this.style.fog;$?(this._fogVisible=$.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=$.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(k),this.opaquePassCutoff=0);const j=this._shadowRenderer;if(j){j.updateShadowParameters(this.transform,this.style.directionalLight);for(const re in T)for(const Y of z[re]){let _e={min:0,max:0};this.terrain&&(_e=this.terrain.getMinMaxForTile(Y)||_e),j.addShadowReceiver(Y.toUnwrapped(),_e.min,_e.max)}}if(this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.ct(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Dl(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!s.cu(this.context.gl))return;this.renderPass="offscreen";for(const re of w){const Y=r.getLayerSourceCache(re);if(!re.hasOffscreenPass()||re.isHidden(this.transform.zoom))continue;const _e=Y?L[Y.id]:void 0;(re.type==="custom"||re.type==="raster"||re.type==="raster-particle"||re.isSky()||_e&&_e.length)&&this.renderLayer(this,Y,re,_e)}this.depthRangeFor3D=[0,1-(w.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,O)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const J=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Z=(()=>{if(a.showOverdrawInspector)return s.C.black;const re=this.style.fog;if(re&&this.transform.projection.supportsFog){const Y=this.style.getLut(re.scope);if(!J){const _e=re.properties.get("color").toRenderColor(Y).toArray01();return new s.C(..._e)}if(J){const _e=re.properties.get("space-color").toRenderColor(Y).toArray01();return new s.C(..._e)}}return s.C.transparent})();if(this.context.clear({color:Z,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const re=w[this.currentLayer],Y=r.getLayerSourceCache(re);if(re.isSky())continue;const _e=Y?(re.is3D()?B:L)[Y.id]:void 0;this._renderTileClippingMasks(re,Y,_e),this.renderLayer(this,Y,re,_e)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.a2(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer0&&re.hasShadowPass()&&--ee==0&&(j.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const _e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=_e;this.currentLayer++){const fe=w[this.currentLayer];if(!fe.hasLightBeamPass())continue;const se=r.getLayerSourceCache(fe);this.renderLayer(this,se,fe,se?L[se.id]:void 0)}this.currentLayer=_e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const _e=this.currentLayer;this.depthOcclusion=!0;for(const fe of this.layersWithOcclusionOpacity){this.currentLayer=fe;const se=w[this.currentLayer],Ce=r.getLayerSourceCache(se),Se=Ce?L[Ce.id]:void 0;se.is3D()||this.terrain||this._renderTileClippingMasks(se,Ce,Ce?z[Ce.id]:void 0),this.renderLayer(this,Ce,se,Se)}this.depthOcclusion=!1,this.currentLayer=_e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let re=null;w.forEach(Y=>{const _e=r.getLayerSourceCache(Y);_e&&!Y.isHidden(this.transform.zoom)&&_e.getVisibleCoordinates().length&&(!re||re.getSource().maxzoom<_e.getSource().maxzoom)&&(re=_e)}),re&&this.options.showTileBoundaries&&Zr.debug(this,re,re.getVisibleCoordinates(),s.C.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Zr.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.C(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(re){const Y=re.transform.padding;ou(re,re.transform.height-(Y.top||0),3,ru),ou(re,Y.bottom||0,3,zl),fa(re,Y.left||0,3,nu),fa(re,re.transform.width-(Y.right||0),3,Ut);const _e=re.transform.centerPoint;(function(fe,se,Ce,Se){os(fe,se-1,Ce-10,2,20,Se),os(fe,se-10,Ce-1,20,2,Se)})(re,_e.x,re.transform.height-_e.y,Pp)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),I||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:a}=this.transform.projection,h=!a||!a.includes(r.type);if(Ci[r.type]&&(h||this.terrain&&r.type==="custom")){const p=this.style.getLayerSourceCache(r);Ci[r.type](r,p,this)}this.gpuTimingEnd()}renderLayer(r,a,h,p){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="sky"||h.type==="custom"||h.type==="model"||h.type==="raster"||h.type==="raster-particle"||p&&p.length)&&(this.id=h.id,this.gpuTimingStart(h),r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes(h.type)&&(!r.terrain||h.type!=="custom")||h.type==="clip"||Zr[h.type](r,a,h,p,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery,h=this.context.gl;let p=this.gpuTimers[r.id];p||(p=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:h.createQuery()}),p.calls++,h.beginQuery(a.TIME_ELAPSED_EXT,p.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,a=this.context.gl,h=a.createQuery();this.deferredRenderGpuTimeQueries.push(h),a.beginQuery(r.TIME_ELAPSED_EXT,h)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const a={};for(const h in r){const p=r[h],m=this.context.extTimerQuery,g=m.getQueryParameter(p.query,this.context.gl.QUERY_RESULT)/1e6;m.deleteQueryEXT(p.query),a[h]=g}return a}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const a=this.context.extTimerQuery,h=this.context.gl;let p=0;for(const m of r)p+=a.getQueryParameter(m,h.QUERY_RESULT)/1e6,a.deleteQueryEXT(m);return p}translatePosMatrix(r,a,h,p,m){if(!h[0]&&!h[1])return r;const g=m?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(g){const T=Math.sin(g),S=Math.cos(g);h=[h[0]*S-h[1]*T,h[0]*T+h[1]*S]}const x=[m?h[0]:s.bD(a,h[0],this.transform.zoom),m?h[1]:s.bD(a,h[1],this.transform.zoom),0],w=new Float32Array(16);return s.ae.translate(w,r,x),w}saveTileTexture(r){const a=r.size[0],h=this._tileTextures[a];h?h.push(r):this._tileTextures[a]=[r]}getTileTexture(r){const a=this._tileTextures[r];return a&&a.length>0?a.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,a,h){const p=h===void 0?this.terrain&&this.terrain.renderingToTexture:h,m=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(m.push("LIGHTING_3D_MODE"),m.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):p||m.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||m.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?m.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):m.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(m.push("TERRAIN"),this.linearFloatFilteringSupported()&&m.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&m.push("GLOBE"),!this._fogVisible||p||a!==void 0&&!a||m.push("FOG","FOG_DITHERING"),p&&m.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&m.push("OVERDRAW_INSPECTOR"),m}getOrCreateProgram(r,a){this.cache=this.cache||{};const h=a&&a.defines||[],p=a&&a.config,m=this.currentGlobalDefines(r,a&&a.overrideFog,a&&a.overrideRtt).concat(h),g=Wc.cacheKey(gh[r],r,m,p);return this.cache[g]||(this.cache[g]=new Wc(this.context,r,gh[r],p,Dh[r],m)),this.cache[g]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a){if(this.style.enable3dLights()){const h=this.style.directionalLight,p=this.style.ambientLight;if(h&&p){const m=((g,x,w)=>{const T=g.properties.get("direction"),S=g.properties.get("color").toRenderColor(w.getLut(g.scope)).toArray01(),I=g.properties.get("intensity"),P=x.properties.get("color").toRenderColor(w.getLut(x.scope)).toArray01(),z=x.properties.get("intensity"),L=[T.x,T.y,T.z],k=s.bC(P,z),O=s.bC(S,I);return{u_lighting_ambient_color:k,u_lighting_directional_dir:L,u_lighting_directional_color:O,u_ground_radiance:Sh(L,O,k)}})(h,p,this.style);a.setLightsUniformValues(r,m)}}}uploadCommonUniforms(r,a,h,p,m){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const x=g.getOpacity(this.transform.pitch),w=((T,S,I,P,z,L,k,O,B,G,$,j)=>{const J=T.transform,Z=S.properties.get("color").toRenderColor(T.style.getLut(S.scope)).toArray01();Z[3]=P;const W=T.frameCounter/1e3%1,[ee,ie]=S.properties.get("vertical-range");return{u_fog_matrix:I?J.calculateFogTileMatrix(I):j||T.identityMat,u_fog_range:S.getFovAdjustedRange(J._fov),u_fog_color:Z,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ee,ie),ie],u_fog_temporal_offset:W,u_frustum_tl:z,u_frustum_tr:L,u_frustum_br:k,u_frustum_bl:O,u_globe_pos:B,u_globe_radius:G,u_viewport:$,u_globe_transition:s.a2(J.zoom),u_is_globe:+(J.projection.name==="globe")}})(this,g,h,x,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.e.devicePixelRatio,this.transform.height*s.e.devicePixelRatio],p);a.setFogUniformValues(r,w)}m&&a.setCutoffUniformValues(r,m.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,a=r.createTexture();return r.bindTexture(r.TEXTURE_2D,a),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),a}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,a=this._backgroundTiles={},h=this.transform.coveringTiles({tileSize:512});for(const p of h)a[p.key]=r[p.key]||new s.bA(p,512,this.transform.tileZoom,this);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(r,a){return!(!r.is3D()||r.minzoom&&r.minzoom>this.transform.zoom||(this.style._clipLayerIndices.length||r.sourceLayer!=="building")&&r.type!=="clip"&&(!a||a.type!=="batched-model"))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let a=this._cachedTileFogOpacities[r.key];return a||(this._cachedTileFogOpacities[r.key]=a=this.style.fog.getOpacityForTile(r)),a[0]>=Ft||a[1]>=Ft}setupDepthForOcclusion(r,a,h){const p=this.context,m=p.gl,g=!!h;var x;h||(h={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),p.activeTexture.set(m.TEXTURE3),r&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),h.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],h.u_depth_range_unpack=[2/((x=this.depthRangeFor3D)[1]-x[0]),-1-2*x[0]/(x[1]-x[0])],h.u_occluder_half_size=.5*this.occlusionParams.occluderSize,h.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE0),g||a.setTerrainUniformValues(p,h)}}class gr{constructor(r,a,h,p){this.screenBounds=r,this.cameraPoint=a,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=h,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,p)}static createFromScreenPoints(r,a){let h,p;if(r instanceof s.P||typeof r[0]=="number"){const m=s.P.convert(r);h=[m],p=a.isPointAboveHorizon(m)}else{const m=s.P.convert(r[0]),g=s.P.convert(r[1]);h=[m,g],p=s.cx(m,g).every(x=>a.isPointAboveHorizon(x))}return new gr(h,a.getCameraPoint(),p,a)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return s.cx(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.cx(a,h,0,!1);return this.cameraPoint.y>h.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x=h.x?p[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(p[3]=this.cameraPoint)),s.cy(p,r)}bufferedCameraGeometryGlobe(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.cx(a,h,r),m=this.cameraPoint.clone();switch(3*((m.y>a.y)+(m.y>h.y))+((m.x>a.x)+(m.x>h.x))){case 0:p[0]=m,p[4]=m.clone();break;case 1:p.splice(1,0,m);break;case 2:p[1]=m;break;case 3:p.splice(4,0,m);break;case 5:p.splice(2,0,m);break;case 6:p[3]=m;break;case 7:p.splice(3,0,m);break;case 8:p[2]=m}return p}containsTile(r,a,h,p=0){const m=r.queryPadding/a._pixelsPerMercatorPixel+1,g=h?this._bufferedCameraMercator(m,a):this._bufferedScreenMercator(m,a);let x=r.tileID.wrap+(g.unwrapped?p:0);const w=g.polygon.map(O=>s.cz(r.tileTransform,O,x));if(!s.cA(w,0,0,s.a4,s.a4))return;x=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?p:0);const T=this.screenGeometryMercator.polygon.map(O=>s.cB(r.tileTransform,O,x)),S=T.map(O=>new s.P(O[0],O[1])),I=a.getFreeCameraOptions().position||new s._(0,0,0),P=s.cB(r.tileTransform,I,x),z=T.map(O=>{const B=s.$.sub(O,O,P);return s.$.normalize(B,B),new s.aU(P,B)}),L=s.bD(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:z,bufferedTilespaceGeometry:w,bufferedTilespaceBounds:(k=s.cC(w),k.min.x=s.au(k.min.x,0,s.a4),k.min.y=s.au(k.min.y,0,s.a4),k.max.x=s.au(k.max.x,0,s.a4),k.max.y=s.au(k.max.y,0,s.a4),k),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:L};var k}_bufferedScreenMercator(r,a){const h=jn(r);if(this._screenRaycastCache[h])return this._screenRaycastCache[h];{let p;return p=a.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),a):{polygon:this.bufferedScreenGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[h]=p,p}}_bufferedCameraMercator(r,a){const h=jn(r);if(this._cameraRaycastCache[h])return this._cameraRaycastCache[h];{let p;return p=a.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),a):{polygon:this.bufferedCameraGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[h]=p,p}}_projectAndResample(r,a){const h=function(m,g){const x=s.ae.multiply([],g.pixelMatrix,g.globeMatrix),w=[0,-s.cF,0,1],T=[0,s.cF,0,1],S=[0,0,0,1];s.aB.transformMat4(w,w,x),s.aB.transformMat4(T,T,x),s.aB.transformMat4(S,S,x);const I=new s.P(w[0]/w[3],w[1]/w[3]),P=new s.P(T[0]/T[3],T[1]/T[3]),z=s.cD(m,I)&&w[3]1?go(m.slice(0,O),g):[],$=Onew s.P(fn(W.x),W.y)),$=$.map(W=>new s.P(fn(W.x),W.y));const j=[...G];j.length===0&&j.push($[$.length-1]);const J=s.a3(j[j.length-1].y,($.length===0?G[0]:$[0]).y,B);let Z;return Z=z?[new s.P(0,J),new s.P(0,0),new s.P(1,0),new s.P(1,J)]:[new s.P(1,J),new s.P(1,1),new s.P(0,1),new s.P(0,J)],j.push(...Z),$.length===0?j.push(G[0]):j.push(...$),{polygon:j.map(W=>new s._(W.x,W.y)),unwrapped:!1}}(r,a);if(h)return h;const p=function(m,g){let x=!1,w=-1/0,T=0;for(let I=0;Iw&&(w=m[I].x,T=I);for(let I=0;I.5&&(z.x{I.x-=1}),{polygon:m,unwrapped:x}}(go(r,a).map(m=>new s.P(fn(m.x),m.y)),a);return{polygon:p.polygon.map(m=>new s._(m.x,m.y)),unwrapped:p.unwrapped}}}function go(u,r){return s.cE(u,a=>{const h=r.pointCoordinate3D(a);a.x=h.x,a.y=h.y},1/256)}function fn(u){return u<0?1+u%1:u%1}function jn(u){return 100*u|0}function zp(u,r){const a=s.ae.identity([]);return s.ae.scale(a,a,[.5*u.width,.5*-u.height,1]),s.ae.translate(a,a,[1,-1,0]),s.ae.multiply(a,a,u.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}function mn(u,r,a,h,p,m,g,x=!1){const w=u.tilesIn(h,g,x);w.sort(cu);const T=[];for(const I of w)T.push({wrappedTileID:I.tile.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(r,a,u._state,I,p,m,zp(u.transform,I.tile.tileID),x)});const S=function(I){const P={},z={};for(const L of I){const k=L.queryResults,O=L.wrappedTileID,B=z[O]=z[O]||{};for(const G in k){const $=k[G],j=B[G]=B[G]||{},J=P[G]=P[G]||[];for(const Z of $)j[Z.featureIndex]||(j[Z.featureIndex]=!0,J.push(Z))}}return P}(T);for(const I in S)S[I].forEach(P=>{const z=P.feature,L=z.layer;L&&L.type!=="background"&&L.type!=="sky"&&L.type!=="slot"&&(z.source=L.source,L["source-layer"]&&(z.sourceLayer=L["source-layer"]),z.state=z.id!==void 0?u.getFeatureState(L["source-layer"],z.id):{})});return S}function Dp(u,r){const a=u.getRenderableIds().map(m=>u.getTileByID(m)),h=[],p={};for(let m=0;m0:h.type==="model"&&(p=!h.isHidden(r)&&h.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!p&&a.visible,a.visible=p}}updateZOffset(r,a){this.currentBuildingBuckets=[];for(const p of this.layers){const m=p.layer,g=this.style.getLayerSourceCache(m);let x=1;m.type==="fill-extrusion"&&(x=p.visible?m.paint.get("fill-extrusion-vertical-scale"):0);let w=g?g.getTile(a):null;if(!w&&g&&a.canonical.z>g.getSource().minzoom){let T=a.scaledTo(Math.min(g.getSource().maxzoom,a.overscaledZ-1));for(;T.overscaledZ>=g.getSource().minzoom&&(w=g.getTile(T),!w&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:w?w.getBucket(m):null,tileID:w?w.tileID:a,verticalScale:x})}r.hasAnyZOffset=!1;let h=!1;for(let p=0;p{h in r&&(a[h]=r[h])}),a}function ga(u){u=u.slice();const r=Object.create(null);for(let a=0;a0?(p-g)/x:0;return this.points[m].mult(1-w).add(this.points[a].mult(w))}}class xa{constructor(r,a,h){const p=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(r/h),this.yCellCount=Math.ceil(a/h);for(let g=0;gthis.width||p<0||a>this.height)return!m&&[];const x=[];if(r<=0&&a<=0&&this.width<=h&&this.height<=p){if(m)return!0;for(let w=0;w0:x}_queryCircle(r,a,h,p,m){const g=r-h,x=r+h,w=a-h,T=a+h;if(x<0||g>this.width||T<0||w>this.height)return!p&&[];const S=[];return this._forEachCell(g,w,x,T,this._queryCellCircle,S,{hitTest:p,circle:{x:r,y:a,radius:h},seenUids:{box:{},circle:{}}},m),p?S.length>0:S}query(r,a,h,p,m){return this._query(r,a,h,p,!1,m)}hitTest(r,a,h,p,m){return this._query(r,a,h,p,!0,m)}hitTestCircle(r,a,h,p){return this._queryCircle(r,a,h,!0,p)}_queryCell(r,a,h,p,m,g,x,w){const T=x.seenUids,S=this.boxCells[m];if(S!==null){const P=this.bboxes;for(const z of S)if(!T.box[z]){T.box[z]=!0;const L=4*z;if(r<=P[L+2]&&a<=P[L+3]&&h>=P[L+0]&&p>=P[L+1]&&(!w||w(this.boxKeys[z]))){if(x.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[z],x1:P[L],y1:P[L+1],x2:P[L+2],y2:P[L+3]})}}}const I=this.circleCells[m];if(I!==null){const P=this.circles;for(const z of I)if(!T.circle[z]){T.circle[z]=!0;const L=3*z;if(this._circleAndRectCollide(P[L],P[L+1],P[L+2],r,a,h,p)&&(!w||w(this.circleKeys[z]))){if(x.hitTest)return g.push(!0),!0;{const k=P[L],O=P[L+1],B=P[L+2];g.push({key:this.circleKeys[z],x1:k-B,y1:O-B,x2:k+B,y2:O+B})}}}}}_queryCellCircle(r,a,h,p,m,g,x,w){const T=x.circle,S=x.seenUids,I=this.boxCells[m];if(I!==null){const z=this.bboxes;for(const L of I)if(!S.box[L]){S.box[L]=!0;const k=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,z[k+0],z[k+1],z[k+2],z[k+3])&&(!w||w(this.boxKeys[L])))return g.push(!0),!0}}const P=this.circleCells[m];if(P!==null){const z=this.circles;for(const L of P)if(!S.circle[L]){S.circle[L]=!0;const k=3*L;if(this._circlesCollide(z[k],z[k+1],z[k+2],T.x,T.y,T.radius)&&(!w||w(this.circleKeys[L])))return g.push(!0),!0}}}_forEachCell(r,a,h,p,m,g,x,w){const T=this._convertToXCellCoord(r),S=this._convertToYCellCoord(a),I=this._convertToXCellCoord(h),P=this._convertToYCellCoord(p);for(let z=T;z<=I;z++)for(let L=S;L<=P;L++)if(m.call(this,r,a,h,p,this.xCellCount*L+z,g,x,w))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,a,h,p,m,g){const x=p-r,w=m-a,T=h+g;return T*T>x*x+w*w}_circleAndRectCollide(r,a,h,p,m,g,x){const w=(g-p)/2,T=Math.abs(r-(p+w));if(T>w+h)return!1;const S=(x-m)/2,I=Math.abs(a-(m+S));if(I>S+h)return!1;if(T<=w||I<=S)return!0;const P=T-w,z=I-S;return P*P+z*z<=h*h}}const Hi=100;class kp{constructor(r,a,h=new xa(r.width+200,r.height+200,25),p=new xa(r.width+200,r.height+200,25)){this.transform=r,this.grid=h,this.ignoredGrid=p,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+Hi,this.screenBottomBoundary=r.height+Hi,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=a}placeCollisionBox(r,a,h,p,m,g,x,w){let T=h.projectedAnchorX,S=h.projectedAnchorY,I=h.projectedAnchorZ;const P=h.elevation,z=h.tileID,L=r.getProjection();if(P&&z){const[Z,W,ee]=L.upVector(z.canonical,h.tileAnchorX,h.tileAnchorY),ie=L.upVectorScale(z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=Z*P*ie,S+=W*P*ie,I+=ee*P*ie}const k=this.projectAndGetPerspectiveRatio(x,T,S,I,h.tileID,L.name==="globe"||!!P||this.transform.pitch>0,L),O=g*k.perspectiveRatio,B=(h.x1*a+p.x-h.padding)*O+k.point.x,G=(h.y1*a+p.y-h.padding)*O+k.point.y,$=(h.x2*a+p.x+h.padding)*O+k.point.x,j=(h.y2*a+p.y+h.padding)*O+k.point.y,J=k.perspectiveRatio<=.55||k.occluded;return!this.isInsideGrid(B,G,$,j)||!m&&this.grid.hitTest(B,G,$,j,w)||J?{box:[],offscreen:!1,occluded:k.occluded}:{box:[B,G,$,j],offscreen:this.isOffscreen(B,G,$,j),occluded:!1}}placeCollisionCircles(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k){const O=[],B=this.transform.elevation,G=r.getProjection(),$=B?B.getAtTileOffsetFunc(k,this.transform.center.lat,this.transform.worldSize,G):null,j=new s.P(h.tileAnchorX,h.tileAnchorY);let{x:J,y:Z,z:W}=G.projectTilePoint(j.x,j.y,k.canonical);if($){const[Se,he,ve]=$(j);J+=Se,Z+=he,W+=ve}const ee=G.name==="globe",ie=this.projectAndGetPerspectiveRatio(x,J,Z,W,k,ee||!!B||this.transform.pitch>0,G),{perspectiveRatio:ue}=ie,re=(I?g/ue:g*ue)/s.bP,Y=$r(J,Z,W,w),_e=ie.signedDistanceFromCamera>0?Js(re,m,h.lineOffsetX*re,h.lineOffsetY*re,!1,Y,j,h,p,w,{},B&&!I?$:null,I&&!!B,G,k,I):null;let fe=!1,se=!1,Ce=!0;if(_e&&!ie.occluded){const Se=.5*z*ue+L,he=new s.P(-100,-100),ve=new s.P(this.screenRightBoundary,this.screenBottomBoundary),ne=new Uh,{first:Me,last:Ae}=_e,Ue=Me.path.length;let Ge=[];for(let it=Ue-1;it>=1;it--)Ge.push(Me.path[it]);for(let it=1;it($&&!ee&&(nt=$(xtit[3]<=0)&&(Ge=[]));let $e=[];if(Ge.length>0){let it=1/0,_t=-1/0,nt=1/0,xt=-1/0;for(const Ct of Ge)it=Math.min(it,Ct[0]),nt=Math.min(nt,Ct[1]),_t=Math.max(_t,Ct[0]),xt=Math.max(xt,Ct[1]);_t>=he.x&&it<=ve.x&&xt>=he.y&&nt<=ve.y&&($e=[Ge.map(Ct=>new s.P(Ct[0],Ct[1]))],(itve.x||ntve.y)&&($e=s.cH($e,he.x,he.y,ve.x,ve.y)))}for(const it of $e){ne.reset(it,.25*Se);let _t=0;_t=ne.length<=.5*Se?1:Math.ceil(ne.paddedLength/He)+1;for(let nt=0;nt<_t;nt++){const xt=nt/Math.max(_t-1,1),Ct=ne.lerp(xt),ii=Ct.x+Hi,Jt=Ct.y+Hi;O.push(ii,Jt,Se,0);const Pt=ii-Se,Xt=Jt-Se,Tt=ii+Se,St=Jt+Se;if(Ce=Ce&&this.isOffscreen(Pt,Xt,Tt,St),se=se||this.isInsideGrid(Pt,Xt,Tt,St),!a&&this.grid.hitTestCircle(ii,Jt,Se,P)&&(fe=!0,!S))return{circles:[],offscreen:!1,collisionDetected:fe,occluded:!1}}}}return{circles:!S&&fe||!se?[]:O,offscreen:Ce,collisionDetected:fe,occluded:ie.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let h=1/0,p=1/0,m=-1/0,g=-1/0;for(const S of r){const I=new s.P(S.x+Hi,S.y+Hi);h=Math.min(h,I.x),p=Math.min(p,I.y),m=Math.max(m,I.x),g=Math.max(g,I.y),a.push(I)}const x=this.grid.query(h,p,m,g).concat(this.ignoredGrid.query(h,p,m,g)),w={},T={};for(const S of x){const I=S.key;if(w[I.bucketInstanceId]===void 0&&(w[I.bucketInstanceId]={}),w[I.bucketInstanceId][I.featureIndex])continue;const P=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.cI(a,P)&&(w[I.bucketInstanceId][I.featureIndex]=!0,T[I.bucketInstanceId]===void 0&&(T[I.bucketInstanceId]=[]),T[I.bucketInstanceId].push(I.featureIndex))}return T}insertCollisionBox(r,a,h,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:p,collisionGroupID:m},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,a,h,p,m){const g=a?this.ignoredGrid:this.grid,x={bucketInstanceId:h,featureIndex:p,collisionGroupID:m};for(let w=0;w0?(s.aB.transformMat4(w,w,r),this.fogState&&m&&x.name!=="globe"&&(T=function(P,z,L,k,O,B){const G=B.calculateFogTileMatrix(O),$=[z,L,k];return s.$.transformMat4($,$,G),Dt(P,s.$.length($),B.pitch,B._fov)}(this.fogState,a,h,p,m.toUnwrapped(),this.transform)>.9)):Gc(w,w,r);const S=w[3];return{point:new s.P((w[0]/S+1)/2*this.transform.width+Hi,(-w[1]/S+1)/2*this.transform.height+Hi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(x)/S*.5,1.5),signedDistanceFromCamera:S,occluded:g&&w[2]>S||T}}isOffscreen(r,a,h,p){return h=this.screenRightBoundary||pthis.screenBottomBoundary}isInsideGrid(r,a,h,p){return h>=0&&r=0&&ah.collisionGroupID===a}}return this.collisionGroups[r]}}function hu(u,r,a,h,p){const{horizontalAlign:m,verticalAlign:g}=s.bS(u),x=-(m-.5)*r,w=-(g-.5)*a,T=s.bR(u,h);return new s.P(x+T[0]*p,w+T[1]*p)}function Bl(u,r,a,h,p){const m=new s.P(u,r);return a&&m._rotate(h?p:-p),m}class $h{constructor(r,a,h,p,m,g){this.transform=r.clone(),this.projection=r.projection.name,this.collisionIndex=new kp(this.transform,m),this.buildingIndex=g,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Gh(h),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,a,h,p){const m=h.getBucket(a),g=h.latestFeatureIndex;if(!m||!g||a.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,w=h.collisionBoxArray,T=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),S=h.tileSize/s.a4,I=h.tileID.toUnwrapped();this.transform.setProjection(m.projection);const P=(z=h.tileID,L=m.getProjection(),k=this.transform,L.name===this.projection?k.calculateProjMatrix(z.toUnwrapped()):po(k,L,z));var z,L,k;const O=x.get("text-pitch-alignment")==="map",B=x.get("text-rotation-alignment")==="map";a.compileFilter();const G=a.dynamicFilter(),$=a.dynamicFilterNeedsFeature(),j=this.transform.calculatePixelsToTileUnitsMatrix(h),J=_l(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),j);let Z=null;if(O){const ie=gl(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),j);Z=s.ae.multiply([],this.transform.labelPlaneMatrix,ie)}let W=null;G&&h.latestFeatureIndex&&(W={unwrappedTileID:I,dynamicFilter:G,dynamicFilterNeedsFeature:$,featureIndex:h.latestFeatureIndex}),this.retainedQueryData[m.bucketInstanceId]=new uu(m.bucketInstanceId,g,m.sourceLayerIndex,m.index,h.tileID);const ee={bucket:m,layout:x,posMatrix:P,textLabelPlaneMatrix:J,labelToScreenMatrix:Z,clippingData:W,scale:T,textPixelRatio:S,holdingForFade:h.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:s.aE(m.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:s.aE(m.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(p)for(const ie of m.sortKeyRanges){const{sortKey:ue,symbolInstanceStart:re,symbolInstanceEnd:Y}=ie;r.push({sortKey:ue,symbolInstanceStart:re,symbolInstanceEnd:Y,parameters:ee})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:ee})}attemptAnchorPlacement(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const{textOffset0:$,textOffset1:j,crossTileID:J}=P,Z=[$,j],W=hu(r,h,p,Z,m),ee=this.collisionIndex.placeCollisionBox(L,m,a,Bl(W.x,W.y,g,x,this.transform.angle),I,w,T,S.predicate);if(O){const ie=L.getSymbolInstanceIconSize(G,this.transform.zoom,P.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,ie,O,Bl(W.x,W.y,g,x,this.transform.angle),I,w,T,S.predicate).box.length===0)return}if(ee.box.length>0){let ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[J]&&this.prevPlacement.placements[J]&&this.prevPlacement.placements[J].text&&(ie=this.prevPlacement.variableOffsets[J].anchor),this.variableOffsets[J]={textOffset:Z,width:h,height:p,anchor:r,textScale:m,prevAnchor:ie},this.markUsedJustification(L,r,P,k),L.allowVerticalPlacement&&(this.markUsedOrientation(L,k,P),this.placedOrientations[J]=k),{shift:W,placedGlyphBoxes:ee}}}placeLayerBucketPart(r,a,h,p){const{bucket:m,layout:g,posMatrix:x,textLabelPlaneMatrix:w,labelToScreenMatrix:T,clippingData:S,textPixelRatio:I,holdingForFade:P,collisionBoxArray:z,partiallyEvaluatedTextSize:L,partiallyEvaluatedIconSize:k,collisionGroup:O}=r.parameters,B=g.get("text-optional"),G=g.get("icon-optional"),$=g.get("text-allow-overlap"),j=g.get("icon-allow-overlap"),J=g.get("text-rotation-alignment")==="map",Z=g.get("text-pitch-alignment")==="map",W=g.get("symbol-z-order")==="viewport-y",ee=g.get("symbol-z-elevate");this.transform.setProjection(m.projection);let ie=$&&(j||!m.hasIconData()||G),ue=j&&($||!m.hasTextData()||B);!m.collisionArrays&&z&&m.deserializeCollisionBoxes(z),h&&p&&m.updateCollisionDebugBuffers(this.transform.zoom,z);const re=(Y,_e,fe)=>{const{crossTileID:se,numVerticalGlyphVertices:Ce}=Y;if(S){const Tt={zoom:this.transform.zoom,pitch:this.transform.pitch};let St=null;if(S.dynamicFilterNeedsFeature){const gt=this.retainedQueryData[m.bucketInstanceId];St=S.featureIndex.loadFeature({featureIndex:Y.featureIndex,bucketIndex:gt.bucketIndex,sourceLayerIndex:gt.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,S.dynamicFilter)(Tt,St,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(Y.tileAnchorX,Y.tileAnchorY),this.transform.calculateDistanceTileData(S.unwrappedTileID)))return this.placements[se]=new Ol(!1,!1,!1,!0),void a.add(se)}if(a.has(se))return;if(P)return void(this.placements[se]=new Ol(!1,!1,!1));let Se=!1,he=!1,ve=!0,ne=!1,Me=!1,Ae=null,Ue={box:null,offscreen:null,occluded:null},Ge={box:null,offscreen:null,occluded:null},He=null,$e=null,it=null,_t=0,nt=0,xt=0;fe.textFeatureIndex?_t=fe.textFeatureIndex:Y.useRuntimeCollisionCircles&&(_t=Y.featureIndex),fe.verticalTextFeatureIndex&&(nt=fe.verticalTextFeatureIndex);const Ct=Tt=>{Tt.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const St=this.transform.elevation;Tt.elevation=Y.zOffset+(St?St.getAtTileOffset(Tt.tileID,Tt.tileAnchorX,Tt.tileAnchorY):0)},ii=fe.textBox;if(ii){Ct(ii);const Tt=gt=>{let Ot=s.aF.horizontal;if(m.allowVerticalPlacement&&!gt&&this.prevPlacement){const Mt=this.prevPlacement.placedOrientations[se];Mt&&(this.placedOrientations[se]=Mt,Ot=Mt,this.markUsedOrientation(m,Ot,Y))}return Ot},St=(gt,Ot)=>{if(m.allowVerticalPlacement&&Ce>0&&fe.verticalTextBox){for(const Mt of m.writingModes)if(Mt===s.aF.vertical?(Ue=Ot(),Ge=Ue):Ue=gt(),Ue&&Ue.box&&Ue.box.length)break}else Ue=gt()};if(g.get("text-variable-anchor")){let gt=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[se]){const at=this.prevPlacement.variableOffsets[se];gt.indexOf(at.anchor)>0&&(gt=gt.filter(bi=>bi!==at.anchor),gt.unshift(at.anchor))}const Ot=(at,bi,wi)=>{const Xi=m.getSymbolInstanceTextSize(L,Y,this.transform.zoom,_e),Yi=(at.x2-at.x1)*Xi+2*at.padding,Fi=(at.y2-at.y1)*Xi+2*at.padding,Ji=Y.hasIconTextFit&&!j?bi:null;Ji&&Ct(Ji);let Li={box:[],offscreen:!1,occluded:!1};const Ni=$?2*gt.length:gt.length;for(let Le=0;Le=gt.length,Y,_e,m,wi,Ji,L,k);if(Ye&&(Li=Ye.placedGlyphBoxes,Li&&Li.box&&Li.box.length)){Se=!0,Ae=Ye.shift;break}}return Li};St(()=>Ot(ii,fe.iconBox,s.aF.horizontal),()=>{const at=fe.verticalTextBox;return at&&Ct(at),m.allowVerticalPlacement&&!(Ue&&Ue.box&&Ue.box.length)&&Ce>0&&at?Ot(at,fe.verticalIconBox,s.aF.vertical):{box:null,offscreen:null,occluded:null}}),Ue&&(Se=Ue.box,ve=Ue.offscreen,ne=Ue.occluded);const Mt=Tt(!(!Ue||!Ue.box));if(!Se&&this.prevPlacement){const at=this.prevPlacement.variableOffsets[se];at&&(this.variableOffsets[se]=at,this.markUsedJustification(m,at.anchor,Y,Mt))}}else{const gt=(Ot,Mt)=>{const at=m.getSymbolInstanceTextSize(L,Y,this.transform.zoom,_e),bi=this.collisionIndex.placeCollisionBox(m,at,Ot,new s.P(0,0),$,I,x,O.predicate);return bi&&bi.box&&bi.box.length&&(this.markUsedOrientation(m,Mt,Y),this.placedOrientations[se]=Mt),bi};St(()=>gt(ii,s.aF.horizontal),()=>{const Ot=fe.verticalTextBox;return m.allowVerticalPlacement&&Ce>0&&Ot?(Ct(Ot),gt(Ot,s.aF.vertical)):{box:null,offscreen:null,occluded:null}}),Tt(!!(Ue&&Ue.box&&Ue.box.length))}}if(He=Ue,Se=He&&He.box&&He.box.length>0,ve=He&&He.offscreen,ne=He&&He.occluded,Y.useRuntimeCollisionCircles){const Tt=m.text.placedSymbolArray.get(Y.centerJustifiedTextSymbolIndex>=0?Y.centerJustifiedTextSymbolIndex:Y.verticalPlacedTextSymbolIndex),St=s.aG(m.textSizeData,L,Tt),gt=g.get("text-padding");$e=this.collisionIndex.placeCollisionCircles(m,$,Tt,m.lineVertexArray,m.glyphOffsetArray,St,x,w,T,h,Z,O.predicate,Y.collisionCircleDiameter*St/s.bP,gt,this.retainedQueryData[m.bucketInstanceId].tileID),Se=$||$e.circles.length>0&&!$e.collisionDetected,ve=ve&&$e.offscreen,ne=$e.occluded}if(fe.iconFeatureIndex&&(xt=fe.iconFeatureIndex),fe.iconBox){const Tt=St=>{Ct(St);const gt=Y.hasIconTextFit&&Ae?Bl(Ae.x,Ae.y,J,Z,this.transform.angle):new s.P(0,0),Ot=m.getSymbolInstanceIconSize(k,this.transform.zoom,Y.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,Ot,St,gt,j,I,x,O.predicate)};Ge&&Ge.box&&Ge.box.length&&fe.verticalIconBox?(it=Tt(fe.verticalIconBox),he=it.box.length>0):(it=Tt(fe.iconBox),he=it.box.length>0),ve=ve&&it.offscreen,Me=it.occluded}const Jt=B||Y.numHorizontalGlyphVertices===0&&Ce===0,Pt=G||Y.numIconVertices===0;if(Jt||Pt?Pt?Jt||(he=he&&Se):Se=he&&Se:he=Se=he&&Se,Se&&He&&He.box&&this.collisionIndex.insertCollisionBox(He.box,g.get("text-ignore-placement"),m.bucketInstanceId,Ge&&Ge.box&&nt?nt:_t,O.ID),he&&it&&this.collisionIndex.insertCollisionBox(it.box,g.get("icon-ignore-placement"),m.bucketInstanceId,xt,O.ID),$e&&(Se&&this.collisionIndex.insertCollisionCircles($e.circles,g.get("text-ignore-placement"),m.bucketInstanceId,_t,O.ID),h)){const Tt=m.bucketInstanceId;let St=this.collisionCircleArrays[Tt];St===void 0&&(St=this.collisionCircleArrays[Tt]=new Op);for(let gt=0;gt<$e.circles.length;gt+=4)St.circles.push($e.circles[gt+0]),St.circles.push($e.circles[gt+1]),St.circles.push($e.circles[gt+2]),St.circles.push($e.collisionDetected?1:0)}const Xt=m.projection.name!=="globe";ie=ie&&(Xt||!ne),ue=ue&&(Xt||!Me),this.placements[se]=new Ol(Se||ie,he||ue,ve||m.justReloaded),a.add(se)};if(ee&&this.buildingIndex&&(this.buildingIndex.updateZOffset(m,this.retainedQueryData[m.bucketInstanceId].tileID),m.updateZOffset()),W){const Y=m.getSortedSymbolIndexes(this.transform.angle);for(let _e=Y.length-1;_e>=0;--_e){const fe=Y[_e];re(m.symbolInstances.get(fe),fe,m.collisionArrays[fe])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const Y=m.getSortedIndexesByZOffset();for(let _e=0;_e=0&&(r.text.placedSymbolArray.get(m).crossTileID=I>=0&&m!==I?0:T),g>=0&&(r.text.placedSymbolArray.get(g).crossTileID=I>=0&&g!==I?0:T),x>=0&&(r.text.placedSymbolArray.get(x).crossTileID=I>=0&&x!==I?0:T),w>=0&&(r.text.placedSymbolArray.get(w).crossTileID=I>=0&&w!==I?0:T)}markUsedOrientation(r,a,h){const p=a===s.aF.horizontal||a===s.aF.horizontalOnly?a:0,m=a===s.aF.vertical?a:0,{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,rightJustifiedTextSymbolIndex:w,verticalPlacedTextSymbolIndex:T}=h,S=r.text.placedSymbolArray;g>=0&&(S.get(g).placedOrientation=p),x>=0&&(S.get(x).placedOrientation=p),w>=0&&(S.get(w).placedOrientation=p),T>=0&&(S.get(T).placedOrientation=m)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let h=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const p=a?a.symbolFadeChange(r):1,m=a?a.opacities:{},g=a?a.variableOffsets:{},x=a?a.placedOrientations:{};for(const w in this.placements){const T=this.placements[w],S=m[w];S?(this.opacities[w]=new va(S,p,T.text,T.icon,null,T.clipped),h=h||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[w]=new va(null,p,T.text,T.icon,T.skipFade,T.clipped),h=h||T.text||T.icon)}for(const w in m){const T=m[w];if(!this.opacities[w]){const S=new va(T,p,!1,!1);S.isHidden()||(this.opacities[w]=S,h=h||T.text.placed||T.icon.placed)}}for(const w in g)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=g[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);h?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:r)}updateLayerOpacities(r,a,h,p){const m=new Set;for(const g of a){const x=g.getBucket(r);x&&g.latestFeatureIndex&&r.fqid===x.layerIds[0]&&(this.updateBucketOpacities(x,m,g.collisionBoxArray,h,p,g.tileID,r.scope),x.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(x,g.tileID),x.updateZOffset()))}}updateBucketOpacities(r,a,h,p,m,g,x){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const w=r.layers[0].layout,T=!!r.layers[0].dynamicFilter(),S=new va(null,0,!1,!1,!0),I=w.get("text-allow-overlap"),P=w.get("icon-allow-overlap"),z=w.get("text-variable-anchor"),L=w.get("text-rotation-alignment")==="map",k=w.get("text-pitch-alignment")==="map",O=new va(null,0,I&&(P||!r.hasIconData()||w.get("icon-optional")),P&&(I||!r.hasTextData()||w.get("text-optional")),!0);!r.collisionArrays&&h&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(h);const B=($,j,J)=>{for(let Z=0;Z0||Z>0,fe=ee>0,se=this.placedOrientations[W],Ce=se===s.aF.vertical,Se=se===s.aF.horizontal||se===s.aF.horizontalOnly;!_e&&!fe||Y.isHidden()||G++;let he=!1;if((_e||fe)&&m)for(const ve of r.activeReplacements){if(s.cJ(ve,p,s.cw.Symbol,x)||ve.min.x>ie||ie>ve.max.x||ve.min.y>ue||ue>ve.max.y)continue;const ne=s.cK(ie,ue,g.canonical,ve.footprintTileId.canonical);if(he=s.cL(ne,ve),he)break}if(_e){const ve=he?$n:yr(Y.text);B(r.text,J,Ce?$n:ve),B(r.text,Z,Se?$n:ve);const ne=Y.text.isHidden(),{leftJustifiedTextSymbolIndex:Me,centerJustifiedTextSymbolIndex:Ae,rightJustifiedTextSymbolIndex:Ue,verticalPlacedTextSymbolIndex:Ge}=j,He=r.text.placedSymbolArray,$e=ne||Ce?1:0;Me>=0&&(He.get(Me).hidden=$e),Ae>=0&&(He.get(Ae).hidden=$e),Ue>=0&&(He.get(Ue).hidden=$e),Ge>=0&&(He.get(Ge).hidden=ne||Se?1:0);const it=this.variableOffsets[W];it&&this.markUsedJustification(r,it.anchor,j,se);const _t=this.placedOrientations[W];_t&&(this.markUsedJustification(r,"left",j,_t),this.markUsedOrientation(r,_t,j))}if(fe){const ve=he?$n:yr(Y.icon),{placedIconSymbolIndex:ne,verticalPlacedIconSymbolIndex:Me}=j,Ae=r.icon.placedSymbolArray,Ue=Y.icon.isHidden()?1:0;ne>=0&&(B(r.icon,ee,Ce?$n:ve),Ae.get(ne).hidden=Ue),Me>=0&&(B(r.icon,j.numVerticalIconVertices,Se?$n:ve),Ae.get(Me).hidden=Ue)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ve=r.collisionArrays[$];if(ve){let ne=new s.P(0,0),Me=!0;if(ve.textBox||ve.verticalTextBox){if(z){const Ue=this.variableOffsets[W];Ue?(ne=hu(Ue.anchor,Ue.width,Ue.height,Ue.textOffset,Ue.textScale),L&&ne._rotate(k?this.transform.angle:-this.transform.angle)):Me=!1}T&&(Me=!Y.clipped),ve.textBox&&rn(r.textCollisionBox.collisionVertexArray,Y.text.placed,!Me||Ce,ne.x,ne.y),ve.verticalTextBox&&rn(r.textCollisionBox.collisionVertexArray,Y.text.placed,!Me||Se,ne.x,ne.y)}const Ae=Me&&!!(!Se&&ve.verticalIconBox);ve.iconBox&&rn(r.iconCollisionBox.collisionVertexArray,Y.icon.placed,Ae,j.hasIconTextFit?ne.x:0,j.hasIconTextFit?ne.y:0),ve.verticalIconBox&&rn(r.iconCollisionBox.collisionVertexArray,Y.icon.placed,!Ae,j.hasIconTextFit?ne.x:0,j.hasIconTextFit?ne.y:0)}}}if(r.fullyClipped=G===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=$.invProjMatrix,r.placementViewportMatrix=$.viewportMatrix,r.collisionCircleArray=$.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function rn(u,r,a,h,p){u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0)}const Fl=Math.pow(2,25),qh=Math.pow(2,24),Zh=Math.pow(2,17),ba=Math.pow(2,16),wa=Math.pow(2,9),Wh=Math.pow(2,8),du=Math.pow(2,1);function yr(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const r=u.placed?1:0,a=Math.floor(127*u.opacity);return a*Fl+r*qh+a*Zh+r*ba+a*wa+r*Wh+a*du+r}const $n=0;class Fe{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,a,h,p,m){const g=this._bucketParts;for(;this._currentTileIndexx.sortKey-w.sortKey));this._currentPartIndex{const x=s.e.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=a[r[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=w)&&(!x.maxzoom||x.maxzoom>w)){const T=x,S=T.layout.get("symbol-z-elevate"),I=this._inProgressLayer=this._inProgressLayer||new Fe(T),P=s.am(x.source,x.scope);if(I.continuePlacement(S?p[P]:h[P],this.placement,this._showCollisionBoxes,x,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const Ta=512/s.a4/2;class pu{constructor(r,a,h){this.tileID=r,this.bucketInstanceId=h,this.index=new s.cN(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const p=r.canonical.x*s.a4,m=r.canonical.y*s.a4;for(let g=0;gr.overscaledZ)for(const x in g){const w=g[x];w.tileID.isChildOf(r)&&w.findMatches(a.symbolInstances,r,p)}else{const x=g[r.scaledTo(Number(m)).key];x&&x.findMatches(a.symbolInstances,r,p)}}for(let m=0;m{a[h]=!0});for(const h in this.layerIndexes)a[h]||delete this.layerIndexes[h]}}const fu=new s.U({data:new s.W(s.N.colorTheme.data)}),xr=(u,r)=>tt(u,r&&r.filter(a=>a.identifier!=="source.canvas")),Vl=s.ai(jt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),us=s.ai(jt,["setCenter","setZoom","setBearing","setPitch"]),Yh={version:8,layers:[],sources:{}},Jh={duration:300,delay:0};class vr extends s.E{constructor(r,a={}){super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=s.Q({},Jh),this._buildingIndex=new cr(this),this.crossTileSymbolIndex=new gn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerIndices=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=a.styleChanges||new Ac,this.dispatcher=a.dispatcher?a.dispatcher:new s.by(s.bz(),this),a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new Ar,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new s.cP(r._requestManager,a.localFontFamily?s.cQ.all:a.localIdeographFontFamily?s.cQ.ideographs:s.cQ.none,a.localFontFamily||a.localIdeographFontFamily),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new No(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._config=a.config,this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",s.cR());const h=this;this._rtlTextPluginCallback=vr.registerForPluginStateChange(p=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(m,g)=>{if(s.cS(m),g&&g.every(x=>x))for(const x in h._sourceCaches){const w=h._sourceCaches[x],T=w.getSource().type;T!=="vector"&&T!=="geojson"||w.reload()}})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.getOwnSource(p.sourceId);if(m&&m.vectorLayerIds)for(const g in this._layers){const x=this._layers[g];x.source===m.id&&this._validateLayer(x)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(s.cT(r))return r;const a=s.cU(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch{return a}return a}return`json://${s.cV(JSON.stringify(r))}`}_diffStyle(r,a,h){this.globalId=this._getGlobalId(r);const p=(m,g)=>{try{g(null,this.setState(m,h))}catch(x){g(x,!1)}};if(typeof r=="string"){const m=this.map._requestManager.normalizeStyleURL(r),g=this.map._requestManager.transformRequest(m,s.R.Style);s.h(g,(x,w)=>{x?this.fire(new s.f(x)):w&&p(w,a)})}else typeof r=="object"&&p(r,a)}loadURL(r,a={}){this.fire(new s.g("dataloading",{dataType:"style"}));const h=typeof a.validate=="boolean"?a.validate:!s.cT(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);const p=this.importsCache.get(r);if(p)return this._load(p,h);const m=this.map._requestManager.transformRequest(r,s.R.Style);this._request=s.h(m,(g,x)=>{if(this._request=null,g)this.fire(new s.f(g));else if(x)return this.importsCache.set(r,x),this._load(x,h)})}loadJSON(r,a={}){this.fire(new s.g("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=s.e.frame(()=>{this._request=null,this._load(r,a.validate!==!1)})}loadEmpty(){this.fire(new s.g("dataloading",{dataType:"style"})),this._load(Yh,!1)}_loadImports(r,a,h){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const p=[];for(const m of r){const g=this._createFragmentStyle(m),x=new Promise(S=>{g.once("style.import.load",S),g.once("error",S)}).then(()=>this.mergeAll());if(p.push(x),this.resolvedImports.has(m.url)){g.loadEmpty();continue}const w=m.data||this.importsCache.get(m.url);w?(g.loadJSON(w,{validate:a}),this._isInternalStyle(w)&&(g.globalId=null)):m.url?g.loadURL(m.url,{validate:a}):g.loadEmpty();const T={style:g,id:m.id,config:m.config};if(h){const S=this.fragments.findIndex(({id:I})=>I===h);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(p)}getImportGlobalIds(r=this,a=new Set){for(const h of r.fragments)h.style.globalId&&a.add(h.style.globalId),this.getImportGlobalIds(h.style,a);return[...a.values()]}_createFragmentStyle(r){const a=this.scope?s.am(r.id,this.scope):r.id;let h;const p=this._initialConfig&&this._initialConfig[a];(r.config||p)&&(h=s.Q({},r.config,p));const m=new vr(this.map,{scope:a,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:h,configOptions:this.options,configDependentLayers:this._configDependentLayers});return m.setEventedParent(this.map,{style:m}),m}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}_load(r,a){const h=r.schema;if(this._isInternalStyle(r)){const g=s.Q({},Yh,{imports:[{id:"basemap",data:r,url:""}]});return void this._load(g,a)}if(this.updateConfig(this._config,h),a&&xr(this,R(r)))return;this._loaded=!0,this.stylesheet=s.cW(r);const p=()=>{for(const T in r.sources)this.addSource(T,r.sources[T],{validate:!1,isInitialLoad:!0});r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(r.glyphs,this.scope);const g=ga(this.stylesheet.layers);if(this._order=g.map(T=>T.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new Bt(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Bt(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const T of g){const S=s.c$(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S,this._serializedLayers[S.id]=S.serialize();const I=this.getOwnLayerSourceCache(S),P=!!this.directionalLight&&this.directionalLight.shadowsEnabled();I&&S.canCastShadows()&&P&&(I.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const x=this.stylesheet.terrain;x&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(x,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.g("data",{dataType:"style"}));const w=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(),this.fire(new s.g(w?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.g(w?"style.load":"style.import.load")))},m=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=m,m){const g=this._evaluateColorThemeData(m);this._loadColorTheme(g).then(()=>{p()}).catch(x=>{s.w(`Couldn't load color theme from the stylesheet: ${x}`),p()})}else this._styleColorTheme.lut=null,p()}isRootStyle(){return this.importDepth===0}mergeAll(){let r,a,h,p,m,g,x,w;const T={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(S=>{if(S.stylesheet){if(S.light!=null&&(r=S.light),S.stylesheet.lights)for(const I of S.stylesheet.lights)I.type==="ambient"&&S.ambientLight!=null&&(a=S.ambientLight),I.type==="directional"&&S.directionalLight!=null&&(h=S.directionalLight);p=this._prioritizeTerrain(p,S.terrain,S.stylesheet.terrain),S.stylesheet.fog&&S.fog!=null&&(m=S.fog),S.stylesheet.camera!=null&&(w=S.stylesheet.camera),S.stylesheet.projection!=null&&(g=S.stylesheet.projection),S.stylesheet.transition!=null&&(x=S.stylesheet.transition),T[S.scope]=S._styleColorTheme}}),this.light=r,this.ambientLight=a,this.directionalLight=h,this.fog=m,this._styleColorThemeForScope=T,p===null?delete this.terrain:this.terrain=p,this.camera=w||{"camera-projection":"perspective"},this.projection=g||{name:"mercator"},this.transition=s.Q({},Jh,x),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(r){const a=h=>{for(const p of h.fragments)a(p.style);r(h)};a(this)}_prioritizeTerrain(r,a,h){const p=r&&r.drapeRenderMode===0;return h===null?a&&a.drapeRenderMode===0?a:p?r:null:a!=null&&(!r||p||a&&a.drapeRenderMode===1)?a:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(a=>{r=this._prioritizeTerrain(r,a.terrain,a.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r}mergeProjection(){let r;this.forEachFragmentStyle(a=>{a.stylesheet.projection!=null&&(r=a.stylesheet.projection)}),this.projection=r||{name:"mercator"}}mergeSources(){const r={},a={},h={};this.forEachFragmentStyle(p=>{for(const m in p._sourceCaches){const g=s.am(m,p.scope);r[g]=p._sourceCaches[m]}for(const m in p._otherSourceCaches){const g=s.am(m,p.scope);a[g]=p._otherSourceCaches[m]}for(const m in p._symbolSourceCaches){const g=s.am(m,p.scope);h[g]=p._symbolSourceCaches[m]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=h}mergeLayers(){const r={},a=[],h={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(g=>{for(const x of g._order){const w=g._layers[x];if(w.type==="slot"){const T=s.cX(x);if(r[T])continue;r[T]=[]}w.slot&&r[w.slot]?r[w.slot].push(w):a.push(w)}}),this._mergedOrder=[],this._clipLayerIndices=[];let p=0;const m=(g=[])=>{for(const x of g)if(x.type==="slot"){const w=s.cX(x.id);r[w]&&m(r[w]),this._mergedSlots.push(w)}else{const w=s.am(x.id,x.scope);this._mergedOrder.push(w),h[w]=x,x.is3D()&&(this._has3DLayers=!0),x.type==="circle"&&(this._hasCircleLayers=!0),x.type==="symbol"&&(this._hasSymbolLayers=!0),x.type==="clip"&&this._clipLayerIndices.push(p),p++}};m(a),this._mergedOrder.sort((g,x)=>{const w=h[g],T=h[x];return w.hasInitialOcclusionOpacityProperties?T.is3D()?1:0:w.is3D()&&T.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=h,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=s.Q({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?function(a,h,p){const m=s.Q({},h);for(const x of Object.keys(s.N.colorTheme))m[x]===void 0&&(m[x]=s.N.colorTheme[x].default);const g=new s.O(fu,a,new Map(p));return g.setTransitionOrValue(m,p),g.untransitioned().possiblyEvaluate(new s.Y(0))}(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((h,p)=>{const m="data:image/png;base64,";if(!r||r.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void h();let g=r;g.startsWith(m)||(g=m+g);const x="mapbox-reserved-lut",w=new Image;w.src=g,w.onerror=()=>{this._styleColorTheme.lutLoading=!1,p(new Error("Failed to load image data"))},w.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void h();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:I}=s.e.getImageData(w);if(S>32)return void p(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void p(new Error("The width of the image must be equal to the height squared."));this.getImage(x)&&this.removeImage(x),this.addImage(x,{data:new s.j({width:T,height:S},I),pixelRatio:1,sdf:!1,version:0});const P=this.imageManager.getImage(x,this.scope);P?(this._styleColorTheme.lut={image:P.data,data:r},h()):p(new Error("Missing LUT image."))}})}getLut(r){const a=this._styleColorThemeForScope[r];return a?a.lut:null}setProjection(r){r?this.stylesheet.projection=r:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(a,h,p){let m,g,x;const w=s.e.devicePixelRatio>1?"@2x":"";let T=s.h(h.transformRequest(h.normalizeSpriteURL(a,w,".json"),s.R.SpriteJSON),(P,z)=>{T=null,x||(x=P,m=z,I())}),S=s.i(h.transformRequest(h.normalizeSpriteURL(a,w,".png"),s.R.SpriteImage),(P,z)=>{S=null,x||(x=P,g=z,I())});function I(){if(x)p(x);else if(m&&g){const P=s.e.getImageData(g),z={};for(const L in m){const{width:k,height:O,x:B,y:G,sdf:$,pixelRatio:j,stretchX:J,stretchY:Z,content:W}=m[L],ee=new s.j({width:k,height:O});s.j.copy(P,ee,{x:B,y:G},{x:0,y:0},{width:k,height:O},null),z[L]={data:ee,pixelRatio:j,sdf:$,stretchX:J,stretchY:Z,content:W}}p(null,z)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(r,this.map._requestManager,(a,h)=>{if(this._spriteRequest=null,a)this.fire(new s.f(a));else if(h)for(const p in h)this.imageManager.addImage(p,this.scope,h[p]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.g("data",{dataType:"style"}))})}_validateLayer(r){const a=this.getOwnSource(r.source);if(!a)return;const h=r.sourceLayer;h&&(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(h)===-1)&&this.fire(new s.f(new Error(`Source layer "${h}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,a)=>{const h=this.fragments[a];return h&&h.style&&(r.data=h.style.serialize()),r})}_serializeSources(){const r={};for(const a in this._sourceCaches){const h=this._sourceCaches[a].getSource();r[h.id]||(r[h.id]=h.serialize())}return r}_serializeLayers(r){const a=[];for(const h of r){const p=this._layers[h];p&&p.type!=="custom"&&a.push(p.serialize())}return a}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const a=this.getOwnLayer(r);if(a)return a;this.fire(new s.f(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const a=this.getOwnSource(r);if(a)return a;this.fire(new s.f(new Error(`The source '${r}' does not exist in the map's style.`)))}precompilePrograms(r,a){const h=this.map.painter;if(h)for(let p=r.minzoom||0;p<(r.maxzoom||25.5);p++){const m=r.getProgramIds();if(m)for(const g of m){const x=r.getDefaultProgramParams(g,a.zoom,this._styleColorTheme.lut);x&&(h.style=this,this.fog&&(h._fogVisible=!0,x.overrideFog=!0,h.getOrCreateProgram(g,x)),h._fogVisible=!1,x.overrideFog=!1,h.getOrCreateProgram(g,x),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(x.overrideRtt=!0,h.getOrCreateProgram(g,x)))}}}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a));const h=this._changes.isDirty();let p=!1;if(this._changes.isDirty()){const g=this._changes.getLayerUpdatesByScope();for(const x in g){const{updatedIds:w,removedIds:T}=g[x];(w||T)&&(this._updateWorkerLayers(x,w,T),p=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._changes.reset()}const m={};for(const g in this._mergedSourceCaches){const x=this._mergedSourceCaches[g];m[g]=x.used,x.used=!1,x.tileCoverLift=0}for(const g of this._mergedOrder){const x=this._mergedLayers[g];if(x.recalculate(r,this._availableImages),!x.isHidden(r.zoom)){const w=this.getLayerSourceCache(x);w&&(w.used=!0,w.tileCoverLift=Math.max(w.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(x,r)}):this.precompilePrograms(x,r))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&p&&this.mergeLayers();for(const g in m){const x=this._mergedSourceCaches[g];m[g]!==x.used&&x.getSource().fire(new s.g("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),h&&this.fire(new s.g("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=this._changes.getUpdatedImages();if(r.length){for(const a in this._sourceCaches)this._sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],r);this._changes.resetUpdatedImages()}}_updateWorkerLayers(r,a,h){const p=this.getFragmentStyle(r);p&&this.dispatcher.broadcast("updateLayers",{layers:a?p._serializeLayers(a):[],scope:r,removedIds:h||[],options:p.options})}setState(r,a){if(this._checkLoaded(),xr(this,R(r)))return!1;(r=s.cW(r)).layers=ga(r.layers);const h=function(g,x){if(!g)return[{command:jt.setStyle,args:[x]}];let w=[];try{if(!s.d(g.version,x.version))return[{command:jt.setStyle,args:[x]}];if(s.d(g.center,x.center)||w.push({command:jt.setCenter,args:[x.center]}),s.d(g.zoom,x.zoom)||w.push({command:jt.setZoom,args:[x.zoom]}),s.d(g.bearing,x.bearing)||w.push({command:jt.setBearing,args:[x.bearing]}),s.d(g.pitch,x.pitch)||w.push({command:jt.setPitch,args:[x.pitch]}),s.d(g.sprite,x.sprite)||w.push({command:jt.setSprite,args:[x.sprite]}),s.d(g.glyphs,x.glyphs)||w.push({command:jt.setGlyphs,args:[x.glyphs]}),s.d(g.imports,x.imports)||function(z=[],L=[],k){L=L||[];const O=(z=z||[]).map(kl),B=L.map(kl),G=z.reduce(_n,{}),$=L.reduce(_n,{}),j=O.slice();let J,Z,W,ee;for(J=0,Z=0;J{z.source&&T[z.source]?w.push({command:jt.removeLayer,args:[z.id]}):I.push(z)});let P=g.terrain;P&&T[P.source]&&(w.push({command:jt.setTerrain,args:[void 0]}),P=void 0),w=w.concat(S),s.d(P,x.terrain)||w.push({command:jt.setTerrain,args:[x.terrain]}),function(z,L,k){L=L||[];const O=(z=z||[]).map(kl),B=L.map(kl),G=z.reduce(_n,{}),$=L.reduce(_n,{}),j=O.slice(),J=Object.create(null);let Z,W,ee,ie,ue,re,Y;for(Z=0,W=0;Z!(g.command in us));if(h.length===0)return!1;const p=h.filter(g=>!(g.command in Vl));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);const m=[];return h.forEach(g=>{m.push(this[g.command].apply(this,g.args))}),a&&Promise.all(m).then(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(r,a){return this.getImage(r)?this.fire(new s.f(new Error("An image with this name already exists."))):(this.imageManager.addImage(r,this.scope,a),this._afterImageUpdated(r),this)}updateImage(r,a){this.imageManager.updateImage(r,this.scope,a)}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._afterImageUpdated(r),this):this.fire(new s.f(new Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(r),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new s.g("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(r,a,h={}){return this._checkLoaded(),this._validate(Pe,`models.${r}`,a,null,h)||(this.modelManager.addModel(r,a,this.scope),this._changes.setDirty()),this}hasModel(r){return this.modelManager.hasModel(r,this.scope)}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.scope),this):this.fire(new s.f(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(r,a,h={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(F,`sources.${r}`,a,null,h))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const p=wl(r,a,this.dispatcher,this);p.scope=this.scope,p.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(p.id),source:p.serialize(),sourceId:p.id}));const m=g=>{const x=(g?"symbol:":"other:")+p.id,w=s.am(x,this.scope),T=this._sourceCaches[x]=new s.bx(w,p,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[p.id]=T,T.onAdd(this.map)};m(!1),a.type!=="vector"&&a.type!=="geojson"||m(!0),p.onAdd&&p.onAdd(this.map),h.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const a=this.getOwnSource(r);if(!a)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new s.f(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new s.f(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));const h=this.getOwnSourceCaches(r);for(const p of h){const m=s.cX(p.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(p.id),p.fire(new s.g("data",{sourceDataType:"metadata",dataType:"source",sourceId:p.getSource().id})),p.setEventedParent(null),p.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,a){this._checkLoaded(),this.getOwnSource(r).setData(a),this._changes.setDirty()}getOwnSource(r){const a=this.getOwnSourceCache(r);return a&&a.getSource()}getOwnSources(){const r=[];for(const a in this._otherSourceCaches){const h=this.getOwnSourceCache(a);h&&r.push(h.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const a in r){const h=r[a]._tiles;for(const p in h){const m=h[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;const a=this._getTransitionParameters();for(const p of r){if(this._validate(te,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(a)}else this.ambientLight=new ao(p,Pc||(Pc=new s.U({color:new s.W(s.N.properties_light_ambient.color),intensity:new s.W(s.N.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(a)}else this.directionalLight=new ao(p,zc||(zc=new s.U({direction:new s.a6(s.N.properties_light_directional.direction),color:new s.W(s.N.properties_light_directional.color),intensity:new s.W(s.N.properties_light_directional.intensity),"cast-shadows":new s.W(s.N.properties_light_directional["cast-shadows"]),"shadow-intensity":new s.W(s.N.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const h=new s.Y(this.z||0,a);this.ambientLight&&this.ambientLight.recalculate(h),this.directionalLight&&this.directionalLight.recalculate(h),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;const h=I=>.2126*(I[0]<=.03928?I[0]/12.92:Math.pow((I[0]+.055)/1.055,2.4))+.7152*(I[1]<=.03928?I[1]/12.92:Math.pow((I[1]+.055)/1.055,2.4))+.0722*(I[2]<=.03928?I[2]/12.92:Math.pow((I[2]+.055)/1.055,2.4)),p=r.properties.get("color").toRenderColor(null).toArray01(),m=r.properties.get("intensity"),g=r.properties.get("direction"),x=1-s.ad(g.x,g.y,g.z)[2]/90,w=h(p)*m*x,T=a.properties.get("color").toRenderColor(null).toArray01(),S=a.properties.get("intensity");return(w+h(T)*S)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(!r)return this;if(s.cY(r)){const a=s.cZ(r),h=this.fragments.find(({id:m})=>m===a);if(!h)throw new Error(`Style import not found: ${r}`);const p=s.cX(r);return h.style.getFragmentStyle(p)}{const a=this.fragments.find(({id:h})=>h===r);if(!a)throw new Error(`Style import not found: ${r}`);return a.style}}getConfigProperty(r,a){const h=this.getFragmentStyle(r);if(!h)return null;const p=s.am(a,h.scope),m=h.options.get(p),g=m?m.value||m.default:null;return g?g.serialize():null}setConfigProperty(r,a,h){const p=this.getFragmentStyle(r);if(!p)return;const m=p.stylesheet.schema;if(!m||!m[a])return;const g=s.z(h);if(g.result!=="success")return void xr(this,g.value);const x=g.value.expression,w=s.am(a,p.scope),T=p.options.get(w);if(!T)return;let S;const{minValue:I,maxValue:P,stepValue:z,type:L,values:k}=m[a],O=s.z(m[a].default);O.result==="success"&&(S=O.value.expression),S?(this.options.set(w,{...T,value:x,default:S,minValue:I,maxValue:P,stepValue:z,type:L,values:k}),this.updateConfigDependencies(a)):this.fire(new s.f(new Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){const a=this.getFragmentStyle(r);if(!a)return null;const h=a.stylesheet.schema;if(!h)return null;const p={};for(const m in h){const g=s.am(m,a.scope),x=a.options.get(g),w=x?x.value||x.default:null;p[m]=w?w.serialize():null}return p}setConfig(r,a){const h=this.getFragmentStyle(r);h&&(h.updateConfig(a,h.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const a=this.getFragmentStyle(r);return a?a.stylesheet.schema:null}setSchema(r,a){const h=this.getFragmentStyle(r);h&&(h.stylesheet.schema=a,h.updateConfig(h._config,a),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(const h in a){let p,m;const g=s.z(a[h].default);if(g.result==="success"&&(p=g.value.expression),r&&r[h]!==void 0){const P=s.z(r[h]);P.result==="success"&&(m=P.value.expression)}const{minValue:x,maxValue:w,stepValue:T,type:S,values:I}=a[h];if(p){const P=s.am(h,this.scope);this.options.set(P,{default:p,value:m,minValue:x,maxValue:w,stepValue:T,type:S,values:I})}else this.fire(new s.f(new Error(`No schema defined for config option "${h}".`)))}else this.fire(new s.f(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(r){for(const a of this._configDependentLayers){const h=this.getLayer(a);if(h){if(r&&!h.configDependencies.has(r))continue;h.possiblyEvaluateVisibility(),this._updateLayer(h)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle(a=>{if(a._styleColorTheme.colorTheme){const h=a._evaluateColorThemeData(a._styleColorTheme.colorTheme);(!a._styleColorTheme.lut&&h!==""||a._styleColorTheme.lut&&h!==a._styleColorTheme.lut.data)&&a.setColorTheme(a._styleColorTheme.colorTheme)}}),this._changes.setDirty()}addLayer(r,a,h={}){this._checkLoaded();const p=r.id;if(this._layers[p])return void this.fire(new s.f(new Error(`Layer with id "${p}" already exists on this map`)));let m;if(r.type==="custom"){if(xr(this,s.c_(r)))return;m=s.c$(r,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof r.source=="object"&&(this.addSource(p,r.source),r=s.cW(r),r=s.Q(r,{source:p})),this._validate(xe,`layers.${p}`,r,{arrayIndex:-1},h))return;m=s.c$(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:p}}),this._serializedLayers[m.id]=m.serialize()}m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid);let g=this._order.length;if(a){const S=this._order.indexOf(a);if(S===-1)return void this.fire(new s.f(new Error(`Layer with id "${a}" does not exist on this map.`)));m.slot===this._layers[a].slot?g=S:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(g,0,p),this._layerOrderChanged=!0,this._layers[p]=m;const x=this.getOwnLayerSourceCache(m),w=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&m.canCastShadows()&&w&&(x.castsShadows=!0);const T=this._changes.getRemovedLayer(m);if(T&&m.source&&x&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const S=s.am(m.source,m.scope);T.type!==m.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),x.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();const h=this._checkLayer(r);if(!h||r===a)return;const p=this._order.indexOf(r);this._order.splice(p,1);let m=this._order.length;if(a){const g=this._order.indexOf(a);if(g===-1)return void this.fire(new s.f(new Error(`Layer with id "${a}" does not exist on this map.`)));h.slot===this._layers[a].slot?m=g:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,r),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(r){this._checkLoaded();const a=this._checkLayer(r);if(!a)return;a.setEventedParent(null);const h=this._order.indexOf(r);this._order.splice(h,1),delete this._layers[r],delete this._serializedLayers[r],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(a.fqid),this._changes.removeLayer(a);const p=this.getOwnLayerSourceCache(a);if(p&&p.castsShadows){let m=!1;for(const g in this._layers)if(this._layers[g].source===a.source&&this._layers[g].canCastShadows()){m=!0;break}p.castsShadows=m}a.onRemove&&a.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const a in this._layers)if(this._layers[a].type===r)return!0;return!1}setLayerZoomRange(r,a,h){this._checkLoaded();const p=this._checkLayer(r);p&&(p.minzoom===a&&p.maxzoom===h||(a!=null&&(p.minzoom=a),h!=null&&(p.maxzoom=h),this._updateLayer(p)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(r,a){this._checkLoaded();const h=this._checkLayer(r);h&&h.slot!==a&&(h.slot=a,this._updateLayer(h))}setFilter(r,a,h={}){this._checkLoaded();const p=this._checkLayer(r);if(p&&!s.d(p.filter,a))return a==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate(le,`layers.${p.id}.filter`,a,{layerType:p.type},h)||(p.filter=s.cW(a),this._updateLayer(p)))}getFilter(r){const a=this._checkLayer(r);if(a)return s.cW(a.filter)}setLayoutProperty(r,a,h,p={}){this._checkLoaded();const m=this._checkLayer(r);if(m&&!s.d(m.getLayoutProperty(a),h)){if(h!=null&&(!p||p.validate!==!1)&&xr(m,ze.call(R,{key:`layers.${r}.layout.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.N,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(a,h),m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),this._updateLayer(m)}}getLayoutProperty(r,a){const h=this._checkLayer(r);if(h)return h.getLayoutProperty(a)}setPaintProperty(r,a,h,p={}){this._checkLoaded();const m=this._checkLayer(r);if(!m||s.d(m.getPaintProperty(a),h)||h!=null&&(!p||p.validate!==!1)&&xr(m,ge.call(R,{key:`layers.${r}.paint.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.N})))return;const g=m.setPaintProperty(a,h);m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),g&&this._updateLayer(m),this._changes.updatePaintProperties(m)}getPaintProperty(r,a){const h=this._checkLayer(r);if(h)return h.getPaintProperty(a)}setFeatureState(r,a){this._checkLoaded();const h=r.source,p=r.sourceLayer,m=this._checkSource(h);if(!m)return;const g=m.type;if(g==="geojson"&&p)return void this.fire(new s.f(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!p)return void this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new s.f(new Error("The feature id parameter must be provided.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.setFeatureState(p,r.id,a)}removeFeatureState(r,a){this._checkLoaded();const h=r.source,p=this._checkSource(h);if(!p)return;const m=p.type,g=m==="vector"?r.sourceLayer:void 0;if(m==="vector"&&!g)return void this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new s.f(new Error("A feature id is required to remove its specific state property.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.removeFeatureState(g,r.id,a)}getFeatureState(r){this._checkLoaded();const a=r.source,h=r.sourceLayer,p=this._checkSource(a);if(p){if(p.type!=="vector"||h)return r.id===void 0&&this.fire(new s.f(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(h,r.id);this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=s.Q({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return s.Q({},this.stylesheet.transition)}serialize(){this._checkLoaded();const r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return s.d0({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(r){this._changes.updateLayer(r);const a=this.getLayerSourceCache(r),h=s.am(r.source,r.scope),p=this._changes.getUpdatedSourceCaches();r.source&&!p[h]&&a&&a.getSource().type!=="raster"&&(this._changes.updateSourceCache(h,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const a=x=>this._mergedLayers[x].type==="fill-extrusion"||this._mergedLayers[x].type==="model",h=this.order,p={},m=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w)){p[w]=x;for(const T of r){const S=T[w];if(S)for(const I of S)m.push(I)}}}m.sort((x,w)=>w.intersectionZ-x.intersectionZ);const g=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w))for(let T=m.length-1;T>=0;T--){const S=m[T].feature;if(S.layer&&p[S.layer.id]{const S=this.getLayer(T);return S&&S.is3D()}):this.has3DLayers(),w=gr.createFromScreenPoints(r,h);for(const T in this._mergedSourceCaches){const S=this._mergedSourceCaches[T].getSource();if(!S||S.scope!==a.scope)continue;const I=this._mergedSourceCaches[T].getSource().id;a.layers&&!p[I]||m.push(mn(this._mergedSourceCaches[T],this._mergedLayers,g,w,a,h,x,!!this.map._showQueryGeometry))}return this.placement&&m.push(function(T,S,I,P,z,L,k){const O={},B=L.queryRenderedSymbols(P),G=[];for(const $ of Object.keys(B).map(Number))G.push(k[$]);G.sort(cu);for(const $ of G){const j=$.featureIndex.lookupSymbolFeatures(B[$.bucketInstanceId],S,$.bucketIndex,$.sourceLayerIndex,z.filter,z.layers,z.availableImages,T);for(const J in j){const Z=O[J]=O[J]||[],W=j[J];W.sort((ee,ie)=>{const ue=$.featureSortOrder;if(ue){const re=ue.indexOf(ee.featureIndex);return ue.indexOf(ie.featureIndex)-re}return ie.featureIndex-ee.featureIndex});for(const ee of W)Z.push(ee)}}for(const $ in O)O[$].forEach(j=>{const J=j.feature,Z=I(T[$]);if(!Z)return;const W=Z.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=W});return O}(this._mergedLayers,g,this.getLayerSourceCache.bind(this),w.screenGeometry,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(r,a){a&&a.filter&&this._validate(le,"querySourceFeatures.filter",a.filter,null,a);const h=this.getOwnSourceCaches(r);let p=[];for(const m of h)p=p.concat(Dp(m,a));return p}addSourceType(r,a,h){return vr.getSourceType(r)?h(new Error(`A source type called "${r}" already exists.`)):(vr.setSourceType(r,a),a.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:r,url:a.workerSourceURL},h):h(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,h={}){this._checkLoaded();const p=this.light.getLight();let m=!1;for(const x in r)if(!s.d(r[x],p[x])){m=!0;break}if(!m)return;const g=this._getTransitionParameters();this.light.setLight(r,a,h),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.e.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),a===0&&delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let h=r;const p=r.source==null;if(a===1){if(this.disableElevatedTerrain)return;if(typeof h.source=="object"){const x="terrain-dem-src";this.addSource(x,h.source),h=s.cW(h),h=s.Q(h,{source:x})}const m=s.Q({},h),g={};if(this.terrain&&p){m.source=this.terrain.get().source;const x=this.terrain?this.getFragmentStyle(this.terrain.scope):null;x&&(g.style=x.serialize())}if(this._validate(K,"terrain",m,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!p||this.terrain&&a!==this.terrain.drapeRenderMode){if(!h)return;this._createTerrain(h,a),this.fire(new s.g("data",{dataType:"style"}))}else{const m=this.terrain,g=m.get();for(const x of Object.keys(s.N.terrain))!h.hasOwnProperty(x)&&s.N.terrain[x].default&&(h[x]=s.N.terrain[x].default);for(const x in r)if(!s.d(r[x],g[x])){m.set(r,this.options),this.stylesheet.terrain=r;const w=this._getTransitionParameters({duration:0});m.updateTransitions(w),this.fire(new s.g("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const a=this.fog=new tr(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const a=this.fog;if(!s.d(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}}else this._createFog(r);this._markersNeedUpdate=!0}setColorTheme(r){this._checkLoaded();const a=()=>{for(const p in this._layers)this._layers[p].lut=this._styleColorTheme.lut;for(const p in this._sourceCaches)this._sourceCaches[p].clearTiles()};if(this._styleColorTheme.colorTheme=r,!r)return this._styleColorTheme.lut=null,void a();const h=this._evaluateColorThemeData(r);this._loadColorTheme(h).then(()=>{this.fire(new s.g("colorthemeset")),a()}).catch(p=>{s.w(`Couldn't set color theme: ${p}`)})}_getTransitionParameters(r){return{now:s.e.now(),transition:s.Q(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],a=[];for(const h of this._mergedOrder)this.isLayerDraped(this._mergedLayers[h])?r.push(h):a.push(h);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...a)}_createTerrain(r,a){const h=this.terrain=new kt(r,a,this.scope,this.options);a===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const p=this._getTransitionParameters({duration:0});h.updateTransitions(p)}_force3DLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="fill-extrusion"&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="symbol"&&this._updateLayer(a)}}_validate(r,a,h,p,m={}){if(m&&m.validate===!1)return!1;const g=s.Q({},this.serialize());return xr(this,r.call(R,s.Q({key:a,style:g,value:h,styleSpec:s.N},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.d1.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles(),this._mergedSourceCaches[r].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(r){const a=this.getSourceCaches(r);for(const h of a)h.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}reloadSource(r){const a=this.getSourceCaches(r);for(const h of a)h.resume(),h.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}updateSources(r){let a;this.directionalLight&&(a=es(this.directionalLight));for(const h in this._mergedSourceCaches)this._mergedSourceCaches[h].update(r,void 0,void 0,a)}_generateCollisionBoxes(){for(const r in this._sourceCaches){const a=this._sourceCaches[r];a.resume(),a.reload()}}_updatePlacement(r,a,h,p,m,g,x=!1){let w=!1,T=!1;const S={},I={};for(const P of this._mergedOrder){const z=this._mergedLayers[P];if(z.type!=="symbol")continue;const L=s.am(z.source,z.scope);let k=S[L];if(!k){const B=this.getLayerSourceCache(z);if(!B)continue;const G=B.getRenderableIds(!0).map($=>B.getTileByID($));I[L]=G.slice(),k=S[L]=G.sort(($,j)=>j.tileID.overscaledZ-$.tileID.overscaledZ||($.tileID.isLessThan(j.tileID)?-1:1))}const O=this.crossTileSymbolIndex.addLayer(z,k,a.center.lng,a.projection);w=w||O}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),x=x||this._layerOrderChanged||p===0,this._layerOrderChanged&&this.fire(new s.g("neworder")),(x||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.e.now(),a.zoom))&&(this.pauseablePlacement=new Hh(a,this._mergedOrder,x,h,p,m,this.placement,this.fog&&a.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,I),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.e.now()),T=!0),w&&this.pauseablePlacement.placement.setStale()),T||w){this._buildingIndex.onNewFrame(a.zoom);for(let P=0;PPm===r.id)!==-1)return void this.fire(new s.f(new Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return h.push(r),this._loadImports([r],!0);const p=h.findIndex(({id:m})=>m===a);return p===-1&&this.fire(new s.f(new Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=h.slice(0,p).concat(r).concat(h.slice(p)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],p=this.getImportIndex(r);return p===-1?this:typeof a=="string"?(this.setImportUrl(r,a),this):(a.url&&a.url!==h[p].url&&this.setImportUrl(r,a.url),s.d(a.config,h[p].config)||this.setImportConfig(r,a.config),s.d(a.data,h[p].data)||this.setImportData(r,a.data),this)}moveImport(r,a){this._checkLoaded();let h=this.stylesheet.imports||[];const p=this.getImportIndex(r);if(p===-1)return this;const m=this.getImportIndex(a);if(m===-1)return this;const g=h[p],x=this.fragments[p];return h=h.filter(({id:w})=>w!==r),this.fragments=this.fragments.filter(({id:w})=>w!==r),this.stylesheet.imports=h.slice(0,m).concat(g).concat(h.slice(m)),this.fragments=this.fragments.slice(0,m).concat(x).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],p=this.getImportIndex(r);if(p===-1)return this;h[p].url=a;const m=this.fragments[p];return m.style=this._createFragmentStyle(h[p]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(a),this}setImportData(r,a){this._checkLoaded();const h=this.getImportIndex(r),p=this.stylesheet.imports||[];return h===-1?this:a?(this.fragments[h].style.setState(a),this._reloadImports(),this):(delete p[h].data,this.setImportUrl(r,p[h].url))}setImportConfig(r,a){this._checkLoaded();const h=this.getImportIndex(r),p=this.stylesheet.imports||[];if(h===-1)return this;a?p[h].config=a:delete p[h].config;const m=this.fragments[h],g=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=a,m.style.updateConfig(a,g),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const a=this.stylesheet.imports||[],h=this.getImportIndex(r);h!==-1&&(a.splice(h,1),this.fragments[h].style._remove(),this.fragments.splice(h,1),this._reloadImports())}getImportIndex(r){const a=(this.stylesheet.imports||[]).findIndex(h=>h.id===r);return a===-1&&this.fire(new s.f(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const a in this._mergedOtherSourceCaches){const h=this._mergedOtherSourceCaches[a];h&&r.push(h.getSource())}return r}getSource(r,a){const h=this.getSourceCache(r,a);return h&&h.getSource()}getLayerSource(r){const a=this.getLayerSourceCache(r);return a&&a.getSource()}getSourceCache(r,a){const h=s.am(r,a);return this._mergedOtherSourceCaches[h]}getLayerSourceCache(r){const a=s.am(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(r){if(r==null)return Object.values(this._mergedSourceCaches);const a=[];return this._mergedOtherSourceCaches[r]&&a.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&a.push(this._mergedSymbolSourceCaches[r]),a}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const a in r){const h=r[a];h==="reload"?this.reloadSource(a):h==="clear"&&this.clearSource(a)}}updateLayers(r){const a=this._changes.getUpdatedPaintProperties();for(const h of a){const p=this.getLayer(h);p&&p.updateTransitions(r)}}getImages(r,a,h){this.imageManager.getImages(a.icons,a.scope,h),this._updateTilesForChangedImages();const p=m=>{m&&m.setDependencies(a.tileID.key,a.type,a.icons)};p(this._otherSourceCaches[a.source]),p(this._symbolSourceCaches[a.source])}getGlyphs(r,a,h){this.glyphManager.getGlyphs(a.stacks,a.scope,h)}getResource(r,a,h){return s.d2(a,h)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const a=[];return this._otherSourceCaches[r]&&a.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&a.push(this._symbolSourceCaches[r]),a}_isSourceCacheLoaded(r){const a=this.getOwnSourceCaches(r);return a.length===0?(this.fire(new s.f(new Error(`There is no source with ID '${r}'`))),!1):a.every(h=>h.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(r,a){if(this._clipLayerIndices.length===0&&r.type!=="fill-extrusion")return!1;const h=r.type==="fill-extrusion"&&r.sourceLayer==="building";let p=0;if(r.is3D()){if(h||a&&a.type==="batched-model")return!0;r.type==="model"&&(p=s.cw.Model)}else r.type==="symbol"&&(p=s.cw.Symbol);for(const m of this._clipLayerIndices){const g=this._mergedLayers[this._mergedOrder[m]];if(!g)continue;const x=[];for(const w of g.layout.get("clip-layer-types"))x.push(w==="model"?s.cw.Model:w==="symbol"?s.cw.Symbol:s.cw.FillExtrusion);for(const w of x)if(p&w)return!0}return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}function Kh(u,r){let a=!1,h=null;const p=()=>{h=null,a&&(u(),h=setTimeout(p,r),a=!1)};return()=>(a=!0,h||p(),h)}vr.getSourceType=function(u){return bl[u]},vr.setSourceType=function(u,r){bl[u]=r},vr.registerForPluginStateChange=s.cO;class Qh{constructor(r){this._hashName=r&&encodeURIComponent(r),s.br(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Kh(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const r=this._map;if(!r)return"";const a=mu(r);if(this._hashName){const h=this._hashName;let p=!1;const m=location.hash.slice(1).split("&").map(g=>{const x=g.split("=")[0];return x===h?(p=!0,`${x}=${a}`):g}).filter(g=>g);return p||m.push(`${h}=${a}`),`#${m.join("&")}`}return`#${a}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let a;return r.split("&").map(h=>h.split("=")).forEach(h=>{h[0]===this._hashName&&(a=h)}),(a&&a[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const a=this._getCurrentHash();if(a.length>=3&&!a.some(h=>isNaN(h))){const h=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(a[3]||0):r.getBearing();return r.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:h,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function mu(u,r){const a=u.getCenter(),h=Math.round(100*u.getZoom())/100,p=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,p),g=Math.round(a.lng*m)/m,x=Math.round(a.lat*m)/m,w=u.getBearing(),T=u.getPitch();let S=r?`/${g}/${x}/${h}`:`${h}/${x}/${g}`;return(w||T)&&(S+="/"+Math.round(10*w)/10),T&&(S+=`/${Math.round(T)}`),S}const hs={linearity:.3,easing:s.d3(0,0,.3,1)},Bp=s.Q({deceleration:2500,maxSpeed:1400},hs),Fp=s.Q({deceleration:20,maxSpeed:1400},hs),Np=s.Q({deceleration:1e3,maxSpeed:360},hs),Vp=s.Q({deceleration:1e3,maxSpeed:90},hs);class ed{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.e.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,a=s.e.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const a={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(a.pan.mag()){const m=yo(a.pan.mag(),h,s.Q({},Bp,r||{}));p.offset=a.pan.mult(m.amount/a.pan.mag()),p.center=this._map.transform.center,Ul(p,m)}if(a.zoom){const m=yo(a.zoom,h,Fp);p.zoom=this._map.transform.zoom+m.amount,Ul(p,m)}if(a.bearing){const m=yo(a.bearing,h,Np);p.bearing=this._map.transform.bearing+s.au(m.amount,-179,179),Ul(p,m)}if(a.pitch){const m=yo(a.pitch,h,Vp);p.pitch=this._map.transform.pitch+m.amount,Ul(p,m)}if(p.zoom||p.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;p.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),p.noMoveStart=!0,p}}function Ul(u,r){(!u.duration||u.durationa.unproject(w)),x=m.reduce((w,T,S,I)=>w.add(T.div(I.length)),new s.P(0,0));super(r,{points:m,point:x,lngLats:g,lngLat:a.unproject(x),originalEvent:h}),this._defaultPrevented=!1}}class _u extends s.g{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a){super("wheel",{originalEvent:a}),this._defaultPrevented=!1}}class jl{constructor(r,a){this._map=r,this._clickTolerance=a.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new _u(this._map,r))}mousedown(r,a){return this._mousedownPos=a,this._firePreventable(new br(r.type,this._map,r))}mouseup(r){this._map.fire(new br(r.type,this._map,r))}preclick(r){const a=s.Q({},r);a.type="preclick",this._map.fire(new br(a.type,this._map,a))}click(r,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||(this.preclick(r),this._map.fire(new br(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new br(r.type,this._map,r))}mouseover(r){this._map.fire(new br(r.type,this._map,r))}mouseout(r){this._map.fire(new br(r.type,this._map,r))}touchstart(r){return this._firePreventable(new Ea(r.type,this._map,r))}touchmove(r){this._map.fire(new Ea(r.type,this._map,r))}touchend(r){this._map.fire(new Ea(r.type,this._map,r))}touchcancel(r){this._map.fire(new Ea(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new br(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new br("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new br(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xo{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,a){this.isEnabled()&&r.shiftKey&&r.button===0&&(Dn(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(r,a){if(!this._active)return;const h=a,p=this._startPos,m=this._lastPos;if(!p||!m||m.equals(h)||!this._box&&h.dist(p){this._box&&(this._box.style.transform=`translate(${g}px,${w}px)`,this._box.style.width=x-g+"px",this._box.style.height=T-w+"px")})}mouseupWindow(r,a){if(!this._active)return;const h=this._startPos,p=a;if(h&&r.button===0){if(this.reset(),Jr(),h.x!==p.x||h.y!==p.y)return this._map.fire(new s.g("boxzoomend",{originalEvent:r})),{cameraAnimation:m=>m.fitScreenCoordinates(h,p,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),el(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new s.g(r,{originalEvent:a}))}}function Sa(u,r){const a={};for(let h=0;hthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),h.length===this.numTouches&&(this.centroid=function(p){const m=new s.P(0,0);for(const g of p)m._add(g);return m.div(p.length)}(a),this.touches=Sa(h,a)))}touchmove(r,a,h){if(this.aborted||!this.centroid)return;const p=Sa(h,a);for(const m in this.touches){const g=p[m];(!g||g.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(r,a,h){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class qn{constructor(r){this.singleTap=new td(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,a,h){this.singleTap.touchstart(r,a,h)}touchmove(r,a,h){this.singleTap.touchmove(r,a,h)}touchend(r,a,h){const p=this.singleTap.touchend(r,a,h);if(p){const m=r.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(p)<30;if(m&&g||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class Ma{constructor(){this._zoomIn=new qn({numTouches:1,numTaps:2}),this._zoomOut=new qn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,a,h){this._zoomIn.touchstart(r,a,h),this._zoomOut.touchstart(r,a,h)}touchmove(r,a,h){this._zoomIn.touchmove(r,a,h),this._zoomOut.touchmove(r,a,h)}touchend(r,a,h){const p=this._zoomIn.touchend(r,a,h),m=this._zoomOut.touchend(r,a,h);return p?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(p)},{originalEvent:r})}):m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(m)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Gl={0:1,2:2};class Ia{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,a){return!1}_move(r,a){return{}}mousedown(r,a){if(this._lastPoint)return;const h=Rn(r);this._correctButton(r,h)&&(this._lastPoint=a,this._eventButton=h)}mousemoveWindow(r,a){const h=this._lastPoint;if(h){if(r.preventDefault(),this._eventButton!=null&&function(p,m){const g=Gl[m];return p.buttons===void 0||(p.buttons&g)!==g}(r,this._eventButton))this.reset();else if(this._moved||!(a.dist(h)0&&(this._active=!0);const p=Sa(h,a),m=new s.P(0,0),g=new s.P(0,0);let x=0;for(const T in p){const S=p[T],I=this._touches[T];I&&(m._add(S),g._add(S.sub(I)),x++,p[T]=S)}if(this._touches=p,x{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Pa{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,a,h){return{}}touchstart(r,a,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([a[0],a[1]]))}touchmove(r,a,h){const p=this._firstTwoTouches;if(!p)return;r.preventDefault();const[m,g]=p,x=vo(h,a,m),w=vo(h,a,g);if(!x||!w)return;const T=this._aroundCenter?null:x.add(w).div(2);return this._move([x,w],T,r)}touchend(r,a,h){if(!this._firstTwoTouches)return;const[p,m]=this._firstTwoTouches,g=vo(h,a,p),x=vo(h,a,m);g&&x||(this._active&&Jr(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function vo(u,r,a){for(let h=0;hMath.abs(u.x)}class od extends Pa{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,Zn(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,a,h){const p=this._lastPoints;if(!p)return;const m=r[0].sub(p[0]),g=r[1].sub(p[1]);return this._map._cooperativeGestures&&!s.d4()&&h.touches.length<3||(this._valid=this.gestureBeginsVertically(m,g,h.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+g.y)/2*-.5})}gestureBeginsVertically(r,a,h){if(this._valid!==void 0)return this._valid;const p=r.mag()>=2,m=a.mag()>=2;if(!p&&!m)return;if(!p||!m)return this._firstMove==null&&(this._firstMove=h),h-this._firstMove<100&&void 0;const g=r.y>0==a.y>0;return Zn(r)&&Zn(a)&&g}}const Up={panStep:100,bearingStep:15,pitchStep:10};class jp{constructor(){const r=Up;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let a=0,h=0,p=0,m=0,g=0;switch(r.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:r.shiftKey?h=-1:(r.preventDefault(),m=-1);break;case 39:r.shiftKey?h=1:(r.preventDefault(),m=1);break;case 38:r.shiftKey?p=1:(r.preventDefault(),g=-1);break;case 40:r.shiftKey?p=-1:(r.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(h=0,p=0),{cameraAnimation:x=>{const w=x.getZoom();x.easeTo({duration:300,easeId:"keyboardHandler",easing:Gp,zoom:a?Math.round(w)+a*(r.shiftKey?2:1):w,bearing:x.getBearing()+h*this._bearingStep,pitch:x.getPitch()+p*this._pitchStep,offset:[-m*this._panStep,-g*this._panStep],center:x.getCenter()},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Gp(u){return u*(2-u)}const ql=4.000244140625,xu=1/450;class vu{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=xu,s.br(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||s.d4()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const h=s.e.now(),p=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,a!==0&&a%ql==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(p*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const a=di(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:a,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>ql?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const I=a(),P=Math.pow(2,I),z=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):P;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(z*S))),this._type==="wheel"&&(this._startZoom=I,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:a(),p=this._startZoom,m=this._easing;let g,x=!1;if(this._type==="wheel"&&p&&m){const T=Math.min((s.e.now()-this._lastWheelEventTime)/200,1),S=m(T);g=s.a3(p,h,S),T<1?this._frameId||(this._frameId=!0):x=!0}else g=h,x=!0;this._active=!0,x&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let w=g-a();return w*this._lastDelta<0&&(w=0),{noInertia:!0,needsRenderFrame:!x,zoomDelta:w,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=s.d5;if(this._prevEase){const h=this._prevEase,p=(s.e.now()-h.start)/h.duration,m=h.easing(p+.01)-h.easing(p),g=.27/Math.sqrt(m*m+1e-4)*.01,x=Math.sqrt(.0729-g*g);a=s.d3(g,x,.25,1)}return this._prevEase={start:s.e.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Zt("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class bu{constructor(r,a){this._clickZoom=r,this._tapZoom=a}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class sd{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,a){return r.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:h.getZoom()+(r.shiftKey?-1:1),around:h.unproject(a)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ad{constructor(){this._tap=new qn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,a,h){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=a[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(r,a,h))}touchmove(r,a,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const p=a[0],m=p.y-this._swipePoint.y;return this._swipePoint=p,r.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(r,a,h)}touchend(r,a,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(r,a,h)&&(this._tapTime=r.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $p{constructor(r,a,h){this._el=r,this._mousePan=a,this._touchPan=h}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class za{constructor(r,a,h){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=a,this._mousePitch=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Da{constructor(r,a,h,p){this._el=r,this._touchZoom=a,this._touchRotate=h,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ra=u=>u.zoom||u.drag||u.pitch||u.rotate;class wr extends s.g{}class wu{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){const h=s.$.sub([],a,r);this.radius=s.$.length(h[2]<0?s.$.div([],h,this.constants):[h[0],h[1],0])}projectRay(r){s.$.div(r,r,this.constants),s.$.normalize(r,r),s.$.mul(r,r,this.constants);const a=s.$.scale([],r,this.radius);if(a[2]>0){const h=s.$.scale([],[0,0,1],s.$.dot(a,[0,0,1])),p=s.$.scale([],s.$.normalize([],[a[0],a[1],0]),this.radius),m=s.$.add([],a,s.$.scale([],s.$.sub([],s.$.add([],p,h),a),2));a[0]=m[0],a[1]=m[1]}return a}}function bo(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Zl{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ed(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new wu,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),s.br(["handleEvent","handleWindowEvent"],this);const h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,m,g]of this._listeners){const x=p===document?this.handleWindowEvent:this.handleEvent;p.addEventListener(m,x,g)}}destroy(){for(const[r,a,h]of this._listeners){const p=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(a,p,h)}}_addDefaultHandlers(r){const a=this._map,h=a.getCanvasContainer();this._add("mapEvent",new jl(a,r));const p=a.boxZoom=new xo(a,r);this._add("boxZoom",p);const m=new Ma,g=new sd;a.doubleClickZoom=new bu(g,m),this._add("tapZoom",m),this._add("clickZoom",g);const x=new ad;this._add("tapDragZoom",x);const w=a.touchPitch=new od(a);this._add("touchPitch",w);const T=new Ca(r),S=new $l(r);a.dragRotate=new za(r,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const I=new Aa(r),P=new id(a,r);a.dragPan=new $p(h,I,P),this._add("mousePan",I),this._add("touchPan",P,["touchZoom","touchRotate"]);const z=new nd,L=new rd;a.touchZoomRotate=new Da(h,L,z,x),this._add("touchRotate",z,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new gu(a));const k=a.scrollZoom=new vu(a,this);this._add("scrollZoom",k,["mousePan"]);const O=a.keyboard=new jp;this._add("keyboard",O);for(const B of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[B]&&a[B].enable(r[B])}_add(r,a,h){this._handlers.push({handlerName:r,handler:a,allowed:h}),this._handlersById[r]=a}stop(r){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ra(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,a,h){for(const p in r)if(p!==h&&(!a||a.indexOf(p)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const a=[];for(const h of r)this._el.contains(h.target)&&a.push(h);return a}handleEvent(r,a){this._updatingCamera=!0;const h=r.type==="renderFrame",p=h?void 0:r,m={needsRenderFrame:!1},g={},x={},w=r.touches?this._getMapTouches(r.touches):void 0,T=w?fi(this._el,w):h?void 0:di(this._el,r);for(const{handlerName:P,handler:z,allowed:L}of this._handlers){if(!z.isEnabled())continue;let k;this._blockedByActive(x,L,P)?z.reset():z[a||r.type]&&(k=z[a||r.type](r,T,w),this.mergeHandlerResult(m,g,k,P,p),k&&k.needsRenderFrame&&this._triggerRenderFrame()),(k||z.isActive())&&(x[P]=z)}const S={};for(const P in this._previousActiveHandlers)x[P]||(S[P]=p);this._previousActiveHandlers=x,(Object.keys(S).length||bo(m))&&(this._changes.push([m,g,S]),this._triggerRenderFrame()),(Object.keys(x).length||bo(m))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=m;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(r,a,h,p,m){if(!h)return;s.Q(r,h);const g={handlerName:p,originalEvent:h.originalEvent||m};h.zoomDelta!==void 0&&(a.zoom=g),h.panDelta!==void 0&&(a.drag=g),h.pitchDelta!==void 0&&(a.pitch=g),h.bearingDelta!==void 0&&(a.rotate=g)}_applyChanges(){const r={},a={},h={};for(const[p,m,g]of this._changes)p.panDelta&&(r.panDelta=(r.panDelta||new s.P(0,0))._add(p.panDelta)),p.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(r.around=p.around),p.aroundCoord!==void 0&&(r.aroundCoord=p.aroundCoord),p.pinchAround!==void 0&&(r.pinchAround=p.pinchAround),p.noInertia&&(r.noInertia=p.noInertia),s.Q(a,m),s.Q(h,g);this._updateMapTransform(r,a,h),this._changes=[]}_updateMapTransform(r,a,h){const p=this._map,m=p.transform,g=G=>[G.x,G.y,G.z];if((G=>{const $=this._eventsInProgress.drag;return $&&!this._handlersById[$.handlerName].isActive()})()&&!bo(r)){const G=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),G!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&p._stop(!0),!bo(r))return void this._fireEvents(a,h,!0);let{panDelta:x,zoomDelta:w,bearingDelta:T,pitchDelta:S,around:I,aroundCoord:P,pinchAround:z}=r;m._isCameraConstrained&&(w>0&&(w=0),m._isCameraConstrained=!1),z!==void 0&&(I=z),(w||(G=>a[G]&&!this._eventsInProgress[G])("drag"))&&I&&(this._dragOrigin=g(m.pointCoordinate3D(I)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",p._stop(!0),I=I||p.transform.centerPoint,T&&(m.bearing+=T),S&&(m.pitch+=S),m._updateCameraState();const L=[0,0,0];if(x)if(m.projection.name==="mercator"){const G=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(I).dir),$=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(I.sub(x)).dir);L[0]=$[0]-G[0],L[1]=$[1]-G[1]}else{const G=m.pointCoordinate(I);if(m.projection.name==="globe"){x=x.rotate(-m.angle);const $=m._pixelsPerMercatorPixel/m.worldSize;L[0]=-x.x*s.d6(s.az(G.y))*$,L[1]=-x.y*s.d6(m.center.lat)*$}else{const $=m.pointCoordinate(I.sub(x));G&&$&&(L[0]=$.x-G.x,L[1]=$.y-G.y)}}const k=m.zoom,O=[0,0,0];if(w){const G=g(P||m.pointCoordinate3D(I)),$={dir:s.$.normalize([],s.$.sub([],G,m._camera.position))};if($.dir[2]<0){const j=m.zoomDeltaToMovement(G,w);s.$.scale(O,$.dir,j)}}const B=s.$.add(L,L,O);m._translateCameraConstrained(B),w&&Math.abs(m.zoom-k)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,h,!0)}_fireEvents(r,a,h){const p=Ra(this._eventsInProgress),m=Ra(r),g={};for(const S in r){const{originalEvent:I}=r[S];this._eventsInProgress[S]||(g[`${S}start`]=I),this._eventsInProgress[S]=r[S]}!p&&m&&this._fireEvent("movestart",m.originalEvent);for(const S in g)this._fireEvent(S,g[S]);m&&this._fireEvent("move",m.originalEvent);for(const S in r){const{originalEvent:I}=r[S];this._fireEvent(S,I)}const x={};let w;for(const S in this._eventsInProgress){const{handlerName:I,originalEvent:P}=this._eventsInProgress[S];this._handlersById[I].isActive()||(delete this._eventsInProgress[S],w=a[I]||P,x[`${S}end`]=w)}for(const S in x)this._fireEvent(S,x[S]);const T=Ra(this._eventsInProgress);if(h&&(p||m)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=P=>P!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new wr("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Wl="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Tu extends s.E{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=a.respectPrefersReducedMotion!==!1,s.br(["_renderFrameCallback"],this)}getCenter(){return new s.aJ(this.transform.center.lng,this.transform.center.lat)}setCenter(r,a){return this.jumpTo({center:r},a)}panBy(r,a,h){return r=s.P.convert(r).mult(-1),this.panTo(this.transform.center,s.Q({offset:r},a),h)}panTo(r,a,h){return this.easeTo(s.Q({center:r},a),h)}getZoom(){return this.transform.zoom}setZoom(r,a){return this.jumpTo({zoom:r},a),this}zoomTo(r,a,h){return this.easeTo(s.Q({zoom:r},a),h)}zoomIn(r,a){return this.zoomTo(this.getZoom()+1,r,a),this}zoomOut(r,a){return this.zoomTo(this.getZoom()-1,r,a),this}getBearing(){return this.transform.bearing}setBearing(r,a){return this.jumpTo({bearing:r},a),this}getPadding(){return this.transform.padding}setPadding(r,a){return this.jumpTo({padding:r},a),this}rotateTo(r,a,h){return this.easeTo(s.Q({bearing:r},a),h)}resetNorth(r,a){return this.rotateTo(0,s.Q({duration:1e3},r),a),this}resetNorthPitch(r,a){return this.easeTo(s.Q({bearing:0,pitch:0,duration:1e3},r),a),this}snapToNorth(r,a){return Math.abs(this.getBearing())r.aspect?h/(2*Math.tan(.5*r.fovX)*r.aspect):p/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,a,h,p,m,g){const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=p,x.pitch=m;const T=s.aJ.convert(a),S=s.aJ.convert(h),I=.5*(T.lat+S.lat),P=.5*(T.lng+S.lng),z=s.d7(I,P),L=s.$.normalize([],z),k=s.$.normalize([],s.$.cross([],L,[0,1,0])),O=s.$.cross([],k,L),B=[k[0],k[1],k[2],0,O[0],O[1],O[2],0,L[0],L[1],L[2],0,0,0,0,1],G=[z,s.d7(T.lat,T.lng),s.d7(S.lat,T.lng),s.d7(S.lat,S.lng),s.d7(T.lat,S.lng),s.d7(I,T.lng),s.d7(I,S.lng),s.d7(T.lat,P),s.d7(S.lat,P)];let $=s.b8.fromPoints(G.map(ne=>[s.$.dot(k,ne),s.$.dot(O,ne),s.$.dot(L,ne)]));const j=s.$.transformMat4([],$.center,B);s.$.squaredLength(j)===0&&s.$.set(j,0,0,1),s.$.normalize(j,j),s.$.scale(j,j,s.cF),x.center=s.d8(j);const J=x.getWorldToCameraMatrix(),Z=s.ae.invert(new Float64Array(16),J);$=s.b8.applyTransform($,s.ae.multiply([],J,B));const W=this._extendAABB($,x,w,p);if(!W)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$=W,s.$.transformMat4(j,j,J);const ee=.5*($.max[2]-$.min[2]),ie=this._minimumAABBFrustumDistance(x,$),ue=s.$.scale([],[0,0,1],ee),re=s.$.add(ue,j,ue),Y=ie+(x.pitch===0?0:s.$.distance(j,re)),_e=x.globeCenterInViewSpace,fe=s.$.sub([],j,[_e[0],_e[1],_e[2]]);s.$.normalize(fe,fe),s.$.scale(fe,fe,Y);const se=s.$.add([],j,fe);s.$.transformMat4(se,se,Z);const Ce=s.da/s.cF,Se=s.$.length(se),he=s.ay(Math.max(Se*Ce-s.da,Number.EPSILON),0),ve=Math.min(x.zoomFromMercatorZAdjusted(he),w.maxZoom);return ve>.5*(s.b3+s.aV)?(x.setProjection({name:"mercator"}),x.zoom=ve,this._cameraForBounds(x,a,h,p,m,g)):{center:x.center,zoom:ve,bearing:p,pitch:m}}_extendAABB(r,a,h,p){const m=.5*((h.padding.left||0)+(h.padding.right||0)),g=.5*((h.padding.top||0)+(h.padding.bottom||0)),x=g,w=m,T=m,S=g,I=a.width-(w+T),P=a.height-(x+S),z=s.$.sub([],r.max,r.min),L=Math.min(I/z[0],P/z[1]),k=Math.min(a.scaleZoom(a.scale*L),h.maxZoom);if(isNaN(k))return null;const O=a.scale/a.zoomScale(k),B=new s.b8([r.min[0]-w*O,r.min[1]-S*O,r.min[2]],[r.max[0]+T*O,r.max[1]+x*O,r.max[2]]),G=(typeof h.offset.x=="number"&&typeof h.offset.y=="number"?new s.P(h.offset.x,h.offset.y):s.P.convert(h.offset)).rotate(-s.ac(p));return B.center[0]-=G.x*O,B.center[1]+=G.y*O,B}queryTerrainElevation(r,a){const h=this.transform.elevation;return h?(a=s.Q({},{exaggerated:!0},a),h.getAtPoint(s._.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,h,p,m,g){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,a,h,p,m,g);const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=p,x.pitch=m;const T=s.aJ.convert(a),S=s.aJ.convert(h),I=new s.aJ(T.lng,S.lat),P=new s.aJ(S.lng,T.lat),z=x.project(T),L=x.project(S),k=this.queryTerrainElevation(T),O=this.queryTerrainElevation(S),B=this.queryTerrainElevation(I),G=this.queryTerrainElevation(P),$=[[z.x,z.y,Math.min(k||0,O||0,B||0,G||0)],[L.x,L.y,Math.max(k||0,O||0,B||0,G||0)]];let j=s.b8.fromPoints($);const J=x.getWorldToCameraMatrix(),Z=s.ae.invert(new Float64Array(16),J);j=s.b8.applyTransform(j,J);const W=this._extendAABB(j,x,w,p);if(!W)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=W;const ee=.5*s.$.sub([],j.max,j.min)[2],ie=this._minimumAABBFrustumDistance(x,j),ue=[0,0,1,0];s.aB.transformMat4(ue,ue,J),s.aB.normalize(ue,ue);const re=s.$.scale([],ue,ie+ee),Y=s.$.add([],j.center,re);s.$.transformMat4(j.center,j.center,Z),s.$.transformMat4(Y,Y,Z);const _e=[j.center[0],j.center[1],Y[2]*x.pixelsPerMeter];s.$.scale(_e,_e,1/x.worldSize);const fe=s.d9(_e[0]),se=s.az(_e[1]),Ce=Math.min(x._zoomFromMercatorZ(_e[2]),w.maxZoom),Se=new s.aJ(fe,se);return x.mercatorFromTransition&&Ce<.5*(s.b3+s.aV)?(x.setProjection({name:"globe"}),x.zoom=Ce,this._cameraForBounds(x,a,h,p,m,g)):{center:Se,zoom:Ce,bearing:p,pitch:m}}fitBounds(r,a,h){const p=this.cameraForBounds(r,a);return this._fitInternal(p,a,h)}fitScreenCoordinates(r,a,h,p,m){const g=s.P.convert(r),x=s.P.convert(a),w=new s.P(Math.min(g.x,x.x),Math.min(g.y,x.y)),T=new s.P(Math.max(g.x,x.x),Math.max(g.y,x.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,x))return this;const S=this.transform.pointLocation3D(w),I=this.transform.pointLocation3D(T),P=this.transform.pointLocation3D(new s.P(w.x,T.y)),z=this.transform.pointLocation3D(new s.P(T.x,w.y)),L=[Math.min(S.lng,I.lng,P.lng,z.lng),Math.min(S.lat,I.lat,P.lat,z.lat)],k=[Math.max(S.lng,I.lng,P.lng,z.lng),Math.max(S.lat,I.lat,P.lat,z.lat)],O=p&&p.pitch?p.pitch:this.getPitch(),B=this._cameraForBounds(this.transform,L,k,h,O,p);return this._fitInternal(B,p,m)}_fitInternal(r,a,h){return r?(a=s.Q(r,a)).linear?this.easeTo(a,h):this.flyTo(a,h):this}jumpTo(r,a){this.stop();const h=r.preloadOnly?this.transform.clone():this.transform;let p=!1,m=!1,g=!1;if("zoom"in r&&h.zoom!==+r.zoom&&(p=!0,h.zoom=+r.zoom),r.center!==void 0&&(h.center=s.aJ.convert(r.center)),"bearing"in r&&h.bearing!==+r.bearing&&(m=!0,h.bearing=+r.bearing),"pitch"in r&&h.pitch!==+r.pitch&&(g=!0,h.pitch=+r.pitch),r.padding!=null){const x=typeof r.padding=="number"?this._extendPadding(r.padding):r.padding;h.isPaddingEqual(x)||(h.padding=x)}return r.preloadOnly?(this._preloadTiles(h),this):(this.fire(new s.g("movestart",a)).fire(new s.g("move",a)),p&&this.fire(new s.g("zoomstart",a)).fire(new s.g("zoom",a)).fire(new s.g("zoomend",a)),m&&this.fire(new s.g("rotatestart",a)).fire(new s.g("rotate",a)).fire(new s.g("rotateend",a)),g&&this.fire(new s.g("pitchstart",a)).fire(new s.g("pitch",a)).fire(new s.g("pitchend",a)),this.fire(new s.g("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(Wl),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){const h=this.transform;if(!h.projection.supportsFreeCamera)return s.w(Wl),this;this.stop();const p=h.zoom,m=h.pitch,g=h.bearing;h.setFreeCameraOptions(r);const x=p!==h.zoom,w=m!==h.pitch,T=g!==h.bearing;return this.fire(new s.g("movestart",a)).fire(new s.g("move",a)),x&&this.fire(new s.g("zoomstart",a)).fire(new s.g("zoom",a)).fire(new s.g("zoomend",a)),T&&this.fire(new s.g("rotatestart",a)).fire(new s.g("rotate",a)).fire(new s.g("rotateend",a)),w&&this.fire(new s.g("pitchstart",a)).fire(new s.g("pitch",a)).fire(new s.g("pitchend",a)),this.fire(new s.g("moveend",a)),this}easeTo(r,a){this._stop(!1,r.easeId),((r=s.Q({offset:[0,0],duration:500,easing:s.d5},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const h=this.transform,p=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?+r.zoom:p,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,S="pitch"in r?+r.pitch:g,I=this._extendPadding(r.padding),P=s.P.convert(r.offset);let z,L,k;if(h.projection.name==="globe"){const ie=s._.fromLngLat(h.center),ue=P.rotate(-h.angle);ie.x+=ue.x/h.worldSize,ie.y+=ue.y/h.worldSize;const re=ie.toLngLat(),Y=s.aJ.convert(r.center||re);this._normalizeCenter(Y),z=h.centerPoint.add(ue),L=new s.P(ie.x,ie.y).mult(h.worldSize),k=new s.P(s.ak(Y.lng),s.al(Y.lat)).mult(h.worldSize).sub(L)}else{z=h.centerPoint.add(P);const ie=h.pointLocation(z),ue=s.aJ.convert(r.center||ie);this._normalizeCenter(ue),L=h.project(ie),k=h.project(ue).sub(L)}const O=h.zoomScale(w-p);let B,G;r.around&&(B=s.aJ.convert(r.around),G=h.locationPoint(B));const $=this._zooming||w!==p,j=this._rotating||m!==T,J=this._pitching||S!==g,Z=!h.isPaddingEqual(I),W=ie=>ue=>{if($&&(ie.zoom=s.a3(p,w,ue)),j&&(ie.bearing=s.a3(m,T,ue)),J&&(ie.pitch=s.a3(g,S,ue)),Z&&(ie.interpolatePadding(x,I,ue),z=ie.centerPoint.add(P)),B)ie.setLocationAtPoint(B,G);else{const re=ie.zoomScale(ie.zoom-p),Y=w>p?Math.min(2,O):Math.max(.5,O),_e=Math.pow(Y,1-ue),fe=ie.unproject(L.add(k.mult(ue*_e)).mult(re));ie.setLocationAtPoint(ie.renderWorldCopies?fe.wrap():fe,z)}return r.preloadOnly||this._fireMoveEvents(a),ie};if(r.preloadOnly){const ie=this._emulate(W,r.duration,h);return this._preloadTiles(ie),this}const ee={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=$,this._rotating=j,this._pitching=J,this._padding=Z,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,ee),this._ease(W(h),ie=>{h.cameraElevationReference==="sea"&&h.recenterOnTerrain(),this._afterEase(a,ie)},r),this}_prepareEase(r,a,h={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),a||h.moving||this.fire(new s.g("movestart",r)),this._zooming&&!h.zooming&&this.fire(new s.g("zoomstart",r)),this._rotating&&!h.rotating&&this.fire(new s.g("rotatestart",r)),this._pitching&&!h.pitching&&this.fire(new s.g("pitchstart",r))}_fireMoveEvents(r){this.fire(new s.g("move",r)),this._zooming&&this.fire(new s.g("zoom",r)),this._rotating&&this.fire(new s.g("rotate",r)),this._pitching&&this.fire(new s.g("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const h=this._zooming,p=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new s.g("zoomend",r)),p&&this.fire(new s.g("rotateend",r)),m&&this.fire(new s.g("pitchend",r)),this.fire(new s.g("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){const ve=s.ai(r,["center","zoom","bearing","pitch","around","padding"]);return this.jumpTo(ve,a)}this.stop(),r=s.Q({offset:[0,0],speed:1.2,curve:1.42,easing:s.d5},r);const h=this.transform,p=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?s.au(+r.zoom,h.minZoom,h.maxZoom):p,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,S="pitch"in r?+r.pitch:g,I=this._extendPadding(r.padding),P=h.zoomScale(w-p),z=s.P.convert(r.offset);let L=h.centerPoint.add(z);const k=h.pointLocation(L),O=s.aJ.convert(r.center||k);this._normalizeCenter(O);const B=h.project(k),G=h.project(O).sub(B);let $=r.curve;const j=Math.max(h.width,h.height),J=j/P,Z=G.mag();if("minZoom"in r){const ve=s.au(Math.min(r.minZoom,p,w),h.minZoom,h.maxZoom),ne=j/h.zoomScale(ve-p);$=Math.sqrt(ne/Z*2)}const W=$*$;function ee(ve){const ne=(J*J-j*j+(ve?-1:1)*W*W*Z*Z)/(2*(ve?J:j)*W*Z);return Math.log(Math.sqrt(ne*ne+1)-ne)}function ie(ve){return(Math.exp(ve)-Math.exp(-ve))/2}function ue(ve){return(Math.exp(ve)+Math.exp(-ve))/2}const re=ee(0);let Y=function(ve){return ue(re)/ue(re+$*ve)},_e=function(ve){return j*((ue(re)*(ie(ne=re+$*ve)/ue(ne))-ie(re))/W)/Z;var ne},fe=(ee(1)-re)/$;if(Math.abs(Z)<1e-6||!isFinite(fe)){if(Math.abs(j-J)<1e-6)return this.easeTo(r,a);const ve=Jr.maxDuration&&(r.duration=0);const se=m!==T,Ce=S!==g,Se=!h.isPaddingEqual(I),he=ve=>ne=>{const Me=ne*fe,Ae=1/Y(Me);ve.zoom=ne===1?w:p+ve.scaleZoom(Ae),se&&(ve.bearing=s.a3(m,T,ne)),Ce&&(ve.pitch=s.a3(g,S,ne)),Se&&(ve.interpolatePadding(x,I,ne),L=ve.centerPoint.add(z));const Ue=ne===1?O:ve.unproject(B.add(G.mult(_e(Me))).mult(Ae));return ve.setLocationAtPoint(ve.renderWorldCopies?Ue.wrap():Ue,L),ve._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),ve};if(r.preloadOnly){const ve=this._emulate(he,r.duration,h);return this._preloadTiles(ve),this}return this._zooming=!0,this._rotating=se,this._pitching=Ce,this._padding=Se,this._prepareEase(a,!1),this._ease(he(h),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop(r,a){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const h=this._onEaseEnd;this._onEaseEnd=void 0,h.call(this,a)}if(!r){const h=this.handlers;h&&h.stop(!1)}return this}_ease(r,a,h){h.animate===!1||h.duration===0?(r(1),a()):(this._easeStart=s.e.now(),this._easeOptions=h,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((s.e.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){r=s.av(r,-180,180);const h=Math.abs(r-a);return Math.abs(r-360-a)180?-360:h<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&s.e.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,a,h){const p=Math.ceil(15*a/1e3),m=[],g=r(h.clone());for(let x=0;x<=p;x++){const w=g(x/p);m.push(w.clone())}return m}_preloadTiles(r,a){}}class La{constructor(r={}){this.options=r,s.br(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const a=this.options&&this.options.compact,h=r._getUIString("AttributionControl.ToggleAttribution");this._map=r,this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Zt("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",h);const p=Zt("span","mapboxgl-ctrl-icon",this._compactButton);return p.setAttribute("aria-hidden","true"),p.setAttribute("title",h),this._innerContainer=Zt("div","mapboxgl-ctrl-attrib-inner",this._container),a&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),a===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.db.ACCESS_TOKEN}];if(r){const h=a.reduce((p,m,g)=>(m.value&&(p+=`${m.key}=${m.value}${gp.length-m.length),r=r.filter((p,m)=>{for(let g=m+1;g=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const h=r.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,r.length?(this._innerContainer.innerHTML=h,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Hl{constructor(){s.br(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=Zt("div","mapboxgl-ctrl");const a=Zt("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const a in r){const h=r[a].getSource();if(h.hasOwnProperty("mapbox_logo")&&!h.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const a=r[0];this._map.getCanvasContainer().offsetWidth<250?a.classList.add("mapboxgl-compact"):a.classList.remove("mapboxgl-compact")}}}class Xl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const a=++this._id;return this._queue.push({callback:r,id:a,cancelled:!1}),a}remove(r){const a=this._currentlyRunning,h=a?this._queue.concat(a):this._queue;for(const p of h)if(p.id===r)return void(p.cancelled=!0)}run(r=0){const a=this._currentlyRunning=this._queue;this._queue=[];for(const h of a)if(!h.cancelled&&(h.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function ka(u,r,a){if(u=new s.aJ(u.lng,u.lat),r){const h=new s.aJ(u.lng-360,u.lat),p=new s.aJ(u.lng+360,u.lat),m=360*Math.ceil(Math.abs(u.lng-a.center.lng)/360),g=a.locationPoint(u).distSqr(r),x=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(h).distSqr(r)180;){const h=a.locationPoint(u);if(h.x>=0&&h.y>=0&&h.x<=a.width&&h.y<=a.height)break;u.lng>a.center.lng?u.lng-=360:u.lng+=360}return u}const Yl={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Jl extends s.E{constructor(r,a){if(super(),(r instanceof HTMLElement||a)&&(r=s.Q({element:r},a)),s.br(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=s.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=Zt("div");const m=41,g=27,x=Di("svg",{display:"block",height:m*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${m}`},this._element),w=Di("radialGradient",{id:"shadowGradient"},Di("defs",{},x));Di("stop",{offset:"10%","stop-opacity":.4},w),Di("stop",{offset:"100%","stop-opacity":.05},w),Di("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},x),Di("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},x),Di("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},x),Di("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},x),this._offset=s.P.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",m=>{m.preventDefault()}),this._element.addEventListener("mousedown",m=>{m.preventDefault()});const h=this._element.classList;for(const m in Yl)h.remove(`mapboxgl-marker-anchor-${m}`);h.add(`mapboxgl-marker-anchor-${this._anchor}`);const p=r&&r.className?r.className.trim().split(/\s+/):[];h.add(...p),this._popup=null}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=s.aJ.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const p=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(r){const a=r.code,h=r.charCode||r.keyCode;a!=="Space"&&a!=="Enter"&&h!==32&&h!==13||this.togglePopup()}_onMapClick(r){const a=r.originalEvent.target,h=this._element;this._popup&&(a===h||h.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,a=this._pos;if(!r||!a)return!1;const h=r.unproject(a),p=r.getFreeCameraOptions();if(!p.position)return!1;const m=p.position.toLngLat();return m.distanceTo(h)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();const h=r.unproject(a);let p;r._showingGlobe()&&s.dc(r.transform,this._lngLat)?p=0:(p=1-r._queryFogOpacity(h),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(p*=this._occludedOpacity)),this._element.style.opacity=`${p}`,this._element.style.pointerEvents=p>0?"auto":"none",this._popup&&this._popup._setOpacity(p),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const a=this._offset.mult(this._scale);this._element.style.transform=` - translate(${r.x}px,${r.y}px) - ${Yl[this._anchor]} - ${this._calculateXYTransform()} ${this._calculateZTransform()} - translate(${a.x}px,${a.y}px) - `}_calculateXYTransform(){const r=this._pos,a=this._map,h=this.getPitchAlignment();if(!a||!r||h!=="map")return"";if(!a._showingGlobe()){const w=a.getPitch();return w?`rotateX(${w}deg)`:""}const p=s.b1(s.dd(a.transform,this._lngLat)),m=r.sub(s.de(a.transform)),g=Math.abs(m.x)+Math.abs(m.y);if(g===0)return"";const x=p/g;return`rotateX(${-m.y*x}deg) rotateY(${m.x*x}deg)`}_calculateZTransform(){const r=this._pos,a=this._map;if(!a||!r)return"";let h=0;const p=this.getRotationAlignment();if(p==="map")if(a._showingGlobe()){const m=a.project(new s.aJ(this._lngLat.lng,this._lngLat.lat+.001)),g=a.project(new s.aJ(this._lngLat.lng,this._lngLat.lat-.001)).sub(m);h=s.b1(Math.atan2(g.y,g.x))-90}else h=-a.getBearing();else if(p==="horizon"){const m=s.a0(4,6,a.getZoom()),g=s.de(a.transform);g.y+=m*a.transform.height;const x=r.sub(g),w=s.b1(Math.atan2(x.y,x.x));h=(w>90?w-270:w+90)*(1-m)}return h+=this._rotation,h?`rotateZ(${h}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const a=this._map;a&&(a.transform.renderWorldCopies&&(this._lngLat=ka(this._lngLat,this._pos,a.transform)),this._pos=a.project(this._lngLat),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),a._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(a._showingGlobe()||a.getTerrain()||a.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=s.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const a=this._map;if(!a)return;const h=this._pointerdownPos,p=this._positionDelta;if(h&&p){if(!this._isDragging){const m=this._clickTolerance||a._clickTolerance;if(r.point.dist(h)=this._endTime)return this._end;const a=s.bb((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,a,h){this._start=this.getValue(a),this._end=r,this._startTime=a,this._endTime=a+h}}const Wp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Hp{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}const Xp={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0},Eu={showCompass:!0,showZoom:!0,visualizePitch:!1};class Su{constructor(r,a,h=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new Ca({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,h&&(this.mousePitch=new $l({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),s.br(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(r,a){this.mouseRotate.mousedown(r,a),this.mousePitch&&this.mousePitch.mousedown(r,a),Dn()}move(r,a){const h=this.map,p=this.mouseRotate.mousemoveWindow(r,a),m=p&&p.bearingDelta;if(m&&h.setBearing(h.getBearing()+m),this.mousePitch){const g=this.mousePitch.mousemoveWindow(r,a),x=g&&g.pitchDelta;x&&h.setPitch(h.getPitch()+x)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart,{passive:!1}),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){el(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(s.Q({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),di(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,di(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=fi(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=fi(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(u.antialias&&s.dh(window)&&(u.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Qs(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies),u),this._repaint=!!u.repaint,this._interactive=u.interactive,this._minTileCacheSize=u.minTileCacheSize,this._maxTileCacheSize=u.maxTileCacheSize,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=u.crossSourceCollisions,this._collectResourceTiming=u.collectResourceTiming,this._language=this._parseLanguage(u.language),this._worldview=u.worldview,this._renderTaskQueue=new Xl,this._domRenderTaskQueue=new Xl,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.di(),this._locale=s.Q({},Wp,u.locale),this._clickTolerance=u.clickTolerance,this._cooperativeGestures=u.cooperativeGestures,this._performanceMetricsCollection=u.performanceMetricsCollection,this._tessellationStep=u.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=u.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Zp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._requestManager=new s.dj(u.transformRequest,u.accessToken,u.testMode),this._silenceAuthErrors=!!u.testMode,this._contextCreateOptions=u.contextCreateOptions?{...u.contextCreateOptions}:{},typeof u.container=="string"){const a=document.getElementById(u.container);if(!a)throw new Error(`Container '${u.container.toString()}' not found.`);this._container=a}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),u.maxBounds&&this.setMaxBounds(u.maxBounds),s.br(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Hp),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Zl(this,u),this._localFontFamily=u.localFontFamily,this._localIdeographFontFamily=u.localIdeographFontFamily,(u.style||!u.testMode)&&this.setStyle(u.style||s.db.DEFAULT_STYLE,{config:u.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),u.projection&&this.setProjection(u.projection),u.hash&&(this._hash=new Qh(typeof u.hash=="string"&&u.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch});const a=u.bounds;a&&(this.resize(),this.fitBounds(a,s.Q({},u.fitBoundsOptions,{duration:0})))}this.resize(),u.attributionControl&&this.addControl(new La({customAttribution:u.customAttribution})),this._logoControl=new Hl,this.addControl(this._logoControl,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new s.g(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new s.g(`${a.dataType}dataloading`,a))})}_getMapId(){return this._mapId}addControl(u,r){if(r===void 0&&(r=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new s.f(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=u.onAdd(this);this._controls.push(u);const h=this._controlPositions[r];return r.indexOf("bottom")!==-1?h.insertBefore(a,h.firstChild):h.appendChild(a),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new s.f(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(u);return r>-1&&this._controls.splice(r,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(u){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const r=!this._moving;return r&&this.fire(new s.g("movestart",u)).fire(new s.g("move",u)),this.fire(new s.g("resize",u)),r&&this.fire(new s.g("moveend",u)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(u){return this.transform.setMaxBounds(s.aj.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u?this.setZoom(u):this.fire(new s.g("zoomstart")).fire(new s.g("zoom")).fire(new s.g("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u?this.setPitch(u):this.fire(new s.g("pitchstart")).fire(new s.g("pitch")).fire(new s.g("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(u){return u==="auto"?navigator.language:Array.isArray(u)?u.length===0?void 0:u.map(r=>r==="auto"?navigator.language:r):u}setLanguage(u){const r=this._parseLanguage(u);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const a of this._controls)a._setLanguage&&a._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(u){return this.style&&u!==this._worldview?(this._worldview=u,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(u){return this._lazyInitEmptyStyle(),u?typeof u=="string"&&(u={name:u}):u=null,this._useExplicitProjection=!!u,this._prioritizeAndUpdateProjection(u,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const u=this.transform,r=u.projection.name;let a;r==="globe"&&u.zoom>=s.aV?(u.setMercatorFromTransition(),a=!0):r==="mercator"&&u.zoom=s.aV?this.transform.setMercatorFromTransition():this.transform.setProjection(u),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(u){return this.transform.locationPoint3D(s.aJ.convert(u))}unproject(u){return this.transform.pointLocation3D(s.P.convert(u))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(u,r,a){if(u==="mouseenter"||u==="mouseover"){let h=!1;const p=g=>{const x=r.filter(T=>this.getLayer(T)),w=x.length?this.queryRenderedFeatures(g.point,{layers:x}):[];w.length?h||(h=!0,a.call(this,new br(u,this,g.originalEvent,{features:w}))):h=!1},m=()=>{h=!1};return{layers:new Set(r),listener:a,delegates:{mousemove:p,mouseout:m}}}if(u==="mouseleave"||u==="mouseout"){let h=!1;const p=g=>{const x=r.filter(w=>this.getLayer(w));(x.length?this.queryRenderedFeatures(g.point,{layers:x}):[]).length?h=!0:h&&(h=!1,a.call(this,new br(u,this,g.originalEvent)))},m=g=>{h&&(h=!1,a.call(this,new br(u,this,g.originalEvent)))};return{layers:new Set(r),listener:a,delegates:{mousemove:p,mouseout:m}}}{const h=p=>{const m=r.filter(x=>this.getLayer(x)),g=m.length?this.queryRenderedFeatures(p.point,{layers:m}):[];g.length&&(p.features=g,a.call(this,p),delete p.features)};return{layers:new Set(r),listener:a,delegates:{[u]:h}}}}on(u,r,a){if(typeof r=="function"||a===void 0)return super.on(u,r);if(Array.isArray(r)||(r=[r]),r){for(const p of r)if(!this._isValidId(p))return this}const h=this._createDelegatedListener(u,r,a);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(h);for(const p in h.delegates)this.on(p,h.delegates[p]);return this}once(u,r,a){if(typeof r=="function"||a===void 0)return super.once(u,r);if(Array.isArray(r)||(r=[r]),r){for(const p of r)if(!this._isValidId(p))return this}const h=this._createDelegatedListener(u,r,a);for(const p in h.delegates)this.once(p,h.delegates[p]);return this}off(u,r,a){if(typeof r=="function"||a===void 0)return super.off(u,r);const h=new Set(Array.isArray(r)?r:[r]);for(const g of h)if(!this._isValidId(g))return this;const p=(g,x)=>{if(g.size!==x.size)return!1;for(const w of g)if(!x.has(w))return!1;return!0},m=this._delegatedListeners?this._delegatedListeners[u]:void 0;return m&&(g=>{for(let x=0;x{a?(s.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(u,r)):h&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(u,r))}_getUIString(u){const r=this._locale[u];if(r==null)throw new Error(`Missing UI string '${u}'`);return r}_updateStyle(u,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),u){const a=s.Q({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new vr(this,a).load(u),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new vr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(u){return u==null?(this.fire(new s.f(new Error("IDs can't be empty."))),!1):!s.cY(u)||(this.fire(new s.f(new Error(`IDs can't contain special symbols: "${u}".`))),!1)}addSource(u,r){return this._isValidId(u)?(this._lazyInitEmptyStyle(),this.style.addSource(u,r),this._update(!0)):this}isSourceLoaded(u){return!!this._isValidId(u)&&!!this.style&&this.style._isSourceCacheLoaded(u)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(u,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(u,r,a)}removeSource(u){return this._isValidId(u)?(this.style.removeSource(u),this._updateTerrain(),this._update(!0)):this}getSource(u){return this._isValidId(u)?this.style.getOwnSource(u):null}addImage(u,r,{pixelRatio:a=1,sdf:h=!1,stretchX:p,stretchY:m,content:g}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:x,height:w,data:T}=s.e.getImageData(r);this.style.addImage(u,{data:new s.j({width:x,height:w},T),pixelRatio:a,stretchX:p,stretchY:m,content:g,sdf:h,version:0})}else if(r.width===void 0||r.height===void 0)this.fire(new s.f(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:w}=r,T=r;this.style.addImage(u,{data:new s.j({width:x,height:w},new Uint8Array(T.data)),pixelRatio:a,stretchX:p,stretchY:m,content:g,sdf:h,version:0,userImage:T}),T.onAdd&&T.onAdd(this,u)}}updateImage(u,r){this._lazyInitEmptyStyle();const a=this.style.getImage(u);if(!a)return void this.fire(new s.f(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?s.e.getImageData(r):r,{width:p,height:m,data:g}=h;if(p===void 0||m===void 0)return void this.fire(new s.f(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==a.data.width||m!==a.data.height)return void this.fire(new s.f(new Error(`The width and height of the updated image (${p}, ${m}) - must be that same as the previous version of the image - (${a.data.width}, ${a.data.height})`)));const x=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(g,x),this.style.updateImage(u,a)}hasImage(u){return u?!!this.style&&!!this.style.getImage(u):(this.fire(new s.f(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u,r){s.i(this._requestManager.transformRequest(u,s.R.Image),(a,h)=>{r(a,h instanceof HTMLImageElement?s.e.getImageData(h):h)})}listImages(){return this.style.listImages()}addModel(u,r){this._lazyInitEmptyStyle(),this.style.addModel(u,r)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new s.f(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,r){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,r),this._update(!0)):this}getSlot(u){const r=this.getLayer(u);return r&&r.slot||null}setSlot(u,r){return this.style.setSlot(u,r),this.style.mergeLayers(),this._update(!0)}addImport(u,r){return this.style.addImport(u,r),this}updateImport(u,r){return typeof r!="string"&&r.id!==u?(this.removeImport(u),this.addImport(r)):(this.style.updateImport(u,r),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,r){return this.style.moveImport(u,r),this._update(!0)}moveLayer(u,r){return this._isValidId(u)?(this.style.moveLayer(u,r),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const r=this.style.getOwnLayer(u);return r?r.type==="custom"?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,r,a){return this._isValidId(u)?(this.style.setLayerZoomRange(u,r,a),this._update(!0)):this}setFilter(u,r,a={}){return this._isValidId(u)?(this.style.setFilter(u,r,a),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setPaintProperty(u,r,a,h),this._update(!0)):this}getPaintProperty(u,r){return this._isValidId(u)?this.style.getPaintProperty(u,r):null}setLayoutProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,r,a,h),this._update(!0)):this}getLayoutProperty(u,r){return this._isValidId(u)?this.style.getLayoutProperty(u,r):null}getSchema(u){return this.style.getSchema(u)}setSchema(u,r){return this.style.setSchema(u,r),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,r){return this.style.setConfig(u,r),this._update(!0)}getConfigProperty(u,r){return this.style.getConfigProperty(u,r)}setConfigProperty(u,r,a){return this.style.setConfigProperty(u,r,a),this._update(!0)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const r=u[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:u}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(u){return this._lazyInitEmptyStyle(),!u&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(u),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(u){return this._lazyInitEmptyStyle(),this.style.setFog(u),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(u){return this._lazyInitEmptyStyle(),this.style.setColorTheme(u),this._update(!0)}setCamera(u){return this.style.setCamera(u),this._triggerCameraUpdate(u)}_triggerCameraUpdate(u){return this._update(this.transform.setOrthographicProjectionAtLowPitch(u["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(u){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aJ.convert(u),this.transform):0}setFeatureState(u,r){return this._isValidId(u.source)?(this.style.setFeatureState(u,r),this._update()):this}removeFeatureState(u,r){return this._isValidId(u.source)?(this.style.removeFeatureState(u,r),this._update()):this}getFeatureState(u){return this._isValidId(u.source)?this.style.getFeatureState(u):null}_updateContainerDimensions(){if(!this._container)return;const u=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let a,h,p,m=this._container;for(;m&&(!h||!p);){const g=window.getComputedStyle(m).transform;g&&g!=="none"&&(a=g.match(/matrix.*\((.+)\)/)[1].split(", "),a[0]&&a[0]!=="0"&&a[0]!=="1"&&(h=a[0]),a[3]&&a[3]!=="0"&&a[3]!=="1"&&(p=a[3])),m=m.parentElement}this._containerWidth=h?Math.abs(u/h):u,this._containerHeight=p?Math.abs(r/p):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const u=this._container;u.classList.add("mapboxgl-map"),(this._missingCSSCanary=Zt("div","mapboxgl-canary",u)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=Zt("div","mapboxgl-canvas-container",u);this._canvas=Zt("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const a=this._controlContainer=Zt("div","mapboxgl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{h[p]=Zt("div",`mapboxgl-ctrl-${p}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,r){const a=s.e.devicePixelRatio||1;this._canvas.width=a*Math.ceil(u),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${r}px`}_addMarker(u){this._markers.push(u)}_removeMarker(u){const r=this._markers.indexOf(u);r!==-1&&this._markers.splice(r,1)}_addPopup(u){this._popups.push(u)}_removePopup(u){const r=this._popups.indexOf(u);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const u=s.Q({},pr.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",u);r?(s.dk(r,!0),this.painter=new lu(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",a=>{a.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.dl.testSupport(r)):this.fire(new s.f(new Error("Failed to initialize WebGL")))}_contextLost(u){u.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.g("webglcontextlost",{originalEvent:u}))}_contextRestored(u){this._setupPainter(),this.resize(),this._update(),this.fire(new s.g("webglcontextrestored",{originalEvent:u}))}_onMapScroll(u){if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(u){return this.style?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_requestDomTask(u){!this.loaded()||this.loaded()&&!this.isMoving()?u():this._domRenderTaskQueue.add(u)}_render(u){let r;this.fire(new s.g("renderstart")),++this._frameId;const a=this.painter.context.extTimerQuery,h=s.e.now(),p=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=p.createQuery(),p.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(u),this._domRenderTaskQueue.run(u),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,I=s.e.now(),P=new s.Y(T,{now:I,fadeDuration:m,pitch:S,transition:this.style.transition});this.style.update(P)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(h),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(h);const x=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource);if(x&&(this._placementDirty=x.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.g("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.df.mark(s.dg.load),this.fire(new s.g("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const T=s.e.now()-h;p.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{const S=p.getQueryParameter(r,p.QUERY_RESULT)/1e6;p.deleteQuery(r),this.fire(new s.g("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new s.g("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new s.g("gpu-timing-deferred-render",{gpuTime:S}))},50)}const w=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(w||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(g=this._updateAverageElevation(h,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new s.g("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new s.g("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||w||(this._fullyLoaded=!0,s.df.mark(s.dg.fullLoad),this._performanceMetricsCollection&&s.dm(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(u){for(const r of this._markers)u&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!u||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(u,r=!1){const a=p=>(this.transform.averageElevation=p,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&a(0);const h=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(h||(r||u-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(u)){const p=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=u;const g=Math.abs(p-m);if(g>1){if(this._isInitialLoad||h)return this._averageElevation.jumpTo(m),a(m);this._averageElevation.easeTo(m,u,300)}else if(g>1e-4)return this._averageElevation.jumpTo(m),a(m)}return!!this._averageElevation.isEasing(u)&&a(this._averageElevation.getValue(u))}_authenticate(){s.dn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,u=>{if(u&&(u.message===s.dp||u.status===401)){const r=this.painter.context.gl;s.dk(r,!1),this._logoControl instanceof Hl&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.f(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),s.dq(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&s.dr(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const u=this._isDragging();this.painter.updateTerrain(this.style,u)}_calculateSpeedIndex(){const u=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const a=this.painter.context.gl,h=a.createFramebuffer();function p(m){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,m,0);const g=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,g),g}return a.bindFramebuffer(a.FRAMEBUFFER,h),this._canvasPixelComparison(p(u),r.canvasCopies.map(p),r.timeStamps)}_canvasPixelComparison(u,r,a){let h=a[1]-a[0];const p=u.length/4;for(let m=0;m{const a=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,a&&this._render(r)}))}_preloadTiles(u){const r=this.style?this.style.getSourceCaches():[];return s.dv(r,(a,h)=>a._preloadTiles(u,h),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(u){this._trackResize&&this.resize({originalEvent:u})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(u){this._showParseStatus!==u&&(this._showParseStatus=u,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(u){this._showTerrainWireframe!==u&&(this._showTerrainWireframe=u,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(u){this._showLayers2DWireframe!==u&&(this._showLayers2DWireframe=u,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(u){this._showLayers3DWireframe!==u&&(this._showLayers3DWireframe=u,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(u){this._speedIndexTiming!==u&&(this._speedIndexTiming=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,this._tp.refreshUI(),u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(u){this._showTileAABBs!==u&&(this._showTileAABBs=u,this._tp.refreshUI(),u&&this._update())}_setCacheLimits(u,r){s.dx(u,r)}get version(){return s.dw}},NavigationControl:class{constructor(u={}){this.options=s.Q({},Eu,u),this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(s.br(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),Zt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),Zt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.br(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const a=this._map;a&&(this.options.visualizePitch?a.resetNorthPitch({},{originalEvent:r}):a.resetNorth({},{originalEvent:r}))}),this._compassIcon=Zt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const u=this._map;if(!u)return;const r=u.getZoom(),a=r===u.getMaxZoom(),h=r===u.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())}_rotateCompassArrow(){const u=this._map;if(!u)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(u.transform.pitch*(Math.PI/180)),.5)}) rotateX(${u.transform.pitch}deg) rotateZ(${u.transform.angle*(180/Math.PI)}deg)`:`rotate(${u.transform.angle*(180/Math.PI)}deg)`;u._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),u.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&u.on("pitch",this._rotateCompassArrow),u.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Su(u,this._compass,this.options.visualizePitch)),this._container}onRemove(){const u=this._map;u&&(this._container.remove(),this.options.showZoom&&u.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&u.off("pitch",this._rotateCompassArrow),u.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(u,r){const a=Zt("button",u,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(u,r){if(!this._map)return;const a=this._map._getUIString(`NavigationControl.${r}`);u.setAttribute("aria-label",a),u.firstElementChild&&u.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends s.E{constructor(u={}){super();const r=navigator.geolocation;this.options=s.Q({geolocation:r},cd,u),s.br(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Kh(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(u){return this._map=u,this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(u){const r=(a=!!this.options.geolocation)=>{this._supportsGeolocation=a,u(a)};this._supportsGeolocation!==void 0?u(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(a=>r(a.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(u){const r=this._map.getMaxBounds(),a=u.coords;return!!r&&(a.longituder.getEast()||a.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(u){if(this._map){if(this._isOutOfMapMaxBounds(u))return this._setErrorState(),this.fire(new s.g("outofmaxbounds",u)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=u,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(u),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(u),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.g("geolocate",u)),this._finish()}}_updateCamera(u){const r=new s.aJ(u.coords.longitude,u.coords.latitude),a=u.coords.accuracy,h=this._map.getBearing(),p=s.Q({bearing:h},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),p,{geolocateSource:!0})}_updateMarker(u){if(u){const r=new s.aJ(u.coords.longitude,u.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=u.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const u=this._map.transform,r=s.ay(1,u._center.lat)*u.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(u){if(this._map){if(this.options.trackUserLocation)if(u.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(u.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.g("error",u)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(u){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=Zt("button","mapboxgl-ctrl-geolocate",this._container),Zt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",u===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Zt("div","mapboxgl-user-location"),this._dotElement.appendChild(Zt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Zt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Jl({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Zt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Jl({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.g("trackuserlocationend")))})}}_onDeviceOrientation(u){this._userLocationDotMarker&&(u.webkitCompassHeading?this._heading=u.webkitCompassHeading:u.absolute===!0&&(this._heading=-1*u.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.g("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.g("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.g("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(u={maximumAge:6e5,timeout:0},this._noTimeout=!0):(u=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,u),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const u=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&u()}).catch(console.error):u()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:La,ScaleControl:class{constructor(u={}){this.options=s.Q({},fs,u),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.br(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const u=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,h=r._containerWidth/2-u/2,p=r.unproject([h,a]),m=r.unproject([h+u,a]),g=p.distanceTo(m);if(this.options.unit==="imperial"){const x=3.2808*g;x>5280?this._setScale(u,x/5280,"mile"):this._setScale(u,x,"foot")}else this.options.unit==="nautical"?this._setScale(u,g/1852,"nautical-mile"):g>=1e3?this._setScale(u,g/1e3,"kilometer"):this._setScale(u,g,"meter")}_setScale(u,r,a){this._map._requestDomTask(()=>{const h=function(m){const g=Math.pow(10,`${Math.floor(m)}`.length-1);let x=m/g;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(w){const T=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*T)/T}(x),g*x}(r),p=h/r;this._container.innerHTML=this._isNumberFormatSupported&&a!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(h):`${h} ${ud[a]}`,this._container.style.width=u*p+"px"})}onAdd(u){return this._map=u,this._language=u.getLanguage(),this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",u.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(u){this._language=u,this._update()}setUnit(u){this.options.unit=u,this._update()}},FullscreenControl:class{constructor(u={}){this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:s.w("Full screen control 'container' must be a DOM element.")),s.br(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const u=this._fullscreenButton=Zt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Zt("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",u)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends s.E{constructor(u){super(),this.options=s.Q(Object.create(ps),u),s.br(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(u&&u.className?u.className.trim().split(/\s+/):[])}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&u.on("preclick",this._onClose),this.options.closeOnMove&&u.on("move",this._onClose),u.on("remove",this.remove),this._update(),u._addPopup(this),this._focusFirstElement(),this._trackPointer?(u.on("mousemove",this._onMouseEvent),u.on("mouseup",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")):u.on("move",this._update),this.fire(new s.g("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const u=this._map;return u&&(u.off("move",this._update),u.off("move",this._onClose),u.off("preclick",this._onClose),u.off("click",this._onClose),u.off("remove",this.remove),u.off("mousemove",this._onMouseEvent),u.off("mouseup",this._onMouseEvent),u.off("drag",this._onMouseEvent),u._canvasContainer&&u._canvasContainer.classList.remove("mapboxgl-track-pointer"),u._removePopup(this),this._map=void 0),this.fire(new s.g("close")),this}getLngLat(){return this._lngLat}setLngLat(u){this._lngLat=s.aJ.convert(u),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const u=this._map;return u&&(u.off("move",this._update),u.on("mousemove",this._onMouseEvent),u.on("drag",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const r=document.createDocumentFragment(),a=document.createElement("body");let h;for(a.innerHTML=u;h=a.firstChild,h;)r.appendChild(h);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=Zt("div","mapboxgl-popup-content",this._container||void 0);if(r.appendChild(u),this.options.closeButton){const a=this._closeButton=Zt("button","mapboxgl-popup-close-button",r);a.type="button",a.setAttribute("aria-label","Close popup"),a.setAttribute("aria-hidden","true"),a.innerHTML="×",a.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(u){return this._classList.add(u),this._updateClassList(),this}removeClassName(u){return this._classList.delete(u),this._updateClassList(),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){let r;return this._classList.delete(u)?r=!1:(this._classList.add(u),r=!0),this._updateClassList(),r}_onMouseEvent(u){this._update(u.point)}_getAnchor(u){if(this.options.anchor)return this.options.anchor;const r=this._map,a=this._container,h=this._pos;if(!r||!a||!h)return"bottom";const p=a.offsetWidth,m=a.offsetHeight,g=h.x

r.transform.width-p/2;if(h.y+ur.transform.height-m){if(g)return"bottom-left";if(x)return"bottom-right"}return g?"left":x?"right":"bottom"}_updateClassList(){const u=this._container;if(!u)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),u.className=r.join(" ")}_update(u){const r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let h=this._container;if(h||(h=this._container=Zt("div","mapboxgl-popup",r.getContainer()),this._tip=Zt("div","mapboxgl-popup-tip",h),h.appendChild(a)),this.options.maxWidth&&h.style.maxWidth!==this.options.maxWidth&&(h.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ka(this._lngLat,this._pos,r.transform)),!this._trackPointer||u){const p=this._pos=this._trackPointer&&u instanceof s.P?u:r.project(this._lngLat),m=ld(this.options.offset),g=this._anchor=this._getAnchor(m.y),x=ld(this.options.offset,g),w=p.add(x).round();r._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${Yl[g]} translate(${w.x}px,${w.y}px)`)})}if(!this._marker&&r._showingGlobe()){const p=s.dc(r.transform,this._lngLat)?0:1;this._setOpacity(p)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(qp);u&&u.focus()}_onClose(){this.remove()}_setOpacity(u){this._container&&(this._container.style.opacity=`${u}`),this._content&&(this._content.style.pointerEvents=u?"auto":"none")}},Marker:Jl,Style:vr,LngLat:s.aJ,LngLatBounds:s.aj,Point:s.P,MercatorCoordinate:s._,FreeCameraOptions:bh,Evented:s.E,config:s.db,prewarm:s.dA,clearPrewarmedResources:s.dB,get accessToken(){return s.db.ACCESS_TOKEN},set accessToken(u){s.db.ACCESS_TOKEN=u},get baseApiUrl(){return s.db.API_URL},set baseApiUrl(u){s.db.API_URL=u},get workerCount(){return s.dC.workerCount},set workerCount(u){s.dC.workerCount=u},get maxParallelImageRequests(){return s.db.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(u){s.db.MAX_PARALLEL_IMAGE_REQUESTS=u},clearStorage(u){s.dD(u)},get workerUrl(){return s.dE.workerUrl},set workerUrl(u){s.dE.workerUrl=u},get workerClass(){return s.dE.workerClass},set workerClass(u){s.dE.workerClass=u},get workerParams(){return s.dE.workerParams},set workerParams(u){s.dE.workerParams=u},get dracoUrl(){return s.dF()},set dracoUrl(u){s.dG(u)},get meshoptUrl(){return s.dH()},set meshoptUrl(u){s.dI(u)},setNow:s.e.setNow,restoreNow:s.e.restoreNow}});var Q0=ks;return Q0})})(Y0);var K0=Y0.exports;const Ib=Eb(K0),Cb=Mb({__proto__:null,default:Ib},[K0]);export{Cb as m}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js deleted file mode 100644 index 905baa3..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js +++ /dev/null @@ -1,580 +0,0 @@ -import{g as Kd,c as Yd}from"./index-b9vwykds.js";function Jd(sa,Sl){for(var Rr=0;RrBi[Br]})}}}return Object.freeze(Object.defineProperty(sa,Symbol.toStringTag,{value:"Module"}))}var ru={exports:{}};/** - * MapLibre GL JS - * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.2/LICENSE.txt - */(function(sa,Sl){(function(Rr,Bi){sa.exports=Bi()})(Yd,function(){var Rr={},Bi={};function Br(k,p,Ei){if(Bi[k]=Ei,k==="index"){var Xi="var sharedModule = {}; ("+Bi.shared+")(sharedModule); ("+Bi.worker+")(sharedModule);",Yt={};return Bi.shared(Yt),Bi.index(Rr,Yt),typeof window<"u"&&Rr.setWorkerUrl(window.URL.createObjectURL(new Blob([Xi],{type:"text/javascript"}))),Rr}}Br("shared",["exports"],function(k){function p(i,e,r,n){return new(r||(r=Promise))(function(l,u){function d(x){try{_(n.next(x))}catch(b){u(b)}}function f(x){try{_(n.throw(x))}catch(b){u(b)}}function _(x){var b;x.done?l(x.value):(b=x.value,b instanceof r?b:new r(function(w){w(b)})).then(d,f)}_((n=n.apply(i,e||[])).next())})}function Ei(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Xi=Yt;function Yt(i,e){this.x=i,this.y=e}Yt.prototype={clone:function(){return new Yt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,e){var r=Math.cos(i),n=Math.sin(i),l=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yt.convert=function(i){return i instanceof Yt?i:Array.isArray(i)?new Yt(i[0],i[1]):i};var xe=Ei(Xi),re=Fr;function Fr(i,e,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}Fr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var xr=Ei(re);let Ki,vr;function cr(){return Ki==null&&(Ki=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ki}function qs(){if(vr==null&&(vr=!1,cr())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let n=0;n<5*5;n++){const l=4*n;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(n%5,Math.floor(n/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!=3&&r[n]!==n){vr=!0;break}}}return vr||!1}function _i(i,e,r,n){const l=new xr(i,e,r,n);return function(u){return l.solve(u)}}const Ut=_i(.25,.1,.25,1);function Yi(i,e,r){return Math.min(r,Math.max(e,i))}function Or(i,e,r){const n=r-e,l=((i-e)%n+n)%n+e;return l===e?r:l}function Mi(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}let Vr=1;function br(i,e,r){const n={};for(const l in i)n[l]=e.call(r||this,i[l],l,i);return n}function yn(i,e,r){const n={};for(const l in i)e.call(r||this,i[l],l,i)&&(n[l]=i[l]);return n}function si(i){return Array.isArray(i)?i.map(si):typeof i=="object"&&i?br(i,si):i}const xt={};function qt(i){xt[i]||(typeof console<"u"&&console.warn(i),xt[i]=!0)}function Fi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ur(i){let e=0;for(let r,n,l=0,u=i.length,d=u-1;l"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(n*l*4);if(yield u.copyTo(_,function(x,b,w,A,P){const M=4*Math.max(-b,0),L=(Math.max(0,w)-w)*A*4+M,V=4*A,$=Math.max(0,b),Y=Math.max(0,w);return{rect:{x:$,y:Y,width:Math.min(x.width,b+A)-$,height:Math.min(x.height,w+P)-Y},layout:[{offset:L,stride:V}]}}(i,e,r,n,l)),f)for(let x=0;x<_.length;x+=4){const b=_[x];_[x]=_[x+2],_[x+2]=b}return _}finally{u.close()}})}let ni,ai;const Nr="AbortError";function Qi(){return new Error(Nr)}const $r={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ur(i){return $r.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const Oi="global-dispatcher";class Vi extends Error{constructor(e,r,n,l){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=l}}const ps=()=>hr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Tr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const n=ur(i.url);if(n)return n(i,e);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:i,targetMapId:Oi},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ps())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(n,l){return p(this,void 0,void 0,function*(){const u=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:ps(),signal:l.signal});n.type==="json"&&u.headers.set("Accept","application/json");const d=yield fetch(u);if(!d.ok){const x=yield d.blob();throw new Vi(d.status,d.statusText,n.url,x)}let f;f=n.type==="arrayBuffer"||n.type==="image"?d.arrayBuffer():n.type==="json"?d.json():d.text();const _=yield f;if(l.signal.aborted)throw Qi();return{data:_,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,e);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:i,mustQueue:!0,targetMapId:Oi},e)}var r;return function(n,l){return new Promise((u,d)=>{const f=new XMLHttpRequest;f.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(f.responseType="arraybuffer");for(const _ in n.headers)f.setRequestHeader(_,n.headers[_]);n.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=n.credentials==="include",f.onerror=()=>{d(new Error(f.statusText))},f.onload=()=>{if(!l.signal.aborted)if((f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let _=f.response;if(n.type==="json")try{_=JSON.parse(f.response)}catch(x){return void d(x)}u({data:_,cacheControl:f.getResponseHeader("Cache-Control"),expires:f.getResponseHeader("Expires")})}else{const _=new Blob([f.response],{type:f.getResponseHeader("Content-Type")});d(new Vi(f.status,f.statusText,n.url,_))}},l.signal.addEventListener("abort",()=>{f.abort(),d(Qi())}),f.send(n.body)})}(i,e)};function xn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Sr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Ir(i,e,r){if(r&&r[i]){const n=r[i].indexOf(e);n!==-1&&r[i].splice(n,1)}}class Ar{constructor(e,r={}){Mi(this,r),this.type=e}}class Mt extends Ar{constructor(e,r={}){super("error",Mi({error:e},r))}}class jr{on(e,r){return this._listeners=this._listeners||{},Sr(e,r,this._listeners),this}off(e,r){return Ir(e,r,this._listeners),Ir(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Sr(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new Ar(e,r||{}));const n=e.type;if(this.listens(n)){e.target=this;const l=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of u)Ir(n,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(Mi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Mt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var se={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const qr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Gs(i,e){const r={};for(const n in i)n!=="ref"&&(r[n]=i[n]);return qr.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Ke(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const G=[Gr,fe,je,Ve,$t,dr,zi,z(Ue),F,I,C];function H(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!H(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of G)if(!H(r,e))return null}}return`Expected ${R(i)} but found ${R(e)} instead.`}function K(i,e){return e.some(r=>r.kind===i.kind)}function q(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function J(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const he=.96422,ne=.82521,oe=4/29,Pe=6/29,Re=3*Pe*Pe,De=Pe*Pe*Pe,Ye=Math.PI/180,Fe=180/Math.PI;function ct(i){return(i%=360)<0&&(i+=360),i}function st([i,e,r,n]){let l,u;const d=Ne((.2225045*(i=Tt(i))+.7168786*(e=Tt(e))+.0606169*(r=Tt(r)))/1);i===e&&e===r?l=u=d:(l=Ne((.4360747*i+.3850649*e+.1430804*r)/he),u=Ne((.0139322*i+.0971045*e+.7141733*r)/ne));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),n]}function Tt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ne(i){return i>De?Math.pow(i,1/3):i/Re+oe}function gt([i,e,r,n]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*li(l),u=he*li(u),d=ne*li(d),[Ft(3.1338561*u-1.6168667*l-.4906146*d),Ft(-.9787684*u+1.9161415*l+.033454*d),Ft(.0719453*u-.2289914*l+1.4052427*d),n]}function Ft(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function li(i){return i>Pe?i*i*i:Re*(i-oe)}function Zt(i){return parseInt(i.padEnd(2,i),16)/255}function Jt(i,e){return xi(e?i/100:i,0,1)}function xi(i,e,r){return Math.min(Math.max(e,i),r)}function go(i){return!i.some(Number.isNaN)}const Il={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class it{constructor(e,r,n,l=1,u=!0){this.r=e,this.g=r,this.b=n,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,n,l]))}static parse(e){if(e instanceof it)return e;if(typeof e!="string")return;const r=function(n){if((n=n.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Il[n];if(l){const[d,f,_]=l;return[d/255,f/255,_/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const d=n.length<6?1:2;let f=1;return[Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+d)||"ff")]}if(n.startsWith("rgb")){const d=n.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,x,b,w,A,P,M,L,V,$,Y]=d,j=[b||" ",P||" ",V].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const W=[x,A,L].join(""),ae=W==="%%%"?100:W===""?255:0;if(ae){const le=[xi(+_/ae,0,1),xi(+w/ae,0,1),xi(+M/ae,0,1),$?Jt(+$,Y):1];if(go(le))return le}}return}}const u=n.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,x,b,w,A,P,M]=u,L=[_||" ",b||" ",A].join("");if(L===" "||L===" /"||L===",,"||L===",,,"){const V=[+f,xi(+x,0,100),xi(+w,0,100),P?Jt(+P,M):1];if(go(V))return function([$,Y,j,W]){function ae(le){const we=(le+$/30)%12,Ce=Y*Math.min(j,1-j);return j-Ce*Math.max(-1,Math.min(we-3,9-we,1))}return $=ct($),Y/=100,j/=100,[ae(0),ae(8),ae(4),W]}(V)}}}(e);return r?new it(...r,!1):void 0}get rgb(){const{r:e,g:r,b:n,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,n/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,n,l,u]=st(e),d=Math.sqrt(n*n+l*l);return[Math.round(1e4*d)?ct(Math.atan2(l,n)*Fe):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",st(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,n,l]=this.rgb;return`rgba(${[e,r,n].map(u=>Math.round(255*u)).join(",")},${l})`}}it.black=new it(0,0,0,1),it.white=new it(1,1,1,1),it.transparent=new it(0,0,0,0),it.red=new it(1,0,0,1);class aa{constructor(e,r,n){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class oa{constructor(e,r,n,l,u){this.text=e,this.image=r,this.scale=n,this.fontStack=l,this.textColor=u}}class vi{constructor(e){this.sections=e}static fromString(e){return new vi([new oa(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof vi?e:vi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bi)return e;if(typeof e=="number")return new bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new bi(e)}}toString(){return JSON.stringify(this.values)}}const _o=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Gt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Gt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,r,n]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Pr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof it||i instanceof aa||i instanceof vi||i instanceof bi||i instanceof Gt||i instanceof ki)return!0;if(Array.isArray(i)){for(const e of i)if(!Pr(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Pr(i[e]))return!1;return!0}return!1}function Ct(i){if(i===null)return Gr;if(typeof i=="string")return je;if(typeof i=="boolean")return Ve;if(typeof i=="number")return fe;if(i instanceof it)return $t;if(i instanceof aa)return Cr;if(i instanceof vi)return dr;if(i instanceof bi)return F;if(i instanceof Gt)return C;if(i instanceof ki)return I;if(Array.isArray(i)){const e=i.length;let r;for(const n of i){const l=Ct(n);if(r){if(r===l)continue;r=Ue;break}r=l}return z(r||Ue,e)}return zi}function Xs(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof it||i instanceof vi||i instanceof bi||i instanceof Gt||i instanceof ki?i.toString():JSON.stringify(i)}class Hr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Pr(e[1]))return r.error("invalid value");const n=e[1];let l=Ct(n);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Hr(l,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class vt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Wr={string:je,number:fe,boolean:Ve,object:zi};class Ui{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n,l=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Wr)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Wr[x],l++}else f=Ue;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],l++}n=z(f,_)}else{if(!Wr[u])throw new Error(`Types doesn't contain name = ${u}`);n=Wr[u]}const d=[];for(;le.outputDefined())}}const vn={"to-boolean":Ve,"to-color":$t,"to-number":fe,"to-string":je};class tr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[0];if(!vn[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=vn[n],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:yo(r[0],r[1],r[2],r[3]),!n))return new it(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new vt(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const n of this.args){r=n.evaluate(e);const l=bi.parse(r);if(l)return l}throw new vt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const n of this.args){r=n.evaluate(e);const l=Gt.parse(r);if(l)return l}throw new vt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const n of this.args){if(r=n.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new vt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return vi.fromString(Xs(this.args[0].evaluate(e)));case"resolvedImage":return ki.fromString(Xs(this.args[0].evaluate(e)));default:return Xs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const la=["Unknown","Point","LineString","Polygon"];class ys{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?la[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=it.parse(e)),r}}class tt{constructor(e,r,n=[],l,u=new Ws,d=[]){this.registry=e,this.path=n,this.key=n.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,n,l,u={}){return r?this.concat(r,n,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function n(l,u,d){return d==="assert"?new Ui(u,[l]):d==="coerce"?new tr(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Hr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new ys;try{d=new Hr(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){const l=typeof e=="number"?this.path.concat(e):this.path,u=n?this.scope.concat(n):this.scope;return new tt(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const n=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new oi(n,e))}checkSubtype(e,r){const n=H(e,r);return n&&this.error(n),n}}class bn{constructor(e,r,n){this.type=Cr,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");const l=r.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Ve);if(!l)return null;const u=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Ve);if(!u)return null;let d=null;return n.locale&&(d=r.parse(n.locale,1,je),!d)?null:new bn(l,u,d)}evaluate(e){return new aa(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const ir=8192;function ca(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ks(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function xo(i,e){const r=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*ir),Math.round(n*l*ir)]}function Al(i,e,r){const n=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return n*d-u*l==0&&n*u<=0&&l*d<=0}function wn(i,e){let r=!1;for(let d=0,f=e.length;d(n=i)[1]!=(u=_[x+1])[1]>n[1]&&n[0]<(u[0]-l[0])*(n[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var n,l,u;return r}function vo(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Cl(i,e,r){for(const x of r)for(let b=0;br[2]){const l=.5*n;let u=i[0]-r[0]>l?-n:r[0]-i[0]>l?n:0;u===0&&(u=i[0]-r[2]>l?-n:r[2]-i[0]>l?n:0),i[0]+=u}ca(e,i)}function So(i,e,r,n){const l=Math.pow(2,n.z)*ir,u=[n.x*ir,n.y*ir],d=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];To(x,e,r,l),d.push(x)}return d}function Sn(i,e,r,n){const l=Math.pow(2,n.z)*ir,u=[n.x*ir,n.y*ir],d=[];for(const _ of i){const x=[];for(const b of _){const w=[b.x+u[0],b.y+u[1]];ca(e,w),x.push(w)}d.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const x of _)To(x,e,r,l)}var f;return d}class Xr{constructor(e,r){this.type=Ve,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Pr(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const l=[];for(const u of n.features){const{type:d,coordinates:f}=u.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new Xr(n,{type:"MultiPolygon",coordinates:l})}else if(n.type==="Feature"){const l=n.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Xr(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Xr(n,n)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Tn(n.coordinates,u,d),_=So(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!wn(x,f))return!1}if(n.type==="MultiPolygon"){const f=ha(n.coordinates,u,d),_=So(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!vo(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Tn(n.coordinates,u,d),_=Sn(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!wo(x,f))return!1}if(n.type==="MultiPolygon"){const f=ha(n.coordinates,u,d),_=Sn(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!Pl(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class In{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const n=e[1];return r.scope.has(n)?new In(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Di{constructor(e,r,n,l){this.name=e,this.type=r,this._evaluate=n,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const n=e[0],l=Di.definitions[n];if(!l)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,b]of f){_=new tt(r.registry,Ys,r.path,null,r.scope);const w=[];let A=!1;for(let P=1;P{return A=w,Array.isArray(A)?`(${A.map(R).join(", ")})`:`(${R(A.type)}...)`;var A}).join(" | "),b=[];for(let w=1;w{r=e?r&&Ys(n):r&&n instanceof Hr}),!!r&&Js(i)&&An(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Js(i){if(i instanceof Di&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Xr)return!1;let e=!0;return i.eachChild(r=>{e&&!Js(r)&&(e=!1)}),e}function Qs(i){if(i instanceof Di&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Qs(r)&&(e=!1)}),e}function An(i,e){if(i instanceof Di&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(n=>{r&&!An(n,e)&&(r=!1)}),r}function en(i,e){const r=i.length-1;let n,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),n=i[f],l=i[f+1],n<=e){if(f===r||ee))throw new vt("Input is not a number.");d=f-1}return 0}class xs{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of n)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(e[1],1,fe);if(!n)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const w=r.parse(_,b,u);if(!w)return null;u=u||w.type,l.push([f,w])}return new xs(u,n,l)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const u=r.length;return l>=r[u-1]?n[u-1].evaluate(e):n[en(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function El(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ml=Io;function Io(i,e,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}Io.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var zl=El(Ml);function Kr(i,e,r){return i+r*(e-i)}function Cn(i,e,r){return i.map((n,l)=>Kr(n,e[l],r))}const wi={number:Kr,color:function(i,e,r,n="rgb"){switch(n){case"rgb":{const[l,u,d,f]=Cn(i.rgb,e.rgb,r);return new it(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[_,x,b,w]=e.hcl;let A,P;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?A=NaN:(A=_,d!==1&&d!==0||(P=x)):(A=l,b!==1&&b!==0||(P=u));else{let Y=_-l;_>l&&Y>180?Y-=360:_180&&(Y+=360),A=l+r*Y}const[M,L,V,$]=function([Y,j,W,ae]){return Y=isNaN(Y)?0:Y*Ye,gt([W,Math.cos(Y)*j,Math.sin(Y)*j,ae])}([A,P??Kr(u,x,r),Kr(d,b,r),Kr(f,w,r)]);return new it(M,L,V,$,!1)}case"lab":{const[l,u,d,f]=gt(Cn(i.lab,e.lab,r));return new it(l,u,d,f,!1)}}},array:Cn,padding:function(i,e,r){return new bi(Cn(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const n=i.values,l=e.values;if(n.length!==l.length)throw new vt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let d=0;dtypeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,fe),!u)return null;const f=[];let _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=$t:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const M=r.parse(w,P,_);if(!M)return null;_=_||M.type,f.push([b,M])}return J(_,fe)||J(_,$t)||J(_,F)||J(_,C)||J(_,z(fe))?new Qt(_,n,l,u,f):r.error(`Type ${R(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const u=r.length;if(l>=r[u-1])return n[u-1].evaluate(e);const d=en(r,l),f=Qt.interpolationFactor(this.interpolation,l,r[d],r[d+1]),_=n[d].evaluate(e),x=n[d+1].evaluate(e);switch(this.operator){case"interpolate":return wi[this.type.kind](_,x,f);case"interpolate-hcl":return wi.color(_,x,f,"hcl");case"interpolate-lab":return wi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function vs(i,e,r,n){const l=n-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Qe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let n=null;const l=r.expectedType;l&&l.kind!=="value"&&(n=l);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,u.push(_)}if(!n)throw new Error("No output type");const d=l&&u.some(f=>H(l,f.type));return new Qe(d?Ue:n,u)}evaluate(e){let r,n=null,l=0;for(const u of this.args)if(l++,n=u.evaluate(e),n&&n instanceof ki&&!n.available&&(r||(r=n.name),n=null,l===this.args.length&&(n=r)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Pn{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let u=1;u=n.length)throw new vt(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new vt(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class da{constructor(e,r){this.type=Ve,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,Ue);return n&&l?K(n.type,[Ve,je,fe,Gr,Ue])?new da(n,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(n.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!q(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${R(Ct(r))} instead.`);if(!q(n,["string","array"]))throw new vt(`Expected second argument to be of type array or string, but found ${R(Ct(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class En{constructor(e,r,n){this.type=fe,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,Ue);if(!n||!l)return null;if(!K(n.type,[Ve,je,fe,Gr,Ue]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(n.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,fe);return u?new En(n,l,u):null}return new En(n,l)}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!q(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${R(Ct(r))} instead.`);if(!q(n,["string","array"]))throw new vt(`Expected second argument to be of type array or string, but found ${R(Ct(n))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return n.indexOf(r,l)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class pa{constructor(e,r,n,l,u,d){this.inputType=e,this.type=r,this.input=n,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let n,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return A.error("Numeric branch labels must be integer values.");if(n){if(A.checkSubtype(n,Ct(M)))return null}else n=Ct(M);if(u[String(M)]!==void 0)return A.error("Branch labels must be unique.");u[String(M)]=d.length}const P=r.parse(w,x,l);if(!P)return null;l=l||P.type,d.push(P)}const f=r.parse(e[1],1,Ue);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(n,f.type)?null:new pa(n,l,f,u,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(Ct(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class fa{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Mn{constructor(e,r,n,l){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,fe);if(!n||!l)return null;if(!K(n.type,[z(Ue),je,Ue]))return r.error(`Expected first argument to be of type array or string, but found ${R(n.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,fe);return u?new Mn(n.type,n,l,u):null}return new Mn(n.type,n,l)}evaluate(e){const r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!q(r,["string","array"]))throw new vt(`Expected first argument to be of type array or string, but found ${R(Ct(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(n,l)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ao(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Co(i,e,r,n){return n.compare(e,r)===0}function bs(i,e,r){const n=i!=="=="&&i!=="!=";return class su{constructor(u,d,f){this.type=Ve,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,Ue);if(!_)return null;if(!Ao(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${R(_.type)}'.`);let x=d.parse(u[2],2,Ue);if(!x)return null;if(!Ao(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${R(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${R(_.type)}' and '${R(x.type)}'.`);n&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Ui(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ui(_.type,[x])));let b=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,Cr),!b)return null}return new su(_,x,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(n&&this.hasUntypedArgument){const _=Ct(d),x=Ct(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new vt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=Ct(d),x=Ct(f);if(_.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const kl=bs("==",function(i,e,r){return e===r},Co),Dl=bs("!=",function(i,e,r){return e!==r},function(i,e,r,n){return!Co(0,e,r,n)}),Ll=bs("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,n){return n.compare(e,r)>0}),Bl=bs("<=",function(i,e,r){return e<=r},function(i,e,r,n){return n.compare(e,r)<=0}),Fl=bs(">=",function(i,e,r){return e>=r},function(i,e,r,n){return n.compare(e,r)>=0});class ma{constructor(e,r,n,l,u){this.type=je,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const n=r.parse(e[1],1,fe);if(!n)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,je),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,je),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,fe),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,fe),!_)?null:new ma(n,u,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class zn{constructor(e){this.type=dr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,fe),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,z(je)),!x))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,$t),!b))return null;const w=l[l.length-1];w.scale=_,w.font=x,w.textColor=b}else{const _=r.parse(e[d],1,Ue);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new zn(l)}evaluate(e){return new vi(this.sections.map(r=>{const n=r.content.evaluate(e);return Ct(n)===I?new oa("",n,null,null,null):new oa(Xs(n),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ga{constructor(e){this.type=I,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const n=r.parse(e[1],1,je);return n?new ga(n):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),n=ki.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class _a{constructor(e){this.type=fe,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${R(n.type)} instead.`):new _a(n):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new vt(`Expected value to be of type string or array, but found ${R(Ct(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ws={"==":kl,"!=":Dl,">":Rl,"<":Ll,">=":Fl,"<=":Bl,array:Ui,at:ua,boolean:Ui,case:fa,coalesce:Qe,collator:bn,format:zn,image:ga,in:da,"index-of":En,interpolate:Qt,"interpolate-hcl":Qt,"interpolate-lab":Qt,length:_a,let:Pn,literal:Hr,match:pa,number:Ui,"number-format":ma,object:Ui,slice:Mn,step:xs,string:Ui,"to-boolean":tr,"to-color":tr,"to-number":tr,"to-string":tr,var:In,within:Xr};function Po(i,[e,r,n,l]){e=e.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const u=l?l.evaluate(i):1,d=yo(e,r,n,u);if(d)throw new vt(d);return new it(e/255,r/255,n/255,u,!1)}function Eo(i,e){return i in e}function ya(i,e){const r=e[i];return r===void 0?null:r}function Yr(i){return{type:i}}function Mo(i){return{result:"success",value:i}}function Ts(i){return{result:"error",value:i}}function Ss(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function zo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function xa(i){return!!i.expression&&i.expression.interpolated}function et(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Is(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ol(i){return i}function ko(i,e){const r=e.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",l=n||!(n||i.property!==void 0),u=i.type||(xa(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?it.parse:bi.parse;(i=yi({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],b(w[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=Do;else if(u==="interval")f=St;else if(u==="categorical"){f=Vl,_=Object.create(null);for(const b of i.stops)_[b[0]]=b[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Je}if(n){const b={},w=[];for(let M=0;MM[0]),evaluate:({zoom:M},L)=>Do({stops:A,base:i.base},e,M).evaluate(M,L)}}if(l){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Qt.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>f(i,e,w,_,x)}}return{kind:"source",evaluate(b,w){const A=w&&w.properties?w.properties[i.property]:void 0;return A===void 0?tn(i.default,e.default):f(i,e,A,_,x)}}}function tn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Vl(i,e,r,n,l){return tn(typeof r===l?n[r]:void 0,i.default,e.default)}function St(i,e,r){if(et(r)!=="number")return tn(i.default,e.default);const n=i.stops.length;if(n===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[n-1][0])return i.stops[n-1][1];const l=en(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Do(i,e,r){const n=i.base!==void 0?i.base:1;if(et(r)!=="number")return tn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=en(i.stops.map(b=>b[0]),r),d=function(b,w,A,P){const M=P-A,L=b-A;return M===0?0:w===1?L/M:(Math.pow(w,L)-1)/(Math.pow(w,M)-1)}(r,n,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=wi[e.type]||Ol;return typeof f.evaluate=="function"?{evaluate(...b){const w=f.evaluate.apply(void 0,b),A=_.evaluate.apply(void 0,b);if(w!==void 0&&A!==void 0)return x(w,A,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function Je(i,e,r){switch(e.type){case"color":r=it.parse(r);break;case"formatted":r=vi.fromString(r.toString());break;case"resolvedImage":r=ki.fromString(r.toString());break;case"padding":r=bi.parse(r);break;default:et(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return tn(r,i.default,e.default)}Di.register(ws,{error:[{kind:"error"},[je],(i,[e])=>{throw new vt(e.evaluate(i))}],typeof:[je,[Ue],(i,[e])=>R(Ct(e.evaluate(i)))],"to-rgba":[z(fe,4),[$t],(i,[e])=>{const[r,n,l,u]=e.evaluate(i).rgb;return[255*r,255*n,255*l,u]}],rgb:[$t,[fe,fe,fe],Po],rgba:[$t,[fe,fe,fe,fe],Po],has:{type:Ve,overloads:[[[je],(i,[e])=>Eo(e.evaluate(i),i.properties())],[[je,zi],(i,[e,r])=>Eo(e.evaluate(i),r.evaluate(i))]]},get:{type:Ue,overloads:[[[je],(i,[e])=>ya(e.evaluate(i),i.properties())],[[je,zi],(i,[e,r])=>ya(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ue,[je],(i,[e])=>ya(e.evaluate(i),i.featureState||{})],properties:[zi,[],i=>i.properties()],"geometry-type":[je,[],i=>i.geometryType()],id:[Ue,[],i=>i.id()],zoom:[fe,[],i=>i.globals.zoom],"heatmap-density":[fe,[],i=>i.globals.heatmapDensity||0],"line-progress":[fe,[],i=>i.globals.lineProgress||0],accumulated:[Ue,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[fe,Yr(fe),(i,e)=>{let r=0;for(const n of e)r+=n.evaluate(i);return r}],"*":[fe,Yr(fe),(i,e)=>{let r=1;for(const n of e)r*=n.evaluate(i);return r}],"-":{type:fe,overloads:[[[fe,fe],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[fe],(i,[e])=>-e.evaluate(i)]]},"/":[fe,[fe,fe],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[fe,[fe,fe],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[fe,[],()=>Math.LN2],pi:[fe,[],()=>Math.PI],e:[fe,[],()=>Math.E],"^":[fe,[fe,fe],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[fe,[fe],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))],log2:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[fe,[fe],(i,[e])=>Math.sin(e.evaluate(i))],cos:[fe,[fe],(i,[e])=>Math.cos(e.evaluate(i))],tan:[fe,[fe],(i,[e])=>Math.tan(e.evaluate(i))],asin:[fe,[fe],(i,[e])=>Math.asin(e.evaluate(i))],acos:[fe,[fe],(i,[e])=>Math.acos(e.evaluate(i))],atan:[fe,[fe],(i,[e])=>Math.atan(e.evaluate(i))],min:[fe,Yr(fe),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[fe,Yr(fe),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[fe,[fe],(i,[e])=>Math.abs(e.evaluate(i))],round:[fe,[fe],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[fe,[fe],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[fe,[fe],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ve,[je,Ue],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ve,[Ue],(i,[e])=>i.id()===e.value],"filter-type-==":[Ve,[je],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n{const r=i.id(),n=e.value;return typeof r==typeof n&&r":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>l}],"filter-id->":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n<=l}],"filter-id-<=":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>=l}],"filter-id->=":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[Ve,[Ue],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ve,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ve,[z(je)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ve,[z(Ue)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ve,[je,z(Ue)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ve,[je,z(Ue)],(i,[e,r])=>function(n,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===n)return!0;l[f]>n?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ve,overloads:[[[Ve,Ve],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Yr(Ve),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ve,overloads:[[[Ve,Ve],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Yr(Ve),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ve,[Ve],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ve,[je],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[je,[je],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[je,[je],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[je,Yr(Ue),(i,e)=>e.map(r=>Xs(r.evaluate(i))).join("")],"resolved-locale":[je,[Cr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class rn{constructor(e,r){var n;this.expression=e,this._warningHistory={},this._evaluator=new ys,this._defaultValue=r?(n=r).type==="color"&&Is(n.default)?new it(0,0,0,0):n.type==="color"?it.parse(n.default)||null:n.type==="padding"?bi.parse(n.default)||null:n.type==="variableAnchorOffsetCollection"?Gt.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new vt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ot(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ws}function nt(i,e){const r=new tt(ws,Ys,[],e?function(l){const u={color:$t,string:je,number:fe,enum:je,boolean:Ve,formatted:dr,padding:F,resolvedImage:I,variableAnchorOffsetCollection:C};return l.type==="array"?z(u[l.value]||Ue,l.length):u[l.type]}(e):void 0),n=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Mo(new rn(n,e)):Ts(r.errors)}class As{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Qs(r.expression)}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,u,d)}evaluate(e,r,n,l,u,d){return this._styleExpression.evaluate(e,r,n,l,u,d)}}class kn{constructor(e,r,n,l){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Qs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,u,d)}evaluate(e,r,n,l,u,d){return this._styleExpression.evaluate(e,r,n,l,u,d)}interpolationFactor(e,r,n){return this.interpolationType?Qt.interpolationFactor(this.interpolationType,e,r,n):0}}function Lo(i,e){const r=nt(i,e);if(r.result==="error")return r;const n=r.value.expression,l=Js(n);if(!l&&!Ss(e))return Ts([new oi("","data expressions not supported")]);const u=An(n,["zoom"]);if(!u&&!zo(e))return Ts([new oi("","zoom expressions not supported")]);const d=Ln(n);return d||u?d instanceof oi?Ts([d]):d instanceof Qt&&!xa(e)?Ts([new oi("",'"interpolate" expressions cannot be used with this property')]):Mo(d?new kn(l?"camera":"composite",r.value,d.labels,d instanceof Qt?d.interpolation:void 0):new As(l?"constant":"source",r.value)):Ts([new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Dn{constructor(e,r){this._parameters=e,this._specification=r,yi(this,ko(this._parameters,this._specification))}static deserialize(e){return new Dn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ln(i){let e=null;if(i instanceof Pn)e=Ln(i.result);else if(i instanceof Qe){for(const r of i.args)if(e=Ln(r),e)break}else(i instanceof xs||i instanceof Qt)&&i.input instanceof Di&&i.input.name==="zoom"&&(e=i);return e instanceof oi||i.eachChild(r=>{const n=Ln(r);n instanceof oi?e=n:!e&&n?e=new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function va(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!va(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ro={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Rn(i){if(i==null)return{filter:()=>!0,needGeometry:!1};va(i)||(i=Cs(i));const e=nt(i,Ro);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,l)=>e.value.evaluate(r,n,{},l),needGeometry:ba(i)}}function Bo(i,e){return ie?1:0}function ba(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?wa(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Cs))):e==="all"?["all"].concat(i.slice(1).map(Cs)):e==="none"?["all"].concat(i.slice(1).map(Cs).map(Bn)):e==="in"?Fo(i[1],i.slice(2)):e==="!in"?Bn(Fo(i[1],i.slice(2))):e==="has"?Oo(i[1]):e==="!has"?Bn(Oo(i[1])):e!=="within"||i;var r}function wa(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Fo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Bo)]]:["filter-in-small",i,["literal",e]]}}function Oo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Bn(i){return["!",i]}function Ta(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${Ta(u)},`;return`${l}]`}const r=Object.keys(i).sort();let n="{";for(let l=0;ln.maximum?[new ge(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Ia(i){const e=i.valueSpec,r=bt(i.value.type);let n,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=et(i.value.stops)==="array"&&et(i.value.stops[0])==="array"&&et(i.value.stops[0][0])==="object",b=Ti({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(P){if(r==="identity")return[new ge(P.key,P.value,'identity function may not have a "stops" property')];let M=[];const L=P.value;return M=M.concat(Ps({key:P.key,value:L,valueSpec:P.valueSpec,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:w})),et(L)==="array"&&L.length===0&&M.push(new ge(P.key,L,"array must have at least one stop")),M},default:function(P){return P.validateSpec({key:P.key,value:P.value,valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec})}}});return r==="identity"&&f&&b.push(new ge(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new ge(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!xa(i.valueSpec)&&b.push(new ge(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!Ss(i.valueSpec)?b.push(new ge(i.key,i.value,"property functions not supported")):f&&!zo(i.valueSpec)&&b.push(new ge(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||b.push(new ge(i.key,i.value,'"property" property is required')),b;function w(P){let M=[];const L=P.value,V=P.key;if(et(L)!=="array")return[new ge(V,L,`array expected, ${et(L)} found`)];if(L.length!==2)return[new ge(V,L,`array length 2 expected, length ${L.length} found`)];if(x){if(et(L[0])!=="object")return[new ge(V,L,`object expected, ${et(L[0])} found`)];if(L[0].zoom===void 0)return[new ge(V,L,"object stop key must have zoom")];if(L[0].value===void 0)return[new ge(V,L,"object stop key must have value")];if(u&&u>bt(L[0].zoom))return[new ge(V,L[0].zoom,"stop zoom values must appear in ascending order")];bt(L[0].zoom)!==u&&(u=bt(L[0].zoom),l=void 0,d={}),M=M.concat(Ti({key:`${V}[0]`,value:L[0],valueSpec:{zoom:{}},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:Sa,value:A}}))}else M=M.concat(A({key:`${V}[0]`,value:L[0],valueSpec:{},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec},L));return ot(Er(L[1]))?M.concat([new ge(`${V}[1]`,L[1],"expressions are not allowed in function stops.")]):M.concat(P.validateSpec({key:`${V}[1]`,value:L[1],valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec}))}function A(P,M){const L=et(P.value),V=bt(P.value),$=P.value!==null?P.value:M;if(n){if(L!==n)return[new ge(P.key,$,`${L} stop domain type must match previous stop domain type ${n}`)]}else n=L;if(L!=="number"&&L!=="string"&&L!=="boolean")return[new ge(P.key,$,"stop domain value must be a number, string, or boolean")];if(L!=="number"&&r!=="categorical"){let Y=`number expected, ${L} found`;return Ss(e)&&r===void 0&&(Y+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ge(P.key,$,Y)]}return r!=="categorical"||L!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&L==="number"&&l!==void 0&&Vnew ge(`${i.key}${n.key}`,i.value,n.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new ge(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Qs(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Qs(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!An(r,["zoom","feature-state"]))return[new ge(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Js(r))return[new ge(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jr(i){const e=i.key,r=i.value,n=i.valueSpec,l=[];return Array.isArray(n.values)?n.values.indexOf(bt(r))===-1&&l.push(new ge(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(bt(r))===-1&&l.push(new ge(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Ms(i){return va(Er(i.value))?Es(yi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):sn(i)}function sn(i){const e=i.value,r=i.key;if(et(e)!=="array")return[new ge(r,e,`array expected, ${et(e)} found`)];const n=i.styleSpec;let l,u=[];if(e.length<1)return[new ge(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Jr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),bt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&bt(e[1])==="$type"&&u.push(new ge(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new ge(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=et(e[1]),l!=="string"&&u.push(new ge(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{x in r&&e.push(new ge(n,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{bt(x.id)===f&&(_=x)}),_?_.ref?e.push(new ge(n,r.ref,"ref cannot reference another ref layer")):d=bt(_.type):e.push(new ge(n,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&bt(_.type);_?x==="vector"&&d==="raster"?e.push(new ge(n,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?e.push(new ge(n,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?e.push(new ge(n,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new ge(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new ge(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ge(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ge(n,r.source,`source "${r.source}" not found`))}else e.push(new ge(n,r,'missing required property "source"'));return e=e.concat(Ti({key:n,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${n}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Ms,layout:_=>Ti({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Ca(yi({layerType:d},x))}}),paint:_=>Ti({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Fn(yi({layerType:d},x))}})}})),e}function rr(i){const e=i.value,r=i.key,n=et(e);return n!=="string"?[new ge(r,e,`string expected, ${n} found`)]:[]}const Uo={promoteId:function({key:i,value:e}){if(et(e)==="string")return rr({key:i,value:e});{const r=[];for(const n in e)r.push(...rr({key:`${i}.${n}`,value:e[n]}));return r}}};function No(i){const e=i.value,r=i.key,n=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new ge(r,e,'"type" is required')];const d=bt(e.type);let f;switch(d){case"vector":case"raster":return f=Ti({key:r,value:e,valueSpec:n[`source_${d.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:Uo,validateSpec:u}),f;case"raster-dem":return f=function(_){var x;const b=(x=_.sourceName)!==null&&x!==void 0?x:"",w=_.value,A=_.styleSpec,P=A.source_raster_dem,M=_.style;let L=[];const V=et(w);if(w===void 0)return L;if(V!=="object")return L.push(new ge("source_raster_dem",w,`object expected, ${V} found`)),L;const $=bt(w.encoding)==="custom",Y=["redFactor","greenFactor","blueFactor","baseShift"],j=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const W in w)!$&&Y.includes(W)?L.push(new ge(W,w[W],`In "${b}": "${W}" is only valid when "encoding" is set to "custom". ${j} encoding found`)):P[W]?L=L.concat(_.validateSpec({key:W,value:w[W],valueSpec:P[W],validateSpec:_.validateSpec,style:M,styleSpec:A})):L.push(new ge(W,w[W],`unknown property "${W}"`));return L}({sourceName:r,value:e,style:i.style,styleSpec:n,validateSpec:u}),f;case"geojson":if(f=Ti({key:r,value:e,valueSpec:n.source_geojson,style:l,styleSpec:n,validateSpec:u,objectElementValidators:Uo}),e.cluster)for(const _ in e.clusterProperties){const[x,b]=e.clusterProperties[_],w=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...Es({key:`${r}.${_}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Es({key:`${r}.${_}.reduce`,value:w,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Ti({key:r,value:e,valueSpec:n.source_video,style:l,validateSpec:u,styleSpec:n});case"image":return Ti({key:r,value:e,valueSpec:n.source_image,style:l,validateSpec:u,styleSpec:n});case"canvas":return[new ge(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:n})}}function $o(i){const e=i.value,r=i.styleSpec,n=r.light,l=i.style;let u=[];const d=et(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new ge("light",e,`object expected, ${d} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&n[_[1]]&&n[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)])}return u}function jo(i){const e=i.value,r=i.styleSpec,n=r.sky,l=i.style,u=et(e);if(e===void 0)return[];if(u!=="object")return[new ge("sky",e,`object expected, ${u} found`)];let d=[];for(const f in e)d=d.concat(n[f]?Ot({key:f,value:e[f],valueSpec:n[f],style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)]);return d}function qo(i){const e=i.value,r=i.styleSpec,n=r.terrain,l=i.style;let u=[];const d=et(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new ge("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)]);return u}function nn(i){let e=[];const r=i.value,n=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new ge(n,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new ge(n,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Ti({key:`${n}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return rr({key:n,value:r})}const an={"*":()=>[],array:Ps,boolean:function(i){const e=i.value,r=i.key,n=et(e);return n!=="boolean"?[new ge(r,e,`boolean expected, ${n} found`)]:[]},number:Sa,color:function(i){const e=i.key,r=i.value,n=et(r);return n!=="string"?[new ge(e,r,`color expected, ${n} found`)]:it.parse(String(r))?[]:[new ge(e,r,`color expected, "${r}" found`)]},constants:Vo,enum:Jr,filter:Ms,function:Ia,layer:Pa,object:Ti,source:No,light:$o,sky:jo,terrain:qo,string:rr,formatted:function(i){return rr(i).length===0?[]:Es(i)},resolvedImage:function(i){return rr(i).length===0?[]:Es(i)},padding:function(i){const e=i.key,r=i.value;if(et(r)==="array"){if(r.length<1||r.length>4)return[new ge(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(Vo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ot}))),Zo(r)}function sr(i){return function(e){return i({...e,validateSpec:Ot})}}function Zo(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function ci(i){return function(...e){return Zo(i.apply(this,e))}}Li.source=ci(sr(No)),Li.sprite=ci(sr(nn)),Li.glyphs=ci(sr(zs)),Li.light=ci(sr($o)),Li.sky=ci(sr(jo)),Li.terrain=ci(sr(qo)),Li.layer=ci(sr(Pa)),Li.filter=ci(sr(Ms)),Li.paintProperty=ci(sr(Fn)),Li.layoutProperty=ci(sr(Ca));const ks=Li,Ea=ks.light,Nl=ks.paintProperty,Ma=ks.layoutProperty;function Go(i,e){let r=!1;if(e&&e.length)for(const n of e)i.fire(new Mt(new Error(n.message))),r=!0;return r}class pr{constructor(e,r,n){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(n=d[2]);for(let _=0;_=w[M+0]&&l>=w[M+1])?(f[P]=!0,d.push(b[P])):f[P]=!1}}}}_forEachCell(e,r,n,l,u,d,f,_){const x=this._convertToCellCoord(e),b=this._convertToCellCoord(r),w=this._convertToCellCoord(n),A=this._convertToCellCoord(l);for(let P=x;P<=w;P++)for(let M=b;M<=A;M++){const L=this.d*M+P;if((!_||_(this._convertFromCellCoord(P),this._convertFromCellCoord(M),this._convertFromCellCoord(P+1),this._convertFromCellCoord(M+1)))&&u.call(this,e,r,n,l,L,d,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let n=0;for(let d=0;d=0)continue;const d=i[u];l[u]=Mr[n].shallow.indexOf(u)>=0?d:Qr(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(l.$name=n),l}throw new Error("can't serialize object of type "+typeof i)}function Ds(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||za(i)||Ji(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ds);if(typeof i=="object"){const e=i.$name||"Object";if(!Mr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Mr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const n=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];n[l]=Mr[e].shallow.indexOf(l)>=0?u:Ds(u)}return n}throw new Error("can't deserialize object of type "+typeof i)}class ka{constructor(){this.first=!0}update(e,r){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function on(i){for(const e of i)if(Vn(e.charCodeAt(0)))return!0;return!1}function On(i){for(const e of i)if(!Ho(e.charCodeAt(0)))return!1;return!0}function Ho(i){return!(Te.Arabic(i)||Te["Arabic Supplement"](i)||Te["Arabic Extended-A"](i)||Te["Arabic Presentation Forms-A"](i)||Te["Arabic Presentation Forms-B"](i))}function Vn(i){return!(i!==746&&i!==747&&(i<4352||!(Te["Bopomofo Extended"](i)||Te.Bopomofo(i)||Te["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Te["CJK Compatibility Ideographs"](i)||Te["CJK Compatibility"](i)||Te["CJK Radicals Supplement"](i)||Te["CJK Strokes"](i)||!(!Te["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Te["CJK Unified Ideographs Extension A"](i)||Te["CJK Unified Ideographs"](i)||Te["Enclosed CJK Letters and Months"](i)||Te["Hangul Compatibility Jamo"](i)||Te["Hangul Jamo Extended-A"](i)||Te["Hangul Jamo Extended-B"](i)||Te["Hangul Jamo"](i)||Te["Hangul Syllables"](i)||Te.Hiragana(i)||Te["Ideographic Description Characters"](i)||Te.Kanbun(i)||Te["Kangxi Radicals"](i)||Te["Katakana Phonetic Extensions"](i)||Te.Katakana(i)&&i!==12540||!(!Te["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Te["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Te["Unified Canadian Aboriginal Syllabics"](i)||Te["Unified Canadian Aboriginal Syllabics Extended"](i)||Te["Vertical Forms"](i)||Te["Yijing Hexagram Symbols"](i)||Te["Yi Syllables"](i)||Te["Yi Radicals"](i))))}function Da(i){return!(Vn(i)||function(e){return!!(Te["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Te["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Te["Letterlike Symbols"](e)||Te["Number Forms"](e)||Te["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Te["Control Pictures"](e)&&e!==9251||Te["Optical Character Recognition"](e)||Te["Enclosed Alphanumerics"](e)||Te["Geometric Shapes"](e)||Te["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Te["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Te["CJK Symbols and Punctuation"](e)||Te.Katakana(e)||Te["Private Use Area"](e)||Te["CJK Compatibility Forms"](e)||Te["Small Form Variants"](e)||Te["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function La(i){return i>=1424&&i<=2303||Te["Arabic Presentation Forms-A"](i)||Te["Arabic Presentation Forms-B"](i)}function Ra(i,e){return!(!e&&La(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Te.Khmer(i))}function Wo(i){for(const e of i)if(La(e.charCodeAt(0)))return!0;return!1}const es=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ht{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ka,this.transition={})}isSupportedScript(e){return function(r,n){for(const l of r)if(!Ra(l.charCodeAt(0),n))return!1;return!0}(e,es.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class Un{constructor(e,r){this.property=e,this.value=r,this.expression=function(n,l){if(Is(n))return new Dn(n,l);if(ot(n)){const u=Lo(n,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=n;return l.type==="color"&&typeof n=="string"?u=it.parse(n):l.type!=="padding"||typeof n!="number"&&!Array.isArray(n)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(n)&&(u=Gt.parse(n)):u=bi.parse(n),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}}class Nn{constructor(e){this.property=e,this.value=new Un(e,void 0)}transitioned(e,r){return new Fa(this.property,this.value,r,Mi({},e.transition,this.transition),e.now)}untransitioned(){return new Fa(this.property,this.value,null,{},0)}}class Ba{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return si(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].value=new Un(this._values[e].property,r===null?void 0:si(r))}getTransition(e){return si(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].transition=si(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const n=new Xo(this._properties);for(const l of Object.keys(this._values))n._values[l]=this._values[l].transitioned(e,r._values[l]);return n}untransitioned(){const e=new Xo(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Fa{constructor(e,r,n,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,n),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;const x=_*_,b=x*_;return 4*(_<.5?b:3*(_-x)+b-.75)}(f))}}return u}}class Xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){const l=new ln(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,n);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class $l{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return si(this._values[e].value)}setValue(e,r){this._values[e]=new Un(this._values[e].property,r===null?void 0:si(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){const l=new ln(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,n);return l}}class Ni{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,l){return this.property.evaluate(this.value,this.parameters,e,r,n,l)}}class ln{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Me{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){const l=wi[this.specification.type];return l?l(e,r,n):e}}class ke{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,l){return new Ni(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},n,l)}:e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Ni(this,{kind:"constant",value:void 0},e.parameters);const l=wi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,n);return new Ni(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,n,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,n,l,u,d)}}class ts extends ke{possiblyEvaluate(e,r,n,l){if(e.value===void 0)return new Ni(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},n,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Ni(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Ni(this,{kind:"constant",value:u},r)}return new Ni(this,e.expression,r)}evaluate(e,r,n,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,n,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,l),e.evaluate({zoom:Math.floor(r.zoom)},n,l),e.evaluate({zoom:Math.floor(r.zoom)+1},n,l),r):e.value}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class Oa{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},n,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new ht(Math.floor(r.zoom-1),r)),e.expression.evaluate(new ht(Math.floor(r.zoom),r)),e.expression.evaluate(new ht(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class cn{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){return!!e.expression.evaluate(r,null,{},n,l)}interpolate(){return!1}}class hi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const n=e[r];n.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Un(n,void 0),u=this.defaultTransitionablePropertyValues[r]=new Nn(n);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ie("DataDrivenProperty",ke),Ie("DataConstantProperty",Me),Ie("CrossFadedDataDrivenProperty",ts),Ie("CrossFadedProperty",Oa),Ie("ColorRampProperty",cn);const Ko="-transition";class $i extends jr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new $l(r.layout)),r.paint)){this._transitionablePaint=new Ba(r.paint);for(const n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(const n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ln(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){r!=null&&this._validate(Ma,`layers.${this.id}.layout.${e}`,e,r,n)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Ko)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null&&this._validate(Nl,`layers.${this.id}.paint.${e}`,e,r,n))return!1;if(e.endsWith(Ko))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),yn(e,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,l,u={}){return(!u||u.validate!==!1)&&Go(this,e.call(ks,{key:r,layerType:this.type,objectKey:n,value:l,styleSpec:se,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Ni&&Ss(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Yo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ls{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _t{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function It(i,e=1){let r=0,n=0;return{members:i.map(l=>{const u=Yo[l.type].BYTES_PER_ELEMENT,d=r=Jo(r,Math.max(e,u)),f=l.components||1;return n=Math.max(n,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:Jo(r,Math.max(n,e)),alignment:e}}function Jo(i,e){return Math.ceil(i/e)*e}class hn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=n,e}}hn.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",hn);class $n extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=n,this.int16[u+2]=l,e}}$n.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",$n);class zr extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=n,this.int16[d+2]=l,this.int16[d+3]=u,e}}zr.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",zr);class Va extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}Va.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",Va);class Ua extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,e}}Ua.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",Ua);class un extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=n,e}}un.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",un);class Na extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,n,l,u,d,f,_,x,b)}emplace(e,r,n,l,u,d,f,_,x,b,w){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=n,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=x,this.uint16[A+8]=b,this.uint16[A+9]=w,e}}Na.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",Na);class jn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b,w,A){const P=this.length;return this.resize(P+1),this.emplace(P,e,r,n,l,u,d,f,_,x,b,w,A)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P){const M=12*e;return this.int16[M+0]=r,this.int16[M+1]=n,this.int16[M+2]=l,this.int16[M+3]=u,this.uint16[M+4]=d,this.uint16[M+5]=f,this.uint16[M+6]=_,this.uint16[M+7]=x,this.int16[M+8]=b,this.int16[M+9]=w,this.int16[M+10]=A,this.int16[M+11]=P,e}}jn.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",jn);class $a extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,e}}$a.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",$a);class ja extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}ja.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",ja);class fr extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,l,u,d,f,_,x)}emplace(e,r,n,l,u,d,f,_,x,b){const w=10*e,A=5*e;return this.int16[w+0]=r,this.int16[w+1]=n,this.int16[w+2]=l,this.int16[w+3]=u,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[A+3]=_,this.uint16[w+8]=x,this.uint16[w+9]=b,e}}fr.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",fr);class qn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}qn.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",qn);class dn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,l,u)}emplace(e,r,n,l,u,d){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=n,this.float32[f+2]=l,this.int16[_+6]=u,this.int16[_+7]=d,e}}dn.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",dn);class Zn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=n,this.float32[f+1]=l,this.float32[f+2]=u,e}}Zn.prototype.bytesPerElement=12,Ie("StructArrayLayout2ub2f12",Zn);class Rs extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=l,e}}Rs.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",Rs);class qa extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y){const j=24*e,W=12*e,ae=48*e;return this.int16[j+0]=r,this.int16[j+1]=n,this.uint16[j+2]=l,this.uint16[j+3]=u,this.uint32[W+2]=d,this.uint32[W+3]=f,this.uint32[W+4]=_,this.uint16[j+10]=x,this.uint16[j+11]=b,this.uint16[j+12]=w,this.float32[W+7]=A,this.float32[W+8]=P,this.uint8[ae+36]=M,this.uint8[ae+37]=L,this.uint8[ae+38]=V,this.uint32[W+10]=$,this.int16[j+22]=Y,e}}qa.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",qa);class Bs extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae){const ye=this.length;return this.resize(ye+1),this.emplace(ye,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae,ye){const pe=32*e,ze=16*e;return this.int16[pe+0]=r,this.int16[pe+1]=n,this.int16[pe+2]=l,this.int16[pe+3]=u,this.int16[pe+4]=d,this.int16[pe+5]=f,this.int16[pe+6]=_,this.int16[pe+7]=x,this.uint16[pe+8]=b,this.uint16[pe+9]=w,this.uint16[pe+10]=A,this.uint16[pe+11]=P,this.uint16[pe+12]=M,this.uint16[pe+13]=L,this.uint16[pe+14]=V,this.uint16[pe+15]=$,this.uint16[pe+16]=Y,this.uint16[pe+17]=j,this.uint16[pe+18]=W,this.uint16[pe+19]=ae,this.uint16[pe+20]=le,this.uint16[pe+21]=we,this.uint16[pe+22]=Ce,this.uint32[ze+12]=be,this.float32[ze+13]=ve,this.float32[ze+14]=me,this.uint16[pe+30]=Ae,this.uint16[pe+31]=ye,e}}Bs.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",Bs);class kr extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}kr.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",kr);class Za extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,e}}Za.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",Za);class Gn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=n,this.uint16[u+3]=l,e}}Gn.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",Gn);class is extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=n,e}}is.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",is);class Ga extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}Ga.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",Ga);class Ha extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,this.float32[d+3]=u,e}}Ha.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",Ha);class Wa extends Ls{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new xe(this.anchorPointX,this.anchorPointY)}}Wa.prototype.size=20;class Qo extends fr{get(e){return new Wa(this,e)}}Ie("CollisionBoxArray",Qo);class c extends Ls{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}c.prototype.size=48;class t extends qa{get(e){return new c(this,e)}}Ie("PlacedSymbolArray",t);class s extends Ls{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}s.prototype.size=64;class a extends Bs{get(e){return new s(this,e)}}Ie("SymbolInstanceArray",a);class o extends kr{getoffsetX(e){return this.float32[1*e+0]}}Ie("GlyphOffsetArray",o);class h extends $n{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ie("SymbolLineVertexArray",h);class m extends Ls{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}m.prototype.size=12;class g extends Za{get(e){return new m(this,e)}}Ie("TextAnchorOffsetArray",g);class y extends Ls{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}y.prototype.size=8;class v extends Gn{get(e){return new y(this,e)}}Ie("FeatureIndexArray",v);class T extends hn{}class S extends hn{}class E extends hn{}class O extends Va{}class B extends Ua{}class U extends un{}class D extends Na{}class Z extends jn{}class Q extends $a{}class N extends ja{}class X extends qn{}class ee extends Zn{}class te extends Rs{}class ie extends is{}const de=It([{name:"a_pos",components:2,type:"Int16"}],4),{members:ce}=de;class ue{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,l){let u=this.segments[this.segments.length-1];return e>ue.MAX_VERTEX_ARRAY_LENGTH&&qt(`Max vertices per segment is ${ue.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>ue.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,l){return new ue([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:l,vaos:{},sortKey:0}])}}function Se(i,e){return 256*(i=Yi(Math.floor(i),0,255))+Yi(Math.floor(e),0,255)}ue.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",ue);const Oe=It([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var _e={exports:{}},Le={exports:{}};Le.exports=function(i,e){var r,n,l,u,d,f,_,x;for(n=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,x=0;x>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var $e=Le.exports,We={exports:{}};We.exports=function(i,e){for(var r,n=i.length,l=e^n,u=0;n>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++u;switch(n){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Be=$e,qe=We.exports;_e.exports=Be,_e.exports.murmur3=Be,_e.exports.murmur2=qe;var Ze=Ei(_e.exports);class mt{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,l){this.ids.push(at(e)),this.positions.push(r,n,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=at(e);let n=0,l=this.ids.length-1;for(;n>1;this.ids[d]>=r?l=d:n=d+1}const u=[];for(;this.ids[n]===r;)u.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return u}static serialize(e,r){const n=new Float64Array(e.ids),l=new Uint32Array(e.positions);return ui(n,l,0,n.length-1),r&&r.push(n.buffer,l.buffer),{ids:n,positions:l}}static deserialize(e){const r=new mt;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function at(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ze(String(i))}function ui(i,e,r,n){for(;r>1];let u=r-1,d=n+1;for(;;){do u++;while(i[u]l);if(u>=d)break;Pt(i,u,d),Pt(e,3*u,3*d),Pt(e,3*u+1,3*d+1),Pt(e,3*u+2,3*d+2)}d-r`u_${l}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new nr(e,r):new Ht(e,r)}}class qi{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new ji(e,r):new Ht(e,r)}}class yt{constructor(e,r,n,l){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,n,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new ht(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,n,l){const u=this.expression.evaluate({zoom:0},n,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,n){if(this.type==="color"){const l=ss(n);for(let u=e;u`u_${f}_t`),this.type=n,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,n,l,u){const d=this.expression.evaluate(new ht(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new ht(this.zoom+1),r,{},l,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,f)}updatePaintArray(e,r,n,l){const u=this.expression.evaluate({zoom:this.zoom},n,l),d=this.expression.evaluate({zoom:this.zoom+1},n,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,n,l){if(this.type==="color"){const u=ss(n),d=ss(l);for(let f=e;f`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof yt||n instanceof ut)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Fs(l,r,n);this.needsUpload=!1,this._featureMap=new mt,this._bufferOffset=0}populatePaintArrays(e,r,n,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,l){for(const u of n)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Vt(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Si(i,e,r){const n={color:{source:un,composite:Ha},number:{source:kr,composite:un}},l=function(u){return{"line-pattern":{source:D,composite:D},"fill-pattern":{source:D,composite:D},"fill-extrusion-pattern":{source:D,composite:D}}[u]}(i);return l&&l[r]||n[e][r]}Ie("ConstantBinder",ar),Ie("CrossFadedConstantBinder",qi),Ie("SourceExpressionBinder",yt),Ie("CrossFadedCompositeBinder",wt),Ie("CompositeExpressionBinder",ut),Ie("ProgramConfiguration",Fs,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",pt);const He=8192,Xa=Math.pow(2,14)-1,el=-Xa-1;function ns(i){const e=He/i.extent,r=i.loadGeometry();for(let n=0;nd.x+1||_d.y+1)&&qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function as(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?ns(i):[]}}function Hn(i,e,r,n,l){i.emplaceBack(2*e+(n+1)/2,2*r+(l+1)/2)}class Ka{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new S,this.indexArray=new te,this.segments=new ue,this.programConfigurations=new pt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:_,id:x,index:b,sourceLayerIndex:w}of e){const A=this.layers[0]._featureFilter.needGeometry,P=as(_,A);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),P,n))continue;const M=f?d.evaluate(P,{},n):void 0,L={id:x,properties:_.properties,type:_.type,sourceLayerIndex:w,index:b,geometry:A?P.geometry:ns(_),patterns:{},sortKey:M};u.push(L)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of u){const{geometry:x,index:b,sourceLayerIndex:w}=_,A=e[b].feature;this.addFeature(_,x,b,n),r.featureIndex.insert(A,x,b,w,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ce),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,l){for(const u of r)for(const d of u){const f=d.x,_=d.y;if(f<0||f>=He||_<0||_>=He)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=x.vertexLength;Hn(this.layoutVertexArray,f,_,-1,-1),Hn(this.layoutVertexArray,f,_,1,-1),Hn(this.layoutVertexArray,f,_,1,1),Hn(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},l)}}function os(i,e){for(let r=0;r1){if(pn(i,e))return!0;for(let n=0;n1?r:r.sub(e)._mult(l)._add(e))}function Ec(i,e){let r,n,l,u=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(u=!u)}return u}function Wn(i,e){let r=!1;for(let n=0,l=i.length-1;ne.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function au(i,e,r){const n=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const u=Fi(i,e,r[0]);return u!==Fi(i,e,r[1])||u!==Fi(i,e,r[2])||u!==Fi(i,e,r[3])}function Ja(i,e,r){const n=e.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(i)}function sl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function nl(i,e,r,n,l){if(!e[0]&&!e[1])return i;const u=xe.convert(e)._mult(l);r==="viewport"&&u._rotate(-n);const d=[];for(let f=0;fDc(V,L))}(x,_),P=w?b*f:b;for(const M of l)for(const L of M){const V=w?L:Dc(L,_);let $=P;const Y=al([],[L.x,L.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=Y[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/Y[3]),tl(A,V,$))return!0}return!1}}function Dc(i,e){const r=al([],[i.x,i.y,0,1],e);return new xe(r[0]/r[3],r[1]/r[3])}class Lc extends Ka{}let Rc;Ie("HeatmapBucket",Lc,{omit:["layers"]});var hu={get paint(){return Rc=Rc||new hi({"heatmap-radius":new ke(se.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ke(se.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Me(se.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cn(se.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Me(se.paint_heatmap["heatmap-opacity"])})}};function ql(i,{width:e,height:r},n,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*n}`)}else l=new Uint8Array(e*r*n);return i.width=e,i.height=r,i.data=l,i}function Bc(i,{width:e,height:r},n){if(e===i.width&&r===i.height)return;const l=ql({},{width:e,height:r},n);Zl(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},n),i.width=e,i.height=r,i.data=l.data}function Zl(i,e,r,n,l,u){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||n.x>e.width-l.width||n.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d80*r){n=u=i[0],l=d=i[1];for(var M=r;Mu&&(u=f),_>d&&(d=_);x=(x=Math.max(u-n,d-l))!==0?32767/x:0}return to(A,P,r,n,l,x,0),P}function Vc(i,e,r,n,l){var u,d;if(l===Xl(i,e,r,n)>0)for(u=e;u=e;u-=n)d=$c(u,i[u],i[u+1],d);return d&&ll(d,d.next)&&(ro(d),d=d.next),d}function mn(i,e){if(!i)return i;e||(e=i);var r,n=i;do if(r=!1,n.steiner||!ll(n,n.next)&&At(n.prev,n,n.next)!==0)n=n.next;else{if(ro(n),(n=e=n.prev)===n.next)break;r=!0}while(r||n!==e);return e}function to(i,e,r,n,l,u,d){if(i){!d&&u&&function(b,w,A,P){var M=b;do M.z===0&&(M.z=Hl(M.x,M.y,w,A,P)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==b);M.prevZ.nextZ=null,M.prevZ=null,function(L){var V,$,Y,j,W,ae,le,we,Ce=1;do{for($=L,L=null,W=null,ae=0;$;){for(ae++,Y=$,le=0,V=0;V0||we>0&&Y;)le!==0&&(we===0||!Y||$.z<=Y.z)?(j=$,$=$.nextZ,le--):(j=Y,Y=Y.nextZ,we--),W?W.nextZ=j:L=j,j.prevZ=W,W=j;$=Y}W.nextZ=null,Ce*=2}while(ae>1)}(M)}(i,n,l,u);for(var f,_,x=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?_u(i,n,l,u):gu(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),ro(i),i=_.next,x=_.next;else if((i=_)===x){d?d===1?to(i=yu(mn(i),e,r),e,r,n,l,u,2):d===2&&xu(i,e,r,n,l,u):to(mn(i),e,r,n,l,u,1);break}}}function gu(i){var e=i.prev,r=i,n=i.next;if(At(e,r,n)>=0)return!1;for(var l=e.x,u=r.x,d=n.x,f=e.y,_=r.y,x=n.y,b=lu?l>d?l:d:u>d?u:d,P=f>_?f>x?f:x:_>x?_:x,M=n.next;M!==e;){if(M.x>=b&&M.x<=A&&M.y>=w&&M.y<=P&&Kn(l,f,u,_,d,x,M.x,M.y)&&At(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function _u(i,e,r,n){var l=i.prev,u=i,d=i.next;if(At(l,u,d)>=0)return!1;for(var f=l.x,_=u.x,x=d.x,b=l.y,w=u.y,A=d.y,P=f<_?f_?f>x?f:x:_>x?_:x,V=b>w?b>A?b:A:w>A?w:A,$=Hl(P,M,e,r,n),Y=Hl(L,V,e,r,n),j=i.prevZ,W=i.nextZ;j&&j.z>=$&&W&&W.z<=Y;){if(j.x>=P&&j.x<=L&&j.y>=M&&j.y<=V&&j!==l&&j!==d&&Kn(f,b,_,w,x,A,j.x,j.y)&&At(j.prev,j,j.next)>=0||(j=j.prevZ,W.x>=P&&W.x<=L&&W.y>=M&&W.y<=V&&W!==l&&W!==d&&Kn(f,b,_,w,x,A,W.x,W.y)&&At(W.prev,W,W.next)>=0))return!1;W=W.nextZ}for(;j&&j.z>=$;){if(j.x>=P&&j.x<=L&&j.y>=M&&j.y<=V&&j!==l&&j!==d&&Kn(f,b,_,w,x,A,j.x,j.y)&&At(j.prev,j,j.next)>=0)return!1;j=j.prevZ}for(;W&&W.z<=Y;){if(W.x>=P&&W.x<=L&&W.y>=M&&W.y<=V&&W!==l&&W!==d&&Kn(f,b,_,w,x,A,W.x,W.y)&&At(W.prev,W,W.next)>=0)return!1;W=W.nextZ}return!0}function yu(i,e,r){var n=i;do{var l=n.prev,u=n.next.next;!ll(l,u)&&Uc(l,n,n.next,u)&&io(l,u)&&io(u,l)&&(e.push(l.i/r|0),e.push(n.i/r|0),e.push(u.i/r|0),ro(n),ro(n.next),n=i=u),n=n.next}while(n!==i);return mn(n)}function xu(i,e,r,n,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Su(d,f)){var _=Nc(d,f);return d=mn(d,d.next),_=mn(_,_.next),to(d,e,r,n,l,u,0),void to(_,e,r,n,l,u,0)}f=f.next}d=d.next}while(d!==i)}function vu(i,e){return i.x-e.x}function bu(i,e){var r=function(l,u){var d,f=u,_=l.x,x=l.y,b=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var w=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(w<=_&&w>b&&(b=w,d=f.x=f.x&&f.x>=M&&_!==f.x&&Kn(xd.x||f.x===d.x&&wu(d,f)))&&(d=f,V=A)),f=f.next;while(f!==P);return d}(i,e);if(!r)return e;var n=Nc(r,i);return mn(n,n.next),mn(r,r.next)}function wu(i,e){return At(i.prev,i,e.prev)<0&&At(e.next,i,i.next)<0}function Hl(i,e,r,n,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Tu(i){var e=i,r=i;do(e.x=(i-d)*(u-f)&&(i-d)*(n-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(n-f)}function Su(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,n){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==n.i&&l.next.i!==n.i&&Uc(l,l.next,r,n))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(io(i,e)&&io(e,i)&&function(r,n){var l=r,u=!1,d=(r.x+n.x)/2,f=(r.y+n.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(At(i.prev,i,e.prev)||At(i,e.prev,e))||ll(i,e)&&At(i.prev,i,i.next)>0&&At(e.prev,e,e.next)>0)}function At(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ll(i,e){return i.x===e.x&&i.y===e.y}function Uc(i,e,r,n){var l=hl(At(i,e,r)),u=hl(At(i,e,n)),d=hl(At(r,n,i)),f=hl(At(r,n,e));return l!==u&&d!==f||!(l!==0||!cl(i,r,e))||!(u!==0||!cl(i,n,e))||!(d!==0||!cl(r,i,n))||!(f!==0||!cl(r,e,n))}function cl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function hl(i){return i>0?1:i<0?-1:0}function io(i,e){return At(i.prev,i,i.next)<0?At(i,e,i.next)>=0&&At(i,i.prev,e)>=0:At(i,e,i.prev)<0||At(i,i.next,e)<0}function Nc(i,e){var r=new Wl(i.i,i.x,i.y),n=new Wl(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,n.next=r,r.prev=n,u.next=n,n.prev=u,n}function $c(i,e,r,n){var l=new Wl(i,e,r);return n?(l.next=n.next,l.prev=n,n.next.prev=l,n.next=l):(l.prev=l,l.next=l),l}function ro(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Wl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Xl(i,e,r,n){for(var l=0,u=e,d=r-n;u0&&r.holes.push(n+=i[l-1].length)}return r};var jc=Ei(Gl.exports);function Iu(i,e,r,n,l){qc(i,e,r,n||i.length-1,l||Au)}function qc(i,e,r,n,l){for(;n>r;){if(n-r>600){var u=n-r+1,d=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);qc(i,e,Math.max(r,Math.floor(e-d*_/u+x)),Math.min(n,Math.floor(e+(u-d)*_/u+x)),l)}var b=i[e],w=r,A=n;for(so(i,r,e),l(i[n],b)>0&&so(i,r,n);w0;)A--}l(i[r],b)===0?so(i,r,A):so(i,++A,n),A<=e&&(r=A+1),e<=A&&(n=A-1)}}function so(i,e,r){var n=i[e];i[e]=i[r],i[r]=n}function Au(i,e){return ie?1:0}function Kl(i,e){const r=i.length;if(r<=1)return[i];const n=[];let l,u;for(let d=0;d1)for(let d=0;dr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new E,this.indexArray=new te,this.indexArray2=new ie,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.segments2=new ue,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Yl("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const w=this.layers[0]._featureFilter.needGeometry,A=as(f,w);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,n))continue;const P=u?l.evaluate(A,{},n,r.availableImages):void 0,M={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:w?A.geometry:ns(f),patterns:{},sortKey:P};d.push(M)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const w=Jl("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,l,u){for(const d of Kl(r,500)){let f=0;for(const P of d)f+=P.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,b=[],w=[];for(const P of d){if(P.length===0)continue;P!==d[0]&&w.push(b.length/2);const M=this.segments2.prepareSegment(P.length,this.layoutVertexArray,this.indexArray2),L=M.vertexLength;this.layoutVertexArray.emplaceBack(P[0].x,P[0].y),this.indexArray2.emplaceBack(L+P.length-1,L),b.push(P[0].x),b.push(P[0].y);for(let V=1;V>3}if(l--,n===1||n===2)u+=i.readSVarint(),d+=i.readSVarint(),n===1&&(e&&f.push(e),e=[]),e.push(new Du(u,d));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Yn.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,n=0,l=0,u=0,d=1/0,f=-1/0,_=1/0,x=-1/0;i.pos>3}if(n--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,x]},Yn.prototype.toGeoJSON=function(i,e,r){var n,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=Yn.types[this.type];function b(P){for(var M=0;M>3;l=d===1?n.readString():d===2?n.readFloat():d===3?n.readDouble():d===4?n.readVarint64():d===5?n.readVarint():d===6?n.readSVarint():d===7?n.readBoolean():null}return l}(r))}Xc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Bu(this._pbf,e,this.extent,this._keys,this._values)};var Ou=Wc;function Vu(i,e,r){if(i===3){var n=new Ou(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Os.VectorTile=function(i,e){this.layers=i.readFields(Vu,{},e)},Os.VectorTileFeature=Hc,Os.VectorTileLayer=Wc;const Uu=Os.VectorTileFeature.types,ec=Math.pow(2,13);function no(i,e,r,n,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(n*ec)+d,l*ec*2,u*ec*2,Math.round(f))}class tc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new O,this.centroidVertexArray=new T,this.indexArray=new te,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Yl("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=as(l,_);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),x,n))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:_?x.geometry:ns(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Jl("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,n,{}),r.featureIndex.insert(l,b.geometry,d,f,this.index,!0)}}addFeatures(e,r,n){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,n)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ku),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,zu.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Kl(r,500)){let _=0;for(const M of f)_+=M.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const M of f){if(M.length===0||$u(M))continue;let L=0;for(let V=0;V=1){const Y=M[V-1];if(!Nu($,Y)){x.vertexLength+4>ue.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const j=$.sub(Y)._perp()._unit(),W=Y.dist($);L+W>32768&&(L=0),no(this.layoutVertexArray,$.x,$.y,j.x,j.y,0,0,L),no(this.layoutVertexArray,$.x,$.y,j.x,j.y,0,1,L),d.x+=2*$.x,d.y+=2*$.y,d.vertexCount+=2,L+=W,no(this.layoutVertexArray,Y.x,Y.y,j.x,j.y,0,0,L),no(this.layoutVertexArray,Y.x,Y.y,j.x,j.y,0,1,L),d.x+=2*Y.x,d.y+=2*Y.y,d.vertexCount+=2;const ae=x.vertexLength;this.indexArray.emplaceBack(ae,ae+2,ae+1),this.indexArray.emplaceBack(ae+1,ae+2,ae+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>ue.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Uu[e.type]!=="Polygon")continue;const b=[],w=[],A=x.vertexLength;for(const M of f)if(M.length!==0){M!==f[0]&&w.push(b.length/2);for(let L=0;LHe)||i.y===e.y&&(i.y<0||i.y>He)}function $u(i){return i.every(e=>e.x<0)||i.every(e=>e.x>He)||i.every(e=>e.y<0)||i.every(e=>e.y>He)}let Kc;Ie("FillExtrusionBucket",tc,{omit:["layers","features"]});var ju={get paint(){return Kc=Kc||new hi({"fill-extrusion-opacity":new Me(se["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ke(se["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Me(se["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Me(se["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ts(se["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ke(se["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ke(se["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Me(se["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class qu extends $i{constructor(e){super(e,ju)}createBucket(e){return new tc(e)}queryRadius(){return sl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,l,u,d,f,_){const x=nl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),b=this.paint.get("fill-extrusion-height").evaluate(r,n),w=this.paint.get("fill-extrusion-base").evaluate(r,n),A=function(M,L,V,$){const Y=[];for(const j of M){const W=[j.x,j.y,0,1];al(W,W,L),Y.push(new xe(W[0]/W[3],W[1]/W[3]))}return Y}(x,_),P=function(M,L,V,$){const Y=[],j=[],W=$[8]*L,ae=$[9]*L,le=$[10]*L,we=$[11]*L,Ce=$[8]*V,be=$[9]*V,ve=$[10]*V,me=$[11]*V;for(const Ae of M){const ye=[],pe=[];for(const ze of Ae){const Ee=ze.x,Ge=ze.y,dt=$[0]*Ee+$[4]*Ge+$[12],ft=$[1]*Ee+$[5]*Ge+$[13],kt=$[2]*Ee+$[6]*Ge+$[14],Ri=$[3]*Ee+$[7]*Ge+$[15],pi=kt+le,Et=Ri+we,jt=dt+Ce,Xt=ft+be,fi=kt+ve,mi=Ri+me,Dt=new xe((dt+W)/Et,(ft+ae)/Et);Dt.z=pi/Et,ye.push(Dt);const Lt=new xe(jt/mi,Xt/mi);Lt.z=fi/mi,pe.push(Lt)}Y.push(ye),j.push(pe)}return[Y,j]}(l,w,b,_);return function(M,L,V){let $=1/0;Ya(V,L)&&($=Yc(V,L[0]));for(let Y=0;Yr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new B,this.layoutVertexArray2=new U,this.indexArray=new te,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Yl("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const w=this.layers[0]._featureFilter.needGeometry,A=as(f,w);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,n))continue;const P=u?l.evaluate(A,{},n):void 0,M={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:w?A.geometry:ns(f),patterns:{},sortKey:P};d.push(M)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const w=Jl("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Wu)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gu),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,n,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),_=d.get("line-cap"),x=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const w of r)this.addLine(w,e,f,_,x,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,u,l)}addLine(e,r,n,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;n==="bevel"&&(u=1.05);const b=this.overscaling<=16?15*He/(512*this.overscaling):0,w=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,P,M,L,V;this.e1=this.e2=-1,f&&(A=e[_-2],V=e[x].sub(A)._unit()._perp());for(let $=x;$<_;$++){if(M=$===_-1?f?e[x+1]:void 0:e[$+1],M&&e[$].equals(M))continue;V&&(L=V),A&&(P=A),A=e[$],V=M?M.sub(A)._unit()._perp():L,L=L||V;let Y=L.add(V);Y.x===0&&Y.y===0||Y._unit();const j=L.x*V.x+L.y*V.y,W=Y.x*V.x+Y.y*V.y,ae=W!==0?1/W:1/0,le=2*Math.sqrt(2-2*W),we=W0;if(we&&$>x){const me=A.dist(P);if(me>2*b){const Ae=A.sub(A.sub(P)._mult(b/me)._round());this.updateDistance(P,Ae),this.addCurrentVertex(Ae,L,0,0,w),P=Ae}}const be=P&&M;let ve=be?n:f?"butt":l;if(be&&ve==="round"&&(aeu&&(ve="bevel"),ve==="bevel"&&(ae>2&&(ve="flipbevel"),ae100)Y=V.mult(-1);else{const me=ae*L.add(V).mag()/L.sub(V).mag();Y._perp()._mult(me*(Ce?-1:1))}this.addCurrentVertex(A,Y,0,0,w),this.addCurrentVertex(A,Y.mult(-1),0,0,w)}else if(ve==="bevel"||ve==="fakeround"){const me=-Math.sqrt(ae*ae-1),Ae=Ce?me:0,ye=Ce?0:me;if(P&&this.addCurrentVertex(A,L,Ae,ye,w),ve==="fakeround"){const pe=Math.round(180*le/Math.PI/20);for(let ze=1;ze2*b){const Ae=A.add(M.sub(A)._mult(b/me)._round());this.updateDistance(A,Ae),this.addCurrentVertex(Ae,V,0,0,w),A=Ae}}}}addCurrentVertex(e,r,n,l,u,d=!1){const f=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*n,r.y-r.x*n,d,!1,n,u),this.addHalfVertex(e,f,_,d,!0,-l,u),this.distance>Jc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,l,u,d))}addHalfVertex({x:e,y:r},n,l,u,d,f,_){const x=.5*(this.lineClips?this.scaledDistance*(Jc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*n)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),_.primitiveLength++),d?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Qc,eh;Ie("LineBucket",ic,{omit:["layers","patternFeatures"]});var th={get paint(){return eh=eh||new hi({"line-opacity":new ke(se.paint_line["line-opacity"]),"line-color":new ke(se.paint_line["line-color"]),"line-translate":new Me(se.paint_line["line-translate"]),"line-translate-anchor":new Me(se.paint_line["line-translate-anchor"]),"line-width":new ke(se.paint_line["line-width"]),"line-gap-width":new ke(se.paint_line["line-gap-width"]),"line-offset":new ke(se.paint_line["line-offset"]),"line-blur":new ke(se.paint_line["line-blur"]),"line-dasharray":new Oa(se.paint_line["line-dasharray"]),"line-pattern":new ts(se.paint_line["line-pattern"]),"line-gradient":new cn(se.paint_line["line-gradient"])})},get layout(){return Qc=Qc||new hi({"line-cap":new Me(se.layout_line["line-cap"]),"line-join":new ke(se.layout_line["line-join"]),"line-miter-limit":new Me(se.layout_line["line-miter-limit"]),"line-round-limit":new Me(se.layout_line["line-round-limit"]),"line-sort-key":new ke(se.layout_line["line-sort-key"])})}};class Yu extends ke{possiblyEvaluate(e,r){return r=new ht(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,l){return r=Mi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,l)}}let ul;class Ju extends $i{constructor(e){super(e,th),this.gradientVersion=0,ul||(ul=new Yu(th.paint.properties["line-width"].specification),ul.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(n){return n._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof xs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=ul.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ic(e)}queryRadius(e){const r=e,n=ih(Ja("line-width",this,r),Ja("line-gap-width",this,r)),l=Ja("line-offset",this,r);return n/2+Math.abs(l)+sl(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,l,u,d,f){const _=nl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*ih(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),b=this.paint.get("line-offset").evaluate(r,n);return b&&(l=function(w,A){const P=[];for(let M=0;M=3){for(let V=0;V0?e+2*i:i}const Qu=It([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ed=It([{name:"a_projected_pos",components:3,type:"Float32"}],4);It([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const td=It([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);It([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const rh=It([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),id=It([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rd(i,e,r){return i.sections.forEach(n=>{n.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),es.applyArabicShaping&&(l=es.applyArabicShaping(l)),l}(n.text,e,r)}),i}It([{name:"triangle",components:3,type:"Uint16"}]),It([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),It([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),It([{type:"Float32",name:"offsetX"}]),It([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),It([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const oo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var zt=24,sh=rt,nh=function(i,e,r,n,l){var u,d,f=8*l-n-1,_=(1<>1,b=-7,w=l-1,A=-1,P=i[e+w];for(w+=A,u=P&(1<<-b)-1,P>>=-b,b+=f;b>0;u=256*u+i[e+w],w+=A,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=n;b>0;d=256*d+i[e+w],w+=A,b-=8);if(u===0)u=1-x;else{if(u===_)return d?NaN:1/0*(P?-1:1);d+=Math.pow(2,n),u-=x}return(P?-1:1)*d*Math.pow(2,u-n)},ah=function(i,e,r,n,l,u){var d,f,_,x=8*u-l-1,b=(1<>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=0,M=1,L=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=b):(d=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-d))<1&&(d--,_*=2),(e+=d+w>=1?A/_:A*Math.pow(2,1-w))*_>=2&&(d++,_/=2),d+w>=b?(f=0,d=b):d+w>=1?(f=(e*_-1)*Math.pow(2,l),d+=w):(f=e*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+P]=255&f,P+=M,f/=256,l-=8);for(d=d<0;i[r+P]=255&d,P+=M,d/=256,x-=8);i[r+P-M]|=128*L};function rt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}rt.Varint=0,rt.Fixed64=1,rt.Bytes=2,rt.Fixed32=5;var rc=4294967296,oh=1/rc,lh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ls(i){return i.type===rt.Bytes?i.readVarint()+i.pos:i.pos+1}function Jn(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function ch(i,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var l=r.pos-1;l>=i;l--)r.buf[l+n]=r.buf[l]}function sd(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function hh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}rt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&n,i(l,e,this),this.pos===u&&this.skip(n)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=dl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=hh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=dl(this.buf,this.pos)+dl(this.buf,this.pos+4)*rc;return this.pos+=8,i},readSFixed64:function(){var i=dl(this.buf,this.pos)+hh(this.buf,this.pos+4)*rc;return this.pos+=8,i},readFloat:function(){var i=nh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=nh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(l,u,d){var f,_,x=d.buf;if(f=(112&(_=x[d.pos++]))>>4,_<128||(f|=(127&(_=x[d.pos++]))<<3,_<128)||(f|=(127&(_=x[d.pos++]))<<10,_<128)||(f|=(127&(_=x[d.pos++]))<<17,_<128)||(f|=(127&(_=x[d.pos++]))<<24,_<128)||(f|=(1&(_=x[d.pos++]))<<31,_<128))return Jn(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&lh?function(r,n,l){return lh.decode(r.subarray(n,l))}(this.buf,e,i):function(r,n,l){for(var u="",d=n;d239?4:b>223?3:b>191?2:1;if(d+A>l)break;A===1?b<128&&(w=b):A===2?(192&(f=r[d+1]))==128&&(w=(31&b)<<6|63&f)<=127&&(w=null):A===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((w=(15&b)<<12|(63&f)<<6|63&_)<=2047||w>=55296&&w<=57343)&&(w=null)):A===4&&(_=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&x)==128&&((w=(15&b)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,A=1):w>65535&&(w-=65536,u+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),u+=String.fromCharCode(w),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==rt.Bytes)return i.push(this.readVarint(e));var r=ls(this);for(i=i||[];this.pos127;);else if(e===rt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===rt.Fixed32)this.pos+=4;else{if(e!==rt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var n,l;if(e>=0?(n=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(n,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(n,l,u){for(var d,f,_=0;_55295&&d<57344){if(!f){d>56319||_+1===l.length?(n[u++]=239,n[u++]=191,n[u++]=189):f=d;continue}if(d<56320){n[u++]=239,n[u++]=191,n[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(n[u++]=239,n[u++]=191,n[u++]=189,f=null);d<128?n[u++]=d:(d<2048?n[u++]=d>>6|192:(d<65536?n[u++]=d>>12|224:(n[u++]=d>>18|240,n[u++]=d>>12&63|128),n[u++]=d>>6&63|128),n[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&ch(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),ah(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),ah(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&ch(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,e,r){this.writeTag(i,rt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,sd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,nd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,ld,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,ad,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,od,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,cd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,hd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,ud,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,dd,e)},writeBytesField:function(i,e){this.writeTag(i,rt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,rt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,rt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,rt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,rt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,rt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,rt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,rt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,rt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,rt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var sc=Ei(sh);const nc=3;function pd(i,e,r){i===1&&r.readMessage(fd,e)}function fd(i,e,r){if(i===3){const{id:n,bitmap:l,width:u,height:d,left:f,top:_,advance:x}=r.readMessage(md,{});e.push({id:n,bitmap:new eo({width:u+2*nc,height:d+2*nc},l),metrics:{width:u,height:d,left:f,top:_,advance:x}})}}function md(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const uh=nc;function dh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=n.length-1;f>=0;f--){const _=n[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===_.w&&d.h===_.h){const x=n.pop();f=0&&n>=e&&fl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const n=new ea;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(co.forText(e.scale,e.fontStack||r));const n=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pl(i,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L){const V=ea.fromFeature(i,l);let $;w===k.ah.vertical&&V.verticalizePunctuation();const{processBidirectionalText:Y,processStyledBidirectionalText:j}=es;if(Y&&V.sections.length===1){$=[];const le=Y(V.toString(),oc(V,x,u,e,n,P,M));for(const we of le){const Ce=new ea;Ce.text=we,Ce.sections=V.sections;for(let be=0;be0&&hs>Ai&&(Ai=hs)}else{const Hi=Ce[Xe.fontStack],Pi=Hi&&Hi[Kt];if(Pi&&Pi.rect)mr=Pi.rect,or=Pi.metrics;else{const hs=we[Xe.fontStack],mo=hs&&hs[Kt];if(!mo)continue;or=mo.metrics}Bt=(Lt-Xe.scale)*zt}lr?(le.verticalizable=!0,ti.push({glyph:Kt,imageName:gr,x:dt,y:ft+Bt,vertical:lr,scale:Xe.scale,fontStack:Xe.fontStack,sectionIndex:ii,metrics:or,rect:mr}),dt+=cs*Xe.scale+ze):(ti.push({glyph:Kt,imageName:gr,x:dt,y:ft+Bt,vertical:lr,scale:Xe.scale,fontStack:Xe.fontStack,sectionIndex:ii,metrics:or,rect:mr}),dt+=or.advance*Xe.scale+ze)}ti.length!==0&&(kt=Math.max(dt-ze,kt),yd(ti,0,ti.length-1,pi,Ai)),dt=0;const Ci=me*Lt+Ai;gi.lineOffset=Math.max(Ai,ei),ft+=Ci,Ri=Math.max(Ci,Ri),++Et}var jt;const Xt=ft-lo,{horizontalAlign:fi,verticalAlign:mi}=lc(Ae);(function(Dt,Lt,ei,gi,ti,Ai,Ci,Rt,Xe){const ii=(Lt-ei)*ti;let Kt=0;Kt=Ai!==Ci?-Rt*gi-lo:(-gi*Xe+.5)*Ci;for(const Bt of Dt)for(const or of Bt.positionedGlyphs)or.x+=ii,or.y+=Kt})(le.positionedLines,pi,fi,mi,kt,Ri,me,Xt,ve.length),le.top+=-mi*Xt,le.bottom=le.top+Xt,le.left+=-fi*kt,le.right=le.left+kt}(ae,e,r,n,$,d,f,_,w,x,A,L),!function(le){for(const we of le)if(we.positionedGlyphs.length!==0)return!1;return!0}(W)&&ae}const fl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gd={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fh(i,e,r,n,l,u){if(e.imageName){const d=n[e.imageName];return d?d.displaySize[0]*e.scale*zt/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function mh(i,e,r,n){const l=Math.pow(i-e,2);return n?i=0;let b=0;for(let A=0;Ad.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=jl([]),this.placementViewportMatrix=jl([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=xh(this.zoom,r["text-size"]),this.iconSizeData=xh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,l=n.get("symbol-sort-key"),u=n.get("symbol-z-order");this.canOverlap=cc(n,"text-overlap","text-allow-overlap")!=="never"||cc(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(d=>k.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new uc(new pt(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new uc(new pt(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new o,this.lineVertexArray=new h,this.symbolInstances=new a,this.textAnchorOffsets=new g}calculateGlyphDependencies(e,r,n,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),b=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!x&&!b)return;const A=r.iconDependencies,P=r.glyphDependencies,M=r.availableImages,L=new ht(this.zoom);for(const{feature:V,id:$,index:Y,sourceLayerIndex:j}of e){const W=l._featureFilter.needGeometry,ae=as(V,W);if(!l._featureFilter.filter(L,ae,n))continue;let le,we;if(W||(ae.geometry=ns(V)),x){const be=l.getValueAndResolveTokens("text-field",ae,n,M),ve=vi.factory(be),me=this.hasRTLText=this.hasRTLText||wd(ve);(!me||es.getRTLTextPluginStatus()==="unavailable"||me&&es.isParsed())&&(le=rd(ve,l,ae))}if(b){const be=l.getValueAndResolveTokens("icon-image",ae,n,M);we=be instanceof ki?be:ki.fromString(be)}if(!le&&!we)continue;const Ce=this.sortFeaturesByKey?w.evaluate(ae,{},n):void 0;if(this.features.push({id:$,text:le,icon:we,index:Y,sourceLayerIndex:j,geometry:ae.geometry,properties:V.properties,type:vd[V.type],sortKey:Ce}),we&&(A[we.name]=!0),le){const be=d.evaluate(ae,{},n).join(","),ve=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(k.ah.vertical)>=0;for(const me of le.sections)if(me.image)A[me.image.name]=!0;else{const Ae=on(le.toString()),ye=me.fontStack||be,pe=P[ye]=P[ye]||{};this.calculateGlyphDependencies(me.text,pe,ve,this.allowVerticalPlacement,Ae)}}}u.get("symbol-placement")==="line"&&(this.features=function(V){const $={},Y={},j=[];let W=0;function ae(be){j.push(V[be]),W++}function le(be,ve,me){const Ae=Y[be];return delete Y[be],Y[ve]=Ae,j[Ae].geometry[0].pop(),j[Ae].geometry[0]=j[Ae].geometry[0].concat(me[0]),Ae}function we(be,ve,me){const Ae=$[ve];return delete $[ve],$[be]=Ae,j[Ae].geometry[0].shift(),j[Ae].geometry[0]=me[0].concat(j[Ae].geometry[0]),Ae}function Ce(be,ve,me){const Ae=me?ve[0][ve[0].length-1]:ve[0][0];return`${be}:${Ae.x}:${Ae.y}`}for(let be=0;bebe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,$)=>V.sortKey-$.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const n=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const n=e.placedSymbolArray.get(r),l=n.vertexStartIndex+4*n.numGlyphs;for(let u=n.vertexStartIndex;ul[f]-l[_]||u[_]-u[f]),d}addToSortKeyRanges(e,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let vh,bh;Ie("SymbolBucket",ta,{omit:["layers","collisionBoxArray","features","compareText"]}),ta.MAX_GLYPHS=65535,ta.addDynamicAttributes=hc;var pc={get paint(){return bh=bh||new hi({"icon-opacity":new ke(se.paint_symbol["icon-opacity"]),"icon-color":new ke(se.paint_symbol["icon-color"]),"icon-halo-color":new ke(se.paint_symbol["icon-halo-color"]),"icon-halo-width":new ke(se.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ke(se.paint_symbol["icon-halo-blur"]),"icon-translate":new Me(se.paint_symbol["icon-translate"]),"icon-translate-anchor":new Me(se.paint_symbol["icon-translate-anchor"]),"text-opacity":new ke(se.paint_symbol["text-opacity"]),"text-color":new ke(se.paint_symbol["text-color"],{runtimeType:$t,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ke(se.paint_symbol["text-halo-color"]),"text-halo-width":new ke(se.paint_symbol["text-halo-width"]),"text-halo-blur":new ke(se.paint_symbol["text-halo-blur"]),"text-translate":new Me(se.paint_symbol["text-translate"]),"text-translate-anchor":new Me(se.paint_symbol["text-translate-anchor"])})},get layout(){return vh=vh||new hi({"symbol-placement":new Me(se.layout_symbol["symbol-placement"]),"symbol-spacing":new Me(se.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Me(se.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ke(se.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Me(se.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Me(se.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Me(se.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Me(se.layout_symbol["icon-ignore-placement"]),"icon-optional":new Me(se.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Me(se.layout_symbol["icon-rotation-alignment"]),"icon-size":new ke(se.layout_symbol["icon-size"]),"icon-text-fit":new Me(se.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Me(se.layout_symbol["icon-text-fit-padding"]),"icon-image":new ke(se.layout_symbol["icon-image"]),"icon-rotate":new ke(se.layout_symbol["icon-rotate"]),"icon-padding":new ke(se.layout_symbol["icon-padding"]),"icon-keep-upright":new Me(se.layout_symbol["icon-keep-upright"]),"icon-offset":new ke(se.layout_symbol["icon-offset"]),"icon-anchor":new ke(se.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Me(se.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Me(se.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Me(se.layout_symbol["text-rotation-alignment"]),"text-field":new ke(se.layout_symbol["text-field"]),"text-font":new ke(se.layout_symbol["text-font"]),"text-size":new ke(se.layout_symbol["text-size"]),"text-max-width":new ke(se.layout_symbol["text-max-width"]),"text-line-height":new Me(se.layout_symbol["text-line-height"]),"text-letter-spacing":new ke(se.layout_symbol["text-letter-spacing"]),"text-justify":new ke(se.layout_symbol["text-justify"]),"text-radial-offset":new ke(se.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Me(se.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ke(se.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ke(se.layout_symbol["text-anchor"]),"text-max-angle":new Me(se.layout_symbol["text-max-angle"]),"text-writing-mode":new Me(se.layout_symbol["text-writing-mode"]),"text-rotate":new ke(se.layout_symbol["text-rotate"]),"text-padding":new Me(se.layout_symbol["text-padding"]),"text-keep-upright":new Me(se.layout_symbol["text-keep-upright"]),"text-transform":new ke(se.layout_symbol["text-transform"]),"text-offset":new ke(se.layout_symbol["text-offset"]),"text-allow-overlap":new Me(se.layout_symbol["text-allow-overlap"]),"text-overlap":new Me(se.layout_symbol["text-overlap"]),"text-ignore-placement":new Me(se.layout_symbol["text-ignore-placement"]),"text-optional":new Me(se.layout_symbol["text-optional"])})}};class wh{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Gr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ie("FormatSectionOverride",wh,{omit:["defaultValue"]});class gl extends $i{constructor(e){super(e,pc)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const n=this.layout.get("text-writing-mode");if(n){const l=[];for(const u of n)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,l){const u=this.layout.get(e).evaluate(r,{},n,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||ot(d.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,b)=>f&&b in f?String(f[b]):"")}(r.properties,u)}createBucket(e){return new ta(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of pc.paint.overridableProperties){if(!gl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),n=new wh(r),l=new rn(n,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new As("source",l):new kn("composite",l,r.value.zoomStops),this.paint._values[e]=new Ni(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&gl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const n=e.get("text-field"),l=pc.paint.properties[r];let u=!1;const d=f=>{for(const _ of f)if(l.overrides&&l.overrides.hasOverride(_))return void(u=!0)};if(n.value.kind==="constant"&&n.value.value instanceof vi)d(n.value.value.sections);else if(n.value.kind==="source"){const f=x=>{u||(x instanceof Hr&&Ct(x.value)===dr?d(x.value.sections):x instanceof zn?d(x.sections):x.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Th;var Td={get paint(){return Th=Th||new hi({"background-color":new Me(se.paint_background["background-color"]),"background-pattern":new Oa(se.paint_background["background-pattern"]),"background-opacity":new Me(se.paint_background["background-opacity"])})}};class Sd extends $i{constructor(e){super(e,Td)}}let Sh;var Id={get paint(){return Sh=Sh||new hi({"raster-opacity":new Me(se.paint_raster["raster-opacity"]),"raster-hue-rotate":new Me(se.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Me(se.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Me(se.paint_raster["raster-brightness-max"]),"raster-saturation":new Me(se.paint_raster["raster-saturation"]),"raster-contrast":new Me(se.paint_raster["raster-contrast"]),"raster-resampling":new Me(se.paint_raster["raster-resampling"]),"raster-fade-duration":new Me(se.paint_raster["raster-fade-duration"])})}};class Ad extends $i{constructor(e){super(e,Id)}}class Cd extends $i{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Pd{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const fc=63710088e-1;class Ns{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ns(Or(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,n=this.lat*r,l=e.lat*r,u=Math.sin(n)*Math.sin(l)+Math.cos(n)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return fc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Ns)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ns(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ns(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Ih=2*Math.PI*fc;function Ah(i){return Ih*Math.cos(i*Math.PI/180)}function Ch(i){return(180+i)/360}function Ph(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Eh(i,e){return i/Ah(e)}function mc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class _l{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){const n=Ns.convert(e);return new _l(Ch(n.lng),Ph(n.lat),Eh(r,n.lat))}toLngLat(){return new Ns(360*this.x-180,mc(this.y))}toAltitude(){return this.z*Ah(mc(this.y))}meterInMercatorCoordinateUnits(){return 1/Ih*(e=mc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Mh(i,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class gc{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=n,this.key=uo(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){const l=(d=this.y,f=this.z,_=Mh(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=Mh(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,d,f,_,x;const b=function(w,A,P){let M,L="";for(let V=w;V>0;V--)M=1<1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new xe((e.x*r-this.x)*He,(e.y*r-this.y)*He)}toString(){return`${this.z}/${this.x}/${this.y}`}}class zh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=uo(e,r.z,r.z,r.x,r.y)}}class Gi{constructor(e,r,n,l,u){if(e= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new gc(n,+l,+u),this.key=uo(r,e,n,l,u)}clone(){return new Gi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Gi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gi(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?uo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):uo(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Gi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,l=2*this.canonical.y;return[new Gi(r,this.wrap,r,n,l),new Gi(r,this.wrap,r,n+1,l),new Gi(r,this.wrap,r,n,l+1),new Gi(r,this.wrap,r,n+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=w),w=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Zi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=n*this.dim,f=n*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(n){case-1:d=f-1;break;case 1:f=d+1}const _=-r*this.dim,x=-n*this.dim;for(let b=d;b=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Lh{constructor(e,r,n,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=l,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Rh{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new pr(He,16,0),this.grid3D=new pr(He,16,0),this.featureIndexArray=new v,this.promoteId=r}insert(e,r,n,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,l,u);const _=d?this.grid3D:this.grid;for(let x=0;x=0&&w[3]>=0&&_.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Os.VectorTile(new sc(this.rawTileData)).layers,this.sourceLayerCoder=new Dh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,l){this.loadVTLayers();const u=e.params||{},d=He/e.tileSize/e.scale,f=Rn(u.filter),_=e.queryGeometry,x=e.queryPadding*d,b=Fh(_),w=this.grid.query(b.minX-x,b.minY-x,b.maxX+x,b.maxY+x),A=Fh(e.cameraQueryGeometry),P=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(V,$,Y,j)=>function(W,ae,le,we,Ce){for(const ve of W)if(ae<=ve.x&&le<=ve.y&&we>=ve.x&&Ce>=ve.y)return!0;const be=[new xe(ae,le),new xe(ae,Ce),new xe(we,Ce),new xe(we,le)];if(W.length>2){for(const ve of be)if(Wn(W,ve))return!0}for(let ve=0;ve(j||(j=ns(W)),ae.queryIntersectsFeature(_,W,le,j,this.z,e.transform,d,e.pixelPosMatrix)))}return M}loadMatchingFeature(e,r,n,l,u,d,f,_,x,b,w){const A=this.bucketLayerIDs[r];if(d&&!function(V,$){for(let Y=0;Y=0)return!0;return!1}(d,A))return;const P=this.sourceLayerCoder.decode(n),M=this.vtLayers[P].feature(l);if(u.needGeometry){const V=as(M,!0);if(!u.filter(new ht(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!u.filter(new ht(this.tileID.overscaledZ),M))return;const L=this.getId(M,P);for(let V=0;V{const f=e instanceof ln?e.get(d):null;return f&&f.evaluate?f.evaluate(r,n,l):f})}function Fh(i){let e=1/0,r=1/0,n=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),n=Math.max(n,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:n,maxY:l}}function Ed(i,e){return e-i}function Oh(i,e,r,n,l){const u=[];for(let d=0;d=n&&w.x>=n||(b.x>=n?b=new xe(n,b.y+(n-b.x)/(w.x-b.x)*(w.y-b.y))._round():w.x>=n&&(w=new xe(n,b.y+(n-b.x)/(w.x-b.x)*(w.y-b.y))._round()),b.y>=l&&w.y>=l||(b.y>=l?b=new xe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round():w.y>=l&&(w=new xe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round()),_&&b.equals(_[_.length-1])||(_=[b],u.push(_)),_.push(w)))))}}return u}Ie("FeatureIndex",Rh,{omit:["rawTileData","sourceLayerCoder"]});class $s extends xe{constructor(e,r,n,l){super(e,r),this.angle=n,l!==void 0&&(this.segment=l)}clone(){return new $s(this.x,this.y,this.angle,this.segment)}}function Vh(i,e,r,n,l){if(e.segment===void 0||r===0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const _=[];let x=0;for(;fn;)x-=_.shift().angleDelta;if(x>l)return!1;d++,f+=b.dist(w)}return!0}function Uh(i){let e=0;for(let r=0;rx){const M=(x-_)/P,L=wi.number(w.x,A.x,M),V=wi.number(w.y,A.y,M),$=new $s(L,V,A.angleTo(w),b);return $._round(),!d||Vh(i,$,f,d,e)?$:void 0}_+=P}}function zd(i,e,r,n,l,u,d,f,_){const x=Nh(n,u,d),b=$h(n,l),w=b*d,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-w=0&&W<_&&ae>=0&&ae<_&&A-x>=0&&A+x<=b){const le=new $s(W,ae,Y,M);le._round(),n&&!Vh(i,le,u,n,l)||P.push(le)}}w+=$}return f||P.length||d||(P=jh(i,w/2,r,n,l,u,d,!0,_)),P}Ie("Anchor",$s);const ia=Ii;function qh(i,e,r,n){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*ia,_=u.paddedRect.h-2*ia,x=i.right-i.left,b=i.bottom-i.top,w=u.stretchX||[[0,f]],A=u.stretchY||[[0,_]],P=(me,Ae)=>me+Ae[1]-Ae[0],M=w.reduce(P,0),L=A.reduce(P,0),V=f-M,$=_-L;let Y=0,j=M,W=0,ae=L,le=0,we=V,Ce=0,be=$;if(u.content&&n){const me=u.content;Y=yl(w,0,me[0]),W=yl(A,0,me[1]),j=yl(w,me[0],me[2]),ae=yl(A,me[1],me[3]),le=me[0]-Y,Ce=me[1]-W,we=me[2]-me[0]-j,be=me[3]-me[1]-ae}const ve=(me,Ae,ye,pe)=>{const ze=xl(me.stretch-Y,j,x,i.left),Ee=vl(me.fixed-le,we,me.stretch,M),Ge=xl(Ae.stretch-W,ae,b,i.top),dt=vl(Ae.fixed-Ce,be,Ae.stretch,L),ft=xl(ye.stretch-Y,j,x,i.left),kt=vl(ye.fixed-le,we,ye.stretch,M),Ri=xl(pe.stretch-W,ae,b,i.top),pi=vl(pe.fixed-Ce,be,pe.stretch,L),Et=new xe(ze,Ge),jt=new xe(ft,Ge),Xt=new xe(ft,Ri),fi=new xe(ze,Ri),mi=new xe(Ee/d,dt/d),Dt=new xe(kt/d,pi/d),Lt=e*Math.PI/180;if(Lt){const ti=Math.sin(Lt),Ai=Math.cos(Lt),Ci=[Ai,-ti,ti,Ai];Et._matMult(Ci),jt._matMult(Ci),fi._matMult(Ci),Xt._matMult(Ci)}const ei=me.stretch+me.fixed,gi=Ae.stretch+Ae.fixed;return{tl:Et,tr:jt,bl:fi,br:Xt,tex:{x:u.paddedRect.x+ia+ei,y:u.paddedRect.y+ia+gi,w:ye.stretch+ye.fixed-ei,h:pe.stretch+pe.fixed-gi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:mi,pixelOffsetBR:Dt,minFontScaleX:we/d/x,minFontScaleY:be/d/b,isSDF:r}};if(n&&(u.stretchX||u.stretchY)){const me=Zh(w,V,M),Ae=Zh(A,$,L);for(let ye=0;ye0&&(M=Math.max(10,M),this.circleDiameter=M)}else{let w=d.top*f-_[0],A=d.bottom*f+_[2],P=d.left*f-_[3],M=d.right*f+_[1];const L=d.collisionPadding;if(L&&(P-=L[0]*f,w-=L[1]*f,M+=L[2]*f,A+=L[3]*f),b){const V=new xe(P,w),$=new xe(M,w),Y=new xe(P,A),j=new xe(M,A),W=b*Math.PI/180;V._rotate(W),$._rotate(W),Y._rotate(W),j._rotate(W),P=Math.min(V.x,$.x,Y.x,j.x),M=Math.max(V.x,$.x,Y.x,j.x),w=Math.min(V.y,$.y,Y.y,j.y),A=Math.max(V.y,$.y,Y.y,j.y)}e.emplaceBack(r.x,r.y,P,w,M,A,n,l,u)}this.boxEndIndex=e.length}}class kd{constructor(e=[],r=Dd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:n}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(n(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:n}=this,l=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=d}r[e]=u}}function Dd(i,e){return ie?1:0}function Ld(i,e=1,r=!1){let n=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let P=0;Pu)&&(u=M.x),(!P||M.y>d)&&(d=M.y)}const _=Math.min(u-n,d-l);let x=_/2;const b=new kd([],Rd);if(_===0)return new xe(n,l);for(let P=n;Pw.d||!w.d)&&(w=P,r&&console.log("found best %d after %d probes",Math.round(1e4*P.d)/1e4,A)),P.max-w.d<=e||(x=P.h/2,b.push(new ra(P.p.x-x,P.p.y-x,x,i)),b.push(new ra(P.p.x+x,P.p.y-x,x,i)),b.push(new ra(P.p.x-x,P.p.y+x,x,i)),b.push(new ra(P.p.x+x,P.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${w.d}`)),w.p}function Rd(i,e){return e.max-i.max}function ra(i,e,r,n){this.p=new xe(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let _=0;_l.y!=M.y>l.y&&l.x<(M.x-P.x)*(l.y-P.y)/(M.y-P.y)+P.x&&(d=!d),f=Math.min(f,Pc(l,P,M))}}return(d?1:-1)*Math.sqrt(f)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Wt;k.ap=void 0,(Wt=k.ap||(k.ap={}))[Wt.center=1]="center",Wt[Wt.left=2]="left",Wt[Wt.right=3]="right",Wt[Wt.top=4]="top",Wt[Wt.bottom=5]="bottom",Wt[Wt["top-left"]=6]="top-left",Wt[Wt["top-right"]=7]="top-right",Wt[Wt["bottom-left"]=8]="bottom-left",Wt[Wt["bottom-right"]=9]="bottom-right";const js=7,_c=Number.POSITIVE_INFINITY;function Gh(i,e){return e[1]!==_c?function(r,n,l){let u=0,d=0;switch(n=Math.abs(n),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-js;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+js}switch(r){case"top-right":case"bottom-right":case"right":u=-n;break;case"top-left":case"bottom-left":case"left":u=n}return[u,d]}(i,e[0],e[1]):function(r,n){let l=0,u=0;n<0&&(n=0);const d=n/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-js;break;case"bottom-right":case"bottom-left":u=-d+js;break;case"bottom":u=-n+js;break;case"top":u=n-js}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=n;break;case"right":l=-n}return[l,u]}(i,e[0])}function Hh(i,e,r){var n;const l=i.layout,u=(n=l.get("text-variable-anchor-offset"))===null||n===void 0?void 0:n.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let x=0;xA*zt);b.startsWith("top")?w[1]-=js:b.startsWith("bottom")&&(w[1]+=js),_[x+1]=w}return new Gt(_)}const d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*zt,_c]:l.get("text-offset").evaluate(e,{},r).map(x=>x*zt);const _=[];for(const x of d)_.push(x,Gh(x,f));return new Gt(_)}return null}function yc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bd(i,e,r,n,l,u,d,f,_,x,b){let w=u.textMaxSize.evaluate(e,{});w===void 0&&(w=d);const A=i.layers[0].layout,P=A.get("icon-offset").evaluate(e,{},b),M=Xh(r.horizontal),L=d/24,V=i.tilePixelRatio*L,$=i.tilePixelRatio*w/24,Y=i.tilePixelRatio*f,j=i.tilePixelRatio*A.get("symbol-spacing"),W=A.get("text-padding")*i.tilePixelRatio,ae=function(pe,ze,Ee,Ge=1){const dt=pe.get("icon-padding").evaluate(ze,{},Ee),ft=dt&&dt.values;return[ft[0]*Ge,ft[1]*Ge,ft[2]*Ge,ft[3]*Ge]}(A,e,b,i.tilePixelRatio),le=A.get("text-max-angle")/180*Math.PI,we=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ce=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",be=A.get("symbol-placement"),ve=j/2,me=A.get("icon-text-fit");let Ae;n&&me!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ae=yh(n,r.vertical,me,A.get("icon-text-fit-padding"),P,L)),M&&(n=yh(n,M,me,A.get("icon-text-fit-padding"),P,L)));const ye=(pe,ze)=>{ze.x<0||ze.x>=He||ze.y<0||ze.y>=He||function(Ee,Ge,dt,ft,kt,Ri,pi,Et,jt,Xt,fi,mi,Dt,Lt,ei,gi,ti,Ai,Ci,Rt,Xe,ii,Kt,Bt,or){const mr=Ee.addToLineVertexArray(Ge,dt);let gr,cs,lr,Hi,Pi=0,hs=0,mo=0,Qh=0,Ac=-1,Cc=-1;const us={};let eu=Ze("");if(Ee.allowVerticalPlacement&&ft.vertical){const ri=Et.layout.get("text-rotate").evaluate(Xe,{},Bt)+90;lr=new bl(jt,Ge,Xt,fi,mi,ft.vertical,Dt,Lt,ei,ri),pi&&(Hi=new bl(jt,Ge,Xt,fi,mi,pi,ti,Ai,ei,ri))}if(kt){const ri=Et.layout.get("icon-rotate").evaluate(Xe,{}),Wi=Et.layout.get("icon-text-fit")!=="none",gn=qh(kt,ri,Kt,Wi),yr=pi?qh(pi,ri,Kt,Wi):void 0;cs=new bl(jt,Ge,Xt,fi,mi,kt,ti,Ai,!1,ri),Pi=4*gn.length;const _n=Ee.iconSizeData;let Lr=null;_n.kind==="source"?(Lr=[Dr*Et.layout.get("icon-size").evaluate(Xe,{})],Lr[0]>Us&&qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${ho}. Reduce your "icon-size".`)):_n.kind==="composite"&&(Lr=[Dr*ii.compositeIconSizes[0].evaluate(Xe,{},Bt),Dr*ii.compositeIconSizes[1].evaluate(Xe,{},Bt)],(Lr[0]>Us||Lr[1]>Us)&&qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${ho}. Reduce your "icon-size".`)),Ee.addSymbols(Ee.icon,gn,Lr,Rt,Ci,Xe,k.ah.none,Ge,mr.lineStartIndex,mr.lineLength,-1,Bt),Ac=Ee.icon.placedSymbolArray.length-1,yr&&(hs=4*yr.length,Ee.addSymbols(Ee.icon,yr,Lr,Rt,Ci,Xe,k.ah.vertical,Ge,mr.lineStartIndex,mr.lineLength,-1,Bt),Cc=Ee.icon.placedSymbolArray.length-1)}const tu=Object.keys(ft.horizontal);for(const ri of tu){const Wi=ft.horizontal[ri];if(!gr){eu=Ze(Wi.text);const yr=Et.layout.get("text-rotate").evaluate(Xe,{},Bt);gr=new bl(jt,Ge,Xt,fi,mi,Wi,Dt,Lt,ei,yr)}const gn=Wi.positionedLines.length===1;if(mo+=Wh(Ee,Ge,Wi,Ri,Et,ei,Xe,gi,mr,ft.vertical?k.ah.horizontal:k.ah.horizontalOnly,gn?tu:[ri],us,Ac,ii,Bt),gn)break}ft.vertical&&(Qh+=Wh(Ee,Ge,ft.vertical,Ri,Et,ei,Xe,gi,mr,k.ah.vertical,["vertical"],us,Cc,ii,Bt));const Vd=gr?gr.boxStartIndex:Ee.collisionBoxArray.length,Ud=gr?gr.boxEndIndex:Ee.collisionBoxArray.length,Nd=lr?lr.boxStartIndex:Ee.collisionBoxArray.length,$d=lr?lr.boxEndIndex:Ee.collisionBoxArray.length,jd=cs?cs.boxStartIndex:Ee.collisionBoxArray.length,qd=cs?cs.boxEndIndex:Ee.collisionBoxArray.length,Zd=Hi?Hi.boxStartIndex:Ee.collisionBoxArray.length,Gd=Hi?Hi.boxEndIndex:Ee.collisionBoxArray.length;let _r=-1;const Tl=(ri,Wi)=>ri&&ri.circleDiameter?Math.max(ri.circleDiameter,Wi):Wi;_r=Tl(gr,_r),_r=Tl(lr,_r),_r=Tl(cs,_r),_r=Tl(Hi,_r);const iu=_r>-1?1:0;iu&&(_r*=or/zt),Ee.glyphOffsetArray.length>=ta.MAX_GLYPHS&&qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Xe.sortKey!==void 0&&Ee.addToSortKeyRanges(Ee.symbolInstances.length,Xe.sortKey);const Hd=Hh(Et,Xe,Bt),[Wd,Xd]=function(ri,Wi){const gn=ri.length,yr=Wi?.values;if(yr?.length>0)for(let _n=0;_n=0?us.right:-1,us.center>=0?us.center:-1,us.left>=0?us.left:-1,us.vertical||-1,Ac,Cc,eu,Vd,Ud,Nd,$d,jd,qd,Zd,Gd,Xt,mo,Qh,Pi,hs,iu,0,Dt,_r,Wd,Xd)}(i,ze,pe,r,n,l,Ae,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,V,[W,W,W,W],we,_,Y,ae,Ce,P,e,u,x,b,d)};if(be==="line")for(const pe of Oh(e.geometry,0,0,He,He)){const ze=zd(pe,j,le,r.vertical||M,n,24,$,i.overscaling,He);for(const Ee of ze)M&&Fd(i,M.text,ve,Ee)||ye(pe,Ee)}else if(be==="line-center"){for(const pe of e.geometry)if(pe.length>1){const ze=Md(pe,le,r.vertical||M,n,24,$);ze&&ye(pe,ze)}}else if(e.type==="Polygon")for(const pe of Kl(e.geometry,0)){const ze=Ld(pe,16);ye(pe[0],new $s(ze.x,ze.y,0))}else if(e.type==="LineString")for(const pe of e.geometry)ye(pe,new $s(pe[0].x,pe[0].y,0));else if(e.type==="Point")for(const pe of e.geometry)for(const ze of pe)ye([ze],new $s(ze.x,ze.y,0))}function Wh(i,e,r,n,l,u,d,f,_,x,b,w,A,P,M){const L=function(Y,j,W,ae,le,we,Ce,be){const ve=ae.layout.get("text-rotate").evaluate(we,{})*Math.PI/180,me=[];for(const Ae of j.positionedLines)for(const ye of Ae.positionedGlyphs){if(!ye.rect)continue;const pe=ye.rect||{};let ze=uh+1,Ee=!0,Ge=1,dt=0;const ft=(le||be)&&ye.vertical,kt=ye.metrics.advance*ye.scale/2;if(be&&j.verticalizable&&(dt=Ae.lineOffset/2-(ye.imageName?-(zt-ye.metrics.width*ye.scale)/2:(ye.scale-1)*zt)),ye.imageName){const Rt=Ce[ye.imageName];Ee=Rt.sdf,Ge=Rt.pixelRatio,ze=Ii/Ge}const Ri=le?[ye.x+kt,ye.y]:[0,0];let pi=le?[0,0]:[ye.x+kt+W[0],ye.y+W[1]-dt],Et=[0,0];ft&&(Et=pi,pi=[0,0]);const jt=ye.metrics.isDoubleResolution?2:1,Xt=(ye.metrics.left-ze)*ye.scale-kt+pi[0],fi=(-ye.metrics.top-ze)*ye.scale+pi[1],mi=Xt+pe.w/jt*ye.scale/Ge,Dt=fi+pe.h/jt*ye.scale/Ge,Lt=new xe(Xt,fi),ei=new xe(mi,fi),gi=new xe(Xt,Dt),ti=new xe(mi,Dt);if(ft){const Rt=new xe(-kt,kt-lo),Xe=-Math.PI/2,ii=zt/2-kt,Kt=new xe(5-lo-ii,-(ye.imageName?ii:0)),Bt=new xe(...Et);Lt._rotateAround(Xe,Rt)._add(Kt)._add(Bt),ei._rotateAround(Xe,Rt)._add(Kt)._add(Bt),gi._rotateAround(Xe,Rt)._add(Kt)._add(Bt),ti._rotateAround(Xe,Rt)._add(Kt)._add(Bt)}if(ve){const Rt=Math.sin(ve),Xe=Math.cos(ve),ii=[Xe,-Rt,Rt,Xe];Lt._matMult(ii),ei._matMult(ii),gi._matMult(ii),ti._matMult(ii)}const Ai=new xe(0,0),Ci=new xe(0,0);me.push({tl:Lt,tr:ei,bl:gi,br:ti,tex:pe,writingMode:j.writingMode,glyphOffset:Ri,sectionIndex:ye.sectionIndex,isSDF:Ee,pixelOffsetTL:Ai,pixelOffsetBR:Ci,minFontScaleX:0,minFontScaleY:0})}return me}(0,r,f,l,u,d,n,i.allowVerticalPlacement),V=i.textSizeData;let $=null;V.kind==="source"?($=[Dr*l.layout.get("text-size").evaluate(d,{})],$[0]>Us&&qt(`${i.layerIds[0]}: Value for "text-size" is >= ${ho}. Reduce your "text-size".`)):V.kind==="composite"&&($=[Dr*P.compositeTextSizes[0].evaluate(d,{},M),Dr*P.compositeTextSizes[1].evaluate(d,{},M)],($[0]>Us||$[1]>Us)&&qt(`${i.layerIds[0]}: Value for "text-size" is >= ${ho}. Reduce your "text-size".`)),i.addSymbols(i.text,L,$,f,u,d,x,e,_.lineStartIndex,_.lineLength,A,M);for(const Y of b)w[Y]=i.text.placedSymbolArray.length-1;return 4*L.length}function Xh(i){for(const e in i)return i[e];return null}function Fd(i,e,r,n){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(n.dist(u[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Kh[15&n];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new xc(f,d,u,e)}constructor(e,r=64,n=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Kh.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return vc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const b=_.pop()||0,w=_.pop()||0,A=_.pop()||0;if(w-A<=f){for(let V=A;V<=w;V++){const $=d[2*V],Y=d[2*V+1];$>=e&&$<=n&&Y>=r&&Y<=l&&x.push(u[V])}continue}const P=A+w>>1,M=d[2*P],L=d[2*P+1];M>=e&&M<=n&&L>=r&&L<=l&&x.push(u[P]),(b===0?e<=M:r<=L)&&(_.push(A),_.push(P-1),_.push(1-b)),(b===0?n>=M:l>=L)&&(_.push(P+1),_.push(w),_.push(1-b))}return x}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],_=[],x=n*n;for(;f.length;){const b=f.pop()||0,w=f.pop()||0,A=f.pop()||0;if(w-A<=d){for(let V=A;V<=w;V++)Jh(u[2*V],u[2*V+1],e,r)<=x&&_.push(l[V]);continue}const P=A+w>>1,M=u[2*P],L=u[2*P+1];Jh(M,L,e,r)<=x&&_.push(l[P]),(b===0?e-n<=M:r-n<=L)&&(f.push(A),f.push(P-1),f.push(1-b)),(b===0?e+n>=M:r+n>=L)&&(f.push(P+1),f.push(w),f.push(1-b))}return _}}function vc(i,e,r,n,l,u){if(l-n<=r)return;const d=n+l>>1;Yh(i,e,d,n,l,u),vc(i,e,r,n,d-1,1-u),vc(i,e,r,d+1,l,1-u)}function Yh(i,e,r,n,l,u){for(;l>n;){if(l-n>600){const x=l-n+1,b=r-n+1,w=Math.log(x),A=.5*Math.exp(2*w/3),P=.5*Math.sqrt(w*A*(x-A)/x)*(b-x/2<0?-1:1);Yh(i,e,r,Math.max(n,Math.floor(r-b*A/x+P)),Math.min(l,Math.floor(r+(x-b)*A/x+P)),u)}const d=e[2*r+u];let f=n,_=l;for(po(i,e,n,r),e[2*l+u]>d&&po(i,e,n,l);f<_;){for(po(i,e,f,_),f++,_--;e[2*f+u]d;)_--}e[2*n+u]===d?po(i,e,n,_):(_++,po(i,e,_,l)),_<=r&&(n=_+1),r<=_&&(l=_-1)}}function po(i,e,r,n){bc(i,r,n),bc(e,2*r,2*n),bc(e,2*r+1,2*n+1)}function bc(i,e,r){const n=i[e];i[e]=i[r],i[r]=n}function Jh(i,e,r,n){const l=i-r,u=e-n;return l*l+u*u}var wc;k.bd=void 0,(wc=k.bd||(k.bd={})).create="create",wc.load="load",wc.fullLoad="fullLoad";let wl=null,fo=[];const Tc=1e3/60,Sc="loadTime",Ic="fullLoadTime",Od={mark(i){performance.mark(i)},frame(i){const e=i;wl!=null&&fo.push(e-wl),wl=e},clearMetrics(){wl=null,fo=[],performance.clearMeasures(Sc),performance.clearMeasures(Ic);for(const i in k.bd)performance.clearMarks(k.bd[i])},getPerformanceMetrics(){performance.measure(Sc,k.bd.create,k.bd.load),performance.measure(Ic,k.bd.create,k.bd.fullLoad);const i=performance.getEntriesByName(Sc)[0].duration,e=performance.getEntriesByName(Ic)[0].duration,r=fo.length,n=1/(fo.reduce((u,d)=>u+d,0)/r/1e3),l=fo.filter(u=>u>Tc).reduce((u,d)=>u+(d-Tc)/Tc,0);return{loadTime:i,fullLoadTime:e,fps:n,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};k.$=ue,k.A=Xn,k.B=function(i){if(ds==null){const e=i.navigator?i.navigator.userAgent:null;ds=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ds},k.C=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Pd(()=>this.process()),this.subscription=function(r,n,l,u){return r.addEventListener(n,l,!1),{unsubscribe:()=>{r.removeEventListener(n,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=hr(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,n)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:n},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const f={id:l,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});const u=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Qr(i.data,u)});this.target.postMessage(d,{transfer:u})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];const n=this.abortControllers[r];return delete this.abortControllers[r],void(n&&n.abort())}if(hr(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return p(this,void 0,void 0,function*(){if(e.type===""){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(Ds(e.error)):l.resolve(Ds(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ds(e.data),n=new AbortController;this.abortControllers[i]=n;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,n);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const n=[];delete this.abortControllers[i];const l={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Qr(e):null,data:Qr(r,n)};this.target.postMessage(l,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},k.D=Me,k.E=jr,k.F=function(){var i=new Xn(16);return Xn!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},k.G=Oi,k.H=function(i,e,r){var n,l,u,d,f,_,x,b,w,A,P,M,L=r[0],V=r[1],$=r[2];return e===i?(i[12]=e[0]*L+e[4]*V+e[8]*$+e[12],i[13]=e[1]*L+e[5]*V+e[9]*$+e[13],i[14]=e[2]*L+e[6]*V+e[10]*$+e[14],i[15]=e[3]*L+e[7]*V+e[11]*$+e[15]):(l=e[1],u=e[2],d=e[3],f=e[4],_=e[5],x=e[6],b=e[7],w=e[8],A=e[9],P=e[10],M=e[11],i[0]=n=e[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=x,i[7]=b,i[8]=w,i[9]=A,i[10]=P,i[11]=M,i[12]=n*L+f*V+w*$+e[12],i[13]=l*L+_*V+A*$+e[13],i[14]=u*L+x*V+P*$+e[14],i[15]=d*L+b*V+M*$+e[15]),i},k.I=ac,k.J=function(i,e,r){var n=r[0],l=r[1],u=r[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},k.K=kc,k.L=function(i,e){const r={};for(let n=0;n{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const n of i){const l=window.document.createElement("source");xn(n)||(e.crossOrigin="Anonymous"),l.src=n,e.appendChild(l)}})},k.a3=function(){return Vr++},k.a4=Qo,k.a5=ta,k.a6=Rn,k.a7=as,k.a8=ht,k.a9=Lh,k.aA=si,k.aB=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!Ke(i.version,e.version))return[{command:"setStyle",args:[e]}];Ke(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),Ke(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),Ke(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),Ke(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),Ke(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),Ke(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),Ke(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),Ke(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),Ke(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),Ke(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]});const n={},l=[];(function(d,f,_,x){let b;for(b in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,b)&&(Object.prototype.hasOwnProperty.call(f,b)||fs(b,_,x));for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(Object.prototype.hasOwnProperty.call(d,b)?Ke(d[b],f[b])||(d[b].type==="geojson"&&f[b].type==="geojson"&&gs(d,f,b)?Nt(_,{command:"setGeoJSONSourceData",args:[b,f[b].data]}):ms(b,f,_,x)):er(b,f,_))})(i.sources,e.sources,l,n);const u=[];i.layers&&i.layers.forEach(d=>{"source"in d&&n[d.source]?r.push({command:"removeLayer",args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,_){f=f||[];const x=(d=d||[]).map(_s),b=f.map(_s),w=d.reduce(Hs,{}),A=f.reduce(Hs,{}),P=x.slice(),M=Object.create(null);let L,V,$,Y,j;for(let W=0,ae=0;W@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,n,l,u)=>{const d=l||u;return e[n]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},k.ab=function(i,e){const r=[];for(const n in i)n in e||r.push(n);return r},k.ac=Yi,k.ad=function(i,e,r){var n=Math.sin(r),l=Math.cos(r),u=e[0],d=e[1],f=e[2],_=e[3],x=e[4],b=e[5],w=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+x*n,i[1]=d*l+b*n,i[2]=f*l+w*n,i[3]=_*l+A*n,i[4]=x*l-u*n,i[5]=b*l-d*n,i[6]=w*l-f*n,i[7]=A*l-_*n,i},k.ae=function(i){var e=new Xn(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},k.af=al,k.ag=function(i,e){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Yi(Qt.interpolationFactor(l,e,u,d),0,1):0;i.kind==="camera"?n=wi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:n}},k.ai=function(i,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:l}){return i.kind==="source"?n/Dr:i.kind==="composite"?wi.number(n/Dr,l/Dr,r):e},k.aj=hc,k.ak=function(i,e,r,n){const l=e.y-i.y,u=e.x-i.x,d=n.y-r.y,f=n.x-r.x,_=d*u-f*l;if(_===0)return null;const x=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new xe(i.x+x*u,i.y+x*l)},k.al=Oh,k.am=os,k.an=jl,k.ao=zt,k.aq=cc,k.ar=function(i,e){var r=e[0],n=e[1],l=e[2],u=e[3],d=e[4],f=e[5],_=e[6],x=e[7],b=e[8],w=e[9],A=e[10],P=e[11],M=e[12],L=e[13],V=e[14],$=e[15],Y=r*f-n*d,j=r*_-l*d,W=r*x-u*d,ae=n*_-l*f,le=n*x-u*f,we=l*x-u*_,Ce=b*L-w*M,be=b*V-A*M,ve=b*$-P*M,me=w*V-A*L,Ae=w*$-P*L,ye=A*$-P*V,pe=Y*ye-j*Ae+W*me+ae*ve-le*be+we*Ce;return pe?(i[0]=(f*ye-_*Ae+x*me)*(pe=1/pe),i[1]=(l*Ae-n*ye-u*me)*pe,i[2]=(L*we-V*le+$*ae)*pe,i[3]=(A*le-w*we-P*ae)*pe,i[4]=(_*ve-d*ye-x*be)*pe,i[5]=(r*ye-l*ve+u*be)*pe,i[6]=(V*W-M*we-$*j)*pe,i[7]=(b*we-A*W+P*j)*pe,i[8]=(d*Ae-f*ve+x*Ce)*pe,i[9]=(n*ve-r*Ae-u*Ce)*pe,i[10]=(M*le-L*W+$*Y)*pe,i[11]=(w*W-b*le-P*Y)*pe,i[12]=(f*be-d*me-_*Ce)*pe,i[13]=(r*me-n*be+l*Ce)*pe,i[14]=(L*j-M*ae-V*Y)*pe,i[15]=(b*ae-w*j+A*Y)*pe,i):null},k.as=yc,k.at=lc,k.au=xc,k.av=function(){const i={},e=se.$version;for(const r in se.$root){const n=se.$root[r];if(n.required){let l=null;l=r==="version"?e:n.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},k.aw=ka,k.ax=ps,k.ay=function(i){i=i.slice();const e=Object.create(null);for(let r=0;rpe*zt)}let be=d?"center":r.get("text-justify").evaluate(x,{},i.canonical);const ve=r.get("symbol-placement"),me=ve==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*zt:0,Ae=()=>{i.bucket.allowVerticalPlacement&&on(W)&&(M.vertical=pl(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,me,u,we,"left",le,$,k.ah.vertical,!0,ve,A,w))};if(!d&&Ce){const ye=new Set;if(be==="auto")for(let ze=0;zep(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),k.e=Mi,k.f=i=>new Promise((e,r)=>{const n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=Zs})},n.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?URL.createObjectURL(l):Zs}),k.g=ur,k.h=(i,e)=>Tr(Mi(i,{type:"json"}),e),k.i=hr,k.j=Mt,k.k=Ar,k.l=(i,e)=>Tr(Mi(i,{type:"arrayBuffer"}),e),k.m=Tr,k.n=function(i){return new sc(i).readFields(pd,[])},k.o=eo,k.p=dh,k.q=hi,k.r=Ea,k.s=xn,k.t=Go,k.u=Te,k.v=se,k.w=qt,k.x=ks,k.y=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},k.z=wi}),Br("worker",["./shared"],function(k){class p{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,C){for(const R of I){this._layerConfigs[R.id]=R;const G=this._layers[R.id]=k.az(R);G._featureFilter=k.a6(G.filter),this.keyCache[R.id]&&delete this.keyCache[R.id]}for(const R of C)delete this.keyCache[R],delete this._layerConfigs[R],delete this._layers[R];this.familiesBySource={};const z=k.bh(Object.values(this._layerConfigs),this.keyCache);for(const R of z){const G=R.map(ne=>this._layers[ne.id]),H=G[0];if(H.visibility==="none")continue;const K=H.source||"";let q=this.familiesBySource[K];q||(q=this.familiesBySource[K]={});const J=H.sourceLayer||"_geojsonTileLayer";let he=q[J];he||(he=q[J]=[]),he.push(G)}}}class Ei{constructor(I){const C={},z=[];for(const K in I){const q=I[K],J=C[K]={};for(const he in q){const ne=q[+he];if(!ne||ne.bitmap.width===0||ne.bitmap.height===0)continue;const oe={x:0,y:0,w:ne.bitmap.width+2,h:ne.bitmap.height+2};z.push(oe),J[he]={rect:oe,metrics:ne.metrics}}}const{w:R,h:G}=k.p(z),H=new k.o({width:R||1,height:G||1});for(const K in I){const q=I[K];for(const J in q){const he=q[+J];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const ne=C[K][J].rect;k.o.copy(he.bitmap,H,{x:0,y:0},{x:ne.x+1,y:ne.y+1},he.bitmap)}}this.image=H,this.positions=C}}k.bi("GlyphAtlas",Ei);class Xi{constructor(I){this.tileID=new k.Q(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId,this.inFlightDependencies=[]}parse(I,C,z,R){return k._(this,void 0,void 0,function*(){this.status="parsing",this.data=I,this.collisionBoxArray=new k.a4;const G=new k.bj(Object.keys(I.layers).sort()),H=new k.bk(this.tileID,this.promoteId);H.bucketLayerIDs=[];const K={},q={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:z},J=C.familiesBySource[this.source];for(const Ne in J){const gt=I.layers[Ne];if(!gt)continue;gt.version===1&&k.w(`Vector tile source "${this.source}" layer "${Ne}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ft=G.encode(Ne),li=[];for(let Zt=0;Zt=Jt.maxzoom||Jt.visibility!=="none"&&(Yt(Zt,this.zoom,z),(K[Jt.id]=Jt.createBucket({index:H.bucketLayerIDs.length,layers:Zt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ft,sourceID:this.source})).populate(li,q,this.tileID.canonical),H.bucketLayerIDs.push(Zt.map(xi=>xi.id)))}}const he=k.aE(q.glyphDependencies,Ne=>Object.keys(Ne).map(Number));this.inFlightDependencies.forEach(Ne=>Ne?.abort()),this.inFlightDependencies=[];let ne=Promise.resolve({});if(Object.keys(he).length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),ne=R.sendAsync({type:"getGlyphs",data:{stacks:he,source:this.source,tileID:this.tileID,type:"glyphs"}},Ne)}const oe=Object.keys(q.iconDependencies);let Pe=Promise.resolve({});if(oe.length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),Pe=R.sendAsync({type:"getImages",data:{icons:oe,source:this.source,tileID:this.tileID,type:"icons"}},Ne)}const Re=Object.keys(q.patternDependencies);let De=Promise.resolve({});if(Re.length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),De=R.sendAsync({type:"getImages",data:{icons:Re,source:this.source,tileID:this.tileID,type:"patterns"}},Ne)}const[Ye,Fe,ct]=yield Promise.all([ne,Pe,De]),st=new Ei(Ye),Tt=new k.bl(Fe,ct);for(const Ne in K){const gt=K[Ne];gt instanceof k.a5?(Yt(gt.layers,this.zoom,z),k.bm({bucket:gt,glyphMap:Ye,glyphPositions:st.positions,imageMap:Fe,imagePositions:Tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):gt.hasPattern&&(gt instanceof k.bn||gt instanceof k.bo||gt instanceof k.bp)&&(Yt(gt.layers,this.zoom,z),gt.addFeatures(q,this.tileID.canonical,Tt.patternPositions))}return this.status="done",{buckets:Object.values(K).filter(Ne=>!Ne.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:st.image,imageAtlas:Tt,glyphMap:this.returnDependencies?Ye:null,iconMap:this.returnDependencies?Fe:null,glyphPositions:this.returnDependencies?st.positions:null}})}}function Yt(F,I,C){const z=new k.a8(I);for(const R of F)R.recalculate(z,C)}class xe{constructor(I,C,z){this.actor=I,this.layerIndex=C,this.availableImages=z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(I,C){return k._(this,void 0,void 0,function*(){const z=yield k.l(I.request,C);try{return{vectorTile:new k.bq.VectorTile(new k.br(z.data)),rawData:z.data,cacheControl:z.cacheControl,expires:z.expires}}catch(R){const G=new Uint8Array(z.data);let H=`Unable to parse the tile at ${I.request.url}, `;throw H+=G[0]===31&&G[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${R.messge}`,new Error(H)}})}loadTile(I){return k._(this,void 0,void 0,function*(){const C=I.uid,z=!!(I&&I.request&&I.request.collectResourceTiming)&&new k.bs(I.request),R=new Xi(I);this.loading[C]=R;const G=new AbortController;R.abort=G;try{const H=yield this.loadVectorTile(I,G);if(delete this.loading[C],!H)return null;const K=H.rawData,q={};H.expires&&(q.expires=H.expires),H.cacheControl&&(q.cacheControl=H.cacheControl);const J={};if(z){const ne=z.finish();ne&&(J.resourceTiming=JSON.parse(JSON.stringify(ne)))}R.vectorTile=H.vectorTile;const he=R.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[C]=R,this.fetching[C]={rawTileData:K,cacheControl:q,resourceTiming:J};try{const ne=yield he;return k.e({rawTileData:K.slice(0)},ne,q,J)}finally{delete this.fetching[C]}}catch(H){throw delete this.loading[C],R.status="done",this.loaded[C]=R,H}})}reloadTile(I){return k._(this,void 0,void 0,function*(){const C=I.uid;if(!this.loaded||!this.loaded[C])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const z=this.loaded[C];if(z.showCollisionBoxes=I.showCollisionBoxes,z.status==="parsing"){const R=yield z.parse(z.vectorTile,this.layerIndex,this.availableImages,this.actor);let G;if(this.fetching[C]){const{rawTileData:H,cacheControl:K,resourceTiming:q}=this.fetching[C];delete this.fetching[C],G=k.e({rawTileData:H.slice(0)},R,K,q)}else G=R;return G}if(z.status==="done"&&z.vectorTile)return z.parse(z.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(I){return k._(this,void 0,void 0,function*(){const C=this.loading,z=I.uid;C&&C[z]&&C[z].abort&&(C[z].abort.abort(),delete C[z])})}removeTile(I){return k._(this,void 0,void 0,function*(){this.loaded&&this.loaded[I.uid]&&delete this.loaded[I.uid]})}}class re{constructor(){this.loaded={}}loadTile(I){return k._(this,void 0,void 0,function*(){const{uid:C,encoding:z,rawImageData:R,redFactor:G,greenFactor:H,blueFactor:K,baseShift:q}=I,J=R.width+2,he=R.height+2,ne=k.b(R)?new k.R({width:J,height:he},yield k.bt(R,-1,-1,J,he)):R,oe=new k.bu(C,ne,z,G,H,K,q);return this.loaded=this.loaded||{},this.loaded[C]=oe,oe})}removeTile(I){const C=this.loaded,z=I.uid;C&&C[z]&&delete C[z]}}function Fr(F,I){if(F.length!==0){xr(F[0],I);for(var C=1;C=Math.abs(K)?C-q+K:K-q+C,C=q}C+z>=0!=!!I&&F.reverse()}var Ki=k.bv(function F(I,C){var z,R=I&&I.type;if(R==="FeatureCollection")for(z=0;z>31}function Ur(F,I){for(var C=F.loadGeometry(),z=F.type,R=0,G=0,H=C.length,K=0;KF},Zs=Math.fround||(wr=new Float32Array(1),F=>(wr[0]=+F,wr[0]));var wr;const ni=3,ai=5,Nr=6;class Qi{constructor(I){this.options=Object.assign(Object.create(Ji),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:C,minZoom:z,maxZoom:R}=this.options;C&&console.time("total time");const G=`prepare ${I.length} points`;C&&console.time(G),this.points=I;const H=[];for(let q=0;q=z;q--){const J=+Date.now();K=this.trees[q]=this._createTree(this._cluster(K,q)),C&&console.log("z%d: %d clusters in %dms",q,K.numItems,+Date.now()-J)}return C&&console.timeEnd("total time"),this}getClusters(I,C){let z=((I[0]+180)%360+360)%360-180;const R=Math.max(-90,Math.min(90,I[1]));let G=I[2]===180?180:((I[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)z=-180,G=180;else if(z>G){const ne=this.getClusters([z,R,180,H],C),oe=this.getClusters([-180,R,G,H],C);return ne.concat(oe)}const K=this.trees[this._limitZoom(C)],q=K.range(Oi(z),Vi(H),Oi(G),Vi(R)),J=K.data,he=[];for(const ne of q){const oe=this.stride*ne;he.push(J[oe+ai]>1?$r(J,oe,this.clusterProps):this.points[J[oe+ni]])}return he}getChildren(I){const C=this._getOriginId(I),z=this._getOriginZoom(I),R="No cluster with the specified id.",G=this.trees[z];if(!G)throw new Error(R);const H=G.data;if(C*this.stride>=H.length)throw new Error(R);const K=this.options.radius/(this.options.extent*Math.pow(2,z-1)),q=G.within(H[C*this.stride],H[C*this.stride+1],K),J=[];for(const he of q){const ne=he*this.stride;H[ne+4]===I&&J.push(H[ne+ai]>1?$r(H,ne,this.clusterProps):this.points[H[ne+ni]])}if(J.length===0)throw new Error(R);return J}getLeaves(I,C,z){const R=[];return this._appendLeaves(R,I,C=C||10,z=z||0,0),R}getTile(I,C,z){const R=this.trees[this._limitZoom(I)],G=Math.pow(2,I),{extent:H,radius:K}=this.options,q=K/H,J=(z-q)/G,he=(z+1+q)/G,ne={features:[]};return this._addTileFeatures(R.range((C-q)/G,J,(C+1+q)/G,he),R.data,C,z,G,ne),C===0&&this._addTileFeatures(R.range(1-q/G,J,1,he),R.data,G,z,G,ne),C===G-1&&this._addTileFeatures(R.range(0,J,q/G,he),R.data,-1,z,G,ne),ne.features.length?ne:null}getClusterExpansionZoom(I){let C=this._getOriginZoom(I)-1;for(;C<=this.options.maxZoom;){const z=this.getChildren(I);if(C++,z.length!==1)break;I=z[0].properties.cluster_id}return C}_appendLeaves(I,C,z,R,G){const H=this.getChildren(C);for(const K of H){const q=K.properties;if(q&&q.cluster?G+q.point_count<=R?G+=q.point_count:G=this._appendLeaves(I,q.cluster_id,z,R,G):G1;let he,ne,oe;if(J)he=ur(C,q,this.clusterProps),ne=C[q],oe=C[q+1];else{const De=this.points[C[q+ni]];he=De.properties;const[Ye,Fe]=De.geometry.coordinates;ne=Oi(Ye),oe=Vi(Fe)}const Pe={type:1,geometry:[[Math.round(this.options.extent*(ne*G-z)),Math.round(this.options.extent*(oe*G-R))]],tags:he};let Re;Re=J||this.options.generateId?C[q+ni]:this.points[C[q+ni]].id,Re!==void 0&&(Pe.id=Re),H.features.push(Pe)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,C){const{radius:z,extent:R,reduce:G,minPoints:H}=this.options,K=z/(R*Math.pow(2,C)),q=I.data,J=[],he=this.stride;for(let ne=0;neC&&(Ye+=q[ct+ai])}if(Ye>De&&Ye>=H){let Fe,ct=oe*De,st=Pe*De,Tt=-1;const Ne=((ne/he|0)<<5)+(C+1)+this.points.length;for(const gt of Re){const Ft=gt*he;if(q[Ft+2]<=C)continue;q[Ft+2]=C;const li=q[Ft+ai];ct+=q[Ft]*li,st+=q[Ft+1]*li,q[Ft+4]=Ne,G&&(Fe||(Fe=this._map(q,ne,!0),Tt=this.clusterProps.length,this.clusterProps.push(Fe)),G(Fe,this._map(q,Ft)))}q[ne+4]=Ne,J.push(ct/Ye,st/Ye,1/0,Ne,-1,Ye),G&&J.push(Tt)}else{for(let Fe=0;Fe1)for(const Fe of Re){const ct=Fe*he;if(!(q[ct+2]<=C)){q[ct+2]=C;for(let st=0;st>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,C,z){if(I[C+ai]>1){const H=this.clusterProps[I[C+Nr]];return z?Object.assign({},H):H}const R=this.points[I[C+ni]].properties,G=this.options.map(R);return z&&G===R?Object.assign({},G):G}}function $r(F,I,C){return{type:"Feature",id:F[I+ni],properties:ur(F,I,C),geometry:{type:"Point",coordinates:[(z=F[I],360*(z-.5)),ps(F[I+1])]}};var z}function ur(F,I,C){const z=F[I+ai],R=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z,G=F[I+Nr],H=G===-1?{}:Object.assign({},C[G]);return Object.assign(H,{cluster:!0,cluster_id:F[I+ni],point_count:z,point_count_abbreviated:R})}function Oi(F){return F/360+.5}function Vi(F){const I=Math.sin(F*Math.PI/180),C=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return C<0?0:C>1?1:C}function ps(F){const I=(180-360*F)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Tr(F,I,C,z){for(var R,G=z,H=C-I>>1,K=C-I,q=F[I],J=F[I+1],he=F[C],ne=F[C+1],oe=I+3;oeG)R=oe,G=Pe;else if(Pe===G){var Re=Math.abs(oe-H);Rez&&(R-I>3&&Tr(F,I,R,z),F[R+2]=G,C-R>3&&Tr(F,R,C,z))}function xn(F,I,C,z,R,G){var H=R-C,K=G-z;if(H!==0||K!==0){var q=((F-C)*H+(I-z)*K)/(H*H+K*K);q>1?(C=R,z=G):q>0&&(C+=H*q,z+=K*q)}return(H=F-C)*H+(K=I-z)*K}function Sr(F,I,C,z){var R={id:F===void 0?null:F,type:I,geometry:C,tags:z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(G){var H=G.geometry,K=G.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")Ir(G,H);else if(K==="Polygon"||K==="MultiLineString")for(var q=0;q0&&(H+=z?(R*J-q*G)/2:Math.sqrt(Math.pow(q-R,2)+Math.pow(J-G,2))),R=q,G=J}var he=I.length-3;I[2]=1,Tr(I,0,he,C),I[he+2]=1,I.size=Math.abs(H),I.start=0,I.end=I.size}function se(F,I,C,z){for(var R=0;R1?1:C}function Ke(F,I,C,z,R,G,H,K){if(z/=I,G>=(C/=I)&&H=z)return null;for(var q=[],J=0;J=C&&Re=z)){var De=[];if(oe==="Point"||oe==="MultiPoint")Nt(ne,De,C,z,R);else if(oe==="LineString")er(ne,De,C,z,R,!1,K.lineMetrics);else if(oe==="MultiLineString")ms(ne,De,C,z,R,!1);else if(oe==="Polygon")ms(ne,De,C,z,R,!0);else if(oe==="MultiPolygon")for(var Ye=0;Ye=C&&H<=z&&(I.push(F[G]),I.push(F[G+1]),I.push(F[G+2]))}}function er(F,I,C,z,R,G,H){for(var K,q,J=fs(F),he=R===0?Zr:_s,ne=F.start,oe=0;oeC&&(q=he(J,Pe,Re,Ye,Fe,C),H&&(J.start=ne+K*q)):ct>z?st=C&&(q=he(J,Pe,Re,Ye,Fe,C),Tt=!0),st>z&&ct<=z&&(q=he(J,Pe,Re,Ye,Fe,z),Tt=!0),!G&&Tt&&(H&&(J.end=ne+K*q),I.push(J),J=fs(F)),H&&(ne+=K)}var Ne=F.length-3;Pe=F[Ne],Re=F[Ne+1],De=F[Ne+2],(ct=R===0?Pe:Re)>=C&&ct<=z&&gs(J,Pe,Re,De),Ne=J.length-3,G&&Ne>=3&&(J[Ne]!==J[0]||J[Ne+1]!==J[1])&&gs(J,J[0],J[1],J[2]),J.length&&I.push(J)}function fs(F){var I=[];return I.size=F.size,I.start=F.start,I.end=F.end,I}function ms(F,I,C,z,R,G){for(var H=0;HH.maxX&&(H.maxX=he),ne>H.maxY&&(H.maxY=ne)}return H}function Gr(F,I,C,z){var R=I.geometry,G=I.type,H=[];if(G==="Point"||G==="MultiPoint")for(var K=0;K0&&I.size<(R?H:z))C.numPoints+=I.length/3;else{for(var K=[],q=0;qH)&&(C.numSimplified++,K.push(I[q]),K.push(I[q+1])),C.numPoints++;R&&function(J,he){for(var ne=0,oe=0,Pe=J.length,Re=Pe-2;oe0===he)for(oe=0,Pe=J.length;oe24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var z=function(R,G){var H=[];if(R.type==="FeatureCollection")for(var K=0;K1&&console.time("creation"),oe=this.tiles[ne]=Ws(F,I,C,z,q),this.tileCoords.push({z:I,x:C,y:z}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,C,z,oe.numFeatures,oe.numPoints,oe.numSimplified),console.timeEnd("creation"));var Pe="z"+I;this.stats[Pe]=(this.stats[Pe]||0)+1,this.total++}if(oe.source=F,R){if(I===q.maxZoom||I===R)continue;var Re=1<1&&console.time("clipping");var De,Ye,Fe,ct,st,Tt,Ne=.5*q.buffer/q.extent,gt=.5-Ne,Ft=.5+Ne,li=1+Ne;De=Ye=Fe=ct=null,st=Ke(F,he,C-Ne,C+Ft,0,oe.minX,oe.maxX,q),Tt=Ke(F,he,C+gt,C+li,0,oe.minX,oe.maxX,q),F=null,st&&(De=Ke(st,he,z-Ne,z+Ft,1,oe.minY,oe.maxY,q),Ye=Ke(st,he,z+gt,z+li,1,oe.minY,oe.maxY,q),st=null),Tt&&(Fe=Ke(Tt,he,z-Ne,z+Ft,1,oe.minY,oe.maxY,q),ct=Ke(Tt,he,z+gt,z+li,1,oe.minY,oe.maxY,q),Tt=null),J>1&&console.timeEnd("clipping"),K.push(De||[],I+1,2*C,2*z),K.push(Ye||[],I+1,2*C,2*z+1),K.push(Fe||[],I+1,2*C+1,2*z),K.push(ct||[],I+1,2*C+1,2*z+1)}}},je.prototype.getTile=function(F,I,C){var z=this.options,R=z.extent,G=z.debug;if(F<0||F>24)return null;var H=1<1&&console.log("drilling down to z%d-%d-%d",F,I,C);for(var q,J=F,he=I,ne=C;!q&&J>0;)J--,he=Math.floor(he/2),ne=Math.floor(ne/2),q=this.tiles[Ve(J,he,ne)];return q&&q.source?(G>1&&console.log("found parent tile z%d-%d-%d",J,he,ne),G>1&&console.time("drilling down"),this.splitTile(q.source,J,he,ne,F,I,C),G>1&&console.timeEnd("drilling down"),this.tiles[K]?yi(this.tiles[K],R):null):null};class Cr extends xe{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(I,C){return k._(this,void 0,void 0,function*(){const z=I.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const R=this._geoJSONIndex.getTile(z.z,z.x,z.y);if(!R)return null;const G=new class{constructor(K){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=k.W,this.length=K.length,this._features=K}feature(K){return new class{constructor(q){this._feature=q,this.extent=k.W,this.type=q.type,this.properties=q.tags,"id"in q&&!isNaN(q.id)&&(this.id=parseInt(q.id,10))}loadGeometry(){if(this._feature.type===1){const q=[];for(const J of this._feature.geometry)q.push([new k.P(J[0],J[1])]);return q}{const q=[];for(const J of this._feature.geometry){const he=[];for(const ne of J)he.push(new k.P(ne[0],ne[1]));q.push(he)}return q}}toGeoJSON(q,J,he){return vr.call(this,q,J,he)}}(this._features[K])}}(R.features);let H=ds(G);return H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),{vectorTile:G,rawData:H.buffer}})}loadData(I){return k._(this,void 0,void 0,function*(){var C;(C=this._pendingRequest)===null||C===void 0||C.abort();const z=!!(I&&I.request&&I.request.collectResourceTiming)&&new k.bs(I.request);this._pendingRequest=new AbortController;try{let R=yield this.loadGeoJSON(I,this._pendingRequest);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`);if(Ki(R,!0),I.filter){const H=k.by(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(q=>`${q.key}: ${q.message}`).join(", "));R={type:"FeatureCollection",features:R.features.filter(q=>H.value.evaluate({zoom:0},q))}}this._geoJSONIndex=I.cluster?new Qi(function({superclusterOptions:H,clusterProperties:K}){if(!K||!H)return H;const q={},J={},he={accumulated:null,zoom:0},ne={properties:null},oe=Object.keys(K);for(const Pe of oe){const[Re,De]=K[Pe],Ye=k.by(De),Fe=k.by(typeof Re=="string"?[Re,["accumulated"],["get",Pe]]:Re);q[Pe]=Ye.value,J[Pe]=Fe.value}return H.map=Pe=>{ne.properties=Pe;const Re={};for(const De of oe)Re[De]=q[De].evaluate(he,ne);return Re},H.reduce=(Pe,Re)=>{ne.properties=Re;for(const De of oe)he.accumulated=Pe[De],Pe[De]=J[De].evaluate(he,ne)},H}(I)).load(R.features):function(H,K){return new je(H,K)}(R,I.geojsonVtOptions),this.loaded={};const G={};if(z){const H=z.finish();H&&(G.resourceTiming={},G.resourceTiming[I.source]=JSON.parse(JSON.stringify(H)))}return G}catch(R){if(delete this._pendingRequest,k.bz(R))return{abandoned:!0};throw R}})}reloadTile(I){const C=this.loaded;return C&&C[I.uid]?super.reloadTile(I):this.loadTile(I)}loadGeoJSON(I,C){return k._(this,void 0,void 0,function*(){const{promoteId:z}=I;if(I.request){const R=yield k.h(I.request,C);return this._dataUpdateable=zi(R.data,z)?Ue(R.data,z):void 0,R.data}if(typeof I.data=="string")try{const R=JSON.parse(I.data);return this._dataUpdateable=zi(R,z)?Ue(R,z):void 0,R}catch{throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`)}if(!I.dataDiff)throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${I.source}`);return function(R,G,H){var K,q,J,he;if(G.removeAll&&R.clear(),G.remove)for(const ne of G.remove)R.delete(ne);if(G.add)for(const ne of G.add){const oe=$t(ne,H);oe!=null&&R.set(oe,ne)}if(G.update)for(const ne of G.update){let oe=R.get(ne.id);if(oe==null)continue;const Pe=!ne.removeAllProperties&&(((K=ne.removeProperties)===null||K===void 0?void 0:K.length)>0||((q=ne.addOrUpdateProperties)===null||q===void 0?void 0:q.length)>0);if((ne.newGeometry||ne.removeAllProperties||Pe)&&(oe=Object.assign({},oe),R.set(ne.id,oe),Pe&&(oe.properties=Object.assign({},oe.properties))),ne.newGeometry&&(oe.geometry=ne.newGeometry),ne.removeAllProperties)oe.properties={};else if(((J=ne.removeProperties)===null||J===void 0?void 0:J.length)>0)for(const Re of ne.removeProperties)Object.prototype.hasOwnProperty.call(oe.properties,Re)&&delete oe.properties[Re];if(((he=ne.addOrUpdateProperties)===null||he===void 0?void 0:he.length)>0)for(const{key:Re,value:De}of ne.addOrUpdateProperties)oe.properties[Re]=De}}(this._dataUpdateable,I.dataDiff,z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(I){return k._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(I){return this._geoJSONIndex.getClusterExpansionZoom(I.clusterId)}getClusterChildren(I){return this._geoJSONIndex.getChildren(I.clusterId)}getClusterLeaves(I){return this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset)}}class dr{constructor(I){this.self=I,this.actor=new k.C(I),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(C,z)=>{if(this.externalWorkerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.externalWorkerSourceTypes[C]=z},this.self.addProtocol=k.bf,this.self.removeProtocol=k.bg,this.self.registerRTLTextPlugin=C=>{if(k.bA.isParsed())throw new Error("RTL text plugin already registered.");k.bA.setMethods(C)},this.actor.registerMessageHandler("loadDEMTile",(C,z)=>this._getDEMWorkerSource(C,z.source).loadTile(z)),this.actor.registerMessageHandler("removeDEMTile",(C,z)=>k._(this,void 0,void 0,function*(){this._getDEMWorkerSource(C,z.source).removeTile(z)})),this.actor.registerMessageHandler("getClusterExpansionZoom",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterExpansionZoom(z)})),this.actor.registerMessageHandler("getClusterChildren",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterChildren(z)})),this.actor.registerMessageHandler("getClusterLeaves",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterLeaves(z)})),this.actor.registerMessageHandler("loadData",(C,z)=>this._getWorkerSource(C,z.type,z.source).loadData(z)),this.actor.registerMessageHandler("loadTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).loadTile(z)),this.actor.registerMessageHandler("reloadTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).reloadTile(z)),this.actor.registerMessageHandler("abortTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).abortTile(z)),this.actor.registerMessageHandler("removeTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).removeTile(z)),this.actor.registerMessageHandler("removeSource",(C,z)=>k._(this,void 0,void 0,function*(){if(!this.workerSources[C]||!this.workerSources[C][z.type]||!this.workerSources[C][z.type][z.source])return;const R=this.workerSources[C][z.type][z.source];delete this.workerSources[C][z.type][z.source],R.removeSource!==void 0&&R.removeSource(z)})),this.actor.registerMessageHandler("removeMap",C=>k._(this,void 0,void 0,function*(){delete this.layerIndexes[C],delete this.availableImages[C],delete this.workerSources[C],delete this.demWorkerSources[C]})),this.actor.registerMessageHandler("setReferrer",(C,z)=>k._(this,void 0,void 0,function*(){this.referrer=z})),this.actor.registerMessageHandler("syncRTLPluginState",(C,z)=>this._syncRTLPluginState(C,z)),this.actor.registerMessageHandler("importScript",(C,z)=>k._(this,void 0,void 0,function*(){this.self.importScripts(z)})),this.actor.registerMessageHandler("setImages",(C,z)=>this._setImages(C,z)),this.actor.registerMessageHandler("updateLayers",(C,z)=>k._(this,void 0,void 0,function*(){this._getLayerIndex(C).update(z.layers,z.removedIds)})),this.actor.registerMessageHandler("setLayers",(C,z)=>k._(this,void 0,void 0,function*(){this._getLayerIndex(C).replace(z)}))}_setImages(I,C){return k._(this,void 0,void 0,function*(){this.availableImages[I]=C;for(const z in this.workerSources[I]){const R=this.workerSources[I][z];for(const G in R)R[G].availableImages=C}})}_syncRTLPluginState(I,C){return k._(this,void 0,void 0,function*(){if(k.bA.isParsed())return k.bA.getState();if(C.pluginStatus!=="loading")return k.bA.setState(C),C;const z=C.pluginURL;if(this.self.importScripts(z),k.bA.isParsed()){const R={pluginStatus:"loaded",pluginURL:z};return k.bA.setState(R),R}throw k.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${z}`)})}_getAvailableImages(I){let C=this.availableImages[I];return C||(C=[]),C}_getLayerIndex(I){let C=this.layerIndexes[I];return C||(C=this.layerIndexes[I]=new p),C}_getWorkerSource(I,C,z){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][C]||(this.workerSources[I][C]={}),!this.workerSources[I][C][z]){const R={sendAsync:(G,H)=>(G.targetMapId=I,this.actor.sendAsync(G,H))};switch(C){case"vector":this.workerSources[I][C][z]=new xe(R,this._getLayerIndex(I),this._getAvailableImages(I));break;case"geojson":this.workerSources[I][C][z]=new Cr(R,this._getLayerIndex(I),this._getAvailableImages(I));break;default:this.workerSources[I][C][z]=new this.externalWorkerSourceTypes[C](R,this._getLayerIndex(I),this._getAvailableImages(I))}}return this.workerSources[I][C][z]}_getDEMWorkerSource(I,C){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][C]||(this.demWorkerSources[I][C]=new re),this.demWorkerSources[I][C]}}return k.i(self)&&(self.worker=new dr(self)),dr}),Br("index",["exports","./shared"],function(k,p){var Ei="4.1.2";let Xi,Yt;const xe={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:c=>new Promise((t,s)=>{const a=requestAnimationFrame(t);c.signal.addEventListener("abort",()=>{cancelAnimationFrame(a),s(p.c())})}),getImageData(c,t=0){return this.getImageCanvasContext(c).getImageData(-t,-t,c.width+2*t,c.height+2*t)},getImageCanvasContext(c){const t=window.document.createElement("canvas"),s=t.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return t.width=c.width,t.height=c.height,s.drawImage(c,0,0,c.width,c.height),s},resolveURL:c=>(Xi||(Xi=document.createElement("a")),Xi.href=c,Xi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Yt==null&&(Yt=matchMedia("(prefers-reduced-motion: reduce)")),Yt.matches)}};class re{static testProp(t){if(!re.docStyle)return t[0];for(let s=0;s{window.removeEventListener("click",re.suppressClickInternal,!0)},0)}static getScale(t){const s=t.getBoundingClientRect();return{x:s.width/t.offsetWidth||1,y:s.height/t.offsetHeight||1,boundingClientRect:s}}static getPoint(t,s,a){const o=s.boundingClientRect;return new p.P((a.clientX-o.left)/s.x-t.clientLeft,(a.clientY-o.top)/s.y-t.clientTop)}static mousePos(t,s){const a=re.getScale(t);return re.getPoint(t,a,s)}static touchPos(t,s){const a=[],o=re.getScale(t);for(let h=0;h{t=[],s=0,a=0,o={}},c.addThrottleControl=y=>{const v=a++;return o[v]=y,v},c.removeThrottleControl=y=>{delete o[y],m()},c.getImage=(y,v,T=!0)=>new Promise((S,E)=>{Fr.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),t.push({abortController:v,requestParameters:y,supportImageRefresh:T,state:"queued",onError:O=>{E(O)},onSuccess:O=>{S(O)}}),m()});const h=y=>p._(this,void 0,void 0,function*(){y.state="running";const{requestParameters:v,supportImageRefresh:T,onError:S,onSuccess:E,abortController:O}=y,B=T===!1&&!p.i(self)&&!p.g(v.url)&&(!v.headers||Object.keys(v.headers).reduce((Z,Q)=>Z&&Q==="accept",!0));s++;const U=B?g(v,O):p.m(v,O);try{const Z=yield U;delete y.abortController,y.state="completed",Z.data instanceof HTMLImageElement||p.b(Z.data)?E(Z):Z.data&&E({data:yield(D=Z.data,typeof createImageBitmap=="function"?p.d(D):p.f(D)),cacheControl:Z.cacheControl,expires:Z.expires})}catch(Z){delete y.abortController,S(Z)}finally{s--,m()}var D}),m=()=>{const y=(()=>{for(const v of Object.keys(o))if(o[v]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let v=s;v0;v++){const T=t.shift();T.abortController.signal.aborted?v--:h(T)}},g=(y,v)=>new Promise((T,S)=>{const E=new Image,O=y.url,B=y.credentials;B&&B==="include"?E.crossOrigin="use-credentials":(B&&B==="same-origin"||!p.s(O))&&(E.crossOrigin="anonymous"),v.signal.addEventListener("abort",()=>{E.src="",S(p.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,T({data:E})},E.onerror=()=>{E.onerror=E.onload=null,v.signal.aborted||S(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},E.src=O})}(_i||(_i={})),_i.resetRequestQueue(),function(c){c.Glyphs="Glyphs",c.Image="Image",c.Source="Source",c.SpriteImage="SpriteImage",c.SpriteJSON="SpriteJSON",c.Style="Style",c.Tile="Tile",c.Unknown="Unknown"}(Ut||(Ut={}));class Yi{constructor(t){this._transformRequestFn=t}transformRequest(t,s){return this._transformRequestFn&&this._transformRequestFn(t,s)||{url:t}}normalizeSpriteURL(t,s,a){const o=function(h){const m=h.match(Or);if(!m)throw new Error(`Unable to parse URL "${h}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return o.path+=`${s}${a}`,function(h){const m=h.params.length?`?${h.params.join("&")}`:"";return`${h.protocol}://${h.authority}${h.path}${m}`}(o)}setTransformRequest(t){this._transformRequestFn=t}}const Or=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Mi(c){var t=new p.A(3);return t[0]=c[0],t[1]=c[1],t[2]=c[2],t}var Vr,br=function(c,t,s){return c[0]=t[0]-s[0],c[1]=t[1]-s[1],c[2]=t[2]-s[2],c};Vr=new p.A(3),p.A!=Float32Array&&(Vr[0]=0,Vr[1]=0,Vr[2]=0);var yn=function(c){var t=c[0],s=c[1];return t*t+s*s};function si(c){const t=[];if(typeof c=="string")t.push({id:"default",url:c});else if(c&&c.length>0){const s=[];for(const{id:a,url:o}of c){const h=`${a}${o}`;s.indexOf(h)===-1&&(s.push(h),t.push({id:a,url:o}))}}return t}(function(){var c=new p.A(2);p.A!=Float32Array&&(c[0]=0,c[1]=0)})();class xt{constructor(t,s,a,o){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(s,o)}update(t,s,a){const{width:o,height:h}=t,m=!(this.size&&this.size[0]===o&&this.size[1]===h||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(s&&s.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!s||s.premultiply!==!1)),m)this.size=[o,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||p.b(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,o,h,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||p.b(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,o,h,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,s,a){const{context:o}=this,{gl:h}=o;h.bindTexture(h.TEXTURE_2D,this.texture),a!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,a||t),this.filter=t),s!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,s),this.wrap=s)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function qt(c){const{userImage:t}=c;return!!(t&&t.render&&t.render())&&(c.data.replace(new Uint8Array(t.data.buffer)),!0)}class Fi extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:s,promiseResolve:a}of this.requestors)a(this._getImagesForIds(s));this.requestors=[]}}getImage(t){const s=this.images[t];if(s&&!s.data&&s.spriteData){const a=s.spriteData;s.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),s.spriteData=null}return s}addImage(t,s){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,s)&&(this.images[t]=s)}_validate(t,s){let a=!0;const o=s.data||s.spriteData;return this._validateStretch(s.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(s.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(s.content,s)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,s){if(!t)return!0;let a=0;for(const o of t){if(o[0]{let o=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(o=!1);this.isLoaded()||o?s(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:s})})}_getImagesForIds(t){const s={};for(const a of t){let o=this.getImage(a);o||(this.fire(new p.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?s[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${a}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return s}getPixelSize(){const{width:t,height:s}=this.atlasImage;return{width:t,height:s}}getPattern(t){const s=this.patterns[t],a=this.getImage(t);if(!a)return null;if(s&&s.position.version===a.version)return s.position;if(s)s.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},h=new p.I(o,a);this.patterns[t]={bin:o,position:h}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const s=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new xt(t,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:s,h:a}=p.p(t),o=this.atlasImage;o.resize({width:s||1,height:a||1});for(const h in this.patterns){const{bin:m}=this.patterns[h],g=m.x+1,y=m.y+1,v=this.getImage(h).data,T=v.width,S=v.height;p.R.copy(v,o,{x:0,y:0},{x:g,y},{width:T,height:S}),p.R.copy(v,o,{x:0,y:S-1},{x:g,y:y-1},{width:T,height:1}),p.R.copy(v,o,{x:0,y:0},{x:g,y:y+S},{width:T,height:1}),p.R.copy(v,o,{x:T-1,y:0},{x:g-1,y},{width:1,height:S}),p.R.copy(v,o,{x:0,y:0},{x:g+T,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const s of t){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const a=this.getImage(s);a||p.w(`Image with ID: "${s}" was not found`),qt(a)&&this.updateImage(s,a)}}}const Ur=1e20;function hr(c,t,s,a,o,h,m,g,y){for(let v=t;v-1);y++,h[y]=g,m[y]=v,m[y+1]=Ur}for(let g=0,y=0;g65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[h])return{stack:t,id:s,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[h]){const g=Ji.loadGlyphRange(t,h,this.url,this.requestManager);a.requests[h]=g}const m=yield a.requests[h];for(const g in m)this._doesCharSupportLocalGlyph(+g)||(a.glyphs[+g]=m[+g]);return a.ranges[h]=!0,{stack:t,id:s,glyph:m[s]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(p.u["CJK Unified Ideographs"](t)||p.u["Hangul Syllables"](t)||p.u.Hiragana(t)||p.u.Katakana(t))}_tinySDF(t,s,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let h=t.tinySDF;if(!h){let g="400";/bold/i.test(s)?g="900":/medium/i.test(s)?g="500":/light/i.test(s)&&(g="200"),h=t.tinySDF=new Ji.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:g})}const m=h.draw(String.fromCharCode(a));return{id:a,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ji.loadGlyphRange=function(c,t,s,a){return p._(this,void 0,void 0,function*(){const o=256*t,h=o+255,m=a.transformRequest(s.replace("{fontstack}",c).replace("{range}",`${o}-${h}`),Ut.Glyphs),g=yield p.l(m,new AbortController);if(!g||!g.data)throw new Error(`Could not load glyph range. range: ${t}, ${o}-${h}`);const y={};for(const v of p.n(g.data))y[v.id]=v;return y})},Ji.TinySDF=class{constructor({fontSize:c=24,buffer:t=3,radius:s=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:h="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=s;const g=this.size=c+4*t,y=this._createCanvas(g),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${h} ${c}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(c){const t=document.createElement("canvas");return t.width=t.height=c,t}draw(c){const{width:t,actualBoundingBoxAscent:s,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:h}=this.ctx.measureText(c),m=Math.ceil(s),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=g+2*this.buffer,T=y+2*this.buffer,S=Math.max(v*T,0),E=new Uint8ClampedArray(S),O={data:E,width:v,height:T,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(g===0||y===0)return O;const{ctx:B,buffer:U,gridInner:D,gridOuter:Z}=this;B.clearRect(U,U,g,y),B.fillText(c,U,U+m);const Q=B.getImageData(U,U,g,y);Z.fill(Ur,0,S),D.fill(0,0,S);for(let N=0;N0?ie*ie:0,D[te]=ie<0?ie*ie:0}}hr(Z,0,0,v,T,v,this.f,this.v,this.z),hr(D,U,U,g,y,v,this.f,this.v,this.z);for(let N=0;N1&&(y=t[++g]);const T=Math.abs(v-y.left),S=Math.abs(v-y.right),E=Math.min(T,S);let O;const B=h/a*(o+1);if(y.isDash){const U=o-Math.abs(B);O=Math.sqrt(E*E+U*U)}else O=o-Math.sqrt(E*E+B*B);this.data[m+v]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(t){for(let g=t.length-1;g>=0;--g){const y=t[g],v=t[g+1];y.zeroLength?t.splice(g,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(g,1))}const s=t[0],a=t[t.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const o=this.width*this.nextRow;let h=0,m=t[h];for(let g=0;g1&&(m=t[++h]);const y=Math.abs(g-m.left),v=Math.abs(g-m.right),T=Math.min(y,v);this.data[o+g]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,s){const a=s?7:0,o=2*a+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let h=0;for(let g=0;g{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nr]}numActive(){return Object.keys(this.active).length}}const $r=Math.floor(xe.hardwareConcurrency/2);let ur,Oi;function Vi(){return ur||(ur=new Qi),ur}Qi.workerCount=p.B(globalThis)?Math.max(Math.min($r,3),1):1;class ps{constructor(t,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const a=this.workerPool.acquire(s);for(let o=0;o{s.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,s){for(const a of this.actors)a.registerMessageHandler(t,s)}}function Tr(){return Oi||(Oi=new ps(Vi(),p.G),Oi.registerMessageHandler("getResource",(c,t,s)=>p.m(t,s))),Oi}function xn(c,t){const s=p.F();return p.H(s,s,[1,1,0]),p.J(s,s,[.5*c.width,.5*c.height,1]),p.K(s,s,c.calculatePosMatrix(t.toUnwrapped()))}function Sr(c,t,s,a,o,h){const m=function(S,E,O){if(S)for(const B of S){const U=E[B];if(U&&U.source===O&&U.type==="fill-extrusion")return!0}else for(const B in E){const U=E[B];if(U.source===O&&U.type==="fill-extrusion")return!0}return!1}(o&&o.layers,t,c.id),g=h.maxPitchScaleFactor(),y=c.tilesIn(a,g,m);y.sort(Ir);const v=[];for(const S of y)v.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(t,s,c._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,h,g,xn(c.transform,S.tileID))});const T=function(S){const E={},O={};for(const B of S){const U=B.queryResults,D=B.wrappedTileID,Z=O[D]=O[D]||{};for(const Q in U){const N=U[Q],X=Z[Q]=Z[Q]||{},ee=E[Q]=E[Q]||[];for(const te of N)X[te.featureIndex]||(X[te.featureIndex]=!0,ee.push(te))}}return E}(v);for(const S in T)T[S].forEach(E=>{const O=E.feature,B=c.getFeatureState(O.layer["source-layer"],O.id);O.source=O.layer.source,O.layer["source-layer"]&&(O.sourceLayer=O.layer["source-layer"]),O.state=B});return T}function Ir(c,t){const s=c.tileID,a=t.tileID;return s.overscaledZ-a.overscaledZ||s.canonical.y-a.canonical.y||s.wrap-a.wrap||s.canonical.x-a.canonical.x}function Ar(c,t,s){return p._(this,void 0,void 0,function*(){let a=c;if(c.url?a=(yield p.h(t.transformRequest(c.url,Ut.Source),s)).data:yield xe.frameAsync(s),!a)return null;const o=p.L(p.e(a,c),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(h=>h.id)),o})}class Mt{constructor(t,s){t&&(s?this.setSouthWest(t).setNorthEast(s):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof p.M?new p.M(t.lng,t.lat):p.M.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.M?new p.M(t.lng,t.lat):p.M.convert(t),this}extend(t){const s=this._sw,a=this._ne;let o,h;if(t instanceof p.M)o=t,h=t;else{if(!(t instanceof Mt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Mt.convert(t)):this.extend(p.M.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(p.M.convert(t)):this;if(o=t._sw,h=t._ne,!o||!h)return this}return s||a?(s.lng=Math.min(o.lng,s.lng),s.lat=Math.min(o.lat,s.lat),a.lng=Math.max(h.lng,a.lng),a.lat=Math.max(h.lat,a.lat)):(this._sw=new p.M(o.lng,o.lat),this._ne=new p.M(h.lng,h.lat)),this}getCenter(){return new p.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.M(this.getWest(),this.getNorth())}getSouthEast(){return new p.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:s,lat:a}=p.M.convert(t);let o=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(t){return t instanceof Mt?t:t&&new Mt(t)}static fromLngLat(t,s=0){const a=360*s/40075017,o=a/Math.cos(Math.PI/180*t.lat);return new Mt(new p.M(t.lng-o,t.lat-a),new p.M(t.lng+o,t.lat+a))}}class jr{constructor(t,s,a){this.bounds=Mt.convert(this.validateBounds(t)),this.minzoom=s||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const s=Math.pow(2,t.z),a=Math.floor(p.N(this.bounds.getWest())*s),o=Math.floor(p.O(this.bounds.getNorth())*s),h=Math.ceil(p.N(this.bounds.getEast())*s),m=Math.ceil(p.O(this.bounds.getSouth())*s);return t.x>=a&&t.x=o&&t.y{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(s,Ut.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.request.collectResourceTiming=this._collectResourceTiming;let o="reloadTile";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,m)=>{t.reloadPromise={resolve:h,reject:m}})}else t.actor=this.dispatcher.getActor(),o="loadTile";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:o,data:a},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,s){if(s&&s.resourceTiming&&(t.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&t.setExpiryData(s),t.loadVectorData(s,this.map.painter),t.reloadPromise){const a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"abortTile",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"removeTile",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qr extends p.E{constructor(t,s,a,o){super(),this.id=t,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},s),p.e(this,p.L(s,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Ar(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(p.e(this,t),t.bounds&&(this.tileBounds=new jr(t.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new p.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return p.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const a=yield _i.getImage(this.map._requestManager.transformRequest(s,Ut.Tile),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,h=o.gl,m=a.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new xt(o,m,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),o.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,o.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,o.extTextureFilterAnisotropicMax)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Gs extends qr{constructor(t,s,a,o){super(t,s,a,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(s,Ut.Tile);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const o=yield _i.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){const h=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const m=p.b(h)&&p.S()?h:yield this.readImageNow(h),g={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const y=yield t.actor.sendAsync({type:"loadDEMTile",data:g});t.dem=y,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}readImageNow(t){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.U()){const s=t.width+2,a=t.height+2;try{return new p.R({width:s,height:a},yield p.V(t,-1,-1,s,a))}catch{}}return xe.getImageData(t,1)})}_getNeighboringTiles(t){const s=t.canonical,a=Math.pow(2,s.z),o=(s.x-1+a)%a,h=s.x===0?t.wrap-1:t.wrap,m=(s.x+1+a)%a,g=s.x+1===a?t.wrap+1:t.wrap,y={};return y[new p.Q(t.overscaledZ,h,s.z,o,s.y).key]={backfilled:!1},y[new p.Q(t.overscaledZ,g,s.z,m,s.y).key]={backfilled:!1},s.y>0&&(y[new p.Q(t.overscaledZ,h,s.z,o,s.y-1).key]={backfilled:!1},y[new p.Q(t.overscaledZ,t.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},y[new p.Q(t.overscaledZ,g,s.z,m,s.y-1).key]={backfilled:!1}),s.y+10&&p.e(h,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(a))}})}loaded(){return this._pendingLoads===0}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const a={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const o=yield this.actor.sendAsync({type:s,data:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(o,this.map.painter,s==="reloadTile")})}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"removeTile",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"removeSource",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Nt=p.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class er extends p.E{constructor(t,s,a,o){super(),this.id=t,this.dispatcher=a,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=s}load(t){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const s=yield _i.getImage(this.map._requestManager.transformRequest(this.url,Ut.Image),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,t&&(this.coordinates=t),this._finishLoading())}catch(s){this._request=null,this.fire(new p.j(s))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const s=t.map(p.Y.fromLngLat);this.tileID=function(o){let h=1/0,m=1/0,g=-1/0,y=-1/0;for(const E of o)h=Math.min(h,E.x),m=Math.min(m,E.y),g=Math.max(g,E.x),y=Math.max(y,E.y);const v=Math.max(g-h,y-m),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),S=Math.pow(2,T);return new p.a0(T,Math.floor((h+g)/2*S),Math.floor((m+y)/2*S))}(s),this.minzoom=this.maxzoom=this.tileID.z;const a=s.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.Z,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,p.W,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,p.W),this._boundsArray.emplaceBack(a[2].x,a[2].y,p.W,p.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new xt(t,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class fs extends er{constructor(t,s,a,o){super(t,s,a,o),this.roundZoom=!0,this.type="video",this.options=s}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const s of t.urls)this.urls.push(this.map._requestManager.transformRequest(s,Ut.Source).url);try{const s=yield p.a2(this.urls);if(this._loaded=!0,!s)return;this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(s){this.fire(new p.j(s))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const s=this.video.seekable;ts.end(0)?this.fire(new p.j(new p.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new xt(t,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ms extends er{constructor(t,s,a,o){super(t,s,a,o),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a1(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a1(`sources.${t}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new p.j(new p.a1(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a1(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.j(new p.a1(`sources.${t}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){return p._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new p.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const s=this.map.painter.context,a=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new xt(s,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const h in this.tiles){const m=this.tiles[h];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const gs={},Zr=c=>{switch(c){case"geojson":return Ke;case"image":return er;case"raster":return qr;case"raster-dem":return Gs;case"vector":return se;case"video":return fs;case"canvas":return ms}return gs[c]},_s="RTLPluginLoaded";class Hs extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Tr()}_syncState(t){return this.status=t,this.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t,pluginURL:this.url}).catch(s=>{throw this.status="error",s})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return p._(this,arguments,void 0,function*(s,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=xe.resolveURL(s),!this.url)throw new Error(`requested url ${s} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(_s))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ge=null;function yi(){return ge||(ge=new Hs),ge}class oi{constructor(t,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=p.a3(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const s=t+this.timeAdded;sh.getLayer(v)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)m[v.id]=g}}return m}(t.buckets,s.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const h=this.buckets[o];if(h instanceof p.a5){if(this.hasSymbolBuckets=!0,!a)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const h=this.buckets[o];if(h instanceof p.a5&&h.hasRTLText){this.hasRTLText=!0,yi().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const h=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(o).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new p.a4}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(t)}const s=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new xt(t,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new xt(t,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,s,a,o,h,m,g,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:h,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:g,queryPadding:this.queryPadding*v},t,s,a):{}}querySourceFeatures(t,s){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),h=s&&s.sourceLayer?s.sourceLayer:"",m=o._geojsonTileLayer||o[h];if(!m)return;const g=p.a6(s&&s.filter),{z:y,x:v,y:T}=this.tileID.canonical,S={z:y,x:v,y:T};for(let E=0;Ea)o=!1;else if(s)if(this.expirationTime{this.remove(t,h)},a)),this.data[o].push(h),this.order.push(o),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const s=this.data[t].shift();return s.timeout&&clearTimeout(s.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),s.value}getByKey(t){const s=this.data[t];return s?s[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,s){if(!this.has(t))return this;const a=t.wrapped().key,o=s===void 0?0:this.data[a].indexOf(s),h=this.data[a][o];return this.data[a].splice(o,1),h.timeout&&clearTimeout(h.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(h.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(t){const s=[];for(const a in this.data)for(const o of this.data[a])t(o.value)||s.push(o);for(const a of s)this.remove(a.value.tileID,a)}}class Gr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,s,a){const o=String(s);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][o]=this.stateChanges[t][o]||{},p.e(this.stateChanges[t][o],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==o&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][o]===null){this.deletedStates[t][o]={};for(const h in this.state[t][o])a[h]||(this.deletedStates[t][o][h]=null)}else for(const h in a)this.deletedStates[t]&&this.deletedStates[t][o]&&this.deletedStates[t][o][h]===null&&delete this.deletedStates[t][o][h]}removeFeatureState(t,s,a){if(this.deletedStates[t]===null)return;const o=String(s);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&s!==void 0)this.deletedStates[t][o]!==null&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][a]=null);else if(s!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][o])for(a in this.deletedStates[t][o]={},this.stateChanges[t][o])this.deletedStates[t][o][a]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null}getState(t,s){const a=String(s),o=p.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][s];if(h===null)return{};for(const m in h)delete o[m]}return o}initializeTileState(t,s){t.setFeatureState(this.state,s)}coalesceChanges(t,s){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const h={};for(const m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),h[m]=this.state[o][m];a[o]=h}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const h={};if(this.deletedStates[o]===null)for(const m in this.state[o])h[m]={},this.state[o][m]={};else for(const m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(const g of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][g];h[m]=this.state[o][m]}a[o]=a[o]||{},p.e(a[o],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in t)t[o].setFeatureState(a,s)}}class fe extends p.E{constructor(t,s,a){super(),this.id=t,this.dispatcher=a,this.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,h,m,g)=>{const y=new(Zr(h.type))(o,h,m,g);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(t,s,a,this),this._tiles={},this._cache=new Ws(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Gr,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const s=this._tiles[t];if(s.state!=="loaded"&&s.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,s,a){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,s,a)}catch(o){t.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new p.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const a=this._tiles[s];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(je).map(t=>t.key)}getRenderableIds(t){const s=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&s.push(this._tiles[a]);return t?s.sort((a,o)=>{const h=a.tileID,m=o.tileID,g=new p.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(a=>a.tileID.key):s.map(a=>a.tileID).sort(je).map(a=>a.key)}hasRenderableParent(t){const s=this.findLoadedParent(t,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(t,s){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(s||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,s){return p._(this,void 0,void 0,function*(){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=s),yield this._loadTile(a,t,s))})}_tileLoaded(t,s,a){t.timeAdded=xe.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(s,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const s=this.getRenderableIds();for(let o=0;o1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),h.dem&&o.dem&&(o.dem.backfillBorder(h.dem,m,g),o.neighboringTiles&&o.neighboringTiles[v]&&(o.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,s,a,o){for(const h in this._tiles){let m=this._tiles[h];if(o[h]||!m.hasData()||m.tileID.overscaledZ<=s||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>s+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(g=v)}let y=g;for(;y.overscaledZ>s;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){o[g.key]=g;break}}}findLoadedParent(t,s){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=s?a:null}for(let a=t.overscaledZ-1;a>=s;a--){const o=t.scaledTo(a),h=this._getLoadedTile(o);if(h)return h}}_getLoadedTile(t){const s=this._tiles[t.key];return s&&s.hasData()?s:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const s=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,o=Math.floor(s*a*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(h)}handleWrapJump(t){const s=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,s){const a={};for(const o in this._tiles){const h=this._tiles[o];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+s),a[h.tileID.key]=h}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}update(t,s){if(this.transform=t,this.terrain=s,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.Q(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:s}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const o=t.coveringZoomLevel(this._source),h=Math.max(o-fe.maxOverzooming,this._source.minzoom),m=Math.max(o+fe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const S of a)if(S.canonical.z>this._source.minzoom){const E=S.scaledTo(S.canonical.z-1);T[E.key]=E;const O=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));T[O.key]=O}a=a.concat(Object.values(T))}const g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);if(Ve(this._source.type)){const T={},S={},E=Object.keys(y),O=xe.now();for(const B of E){const U=y[B],D=this._tiles[B];if(!D||D.fadeEndTime!==0&&D.fadeEndTime<=O)continue;const Z=this.findLoadedParent(U,h);Z&&(this._addTile(Z.tileID),T[Z.tileID.key]=Z.tileID),S[B]=U}this._retainLoadedChildren(S,o,m,y);for(const B in T)y[B]||(this._coveredTiles[B]=!0,y[B]=T[B]);if(s){const B={},U={};for(const D of a)this._tiles[D.key].hasData()?B[D.key]=D:U[D.key]=D;for(const D in U){const Z=U[D].children(this._source.maxzoom);this._tiles[Z[0].key]&&this._tiles[Z[1].key]&&this._tiles[Z[2].key]&&this._tiles[Z[3].key]&&(B[Z[0].key]=y[Z[0].key]=Z[0],B[Z[1].key]=y[Z[1].key]=Z[1],B[Z[2].key]=y[Z[2].key]=Z[2],B[Z[3].key]=y[Z[3].key]=Z[3],delete U[D])}for(const D in U){const Z=this.findLoadedParent(U[D],this._source.minzoom);if(Z){B[Z.tileID.key]=y[Z.tileID.key]=Z.tileID;for(const Q in B)B[Q].isChildOf(Z.tileID)&&delete B[Q]}}for(const D in this._tiles)B[D]||(this._coveredTiles[D]=!0)}}for(const T in y)this._tiles[T].clearFadeHold();const v=p.ab(this._tiles,y);for(const T of v){const S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,s){const a={},o={},h=Math.max(s-fe.maxOverzooming,this._source.minzoom),m=Math.max(s+fe.maxUnderzooming,this._source.minzoom),g={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||sthis._source.maxzoom){const S=y.children(this._source.maxzoom)[0],E=this.getTile(S);if(E&&E.hasData()){a[S.key]=S;continue}}else{const S=y.children(this._source.maxzoom);if(a[S[0].key]&&a[S[1].key]&&a[S[2].key]&&a[S[3].key])continue}let T=v.wasRequested();for(let S=y.overscaledZ-1;S>=h;--S){const E=y.scaledTo(S);if(o[E.key])break;if(o[E.key]=!0,v=this.getTile(E),!v&&T&&(v=this._addTile(E)),v){const O=v.hasData();if((T||O)&&(a[E.key]=E),T=v.wasRequested(),O)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const s=[];let a,o=this._tiles[t].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}s.push(o.key);const h=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(h),a)break;o=h}for(const h of s)this._loadedParentTiles[h]=a}}_addTile(t){let s=this._tiles[t.key];if(s)return s;s=this._cache.getAndRemove(t),s&&(this._setTileReloadTimer(t.key,s),s.tileID=t,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,s)));const a=s;return s||(s=new oi(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(s,t.key,s.state)),s.uses++,this._tiles[t.key]=s,a||this._source.fire(new p.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(t,s){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=s.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const s=this._tiles[t];s&&(s.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,s,a){const o=[],h=this.transform;if(!h)return o;const m=a?h.getCameraQueryGeometry(t):t,g=t.map(B=>h.pointCoordinate(B,this.terrain)),y=m.map(B=>h.pointCoordinate(B,this.terrain)),v=this.getIds();let T=1/0,S=1/0,E=-1/0,O=-1/0;for(const B of y)T=Math.min(T,B.x),S=Math.min(S,B.y),E=Math.max(E,B.x),O=Math.max(O,B.y);for(let B=0;B=0&&N[1].y+Q>=0){const X=g.map(te=>D.getTilePoint(te)),ee=y.map(te=>D.getTilePoint(te));o.push({tile:U,tileID:D,queryGeometry:X,cameraQueryGeometry:ee,scale:Z})}}return o}getVisibleCoordinates(t){const s=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of s)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(Ve(this._source.type)){const t=xe.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=t)return!0}return!1}setFeatureState(t,s,a){this._state.updateState(t=t||"_geojsonTileLayer",s,a)}removeFeatureState(t,s,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",s,a)}getFeatureState(t,s){return this._state.getState(t=t||"_geojsonTileLayer",s)}setDependencies(t,s,a){const o=this._tiles[t];o&&o.setDependencies(s,a)}reloadTilesForDependencies(t,s){for(const a in this._tiles)this._tiles[a].hasDependency(t,s)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,s))}}function je(c,t){const s=Math.abs(2*c.wrap)-+(c.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return c.overscaledZ-t.overscaledZ||a-s||t.canonical.y-c.canonical.y||t.canonical.x-c.canonical.x}function Ve(c){return c==="raster"||c==="image"||c==="video"}fe.maxOverzooming=10,fe.maxUnderzooming=3;class $t{constructor(t,s){this.reset(t,s)}reset(t,s){this.points=t||[],this._distances=[0];for(let a=1;a0?(o-m)/g:0;return this.points[h].mult(1-y).add(this.points[s].mult(y))}}function zi(c,t){let s=!0;return c==="always"||c!=="never"&&t!=="never"||(s=!1),s}class Ue{constructor(t,s,a){const o=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(s/a);for(let m=0;mthis.width||o<0||s>this.height)return[];const y=[];if(t<=0&&s<=0&&this.width<=a&&this.height<=o){if(h)return[{key:null,x1:t,y1:s,x2:a,y2:o}];for(let v=0;v0}hitTestCircle(t,s,a,o,h){const m=t-a,g=t+a,y=s-a,v=s+a;if(g<0||m>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,g,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:t,y:s,radius:a},seenUids:{box:{},circle:{}}},h),T.length>0}_queryCell(t,s,a,o,h,m,g,y){const{seenUids:v,hitTest:T,overlapMode:S}=g,E=this.boxCells[h];if(E!==null){const B=this.bboxes;for(const U of E)if(!v.box[U]){v.box[U]=!0;const D=4*U,Z=this.boxKeys[U];if(t<=B[D+2]&&s<=B[D+3]&&a>=B[D+0]&&o>=B[D+1]&&(!y||y(Z))&&(!T||!zi(S,Z.overlapMode))&&(m.push({key:Z,x1:B[D],y1:B[D+1],x2:B[D+2],y2:B[D+3]}),T))return!0}}const O=this.circleCells[h];if(O!==null){const B=this.circles;for(const U of O)if(!v.circle[U]){v.circle[U]=!0;const D=3*U,Z=this.circleKeys[U];if(this._circleAndRectCollide(B[D],B[D+1],B[D+2],t,s,a,o)&&(!y||y(Z))&&(!T||!zi(S,Z.overlapMode))){const Q=B[D],N=B[D+1],X=B[D+2];if(m.push({key:Z,x1:Q-X,y1:N-X,x2:Q+X,y2:N+X}),T)return!0}}}return!1}_queryCellCircle(t,s,a,o,h,m,g,y){const{circle:v,seenUids:T,overlapMode:S}=g,E=this.boxCells[h];if(E!==null){const B=this.bboxes;for(const U of E)if(!T.box[U]){T.box[U]=!0;const D=4*U,Z=this.boxKeys[U];if(this._circleAndRectCollide(v.x,v.y,v.radius,B[D+0],B[D+1],B[D+2],B[D+3])&&(!y||y(Z))&&!zi(S,Z.overlapMode))return m.push(!0),!0}}const O=this.circleCells[h];if(O!==null){const B=this.circles;for(const U of O)if(!T.circle[U]){T.circle[U]=!0;const D=3*U,Z=this.circleKeys[U];if(this._circlesCollide(B[D],B[D+1],B[D+2],v.x,v.y,v.radius)&&(!y||y(Z))&&!zi(S,Z.overlapMode))return m.push(!0),!0}}}_forEachCell(t,s,a,o,h,m,g,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(s),S=this._convertToXCellCoord(a),E=this._convertToYCellCoord(o);for(let O=v;O<=S;O++)for(let B=T;B<=E;B++)if(h.call(this,t,s,a,o,this.xCellCount*B+O,m,g,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,s,a,o,h,m){const g=o-t,y=h-s,v=a+m;return v*v>g*g+y*y}_circleAndRectCollide(t,s,a,o,h,m,g){const y=(m-o)/2,v=Math.abs(t-(o+y));if(v>y+a)return!1;const T=(g-h)/2,S=Math.abs(s-(h+T));if(S>T+a)return!1;if(v<=y||S<=T)return!0;const E=v-y,O=S-T;return E*E+O*O<=a*a}}function Cr(c,t,s,a,o){const h=p.F();return t?(p.J(h,h,[1/o,1/o,1]),s||p.ad(h,h,a.angle)):p.K(h,a.labelPlaneMatrix,c),h}function dr(c,t,s,a,o){if(t){const h=p.ae(c);return p.J(h,h,[o,o,1]),s||p.ad(h,h,-a.angle),h}return a.glCoordMatrix}function F(c,t,s){let a;s?(a=[c.x,c.y,s(c.x,c.y),1],p.af(a,a,t)):(a=[c.x,c.y,0,1],Re(a,a,t));const o=a[3];return{point:new p.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o}}function I(c,t){return .5+c/t*.5}function C(c,t){const s=c[0]/c[3],a=c[1]/c[3];return s>=-t[0]&&s<=t[0]&&a>=-t[1]&&a<=t[1]}function z(c,t,s,a,o,h,m,g,y,v){const T=a?c.textSizeData:c.iconSizeData,S=p.ag(T,s.transform.zoom),E=[256/s.width*2+1,256/s.height*2+1],O=a?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;O.clear();const B=c.lineVertexArray,U=a?c.text.placedSymbolArray:c.icon.placedSymbolArray,D=s.transform.width/s.transform.height;let Z=!1;for(let Q=0;QMath.abs(s.x-t.x)*a?{useVertical:!0}:(c===p.ah.vertical?t.ys.x)?{needsFlipping:!0}:null}function H(c,t,s,a,o,h,m,g,y,v,T,S,E,O,B,U){const D=t/24,Z=c.lineOffsetX*D,Q=c.lineOffsetY*D;let N;if(c.numGlyphs>1){const X=c.glyphStartIndex+c.numGlyphs,ee=c.lineStartIndex,te=c.lineStartIndex+c.lineLength,ie=R(D,g,Z,Q,s,T,S,c,y,h,E,B,U);if(!ie)return{notEnoughRoom:!0};const de=F(ie.first.point,m,U).point,ce=F(ie.last.point,m,U).point;if(a&&!s){const ue=G(c.writingMode,de,ce,O);if(ue)return ue}N=[ie.first];for(let ue=c.glyphStartIndex+1;ue0?de.point:K(S,ie,ee,1,o,U),ue=G(c.writingMode,ee,ce,O);if(ue)return ue}const X=ne(D*g.getoffsetX(c.glyphStartIndex),Z,Q,s,T,S,c.segment,c.lineStartIndex,c.lineStartIndex+c.lineLength,y,h,E,B,U);if(!X)return{notEnoughRoom:!0};N=[X]}for(const X of N)p.aj(v,X.point,X.angle);return{}}function K(c,t,s,a,o,h){const m=F(c.add(c.sub(t)._unit()),o,h).point,g=s.sub(m);return s.add(g._mult(a/g.mag()))}function q(c,t){const{projectionCache:s,lineVertexArray:a,labelPlaneMatrix:o,tileAnchorPoint:h,distanceFromAnchor:m,getElevation:g,previousVertex:y,direction:v,absOffsetX:T}=t;if(s.projections[c])return s.projections[c];const S=new p.P(a.getx(c),a.gety(c)),E=F(S,o,g);if(E.signedDistanceFromCamera>0)return s.projections[c]=E.point,E.point;const O=c-v;return K(m===0?h:new p.P(a.getx(O),a.gety(O)),S,y,T-m+1,o,g)}function J(c,t,s){return c._unit()._perp()._mult(t*s)}function he(c,t,s,a,o,h,m,g){const{projectionCache:y,direction:v}=g;if(y.offsets[c])return y.offsets[c];const T=s.add(t);if(c+v=o)return y.offsets[c]=T,T;const S=q(c+v,g),E=J(S.sub(s),m,v),O=s.add(E),B=S.add(E);return y.offsets[c]=p.ak(h,T,O,B)||T,y.offsets[c]}function ne(c,t,s,a,o,h,m,g,y,v,T,S,E,O){const B=a?c-t:c+t;let U=B>0?1:-1,D=0;a&&(U*=-1,D=Math.PI),U<0&&(D+=Math.PI);let Z,Q,N=U>0?g+m:g+m+1,X=o,ee=o,te=0,ie=0;const de=Math.abs(B),ce=[];let ue;for(;te+ie<=de;){if(N+=U,N=y)return null;te+=ie,ee=X,Q=Z;const _e={projectionCache:S,lineVertexArray:v,labelPlaneMatrix:T,tileAnchorPoint:h,distanceFromAnchor:te,getElevation:O,previousVertex:ee,direction:U,absOffsetX:de};if(X=q(N,_e),s===0)ce.push(ee),ue=X.sub(ee);else{let Le;const $e=X.sub(ee);Le=$e.mag()===0?J(q(N+U,_e).sub(X),s,U):J($e,s,U),Q||(Q=ee.add(Le)),Z=he(N,Le,X,g,y,Q,s,_e),ce.push(Q),ue=Z.sub(Q)}ie=ue.mag()}const Se=ue._mult((de-te)/ie)._add(Q||ee),Oe=D+Math.atan2(X.y-ee.y,X.x-ee.x);return ce.push(Se),{point:Se,angle:E?Oe:0,path:ce}}const oe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Pe(c,t){for(let s=0;s=1;qe--)$e.push(_e.path[qe]);for(let qe=1;qeF(Ze,y,B));$e=qe.some(Ze=>Ze.signedDistanceFromCamera<=0)?[]:qe.map(Ze=>Ze.point)}let Be=[];if($e.length>0){const qe=$e[0].clone(),Ze=$e[0].clone();for(let mt=1;mt<$e.length;mt++)qe.x=Math.min(qe.x,$e[mt].x),qe.y=Math.min(qe.y,$e[mt].y),Ze.x=Math.max(Ze.x,$e[mt].x),Ze.y=Math.max(Ze.y,$e[mt].y);Be=qe.x>=ue.x&&Ze.x<=Se.x&&qe.y>=ue.y&&Ze.y<=Se.y?[$e]:Ze.xSe.x||Ze.ySe.y?[]:p.al([$e],ue.x,ue.y,Se.x,Se.y)}for(const qe of Be){Oe.reset(qe,.25*ce);let Ze=0;Ze=Oe.length<=.5*ce?1:Math.ceil(Oe.paddedLength/We)+1;for(let mt=0;mt=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(t,s,a,o){return a>=0&&t=0&&sa.collisionGroupID===s}}return this.collisionGroups[t]}}function li(c,t,s,a,o){const{horizontalAlign:h,verticalAlign:m}=p.at(c);return new p.P(-(h-.5)*t+a[0]*o,-(m-.5)*s+a[1]*o)}function Zt(c,t,s,a,o,h){const{x1:m,x2:g,y1:y,y2:v,anchorPointX:T,anchorPointY:S}=c,E=new p.P(t,s);return a&&E._rotate(o?h:-h),{x1:m+E.x,y1:y+E.y,x2:g+E.x,y2:v+E.y,anchorPointX:T,anchorPointY:S}}class Jt{constructor(t,s,a,o,h){this.transform=t.clone(),this.terrain=s,this.collisionIndex=new Ye(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ft(o),this.collisionCircleArrays={},this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,s,a,o){const h=a.getBucket(s),m=a.latestFeatureIndex;if(!h||!m||s.id!==h.layerIds[0])return;const g=a.collisionBoxArray,y=h.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),T=a.tileSize/p.W,S=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),E=y.get("text-pitch-alignment")==="map",O=y.get("text-rotation-alignment")==="map",B=Fe(a,1,this.transform.zoom),U=Cr(S,E,O,this.transform,B);let D=null;if(E){const Q=dr(S,E,O,this.transform,B);D=p.K([],this.transform.labelPlaneMatrix,Q)}this.retainedQueryData[h.bucketInstanceId]=new gt(h.bucketInstanceId,m,h.sourceLayerIndex,h.index,a.tileID);const Z={bucket:h,layout:y,posMatrix:S,textLabelPlaneMatrix:U,labelToScreenMatrix:D,scale:v,textPixelRatio:T,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:p.ag(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(o)for(const Q of h.sortKeyRanges){const{sortKey:N,symbolInstanceStart:X,symbolInstanceEnd:ee}=Q;t.push({sortKey:N,symbolInstanceStart:X,symbolInstanceEnd:ee,parameters:Z})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:Z})}attemptAnchorPlacement(t,s,a,o,h,m,g,y,v,T,S,E,O,B,U,D){const Z=p.ap[t.textAnchor],Q=[t.textOffset0,t.textOffset1],N=li(Z,a,o,Q,h),X=this.collisionIndex.placeCollisionBox(Zt(s,N.x,N.y,m,g,this.transform.angle),S,y,v,T.predicate,D);if((!U||this.collisionIndex.placeCollisionBox(Zt(U,N.x,N.y,m,g,this.transform.angle),S,y,v,T.predicate,D).box.length!==0)&&X.box.length>0){let ee;if(this.prevPlacement&&this.prevPlacement.variableOffsets[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID].text&&(ee=this.prevPlacement.variableOffsets[E.crossTileID].anchor),E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[E.crossTileID]={textOffset:Q,width:a,height:o,anchor:Z,textBoxScale:h,prevAnchor:ee},this.markUsedJustification(O,Z,E,B),O.allowVerticalPlacement&&(this.markUsedOrientation(O,B,E),this.placedOrientations[E.crossTileID]=B),{shift:N,placedGlyphBoxes:X}}}placeLayerBucketPart(t,s,a){const{bucket:o,layout:h,posMatrix:m,textLabelPlaneMatrix:g,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:S,partiallyEvaluatedTextSize:E,collisionGroup:O}=t.parameters,B=h.get("text-optional"),U=h.get("icon-optional"),D=p.aq(h,"text-overlap","text-allow-overlap"),Z=D==="always",Q=p.aq(h,"icon-overlap","icon-allow-overlap"),N=Q==="always",X=h.get("text-rotation-alignment")==="map",ee=h.get("text-pitch-alignment")==="map",te=h.get("icon-text-fit")!=="none",ie=h.get("symbol-z-order")==="viewport-y",de=Z&&(N||!o.hasIconData()||U),ce=N&&(Z||!o.hasTextData()||B);!o.collisionArrays&&S&&o.deserializeCollisionBoxes(S);const ue=this.retainedQueryData[o.bucketInstanceId].tileID,Se=this.terrain?(_e,Le)=>this.terrain.getElevation(ue,_e,Le):null,Oe=(_e,Le)=>{var $e,We;if(s[_e.crossTileID])return;if(T)return void(this.placements[_e.crossTileID]=new Tt(!1,!1,!1));let Be=!1,qe=!1,Ze=!0,mt=null,at={box:null,offscreen:null},ui={box:null,offscreen:null},Pt=null,lt=null,Ht=null,ji=0,nr=0,rs=0;Le.textFeatureIndex?ji=Le.textFeatureIndex:_e.useRuntimeCollisionCircles&&(ji=_e.featureIndex),Le.verticalTextFeatureIndex&&(nr=Le.verticalTextFeatureIndex);const ss=Le.textBox;if(ss){const yt=pt=>{let Vt=p.ah.horizontal;if(o.allowVerticalPlacement&&!pt&&this.prevPlacement){const Si=this.prevPlacement.placedOrientations[_e.crossTileID];Si&&(this.placedOrientations[_e.crossTileID]=Si,Vt=Si,this.markUsedOrientation(o,Vt,_e))}return Vt},ut=(pt,Vt)=>{if(o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(const Si of o.writingModes)if(Si===p.ah.vertical?(at=Vt(),ui=at):at=pt(),at&&at.box&&at.box.length)break}else at=pt()},wt=_e.textAnchorOffsetStartIndex,Fs=_e.textAnchorOffsetEndIndex;if(Fs===wt){const pt=(Vt,Si)=>{const He=this.collisionIndex.placeCollisionBox(Vt,D,v,m,O.predicate,Se);return He&&He.box&&He.box.length&&(this.markUsedOrientation(o,Si,_e),this.placedOrientations[_e.crossTileID]=Si),He};ut(()=>pt(ss,p.ah.horizontal),()=>{const Vt=Le.verticalTextBox;return o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Vt?pt(Vt,p.ah.vertical):{box:null,offscreen:null}}),yt(at&&at.box&&at.box.length)}else{let pt=p.ap[(We=($e=this.prevPlacement)===null||$e===void 0?void 0:$e.variableOffsets[_e.crossTileID])===null||We===void 0?void 0:We.anchor];const Vt=(He,Xa,el)=>{const ns=He.x2-He.x1,as=He.y2-He.y1,Hn=_e.textBoxScale,Ka=te&&Q==="never"?Xa:null;let os={box:[],offscreen:!1},tl=D==="never"?1:2,Ya="never";pt&&tl++;for(let il=0;ilVt(ss,Le.iconBox,p.ah.horizontal),()=>{const He=Le.verticalTextBox;return o.allowVerticalPlacement&&!(at&&at.box&&at.box.length)&&_e.numVerticalGlyphVertices>0&&He?Vt(He,Le.verticalIconBox,p.ah.vertical):{box:null,offscreen:null}}),at&&(Be=at.box,Ze=at.offscreen);const Si=yt(at&&at.box);if(!Be&&this.prevPlacement){const He=this.prevPlacement.variableOffsets[_e.crossTileID];He&&(this.variableOffsets[_e.crossTileID]=He,this.markUsedJustification(o,He.anchor,_e,Si))}}}if(Pt=at,Be=Pt&&Pt.box&&Pt.box.length>0,Ze=Pt&&Pt.offscreen,_e.useRuntimeCollisionCircles){const yt=o.text.placedSymbolArray.get(_e.centerJustifiedTextSymbolIndex),ut=p.ai(o.textSizeData,E,yt),wt=h.get("text-padding");lt=this.collisionIndex.placeCollisionCircles(D,yt,o.lineVertexArray,o.glyphOffsetArray,ut,m,g,y,a,ee,O.predicate,_e.collisionCircleDiameter,wt,Se),lt.circles.length&<.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),Be=Z||lt.circles.length>0&&!lt.collisionDetected,Ze=Ze&<.offscreen}if(Le.iconFeatureIndex&&(rs=Le.iconFeatureIndex),Le.iconBox){const yt=ut=>{const wt=te&&mt?Zt(ut,mt.x,mt.y,X,ee,this.transform.angle):ut;return this.collisionIndex.placeCollisionBox(wt,Q,v,m,O.predicate,Se)};ui&&ui.box&&ui.box.length&&Le.verticalIconBox?(Ht=yt(Le.verticalIconBox),qe=Ht.box.length>0):(Ht=yt(Le.iconBox),qe=Ht.box.length>0),Ze=Ze&&Ht.offscreen}const ar=B||_e.numHorizontalGlyphVertices===0&&_e.numVerticalGlyphVertices===0,qi=U||_e.numIconVertices===0;if(ar||qi?qi?ar||(qe=qe&&Be):Be=qe&&Be:qe=Be=qe&&Be,Be&&Pt&&Pt.box&&this.collisionIndex.insertCollisionBox(Pt.box,D,h.get("text-ignore-placement"),o.bucketInstanceId,ui&&ui.box&&nr?nr:ji,O.ID),qe&&Ht&&this.collisionIndex.insertCollisionBox(Ht.box,Q,h.get("icon-ignore-placement"),o.bucketInstanceId,rs,O.ID),lt&&(Be&&this.collisionIndex.insertCollisionCircles(lt.circles,D,h.get("text-ignore-placement"),o.bucketInstanceId,ji,O.ID),a)){const yt=o.bucketInstanceId;let ut=this.collisionCircleArrays[yt];ut===void 0&&(ut=this.collisionCircleArrays[yt]=new Ne);for(let wt=0;wt=0;--Le){const $e=_e[Le];Oe(o.symbolInstances.get($e),o.collisionArrays[$e])}}else for(let _e=t.symbolInstanceStart;_e=0&&(t.text.placedSymbolArray.get(g).crossTileID=h>=0&&g!==h?0:a.crossTileID)}markUsedOrientation(t,s,a){const o=s===p.ah.horizontal||s===p.ah.horizontalOnly?s:0,h=s===p.ah.vertical?s:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const g of m)t.text.placedSymbolArray.get(g).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let a=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const o=s?s.symbolFadeChange(t):1,h=s?s.opacities:{},m=s?s.variableOffsets:{},g=s?s.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=h[y];T?(this.opacities[y]=new st(T,o,v.text,v.icon),a=a||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new st(null,o,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in h){const v=h[y];if(!this.opacities[y]){const T=new st(v,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:t)}updateLayerOpacities(t,s){const a={};for(const o of s){const h=o.getBucket(t);h&&o.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a,o.collisionBoxArray)}}updateBucketOpacities(t,s,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0],h=o.layout,m=new st(null,0,!1,!1,!0),g=h.get("text-allow-overlap"),y=h.get("icon-allow-overlap"),v=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),T=h.get("text-rotation-alignment")==="map",S=h.get("text-pitch-alignment")==="map",E=h.get("icon-text-fit")!=="none",O=new st(null,0,g&&(y||!t.hasIconData()||h.get("icon-optional")),y&&(g||!t.hasTextData()||h.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const B=(U,D,Z)=>{for(let Q=0;Q0,te=this.placedOrientations[D.crossTileID],ie=te===p.ah.vertical,de=te===p.ah.horizontal||te===p.ah.horizontalOnly;if(Z>0||Q>0){const ce=_o(X.text);B(t.text,Z,ie?Gt:ce),B(t.text,Q,de?Gt:ce);const ue=X.text.isHidden();[D.rightJustifiedTextSymbolIndex,D.centerJustifiedTextSymbolIndex,D.leftJustifiedTextSymbolIndex].forEach(_e=>{_e>=0&&(t.text.placedSymbolArray.get(_e).hidden=ue||ie?1:0)}),D.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(D.verticalPlacedTextSymbolIndex).hidden=ue||de?1:0);const Se=this.variableOffsets[D.crossTileID];Se&&this.markUsedJustification(t,Se.anchor,D,te);const Oe=this.placedOrientations[D.crossTileID];Oe&&(this.markUsedJustification(t,"left",D,Oe),this.markUsedOrientation(t,Oe,D))}if(ee){const ce=_o(X.icon),ue=!(E&&D.verticalPlacedIconSymbolIndex&&ie);D.placedIconSymbolIndex>=0&&(B(t.icon,D.numIconVertices,ue?ce:Gt),t.icon.placedSymbolArray.get(D.placedIconSymbolIndex).hidden=X.icon.isHidden()),D.verticalPlacedIconSymbolIndex>=0&&(B(t.icon,D.numVerticalIconVertices,ue?Gt:ce),t.icon.placedSymbolArray.get(D.verticalPlacedIconSymbolIndex).hidden=X.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ce=t.collisionArrays[U];if(ce){let ue=new p.P(0,0);if(ce.textBox||ce.verticalTextBox){let Oe=!0;if(v){const _e=this.variableOffsets[N];_e?(ue=li(_e.anchor,_e.width,_e.height,_e.textOffset,_e.textBoxScale),T&&ue._rotate(S?this.transform.angle:-this.transform.angle)):Oe=!1}ce.textBox&&xi(t.textCollisionBox.collisionVertexArray,X.text.placed,!Oe||ie,ue.x,ue.y),ce.verticalTextBox&&xi(t.textCollisionBox.collisionVertexArray,X.text.placed,!Oe||de,ue.x,ue.y)}const Se=!!(!de&&ce.verticalIconBox);ce.iconBox&&xi(t.iconCollisionBox.collisionVertexArray,X.icon.placed,Se,E?ue.x:0,E?ue.y:0),ce.verticalIconBox&&xi(t.iconCollisionBox.collisionVertexArray,X.icon.placed,!Se,E?ue.x:0,E?ue.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=U.invProjMatrix,t.placementViewportMatrix=U.viewportMatrix,t.collisionCircleArray=U.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function xi(c,t,s,a,o){c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0)}const go=Math.pow(2,25),Il=Math.pow(2,24),it=Math.pow(2,17),aa=Math.pow(2,16),oa=Math.pow(2,9),vi=Math.pow(2,8),bi=Math.pow(2,1);function _o(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;const t=c.placed?1:0,s=Math.floor(127*c.opacity);return s*go+t*Il+s*it+t*aa+s*oa+t*vi+s*bi+t}const Gt=0;class ki{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,s,a,o,h){const m=this._bucketParts;for(;this._currentTileIndexg.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&xe.now()-o>2;for(;this._currentPlacementIndex>=0;){const m=s[t[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new ki(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Pr=512/p.W/2;class Ct{constructor(t,s,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let h=0;h({x:Math.floor(y.anchorX*Pr),y:Math.floor(y.anchorY*Pr)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){const y=new p.au(g.positions.length,16,Uint16Array);for(const{x:v,y:T}of g.positions)y.add(v,T);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[h]=g}}getScaledCoordinates(t,s){const{x:a,y:o,z:h}=this.tileID.canonical,{x:m,y:g,z:y}=s.canonical,v=Pr/Math.pow(2,y-h),T=(g*p.W+t.anchorY)*v,S=o*p.W*Pr;return{x:Math.floor((m*p.W+t.anchorX)*v-a*p.W*Pr),y:Math.floor(T-S)}}findMatches(t,s,a){const o=this.tileID.canonical.zt)}}class Xs{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Hr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const s=Math.round((t-this.lng)/360);if(s!==0)for(const a in this.indexes){const o=this.indexes[a],h={};for(const m in o){const g=o[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+s),h[g.tileID.key]=g}this.indexes[a]=h}this.lng=t}addBucket(t,s,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let h=0;ht.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(t)&&y.findMatches(s.symbolInstances,t,o)}else{const g=m[t.scaledTo(Number(h)).key];g&&g.findMatches(s.symbolInstances,t,o)}}for(let h=0;h{s[a]=!0});for(const a in this.layerIndexes)s[a]||delete this.layerIndexes[a]}}const Wr=(c,t)=>p.t(c,t&&t.filter(s=>s.identifier!=="source.canvas")),Ui=p.av();class vn extends p.E{constructor(t,s={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=t,this.dispatcher=new ps(Vi(),t._getMapId()),this.dispatcher.registerMessageHandler("getGlyphs",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("getImages",(a,o)=>this.getImages(a,o)),this.imageManager=new Fi,this.imageManager.setEventedParent(this),this.glyphManager=new Ji(t._requestManager,s.localIdeographFontFamily),this.lineAtlas=new ai(256,512),this.crossTileSymbolIndex=new vt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",p.ax()),yi().on(_s,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const h=o.getSource();if(h&&h.vectorLayerIds)for(const m in this._layers){const g=this._layers[m];g.source===h.id&&this._validateLayer(g)}})}loadURL(t,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const o=this.map._requestManager.transformRequest(t,Ut.Style);this._loadStyleRequest=new AbortController,p.h(o,this._loadStyleRequest).then(h=>{this._loadStyleRequest=null,this._load(h.data,s,a)}).catch(h=>{this._loadStyleRequest=null,h&&this.fire(new p.j(h))})}loadJSON(t,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,xe.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,s.validate=s.validate!==!1,this._load(t,s,a)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Ui,{validate:!1})}_load(t,s,a){var o;const h=s.transformStyle?s.transformStyle(a,t):t;if(!s.validate||!Wr(this,p.x(h))){this._loaded=!0,this.stylesheet=h;for(const m in h.sources)this.addSource(m,h.sources[m],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new ni(this.stylesheet.light),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){const t=p.ay(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(s=>s.id),this._layers={},this._serializedLayers=null;for(const s of t){const a=p.az(s);a.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=a}}_loadSprite(t,s=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,m,g,y){return p._(this,void 0,void 0,function*(){const v=si(h),T=g>1?"@2x":"",S={},E={};for(const{id:O,url:B}of v){const U=m.transformRequest(m.normalizeSpriteURL(B,T,".json"),Ut.SpriteJSON);S[O]=p.h(U,y);const D=m.transformRequest(m.normalizeSpriteURL(B,T,".png"),Ut.SpriteImage);E[O]=_i.getImage(D,y)}return yield Promise.all([...Object.values(S),...Object.values(E)]),function(O,B){return p._(this,void 0,void 0,function*(){const U={};for(const D in O){U[D]={};const Z=xe.getImageCanvasContext((yield B[D]).data),Q=(yield O[D]).data;for(const N in Q){const{width:X,height:ee,x:te,y:ie,sdf:de,pixelRatio:ce,stretchX:ue,stretchY:Se,content:Oe}=Q[N];U[D][N]={data:null,pixelRatio:ce,sdf:de,stretchX:ue,stretchY:Se,content:Oe,spriteData:{width:X,height:ee,x:te,y:ie,context:Z}}}}return U})}(S,E)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const m in h){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in h)):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in h[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,h[m][y],!1):this.imageManager.addImage(v,h[m][y]),s&&(this._changedImages[v]=!0)}}}).catch(h=>{this._spriteRequest=null,o=h,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(t){const s=this.sourceCaches[t.source];if(!s)return;const a=t.sourceLayer;if(!a)return;const o=s.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new p.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const s=this._serializedAllLayers();if(!t||t.length===0)return Object.values(s);const a=[];for(const o of t)s[o]&&a.push(s[o]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const s=Object.keys(this._layers);for(const a of s){const o=this._layers[a];o.type!=="custom"&&(t[a]=o.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const s=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(o.length||h.length)&&this._updateWorkerLayers(o,h);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const h=this.sourceCaches[o];a[o]=h.used,h.used=!1}for(const o of this._order){const h=this._layers[o];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const o in a){const h=this.sourceCaches[o];a[o]!==h.used&&h.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.z=t.zoom,s&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,s){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,s={}){var a;this._checkLoaded();const o=this.serialize();if(t=s.transformStyle?s.transformStyle(o,t):t,((a=s.validate)===null||a===void 0||a)&&Wr(this,p.x(t)))return!1;(t=p.aA(t)).layers=p.ay(t.layers);const h=p.aB(o,t),m=this._getOperationsToPerform(h);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const g of m.operations)g();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const s=[],a=[];for(const o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":s.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":s.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":s.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":s.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":s.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":s.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":s.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":s.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":s.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":s.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":s.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":s.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":s.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":s.push(()=>{});break;default:a.push(o.command)}return{operations:s,unimplemented:a}}addImage(t,s){if(this.getImage(t))return this.fire(new p.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,s),this._afterImageUpdated(t)}updateImage(t,s){this.imageManager.updateImage(t,s)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new p.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,s,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(p.x.source,`sources.${t}`,s,null,a))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const o=this.sourceCaches[t]=new fe(t,s,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:t})),o.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new p.j(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const s=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],s.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,s){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(s),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,s,a={}){this._checkLoaded();const o=t.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let h;if(t.type==="custom"){if(Wr(this,p.aC(t)))return;h=p.az(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=p.aA(t),t=p.e(t,{source:o})),this._validate(p.x.layer,`layers.${o}`,t,{arrayIndex:-1},a))return;h=p.az(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:o}})}const m=s?this._order.indexOf(s):this._order.length;if(s&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${s}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=h,this._removedLayers[o]&&h.source&&h.type!=="custom"){const g=this._removedLayers[o];delete this._removedLayers[o],g.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,s){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new p.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===s)return;const a=this._order.indexOf(t);this._order.splice(a,1);const o=s?this._order.indexOf(s):this._order.length;s&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${t}" before non-existing layer "${s}".`))):(this._order.splice(o,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const s=this._layers[t];if(!s)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${t}".`)));s.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=s,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],s.onRemove&&s.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,s,a){this._checkLoaded();const o=this.getLayer(t);o?o.minzoom===s&&o.maxzoom===a||(s!=null&&(o.minzoom=s),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,s,a={}){this._checkLoaded();const o=this.getLayer(t);if(o){if(!p.aD(o.filter,s))return s==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.x.filter,`layers.${o.id}.filter`,s,null,a)||(o.filter=p.aA(s),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return p.aA(this.getLayer(t).filter)}setLayoutProperty(t,s,a,o={}){this._checkLoaded();const h=this.getLayer(t);h?p.aD(h.getLayoutProperty(s),a)||(h.setLayoutProperty(s,a,o),this._updateLayer(h)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,s){const a=this.getLayer(t);if(a)return a.getLayoutProperty(s);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,s,a,o={}){this._checkLoaded();const h=this.getLayer(t);h?p.aD(h.getPaintProperty(s),a)||(h.setPaintProperty(s,a,o)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new p.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,s){return this.getLayer(t).getPaintProperty(s)}setFeatureState(t,s){this._checkLoaded();const a=t.source,o=t.sourceLayer,h=this.sourceCaches[a];if(h===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const m=h.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(t.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(o,t.id,s)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,s){this._checkLoaded();const a=t.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const h=o.getSource().type,m=h==="vector"?t.sourceLayer:void 0;h!=="vector"||m?s&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,t.id,s):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const s=t.source,a=t.sourceLayer,o=this.sourceCaches[s];if(o!==void 0)return o.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,t.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=p.aE(this.sourceCaches,h=>h.serialize()),s=this._serializeByIds(this._order),a=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aF({version:o.version,name:o.name,metadata:o.metadata,light:o.light,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:t,layers:s,terrain:a},h=>h!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const s=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g)){a[g]=m;for(const y of t){const v=y[g];if(v)for(const T of v)o.push(T)}}}o.sort((m,g)=>g.intersectionZ-m.intersectionZ);const h=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g))for(let y=o.length-1;y>=0;y--){const v=o[y].feature;if(a[v.layer.id]{const de=Z.featureSortOrder;if(de){const ce=de.indexOf(te.featureIndex);return de.indexOf(ie.featureIndex)-ce}return ie.featureIndex-te.featureIndex});for(const te of ee)X.push(te)}}for(const Z in B)B[Z].forEach(Q=>{const N=Q.feature,X=v[g[Z].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=X});return B}(this._layers,m,this.sourceCaches,t,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,s){s&&s.filter&&this._validate(p.x.filter,"querySourceFeatures.filter",s.filter,null,s);const a=this.sourceCaches[t];return a?function(o,h){const m=o.getRenderableIds().map(v=>o.getTileByID(v)),g=[],y={};for(let v=0;vE.getTileByID(O)).sort((O,B)=>B.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(B.tileID)?-1:1))}const S=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(xe.now(),t.zoom))&&(this.pauseablePlacement=new yo(t,this.map.terrain,this._order,h,s,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(xe.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(xe.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,s){return p._(this,void 0,void 0,function*(){const a=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,s.icons),a})}getGlyphs(t,s){return p._(this,void 0,void 0,function*(){const a=yield this.glyphManager.getGlyphs(s.stacks),o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,s={}){this._checkLoaded(),t&&this._validate(p.x.glyphs,"glyphs",t,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,s,a={},o){this._checkLoaded();const h=[{id:t,url:s}],m=[...si(this.stylesheet.sprite),...h];this._validate(p.x.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(h,!0,o))}removeSprite(t){this._checkLoaded();const s=si(this.stylesheet.sprite);if(s.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;s.splice(s.findIndex(a=>a.id===t),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return si(this.stylesheet.sprite)}setSprite(t,s={},a){this._checkLoaded(),t&&this._validate(p.x.sprite,"sprite",t,null,s)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}var tr=p.X([{name:"a_pos",type:"Int16",components:2}]),la="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ys={prelude:tt(`#ifdef GL_ES -precision mediump float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -`,`#ifdef GL_ES -precision highp float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 -);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} -#ifdef TERRAIN3D -uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; -#endif -const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { -#ifdef TERRAIN3D -highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); -#else -return 1.0; -#endif -}float calculate_visibility(vec4 pos) { -#ifdef TERRAIN3D -vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; -#else -return 1.0; -#endif -}float ele(vec2 pos) { -#ifdef TERRAIN3D -vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; -#else -return 0.0; -#endif -}float get_elevation(vec2 pos) { -#ifdef TERRAIN3D -vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; -#else -return 0.0; -#endif -}`),background:tt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:tt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:tt(`varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:tt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tt(`uniform highp float u_intensity;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -void main(void) { -#pragma mapbox: initialize highp float weight -#pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:tt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(0.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:tt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:tt(`#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_FragColor=color*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:tt(`varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:tt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:tt(`varying vec4 v_color;void main() {gl_FragColor=v_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec4 v_color; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -vec3 normal=a_normal_ed.xyz; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:tt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 -? a_pos -: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; -#define PI 3.141592653589793 -void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:tt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),lineGradient:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),linePattern:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:tt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:tt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:tt(`#define SDF_PX 8.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:tt(`#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:tt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",la),terrainDepth:tt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",la),terrainCoords:tt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",la)};function tt(c,t){const s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),o=c.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=h?h.concat(o):o,g={};return{fragmentSource:c=c.replace(s,(y,v,T,S,E)=>(g[E]=!0,v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -varying ${T} ${S} ${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = u_${E}; -#endif -`)),vertexSource:t=t.replace(s,(y,v,T,S,E)=>{const O=S==="float"?"vec2":"vec4",B=E.match(/color/)?"color":O;return g[E]?v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -uniform lowp float u_${E}_t; -attribute ${T} ${O} a_${E}; -varying ${T} ${S} ${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:B==="vec4"?` -#ifndef HAS_UNIFORM_u_${E} - ${E} = a_${E}; -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${E} - ${E} = unpack_mix_${B}(a_${E}, u_${E}_t); -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -uniform lowp float u_${E}_t; -attribute ${T} ${O} a_${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:B==="vec4"?` -#ifndef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = a_${E}; -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = unpack_mix_${B}(a_${E}, u_${E}_t); -#else - ${T} ${S} ${E} = u_${E}; -#endif -`}),staticAttributes:a,staticUniforms:m}}class bn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,s,a,o,h,m,g,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==o.length;for(let S=0;!T&&S({u_depth:new p.aG(te,ie.u_depth),u_terrain:new p.aG(te,ie.u_terrain),u_terrain_dim:new p.aH(te,ie.u_terrain_dim),u_terrain_matrix:new p.aI(te,ie.u_terrain_matrix),u_terrain_unpack:new p.aJ(te,ie.u_terrain_unpack),u_terrain_exaggeration:new p.aH(te,ie.u_terrain_exaggeration)}))(t,ee),this.binderUniforms=a?a.getUniforms(t,ee):[]}draw(t,s,a,o,h,m,g,y,v,T,S,E,O,B,U,D,Z,Q){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(o),t.setColorMode(h),t.setCullFace(m),y){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(const ee in this.terrainUniforms)this.terrainUniforms[ee].set(y[ee])}for(const ee in this.fixedUniforms)this.fixedUniforms[ee].set(g[ee]);U&&U.setUniforms(t,this.binderUniforms,O,{zoom:B});let X=0;switch(s){case N.LINES:X=2;break;case N.TRIANGLES:X=3;break;case N.LINE_STRIP:X=1}for(const ee of E.get()){const te=ee.vaos||(ee.vaos={});(te[v]||(te[v]=new bn)).bind(t,this,T,U?U.getPaintVertexBuffers():[],S,ee.vertexOffset,D,Z,Q),N.drawElements(s,ee.primitiveLength*X,N.UNSIGNED_SHORT,ee.primitiveOffset*X*2)}}}function Ks(c,t,s){const a=1/Fe(s,1,t.transform.tileZoom),o=Math.pow(2,s.tileID.overscaledZ),h=s.tileSize*Math.pow(2,t.transform.tileZoom)/o,m=h*(s.tileID.canonical.x+s.tileID.wrap*o),g=h*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[a,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const xo=(c,t,s,a)=>{const o=t.style.light,h=o.properties.get("position"),m=[h.x,h.y,h.z],g=function(){var v=new p.A(9);return p.A!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();o.properties.get("anchor")==="viewport"&&function(v,T){var S=Math.sin(T),E=Math.cos(T);v[0]=E,v[1]=S,v[2]=0,v[3]=-S,v[4]=E,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(g,-t.transform.angle),function(v,T,S){var E=T[0],O=T[1],B=T[2];v[0]=E*S[0]+O*S[3]+B*S[6],v[1]=E*S[1]+O*S[4]+B*S[7],v[2]=E*S[2]+O*S[5]+B*S[8]}(m,m,g);const y=o.properties.get("color");return{u_matrix:c,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+s,u_opacity:a}},Al=(c,t,s,a,o,h,m)=>p.e(xo(c,t,s,a),Ks(h,t,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),wn=c=>({u_matrix:c}),vo=(c,t,s,a)=>p.e(wn(c),Ks(s,t,a)),bo=(c,t)=>({u_matrix:c,u_world:t}),Cl=(c,t,s,a,o)=>p.e(vo(c,t,s,a),{u_world:o}),wo=(c,t,s,a)=>{const o=c.transform;let h,m;if(a.paint.get("circle-pitch-alignment")==="map"){const g=Fe(s,1,o.zoom);h=!0,m=[g,g]}else h=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(t.posMatrix,s,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:c.pixelRatio,u_extrude_scale:m}},Pl=(c,t,s)=>{const a=Fe(s,1,t.zoom),o=Math.pow(2,t.zoom-s.tileID.overscaledZ),h=s.tileID.overscaleFactor();return{u_matrix:c,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*o),t.pixelsToGLUnits[1]/(a*o)],u_overscale_factor:h}},Tn=(c,t,s=1)=>({u_matrix:c,u_color:t,u_overlay:0,u_overlay_scale:s}),ha=c=>({u_matrix:c}),To=(c,t,s,a)=>({u_matrix:c,u_extrude_scale:Fe(t,1,s),u_intensity:a});function So(c,t){const s=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new p.Y(0,a/s).toLngLat().lat,new p.Y(0,(a+1)/s).toLngLat().lat]}const Sn=(c,t,s,a)=>{const o=c.transform;return{u_matrix:Js(c,t,s,a),u_ratio:1/Fe(t,1,o.zoom),u_device_pixel_ratio:c.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Xr=(c,t,s,a,o)=>p.e(Sn(c,t,s,o),{u_image:0,u_image_height:a}),In=(c,t,s,a,o)=>{const h=c.transform,m=Ys(t,h);return{u_matrix:Js(c,t,s,o),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Fe(t,1,h.zoom),u_device_pixel_ratio:c.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Di=(c,t,s,a,o,h)=>{const m=c.lineAtlas,g=Ys(t,c.transform),y=s.layout.get("line-cap")==="round",v=m.getDash(a.from,y),T=m.getDash(a.to,y),S=v.width*o.fromScale,E=T.width*o.toScale;return p.e(Sn(c,t,s,h),{u_patternscale_a:[g/S,-v.height/2],u_patternscale_b:[g/E,-T.height/2],u_sdfgamma:m.width/(256*Math.min(S,E)*c.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:o.t})};function Ys(c,t){return 1/Fe(c,1,t.tileZoom)}function Js(c,t,s,a){return c.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const Qs=(c,t,s,a,o)=>{return{u_matrix:c,u_tl_parent:t,u_scale_parent:s,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=o.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:An(o.paint.get("raster-hue-rotate"))};var h,m};function An(c){c*=Math.PI/180;const t=Math.sin(c),s=Math.cos(c);return[(2*s+1)/3,(-Math.sqrt(3)*t-s+1)/3,(Math.sqrt(3)*t-s+1)/3]}const en=(c,t,s,a,o,h,m,g,y,v)=>{const T=o.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:T.width/T.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:h,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},xs=(c,t,s,a,o,h,m,g,y,v,T)=>{const S=o.transform;return p.e(en(c,t,s,a,o,h,m,g,y,v),{u_gamma_scale:a?Math.cos(S._pitch)*S.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+T})},El=(c,t,s,a,o,h,m,g,y,v)=>p.e(xs(c,t,s,a,o,h,m,g,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Ml=(c,t,s)=>({u_matrix:c,u_opacity:t,u_color:s}),Io=(c,t,s,a,o,h)=>p.e(function(m,g,y,v){const T=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:E,height:O}=y.imageManager.getPixelSize(),B=Math.pow(2,v.tileID.overscaledZ),U=v.tileSize*Math.pow(2,y.transform.tileZoom)/B,D=U*(v.tileID.canonical.x+v.tileID.wrap*B),Z=U*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[E,O],u_mix:g.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/Fe(v,1,y.transform.tileZoom),u_pixel_coord_upper:[D>>16,Z>>16],u_pixel_coord_lower:[65535&D,65535&Z]}}(a,h,s,o),{u_matrix:c,u_opacity:t}),zl={fillExtrusion:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_lightpos:new p.aK(c,t.u_lightpos),u_lightintensity:new p.aH(c,t.u_lightintensity),u_lightcolor:new p.aK(c,t.u_lightcolor),u_vertical_gradient:new p.aH(c,t.u_vertical_gradient),u_opacity:new p.aH(c,t.u_opacity)}),fillExtrusionPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_lightpos:new p.aK(c,t.u_lightpos),u_lightintensity:new p.aH(c,t.u_lightintensity),u_lightcolor:new p.aK(c,t.u_lightcolor),u_vertical_gradient:new p.aH(c,t.u_vertical_gradient),u_height_factor:new p.aH(c,t.u_height_factor),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade),u_opacity:new p.aH(c,t.u_opacity)}),fill:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix)}),fillPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),fillOutline:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world)}),fillOutlinePattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),circle:(c,t)=>({u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_scale_with_map:new p.aG(c,t.u_scale_with_map),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_extrude_scale:new p.aL(c,t.u_extrude_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_matrix:new p.aI(c,t.u_matrix)}),collisionBox:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pixels_to_tile_units:new p.aH(c,t.u_pixels_to_tile_units),u_extrude_scale:new p.aL(c,t.u_extrude_scale),u_overscale_factor:new p.aH(c,t.u_overscale_factor)}),collisionCircle:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_inv_matrix:new p.aI(c,t.u_inv_matrix),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_viewport_size:new p.aL(c,t.u_viewport_size)}),debug:(c,t)=>({u_color:new p.aM(c,t.u_color),u_matrix:new p.aI(c,t.u_matrix),u_overlay:new p.aG(c,t.u_overlay),u_overlay_scale:new p.aH(c,t.u_overlay_scale)}),clippingMask:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix)}),heatmap:(c,t)=>({u_extrude_scale:new p.aH(c,t.u_extrude_scale),u_intensity:new p.aH(c,t.u_intensity),u_matrix:new p.aI(c,t.u_matrix)}),heatmapTexture:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world),u_image:new p.aG(c,t.u_image),u_color_ramp:new p.aG(c,t.u_color_ramp),u_opacity:new p.aH(c,t.u_opacity)}),hillshade:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_latrange:new p.aL(c,t.u_latrange),u_light:new p.aL(c,t.u_light),u_shadow:new p.aM(c,t.u_shadow),u_highlight:new p.aM(c,t.u_highlight),u_accent:new p.aM(c,t.u_accent)}),hillshadePrepare:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_dimension:new p.aL(c,t.u_dimension),u_zoom:new p.aH(c,t.u_zoom),u_unpack:new p.aJ(c,t.u_unpack)}),line:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels)}),lineGradient:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_image:new p.aG(c,t.u_image),u_image_height:new p.aH(c,t.u_image_height)}),linePattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texsize:new p.aL(c,t.u_texsize),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_image:new p.aG(c,t.u_image),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),lineSDF:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_patternscale_a:new p.aL(c,t.u_patternscale_a),u_patternscale_b:new p.aL(c,t.u_patternscale_b),u_sdfgamma:new p.aH(c,t.u_sdfgamma),u_image:new p.aG(c,t.u_image),u_tex_y_a:new p.aH(c,t.u_tex_y_a),u_tex_y_b:new p.aH(c,t.u_tex_y_b),u_mix:new p.aH(c,t.u_mix)}),raster:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_tl_parent:new p.aL(c,t.u_tl_parent),u_scale_parent:new p.aH(c,t.u_scale_parent),u_buffer_scale:new p.aH(c,t.u_buffer_scale),u_fade_t:new p.aH(c,t.u_fade_t),u_opacity:new p.aH(c,t.u_opacity),u_image0:new p.aG(c,t.u_image0),u_image1:new p.aG(c,t.u_image1),u_brightness_low:new p.aH(c,t.u_brightness_low),u_brightness_high:new p.aH(c,t.u_brightness_high),u_saturation_factor:new p.aH(c,t.u_saturation_factor),u_contrast_factor:new p.aH(c,t.u_contrast_factor),u_spin_weights:new p.aK(c,t.u_spin_weights)}),symbolIcon:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texture:new p.aG(c,t.u_texture)}),symbolSDF:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texture:new p.aG(c,t.u_texture),u_gamma_scale:new p.aH(c,t.u_gamma_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_is_halo:new p.aG(c,t.u_is_halo)}),symbolTextAndIcon:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texsize_icon:new p.aL(c,t.u_texsize_icon),u_texture:new p.aG(c,t.u_texture),u_texture_icon:new p.aG(c,t.u_texture_icon),u_gamma_scale:new p.aH(c,t.u_gamma_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_is_halo:new p.aG(c,t.u_is_halo)}),background:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_opacity:new p.aH(c,t.u_opacity),u_color:new p.aM(c,t.u_color)}),backgroundPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_opacity:new p.aH(c,t.u_opacity),u_image:new p.aG(c,t.u_image),u_pattern_tl_a:new p.aL(c,t.u_pattern_tl_a),u_pattern_br_a:new p.aL(c,t.u_pattern_br_a),u_pattern_tl_b:new p.aL(c,t.u_pattern_tl_b),u_pattern_br_b:new p.aL(c,t.u_pattern_br_b),u_texsize:new p.aL(c,t.u_texsize),u_mix:new p.aH(c,t.u_mix),u_pattern_size_a:new p.aL(c,t.u_pattern_size_a),u_pattern_size_b:new p.aL(c,t.u_pattern_size_b),u_scale_a:new p.aH(c,t.u_scale_a),u_scale_b:new p.aH(c,t.u_scale_b),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aH(c,t.u_tile_units_to_pixels)}),terrain:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texture:new p.aG(c,t.u_texture),u_ele_delta:new p.aH(c,t.u_ele_delta)}),terrainDepth:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ele_delta:new p.aH(c,t.u_ele_delta)}),terrainCoords:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texture:new p.aG(c,t.u_texture),u_terrain_coords_id:new p.aH(c,t.u_terrain_coords_id),u_ele_delta:new p.aH(c,t.u_ele_delta)})};class Kr{constructor(t,s,a){this.context=t;const o=t.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Cn={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class wi{constructor(t,s,a,o){this.length=s.length,this.attributes=a,this.itemSize=s.bytesPerElement,this.dynamicDraw=o,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,s){for(let a=0;a0){const ue=p.F(),Se=ie;p.aP(ue,te.placementInvProjMatrix,c.transform.glCoordMatrix),p.aP(ue,ue,te.placementViewportMatrix),T.push({circleArray:ce,circleOffset:E,transform:Se,invTransform:ue,coord:X}),S+=ce.length/4,E=S}de&&v.draw(g,y.LINES,Je.disabled,ot.disabled,c.colorModeForRenderPass(),nt.disabled,Pl(ie,c.transform,ee),c.style.map.terrain&&c.style.map.terrain.getTerrainData(X),s.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,null,c.transform.zoom,null,null,de.collisionVertexBuffer)}if(!m||!T.length)return;const O=c.useProgram("collisionCircle"),B=new p.aQ;B.resize(4*S),B._trim();let U=0;for(const N of T)for(let X=0;X=0&&(B[D.associatedIconIndex]={shiftedAnchor:Oe,angle:_e})}else Pe(D.numGlyphs,E)}if(v){O.clear();const U=c.icon.placedSymbolArray;for(let D=0;Dc.style.map.terrain.getElevation(de,Si,He):null,Vt=s.layout.get("text-rotation-alignment")==="map";z(ue,de.posMatrix,c,o,ji,nr,D,v,Vt,pt)}const ar=c.translatePosMatrix(de.posMatrix,ce,h,m),qi=Z||o&&te||ss?Lo:ji,yt=c.translatePosMatrix(nr,ce,h,m,!0),ut=_e&&s.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let wt;wt=_e?ue.iconsInText?El(Le.kind,Be,Q,D,c,ar,qi,yt,Ze,Pt):xs(Le.kind,Be,Q,D,c,ar,qi,yt,o,Ze,!0):en(Le.kind,Be,Q,D,c,ar,qi,yt,o,Ze);const Fs={program:We,buffers:Se,uniformValues:wt,atlasTexture:mt,atlasTextureIcon:lt,atlasInterpolation:at,atlasInterpolationIcon:ui,isSDF:_e,hasHalo:ut};if(N&&ue.canOverlap){X=!0;const pt=Se.segments.get();for(const Vt of pt)ie.push({segments:new p.$([Vt]),sortKey:Vt.sortKey,state:Fs,terrainData:qe})}else ie.push({segments:Se.segments,sortKey:0,state:Fs,terrainData:qe})}X&&ie.sort((de,ce)=>de.sortKey-ce.sortKey);for(const de of ie){const ce=de.state;if(E.activeTexture.set(O.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,O.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(E.activeTexture.set(O.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ce.isSDF){const ue=ce.uniformValues;ce.hasHalo&&(ue.u_is_halo=1,Rn(ce.buffers,de.segments,s,c,ce.program,ee,T,S,ue,de.terrainData)),ue.u_is_halo=0}Rn(ce.buffers,de.segments,s,c,ce.program,ee,T,S,ce.uniformValues,de.terrainData)}}function Rn(c,t,s,a,o,h,m,g,y,v){const T=a.context;o.draw(T,T.gl.TRIANGLES,h,m,g,nt.disabled,y,v,s.id,c.layoutVertexBuffer,c.indexBuffer,t,s.paint,a.transform.zoom,c.programConfigurations.get(s.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function Bo(c,t,s,a,o){if(!s||!a||!a.imageAtlas)return;const h=a.imageAtlas.patternPositions;let m=h[s.to.toString()],g=h[s.from.toString()];if(!m&&g&&(m=g),!g&&m&&(g=m),!m||!g){const y=o.getPaintProperty(t);m=h[y],g=h[y]}m&&g&&c.setConstantPatternPositions(m,g)}function ba(c,t,s,a,o,h,m){const g=c.context.gl,y="fill-pattern",v=s.paint.get(y),T=v&&v.constantOr(1),S=s.getCrossfadeParameters();let E,O,B,U,D;m?(O=T&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",E=g.LINES):(O=T?"fillPattern":"fill",E=g.TRIANGLES);const Z=v.constantOr(null);for(const Q of a){const N=t.getTile(Q);if(T&&!N.patternsLoaded())continue;const X=N.getBucket(s);if(!X)continue;const ee=X.programConfigurations.get(s.id),te=c.useProgram(O,ee),ie=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Q);T&&(c.context.activeTexture.set(g.TEXTURE0),N.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),ee.updatePaintBuffers(S)),Bo(ee,y,Z,N,s);const de=ie?Q:null,ce=c.translatePosMatrix(de?de.posMatrix:Q.posMatrix,N,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(m){U=X.indexBuffer2,D=X.segments2;const ue=[g.drawingBufferWidth,g.drawingBufferHeight];B=O==="fillOutlinePattern"&&T?Cl(ce,c,S,N,ue):bo(ce,ue)}else U=X.indexBuffer,D=X.segments,B=T?vo(ce,c,S,N):wn(ce);te.draw(c.context,E,o,c.stencilModeForClipping(Q),h,nt.disabled,B,ie,s.id,X.layoutVertexBuffer,U,D,s.paint,c.transform.zoom,ee)}}function Cs(c,t,s,a,o,h,m){const g=c.context,y=g.gl,v="fill-extrusion-pattern",T=s.paint.get(v),S=T.constantOr(1),E=s.getCrossfadeParameters(),O=s.paint.get("fill-extrusion-opacity"),B=T.constantOr(null);for(const U of a){const D=t.getTile(U),Z=D.getBucket(s);if(!Z)continue;const Q=c.style.map.terrain&&c.style.map.terrain.getTerrainData(U),N=Z.programConfigurations.get(s.id),X=c.useProgram(S?"fillExtrusionPattern":"fillExtrusion",N);S&&(c.context.activeTexture.set(y.TEXTURE0),D.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(E)),Bo(N,v,B,D,s);const ee=c.translatePosMatrix(U.posMatrix,D,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),te=s.paint.get("fill-extrusion-vertical-gradient"),ie=S?Al(ee,c,te,O,U,E,D):xo(ee,c,te,O);X.draw(g,g.gl.TRIANGLES,o,h,m,nt.backCCW,ie,Q,s.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,s.paint,c.transform.zoom,N,c.style.map.terrain&&Z.centroidVertexBuffer)}}function wa(c,t,s,a,o,h,m){const g=c.context,y=g.gl,v=s.fbo;if(!v)return;const T=c.useProgram("hillshade"),S=c.style.map.terrain&&c.style.map.terrain.getTerrainData(t);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(g,y.TRIANGLES,o,h,m,nt.disabled,((E,O,B,U)=>{const D=B.paint.get("hillshade-shadow-color"),Z=B.paint.get("hillshade-highlight-color"),Q=B.paint.get("hillshade-accent-color");let N=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=E.transform.angle);const X=!E.options.moving;return{u_matrix:U?U.posMatrix:E.transform.calculatePosMatrix(O.tileID.toUnwrapped(),X),u_image:0,u_latrange:So(0,O.tileID),u_light:[B.paint.get("hillshade-exaggeration"),N],u_shadow:D,u_highlight:Z,u_accent:Q}})(c,s,a,S?t:null),S,a.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}function Fo(c,t,s,a,o,h){const m=c.context,g=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,S=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||c.getTileTexture(T),t.demTexture){const O=t.demTexture;O.update(S,{premultiply:!1}),O.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else t.demTexture=new xt(m,S,g.RGBA,{premultiply:!1}),t.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let E=t.fbo;if(!E){const O=new xt(m,{width:v,height:v,data:null},g.RGBA);O.bind(g.LINEAR,g.CLAMP_TO_EDGE),E=t.fbo=m.createFramebuffer(v,v,!0,!1),E.colorAttachment.set(O.texture)}m.bindFramebuffer.set(E.framebuffer),m.viewport.set([0,0,v,v]),c.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,o,h,nt.disabled,((O,B)=>{const U=B.stride,D=p.F();return p.aN(D,0,p.W,-p.W,0,0,1),p.H(D,D,[0,-p.W,0]),{u_matrix:D,u_image:1,u_dimension:[U,U],u_zoom:O.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,y),null,s.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Oo(c,t,s,a,o,h){const m=a.paint.get("raster-fade-duration");if(!h&&m>0){const g=xe.now(),y=(g-c.timeAdded)/m,v=t?(g-t.timeAdded)/m:-1,T=s.getSource(),S=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),E=!t||Math.abs(t.tileID.overscaledZ-S)>Math.abs(c.tileID.overscaledZ-S),O=E&&c.refreshedUponExpiration?1:p.ac(E?y:1-v,0,1);return c.refreshedUponExpiration&&y>=1&&(c.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const Bn=new p.aO(1,0,0,1),Ta=new p.aO(0,1,0,1),Ul=new p.aO(0,0,1,1),Vo=new p.aO(1,0,1,1),bt=new p.aO(0,1,1,1);function Er(c,t,s,a){Ps(c,0,t+s/2,c.transform.width,s,a)}function Ti(c,t,s,a){Ps(c,t-s/2,0,s,c.transform.height,a)}function Ps(c,t,s,a,o,h){const m=c.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*c.pixelRatio,s*c.pixelRatio,a*c.pixelRatio,o*c.pixelRatio),m.clear({color:h}),g.disable(g.SCISSOR_TEST)}function Sa(c,t,s){const a=c.context,o=a.gl,h=s.posMatrix,m=c.useProgram("debug"),g=Je.disabled,y=ot.disabled,v=c.colorModeForRenderPass(),T="$debug",S=c.style.map.terrain&&c.style.map.terrain.getTerrainData(s);a.activeTexture.set(o.TEXTURE0);const E=t.getTileByID(s.key).latestRawTileData,O=Math.floor((E&&E.byteLength||0)/1024),B=t.getTile(s).tileSize,U=512/Math.min(B,512)*(s.overscaledZ/c.transform.zoom)*.5;let D=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(D+=` => ${s.overscaledZ}`),function(Z,Q){Z.initDebugOverlayCanvas();const N=Z.debugOverlayCanvas,X=Z.context.gl,ee=Z.debugOverlayCanvas.getContext("2d");ee.clearRect(0,0,N.width,N.height),ee.shadowColor="white",ee.shadowBlur=2,ee.lineWidth=1.5,ee.strokeStyle="white",ee.textBaseline="top",ee.font="bold 36px Open Sans, sans-serif",ee.fillText(Q,5,5),ee.strokeText(Q,5,5),Z.debugOverlayTexture.update(N),Z.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)}(c,`${D} ${O}kB`),m.draw(a,o.TRIANGLES,g,y,St.alphaBlended,nt.disabled,Tn(h,p.aO.transparent,U),null,T,c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments),m.draw(a,o.LINE_STRIP,g,y,v,nt.disabled,Tn(h,p.aO.red),S,T,c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments)}function Ia(c,t,s){const a=c.context,o=a.gl,h=c.colorModeForRenderPass(),m=new Je(o.LEQUAL,Je.ReadWrite,c.depthRangeFor3D),g=c.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,c.width,c.height]);for(const v of s){const T=c.renderToTexture.getTexture(v),S=t.getTerrainData(v.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);const E={u_matrix:c.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(c.transform.zoom)};g.draw(a,o.TRIANGLES,m,ot.disabled,h,nt.backCCW,E,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Es{constructor(t,s){this.context=new Do(t),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=fe.maxUnderzooming+fe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new vt}resize(t,s,a){if(this.width=Math.floor(t*a),this.height=Math.floor(s*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const t=this.context,s=new p.aV;s.emplaceBack(0,0),s.emplaceBack(p.W,0),s.emplaceBack(0,p.W),s.emplaceBack(p.W,p.W),this.tileExtentBuffer=t.createVertexBuffer(s,tr.members),this.tileExtentSegments=p.$.simpleSegment(0,0,4,2);const a=new p.aV;a.emplaceBack(0,0),a.emplaceBack(p.W,0),a.emplaceBack(0,p.W),a.emplaceBack(p.W,p.W),this.debugBuffer=t.createVertexBuffer(a,tr.members),this.debugSegments=p.$.simpleSegment(0,0,4,5);const o=new p.Z;o.emplaceBack(0,0,0,0),o.emplaceBack(p.W,0,p.W,0),o.emplaceBack(0,p.W,0,p.W),o.emplaceBack(p.W,p.W,p.W,p.W),this.rasterBoundsBuffer=t.createVertexBuffer(o,Nt.members),this.rasterBoundsSegments=p.$.simpleSegment(0,0,4,2);const h=new p.aV;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,tr.members),this.viewportSegments=p.$.simpleSegment(0,0,4,2);const m=new p.aW;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const g=new p.aX;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new ot({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,s=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=p.F();p.aN(a,0,this.width,this.height,0,0,1),p.J(a,a,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,s.TRIANGLES,Je.disabled,this.stencilClearMode,St.disabled,nt.disabled,ha(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,s){if(this.currentStencilSource===t.source||!t.isTileClipped()||!s||!s.length)return;this.currentStencilSource=t.source;const a=this.context,o=a.gl;this.nextStencilID+s.length>256&&this.clearStencil(),a.setColorMode(St.disabled),a.setDepthMode(Je.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of s){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(a,o.TRIANGLES,Je.disabled,new ot({func:o.ALWAYS,mask:0},g,255,o.KEEP,o.KEEP,o.REPLACE),St.disabled,nt.disabled,ha(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,s=this.context.gl;return new ot({func:s.NOTEQUAL,mask:255},t,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(t){const s=this.context.gl;return new ot({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(t){const s=this.context.gl,a=t.sort((m,g)=>g.overscaledZ-m.overscaledZ),o=a[a.length-1].overscaledZ,h=a[0].overscaledZ-o+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let g=0;g=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=o[y.source],T=h[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,v,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerD.source&&!D.isHidden(T)?[v.sourceCaches[D.source]]:[]),O=E.filter(D=>D.getSource().type==="vector"),B=E.filter(D=>D.getSource().type!=="vector"),U=D=>{(!S||S.getSource().maxzoomU(D)),S||B.forEach(D=>U(D)),S}(this.style,this.transform.zoom);y&&function(v,T,S){for(let E=0;E0),o&&(p.a_(s,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const g=h.context,y=g.gl,v=St.unblended,T=new Je(y.LEQUAL,Je.ReadWrite,[0,1]),S=m.getTerrainMesh(),E=m.sourceCache.getRenderableTiles(),O=h.useProgram("terrainDepth");g.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),g.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),g.clear({color:p.aO.transparent,depth:1});for(const B of E){const U=m.getTerrainData(B.tileID),D={u_matrix:h.transform.calculatePosMatrix(B.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};O.draw(g,y.TRIANGLES,T,ot.disabled,v,nt.backCCW,D,U,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const g=h.context,y=g.gl,v=St.unblended,T=new Je(y.LEQUAL,Je.ReadWrite,[0,1]),S=m.getTerrainMesh(),E=m.getCoordsTexture(),O=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainCoords");g.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),g.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),g.clear({color:p.aO.transparent,depth:1}),m.coordsIndex=[];for(const U of O){const D=m.getTerrainData(U.tileID);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,E.texture);const Z={u_matrix:h.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(g,y.TRIANGLES,T,ot.disabled,v,nt.backCCW,Z,D,"terrain",S.vertexBuffer,S.indexBuffer,S.segments),m.coordsIndex.push(U.tileID.key)}g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,s,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(h,m,g,y,v){if(h.renderPass!=="translucent")return;const T=ot.disabled,S=h.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(E,O,B,U,D,Z,Q){const N=O.transform,X=D==="map",ee=Z==="map";for(const te of E){const ie=U.getTile(te),de=ie.getBucket(B);if(!de||!de.text||!de.text.segments.get().length)continue;const ce=p.ag(de.textSizeData,N.zoom),ue=Fe(ie,1,O.transform.zoom),Se=Cr(te.posMatrix,ee,X,O.transform,ue),Oe=B.layout.get("icon-text-fit")!=="none"&&de.hasIconData();if(ce){const _e=Math.pow(2,N.zoom-ie.tileID.overscaledZ);Ln(de,X,ee,Q,N,Se,te.posMatrix,_e,ce,Oe,O.style.map.terrain?(Le,$e)=>O.style.map.terrain.getElevation(te,Le,$e):null)}}}(y,h,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),v),g.paint.get("icon-opacity").constantOr(1)!==0&&Ro(h,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),T,S),g.paint.get("text-opacity").constantOr(1)!==0&&Ro(h,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),T,S),m.map.showCollisionBoxes&&(kn(h,m,g,y,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),!0),kn(h,m,g,y,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),!1))})(t,s,a,o,this.style.placement.variableOffsets);break;case"circle":(function(h,m,g,y){if(h.renderPass!=="translucent")return;const v=g.paint.get("circle-opacity"),T=g.paint.get("circle-stroke-width"),S=g.paint.get("circle-stroke-opacity"),E=!g.layout.get("circle-sort-key").isConstant();if(v.constantOr(1)===0&&(T.constantOr(1)===0||S.constantOr(1)===0))return;const O=h.context,B=O.gl,U=h.depthModeForSublayer(0,Je.ReadOnly),D=ot.disabled,Z=h.colorModeForRenderPass(),Q=[];for(let N=0;NN.sortKey-X.sortKey);for(const N of Q){const{programConfiguration:X,program:ee,layoutVertexBuffer:te,indexBuffer:ie,uniformValues:de,terrainData:ce}=N.state;ee.draw(O,B.TRIANGLES,U,D,Z,nt.disabled,de,ce,g.id,te,ie,N.segments,g.paint,h.transform.zoom,X)}})(t,s,a,o);break;case"heatmap":(function(h,m,g,y){if(g.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const v=h.context,T=v.gl,S=ot.disabled,E=new St([T.ONE,T.ONE],p.aO.transparent,[!0,!0,!0,!0]);(function(O,B,U){const D=O.gl;O.activeTexture.set(D.TEXTURE1),O.viewport.set([0,0,B.width/4,B.height/4]);let Z=U.heatmapFbo;if(Z)D.bindTexture(D.TEXTURE_2D,Z.colorAttachment.get()),O.bindFramebuffer.set(Z.framebuffer);else{const Q=D.createTexture();D.bindTexture(D.TEXTURE_2D,Q),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.LINEAR),Z=U.heatmapFbo=O.createFramebuffer(B.width/4,B.height/4,!1,!1),function(N,X,ee,te){var ie,de;const ce=N.gl,ue=(ie=N.HALF_FLOAT)!==null&&ie!==void 0?ie:ce.UNSIGNED_BYTE,Se=(de=N.RGBA16F)!==null&&de!==void 0?de:ce.RGBA;ce.texImage2D(ce.TEXTURE_2D,0,Se,X.width/4,X.height/4,0,ce.RGBA,ue,null),te.colorAttachment.set(ee)}(O,B,Q,Z)}})(v,h,g),v.clear({color:p.aO.transparent});for(let O=0;O{const N=p.F();p.aN(N,0,U.width,U.height,0,0,1);const X=U.context.gl;return{u_matrix:N,u_world:[X.drawingBufferWidth,X.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:D.paint.get("heatmap-opacity")}})(v,T),null,T.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,T.paint,v.transform.zoom)}(h,g))})(t,s,a,o);break;case"line":(function(h,m,g,y){if(h.renderPass!=="translucent")return;const v=g.paint.get("line-opacity"),T=g.paint.get("line-width");if(v.constantOr(1)===0||T.constantOr(1)===0)return;const S=h.depthModeForSublayer(0,Je.ReadOnly),E=h.colorModeForRenderPass(),O=g.paint.get("line-dasharray"),B=g.paint.get("line-pattern"),U=B.constantOr(1),D=g.paint.get("line-gradient"),Z=g.getCrossfadeParameters(),Q=U?"linePattern":O?"lineSDF":D?"lineGradient":"line",N=h.context,X=N.gl;let ee=!0;for(const te of y){const ie=m.getTile(te);if(U&&!ie.patternsLoaded())continue;const de=ie.getBucket(g);if(!de)continue;const ce=de.programConfigurations.get(g.id),ue=h.context.program.get(),Se=h.useProgram(Q,ce),Oe=ee||Se.program!==ue,_e=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Le=B.constantOr(null);if(Le&&ie.imageAtlas){const Be=ie.imageAtlas,qe=Be.patternPositions[Le.to.toString()],Ze=Be.patternPositions[Le.from.toString()];qe&&Ze&&ce.setConstantPatternPositions(qe,Ze)}const $e=_e?te:null,We=U?In(h,ie,g,Z,$e):O?Di(h,ie,g,O,Z,$e):D?Xr(h,ie,g,de.lineClipsArray.length,$e):Sn(h,ie,g,$e);if(U)N.activeTexture.set(X.TEXTURE0),ie.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),ce.updatePaintBuffers(Z);else if(O&&(Oe||h.lineAtlas.dirty))N.activeTexture.set(X.TEXTURE0),h.lineAtlas.bind(N);else if(D){const Be=de.gradients[g.id];let qe=Be.texture;if(g.gradientVersion!==Be.version){let Ze=256;if(g.stepInterpolant){const mt=m.getSource().maxzoom,at=te.canonical.z===mt?Math.ceil(1<0?s.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const s=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!s||!a}useProgram(t,s){this.cache=this.cache||{};const a=t+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new ca(this.context,ys[t],s,zl[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new xt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:s}=this.context.gl;return this.width!==t||this.height!==s}}class Jr{constructor(t,s){this.points=t,this.planes=s}static fromInvProjectionMatrix(t,s,a){const o=Math.pow(2,a),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const y=1/(g=p.af([],g,t))[3]/s*o;return p.a$(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const y=function(E,O){var B=O[0],U=O[1],D=O[2],Z=B*B+U*U+D*D;return Z>0&&(Z=1/Math.sqrt(Z)),E[0]=O[0]*Z,E[1]=O[1]*Z,E[2]=O[2]*Z,E}([],function(E,O,B){var U=O[0],D=O[1],Z=O[2],Q=B[0],N=B[1],X=B[2];return E[0]=D*X-Z*N,E[1]=Z*Q-U*X,E[2]=U*N-D*Q,E}([],br([],h[g[0]],h[g[1]]),br([],h[g[2]],h[g[1]]))),v=-((T=y)[0]*(S=h[g[1]])[0]+T[1]*S[1]+T[2]*S[2]);var T,S;return y.concat(v)});return new Jr(h,m)}}class Ms{constructor(t,s){this.min=t,this.max=s,this.center=function(a,o,h){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a}([],function(a,o,h){return a[0]=o[0]+h[0],a[1]=o[1]+h[1],a[2]=o[2]+h[2],a}([],this.min,this.max))}quadrant(t){const s=[t%2==0,t<2],a=Mi(this.min),o=Mi(this.max);for(let h=0;h=0&&m++;if(m===0)return 0;m!==s.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let h=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;gthis.max[o]-this.min[o])return 0}return 1}}class sn{constructor(t=0,s=0,a=0,o=0){if(isNaN(t)||t<0||isNaN(s)||s<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=s,this.left=a,this.right=o}interpolate(t,s,a){return s.top!=null&&t.top!=null&&(this.top=p.z.number(t.top,s.top,a)),s.bottom!=null&&t.bottom!=null&&(this.bottom=p.z.number(t.bottom,s.bottom,a)),s.left!=null&&t.left!=null&&(this.left=p.z.number(t.left,s.left,a)),s.right!=null&&t.right!=null&&(this.right=p.z.number(t.right,s.right,a)),this}getCenter(t,s){const a=p.ac((this.left+t-this.right)/2,0,t),o=p.ac((this.top+s-this.bottom)/2,0,s);return new p.P(a,o)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new sn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Aa=85.051129;class Fn{constructor(t,s,a,o,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=s||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new sn,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new Fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const s=-p.b1(t,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=function(){var a=new p.A(4);return p.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,o,h){var m=o[0],g=o[1],y=o[2],v=o[3],T=Math.sin(h),S=Math.cos(h);a[0]=m*S+y*T,a[1]=g*S+v*T,a[2]=m*-T+y*S,a[3]=g*-T+v*S}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const s=p.ac(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const s=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.tileZoom=Math.max(0,Math.floor(s)),this.scale=this.zoomScale(s),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,s,a){this._unmodified=!1,this._edgeInsets.interpolate(t,s,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const s=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(t){const s=[new p.b2(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),h=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),g=Math.floor(Math.min(a.x,o.x,h.x,m.x)),y=Math.floor(Math.max(a.x,o.x,h.x,m.x)),v=1;for(let T=g-v;T<=y+v;T++)T!==0&&s.push(new p.b2(T,t))}return s}coveringTiles(t){var s,a;let o=this.coveringZoomLevel(t);const h=o;if(t.minzoom!==void 0&&ot.maxzoom&&(o=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=p.Y.fromLngLat(this.center),y=Math.pow(2,o),v=[y*m.x,y*m.y,0],T=[y*g.x,y*g.y,0],S=Jr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o);let E=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(E=o);const O=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=N=>({aabb:new Ms([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),U=[],D=[],Z=o,Q=t.reparseOverscaled?h:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)U.push(B(-N)),U.push(B(N));for(U.push(B(0));U.length>0;){const N=U.pop(),X=N.x,ee=N.y;let te=N.fullyVisible;if(!te){const Se=N.aabb.intersects(S);if(Se===0)continue;te=Se===2}const ie=t.terrain?v:T,de=N.aabb.distanceX(ie),ce=N.aabb.distanceY(ie),ue=Math.max(Math.abs(de),Math.abs(ce));if(N.zoom===Z||ue>O+(1<=E){const Se=Z-N.zoom,Oe=v[0]-.5-(X<>1),Le=N.zoom+1;let $e=N.aabb.quadrant(Se);if(t.terrain){const We=new p.Q(Le,N.wrap,Le,Oe,_e),Be=t.terrain.getMinMaxElevation(We),qe=(s=Be.minElevation)!==null&&s!==void 0?s:this.elevation,Ze=(a=Be.maxElevation)!==null&&a!==void 0?a:this.elevation;$e=new Ms([$e.min[0],$e.min[1],qe],[$e.max[0],$e.max[1],Ze])}U.push({aabb:$e,zoom:Le,x:Oe,y:_e,wrap:N.wrap,fullyVisible:te})}}return D.sort((N,X)=>N.distanceSq-X.distanceSq).map(N=>N.tileID)}resize(t,s){this.width=t,this.height=s,this.pixelsToGLUnits=[2/t,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const s=p.ac(t.lat,-85.051129,Aa);return new p.P(p.N(t.lng)*this.worldSize,p.O(s)*this.worldSize)}unproject(t){return new p.Y(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const s=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-h))return;const m=a+s-h,g=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b3(1,o.lat),y=this.scaleZoom(g/this.tileSize);this._elevation=h,this._center=o,this.zoom=y}setLocationAtPoint(t,s){const a=this.pointCoordinate(s),o=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),m=new p.Y(h.x-(a.x-o.x),h.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,s){return s?this.coordinatePoint(this.locationCoordinate(t),s.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,s){return this.coordinateLocation(this.pointCoordinate(t,s))}locationCoordinate(t){return p.Y.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,s){if(s){const E=s.pointCoordinate(t);if(E!=null)return E}const a=[t.x,t.y,0,1],o=[t.x,t.y,1,1];p.af(a,a,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);const h=a[3],m=o[3],g=a[1]/h,y=o[1]/m,v=a[2]/h,T=o[2]/m,S=v===T?0:(0-v)/(T-v);return new p.Y(p.z.number(a[0]/h,o[0]/m,S)/this.worldSize,p.z.number(g,y,S)/this.worldSize)}coordinatePoint(t,s=0,a=this.pixelMatrix){const o=[t.x*this.worldSize,t.y*this.worldSize,s,1];return p.af(o,o,a),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Mt().extend(this.pointLocation(new p.P(0,t))).extend(this.pointLocation(new p.P(this.width,t))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Mt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Aa])}calculatePosMatrix(t,s=!1){const a=t.key,o=s?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];const h=t.canonical,m=this.worldSize/this.zoomScale(h.z),g=h.x+Math.pow(2,h.z)*t.wrap,y=p.an(new Float64Array(16));return p.H(y,y,[g*m,h.y*m,0]),p.J(y,y,[m/p.W,m/p.W,1]),p.K(y,s?this.alignedProjMatrix:this.projMatrix,y),o[a]=new Float32Array(y),o[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,s){s=p.ac(+s,this.minZoom,this.maxZoom);const a={center:new p.M(t.lng,t.lat),zoom:s};let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const N=179.9999999999;o=[-N,N]}const h=this.tileSize*this.zoomScale(a.zoom);let m=0,g=h,y=0,v=h,T=0,S=0;const{x:E,y:O}=this.size;if(this.latRange){const N=this.latRange;m=p.O(N[1])*h,g=p.O(N[0])*h,g-mg&&(Z=g-N)}if(o){const N=(y+v)/2;let X=B;this._renderWorldCopies&&(X=p.b1(B,N-h/2,N+h/2));const ee=E/2;X-eev&&(D=v-ee)}if(D!==void 0||Z!==void 0){const N=new p.P(D??B,Z??U);a.center=this.unproject.call({worldSize:h},N).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:s,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=s,this.zoom=a,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,s=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b3(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.J(o,o,[this.width/2,-this.height/2,1]),p.H(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.J(o,o,[1,-1,1]),p.H(o,o,[-1,-1,0]),p.J(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),g=h-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:h,v=Math.PI/2+this._pitch,T=this._fov*(.5+t.y/this.height),S=Math.sin(T)*y/Math.sin(p.ac(Math.PI-v-T,.01,Math.PI-.01)),E=this.getHorizon(),O=2*Math.atan(E/this.cameraToCenterDistance)*(.5+t.y/(2*E)),B=Math.sin(O)*y/Math.sin(p.ac(Math.PI-v-O,.01,Math.PI-.01)),U=Math.min(S,B),D=1.01*(Math.cos(Math.PI/2-this._pitch)*U+y),Z=this.height/50;o=new Float64Array(16),p.b4(o,this._fov,this.width/this.height,Z,D),o[8]=2*-t.x/this.width,o[9]=2*t.y/this.height,p.J(o,o,[1,-1,1]),p.H(o,o,[0,0,-this.cameraToCenterDistance]),p.b5(o,o,this._pitch),p.ad(o,o,this.angle),p.H(o,o,[-s,-a,0]),this.mercatorMatrix=p.J([],o,[this.worldSize,this.worldSize,this.worldSize]),p.J(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.K(new Float64Array(16),this.labelPlaneMatrix,o),p.H(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=p.ar([],o),this.pixelMatrix3D=p.K(new Float64Array(16),this.labelPlaneMatrix,o);const Q=this.width%2/2,N=this.height%2/2,X=Math.cos(this.angle),ee=Math.sin(this.angle),te=s-Math.round(s)+X*Q+ee*N,ie=a-Math.round(a)+X*N+ee*Q,de=new Float64Array(o);if(p.H(de,de,[te>.5?te-1:te,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=de,o=p.ar(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new p.P(0,0)),s=[t.x*this.worldSize,t.y*this.worldSize,0,1];return p.af(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,t))}getCameraQueryGeometry(t){const s=this.getCameraPoint();if(t.length===1)return[t[0],s];{let a=s.x,o=s.y,h=s.x,m=s.y;for(const g of t)a=Math.min(a,g.x),o=Math.min(o,g.y),h=Math.max(h,g.x),m=Math.max(m,g.y);return[new p.P(a,o),new p.P(h,o),new p.P(h,m),new p.P(a,m),new p.P(a,o)]}}lngLatToCameraDepth(t,s){const a=this.locationCoordinate(t),o=[a.x*this.worldSize,a.y*this.worldSize,s,1];return p.af(o,o,this.projMatrix),o[2]/o[3]}}function Ca(c,t){let s,a=!1,o=null,h=null;const m=()=>{o=null,a&&(c.apply(h,s),o=setTimeout(m,t),a=!1)};return(...g)=>(a=!0,h=this,s=g,o||m(),o)}class Pa{constructor(t){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let a;return s.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some(a=>isNaN(a))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:a,pitch:+(s[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const s=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,s)}catch{}},this._updateHash=Ca(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const s=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,o),m=Math.round(s.lng*h)/h,g=Math.round(s.lat*h)/h,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const S=this._hashName;let E=!1;const O=window.location.hash.slice(1).split("&").map(B=>{const U=B.split("=")[0];return U===S?(E=!0,`${U}=${T}`):B}).filter(B=>B);return E||O.push(`${S}=${T}`),`#${O.join("&")}`}return`#${T}`}}const rr={linearity:.3,easing:p.b6(0,0,.3,1)},Uo=p.e({deceleration:2500,maxSpeed:1400},rr),No=p.e({deceleration:20,maxSpeed:1400},rr),$o=p.e({deceleration:1e3,maxSpeed:360},rr),jo=p.e({deceleration:1e3,maxSpeed:90},rr);class qo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:xe.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,s=xe.now();for(;t.length>0&&s-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)s.zoom+=h.zoomDelta||0,s.bearing+=h.bearingDelta||0,s.pitch+=h.pitchDelta||0,h.panDelta&&s.pan._add(h.panDelta),h.around&&(s.around=h.around),h.pinchAround&&(s.pinchAround=h.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(s.pan.mag()){const h=an(s.pan.mag(),a,p.e({},Uo,t||{}));o.offset=s.pan.mult(h.amount/s.pan.mag()),o.center=this._map.transform.center,nn(o,h)}if(s.zoom){const h=an(s.zoom,a,No);o.zoom=this._map.transform.zoom+h.amount,nn(o,h)}if(s.bearing){const h=an(s.bearing,a,$o);o.bearing=this._map.transform.bearing+p.ac(h.amount,-179,179),nn(o,h)}if(s.pitch){const h=an(s.pitch,a,jo);o.pitch=this._map.transform.pitch+h.amount,nn(o,h)}if(o.zoom||o.bearing){const h=s.pinchAround===void 0?s.around:s.pinchAround;o.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function nn(c,t){(!c.duration||c.durations.unproject(y)),g=h.reduce((y,v,T,S)=>y.add(v.div(S.length)),new p.P(0,0));super(t,{points:h,point:g,lngLats:m,lngLat:s.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class Li extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class sr{constructor(t,s){this._map=t,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Li(t.type,this._map,t))}mousedown(t,s){return this._mousedownPos=s,this._firePreventable(new Ot(t.type,this._map,t))}mouseup(t){this._map.fire(new Ot(t.type,this._map,t))}click(t,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Ot(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ot(t.type,this._map,t))}mouseover(t){this._map.fire(new Ot(t.type,this._map,t))}mouseout(t){this._map.fire(new Ot(t.type,this._map,t))}touchstart(t){return this._firePreventable(new zs(t.type,this._map,t))}touchmove(t){this._map.fire(new zs(t.type,this._map,t))}touchend(t){this._map.fire(new zs(t.type,this._map,t))}touchcancel(t){this._map.fire(new zs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ot(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ot("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ot(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ci{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(p.P.convert(t),this._map.terrain)}}class ks{constructor(t,s){this._map=t,this._tr=new ci(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,s){this.isEnabled()&&t.shiftKey&&t.button===0&&(re.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(t,s){if(!this._active)return;const a=s;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)h.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(re.remove(this._box),this._box=null),re.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,s){return this._map.fire(new p.k(t,{originalEvent:s}))}}function Ea(c,t){if(c.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${c.length}, points ${t.length}`);const s={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){const h=new p.P(0,0);for(const m of o)h._add(m);return h.div(o.length)}(s),this.touches=Ea(a,s)))}touchmove(t,s,a){if(this.aborted||!this.centroid)return;const o=Ea(a,s);for(const h in this.touches){const m=o[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,s,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class Ma{constructor(t){this.singleTap=new Nl(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,s,a){this.singleTap.touchstart(t,s,a)}touchmove(t,s,a){this.singleTap.touchmove(t,s,a)}touchend(t,s,a){const o=this.singleTap.touchend(t,s,a);if(o){const h=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(h&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class Go{constructor(t){this._tr=new ci(t),this._zoomIn=new Ma({numTouches:1,numTaps:2}),this._zoomOut=new Ma({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,s,a){this._zoomIn.touchstart(t,s,a),this._zoomOut.touchstart(t,s,a)}touchmove(t,s,a){this._zoomIn.touchmove(t,s,a),this._zoomOut.touchmove(t,s,a)}touchend(t,s,a){const o=this._zoomIn.touchend(t,s,a),h=this._zoomOut.touchend(t,s,a),m=this._tr;return o?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class pr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const s=this._moveFunction(...t);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(t,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,s){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const o=s.length?s[0]:s;return!this._moved&&o.dist(a){c.mousedown=c.dragStart,c.mousemoveWindow=c.dragMove,c.mouseup=c.dragEnd,c.contextmenu=function(t){t.preventDefault()}},Ds=({enable:c,clickTolerance:t,bearingDegreesPerPixelMoved:s=.8})=>{const a=new Ie({checkCorrectEvent:o=>re.mouseButton(o)===0&&o.ctrlKey||re.mouseButton(o)===2});return new pr({clickTolerance:t,move:(o,h)=>({bearingDelta:(h.x-o.x)*s}),moveStateManager:a,enable:c,assignEvents:Qr})},ka=({enable:c,clickTolerance:t,pitchDegreesPerPixelMoved:s=-.5})=>{const a=new Ie({checkCorrectEvent:o=>re.mouseButton(o)===0&&o.ctrlKey||re.mouseButton(o)===2});return new pr({clickTolerance:t,move:(o,h)=>({pitchDelta:(h.y-o.y)*s}),moveStateManager:a,enable:c,assignEvents:Qr})};class Te{constructor(t,s){this._clickTolerance=t.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,s,a){return this._calculateTransform(t,s,a)}touchmove(t,s,a){if(this._active&&!(a.length0&&(this._active=!0);const o=Ea(a,s),h=new p.P(0,0),m=new p.P(0,0);let g=0;for(const v in o){const T=o[v],S=this._touches[v];S&&(h._add(T),m._add(T.sub(S)),g++,o[v]=T)}if(this._touches=o,gMath.abs(c.x)}class Wo extends on{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,s,a){super.touchstart(t,s,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,Ra(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,s,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,h,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,s,a){if(this._valid!==void 0)return this._valid;const o=t.mag()>=2,h=s.mag()>=2;if(!o&&!h)return;if(!o||!h)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==s.y>0;return Ra(t)&&Ra(s)&&m}}const es={panStep:100,bearingStep:15,pitchStep:10};class ht{constructor(t){this._tr=new ci(t);const s=es;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let s=0,a=0,o=0,h=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:Un,zoom:s?Math.round(y.zoom)+s*(t.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:y.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Un(c){return c*(2-c)}const Nn=4.000244140625;class Ba{constructor(t,s){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new ci(t),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!t[this._map.cooperativeGestures._bypassKey])return;let s=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=xe.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,s!==0&&s%Nn==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(o*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),t.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=t,this._delta-=s,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=re.mousePos(this._map.getCanvas(),t),a=this._tr;this._around=s.y>a.transform.height/2-a.transform.getHorizon()?p.M.convert(this._aroundCenter?a.center:a.unproject(s)):p.M.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const g=this._type==="wheel"&&Math.abs(this._delta)>Nn?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*g)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,o=this._easing;let h,m=!1;if(this._type==="wheel"&&a&&o){const g=Math.min((xe.now()-this._lastWheelEventTime)/200,1),y=o(g);h=p.z.number(a,s,y),g<1?this._frameId||(this._frameId=!0):m=!0}else h=s,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let s=p.b7;if(this._prevEase){const a=this._prevEase,o=(xe.now()-a.start)/a.duration,h=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(h*h+1e-4)*.01,g=Math.sqrt(.0729-m*m);s=p.b6(m,g,.25,1)}return this._prevEase={start:xe.now(),duration:t,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Fa{constructor(t,s){this._clickZoom=t,this._tapZoom=s}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Xo{constructor(t){this._tr=new ci(t),this.reset()}reset(){this._active=!1}dblclick(t,s){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(){this._tap=new Ma({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,s,a){if(!this._swipePoint)if(this._tapTime){const o=s[0],h=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;h&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,s,a)}touchmove(t,s,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=s[0],h=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,s,a)}touchend(t,s,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(t,s,a);o&&(this._tapTime=t.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ni{constructor(t,s,a){this._el=t,this._mousePan=s,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ln{constructor(t,s,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=s,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Me{constructor(t,s,a,o){this._el=t,this._touchZoom=s,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ke{constructor(t,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=re.create("div","maplibregl-cooperative-gesture-screen",t);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=s,this._container.appendChild(o);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=a,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(re.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(t){this._onCooperativeGesture(t.touches.length===1)}wheel(t){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!t[this._bypassKey])}_onCooperativeGesture(t){this._enabled&&t&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ts=c=>c.zoom||c.drag||c.pitch||c.rotate;class Oa extends p.k{}function cn(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class hi{constructor(t,s){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,h)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=o.type==="renderFrame"?void 0:o,g={needsRenderFrame:!1},y={},v={},T=o.touches,S=T?this._getMapTouches(T):void 0,E=S?re.touchPos(this._map.getCanvas(),S):re.mousePos(this._map.getCanvas(),o);for(const{handlerName:U,handler:D,allowed:Z}of this._handlers){if(!D.isEnabled())continue;let Q;this._blockedByActive(v,Z,U)?D.reset():D[h||o.type]&&(Q=D[h||o.type](o,E,S),this.mergeHandlerResult(g,y,Q,U,m),Q&&Q.needsRenderFrame&&this._triggerRenderFrame()),(Q||D.isActive())&&(v[U]=D)}const O={};for(const U in this._previousActiveHandlers)v[U]||(O[U]=m);this._previousActiveHandlers=v,(Object.keys(O).length||cn(g))&&(this._changes.push([g,y,O]),this._triggerRenderFrame()),(Object.keys(v).length||cn(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:B}=g;B&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],B(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qo(t),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,h,m]of this._listeners)re.addEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,s,a]of this._listeners)re.removeEventListener(t,s,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const s=this._map,a=s.getCanvasContainer();this._add("mapEvent",new sr(s,t));const o=s.boxZoom=new ks(s,t);this._add("boxZoom",o),t.interactive&&t.boxZoom&&o.enable();const h=s.cooperativeGestures=new ke(s,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Go(s),g=new Xo(s);s.doubleClickZoom=new Fa(g,m),this._add("tapZoom",m),this._add("clickZoom",g),t.interactive&&t.doubleClickZoom&&s.doubleClickZoom.enable();const y=new $l;this._add("tapDragZoom",y);const v=s.touchPitch=new Wo(s);this._add("touchPitch",v),t.interactive&&t.touchPitch&&s.touchPitch.enable(t.touchPitch);const T=Ds(t),S=ka(t);s.dragRotate=new ln(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]),t.interactive&&t.dragRotate&&s.dragRotate.enable();const E=(({enable:Q,clickTolerance:N})=>{const X=new Ie({checkCorrectEvent:ee=>re.mouseButton(ee)===0&&!ee.ctrlKey});return new pr({clickTolerance:N,move:(ee,te)=>({around:te,panDelta:te.sub(ee)}),activateOnStart:!0,moveStateManager:X,enable:Q,assignEvents:Qr})})(t),O=new Te(t,s);s.dragPan=new Ni(a,E,O),this._add("mousePan",E),this._add("touchPan",O,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&s.dragPan.enable(t.dragPan);const B=new La,U=new Vn;s.touchZoomRotate=new Me(a,U,B,y),this._add("touchRotate",B,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&s.touchZoomRotate.enable(t.touchZoomRotate);const D=s.scrollZoom=new Ba(s,()=>this._triggerRenderFrame());this._add("scrollZoom",D,["mousePan"]),t.interactive&&t.scrollZoom&&s.scrollZoom.enable(t.scrollZoom);const Z=s.keyboard=new ht(s);this._add("keyboard",Z),t.interactive&&t.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new Zo(s))}_add(t,s,a){this._handlers.push({handlerName:t,handler:s,allowed:a}),this._handlersById[t]=s}stop(t){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ts(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,s,a){for(const o in t)if(o!==a&&(!s||s.indexOf(o)<0))return!0;return!1}_getMapTouches(t){const s=[];for(const a of t)this._el.contains(a.target)&&s.push(a);return s}mergeHandlerResult(t,s,a,o,h){if(!a)return;p.e(t,a);const m={handlerName:o,originalEvent:a.originalEvent||h};a.zoomDelta!==void 0&&(s.zoom=m),a.panDelta!==void 0&&(s.drag=m),a.pitchDelta!==void 0&&(s.pitch=m),a.bearingDelta!==void 0&&(s.rotate=m)}_applyChanges(){const t={},s={},a={};for(const[o,h,m]of this._changes)o.panDelta&&(t.panDelta=(t.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(t.around=o.around),o.pinchAround!==void 0&&(t.pinchAround=o.pinchAround),o.noInertia&&(t.noInertia=o.noInertia),p.e(s,h),p.e(a,m);this._updateMapTransform(t,s,a),this._changes=[]}_updateMapTransform(t,s,a){const o=this._map,h=o._getTransformForUpdate(),m=o.terrain;if(!(cn(t)||m&&this._terrainMovement))return this._fireEvents(s,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:S,pinchAround:E}=t;E!==void 0&&(S=E),o._stop(!0),S=S||o.transform.centerPoint;const O=h.pointLocation(g?S.sub(g):S);v&&(h.bearing+=v),T&&(h.pitch+=T),y&&(h.zoom+=y),m?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(g)):h.setLocationAtPoint(O,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(O,S),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,h.recalculateZoom(o.terrain)})):h.setLocationAtPoint(O,S),o._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(s,a,!0)}_fireEvents(t,s,a){const o=ts(this._eventsInProgress),h=ts(t),m={};for(const T in t){const{originalEvent:S}=t[T];this._eventsInProgress[T]||(m[`${T}start`]=S),this._eventsInProgress[T]=t[T]}!o&&h&&this._fireEvent("movestart",h.originalEvent);for(const T in m)this._fireEvent(T,m[T]);h&&this._fireEvent("move",h.originalEvent);for(const T in t){const{originalEvent:S}=t[T];this._fireEvent(T,S)}const g={};let y;for(const T in this._eventsInProgress){const{handlerName:S,originalEvent:E}=this._eventsInProgress[T];this._handlersById[S].isActive()||(delete this._eventsInProgress[T],y=s[S]||E,g[`${T}end`]=y)}for(const T in g)this._fireEvent(T,g[T]);const v=ts(this._eventsInProgress);if(a&&(o||h)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=E=>E!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Oa("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ko extends p.E{constructor(t,s){super(),this._renderFrameCallback=()=>{const a=Math.min((xe.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=s.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.M(this.transform.center.lng,this.transform.center.lat)}setCenter(t,s){return this.jumpTo({center:t},s)}panBy(t,s,a){return t=p.P.convert(t).mult(-1),this.panTo(this.transform.center,p.e({offset:t},s),a)}panTo(t,s,a){return this.easeTo(p.e({center:t},s),a)}getZoom(){return this.transform.zoom}setZoom(t,s){return this.jumpTo({zoom:t},s),this}zoomTo(t,s,a){return this.easeTo(p.e({zoom:t},s),a)}zoomIn(t,s){return this.zoomTo(this.getZoom()+1,t,s),this}zoomOut(t,s){return this.zoomTo(this.getZoom()-1,t,s),this}getBearing(){return this.transform.bearing}setBearing(t,s){return this.jumpTo({bearing:t},s),this}getPadding(){return this.transform.padding}setPadding(t,s){return this.jumpTo({padding:t},s),this}rotateTo(t,s,a){return this.easeTo(p.e({bearing:t},s),a)}resetNorth(t,s){return this.rotateTo(0,p.e({duration:1e3},t),s),this}resetNorthPitch(t,s){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},t),s),this}snapToNorth(t,s){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=p.z.number(h,D,ie)),this._rotating&&(o.bearing=p.z.number(m,v,ie)),this._pitching&&(o.pitch=p.z.number(g,T,ie)),this._padding&&(o.interpolatePadding(y,S,ie),O=o.centerPoint.add(E)),this.terrain&&!t.freezeElevation&&this._updateElevation(ie),X)o.setLocationAtPoint(X,ee);else{const de=o.zoomScale(o.zoom-h),ce=D>h?Math.min(2,N):Math.max(.5,N),ue=Math.pow(ce,1-ie),Se=o.unproject(Z.add(Q.mult(ie*ue)).mult(de));o.setLocationAtPoint(o.renderWorldCopies?Se.wrap():Se,O)}this._applyUpdatedTransform(o),this._fireMoveEvents(s)},ie=>{this.terrain&&this._finalizeElevation(),this._afterEase(s,ie)},t),this}_prepareEase(t,s,a={}){this._moving=!0,s||a.moving||this.fire(new p.k("movestart",t)),this._zooming&&!a.zooming&&this.fire(new p.k("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new p.k("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new p.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&s!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(s-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=s}this.transform.elevation=p.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const s=t.clone(),{center:a,zoom:o,pitch:h,bearing:m,elevation:g}=this.transformCameraUpdate(s);a&&(s.center=a),o!==void 0&&(s.zoom=o),h!==void 0&&(s.pitch=h),m!==void 0&&(s.bearing=m),g!==void 0&&(s.elevation=g),this.transform.apply(s)}_fireMoveEvents(t){this.fire(new p.k("move",t)),this._zooming&&this.fire(new p.k("zoom",t)),this._rotating&&this.fire(new p.k("rotate",t)),this._pitching&&this.fire(new p.k("pitch",t))}_afterEase(t,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const a=this._zooming,o=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new p.k("zoomend",t)),o&&this.fire(new p.k("rotateend",t)),h&&this.fire(new p.k("pitchend",t)),this.fire(new p.k("moveend",t))}flyTo(t,s){var a;if(!t.essential&&xe.prefersReducedMotion){const We=p.L(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,s)}this.stop(),t=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b7},t);const o=this._getTransformForUpdate(),h=this.getZoom(),m=this.getBearing(),g=this.getPitch(),y=this.getPadding(),v="bearing"in t?this._normalizeBearing(t.bearing,m):m,T="pitch"in t?+t.pitch:g,S="padding"in t?t.padding:o.padding,E=p.P.convert(t.offset);let O=o.centerPoint.add(E);const B=o.pointLocation(O),{center:U,zoom:D}=o.getConstrained(p.M.convert(t.center||B),(a=t.zoom)!==null&&a!==void 0?a:h);this._normalizeCenter(U);const Z=o.zoomScale(D-h),Q=o.project(B),N=o.project(U).sub(Q);let X=t.curve;const ee=Math.max(o.width,o.height),te=ee/Z,ie=N.mag();if("minZoom"in t){const We=p.ac(Math.min(t.minZoom,h,D),o.minZoom,o.maxZoom),Be=ee/o.zoomScale(We-h);X=Math.sqrt(Be/ie*2)}const de=X*X;function ce(We){const Be=(te*te-ee*ee+(We?-1:1)*de*de*ie*ie)/(2*(We?te:ee)*de*ie);return Math.log(Math.sqrt(Be*Be+1)-Be)}function ue(We){return(Math.exp(We)-Math.exp(-We))/2}function Se(We){return(Math.exp(We)+Math.exp(-We))/2}const Oe=ce(!1);let _e=function(We){return Se(Oe)/Se(Oe+X*We)},Le=function(We){return ee*((Se(Oe)*(ue(Be=Oe+X*We)/Se(Be))-ue(Oe))/de)/ie;var Be},$e=(ce(!0)-Oe)/X;if(Math.abs(ie)<1e-6||!isFinite($e)){if(Math.abs(ee-te)<1e-6)return this.easeTo(t,s);const We=tet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==v,this._pitching=T!==g,this._padding=!o.isPaddingEqual(S),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(U),this._ease(We=>{const Be=We*$e,qe=1/_e(Be);o.zoom=We===1?D:h+o.scaleZoom(qe),this._rotating&&(o.bearing=p.z.number(m,v,We)),this._pitching&&(o.pitch=p.z.number(g,T,We)),this._padding&&(o.interpolatePadding(y,S,We),O=o.centerPoint.add(E)),this.terrain&&!t.freezeElevation&&this._updateElevation(We);const Ze=We===1?U:o.unproject(Q.add(N.mult(Le(Be))).mult(qe));o.setLocationAtPoint(o.renderWorldCopies?Ze.wrap():Ze,O),this._applyUpdatedTransform(o),this._fireMoveEvents(s)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(s)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,s){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,s)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,s,a){a.animate===!1||a.duration===0?(t(1),s()):(this._easeStart=xe.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,s){t=p.b1(t,-180,180);const a=Math.abs(t-s);return Math.abs(t-360-s)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(p.M.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const $i={compact:!0,customAttribution:'MapLibre'};class Yo{constructor(t=$i){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=re.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=re.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=re.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){re.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,s){const a=this._map._getUIString(`AttributionControl.${s}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const s=this._map.style.sourceCaches;for(const o in s){const h=s[o];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(o=>String(o).trim()),t.sort((o,h)=>o.length-h.length),t=t.filter((o,h)=>{for(let m=h+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ls{constructor(t={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const a=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=re.create("div","maplibregl-ctrl");const s=re.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){re.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _t{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const s=++this._id;return this._queue.push({callback:t,id:s,cancelled:!1}),s}remove(t){const s=this._currentlyRunning,a=s?this._queue.concat(s):this._queue;for(const o of a)if(o.id===t)return void(o.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const a of s)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var It=p.X([{name:"a_pos3d",type:"Int16",components:3}]);class Jo extends p.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,s){this.sourceCache.update(t,s),this._renderableTilesKeys=[];const a={};for(const o of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aN(o.posMatrix,0,p.W,0,p.W,0,1),this._tiles[o.key]=new oi(o,this.tileSize));for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(t){for(const s in this._tiles){const a=this._tiles[s];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const s={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID;if(o.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),p.aN(h.posMatrix,0,p.W,0,p.W,0,1),s[a]=h}else if(o.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=o.canonical.z-t.canonical.z,g=o.canonical.x-(o.canonical.x>>m<>m<>m;p.aN(h.posMatrix,0,v,0,v,0,1),p.H(h.posMatrix,h.posMatrix,[-g*v,-y*v,0]),s[a]=h}else if(t.canonical.isChildOf(o.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=t.canonical.z-o.canonical.z,g=t.canonical.x-(t.canonical.x>>m<>m<>m;p.aN(h.posMatrix,0,p.W,0,p.W,0,1),p.H(h.posMatrix,h.posMatrix,[g*v,y*v,0]),p.J(h.posMatrix,h.posMatrix,[1/2**m,1/2**m,0]),s[a]=h}}return s}getSourceTile(t,s){const a=this.sourceCache._source;let o=t.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(o--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(s=>s.timeAdded>=t)}}class hn{constructor(t,s,a){this.painter=t,this.sourceCache=new Jo(s),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,s,a,o=p.W){var h;if(!(s>=0&&s=0&&at.canonical.z&&(t.canonical.z>=o?h=t.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>h<>h<>8<<4|h>>8,s[m+3]=0;const a=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),o=new xt(t,a,t.gl.RGBA,{premultiply:!1});return o.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const s=new Uint8Array(4),a=this.painter.context,o=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null);const h=s[0]+(s[2]>>4<<8),m=s[1]+((15&s[2])<<8),g=this.coordsIndex[255-s[3]],y=g&&this.sourceCache.getTileByID(g);if(!y)return null;const v=this._coordsTextureSize,T=(1<t.id!==s),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const zr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Va{constructor(t,s){this.painter=t,this.terrain=s,this.pool=new $n(t.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(s)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const o=t.sourceCaches[a].getVisibleCoordinates();for(const h of o){const m=this.terrain.sourceCache.getTerrainCoords(h);for(const g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(const a of t._order){const o=t._layers[a],h=o.source;if(zr[o.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(g=>g.key).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[o][a.tileID.key];h&&h!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const s=t.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(zr[s]&&(this._prevType&&zr[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(zr[this._prevType]||zr[s]&&o){this._prevType=s;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(Ia(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[h]){const v=this.pool.getObjectForId(g.rtt[h].id);if(v.stamp===g.rtt[h].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[h]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:p.aO.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v{c.touchstart=c.dragStart,c.touchmoveWindow=c.dragMove,c.touchend=c.dragEnd},$a={showCompass:!0,showZoom:!0,visualizePitch:!1};class ja{constructor(t,s,a=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),re.mousePos(this.element,m)),re.addEventListener(window,"mousemove",this.mousemove),re.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,re.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),re.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const o=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Ds({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const v=new za;return new pr({clickTolerance:g,move:(T,S)=>({bearingDelta:(S.x-T.x)*y}),moveStateManager:v,enable:m,assignEvents:jn})})({clickTolerance:o,enable:!0}),this.map=t,a&&(this.mousePitch=ka({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new za;return new pr({clickTolerance:g,move:(T,S)=>({pitchDelta:(S.y-T.y)*y}),moveStateManager:v,enable:m,assignEvents:jn})})({clickTolerance:h,enable:!0})),re.addEventListener(s,"mousedown",this.mousedown),re.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),re.addEventListener(s,"touchcancel",this.reset)}startMouse(t,s){this.mouseRotate.dragStart(t,s),this.mousePitch&&this.mousePitch.dragStart(t,s),re.disableDrag()}startTouch(t,s){this.touchRotate.dragStart(t,s),this.touchPitch&&this.touchPitch.dragStart(t,s),re.disableDrag()}moveMouse(t,s){const a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(t,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,s)||{};h&&a.setPitch(a.getPitch()+h)}}moveTouch(t,s){const a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(t,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,s)||{};h&&a.setPitch(a.getPitch()+h)}}off(){const t=this.element;re.removeEventListener(t,"mousedown",this.mousedown),re.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend),re.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){re.enableDrag(),re.removeEventListener(window,"mousemove",this.mousemove),re.removeEventListener(window,"mouseup",this.mouseup),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend)}}let fr;function qn(c,t,s){const a=new p.M(c.lng,c.lat);if(c=new p.M(c.lng,c.lat),t){const o=new p.M(c.lng-360,c.lat),h=new p.M(c.lng+360,c.lat),m=s.locationPoint(c).distSqr(t);s.locationPoint(o).distSqr(t)180;){const o=s.locationPoint(c);if(o.x>=0&&o.y>=0&&o.x<=s.width&&o.y<=s.height)break;c.lng>s.center.lng?c.lng-=360:c.lng+=360}return c.lng!==a.lng&&s.locationPoint(c).y>s.height/2-s.getHorizon()?c:a}const dn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Zn(c,t,s){const a=c.classList;for(const o in dn)a.remove(`maplibregl-${s}-anchor-${o}`);a.add(`maplibregl-${s}-anchor-${t}`)}class Rs extends p.E{constructor(t){if(super(),this._onKeyPress=s=>{const a=s.code,o=s.charCode||s.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=s=>{const a=s.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=s=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(s?.type==="terrain"||s?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?qn(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),s&&s.type!=="moveend"||(this._pos=this._pos.round()),re.setTransform(this._element,`${dn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${h}`),xe.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=s.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.k("dragstart"))),this.fire(new p.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new p.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t?.opacity,t?.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=p.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=re.create("div"),this._element.setAttribute("aria-label","Map marker");const s=re.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${a}px`),s.setAttributeNS(null,"width",`${o}px`),s.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const h=re.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=re.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=re.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Z of y){const Q=re.createNS("http://www.w3.org/2000/svg","ellipse");Q.setAttributeNS(null,"opacity","0.04"),Q.setAttributeNS(null,"cx","10.5"),Q.setAttributeNS(null,"cy","5.80029008"),Q.setAttributeNS(null,"rx",Z.rx),Q.setAttributeNS(null,"ry",Z.ry),g.appendChild(Q)}const v=re.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const T=re.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),v.appendChild(T);const S=re.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const E=re.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),S.appendChild(E);const O=re.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const B=re.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const U=re.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#000000"),U.setAttributeNS(null,"opacity","0.25"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962");const D=re.createNS("http://www.w3.org/2000/svg","circle");D.setAttributeNS(null,"fill","#FFFFFF"),D.setAttributeNS(null,"cx","5.5"),D.setAttributeNS(null,"cy","5.5"),D.setAttributeNS(null,"r","5.4999962"),B.appendChild(U),B.appendChild(D),m.appendChild(g),m.appendChild(v),m.appendChild(S),m.appendChild(O),m.appendChild(B),s.appendChild(m),s.setAttributeNS(null,"height",a*this._scale+"px"),s.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(s),this._offset=p.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Zn(this._element,this._anchor,"marker"),t&&t.className)for(const s of t.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),re.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=p.M.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var s,a;if(!(!((s=this._map)===null||s===void 0)&&s.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const o=this._map,h=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-h<.006)return void(this._element.style.opacity=this._opacity);const g=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*g,v=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-v>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=p.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,s){return t===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const qa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Bs=0,kr=!1;const Za={maxWidth:100,unit:"metric"};function Gn(c,t,s){const a=s&&s.maxWidth||100,o=c._container.clientHeight/2,h=c.unproject([0,o]),m=c.unproject([a,o]),g=h.distanceTo(m);if(s&&s.unit==="imperial"){const y=3.2808*g;y>5280?is(t,a,y/5280,c._getUIString("ScaleControl.Miles")):is(t,a,y,c._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?is(t,a,g/1852,c._getUIString("ScaleControl.NauticalMiles")):g>=1e3?is(t,a,g/1e3,c._getUIString("ScaleControl.Kilometers")):is(t,a,g,c._getUIString("ScaleControl.Meters"))}function is(c,t,s,a){const o=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let g=h/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(g),m*g}(s);c.style.width=t*(o/s)+"px",c.innerHTML=`${o} ${a}`}const Ga={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ha=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Wa(c){if(c){if(typeof c=="number"){const t=Math.round(Math.abs(c)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,c),"top-left":new p.P(t,t),"top-right":new p.P(-t,t),bottom:new p.P(0,-c),"bottom-left":new p.P(t,-t),"bottom-right":new p.P(-t,-t),left:new p.P(c,0),right:new p.P(-c,0)}}if(c instanceof p.P||Array.isArray(c)){const t=p.P.convert(c);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:p.P.convert(c.center||[0,0]),top:p.P.convert(c.top||[0,0]),"top-left":p.P.convert(c["top-left"]||[0,0]),"top-right":p.P.convert(c["top-right"]||[0,0]),bottom:p.P.convert(c.bottom||[0,0]),"bottom-left":p.P.convert(c["bottom-left"]||[0,0]),"bottom-right":p.P.convert(c["bottom-right"]||[0,0]),left:p.P.convert(c.left||[0,0]),right:p.P.convert(c.right||[0,0])}}return Wa(new p.P(0,0))}const Qo=Ei;k.AJAXError=p.be,k.Evented=p.E,k.LngLat=p.M,k.MercatorCoordinate=p.Y,k.Point=p.P,k.addProtocol=p.bf,k.config=p.a,k.removeProtocol=p.bg,k.AttributionControl=Yo,k.BoxZoomHandler=ks,k.CanvasSource=ms,k.CooperativeGesturesHandler=ke,k.DoubleClickZoomHandler=Fa,k.DragPanHandler=Ni,k.DragRotateHandler=ln,k.EdgeInsets=sn,k.FullscreenControl=class extends p.E{constructor(c={}){super(),this._onFullscreenChange=()=>{var t;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=s?.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:p.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){re.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const c=this._fullscreenButton=re.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);re.create("span","maplibregl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},k.GeoJSONSource=Ke,k.GeolocateControl=class extends p.E{constructor(c){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const s=new p.M(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,o=this._map.getBearing(),h=p.e({bearing:o},this.options.fitBoundsOptions),m=Mt.fromLngLat(s,a);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const s=new p.M(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&kr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=re.create("button","maplibregl-ctrl-geolocate",this._container),re.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=re.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Rs({element:this._dotElement}),this._circleElement=re.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Rs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.k("trackuserlocationend")))})}},this.options=p.e({},qa,c)}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return p._(this,arguments,void 0,function*(t=!1){if(fr!==void 0&&!t)return fr;if(window.navigator.permissions===void 0)return fr=!!window.navigator.geolocation,fr;try{fr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{fr=!!window.navigator.geolocation}return fr})}().then(t=>this._setupUI(t)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),re.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Bs=0,kr=!1}_isOutOfMapMaxBounds(c){const t=this._map.getMaxBounds(),s=c.coords;return t&&(s.longitudet.getEast()||s.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const c=this._map.getBounds(),t=c.getSouthEast(),s=c.getNorthEast(),a=t.distanceTo(s),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Bs--,kr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new p.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new p.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let c;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Bs++,Bs>1?(c={maximumAge:6e5,timeout:0},kr=!0):(c=this.options.positionOptions,kr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,c)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},k.Hash=Pa,k.ImageSource=er,k.KeyboardHandler=ht,k.LngLatBounds=Mt,k.LogoControl=Ls,k.Map=class extends Ko{constructor(c){if(p.bc.mark(p.bd.create),(c=p.e({},Na,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Fn(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),{bearingSnap:c.bearingSnap}),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=c.collectResourceTiming,this._renderTaskQueue=new _t,this._controls=[],this._mapId=p.a3(),this._locale=p.e({},Ua,c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this.transformCameraUpdate=c.transformCameraUpdate,this._imageQueueHandle=_i.addThrottleControl(()=>this.isMoving()),this._requestManager=new Yi(c.transformRequest),typeof c.container=="string"){if(this._container=document.getElementById(c.container),!this._container)throw new Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(c.maxBounds&&this.setMaxBounds(c.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const s=Ca(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{t?s(a):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new hi(this,c),this._hash=c.hash&&new Pa(typeof c.hash=="string"&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,p.e({},c.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=c.localIdeographFontFamily,this._validateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new Yo(typeof c.attributionControl=="boolean"?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new Ls,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new p.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new p.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new p.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(c,t){if(t===void 0&&(t=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=c.onAdd(this);this._controls.push(c);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(s,a.firstChild):a.appendChild(s),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(c);return t>-1&&this._controls.splice(t,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}calculateCameraOptionsFromTo(c,t,s,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(c,t,s,a)}resize(c){var t;const s=this._containerDimensions(),a=s[0],o=s[1],h=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,h),this.painter.resize(a,o,h),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,o);const m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",c)).fire(new p.k("move",c))),this.fire(new p.k("resize",c)),m&&this.fire(new p.k("moveend",c)),this}_getClampedPixelRatio(c,t){const{0:s,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),h=c*o,m=t*o;return Math.min(h>s?s/h:1,m>a?a/m:1)*o}getPixelRatio(){var c;return(c=this._overridePixelRatio)!==null&&c!==void 0?c:devicePixelRatio}setPixelRatio(c){this._overridePixelRatio=c,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(c){return this.transform.setMaxBounds(Mt.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this._update()}project(c){return this.transform.locationPoint(p.M.convert(c),this.style&&this.terrain)}unproject(c){return this.transform.pointLocation(p.P.convert(c),this.terrain)}isMoving(){var c;return this._moving||((c=this.handlers)===null||c===void 0?void 0:c.isMoving())}isZooming(){var c;return this._zooming||((c=this.handlers)===null||c===void 0?void 0:c.isZooming())}isRotating(){var c;return this._rotating||((c=this.handlers)===null||c===void 0?void 0:c.isRotating())}_createDelegatedListener(c,t,s){if(c==="mouseenter"||c==="mouseover"){let a=!1;return{layer:t,listener:s,delegates:{mousemove:h=>{const m=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];m.length?a||(a=!0,s.call(this,new Ot(c,this,h.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(c==="mouseleave"||c==="mouseout"){let a=!1;return{layer:t,listener:s,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,s.call(this,new Ot(c,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,s.call(this,new Ot(c,this,m.originalEvent)))}}}}{const a=o=>{const h=this.getLayer(t)?this.queryRenderedFeatures(o.point,{layers:[t]}):[];h.length&&(o.features=h,s.call(this,o),delete o.features)};return{layer:t,listener:s,delegates:{[c]:a}}}}on(c,t,s){if(s===void 0)return super.on(c,t);const a=this._createDelegatedListener(c,t,s);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(a);for(const o in a.delegates)this.on(o,a.delegates[o]);return this}once(c,t,s){if(s===void 0)return super.once(c,t);const a=this._createDelegatedListener(c,t,s);for(const o in a.delegates)this.once(o,a.delegates[o]);return this}off(c,t,s){return s===void 0?super.off(c,t):(this._delegatedListeners&&this._delegatedListeners[c]&&(a=>{const o=this._delegatedListeners[c];for(let h=0;hthis._updateStyle(c,t));const s=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!c)),c?(this.style=new vn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c,t,s):this.style.loadJSON(c,t,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,t){if(typeof c=="string"){const s=this._requestManager.transformRequest(c,Ut.Style);p.h(s,new AbortController).then(a=>{this._updateDiff(a.data,t)}).catch(a=>{a&&this.fire(new p.j(a))})}else typeof c=="object"&&this._updateDiff(c,t)}_updateDiff(c,t){try{this.style.setState(c,t)&&this._update(!0)}catch(s){p.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(c,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(c,t){return this._lazyInitEmptyStyle(),this.style.addSource(c,t),this._update(!0)}isSourceLoaded(c){const t=this.style&&this.style.sourceCaches[c];if(t!==void 0)return t.loaded();this.fire(new p.j(new Error(`There is no source with ID '${c}'`)))}setTerrain(c){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),c){const t=this.style.sourceCaches[c.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain===null&&t.reload();for(const s in this.style._layers){const a=this.style._layers[s];a.type==="hillshade"&&a.source===c.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new hn(this.painter,t,c),this.painter.renderToTexture=new Va(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==c.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:c})),this}getTerrain(){var c,t;return(t=(c=this.terrain)===null||c===void 0?void 0:c.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const c=this.style&&this.style.sourceCaches;for(const t in c){const s=c[t]._tiles;for(const a in s){const o=s[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(c){return this.style.removeSource(c),this._update(!0)}getSource(c){return this.style.getSource(c)}addImage(c,t,s={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:h,stretchY:m,content:g}=s;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||p.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:y,height:v,data:T}=t,S=t;return this.style.addImage(c,{data:new p.R({width:y,height:v},new Uint8Array(T)),pixelRatio:a,stretchX:h,stretchY:m,content:g,sdf:o,version:0,userImage:S}),S.onAdd&&S.onAdd(this,c),this}}{const{width:y,height:v,data:T}=xe.getImageData(t);this.style.addImage(c,{data:new p.R({width:y,height:v},T),pixelRatio:a,stretchX:h,stretchY:m,content:g,sdf:o,version:0})}}updateImage(c,t){const s=this.style.getImage(c);if(!s)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||p.b(t)?xe.getImageData(t):t,{width:o,height:h,data:m}=a;if(o===void 0||h===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==s.data.width||h!==s.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(t instanceof HTMLImageElement||p.b(t));return s.data.replace(m,g),this.style.updateImage(c,s),this}getImage(c){return this.style.getImage(c)}hasImage(c){return c?!!this.style.getImage(c):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c){return _i.getImage(this._requestManager.transformRequest(c,Ut.Image),new AbortController)}listImages(){return this.style.listImages()}addLayer(c,t){return this._lazyInitEmptyStyle(),this.style.addLayer(c,t),this._update(!0)}moveLayer(c,t){return this.style.moveLayer(c,t),this._update(!0)}removeLayer(c){return this.style.removeLayer(c),this._update(!0)}getLayer(c){return this.style.getLayer(c)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(c,t,s){return this.style.setLayerZoomRange(c,t,s),this._update(!0)}setFilter(c,t,s={}){return this.style.setFilter(c,t,s),this._update(!0)}getFilter(c){return this.style.getFilter(c)}setPaintProperty(c,t,s,a={}){return this.style.setPaintProperty(c,t,s,a),this._update(!0)}getPaintProperty(c,t){return this.style.getPaintProperty(c,t)}setLayoutProperty(c,t,s,a={}){return this.style.setLayoutProperty(c,t,s,a),this._update(!0)}getLayoutProperty(c,t){return this.style.getLayoutProperty(c,t)}setGlyphs(c,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(c,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(c,t,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(c,t,s,a=>{a||this._update(!0)}),this}removeSprite(c){return this._lazyInitEmptyStyle(),this.style.removeSprite(c),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(c,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(c,t,s=>{s||this._update(!0)}),this}setLight(c,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(c,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(c,t){return this.style.setFeatureState(c,t),this._update()}removeFeatureState(c,t){return this.style.removeFeatureState(c,t),this._update()}getFeatureState(c){return this.style.getFeatureState(c)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let c=0,t=0;return this._container&&(c=this._container.clientWidth||400,t=this._container.clientHeight||300),[c,t]}_setupContainer(){const c=this._container;c.classList.add("maplibregl-map");const t=this._canvasContainer=re.create("div","maplibregl-canvas-container",c);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=re.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),a=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],a);const o=this._controlContainer=re.create("div","maplibregl-control-container",c),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=re.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,t,s){this._canvas.width=Math.floor(s*c),this._canvas.height=Math.floor(s*t),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const c={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:c},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const s=this._canvas.getContext("webgl2",c)||this._canvas.getContext("webgl",c);if(!s){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Es(s,this.transform),Fr.testSupport(s)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_render(c){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const o=this.transform.zoom,h=xe.now();this.style.zoomHistory.update(o,h);const m=new p.a8(o,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(s=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bc.mark(p.bd.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,p.bc.mark(p.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var c;this._hash&&this._hash.remove();for(const s of this._controls)s.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),_i.removeThrottleControl(this._imageQueueHandle),(c=this._resizeObserver)===null||c===void 0||c.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),re.remove(this._canvasContainer),re.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bc.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,xe.frameAsync(this._frameRequest).then(c=>{p.bc.frame(c),this._frameRequest=null,this._render(c)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get version(){return un}getCameraTargetElevation(){return this.transform.elevation}},k.MapMouseEvent=Ot,k.MapTouchEvent=zs,k.MapWheelEvent=Li,k.Marker=Rs,k.NavigationControl=class{constructor(c){this._updateZoomButtons=()=>{const t=this._map.getZoom(),s=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,s)=>{const a=this._map._getUIString(`NavigationControl.${s}`);t.title=a,t.setAttribute("aria-label",a)},this.options=p.e({},$a,c),this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=re.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ja(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){re.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,t){const s=re.create("button",c,this._container);return s.type="button",s.addEventListener("click",t),s}},k.Popup=class extends p.E{constructor(c){super(),this.remove=()=>(this._content&&re.remove(this._content),this._container&&(re.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=re.create("div","maplibregl-popup",this._map.getContainer()),this._tip=re.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const g of this.options.className.split(" "))this._container.classList.add(g);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?qn(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!t)return;const a=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor;const h=Wa(this.options.offset);if(!o){const g=this._container.offsetWidth,y=this._container.offsetHeight;let v;v=a.y+h.bottom.ythis._map.transform.height-y?["bottom"]:[],a.xthis._map.transform.width-g/2&&v.push("right"),o=v.length===0?"bottom":v.join("-")}let m=a.add(h[o]);this.options.subpixelPositioning||(m=m.round()),re.setTransform(this._container,`${dn[o]} translate(${m.x}px,${m.y}px)`),Zn(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Ga),c)}addTo(c){return this._map&&this.remove(),this._map=c,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(c){return this._lngLat=p.M.convert(c),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){const t=document.createDocumentFragment(),s=document.createElement("body");let a;for(s.innerHTML=c;a=s.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var c;return(c=this._container)===null||c===void 0?void 0:c.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=re.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(c),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(c){this._container&&this._container.classList.add(c)}removeClassName(c){this._container&&this._container.classList.remove(c)}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){if(this._container)return this._container.classList.toggle(c)}setSubpixelPositioning(c){this.options.subpixelPositioning=c}_createCloseButton(){this.options.closeButton&&(this._closeButton=re.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const c=this._container.querySelector(Ha);c&&c.focus()}},k.RasterDEMTileSource=Gs,k.RasterTileSource=qr,k.ScaleControl=class{constructor(c){this._onMove=()=>{Gn(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Gn(this._map,this._container,this.options)},this.options=p.e({},Za,c)}getDefaultPosition(){return"bottom-left"}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-scale",c.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){re.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},k.ScrollZoomHandler=Ba,k.Style=vn,k.TerrainControl=class{constructor(c){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=c}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=re.create("button","maplibregl-ctrl-terrain",this._container),re.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){re.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},k.TwoFingersTouchPitchHandler=Wo,k.TwoFingersTouchRotateHandler=La,k.TwoFingersTouchZoomHandler=Vn,k.TwoFingersTouchZoomRotateHandler=Me,k.VectorTileSource=se,k.VideoSource=fs,k.addSourceType=(c,t)=>p._(void 0,void 0,void 0,function*(){if(Zr(c))throw new Error(`A source type called "${c}" already exists.`);((s,a)=>{gs[s]=a})(c,t)}),k.clearPrewarmedResources=function(){const c=ur;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(Nr),ur=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},k.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},k.getRTLTextPluginStatus=function(){return yi().getRTLTextPluginStatus()},k.getVersion=function(){return Qo},k.getWorkerCount=function(){return Qi.workerCount},k.getWorkerUrl=function(){return p.a.WORKER_URL},k.importScriptInWorkers=function(c){return Tr().broadcast("importScript",c)},k.prewarm=function(){Vi().acquire(Nr)},k.setMaxParallelImageRequests=function(c){p.a.MAX_PARALLEL_IMAGE_REQUESTS=c},k.setRTLTextPlugin=function(c,t){return yi().setRTLTextPlugin(c,t)},k.setWorkerCount=function(c){Qi.workerCount=c},k.setWorkerUrl=function(c){p.a.WORKER_URL=c}});var na=Rr;return na})})(ru);var nu=ru.exports;const Qd=Kd(nu),tp=Jd({__proto__:null,default:Qd},[nu]);export{tp as m}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt deleted file mode 100644 index 14267e9..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Allow: / \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest deleted file mode 100644 index 6135ea5..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Meshtastic", - "short_name": "Meshtastic", - "start_url": ".", - "description": "Meshtastic web app", - "icons": [ - { - "src": "/icon.svg", - "sizes": "any", - "type": "image/svg+xml" - } - ], - "theme_color": "#67ea94", - "background_color": "#67ea94", - "display": "standalone" -} From f9977f68a226eb0b6e66bd472722e3002895062a Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 15:04:15 +0200 Subject: [PATCH 092/149] Fix set-time dialog --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index a734a70..449305e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -59,7 +59,12 @@ done if [ $arg_count -eq 0 ]; then # if the script was launched with no arguments, then load the UI. echo "Loading current time settings..." current_timezone=$(timedatectl show --property=Timezone --value) - dialog --no-collapse --title "System time" --yesno "Current system time: $(date +"%H:%M:%S")\nCurrent time zone: $current_timezone ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n$(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\nSet new time and timezone?" 10 60 + dialog --no-collapse --title "System time" --yesno "\ +Current system time:\n\ +$(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\ +$(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\ +\n\ +Set new time and timezone?" 10 70 if [ $? -eq 1 ]; then #unless cancel/no exit 0 fi From 2c2edf051667ff1b0888845eb30a79b7479e487f Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 17:31:10 +0200 Subject: [PATCH 093/149] Update femto-set-time.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index 449305e..de2b08c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -64,7 +64,7 @@ Current system time:\n\ $(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\ $(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\ \n\ -Set new time and timezone?" 10 70 +Set new time and timezone?" 10 50 if [ $? -eq 1 ]; then #unless cancel/no exit 0 fi From 57954fe23665d2414dd5748597ad15d3238e4e46 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 17:37:12 +0200 Subject: [PATCH 094/149] Update femto-set-time.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index de2b08c..51b29d8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -32,7 +32,7 @@ for i in {1..5}; do echo "Time Zone updated to:\n$(timedatectl show --property=Timezone --value) $(date +%Z) (UTC$(date +%:z))\nSystem time updated to:\n$(date)\n\nNew time successfully saved to RTC.\nTime & date are also set automatically from internet, if connected." return 0 else - echo "System time updated to:\n$(date) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\nUnable to communicate with RTC module. An RTC module can remember system time between reboots/power outages.\nTime & date are also set automatically from internet, if connected." + echo "System time updated to:\n$(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\nUnable to communicate with RTC module. An RTC module can remember system time between reboots/power outages.\nTime & date are also set automatically from internet, if connected." return 0 fi fi @@ -83,7 +83,7 @@ Set new time and timezone?" 10 50 # Show timezone selection menu with preselection of current timezone selected_timezone=$(dialog --title "Set Time Zone" \ --default-item "$current_timezone" \ - --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 60 10 \ + --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 50 10 \ $(printf "%s " "${options[@]}") 3>&1 1>&2 2>&3) exit_status=$? if [[ $exit_status -eq 0 && -n "$selected_timezone" ]]; then From 8f0d52117eae689eb73d3afab12b0f1c95f65aa9 Mon Sep 17 00:00:00 2001 From: joshbowyer <37744796+joshbowyer@users.noreply.github.com> Date: Mon, 17 Feb 2025 11:33:47 -0600 Subject: [PATCH 095/149] Update femtofox.chroot Add vim and mtd-utils to apt install in chroot --- environment-setup/femtofox.chroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index f3c1859..9b5868e 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -23,7 +23,7 @@ ln -sf /usr/share/zoneinfo/UTC /etc/localtime echo "Installing packages..." apt update -DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba +DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba vim mtd-utils if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi DEBIAN_FRONTEND=noninteractive apt upgrade -y --option Dpkg::Options::="--force-confold" From aaaa7d9e87c2d4c355ea4b9a494ce75f2a257419 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 19:43:09 +0200 Subject: [PATCH 096/149] Revert runonce swapfile "oops" --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index a5df75a..4ba57a2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -62,7 +62,7 @@ if [ ! -f /swapfile ]; then # check if swap file already exists chmod 600 /swapfile mkswap /swapfile > /dev/null swapon /swapfile > /dev/null - echo '/swapfile none swap sw 0 0' + echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null log_message "Swap file allocated." else log_message "Swap file already allocated, skipping" From 3fc3c50f9aa2713535ec12c4ef5c83b53c13656c Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 17 Feb 2025 22:35:40 +0200 Subject: [PATCH 097/149] Continue refining lora settings menu --- .../usr/local/bin/femto-config | 20 +++-- .../usr/local/bin/femto-meshtasticd-config.sh | 74 +++++++---------- .../bin/femto-meshtasticd-lora-dialogs.sh | 82 ++++++++----------- .../usr/local/bin/femto-network-config.sh | 2 +- .../usr/local/bin/femto-set-time.sh | 6 +- 5 files changed, 80 insertions(+), 104 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 7bdf98c..0188acf 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -62,10 +62,16 @@ ingest_data() { # usage: `ingest_data "command.sh -argument" key_width` } check_meshtasticd_running() { - if echo $(femto-utils.sh -C "meshtasticd") | grep -q "not running"; then + if ! echo $(femto-utils.sh -C "meshtasticd") | sed 's/\x1b\[[0-9;]*m//g' | grep -q ", running"; then dialog --no-collapse --title "Meshtasticd service" --yesno "Meshtasticd service is not running but is required.\n\nStart service?" 9 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -s + echo "Waiting for meshtasticd service to start..." + sleep 3 + if ! echo $(femto-utils.sh -C "meshtasticd") | sed 's/\x1b\[[0-9;]*m//g' | grep -q ", running"; then + dialog --no-collapse --colors --title "Meshtasticd service" --msgbox "Meshtasticd service ($(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")) failed to run, but is required." 7 50 + return 1 + fi return 0 else return 1 @@ -186,12 +192,12 @@ networking_settings() { if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog break elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "Meshtastic wifi sync service help" --msgbox "The Meshtastic wifi sync service synchronizes wifi settings with Meshtastic wifi settings. This allows you to use remote node administration to enable/disable Femtofox wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n" 0 0 + dialog --no-collapse --colors --title "Meshtastic wifi sync service help" --msgbox "The Meshtastic wifi sync service synchronizes system wifi settings with Meshtastic wifi settings. This allows you to use Meshtastic's remote node administration feature to enable/disable wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n" 0 0 else case $choice in "View detailed service status") echo "Getting Meshtastic wifi sync service status..." - dialog --no-collapse --no-shadow --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 + dialog --no-collapse --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 ;; "Start/restart service") dialog --no-collapse --title "$title" --yesno "Start/restart Meshtastic wifi sync service?" 7 45 @@ -383,7 +389,7 @@ legacy_admin() { choice="" # zero the choice before loading the submenu while true; do loading "Getting current legacy admin state..." - choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you need to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ + choice=$(dialog --no-collapse --colors --title "Legacy Admin" --default-item "$choice" --help-button --item-help --menu "If the node you Femtofox needs to administer or be administered by is running 2.4.x or earlier, you should set this to Enabled.\n\nCurrent state: $(femto-utils.sh -R "$(femto-meshtasticd-config.sh -p)")" 16 65 5 \ 1 "Enable" "" \ 2 "Disable (default)" "" \ " " "" "" \ @@ -553,7 +559,7 @@ meshtastic_settings() { case $choice in "View detailed service status") echo "Getting Meshtasticd service status..." - dialog --no-collapse --no-shadow --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 + dialog --no-collapse --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; "Start/restart service") dialog --no-collapse --title "$title" --yesno "Start/restart Meshtasticd service?" 6 45 @@ -614,7 +620,7 @@ help_menu() { local title="Help / About" help_choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$help_choice" --item-help --menu "$title" 0 0 7 \ 1 "About Femtofox" "" \ - 2 "View pinout" "" \ + 2 "Display pinout" "" \ 3 "Femtofox licensing info - short" "" \ 4 "Femtofox licensing info - long" "" \ 5 "Meshtastic licensing info" "" \ @@ -696,7 +702,7 @@ while getopts ":hlLwc" opt; do ;; c) # Option -c (Check if Meshtasticd is running and warn the user if not) check_meshtasticd_running - exit $? # relay exit status + exit $? ;; \?) # Unknown option) echo -e "Unknown argument $1.\n$help" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index f5caf35..6b24d72 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -28,7 +28,7 @@ Options are: -S Get Meshtasticd service state -z Upgrade Meshtasticd -x Uninstall Meshtasticd --m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m '--set security.admin_channel_enabled false' 10 'Disable legacy admin'\` +-m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m \"--set security.admin_channel_enabled false\" 10 \"Disable legacy admin\"\` Will retry the \`--set security.admin_channel_enabled false\` command until successful or up to 10 times, and tag status reports with \`Disable legacy admin\` via echo and to system log. EOF ) @@ -45,19 +45,17 @@ meshtastic_update() { local ref="$3: " echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - local output=$(meshtastic --host $command | tee /dev/tty) #>&2 lets meshtastic's output display on screen + local output=$(meshtastic --host $command 2>&1 | tee $(if [ -e /dev/tty ]; then echo /dev/tty; else echo /dev/ttyFIQ0; fi)) logger $output if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." - femto-meshtasticd-config.sh -s echo "$msg" logger "$msg" sleep 2 # Add a small delay before retrying fi else local success="true" - echo -e "$output" msg="${ref:+$ref}Meshtastic command successful!" echo "$msg" logger "$msg" @@ -85,44 +83,26 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do i) # Option -i (Get important node info) declare -a output_array output=$(meshtastic --host --info) - output_array+=("Service=$(femto-meshtasticd-config.sh -S)") - output_array+=("Version=$(echo "$output" | grep -oP '"firmwareVersion":\s*"\K[^"]+' | head -n 1)") - output_array+=("Node name=$(echo "$output" | grep -oP 'Owner:\s*\K.*' | head -n 1)") - output_array+=("NodeID=$(echo "!$(printf "%08x\n" $(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1))")") - output_array+=("Nodenum=$(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1)") - output_array+=("TX enabled=$(echo "$output" | grep -oP '"txEnabled":\s*\K\w+')") - use_preset=$(echo "$output" | grep -oP '"usePreset":\s*\K\w+') - output_array+=("Use preset=$use_preset") - if [ "$use_preset" = "true" ]; then # if use-preset is true, then display the preset - output_array+=("Preset=$(echo "$output" | grep -oP '"modemPreset":\s*"\K[^"]+')") - else # otherwise, display the lora settings - output_array+=("Bandwidth=$(echo "$output" | grep -oP '"bandwidth":\s*\K\w+')") - output_array+=("Spread factor=$(echo "$output" | grep -oP '"spreadFactor":\s*\K\w+')") - output_array+=("Coding rate=$(echo "$output" | grep -oP '"codingRate":\s*\K\w+')") - fi - output_array+=("Role=$(echo "$output" | grep -oP '"role":\s*"\K[^"]+' | head -n 1)") - freq_offset=$(echo "$output" | grep -oP '"bandwidth":\s*\K\w+') - if [ "$freq_offset" != 0 ]; then # only display frequency offset if not 0 - output_array+=("Freq offset=$freq_offset") - fi - output_array+=("Region=$(echo "$output" | grep -oP '"region":\s*"\K[^"]+')") - output_array+=("Hop limit=$(echo "$output" | grep -oP '"hopLimit":\s*\K\w+')") - freq_slot=$(echo "$output" | grep -oP '"channelNum":\s*\K\d+' | head -n 1) - if [ "$freq_slot" != 0 ]; then # only display frequency slot if not 0 - freq_slot+=("Freq slot=$freq_slot") - fi - override_freq=$(echo "$output" | grep -oP '"overrideFrequency":\s*\K[0-9.]+') - if [ "$override_freq" != "0.0" ]; then # only display override frequency if not 0.0 - output_array+=("Override freq=$override_freq") - fi - output_array+=("Public key=$(echo "$output" | grep -oP '"publicKey":\s*"\K[^"]+' | head -n 1)") - output_array+=("Nodes in db=$(echo "$output" | grep -oP '"![a-zA-Z0-9]+":\s*\{' | wc -l)") - # now, echo the array - for pair in "${output_array[@]}"; do - key=$(echo "$pair" | cut -d'=' -f1) - value=$(echo "$pair" | cut -d'=' -f2-) - echo "$key:$value" - done + echo -e "\ +Service:$(femto-meshtasticd-config.sh -S) +Version:$(echo "$output" | grep -oP '"firmwareVersion":\s*"\K[^"]+' | head -n 1) +Node name:$(echo "$output" | grep -oP 'Owner:\s*\K.*' | head -n 1) +NodeID:$(echo "!$(printf "%08x\n" $(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1))") +Nodenum:$(echo "$output" | grep -oP '"myNodeNum":\s*\K\d+' | head -n 1) +TX enabled:$(echo "$output" | grep -oP '"txEnabled":\s*\K\w+') +Use preset:$(echo "$output" | grep -oP '"usePreset":\s*\K\w+') +Preset:$(echo "$output" | grep -oP '"modemPreset":\s*"\K[^"]+') +Bandwidth:$(echo "$output" | grep -oP '"bandwidth":\s*\K\w+') +Spread factor:$(echo "$output" | grep -oP '"spreadFactor":\s*\K\w+') +Coding rate:$(echo "$output" | grep -oP '"codingRate":\s*\K\w+') +Role:$(echo "$output" | grep -oP '"role":\s*"\K[^"]+' | head -n 1) +Freq offset:$(echo "$output" | grep -oP '"bandwidth":\s*\K\w+') +Region:$(echo "$output" | grep -oP '"region":\s*"\K[^"]+') +Hop limit:$(echo "$output" | grep -oP '"hopLimit":\s*\K\w+') +Freq slot:$(echo "$output" | grep -oP '"channelNum":\s*\K\d+' | head -n 1) +Override freq:$(echo "$output" | grep -oP '"overrideFrequency":\s*\K[0-9.]+') +Public key:$(echo "$output" | grep -oP '"publicKey":\s*"\K[^"]+' | head -n 1) +Nodes in db:$(echo "$output" | grep -oP '"![a-zA-Z0-9]+":\s*\{' | wc -l)" ;; g) # Option -g (get config URL) url=$(meshtastic --host --qr-all | grep -oP '(?<=Complete URL \(includes all channels\): )https://[^ ]+') #add look for errors @@ -239,14 +219,16 @@ while getopts ":higkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do x) # Option -x (uninstall meshtasticd) apt remove meshtasticd ;; - m) # Option -m (manual meshtastic command) + m) external="true" # set a variable so the function knows it was called by an an external script and not locally meshtastic_update "$2" $3 "$4" ;; - \?) # Invalid option) - echo -e "Unknown argument $1.\n$help" + \?) # Invalid option + echo "Invalid option: -$OPTARG" + echo -e "$help" + exit 1 ;; - :) # Missing argument for option) + :) # Missing argument for option echo "Option -$OPTARG requires a setting." echo -e "$help" exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 5f8029e..e3adc55 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -25,6 +25,7 @@ send_settings() { dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "\Z4Command Successful!\Zn\n\nLog:\n$output")" 0 0 fi fi + [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 # if in wizard mode AND there are no script arguments, display the message } @@ -102,21 +103,21 @@ set_lora_radio() { } lora_settings_actions() { + if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then + set_lora_radio $1 + fi + if femto-config -c; then - if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then - set_lora_radio $1 - [ "$1" != "wizard" ] && return - fi if [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Cancel" --default-item "True" --item-help --menu "Meshtastic configuration method" 8 50 0 \ "Automatic configuration with URL" "" "" \ "Manual configuration" "" "" \ " " "" "" \ - "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] || [ "$choice" == "Skip" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] || [ "$choice" == "Cancel" ] && return # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue #restart loop if no choice made [ "$choice" == "Manual configuration" ] && break [ "$choice" == "Automatic configuration with URL" ] && config_url "$1" @@ -124,6 +125,11 @@ lora_settings_actions() { done fi + dialog --no-collapse --infobox "Getting current settings from Meshtasticd.\n\nThis can take a minute..." 6 50 + while IFS=: read -r key value; do + declare "$(echo "$key" | tr '[:upper:]' '[:lower:]' | tr ' ' '_' | xargs)=$(echo "$value" | xargs)" + done < <(femto-meshtasticd-config.sh -i) + if [ "$1" = "region" ] || [ "$1" = "wizard" ]; then options=("UNSET" "US" "EU_433" "EU_868" "CN" "JP" "ANZ" "KR" "TW" "RU" "IN" "NZ_865" "TH" "LORA_24" "UA_433" "UA_868" "MY_433" "MY_919" "SG_923") menu_items=() @@ -137,20 +143,19 @@ lora_settings_actions() { done menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "LONG_FAST" --item-help --menu "Sets the region for your node. Default is unset. As long as this is not set, the node screen will display a message and not transmit any packets.\n\nRegion (default: UNSET)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$region" --item-help --menu "Sets the region for your node. As long as this is not set, the node will display a message and not transmit any packets.\n\nRegion? (current: ${region:-unknown})" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.region $choice " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${use_preset^}" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset? (current: ${use_preset:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -161,7 +166,6 @@ lora_settings_actions() { command+="--set lora.use_preset $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "wizard" ] && [ "$using_preset" = "False" ]; then @@ -180,14 +184,13 @@ lora_settings_actions() { done menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "LONG_FAST" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$preset" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${preset:-unknown})" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made command+="--set lora.modem_preset $choice " break done - [ "$1" != "wizard" ] && return fi fi @@ -196,11 +199,12 @@ lora_settings_actions() { else if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 250 --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $bandwidth --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth? (current: ${bandwidth:-unknown})" 0 0 0 \ + 0 "(default, automatic)" "" \ 31 "" "" \ 62 "" "" \ 125 "" "" \ - 250 "(default)" "" \ + 250 "" "" \ 500 "" "" \ " " "" "" \ "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) @@ -209,18 +213,18 @@ lora_settings_actions() { command+="--set lora.bandwidth $choice " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 12 --menu "Indicates the number of chirps per symbol.\n\nSpread factor (only used if modem preset is disabled)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $spread_factor --menu "Indicates the number of chirps per symbol. Only used if modem preset is disabled.\n\nSpread factor? (current: ${spread_factor:-unknown})" 0 0 0 \ + 0 "(default, automatic)" "" \ 7 "" "" \ 8 "" "" \ 9 "" "" \ 10 "" "" \ 11 "" "" \ - 12 "(default)" "" \ + 12 "" "" \ " " "" "" \ "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -228,16 +232,16 @@ lora_settings_actions() { command+="--set lora.spread_factor $choice " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item 8 --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $coding_rate --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)? (current: ${coding_rate:-unknown})" 0 0 0 \ + 0 "(default, automatic)" "" \ 5 "" "" \ 6 "" "" \ 7 "" "" \ - 8 "(default)" "" \ + 8 "" "" \ " " "" "" \ "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog @@ -245,38 +249,35 @@ lora_settings_actions() { command+="--set lora.coding_rate $choice " break done - [ "$1" != "wizard" ] && return fi fi if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 $freq_offset 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^([0-9]{1,6})(\.[0-9]+)?$ && $(echo "$input <= 1000000" | bc -l) -eq 1) ]] && break # exit loop if user input a number between 0 and 1000000. Decimals allowed dialog --no-collapse --title "$title" --msgbox "Must be between 0-1000000. Decimals allowed." 6 50 done if [ $? -ne 1 ] && [ -n "$input" ]; then command+="--set lora.frequency_offset $input " fi - [ "$1" != "wizard" ] && return fi if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 $hop_limit 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-7]$) ]] && break # exit loop if user input an integer between 0 and 7 dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 7." 6 50 done if [ $? -ne 1 ] && [ -n "$input" ]; then command+="--set lora.hop_limit $input " fi - [ "$1" != "wizard" ] && return fi if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${tx_enabled^}" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX? (current: ${tx_enabled:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -286,7 +287,6 @@ lora_settings_actions() { command+="--set lora.tx_enabled $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "tx_power" ] || [ "$1" = "wizard" ]; then @@ -300,31 +300,29 @@ ERP above 36db violates US (unlicensed) law.\n\ If 0, will use the maximum continuous power legal in your region. \n\ \n\ -TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) +TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-30]$) ]] && break # exit loop if user input an integer between 0 and 30 dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 30." 6 50 done if [ $? -ne 1 ] && [ -n "$input" ]; then command+="--set lora.tx_power $input " fi - [ "$1" != "wizard" ] && return fi if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 $freq_slot 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+$) ]] && break # exit loop if user input an integer 0 or higher dialog --no-collapse --title "$title" --msgbox "Must be an integer 0 or higher." 6 50 done if [ $? -ne 1 ] && [ -n "$input" ]; then command+="--set lora.channel_num $input " fi - [ "$1" != "wizard" ] && return fi if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${override_duty:-False}" | sed 's/^./\U&/')" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle? (current: ${override_duty:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ @@ -334,12 +332,11 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) command+="--set lora.override_duty_cycle $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "True" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${sx126x_boost:-True}" | sed 's/^./\U&/')" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain? (current: ${sx126x_boost:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -349,12 +346,11 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) command+="--set lora.sx126x_rx_boosted_gain $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 ${override_freq:-0} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+(\.[0-9]+)?$) ]] && break # exit loop if user input a number 0 or higher (decimals allowed) dialog --no-collapse --title "$title" --msgbox "Must be a number 0 or higher. Decimals allowed." 6 53 done @@ -362,12 +358,11 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) if [ $? -ne 1 ] && [ -n "$input" ]; then command+="--set lora.override_frequency $input " fi - [ "$1" != "wizard" ] && return fi if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${ignore_mqtt:-False}" | sed 's/^./\U&/')" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT? (current: ${ignore_mqtt:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ @@ -377,12 +372,11 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) command+="--set lora.ignore_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "False" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT?" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${ok_to_mqtt:-False}" | sed 's/^./\U&/')" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT? (current: ${ok_to_mqtt:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ @@ -392,15 +386,9 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 3>&1 1>&2 2>&3) command+="--set lora.config_ok_to_mqtt $(echo "$choice" | tr '[:upper:]' '[:lower:]') " break done - [ "$1" != "wizard" ] && return fi - # if we're in wizard mode AND there are no script arguments, then display a message - [ "$1" = "wizard" ] && [ -z "$args" ] && dialog --no-collapse --title "$title" --colors --msgbox "Meshtastic LoRa Settings Wizard complete!" 6 50 - send_settings $1 - - [ "$1" = "wizard" ] && return # quit function if wizard fi } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index d9690c9..14c0d05 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -103,7 +103,7 @@ MAC address:$(ifconfig wlan0 | grep ether | awk '{print $2}')" Wi-Fi status:\033[4m\033[0;34menabled\033[0m\n\ Connected to:$(iwconfig 2>/dev/null | grep -i 'ESSID' | awk -F 'ESSID:"' '{print $2}' | awk -F '"' '{print $1}' | sed 's/^$/none/')\n\ Sig. strength:$(iwconfig 2>/dev/null | grep -i 'Signal level' | awk -F 'Signal level=' '{print $2}' | awk '{print $1}')\n\ -Current IP:$(hostname -I | awk '{print $1}')\n +Current IP:$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)\n Hostname:$(hostname).local\n\ $mac_address_line" else diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index 449305e..51b29d8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -32,7 +32,7 @@ for i in {1..5}; do echo "Time Zone updated to:\n$(timedatectl show --property=Timezone --value) $(date +%Z) (UTC$(date +%:z))\nSystem time updated to:\n$(date)\n\nNew time successfully saved to RTC.\nTime & date are also set automatically from internet, if connected." return 0 else - echo "System time updated to:\n$(date) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\nUnable to communicate with RTC module. An RTC module can remember system time between reboots/power outages.\nTime & date are also set automatically from internet, if connected." + echo "System time updated to:\n$(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\nUnable to communicate with RTC module. An RTC module can remember system time between reboots/power outages.\nTime & date are also set automatically from internet, if connected." return 0 fi fi @@ -64,7 +64,7 @@ Current system time:\n\ $(date +"%B %d, %Y %H:%M:%S") $(timedatectl show --property=Timezone --value) ($(date +"UTC%z" | sed -E 's/GMT([+-])0?([0-9]{1,2})00/GMT\1\2/'))\n\ $(hwclock >/dev/null 2>&1 && echo "RTC module found!" || echo "RTC module not found.")\n\ \n\ -Set new time and timezone?" 10 70 +Set new time and timezone?" 10 50 if [ $? -eq 1 ]; then #unless cancel/no exit 0 fi @@ -83,7 +83,7 @@ Set new time and timezone?" 10 70 # Show timezone selection menu with preselection of current timezone selected_timezone=$(dialog --title "Set Time Zone" \ --default-item "$current_timezone" \ - --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 60 10 \ + --menu "Current time zone: $current_timezone (UTC$(date +%z))" 20 50 10 \ $(printf "%s " "${options[@]}") 3>&1 1>&2 2>&3) exit_status=$? if [[ $exit_status -eq 0 && -n "$selected_timezone" ]]; then From ee461842ec5257a7697a4464f33aa3f5f2db7e3e Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 18 Feb 2025 21:16:33 +0200 Subject: [PATCH 098/149] Revamp settings ingest --- .../usr/local/bin/femto-config | 4 +- .../usr/local/bin/femto-meshtasticd-config.sh | 153 +++++++++++++++--- .../bin/femto-meshtasticd-lora-dialogs.sh | 41 +++-- 3 files changed, 154 insertions(+), 44 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 0188acf..bcfde72 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -21,7 +21,7 @@ loading() { } ## function to pull data from various femto scripts and convert it to the contents of a read only dialog --form -# ingest_data() { # usage: `ingest_data "command.sh -argument" key_width value_width` +# ingest_form_data() { # usage: `ingest_form_data "command.sh -argument" key_width value_width` # unset output_array #debug code, delete me # declare -a output_array # # Read the output from femto-meshtasticd-config.sh and store it in the array @@ -42,7 +42,7 @@ loading() { # echo "$form_contents" | sed 's/\x1b\[[0-9;]*m//g' # } ## CODE TO USE THIS FUNCTION: -# eval "$(echo -e "dialog --no-collapse --no-cancel --form \"Meshtastic node info\" 0 0 0 $(ingest_data "femto-meshtasticd-config.sh -i" 18 0) 2>/dev/null")" +# eval "$(echo -e "dialog --no-collapse --no-cancel --form \"Meshtastic node info\" 0 0 0 $(ingest_form_data "femto-meshtasticd-config.sh -i" 18 0) 2>/dev/null")" # function to pull data from various femto scripts and convert it a simple text string, with dialog colors diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 6b24d72..70a0dac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -8,6 +8,7 @@ help=$(cat <&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made @@ -155,7 +154,7 @@ lora_settings_actions() { if [ "$1" = "use_modem_preset" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${use_preset^}" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset? (current: ${use_preset:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_usePreset^}" --item-help --menu "Presets are pre-defined modem settings (Bandwidth, Spread Factor, and Coding Rate) which influence both message speed and range. The vast majority of users use a preset.\n\nUse modem preset? (current: ${lora_usePreset:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -184,7 +183,7 @@ lora_settings_actions() { done menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$preset" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${preset:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${$lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made @@ -199,7 +198,7 @@ lora_settings_actions() { else if [ "$1" = "bandwidth" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $bandwidth --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth? (current: ${bandwidth:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_bandwidth --menu "Width of the frequency \"band\" used around the calculated center frequency. Only used if modem preset is disabled.\n\nBandwidth? (current: ${lora_bandwidth:-unknown})" 0 0 0 \ 0 "(default, automatic)" "" \ 31 "" "" \ 62 "" "" \ @@ -217,7 +216,7 @@ lora_settings_actions() { if [ "$1" = "spread_factor" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $spread_factor --menu "Indicates the number of chirps per symbol. Only used if modem preset is disabled.\n\nSpread factor? (current: ${spread_factor:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_spreadFactor --menu "Indicates the number of chirps per symbol. Only used if modem preset is disabled.\n\nSpread factor? (current: ${lora_spreadFactor:-unknown})" 0 0 0 \ 0 "(default, automatic)" "" \ 7 "" "" \ 8 "" "" \ @@ -236,7 +235,7 @@ lora_settings_actions() { if [ "$1" = "coding_rate" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $coding_rate --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)? (current: ${coding_rate:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --item-help --default-item $lora_codingRate --menu "The proportion of each LoRa transmission that contains actual data - the rest is used for error correction.\n\nCoding rate (only used if modem preset is disabled)? (current: ${lora_codingRate:-unknown})" 0 0 0 \ 0 "(default, automatic)" "" \ 5 "" "" \ 6 "" "" \ @@ -254,7 +253,7 @@ lora_settings_actions() { if [ "$1" = "frequency_offset" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 $freq_offset 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "This parameter is for advanced users with advanced test equipment.\n\nFrequency offset (default: 0)" 0 0 ${lora_frequencyOffset:-unknown} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^([0-9]{1,6})(\.[0-9]+)?$ && $(echo "$input <= 1000000" | bc -l) -eq 1) ]] && break # exit loop if user input a number between 0 and 1000000. Decimals allowed dialog --no-collapse --title "$title" --msgbox "Must be between 0-1000000. Decimals allowed." 6 50 done @@ -265,7 +264,7 @@ lora_settings_actions() { if [ "$1" = "hop_limit" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 $hop_limit 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --colors --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "The maximum number of intermediate nodes between Femtofox and a node it is sending to. Does not impact received messages.\n\n\Z1WARNING:\Zn Excessive hop limit increases congestion!\n\nHop limit. Must be 0-7 (default: 3)" 0 0 ${lora_hopLimit:-unknown} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-7]$) ]] && break # exit loop if user input an integer between 0 and 7 dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 7." 6 50 done @@ -277,7 +276,7 @@ lora_settings_actions() { if [ "$1" = "tx_enabled" ] || [ "$1" = "wizard" ]; then choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${tx_enabled^}" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX? (current: ${tx_enabled:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_txEnabled^}" --item-help --menu "Enables/disables the radio chip. Useful for hot-swapping antennas.\n\nEnable TX? (current: ${lora_txEnabled:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -300,8 +299,8 @@ ERP above 36db violates US (unlicensed) law.\n\ If 0, will use the maximum continuous power legal in your region. \n\ \n\ -TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2>&3) - [[ -z $input || ($input =~ ^[0-30]$) ]] && break # exit loop if user input an integer between 0 and 30 +TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${lora_txPower:-unknown} 3>&1 1>&2 2>&3) + [[ -z $input || $input =~ ^([12]?[0-9]|30)$ ]] && break # exit loop if user input an integer between 0 and 30 dialog --no-collapse --title "$title" --msgbox "Must be an integer between 0 and 30." 6 50 done if [ $? -ne 1 ] && [ -n "$input" ]; then @@ -311,7 +310,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "frequency_slot" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 $freq_slot 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Determines the exact frequency the radio transmits and receives. If unset or set to 0, determined automatically by the primary channel name.\n\nFrequency slot (0 for automatic)" 0 0 ${lora_channelNum:-unknown} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+$) ]] && break # exit loop if user input an integer 0 or higher dialog --no-collapse --title "$title" --msgbox "Must be an integer 0 or higher." 6 50 done @@ -322,7 +321,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "override_duty_cycle" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${override_duty:-False}" | sed 's/^./\U&/')" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle? (current: ${override_duty:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_overrideDutyCycle:-False}" | sed 's/^./\U&/')" --item-help --menu "May have legal ramifications.\n\nOverride duty cycle? (current: ${lora_overrideDutyCycle:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ @@ -336,7 +335,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "sx126x_rx_boosted_gain" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${sx126x_boost:-True}" | sed 's/^./\U&/')" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain? (current: ${sx126x_boost:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_sx126xRxBoostedGain:-True}" | sed 's/^./\U&/')" --item-help --menu "This is an option specific to the SX126x chip series which allows the chip to consume a small amount of additional power to increase RX (receive) sensitivity.\n\nEnable SX126X RX boosted gain? (current: ${lora_sx126xRxBoostedGain:-unknown})" 0 0 0 \ "True" "(default)" "" \ "False" "" "" \ " " "" "" \ @@ -350,7 +349,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "override_frequency" ] || [ "$1" = "wizard" ]; then while true; do - input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 ${override_freq:-0} 3>&1 1>&2 2>&3) + input=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --inputbox "Overrides frequency slot. May have legal ramifications.\n\nOverride frequency in MHz (0 for none)." 0 0 ${lora_overrideFrequency:-unknown} 3>&1 1>&2 2>&3) [[ -z $input || ($input =~ ^[0-9]+(\.[0-9]+)?$) ]] && break # exit loop if user input a number 0 or higher (decimals allowed) dialog --no-collapse --title "$title" --msgbox "Must be a number 0 or higher. Decimals allowed." 6 53 done @@ -362,7 +361,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "ignore_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${ignore_mqtt:-False}" | sed 's/^./\U&/')" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT? (current: ${ignore_mqtt:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_ignoreMqtt:-unknown}" | sed 's/^./\U&/')" --item-help --menu "Ignores any messages it receives via LoRa that came via MQTT somewhere along the path towards the device.\n\nIgnore MQTT? (current: ${lora_ignoreMqtt:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ @@ -376,7 +375,7 @@ TX power in dBm. Must be 0-30 (0 for automatic)" 0 0 ${tx_power:-0} 3>&1 1>&2 2> if [ "$1" = "ok_to_mqtt" ] || [ "$1" = "wizard" ]; then while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${ok_to_mqtt:-False}" | sed 's/^./\U&/')" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT? (current: ${ok_to_mqtt:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$(echo "${lora_configOkToMqtt:-unknown}" | sed 's/^./\U&/')" --item-help --menu "Indicates that the user approves their packets to be uplinked to MQTT brokers.\n\nOK to MQTT? (current: ${lora_configOkToMqtt:-unknown})" 0 0 0 \ "True" "" "" \ "False" "(default)" "" \ " " "" "" \ From 9019527e95786d8b45901ec6bcc96ddc95a109b5 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Tue, 18 Feb 2025 22:51:35 +0000 Subject: [PATCH 099/149] Update README.md --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c08679..292a7b3 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,13 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo - [Features](#features) and [Specifications](#Specification) - [Supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware) - [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started) -- How to order - coming soon +- How to order + - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) + - [Tindie (UK)](tbc) - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) - [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) - [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) - ### Features * Tiny size (63x54mm for Femtofox, 65x30mm for the Smol Edition). Equivalent to a standard Raspberry Pi hat and Pi Zero respectively. * Power efficient (~0.27-0.4w average, depending on radio and mesh congestion) @@ -30,11 +31,12 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo | Feature | Specification | | ------------ | ------------------------------------------------------- | -| Processor | Rockchip RV1103, Cortex A7 \@1.1GHz | +| Processor | Rockchip RV1103, Cortex A7 \@1.1GHz | | Memory | 64MB DDR2 | | OS | Foxbuntu (based on Ubuntu 22.04.5 LTS Jammy) | | Connectivity | USB 2.0 Host/Device | -| Network | RJ45 Ethernet with filtering
WiFi ready | +| Network | RJ45 Ethernet with filtering
| +| | WiFi ready | | GPIO | 17x GPIO pins (of which 8 are required for Lora module) | | IO | 2x I2C JST PH | | | 1x UART JST PH | @@ -42,6 +44,7 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo | Mesh | 30dB LoRa Radio 868-915MHz | | Storage | Micro-SD slot | | Power | 3.3-5V.dc via JST PH or USB-C | +| Dimensions | 63 x 54 x 19mm | **Accomplished:** - [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md)) From 368adf06414306dd9b8097b54864e2b13823acac Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 01:00:04 +0200 Subject: [PATCH 100/149] Only generate new ttyd ssl keys if hostname actually changed --- .../bin/femto-meshtasticd-lora-dialogs.sh | 127 +++++++++--------- .../usr/local/bin/femto-network-config.sh | 3 +- 2 files changed, 64 insertions(+), 66 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index e6fd894..2ab2b5b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -11,11 +11,12 @@ export LANG=C.UTF-8 title="Meshtastic LoRa Settings" args=$@ + send_settings() { if [ -n "$command" ]; then set -o pipefail echo "meshtastic --host $command" - output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save LoRa settings'" | tee /dev/tty) + output=$(eval "femto-meshtasticd-config.sh -m '$command' 5 'Save Meshtastic settings'" | tee /dev/tty) exit_status=$? set +o pipefail if [ $exit_status -eq 1 ]; then @@ -30,7 +31,7 @@ send_settings() { config_url() { femto-config -c && ( - newurl=$(dialog --no-collapse --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 11 63 3>&1 1>&2 2>&3) + newurl=$(dialog --no-collapse --colors --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\nEntering a URL may \Z1\ZuOVERWRITE\Zn your LoRa settings and channels!\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 13 63 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered command+="--seturl $newurl " fi @@ -39,71 +40,67 @@ config_url() { ) } -#set lora radio -set_lora_radio() { - choice="" # zero the choice before loading the submenu - while true; do - echo "Checking LoRa radio..." - #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) - choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ - "Radio name:" "Configuration:" "" \ - "" "" "" \ - "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ - "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ - "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ - "Heltec ht-ra62" "(SX1262_TCXO)" "" \ - "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ - "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ - "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ - "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ - "Simulated radio" "(none)" "" \ - " " "" "" \ - "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - local radio="" - case $choice in - "Ebyte e22-900m30s") - radio="sx1262_tcxo" - ;; - "Ebyte e22-900m22s") - radio="sx1262_tcxo" - ;; - "Ebyte e80-900m22s") - radio="sx1262_xtal" - ;; - "Heltec ht-ra62") - radio="sx1262_tcxo" - ;; - "Seeed wio-sx1262") - radio="sx1262_tcxo" - ;; - "Waveshare sx126x-xxxm") - radio="sx1262_xtal" - ;; - "AI Thinker ra-01sh") - radio="femto_sx1262_xtal" - ;; - "LoRa Meshstick 1262") - radio="lora-meshstick-1262" - ;; - "Simulated radio") - radio="none" - ;; - "Skip") - return - ;; - esac - if [ -n "$radio" ]; then #if a radio was selected - femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd - dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45 - return - fi - done -} - lora_settings_actions() { if [ "$1" = "set_lora_radio_model" ] || [ "$1" = "wizard" ]; then - set_lora_radio $1 + choice="" # zero the choice before loading the submenu + while true; do + echo "Checking LoRa radio..." + #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) + choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + "Radio name:" "Configuration:" "" \ + "" "" "" \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ + "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ + "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ + "Heltec ht-ra62" "(SX1262_TCXO)" "" \ + "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ + "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ + "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ + "Simulated radio" "(none)" "" \ + " " "" "" \ + "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + local radio="" + case $choice in + "Ebyte e22-900m30s") + radio="sx1262_tcxo" + ;; + "Ebyte e22-900m22s") + radio="sx1262_tcxo" + ;; + "Ebyte e80-900m22s") + radio="sx1262_xtal" + ;; + "Heltec ht-ra62") + radio="sx1262_tcxo" + ;; + "Seeed wio-sx1262") + radio="sx1262_tcxo" + ;; + "Waveshare sx126x-xxxm") + radio="sx1262_xtal" + ;; + "AI Thinker ra-01sh") + radio="femto_sx1262_xtal" + ;; + "LoRa Meshstick 1262") + radio="lora-meshstick-1262" + ;; + "Simulated radio") + radio="none" + ;; + "Skip") + return + ;; + esac + if [ -n "$radio" ]; then #if a radio was selected + femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45 + break + fi + done + [ "$1" = "set_lora_radio_model" ] && return fi if femto-config -c; then diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index 14c0d05..f1e5abb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -147,11 +147,12 @@ $wifi_settings" updated_wifi="true" ;; n) # Option -n (set hostname) + old_hostname=$(hostname) sed -i "s/$(hostname)/$OPTARG/g" /etc/hosts hostnamectl set-hostname "$OPTARG" systemctl restart avahi-daemon echo "Regenerating web terminal ssl keys..." - /usr/local/bin/packages/ttyd.sh -k + [ "$OPTARG" != "$old_hostname" ] && /usr/local/bin/packages/ttyd.sh -k ;; \?) # Invalid option) echo "Invalid option: -$OPTARG" From 9aabaad7d572d72ac95cb83edbe3799af6ddf3f4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 01:03:08 +0200 Subject: [PATCH 101/149] add jq and rsync to apt installs in chroot --- environment-setup/femtofox.chroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 9b5868e..19d213c 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -23,7 +23,7 @@ ln -sf /usr/share/zoneinfo/UTC /etc/localtime echo "Installing packages..." apt update -DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba vim mtd-utils +DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba vim mtd-utils jq rsync if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi DEBIAN_FRONTEND=noninteractive apt upgrade -y --option Dpkg::Options::="--force-confold" From 3a0624417442ab7cafd8a139b87b83b4c18ce9e7 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Wed, 19 Feb 2025 01:21:49 +0000 Subject: [PATCH 102/149] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 292a7b3..2bb68ca 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo - [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started) - How to order - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) - - [Tindie (UK)](tbc) + - [Tindie (UK)](https://www.tindie.com/products/nomdetom/femtofox-pro-v1-kit-linux-mesthastic-node/) - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) - [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) - [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) From 0850c60fd194850b85818b281c8b076e46873224 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Wed, 19 Feb 2025 02:50:51 +0000 Subject: [PATCH 103/149] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bb68ca..675ef38 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo - [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started) - How to order - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) - - [Tindie (UK)](https://www.tindie.com/products/nomdetom/femtofox-pro-v1-kit-linux-mesthastic-node/) + - [Tindie (UK)](https://www.tindie.com/products/edit/femtofox-pro-v1-kit-linux-meshtastic-node/) - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) - [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) - [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) From 883d57a3e734e5f2963a34ddd8b79d0fde7c0b01 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:24:32 +0200 Subject: [PATCH 104/149] Network failover --- .../rootfs_uclibc_rv1106/etc/network/interfaces | 9 +++++++++ .../usr/local/bin/femto-runonce.sh | 16 ++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces index 315112b..bfde602 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces @@ -8,4 +8,13 @@ iface lo inet loopback allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf + metric 100 + post-up sleep 5 && dhclient wlan0 + pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev wlan0 metric 100 + +allow-hotplug eth0 +iface eth0 inet dhcp + metric 10 + post-up ip route replace default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10 + pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 4ba57a2..8f6073b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -70,16 +70,16 @@ fi # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" -if ! grep -q "eth0" /etc/network/interfaces; then +file="/etc/network/interfaces" +if ! grep -q " hwaddress ether $mac" "$file"; then log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)" - cat <> /etc/network/interfaces -# static mac address for onboard ethernet (castellated pins) -allow-hotplug eth0 -iface eth0 inet dhcp -hwaddress ether $mac -EOF + awk -v mac="$mac" ' + { print } + /allow-hotplug eth0/ { count=5 } + count && --count == 0 { print " hwaddress ether " mac } + ' "$file" > "$file.tmp" && mv "$file.tmp" "$file" else - log_message "eth0 already exists in /etc/network/interfaces, skipping" + log_message "eth0 mac address already set in /etc/network/interfaces, skipping" fi # Add term stuff to .bashrc From a980af7e47a46cc040cc1fb1abeda744c6355db0 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:49:53 +0200 Subject: [PATCH 105/149] add back ssh keygen --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 8f6073b..df60518 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -110,7 +110,7 @@ systemctl enable meshtasticd #generate SSH keys log_message "Generating new SSH encryption keys. This can take a couple minutes..." -#femto-utils.sh -E +femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." From 01b65a642454b29e01ab590865cf62b6ebf33044 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:50:27 +0200 Subject: [PATCH 106/149] Update femto-runonce.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index df60518..c0d19ac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k +systemctl enable ttyd # remove first boot flag systemctl disable femto-runonce From 9db705447e8a218e659e89e8275d5b01a3e92831 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 14:14:38 +0200 Subject: [PATCH 107/149] disable ttyd in chroot and re-enable on first boot --- environment-setup/femtofox.chroot | 3 ++- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 19d213c..d0274df 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -62,7 +62,8 @@ systemctl enable femto-boot-complete.service systemctl enable femto-wifi-mesh-control systemctl enable femto-watchclock-dog -systemctl disable meshtasticd +systemctl disable ttyd # enabled on first boot +systemctl disable meshtasticd # enabled on first boot systemctl disable apt-daily.timer systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index c0d19ac..a319a38 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k +log_message "Enabling Web Terminal (ttyd) service... systemctl enable ttyd # remove first boot flag From 21519c034503af71ddfe8de4e0b88c575b63b2c4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 14:34:42 +0200 Subject: [PATCH 108/149] Fix typo in lora settings menu --- .../usr/local/bin/femto-meshtasticd-lora-dialogs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 2ab2b5b..d8acc49 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -180,7 +180,7 @@ lora_settings_actions() { done menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${$lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made From 80fa90e1201553955683d328c18176ff652e2798 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 20:39:02 +0200 Subject: [PATCH 109/149] Missing " in runonce --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index a319a38..d38262a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,7 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k -log_message "Enabling Web Terminal (ttyd) service... +log_message "Enabling Web Terminal (ttyd) service..." systemctl enable ttyd # remove first boot flag From ff37008b0f5cb138bc6d256909944632666cd426 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 20 Feb 2025 00:32:41 +0200 Subject: [PATCH 110/149] Fix small pinouts issues --- .../usr/local/bin/femto-config | 2 +- .../usr/local/bin/femto-pinout.sh | 96 +++++++++---------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index bcfde72..8fcc0da 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -636,7 +636,7 @@ help_menu() { 2) #Display pinout) choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --cancel-label "Back" --item-help --menu "Pinouts" 15 40 5 \ + choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --item-help --menu "Pinouts" 15 40 5 \ 1 "Femtofox Pro/CE" "" \ 2 "Femtofox Zero" "" \ 3 "Femtofox Tiny" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh index a3f374b..c54db4b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh @@ -60,58 +60,58 @@ KILL: add PWR switch or thermal cutoff/fuse & remove resistor." femtofox_zero="\ - ┌────┐ ┌────┐ - │⚪ \ / ⚪│ - │ \ / │ - │ └─────────┘ │ - │ ┌─────────────────┐ │ - │ ●│● USB-C ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● LUCKFOX ●│● │ - │ ●│● PICO MINI ●│● │ - │ ●│● ●│● │ - │ ●│● FOXHOLE ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ └────●─●─●─●─●────┘ │ - ├───┐ ┌─────────────┐ ┌───┤ - GND │ ● │ │ HT-RA62 │ │ ● │ GND - 3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3 -UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA -UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL - ├───┘ │ │SX 1262│ │ └───┤ - │ │ └───────┘ │ ● │ UNUSED - │ └─────────────┘ ● │ GND - │⚪ ETH ⚪│ - └────────●─●─●─●─●────────┘ - R R G T T - X X N X X - - + D - + \n" + ┌────┐ ┌────┐ \n\ + │⚪ \ / ⚪│ \n\ + │ \ / │ \n\ + │ └─────────┘ │ \n\ + │ ┌─────────────────┐ │ \n\ + │ ●│● USB-C ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● LUCKFOX ●│● │ \n\ + │ ●│● PICO MINI ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● FOXHOLE ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ └────●─●─●─●─●────┘ │ \n\ + ├───┐ ┌─────────────┐ ┌───┤ \n\ + GND │ ● │ │ HT-RA62 │ │ ● │ GND \n\ + 3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3 \n\ +UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA \n\ +UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL \n\ + ├───┘ │ │SX 1262│ │ └───┤ \n\ + │ │ └───────┘ │ ● │ UNUSED \n\ + │ └─────────────┘ ● │ GND \n\ + │⚪ ETH ⚪│ \n\ + └────────●─●─●─●─●────────┘ \n\ + R R G T T \n\ + X X N X X \n\ + - + D - + " femtofox_tiny="coming soon" luckfox="\ - ┌────┬───────┬────┐ - VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT - GND ●│● │ │ ●│● GND - 3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V -UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V -UART2-RX DEBUG, 43 ●│● [BTN] ●│● 4 - CS0, 48 ●│● ●│● 55, IRQ - CLK, 49 ●│● ●│● 54, BUSY - MOSI, 50 ●│● ●│● 59, I2C SCL - MISO, 51 ●│● ●│● 58, I2C SDA - UART4-RX, 52 ●│● ●│● 57, NRST, UART3-RX - UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX - └──●──●──●──●──●──┘ - R R G T T - X X N X X - - + D - + -GPIO BANK 0 (3.3v): 4 -GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59 + ┌────┬───────┬────┐ \n\ + VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT \n\ + GND ●│● │ │ ●│● GND \n\ + 3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V\n\ +UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V\n\ +UART2-RX DEBUG, 43 ●│● [BTN] ●│● 4 \n\ + CS0, 48 ●│● ●│● 55, IRQ \n\ + CLK, 49 ●│● ●│● 54, BUSY \n\ + MOSI, 50 ●│● ●│● 59, I2C SCL \n\ + MISO, 51 ●│● ●│● 58, I2C SDA \n\ + UART4-RX, 52 ●│● ●│● 57, NRST, UART3-RX \n\ + UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX \n\ + └──●──●──●──●──●──┘ \n\ + R R G T T \n\ + X X N X X \n\ + - + D - + \n\ +GPIO BANK 0 (3.3v): 4 \n\ +GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59\n\ GPIO BANK 4 (1.8v): 144 145 " # Parse options From 5e018368a0ad7562ec93ac0432a2417d322a7fe3 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:01:06 +0200 Subject: [PATCH 111/149] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 675ef38..41dd90d 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,13 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo | Dimensions | 63 x 54 x 19mm | **Accomplished:** -- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md)) -- [x] WIFI over USB (see [supported hardware](supported_hardware.md)) +- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) +- [x] WIFI over USB (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] Ethernet over pins (see *Networking* below and wiring diagram at bottom of page) - [x] UART communications with Meshtastic nodes (2 pin pairs) such as RAK Wisblock -- [x] USB serial communications with Meshtastic nodes (see [supported hardware](supported_hardware.md)) +- [x] USB serial communications with Meshtastic nodes (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] USB mass storage -- [x] Real time clock (RTC) support (see [supported hardware](supported_hardware.md)) +- [x] Real time clock (RTC) support (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] Activity LED disabled. User LED will blink for 5 seconds when boot is complete - [x] Short pressing the "BOOT" button toggles wifi, 2-5 second press triggers reboot, 5+ second press shuts system down - [x] Ability to reconfigure wifi via USB flash drive From 4550289068bdbb2687eb24a10698343bc53ce230 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 23 Feb 2025 14:37:33 +0200 Subject: [PATCH 112/149] Add meshtastic_cli to usb config tool --- .../usr/local/bin/femto-meshtasticd-config.sh | 13 ++++++++----- .../usr/local/bin/femto-usb-config-tool.sh | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 70a0dac..d9c2fec 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -44,11 +44,12 @@ meshtastic_update() { local command="$1" local attempts=$2 local ref="$3: " + echo "${ref:+$ref}meshtastic --host $command" echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - local output=$(meshtastic --host $command 2>&1 | tee $(if [ -e /dev/tty ]; then echo /dev/tty; else echo /dev/ttyFIQ0; fi)) - logger $output - if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then + output=$(meshtastic --host --info | tee /dev/fd/2) + logger "$output" + if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno|failed|Failed"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." echo "$msg" @@ -177,8 +178,10 @@ get_meshtastic_settings() { eval "url_primary_channel='$(echo "$meshtastic_info" | sed -n 's/^Primary channel URL: //p')'" [[ "$1" != *"quiet"* ]] && echo "url_primary_channel:$url_primary_channel" - eval "url_all_channels='$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')'" - [[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels" + if echo "$meshtastic_info" | grep -q "^Complete URL (includes all channels): "; then + url_all_channels=$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p') + [[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels" + fi fi } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 5096583..5bf0574 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -270,6 +270,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list fi + # get meshtastic_cli= lines and run them + while IFS='=' read -r key value; do + log_message "Meshtastic CLI command found." + femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log + found_config=true + done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/') + if [ "$found_config" = true ]; then #if we found a config file containing valid data if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi log_message "Making changes to wifi settings and restarting wifi." From 0cdd6f7125f07b95d0ef95f607e3cd62a676debf Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 23 Feb 2025 15:52:25 +0200 Subject: [PATCH 113/149] Fix meshtastic_cli support --- assets/femtofox-config.txt | 5 +++++ .../usr/local/bin/femto-meshtasticd-config.sh | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 22d3ca1..01e4d3c 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -21,6 +21,11 @@ ### Meshtastic settings +## Multiple meshtastic_cli lines can be added. This is important, as the Meshtastic CLI requires that different settings categories (such as device and lora) be handled in separate commands. +## See Meshtastic CLI docs (https://meshtastic.org/docs/software/python/cli/) for more information. +#meshtastic_cli="--set lora.modem_preset LONG_FAST" +#meshtastic_cli="--set device.role CLIENT" + ## Radio module to use. Options are: ## "ebyte-e22-900m30s" ## "ebyte-e22-900m22s" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index d9c2fec..1e9c80e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -47,9 +47,9 @@ meshtastic_update() { echo "${ref:+$ref}meshtastic --host $command" echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - output=$(meshtastic --host --info | tee /dev/fd/2) + output=$(eval meshtastic --host $command 2>&1 | tee /dev/fd/2) # display the output on screen live. Use eval so quotes will be handled correctly in $command logger "$output" - if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno|failed|Failed"; then + if echo "$output" | grep -qiE "Abort|invalid|Error|error|unrecognized|refused|Errno|failed|Failed"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." echo "$msg" From 581236ad7b61b8b29ea79c010c1f5a35ae07b95c Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 24 Feb 2025 22:46:26 +0200 Subject: [PATCH 114/149] Add new meshing-around dependencies --- environment-setup/femtofox.chroot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index d0274df..73d2b87 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -39,7 +39,8 @@ DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force- echo "Installing dependencies for meshing-around and meshtastic cli..." #pip config set global.extra-index-url https://www.piwheels.org/simple -pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python +pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python pubsub datetime + if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi echo "Downloading ttyd and enabling service..." From 73788c1b8450ba6b3d1d05e66753f5bea751d9fe Mon Sep 17 00:00:00 2001 From: Ruledo Date: Tue, 25 Feb 2025 00:12:36 -0800 Subject: [PATCH 115/149] Build on any OS Good luck. --- environment-setup/foxbuntu-builder.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/environment-setup/foxbuntu-builder.sh b/environment-setup/foxbuntu-builder.sh index 3229318..3cb4063 100644 --- a/environment-setup/foxbuntu-builder.sh +++ b/environment-setup/foxbuntu-builder.sh @@ -12,15 +12,11 @@ if [[ $(id -u) != 0 ]]; then exit 1 fi -if [ -f /etc/os-release ]; then - . /etc/os-release - if [ "$VERSION_ID" != "22.04" ] || [ "$NAME" != "Ubuntu" ]; then - echo "This script is intended for Ubuntu 22.04, exiting..." - exit 1 - fi -else - echo "This script is intended for Ubuntu 22.04, exiting..." - exit 1 +[ -f /etc/os-release ] && . /etc/os-release + +if [ "$VERSION_ID" != "22.04" ] || [ "$NAME" != "Ubuntu" ]; then + echo -e "This script is intended for Ubuntu 22.04, your operating system is not supported (but may work).\nPress Ctrl+C to cancel, or Enter to continue." + read fi sudoer=$(echo $SUDO_USER) From 5c7e392c9545a77ad92970809f67f1bd5d4ab288 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 16:08:40 +0200 Subject: [PATCH 116/149] Add software install via USB config tool --- assets/femtofox-config.txt | 4 + .../usr/local/bin/femto-set-time.sh | 15 ++++ .../usr/local/bin/femto-usb-config-tool.sh | 74 ++++++++++++++++--- 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 01e4d3c..4eab8f9 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -18,6 +18,10 @@ ## Options are "enable" and "disable" #act_led="disable" +### Software control +## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages +## Multiple packages can be installed by separating them with commas +#software_install="packageA,packageB" ### Meshtastic settings diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh index 51b29d8..2ca6bd8 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-set-time.sh @@ -23,6 +23,19 @@ set_timezone() { echo "Setting time zone..." ln -f -s /usr/share/zoneinfo/$1 /etc/localtime >/dev/null 2>&1 dpkg-reconfigure --frontend noninteractive tzdata >/dev/null 2>&1 + if [ ! -f /usr/share/zoneinfo/$1 >/dev/null 2>&1 ]; then + echo -e "Invalid timezone: $1" + return 1 + fi + desired_offset=$(TZ=$1 date +"%:z") + current_offset=$(date +"%:z") + if [ "$desired_offset" != "$current_offset" ]; then + echo -e "FAILED to set timezone to $1. Expected GMT offset: $desired_offset, but got: $current_offset" + return 1 + else + echo "Set timezone to $current_offset" + return 0 + fi } set_timestamp() { @@ -46,9 +59,11 @@ while getopts ":t:T:h" opt; do case ${opt} in t) # Option -t (timezone) set_timezone "$OPTARG" + [ $? -eq 1 ] && exit 1 ;; T) # Option -t (timestamp) set_timestamp "$OPTARG" + [ $? -eq 1 ] && exit 1 || exit 0 ;; h) # Option -h (help) echo -e "$help" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 5bf0574..36d18b5 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -20,6 +20,15 @@ if grep -qE '^first_boot=true' /etc/femto.conf; then fi exit_script() { + if [[ -n "$partial_failure" ]]; then + log_message "\033[0;31mPartial failure in usb-config-tool...\033[0m" + for _ in {1..2}; do #boot code + blink "1" && sleep 0.5 + done + for _ in {1..2}; do #boot code + blink "0.25" && sleep 0.5 + done + fi if [ ! -z "$usb_path" ]; then #if usb path is populated if ! df -T /mnt/usb 2>/dev/null | grep -qw 'ntfs'; then log_message "USB configuration script complete. Copying femtofox-config.log to USB drive." @@ -130,8 +139,9 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_private_key) meshtastic_private_key=$(escape_sed "$value") ;; meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;; dont_run_if_log_exists) dont_run_if_log_exists=$(escape_sed "$value") ;; + software_install) software_install=$(escape_sed "$value") ;; esac - done < <(grep -E '^(act_led|wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|meshtastic_admin_key|dont_run_if_log_exists)=' "$usb_config") + done < <(grep -E '^(act_led|wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|meshtastic_admin_key|dont_run_if_log_exists|software_install)=' "$usb_config") # Check if the log exits and if the dont_run_if_log_exists line is set in the script if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then @@ -173,6 +183,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then found_config="true" update_wifi="true" fi + + if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi + log_message "Making changes to wifi settings and restarting wifi." + wifi_command="$wifi_command -r" + eval $wifi_command 2>&1 | tee -a /tmp/femtofox-config.log + log_message "wpa_supplicant.conf updated and wifi restarted. Enabling Meshtastic wifi setting." + fi #get meshtastic_lora_radio model, if specified, and copy appropriate yaml to /etc/meshtasticd/config.d/ if [[ -n "$meshtastic_lora_radio" ]]; then @@ -214,12 +231,18 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then radio="none" ;; *) - log_message "Invalid LoRa radio name: $meshtastic_lora_radio, ignoring." + log_message "\033[0;31mInvalid LoRa radio name: $meshtastic_lora_radio, ignoring.\033[0m" + partial_failure=true ;; esac if [[ -n "$radio" ]]; then # if a radio was found femto-meshtasticd-config.sh -l "$radio" -s 2>&1 | tee -a /tmp/femtofox-config.log # set the radio and restart the service - log_message "Set LoRa radio to $meshtastic_lora_radio, restarting Meshtasticd." + if [ $? -eq 0 ]; then + log_message "Set LoRa radio to $meshtastic_lora_radio, restarting Meshtasticd." + else + log_message "\033[0;31mSeting LoRa radio to $meshtastic_lora_radio FAILED, restarting Meshtasticd.\033[0m" | tee -a /tmp/femtofox-config.log + partial_failure=true + fi fi fi @@ -227,6 +250,10 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then timezone=$(echo "$timezone" | sed 's/\\//g') log_message "Updating system timezone to $timezone." femto-set-time.sh -t "$timezone" + if [ $? -eq 1 ]; then + partial_failure=true + log_message "\033[0;31mSeting timezone to $timezone FAILED.\033[0m" | tee -a /tmp/femtofox-config.log + fi found_config="true" fi @@ -274,25 +301,54 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then while IFS='=' read -r key value; do log_message "Meshtastic CLI command found." femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log + if [ $? -eq 1 ]; then + partial_failure=true + log_message "\033[0;31mMeshtastic CLI command \`meshtastic --host $value\` FAILED.\033[0m" | tee -a /tmp/femtofox-config.log + fi found_config=true done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/') - if [ "$found_config" = true ]; then #if we found a config file containing valid data - if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi - log_message "Making changes to wifi settings and restarting wifi." - wifi_command="$wifi_command -r" - eval $wifi_command 2>&1 | tee -a /tmp/femtofox-config.log - log_message "wpa_supplicant.conf updated and wifi restarted. Enabling Meshtastic wifi setting." + # install software packages from software_install= + package_dir="/usr/local/bin/packages" + IFS=',' read -ra packages <<< "$software_install" + for package in "${packages[@]}"; do + if [[ -f "/usr/local/bin/packages/${package}.sh" ]]; then + found_config=true + log_message "Installing $($package_dir/${package}.sh -N) in non-interactive mode..." | tee -a /tmp/femtofox-config.log + set -o pipefail + $package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log + exit_status=$? + set +o pipefail + if [ $exit_status -eq 0 ]; then + log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m" + else + log_message "\033[0;31mInstallation of $($package_dir/${package}.sh -N) unsuccessful!\033[0m" + partial_failure=true + fi + else + log_message "\033[0;31mSoftware package $package_dir/${package}.sh does not exist, ignoring...\033[0m" + partial_failure=true fi + done + + if [ "$found_config" = true ]; then #if we found a config file containing valid data if [ "$meshtastic_url" != "" ]; then log_message "Connecting to Meshtastic radio and submitting $meshtastic_url" femto-meshtasticd-config.sh -q "$meshtastic_url" 2>&1 | tee -a /tmp/femtofox-config.log + if [ $? -eq 1 ]; then + partial_failure=true + log_message "\033[0;31mSetting Meshtastic URL to $meshtastic_url FAILED.\033[0m" | tee -a /tmp/femtofox-config.log + fi fi if [ "$meshtastic_security_command" != "femto-meshtasticd-config.sh" ]; then log_message "Connecting to Meshtastic radio and submitting $meshtastic_security_command" eval "$meshtastic_security_command" 2>&1 | tee -a /tmp/femtofox-config.log + if [ $? -eq 1 ]; then + partial_failure=true + log_message "\033[0;31mSetting Meshtastic security settings FAILED.\033[0m" | tee -a /tmp/femtofox-config.log + fi fi for _ in {1..10}; do #do our successful config boot code From 119b4ef03965b56c630b4a4410d3e70ab89a6610 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 16:16:07 +0200 Subject: [PATCH 117/149] Update femtofox-config.txt --- assets/femtofox-config.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 4eab8f9..fc3e24d 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -19,8 +19,8 @@ #act_led="disable" ### Software control -## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages -## Multiple packages can be installed by separating them with commas +## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages. Multiple packages can be installed by separating them with commas. +## Some software (such as Samba) normally requires user interaction to complete. In this case, a message will display on serial console and in the USB config log warning that you will need to run the "initialization" option in the software menu for that package. Internet connectivity is required for software installation. #software_install="packageA,packageB" ### Meshtastic settings From 3fe798408282f28dad39872434f83c02081184e7 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 16:36:55 +0200 Subject: [PATCH 118/149] Update femtofox-config.txt --- assets/femtofox-config.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index fc3e24d..90b1b92 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -18,9 +18,9 @@ ## Options are "enable" and "disable" #act_led="disable" -### Software control -## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages. Multiple packages can be installed by separating them with commas. -## Some software (such as Samba) normally requires user interaction to complete. In this case, a message will display on serial console and in the USB config log warning that you will need to run the "initialization" option in the software menu for that package. Internet connectivity is required for software installation. +### Software installation +## Software package names are filenames (without .sh suffix) in /usr/local/bin/packages +## Multiple packages can be installed by separating them with commas #software_install="packageA,packageB" ### Meshtastic settings From 94ae7aaa1bcd4080fe8703d0e0e0f84f780110ba Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 16:41:17 +0200 Subject: [PATCH 119/149] Update femto-usb-config-tool.sh --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 36d18b5..560a135 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -14,7 +14,7 @@ log_message() { echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log } -if grep -qE '^first_boot=true' /etc/femto.conf; then +if systemctl is-enabled femto-runonce &>/dev/null; then log_message "First boot, skipping USB Configuration Tool." exit 0 fi From dd420e146e7e191ea7c44e75c3f46070ea4cc39d Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 19:16:12 +0200 Subject: [PATCH 120/149] Add retry to usb-config-tool software installation Will retry up to 5 times --- .../usr/local/bin/femto-usb-config-tool.sh | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 560a135..c9c8cc1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -310,18 +310,26 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then # install software packages from software_install= package_dir="/usr/local/bin/packages" + export HOME=/root IFS=',' read -ra packages <<< "$software_install" for package in "${packages[@]}"; do if [[ -f "/usr/local/bin/packages/${package}.sh" ]]; then found_config=true log_message "Installing $($package_dir/${package}.sh -N) in non-interactive mode..." | tee -a /tmp/femtofox-config.log - set -o pipefail - $package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log - exit_status=$? - set +o pipefail - if [ $exit_status -eq 0 ]; then - log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m" - else + for i in {1..5}; do + set -o pipefail + $package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log + last_install_attempt_state=${PIPESTATUS[0]} + set +o pipefail + if [ $last_install_attempt_state -eq 0 ]; then + log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m" + break + fi + [ $i = 5 ] && log_message "Installation failed... Is internet connected?" && break + log_message "Installation failed ($((i+1))/5). Retrying..." + sleep 4 + done + if [ $last_install_attempt_state -ne 0 ]; then log_message "\033[0;31mInstallation of $($package_dir/${package}.sh -N) unsuccessful!\033[0m" partial_failure=true fi From b04080efb57291a4b4498b16352d7a2232e4231b Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 19:17:00 +0200 Subject: [PATCH 121/149] Prevent Boot Complete LED boot code until USB-config is done --- .../etc/systemd/system/femto-boot-complete.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service index 85e6d55..2e47bf2 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-boot-complete.service @@ -1,7 +1,7 @@ [Unit] Description=Boot Complete DefaultDependencies=no -After=multi-user.target +After=multi-user.target femto-usb-config-tool.service [Service] ExecStart=/usr/local/bin/femto-boot-complete.sh From e74b48af6b681770ea3347e9b963d45fb2153ebf Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 26 Feb 2025 20:07:15 +0200 Subject: [PATCH 122/149] Increment foxbuntu version --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release | 2 +- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 4 ++-- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release index 3f697f5..f2aa180 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release @@ -1,6 +1,6 @@ major=1 minor=0 patch=0 -hotfix= +hotfix=RC3 # major, minor and patch must be numbers and populated. hotfix must be letters and can be blank. diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index d38262a..0968a57 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -109,11 +109,11 @@ log_message "Enabling meshtasticd service" systemctl enable meshtasticd #generate SSH keys -log_message "Generating new SSH encryption keys. This can take a couple minutes..." +log_message "Generating new SSH encryption keys. This can take a few minutes..." femto-utils.sh -E #generate ttyd SSL keys -log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." +log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a few minutes..." /usr/local/bin/packages/ttyd.sh -k log_message "Enabling Web Terminal (ttyd) service..." systemctl enable ttyd diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index ad3fe08..ad38079 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -284,7 +284,7 @@ while getopts ":harsl:ipcnoSEC:R:v" opt; do replace_colors "$OPTARG" ;; v) # get foxbuntu version) - echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" + echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K\S+' /etc/foxbuntu-release)" ;; \?) # Unknown argument) echo -e "Unknown argument $1.\n$help" From 81309bf271e28cb35cd751330a2e54bedda133ea Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 27 Feb 2025 13:34:45 +0200 Subject: [PATCH 123/149] Minor fix for system info > OS info --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index ad38079..2a0cb78 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -92,10 +92,11 @@ Mnted drives:$mounted_drives" } os_info() { - local os_version="Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) ($(lsb_release -d | awk -F'\t' '{print $2}') $(lsb_release -c | awk -F'\t' '{print $2}'))" + local os_version="$(femto-utils.sh -v) ($(lsb_release -d | awk -F'\t' '{print $2}') $(lsb_release -c | awk -F'\t' '{print $2}'))" local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')" local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)" local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")" + local kernel_modules_blacklist="$(femto-kernel-modules.sh -y | sed 's/\x1B\[[0-9;]*m//g')" #remove underline local ttyd_enabled="$(femto-utils.sh -C "ttyd")" local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')" local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output @@ -107,6 +108,7 @@ Uptime:$system_uptime\n\ System time:$(date)\n\ K mods active:$kernel_active_modules\n\ K boot mods:$kernel_boot_modules\n\ +K mod blcklst: $kernel_modules_blacklist Web terminal:$ttyd_enabled\n\ Logging:$logging_enabled\n\ Activity LED:$act_led" From 97ba36396b8092a449131508788cb08568b2b683 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 1 Mar 2025 23:56:44 +0200 Subject: [PATCH 124/149] Add Tun --- .../kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig b/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig index 2b34fc4..5d91701 100644 --- a/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig +++ b/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig @@ -1326,6 +1326,8 @@ CONFIG_SCSI_LOWLEVEL=y # CONFIG_SCSI_MPT2SAS is not set # CONFIG_SCSI_SMARTPQI is not set CONFIG_SCSI_UFSHCD=y +CONFIG_NETDEVICES=y +CONFIG_TUN=m # CONFIG_SCSI_UFSHCD_PCI is not set # CONFIG_SCSI_UFSHCD_PLATFORM is not set # CONFIG_SCSI_UFS_BSG is not set From f5a903cfe6e8ccf7aedffe3c2e95a5bffc014458 Mon Sep 17 00:00:00 2001 From: Ruledo Date: Mon, 3 Mar 2025 00:16:12 -0800 Subject: [PATCH 125/149] Foxbuntu Build Script Documentation This is how we build the releases. --- environment-setup/Foxbuntu SDK.pdf | Bin 0 -> 293887 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 environment-setup/Foxbuntu SDK.pdf diff --git a/environment-setup/Foxbuntu SDK.pdf b/environment-setup/Foxbuntu SDK.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bbdea6cc61b6d09fcfc1cea7fb8ec652ac238fec GIT binary patch literal 293887 zcmb@tWl)^Wx9%MX7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Kgz<;zi;6IWDW(qM0o~LgU=i2aqRmu<1>s3(Ic6*-58{V0$*&Nu$i6Yy5t*B64P~RxDib+3lzALGftATOVlY3h5~w!C zF^_p4^RWuJlV!1tRV;I_$UL0OY{>7!qvVq)-^jPiDA@;v5| zaLZ0M(%}E3{y+hc%{5Y^JeL~WCd*^BntcDdW(1@ zq%GD9=rDek&yjZdd}x$CBs0iT86z~xRniNNk&J)nC?ag8alub(L>K6Czqp_#o8!`k z=K-zIvmh>LjC(LNTBGQFz<<0h_qu@1p*$VYP4q0%0__)sr;JxR=57`=7v&=jY)g8E zImqS_*(Y^?-*%O;7?nL?3ozFdb07$r8hNYEUcE0YfaCz1{f-vy%mfcRK+1QH%c)~Ean3lX-6N(0(2TDM3R@QJjK zASO537{9W7ub}}kd5xI7ina{08!#s64|mpNBj8S20~nZ}Me>n;Z>h%>30YIjMh2z& z5|tXwLrVw8@t9sejcY49muQ`#GaYij56U;HD=Y4`YYNEWn3k}NUzjcCcDx*Jz$gxf*25Ed}nQVuYYlS^Hp>7Dj#Vr*{k zVFx`+-Y-!WJr|Ia%rt5u0)f ze#ePr@hqKbL^ZN6s6Nsaep`%U6T14SHzfpSkUj+KO8cT6oz5Ft-tqBQqW&;OF#@+Z zXciaq(7qutVe}Q1+y}-&i7lW|y8lJ{DcxgZ42N2*i|=uyjZpj&&)@-`$~qon#E)Z) zc#Ei`T=K;r9;oid7>aBmA53&D-&C02Klh28{G?W`GP>oC#?O7>d&!Khd3l8?L6m-@ mPk$d6J}55*$MNd-!v%%?^9!$jTZzU_pqZqmO|v?8O!^O}k@=qh literal 0 HcmV?d00001 From 8e4895320e512c2df722a266e9ce64a0ff61d54d Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 3 Mar 2025 19:30:46 +0200 Subject: [PATCH 126/149] Add meshtastic i2c support to menus. --- .../usr/local/bin/femto-config | 40 ++++++++++++++++--- .../usr/local/bin/femto-meshtasticd-config.sh | 23 ++++++++++- .../usr/local/bin/femto-usb-config-tool.sh | 12 +++++- 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 8fcc0da..be51088 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -433,10 +433,11 @@ meshtastic_settings() { 4 "Security settings" "" \ 5 "Mesh connectivity test" "" \ 6 "Manage Meshtasticd service" "" \ - 7 "Upgrade/install Meshtasticd" "" \ - 8 "Uninstall Meshtasticd" "" \ + 7 "Enable/disable i2c devices" "" \ + 8 "Upgrade/install Meshtasticd" "" \ + 9 "Uninstall Meshtasticd" "" \ " " "" "" \ - 9 "Back to main menu" "" 3>&1 1>&2 2>&3) + 10 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $meshtastic_choice in 1) # view node info) @@ -593,21 +594,48 @@ meshtastic_settings() { esac done ;; - 7) #Upgrade meshtasticd) + 7) #i2c) + choice="" # zero the choice before loading the submenu + while true; do + i2c_state=$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -I check)") + choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtastic i2c" --default-item "$choice" --menu "i2c is used for sensors and displays.\nCurrently \Zu$i2c_state." 12 42 5 \ + $(if echo "$i2c_state" | grep -q 'disabled'; then echo "Enable i2c x"; fi) \ + $(if echo "$i2c_state" | grep -q 'enabled'; then echo "Disable i2c x"; fi) \ + " " "" \ + "Back" "x" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + case $choice in + "Enable i2c") + dialog --no-collapse --colors --title "$title" --yesno "Enable i2c?\n\nEnabling i2c without devices connected will lead to slowdowns and error messages." 9 47 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -I enable + fi + ;; + "Disable i2c") + dialog --no-collapse --colors --title "$title" --yesno "Disable i2c?\n\nDisabling i2c will only apply to Meshtastic, not to Foxbuntu." 9 50 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -I disable + fi + ;; + "Back") break ;; + esac + done + ;; + 8) #Upgrade meshtasticd) dialog --no-collapse --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -z pause fi ;; - 8) #uninstall meshtasticd) + 9) #uninstall meshtasticd) dialog --no-collapse --colors --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed.\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 0 0 if [ $? -eq 0 ]; then femto-meshtasticd-config.sh -x dialog --no-collapse --colors --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`\Zusudo apt purge\Zn\`." 8 40 fi ;; - 9) + 10) return ;; esac diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 1e9c80e..946c72b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -27,6 +27,7 @@ Options are: -t Stop Meshtasticd service -M "enable" Enable/disable Meshtasticd service. Options: "enable" "disable" -S Get Meshtasticd service state +-I "enable" Manage i2c state. Options: "enable" "disable" "check" -z Upgrade Meshtasticd -x Uninstall Meshtasticd -m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m \"--set security.admin_channel_enabled false\" 10 \"Disable legacy admin\"\` @@ -186,7 +187,7 @@ get_meshtastic_settings() { } # Parse options -while getopts ":hiC:gkl:q:uU:rR:aA:cpo:sM:Stwuxm" opt; do +while getopts ":hiC:gkl:q:uU:rR:aA:cpo:sM:StI:wuxm" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -326,6 +327,26 @@ Nodes in db:$metadata_nodedbCount" systemctl stop meshtasticd echo "Meshtasticd service stopped." ;; + I) # Option -I (Manage i2c state. Options: "enable" "disable" "check") + yaml_file="/etc/meshtasticd/config.d/femto_config.yaml" + if [ "$OPTARG" = "enable" ]; then + echo -e "\nI2C:\n I2CDevice: /dev/i2c-3" >> $yaml_file + femto-meshtasticd-config.sh -s + elif [ "$OPTARG" = "disable" ]; then + sed -i '/I2C:/,/I2CDevice: \/dev\/i2c-3/d' $yaml_file + femto-meshtasticd-config.sh -s + elif [ "$OPTARG" = "check" ]; then + if grep -q "I2C:" $yaml_file && grep -q "I2CDevice: /dev/i2c-3" $yaml_file; then + echo -e "\033[0;34menabled\033[0m" + else + echo -e "\033[0;31mdisabled\033[0m" + fi + else + echo "Invalid argument \`-I $OPTARG\`. Options are \`enable\` \`disable\` \`check\`." + echo -e "$help" + exit 1 + fi + ;; z) # Option -z (upgrade meshtasticd) apt update apt install --only-upgrade meshtasticd diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index c9c8cc1..a7792de 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -118,6 +118,8 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then wifi_command="femto-network-config.sh" meshtastic_security_command="femto-meshtasticd-config.sh" dont_run_if_log_exists="" + software_install="" + meshtastic_i2c="" # Escape and read the fields from the USB config file if they exist while IFS='=' read -r key value; do @@ -140,8 +142,9 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_admin_key) meshtastic_admin_key=$(escape_sed "$value") ;; dont_run_if_log_exists) dont_run_if_log_exists=$(escape_sed "$value") ;; software_install) software_install=$(escape_sed "$value") ;; + meshtastic_i2c) meshtastic_i2c=$(escape_sed "$value") ;; esac - done < <(grep -E '^(act_led|wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|meshtastic_admin_key|dont_run_if_log_exists|software_install)=' "$usb_config") + done < <(grep -E '^(act_led|wifi_ssid|wifi_psk|wifi_country|meshtastic_lora_radio|timezone|meshtastic_url|meshtastic_legacy_admin|meshtastic_public_key|meshtastic_private_key|meshtastic_admin_key|dont_run_if_log_exists|software_install|meshtastic_i2c)=' "$usb_config") # Check if the log exits and if the dont_run_if_log_exists line is set in the script if $log_exists && [[ $dont_run_if_log_exists = "true" ]]; then @@ -339,6 +342,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then fi done + if [[ -n "$meshtastic_i2c" ]]; then # set meshtastic i2c state + femto-meshtasticd-config.sh -I $meshtastic_i2c 2>&1 | tee -a /tmp/femtofox-config.log + log_message "Set Meshtastic i2c state to \`$meshtastic_i2c\`." + found_config="true" + fi + + if [ "$found_config" = true ]; then #if we found a config file containing valid data if [ "$meshtastic_url" != "" ]; then From e464fc7507a5a2d8eb540671af3dec6f503368ce Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 3 Mar 2025 19:32:28 +0200 Subject: [PATCH 127/149] Update femtofox-config.txt --- assets/femtofox-config.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 90b1b92..6b337b4 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -57,6 +57,10 @@ #meshtastic_admin_key="XX=" #meshtastic_legacy_admin="false" +## Meshtastic i2c state. +## Enabling i2c without devices connected will lead to slowdowns and error messages. +## Options are "enable" and "disable" +meshtastic_i2c="disable" ### If the following line is uncommented, USB config will be skipped if a log file is present on the USB drive, indicating the tool has already been run on this system #dont_run_if_log_exists From c4a703c172882776b60dd9ba4b0d501a4c69f6ea Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 3 Mar 2025 19:37:22 +0200 Subject: [PATCH 128/149] Update femto-config --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index be51088..ad5e4eb 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -433,7 +433,7 @@ meshtastic_settings() { 4 "Security settings" "" \ 5 "Mesh connectivity test" "" \ 6 "Manage Meshtasticd service" "" \ - 7 "Enable/disable i2c devices" "" \ + 7 "Enable/disable i2c support" "" \ 8 "Upgrade/install Meshtasticd" "" \ 9 "Uninstall Meshtasticd" "" \ " " "" "" \ @@ -598,7 +598,7 @@ meshtastic_settings() { choice="" # zero the choice before loading the submenu while true; do i2c_state=$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -I check)") - choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtastic i2c" --default-item "$choice" --menu "i2c is used for sensors and displays.\nCurrently \Zu$i2c_state." 12 42 5 \ + choice=$(dialog --no-collapse --colors --cancel-label "Back" --title "Meshtastic i2c Support" --default-item "$choice" --menu "i2c is used for sensors and displays.\nCurrently \Zu$i2c_state." 12 42 5 \ $(if echo "$i2c_state" | grep -q 'disabled'; then echo "Enable i2c x"; fi) \ $(if echo "$i2c_state" | grep -q 'enabled'; then echo "Disable i2c x"; fi) \ " " "" \ @@ -606,13 +606,13 @@ meshtastic_settings() { [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $choice in "Enable i2c") - dialog --no-collapse --colors --title "$title" --yesno "Enable i2c?\n\nEnabling i2c without devices connected will lead to slowdowns and error messages." 9 47 + dialog --no-collapse --colors --title "Meshtastic i2c Support" --yesno "Enable i2c?\n\nEnabling i2c without devices connected will lead to slowdowns and error messages." 9 47 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -I enable fi ;; "Disable i2c") - dialog --no-collapse --colors --title "$title" --yesno "Disable i2c?\n\nDisabling i2c will only apply to Meshtastic, not to Foxbuntu." 9 50 + dialog --no-collapse --colors --title "Meshtastic i2c Support" --yesno "Disable i2c?\n\nDisabling i2c will only apply to Meshtastic, not to Foxbuntu." 9 50 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -I disable fi From 242a145bdbcb6e6d647c14dd51fce2802284e617 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 4 Mar 2025 12:44:48 +0200 Subject: [PATCH 129/149] Fix wifi toggle on button press --- .../usr/local/bin/femto-network-config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index f1e5abb..5a11622 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -55,10 +55,10 @@ while getopts ":hx:Ts:p:c:eiwn:tr" opt; do T) # Option -T (toggle wifi state) if [ "$(cat /etc/wifi_state.txt)" == "up" ]; then logger "Toggling wifi off" - femto-network-config.sh -x "up" + femto-network-config.sh -x "down" else logger "Toggling wifi on" - femto-network-config.sh -x "down" + femto-network-config.sh -x "up" fi ;; s) # Option -s (ssid) From 436856abcd88ff8948e37d3ee1b7957f88b6a457 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 20:04:37 +0200 Subject: [PATCH 130/149] Revamp settings menu to take advantage of Control by pdxlocations --- .../usr/local/bin/femto-config | 201 +++++++++--------- .../usr/local/bin/femto-install-wizard.sh | 95 +++++---- 2 files changed, 156 insertions(+), 140 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index ad5e4eb..ca33b5f 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -421,23 +421,92 @@ legacy_admin() { done } +meshtastic_config_url() { + newurl=$(dialog --no-collapse --colors --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nEntering a URL may \Z1\ZuOVERWRITE\Zn your LoRa settings and channels!\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 14 63 3>&1 1>&2 2>&3) + if [ -n "$newurl" ]; then #if a URL was entered + femto-meshtasticd-config.sh -q "$newurl" + fi +} + +set_lora_radio() { + choice="" # zero the choice before loading the submenu + while true; do + echo "Checking LoRa radio..." + #Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -)) + choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \ + "Radio name:" "Configuration:" "" \ + "" "" "" \ + "Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \ + "Ebyte e22-900m22s" "(SX1262_TCXO)" "" \ + "Ebyte e80-900m22s" "(SX1262_XTAL)" "" \ + "Heltec ht-ra62" "(SX1262_TCXO)" "" \ + "Seeed wio-sx1262" "(SX1262_TCXO)" "" \ + "Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \ + "AI Thinker ra-01sh" "(SX1262_XTAL)" "" \ + "LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \ + "Simulated radio" "(none)" "" \ + " " "" "" \ + "Cancel" "" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + local radio="" + case $choice in + "Ebyte e22-900m30s") + radio="sx1262_tcxo" + ;; + "Ebyte e22-900m22s") + radio="sx1262_tcxo" + ;; + "Ebyte e80-900m22s") + radio="sx1262_xtal" + ;; + "Heltec ht-ra62") + radio="sx1262_tcxo" + ;; + "Seeed wio-sx1262") + radio="sx1262_tcxo" + ;; + "Waveshare sx126x-xxxm") + radio="sx1262_xtal" + ;; + "AI Thinker ra-01sh") + radio="femto_sx1262_xtal" + ;; + "LoRa Meshstick 1262") + radio="lora-meshstick-1262" + ;; + "Simulated radio") + radio="none" + ;; + "Cancel") + return + ;; + esac + if [ -n "$radio" ]; then #if a radio was selected + femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd + dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45 + break + fi + done +} + # Function to handle Meshtasticd settings meshtastic_settings() { local title="Meshtastic Settings" while true; do echo "Checking Meshtasticd service state..." - meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 18 50 4 \ + meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 20 50 4 \ 1 "View node info" "" \ - 2 "View configuration URL & QR code" "" \ - 3 "LoRa settings" "" \ - 4 "Security settings" "" \ - 5 "Mesh connectivity test" "" \ - 6 "Manage Meshtasticd service" "" \ - 7 "Enable/disable i2c support" "" \ - 8 "Upgrade/install Meshtasticd" "" \ - 9 "Uninstall Meshtasticd" "" \ + 2 "Set LoRa radio model" "" \ + 3 "View configuration URL & QR code" "" \ + 4 "Set configuration URL" "" \ + 5 "Full Meshtastic settings" "" \ + 6 "Mesh connectivity test" "" \ + 7 "Manage Meshtasticd service" "" \ + 8 "Enable/disable i2c support" "" \ + 9 "Upgrade/install Meshtasticd" "" \ + 10 "Uninstall Meshtasticd" "" \ " " "" "" \ - 10 "Back to main menu" "" 3>&1 1>&2 2>&3) + 11 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $meshtastic_choice in 1) # view node info) @@ -445,94 +514,29 @@ meshtastic_settings() { loading "Getting node info..." dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0 ) - ;; - 2) # get current configuration URL & QR code) + ;; + 2) # Set LoRa radio model) + set_lora_radio + ;; + 3) # get current configuration URL & QR code) check_meshtasticd_running && ( loading "Getting Meshtastic QR code and URL..." femto-meshtasticd-config.sh -g pause ) ;; - 3) # LoRa settings) - femto-meshtasticd-lora-dialogs.sh - ;; - 4) # remote admin) + 4) # Configure automatically with URL) check_meshtasticd_running && ( - choice="" # zero the choice before loading the submenu - while true; do - choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --item-help --menu "" 16 40 5 \ - 1 "View/change public key" "" \ - 2 "View/change private key" "" \ - " " "" "" \ - 3 "View admin keys" "" \ - 4 "Set admin key" "" \ - 5 "Clear admin keys" "" \ - 6 "Legacy admin channel" "" \ - " " "" "" \ - 7 "Return to previous menu" "" 3>&1 1>&2 2>&3) - [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog - case $choice in - 1) # view/change public key) - loading "Getting current public key..." - key=$(femto-meshtasticd-config.sh -u) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - fi - else - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 - fi - ;; - 2) # view/change private key) - loading "Getting current private key..." - key=$(femto-meshtasticd-config.sh -r) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - fi - else - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 - fi - ;; - 3) # view admin keys) - loading "Getting Admin Keys..." - dialog --no-collapse --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -a | tail -n 1 | sed 's/|n/\\n/g')" 0 0 - ;; - 4) # set admin key) - key=$(dialog --no-collapse --title "Admin Keys" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n\n(SHIFT+INS to paste):" 11 40 3>&1 1>&2 2>&3) - if [ -n "$key" ]; then #if a key was entered - loading "Sending command..." - dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 5) # clear admin keys) - dialog --no-collapse --title "Admin Keys" --yesno "Meshtasticd can have up to 3 admin keys. If more are added, they will be ignored.\n\nClear admin key list?\n" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -c && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - ;; - 6) # legacy admin) - legacy_admin - ;; - 7) # return to previous menu) - break - ;; - esac - done + meshtastic_config_url ) ;; - 5) #test mesh connectivity) + 5) # Meshtastic settings) + check_meshtasticd_running && ( + dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nThis can take up to a minute." 6 45 + python /opt/control/main.py --host + ) + ;; + 6) #test mesh connectivity) check_meshtasticd_running && ( dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 if [ $? -eq 0 ]; then #unless cancel/no @@ -541,7 +545,7 @@ meshtastic_settings() { fi ) ;; - 6) #manage meshtasticd service) + 7) #manage meshtasticd service) choice="" # zero the choice before loading the submenu while true; do echo "Checking Meshtasticd service state..." @@ -594,7 +598,7 @@ meshtastic_settings() { esac done ;; - 7) #i2c) + 8) #i2c) choice="" # zero the choice before loading the submenu while true; do i2c_state=$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -I check)") @@ -621,21 +625,21 @@ meshtastic_settings() { esac done ;; - 8) #Upgrade meshtasticd) + 9) #Upgrade meshtasticd) dialog --no-collapse --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -z pause fi ;; - 9) #uninstall meshtasticd) + 10) #uninstall meshtasticd) dialog --no-collapse --colors --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed.\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 0 0 if [ $? -eq 0 ]; then femto-meshtasticd-config.sh -x dialog --no-collapse --colors --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`\Zusudo apt purge\Zn\`." 8 40 fi ;; - 10) + 11) return ;; esac @@ -714,13 +718,16 @@ Options are:\n\ -w Set Wi-Fi config menu\ -c Check if Meshtasticd is running and warn the user if not\ " -while getopts ":hlLwc" opt; do +while getopts ":hluLwc" opt; do case ${opt} in h) # Option -h (help) echo -e $help - ;; + ;; l) # Option -l (set lora radio) - femto-meshtasticd-lora-dialogs.sh # this function has moved + set_lora_radio + ;; + u) # Option -u (set meshtastic URL) + meshtastic_config_url ;; L) # Option -L (Meshtastic legacy admin menu) legacy_admin diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index 8d199ae..037dec2 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -25,55 +25,64 @@ wizard() { dialog --title "Hostname" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40 fi - dialog --title "$title" --cancel-label "Skip" --yesno "Configure Wi-Fi settings?" 6 40 + dialog --title "$title" --yesno "Configure Wi-Fi settings?" 6 40 if [ $? -eq 0 ]; then #unless cancel/no femto-config -w fi - dialog --title "$title" --cancel-label "Skip" --yesno "Configure Meshtastic?" 6 40 + dialog --title "$title" --yesno "Configure Meshtastic?" 6 40 if [ $? -eq 0 ]; then #unless cancel/no - - femto-meshtasticd-lora-dialogs.sh -w - - # public key - loading "Getting current public key..." - key=$(femto-meshtasticd-config.sh -u) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - fi - else - dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 + if femto-config -c; then + while true; do + meshtastic_menu_choice=$(dialog --no-collapse --colors --cancel-label "Continue" --default-item "$meshtastic_menu_choice" --title "Meshtastic Configuration" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")" 16 40 5 \ + 1 "Set LoRa radio model" "" \ + 2 "Set configuration URL" "" \ + 3 "Set private key" "" \ + 4 "Set public key" "" \ + " " "" "" \ + 5 "Full Meshtastic settings menu" "" \ + " " "" "" \ + 6 "Continue" "" 3>&1 1>&2 2>&3) + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + case $meshtastic_menu_choice in + 1) # Set LoRa radio model) + femto-config -l + ;; + 2) # Configure automatically with URL) + femto-config -c && ( + femto-config -u + ) + ;; + 3) # view/change private key) + femto-config -c && ( + key=$(dialog --no-collapse --colors --title "Meshtastic Private Key" --cancel-label "Cancel" --inputbox "The private key of the device, used to create a shared key with a remote device for secure communication.\n\n\Z1This key should be kept confidential.\nSetting an invalid key will lead to unexpected behaviors.\Zn\n\nPrivate key (default: random)" 15 60 3>&1 1>&2 2>&3) + if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic Private Key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ) + ;; + 4) # view/change public key) + femto-config -c && ( + key=$(dialog --no-collapse --colors --title "Meshtastic Public Key" --cancel-label "Cancel" --inputbox "The public key of the device, shared with other nodes on the mesh to allow them to compute a shared secret key for secure communication.\n\n\ZuGenerated automatically\Zn to match private key.\n\n\Z1Don't change this if you don't know what you're doing.\Zn\n\nPublic key (default: generated from private key)" 16 60 3>&1 1>&2 2>&3) + if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no + loading "Sending command..." + dialog --no-collapse --colors --title "Meshtastic Public Key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 + fi + ) + ;; + 5) # Full Meshtastic settings menu) + femto-config -c && ( + dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nThis can take up to a minute." 6 45 + python /opt/control/main.py --host + ) + ;; + 6) # return to previous menu) + break + ;; + esac + done fi - - # private key - loading "Getting current private key..." - key=$(femto-meshtasticd-config.sh -u) - if [ -n "$key" ]; then - dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55 - if [ $? -eq 0 ]; then #unless cancel/no - key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then #unless cancel/no - loading "Sending command..." - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - fi - else - dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0 - fi - - key=$(dialog --title "Meshtastic admin key" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3) - if [ -n "$key" ]; then #if a URL was entered - loading "Sending key..." - dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0 - fi - - femto-config -L # legacy admin menu fi dialog --title "$title" --msgbox "Setup wizard complete!" 6 40 From fc7f1879376dd43a61ebe953ce3db77554cefc1b Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 20:07:56 +0200 Subject: [PATCH 131/149] Add control download to chroot --- environment-setup/femtofox.chroot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 73d2b87..38f06b8 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -48,6 +48,8 @@ wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "brow chmod +x /opt/ttyd/ttyd systemctl enable ttyd +git clone https://github.com/pdxlocations/control.git /opt/control + echo "Setting MOTD..." mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak mv /etc/update-motd.d/60-unminimize /etc/update-motd.d/60-unminimize.bak From 978d58d6491e62eb30f9886c6d6762b745298cd4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 20:26:38 +0200 Subject: [PATCH 132/149] Add control package to software menu --- environment-setup/femtofox.chroot | 1 + .../bin/packages/control_for_meshtastic.sh | 74 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 38f06b8..531d67c 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -48,6 +48,7 @@ wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "brow chmod +x /opt/ttyd/ttyd systemctl enable ttyd +echo "Cloning Control for Meshtastic by pdxlocations" git clone https://github.com/pdxlocations/control.git /opt/control echo "Setting MOTD..." diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh new file mode 100644 index 0000000..37c06c4 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh @@ -0,0 +1,74 @@ +#!/bin/bash +### For package maintainer: +# Fill the following fields and choose the options that are in use by this package +# Populate the install, uninstall and upgrade functions +# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible +# This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini` +# Successful operations should `exit 0`, fails should `exit 1` +# Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` +# Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed + +name="Control for Meshtastic" # software name +author="pdxlocations" # software author - OPTIONAL +description="Control for Meshtastic is a fully-featured Meshtastic configuration tool made for running in console, utilizing Curses.\n\nControl is installed by default on Femtofox and is used for Meshtastic configuration in femto-config. Uninstallation is not recommended." # software description - OPTIONAL (but strongly recommended!) +URL="https://github.com/pdxlocations/control" # software URL. Can contain multiple URLs - OPTIONAL +options="hxiuglNADUOLGTI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +launch="python /opt/control/main.py --host" # command to launch software, if applicable +license="/opt/control/LICENSE" # file to cat to display license +location="/opt/control" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` +license="$location/LICENSE" # file to cat to display license +license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string +conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" + +# install script +install() { + if ! git clone https://github.com/pdxlocations/control.git /opt/control; then + echo "user_message: Git clone failed. Is internet connected?" + exit 1 + fi + pip install -r $location/requirements.txt + chown -R femto $location #give ownership of installation directory to $user + git config --global --add safe.directory $location # prevents git error when updating + echo "user_message: To launch, run \`python $location/main.py --host\`" + exit 0 # should be `exit 1` if operation failed +} + +# uninstall script +uninstall() { + rm -rf $location + echo "Removed \`$location\`." + echo "user_message: All files removed." + exit 0 # should be `exit 1` if operation failed +} + +#upgrade script +upgrade() { + cd $location + if ! git pull; then + echo "user_message: Git pull failed. Is internet connected?" + exit 1 + fi + exit 0 +} + +# Check if already installed. `exit 0` if yes, `exit 1` if no +check() { + #the following works for cloned repos, but not for apt installs + if [ -d "$location" ]; then + #echo "Already installed" + exit 0 + else + #echo "Not installed" + exit 1 + fi +} + +# display license +license() { + echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")" +} + +# parse arguments +source /usr/local/bin/packages/femto_argument_parse.sh "$@" + +exit 0 \ No newline at end of file From f8e2355e798cc183deb9c3e20811fbd2049852a4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 22:36:40 +0200 Subject: [PATCH 133/149] +x for control software package --- .../usr/local/bin/packages/control_for_meshtastic.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh old mode 100644 new mode 100755 From 6c6a7218a8cb74f20edce1980544f5d199ed3f14 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 22:51:23 +0200 Subject: [PATCH 134/149] add pip install of control for meshtastic requirements to chroot --- environment-setup/femtofox.chroot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 531d67c..409ecd1 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -50,6 +50,9 @@ systemctl enable ttyd echo "Cloning Control for Meshtastic by pdxlocations" git clone https://github.com/pdxlocations/control.git /opt/control +pip install -r /opt/control/requirements.txt +chown -R femto /opt/control +git config --global --add safe.directory /opt/control # prevents git error when updating echo "Setting MOTD..." mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak From 7d34cd9b6190f9c5413a6a521d947c227e366006 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 5 Mar 2025 23:58:41 +0200 Subject: [PATCH 135/149] Prevent conflicts between Control for Meshtastic and running BBS applications --- .../usr/local/bin/femto-config | 4 ++- .../usr/local/bin/femto-install-wizard.sh | 4 ++- .../usr/local/bin/femto-utils.sh | 33 ++++++++++++++++++- .../bin/packages/control_for_meshtastic.sh | 6 ++-- .../usr/local/bin/packages/meshing_around.sh | 2 +- .../usr/local/bin/packages/tc2_bbs.sh | 2 +- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index ca33b5f..6ef09fe 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -532,8 +532,10 @@ meshtastic_settings() { ;; 5) # Meshtastic settings) check_meshtasticd_running && ( - dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nThis can take up to a minute." 6 45 + dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50 + femto-utils.sh -A stop python /opt/control/main.py --host + femto-utils.sh -A start ) ;; 6) #test mesh connectivity) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index 037dec2..2d92d35 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -73,8 +73,10 @@ wizard() { ;; 5) # Full Meshtastic settings menu) femto-config -c && ( - dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nThis can take up to a minute." 6 45 + dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50 + femto-utils.sh -A stop python /opt/control/main.py --host + femto-utils.sh -A start ) ;; 6) # return to previous menu) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh index 2a0cb78..0e3af30 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-utils.sh @@ -22,6 +22,7 @@ Options are: -E Generate/overwrite SSH encryption keys -C "service" Check if service is enabled, disabled, running -R "command" Replace colors for dialog menus +-A "stop" Stop/start services that are using the meshtastic API so the Control for Meshtastic settings UI can run without interference. Options: "stop" "start" -v Get Foxbuntu version EOF ) @@ -222,7 +223,7 @@ replace_colors() { echo "$input" } -while getopts ":harsl:ipcnoSEC:R:v" opt; do +while getopts ":harsl:ipcnoSEC:R:A:v" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -285,6 +286,36 @@ while getopts ":harsl:ipcnoSEC:R:v" opt; do R) # replace colors) replace_colors "$OPTARG" ;; + A) # Stop/start services that are using the meshtastic API) + # this code cycles through all the software packages and looks for ones that are installed, conflict with Control and have a service that is enabled. If it finds such a software package, it either stops or starts it, according to $OPTARG + if [[ $OPTARG == "stop" ]]; then + action_text="Stopping" + action="s" + elif [[ $OPTARG == "start" ]]; then + action_text="Starting" + action="r" + else + echo "\`$OPTARG\` is not a valid argument for -A. Options are \"stop\" and \"start\"." + echo -e "$help" + exit 1 + fi + + for file in /usr/local/bin/packages/*.sh; do + filename=$(basename "$file") + + [[ "$filename" == femto_* ]] && continue # Skip files starting with "femto_" + + if sudo "$file" -I; then + if echo "$(sudo "$file" -C)" | grep -q "\"full control\" Meshtastic software"; then + service_state=$(sudo femto-utils.sh -C "$(sudo $file -E)") + if [[ $service_state =~ "enabled" ]] ; then + echo "$action_text $(sudo $file -N) service..." + eval "sudo $file -$action" + fi + fi + fi + done + ;; v) # get foxbuntu version) echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K\S+' /etc/foxbuntu-release)" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh index 37c06c4..0aef37b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh @@ -12,13 +12,13 @@ name="Control for Meshtastic" # software name author="pdxlocations" # software author - OPTIONAL description="Control for Meshtastic is a fully-featured Meshtastic configuration tool made for running in console, utilizing Curses.\n\nControl is installed by default on Femtofox and is used for Meshtastic configuration in femto-config. Uninstallation is not recommended." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/control" # software URL. Can contain multiple URLs - OPTIONAL -options="hxiuglNADUOLGTI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` +options="hxiuglNADUOLGTIC" # script options in use by software package. For example, for a package with no service, exclude `edsrS` launch="python /opt/control/main.py --host" # command to launch software, if applicable license="/opt/control/LICENSE" # file to cat to display license location="/opt/control" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string -conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" +conflicts="\"Full control\" Meshtastic software, such as TC²-BBS and Meshing Around - but only while running." # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script install() { @@ -29,7 +29,7 @@ install() { pip install -r $location/requirements.txt chown -R femto $location #give ownership of installation directory to $user git config --global --add safe.directory $location # prevents git error when updating - echo "user_message: To launch, run \`python $location/main.py --host\`" + echo "user_message: To launch, go to Meshtastic settings. Launching manually may conflict with \`full control\` Meshtastic software such as BBS." exit 0 # should be `exit 1` if operation failed } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 768932f..2dda8ad 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -19,7 +19,7 @@ service_name="mesh_bot" # the name of the service, such as `chrony`. REQUIRED if location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string -conflicts="TC²-BBS, any other \"full control\" style bots" # comma delineated plain-text list of packages with which this package conflicts. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" +conflicts="TC²-BBS, other \"full control\" Meshtastic software, Control (only when running)." # comma delineated plain-text list of packages with which this package conflicts. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script install() { diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 3a479b4..e36a8ea 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -20,7 +20,7 @@ service_name="mesh-bbs" # the name of the service/s, such as `chrony`. REQUIRE location="/opt/TC2-BBS-mesh" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string -conflicts="Meshing Around, other \"full control\" packages" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" +conflicts="Meshing Around, other \"full control\" Meshtastic software, Control (only when running)." # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script install() { From 5120cba1a6df24146654aaab78f9a98067ce43da Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Mar 2025 16:47:59 +0200 Subject: [PATCH 136/149] try prevent daily updates --- environment-setup/femtofox.chroot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 73d2b87..384940d 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -66,6 +66,9 @@ systemctl enable femto-watchclock-dog systemctl disable ttyd # enabled on first boot systemctl disable meshtasticd # enabled on first boot systemctl disable apt-daily.timer +systemctl disable apt-daily-upgrade.timer +systemctl mask apt-daily.service # try prevent daily updates +systemctl mask apt-daily-upgrade.service # try prevent daily updates systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu systemctl disable NetworkManager From 3997de8c87b3d2ed92919cb6d94c0fad7343bd46 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Mar 2025 18:33:01 +0200 Subject: [PATCH 137/149] Fix "run software" command in software menu, re-enable for Contact and Control --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 1 + .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 4 ++-- .../usr/local/bin/packages/contact_client.sh | 3 +-- .../usr/local/bin/packages/control_for_meshtastic.sh | 2 +- .../usr/local/bin/packages/femto_argument_parse.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 6ef09fe..2462f15 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -535,6 +535,7 @@ meshtastic_settings() { dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50 femto-utils.sh -A stop python /opt/control/main.py --host + echo "Restarting conflicting services..." femto-utils.sh -A start ) ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 4e0ac3d..db24206 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -100,8 +100,8 @@ package_menu() { # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) if $package_dir/$1.sh -I; then service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)"); fi # Removed from menu list until can be fixed - contact does not launch. When returned to list, should be first entry - # $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ menu_list="\ + $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ @@ -128,7 +128,7 @@ package_menu() { else # execute the actual commands case $choice in - "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; + "Run software") eval "$package_dir/$1.sh -l" ;; "Install") install $1 ;; "Uninstall") uninstall $1 ;; "Initialize") initialize $1 ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 1587e6b..19ee651 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -9,13 +9,12 @@ # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` # Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed - name="Contact" # software name author="pdxlocations" # software author - OPTIONAL description="A Text-Based Console UI for Meshtastic Nodes. Formerly called Curses Client.\nAfter install, run \`contact\` to launch." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/contact/" # software URL. Can contain multiple URLs - OPTIONAL options="xiuglNADUOLGTCI" # script options in use by software package. For example, for a package with no service, exclude `edsrS` -launch="python /opt/contact/main.py --host" # command to launch software, if applicable +launch="echo \"Stopping conflicting services (if any), will restart after exit...\" && sudo femto-utils.sh -A stop && sudo -u ${SUDO_USER:-$(whoami)} env LANG=$LANG TERM=$TERM NCURSES_NO_UTF8_ACS=$NCURSES_NO_UTF8_ACS python /opt/contact/main.py --host && echo \"Restarting conflicting services (if any)...\" && sudo femto-utils.sh -A start" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/contact" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh index 0aef37b..0272b95 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/control_for_meshtastic.sh @@ -13,7 +13,7 @@ author="pdxlocations" # software author - OPTIONAL description="Control for Meshtastic is a fully-featured Meshtastic configuration tool made for running in console, utilizing Curses.\n\nControl is installed by default on Femtofox and is used for Meshtastic configuration in femto-config. Uninstallation is not recommended." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/control" # software URL. Can contain multiple URLs - OPTIONAL options="hxiuglNADUOLGTIC" # script options in use by software package. For example, for a package with no service, exclude `edsrS` -launch="python /opt/control/main.py --host" # command to launch software, if applicable +launch="echo \"Stopping conflicting services (if any), will restart after exit...\" && sudo femto-utils.sh -A stop && sudo -u ${SUDO_USER:-$(whoami)} env LANG=$LANG TERM=$TERM NCURSES_NO_UTF8_ACS=$NCURSES_NO_UTF8_ACS python /opt/control/main.py --host && echo \"Restarting conflicting services (if any)...\" && sudo femto-utils.sh -A start" # command to launch software, if applicable license="/opt/control/LICENSE" # file to cat to display license location="/opt/control" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh index 4ff9a22..a79d5d9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/femto_argument_parse.sh @@ -76,7 +76,7 @@ while getopts ":$options" opt; do ;; l) # Option -l (Run software) echo "Launching $name..." - sudo -u ${SUDO_USER:-$(whoami)} $launch + eval "$launch" ;; N) echo -e $name ;; A) echo -e $author ;; From 6b3245b5546407f76ffb55a910ab68519f726f7c Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 8 Mar 2025 18:33:40 +0200 Subject: [PATCH 138/149] Update contact_client.sh --- .../usr/local/bin/packages/contact_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 19ee651..4add3fd 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -19,7 +19,7 @@ service_name="" # the name of the service/s, such as `chrony`. REQUIRED if ser location="/opt/contact" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` license="$location/LICENSE" # file to cat to display license license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string. -conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" +conflicts="\"Full control\" Meshtastic software, such as TC²-BBS and Meshing Around - but only while running." # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" if [ $# -eq 0 ]; then From 253d10b8bf6117414b6da57ee8bf3d78d11b5f31 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 13 Mar 2025 15:43:41 +0100 Subject: [PATCH 139/149] fix tindie 404 link in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41dd90d..27b1d63 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo - [Installation guide](https://github.com/femtofox/femtofox/wiki/Getting-Started) - How to order - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) - - [Tindie (UK)](https://www.tindie.com/products/edit/femtofox-pro-v1-kit-linux-meshtastic-node/) + - [Tindie (UK)](https://www.tindie.com/products/nomdetom/femtofox-pro-v1-kit-linux-meshtastic-node/) - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) - [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) - [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) From 357d6fe77aec0205021adae45be23692fbdb4419 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Mar 2025 17:14:01 +0200 Subject: [PATCH 140/149] Fix software install/upgrade exit status false reports --- .../usr/local/bin/femto-software.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index db24206..5abda29 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -9,8 +9,9 @@ install() { echo "Installing $($package_dir/$1.sh -N)..." # Run the installation script, capturing the output and displaying it in real time - output=$($package_dir/$1.sh -i | tee /dev/tty) - install_status=$? # Capture the exit status of the eval command + output="$($package_dir/$1.sh -i 2>&1 | tee /dev/tty)" + install_status=$([[ "$output" == *"failed"* ]] && echo 1 || echo 0) + # Capture the exit status of the eval command if [ ${#output} -gt 2048 ]; then # Truncate to 2048 characters and append ellipsis and note if necessary truncated_output="${output:0:2000}...\nLOG TRUNCATED" if [[ "$output" =~ user_message: ]]; then # preserve user_message by adding to end of string @@ -21,6 +22,8 @@ install() { user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output + echo $install_status + if [ $install_status -eq 0 ]; then # if the installation was successful dialog --no-collapse --colors --title "$title" --beep --msgbox "\ZuInstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks else @@ -60,8 +63,8 @@ upgrade() { dialog --no-collapse --title "Upgrade $($package_dir/$1.sh -N)" --yesno "\nUpgrade requires internet connectivity.\n\nUpgrade $($package_dir/$1.sh -N)?" 10 40 [ $? -eq 1 ] && return 1 #if cancel/no echo "Upgrading $($package_dir/$1.sh -N)..." - output=$(eval "$package_dir/$1.sh -g 2>&1 | tee /dev/tty") - install_status=$? # Capture the exit status of the eval command + output="$($package_dir/$1.sh -g 2>&1 | tee /dev/tty)" + install_status=$([[ "$output" == *"failed"* ]] && echo 1 || echo 0) user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output if [ $install_status -eq 0 ]; then # if the installation was successful @@ -78,7 +81,7 @@ package_intro() { # check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog dialog --no-collapse --colors --title "$title" --yes-label "Continue" --no-label "Back" --yesno "\ $($package_dir/$1.sh -N)\n\ - $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ +$(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ $(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ From 673cd7e2687677886b28d5c5236f703039825cac Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Mar 2025 17:17:27 +0200 Subject: [PATCH 141/149] Fix meshtastic install/upgrade in menus --- .../usr/local/bin/femto-meshtasticd-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 946c72b..59b1819 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -187,7 +187,7 @@ get_meshtastic_settings() { } # Parse options -while getopts ":hiC:gkl:q:uU:rR:aA:cpo:sM:StI:wuxm" opt; do +while getopts ":hiC:gkl:q:uU:rR:aA:cpo:sM:StI:wuzxm" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" From a4b8ba374d653fcf237fd349b3c32165988196b7 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 14 Mar 2025 18:08:10 +0200 Subject: [PATCH 142/149] Increment foxbuntu release --- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release index f2aa180..3f697f5 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/foxbuntu-release @@ -1,6 +1,6 @@ major=1 minor=0 patch=0 -hotfix=RC3 +hotfix= # major, minor and patch must be numbers and populated. hotfix must be letters and can be blank. From 6c3b0da71f9eb0537ff6509ea4b0d159893e9c02 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Sat, 15 Mar 2025 00:35:04 +0000 Subject: [PATCH 143/149] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 27b1d63..5445dde 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo - How to order - [Etsy (USA)](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) - [Tindie (UK)](https://www.tindie.com/products/nomdetom/femtofox-pro-v1-kit-linux-meshtastic-node/) + - [Etsy (UK)](https://www.etsy.com/uk/listing/1866094154/femtofox-pro-v1-kit-linux-meshtastic) - [DIY instructions](https://github.com/femtofox/Femtofox_Community_Hardware) - [USB configuration tool](https://github.com/femtofox/femtofox/wiki/USB-Configuration-Tool) - [Building your own Foxbuntu image](https://github.com/femtofox/femtofox/wiki/Building-Foxbuntu-%28WSL%29) From 2b1ffd0d9049d39a27ae78f83d787c77271468f4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sat, 15 Mar 2025 19:51:40 +0200 Subject: [PATCH 144/149] Prettify runounce output --- .../usr/local/bin/femto-runonce.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 0968a57..2dd10c9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -53,7 +53,7 @@ log_message "Resizing filesystem..." resize2fs /dev/mmcblk1p5 resize2fs /dev/mmcblk1p6 resize2fs /dev/mmcblk1p7 -log_message "Resizing filesystem complete" +log_message "Resizing filesystem complete." # allocate swap file if [ ! -f /swapfile ]; then # check if swap file already exists @@ -65,21 +65,21 @@ if [ ! -f /swapfile ]; then # check if swap file already exists echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null log_message "Swap file allocated." else - log_message "Swap file already allocated, skipping" + log_message "Swap file already allocated, skipping..." fi # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" file="/etc/network/interfaces" if ! grep -q " hwaddress ether $mac" "$file"; then - log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)" + log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)..." awk -v mac="$mac" ' { print } /allow-hotplug eth0/ { count=5 } count && --count == 0 { print " hwaddress ether " mac } ' "$file" > "$file.tmp" && mv "$file.tmp" "$file" else - log_message "eth0 mac address already set in /etc/network/interfaces, skipping" + log_message "eth0 mac address already set in /etc/network/interfaces, skipping..." fi # Add term stuff to .bashrc @@ -87,25 +87,25 @@ lines="export NCURSES_NO_UTF8_ACS=1 export TERM=xterm-256color export LANG=C.UTF-8" if ! grep -Fxq "$lines" /home/femto/.bashrc; then # Check if the lines are already in .bashrc + log_message "Adding TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc..." echo "$lines" >> /home/femto/.bashrc - log_message "Added TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc" else - log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" + log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping..." fi # Fix Compiler +log_message "Adding compiler support..." cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a -log_message "Added compiler support" # Add a cheeky alias to .bash_aliases if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc log_message "Added \`alias sfc='sudo femto-config'\` to .bashrc" else - log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping" + log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping..." fi -log_message "Enabling meshtasticd service" +log_message "Enabling meshtasticd service..." systemctl enable meshtasticd #generate SSH keys From ccdb98a1136ee2a12bcd0159fc89c6a5247c598c Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Mon, 24 Mar 2025 00:35:38 +0000 Subject: [PATCH 145/149] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5445dde..5835d9f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ + + # Femtofox    The tiny, low power Linux Meshtastic node +###          [Click here for the Femtofox store](https://www.etsy.com/listing/1861858340/femtofox-pro-v1-kit-compact-arm-linux) + **Femtofox is a Linux-based mesh development platform - a Raspberry Pi sized computer with onboard LoRa radio, capable of being run with only 0.3w, making it *ideal* for solar powered nodes.** The Luckfox Pico Mini is the postage stamp sized heart of the Femtofox - a compact and power efficient Linux board, running Foxbuntu, our own customized version of Ubuntu. Femtofox is an expansion of the Luckfox's capabilities, utilizing a custom PCB with a 30db LoRa radio (over 6x the transmit power of a RAK Wisblock or Heltec V3) to create a power efficient, tiny and highly capable Meshtastic Linux node. From 419f203f57b3b5b3444859d1bf4aeccdcdd985e4 Mon Sep 17 00:00:00 2001 From: Jeremy Asher Date: Fri, 18 Apr 2025 11:21:40 -0700 Subject: [PATCH 146/149] add tun module dependency This adds `NET_CORE` which is a dependency for `TUN`. --- .../configs/luckfox_rv1106_linux_defconfig | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig b/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig index 5d91701..2c77d1b 100644 --- a/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig +++ b/foxbuntu/sysdrv/source/kernel/arch/arm/configs/luckfox_rv1106_linux_defconfig @@ -1326,8 +1326,6 @@ CONFIG_SCSI_LOWLEVEL=y # CONFIG_SCSI_MPT2SAS is not set # CONFIG_SCSI_SMARTPQI is not set CONFIG_SCSI_UFSHCD=y -CONFIG_NETDEVICES=y -CONFIG_TUN=m # CONFIG_SCSI_UFSHCD_PCI is not set # CONFIG_SCSI_UFSHCD_PLATFORM is not set # CONFIG_SCSI_UFS_BSG is not set @@ -1370,7 +1368,25 @@ CONFIG_TUN=m CONFIG_NETDEVICES=y CONFIG_MII=y -# CONFIG_NET_CORE is not set +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_WIREGUARD is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_FC is not set +# CONFIG_NET_TEAM is not set +# CONFIG_MACVLAN is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_GENEVE is not set +# CONFIG_BAREUDP is not set +# CONFIG_GTP is not set +# CONFIG_MACSEC is not set +# CONFIG_NETCONSOLE is not set +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +# CONFIG_VETH is not set +# CONFIG_NLMON is not set # CONFIG_ARCNET is not set # @@ -2988,6 +3004,7 @@ CONFIG_VIDEO_RK_IRCUT=y # CONFIG_VIDEO_VS6624 is not set # CONFIG_VIDEO_MIS2031 is not set # CONFIG_VIDEO_MIS4001 is not set +# CONFIG_VIDEO_MIS5001 is not set # CONFIG_VIDEO_MT9M001 is not set # CONFIG_VIDEO_MT9M032 is not set # CONFIG_VIDEO_MT9M111 is not set From 2a3f96ed70a5d1289bfcd63e67884d2808460403 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 25 Apr 2025 16:00:02 +0300 Subject: [PATCH 147/149] Add avahi-daemon toggle to networking menu --- .../usr/local/bin/femto-config | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 2462f15..d196e05 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -122,8 +122,9 @@ networking_settings() { 6 "Set hostname" "" \ 7 "Test internet connection" "" \ 8 "Manage Meshtastic wifi sync" "" \ + 9 "Manage Avahi-Daemon service" "" \ " " "" "" \ - 9 "Back to main menu" "" 3>&1 1>&2 2>&3) + 10 "Back to main menu" "" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case $networking_choice in 1) # Turn Wi-Fi on/off) @@ -235,6 +236,68 @@ networking_settings() { done ;; 9) + choice="" # zero the choice before loading the submenu + while true; do + local name="avahi-daemon" + echo "Checking $name service state..." + local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "$name")")" + choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "$name Service" --default-item "$choice" --menu "Avahi-Daemon service is $service_state" 16 60 5 \ + "View detailed service status" "x" \ + " " "" \ + "Start/restart service" "x" \ + $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ + " " "" \ + $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ + $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ + " " "" \ + "Back to previous menu" "x" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "$name service help" --msgbox "The $name service advertises the Meshtastic node on the local LAN, allowing the Android app to detect it. Without Avahi, you will need to manually enter the Femtofox's IP address in the app to connect.\n" 0 0 + else + case $choice in + "View detailed service status") + echo "Getting $name service status..." + dialog --no-collapse --title "$name service status" --msgbox "$(systemctl status $name)" 0 0 + ;; + "Start/restart service") + dialog --no-collapse --title "$title" --yesno "Start/restart $name service?" 7 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl restart $name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart $name\Zn\` command to system.\n\n$name should be running." 10 60 + fi + ;; + "Stop service") + dialog --no-collapse --colors --title "$title" --yesno "Stop $name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\n$name will automatically restart on boot service if enabled." 11 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl stop $name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop $name\Zn\` command to system.\n\n$name should be stopped." 9 60 + fi + ;; + "Enable service") + dialog --no-collapse --title "$title" --yesno "Enable $name service?" 6 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl enable $name + systemctl start $name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable $name\Zn\` and \`\Zusystemctl start $name\Zn\` commands to system.\n\n$name should be running." 10 60 + fi + ;; + "Disable service") + dialog --no-collapse --colors --title "$title" --yesno "Disable $name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl disable $name + systemctl stop $name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable $name\Zn\` and \`\Zusystemctl stop $name\Zn\` commands to system.\n\n$name should be disabled and stopped." 10 60 + fi + ;; + "Back to previous menu") break ;; + esac + fi + done + ;; + 10) return ;; esac From df8cb489838eb217650ca10c2eb72b895fdd2f99 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 25 Apr 2025 21:06:26 +0300 Subject: [PATCH 148/149] Combined meshtastic wifi sync and avahi daemon service managers into a single function --- .../usr/local/bin/femto-config | 188 +++++++----------- 1 file changed, 68 insertions(+), 120 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index d196e05..64ac042 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -79,6 +79,71 @@ check_meshtasticd_running() { fi } +service_manager() { + choice="" # zero the choice before loading the submenu + while true; do + local service_name=$1 + local readable_name=$2 + local help=$3 + echo "Checking $readable_name service state..." + local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "$service_name")")" + choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "$readable_name Service" --default-item "$choice" --menu "Avahi-Daemon service is $service_state" 16 60 5 \ + "View detailed service status" "x" \ + " " "" \ + "Start/restart service" "x" \ + $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ + " " "" \ + $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ + $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ + " " "" \ + "Back to previous menu" "x" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "$readable_name service help" --msgbox "$3" 0 0 + else + case $choice in + "View detailed service status") + echo "Getting $readable_name service status..." + dialog --no-collapse --title "$readable_name service status" --msgbox "$(systemctl status $service_name)" 0 0 + ;; + "Start/restart service") + dialog --no-collapse --title "$title" --yesno "Start/restart $readable_name service?" 7 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl restart $service_name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart $service_name\Zn\` command to system.\n\n$readable_name should be running." 10 60 + fi + ;; + "Stop service") + dialog --no-collapse --colors --title "$title" --yesno "Stop $readable_name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\n$readable_name will automatically restart on boot service if enabled." 11 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl stop $service_name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop $service_name\Zn\` command to system.\n\n$readable_name should be stopped." 9 60 + fi + ;; + "Enable service") + dialog --no-collapse --title "$title" --yesno "Enable $readable_name service?" 6 45 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl enable $service_name + systemctl start $service_name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable $service_name\Zn\` and \`\Zusystemctl start $service_name\Zn\` commands to system.\n\n$readable_name should be running." 10 60 + fi + ;; + "Disable service") + dialog --no-collapse --colors --title "$title" --yesno "Disable $readable_name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 + if [ $? -eq 0 ]; then #unless cancel/no + systemctl disable $service_name + systemctl stop $service_name + dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable $service_name\Zn\` and \`\Zusystemctl stop $service_name\Zn\` commands to system.\n\n$readable_name should be disabled and stopped." 10 60 + fi + ;; + "Back to previous menu") break ;; + esac + fi + done +} + wifi_config() { local title2="Wi-Fi (wlan0) Settings" local config=$(dialog --no-collapse --title "$title2" --form "↑ ↓ to navigate, [ESC] to cancel." 10 45 0 \ @@ -175,127 +240,10 @@ networking_settings() { dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(femto-utils.sh -R "$(femto-network-config.sh -t)")" 9 40 ;; 8) # Manage Meshtastic wifi sync) - choice="" # zero the choice before loading the submenu - while true; do - echo "Checking Meshtastic wifi sync service state..." - local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "femto-wifi-mesh-control")")" - choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "Meshtastic wifi sync Service" --default-item "$choice" --menu "Meshtastic wifi sync service is $service_state" 16 60 5 \ - "View detailed service status" "x" \ - " " "" \ - "Start/restart service" "x" \ - $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ - " " "" \ - $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ - " " "" \ - "Back to previous menu" "x" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "Meshtastic wifi sync service help" --msgbox "The Meshtastic wifi sync service synchronizes system wifi settings with Meshtastic wifi settings. This allows you to use Meshtastic's remote node administration feature to enable/disable wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n" 0 0 - else - case $choice in - "View detailed service status") - echo "Getting Meshtastic wifi sync service status..." - dialog --no-collapse --title "Meshtastic wifi sync service status" --msgbox "$(systemctl status femto-wifi-mesh-control)" 0 0 - ;; - "Start/restart service") - dialog --no-collapse --title "$title" --yesno "Start/restart Meshtastic wifi sync service?" 7 45 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl restart femto-wifi-mesh-control - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart femto-wifi-mesh-control wifi sync\Zn\` command to system.\n\nMeshtastic wifi sync should be running." 10 60 - fi - ;; - "Stop service") - dialog --no-collapse --colors --title "$title" --yesno "Stop Meshtastic wifi sync service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\nMeshtastic wifi sync will automatically restart on boot service if enabled." 11 50 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl stop femto-wifi-mesh-control - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop femto-wifi-mesh-control\Zn\` command to system.\n\nMeshtastic wifi sync should be stopped." 9 60 - fi - ;; - "Enable service") - dialog --no-collapse --title "$title" --yesno "Enable Meshtastic wifi sync service?" 6 45 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl enable femto-wifi-mesh-control - systemctl start femto-wifi-mesh-control - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable femto-wifi-mesh-control\Zn\` and \`\Zusystemctl start femto-wifi-mesh-control\Zn\` commands to system.\n\nMeshtastic wifi sync should be running." 10 60 - fi - ;; - "Disable service") - dialog --no-collapse --colors --title "$title" --yesno "Disable Meshtastic wifi sync service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl disable femto-wifi-mesh-control - systemctl stop femto-wifi-mesh-control - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable femto-wifi-mesh-control\Zn\` and \`\Zusystemctl stop femto-wifi-mesh-control\Zn\` commands to system.\n\nMeshtastic wifi sync should be disabled and stopped." 10 60 - fi - ;; - "Back to previous menu") break ;; - esac - fi - done + service_manager "femto-wifi-mesh-control" "Meshtastic wifi sync" "The Meshtastic wifi sync service synchronizes system wifi settings with Meshtastic wifi settings. This allows you to use Meshtastic's remote node administration feature to enable/disable wifi.\n\nIn future, this will also allow you to reconfigure SSID and password.\n" ;; - 9) - choice="" # zero the choice before loading the submenu - while true; do - local name="avahi-daemon" - echo "Checking $name service state..." - local service_state="$(femto-utils.sh -R "$(femto-utils.sh -C "$name")")" - choice=$(dialog --no-collapse --colors --help-button --cancel-label "Back" --title "$name Service" --default-item "$choice" --menu "Avahi-Daemon service is $service_state" 16 60 5 \ - "View detailed service status" "x" \ - " " "" \ - "Start/restart service" "x" \ - $(if ! echo "$service_state" | grep -q 'not running'; then echo "Stop service x"; fi) \ - " " "" \ - $(if echo "$service_state" | grep -q 'disabled'; then echo "Enable service x"; fi) \ - $(if echo "$service_state" | grep -q 'enabled'; then echo "Disable service x"; fi) \ - " " "" \ - "Back to previous menu" "x" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "$name service help" --msgbox "The $name service advertises the Meshtastic node on the local LAN, allowing the Android app to detect it. Without Avahi, you will need to manually enter the Femtofox's IP address in the app to connect.\n" 0 0 - else - case $choice in - "View detailed service status") - echo "Getting $name service status..." - dialog --no-collapse --title "$name service status" --msgbox "$(systemctl status $name)" 0 0 - ;; - "Start/restart service") - dialog --no-collapse --title "$title" --yesno "Start/restart $name service?" 7 45 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl restart $name - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl restart $name\Zn\` command to system.\n\n$name should be running." 10 60 - fi - ;; - "Stop service") - dialog --no-collapse --colors --title "$title" --yesno "Stop $name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn.\n\n$name will automatically restart on boot service if enabled." 11 50 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl stop $name - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl stop $name\Zn\` command to system.\n\n$name should be stopped." 9 60 - fi - ;; - "Enable service") - dialog --no-collapse --title "$title" --yesno "Enable $name service?" 6 45 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl enable $name - systemctl start $name - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl enable $name\Zn\` and \`\Zusystemctl start $name\Zn\` commands to system.\n\n$name should be running." 10 60 - fi - ;; - "Disable service") - dialog --no-collapse --colors --title "$title" --yesno "Disable $name service?\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 9 50 - if [ $? -eq 0 ]; then #unless cancel/no - systemctl disable $name - systemctl stop $name - dialog --no-collapse --colors --msgbox "Sent \`\Zusystemctl disable $name\Zn\` and \`\Zusystemctl stop $name\Zn\` commands to system.\n\n$name should be disabled and stopped." 10 60 - fi - ;; - "Back to previous menu") break ;; - esac - fi - done + 9) # Manage avahi) + service_manager "avahi-daemon" "Avahi Daemon" "The Avahi-Daemon service advertises the Meshtastic node on the local LAN (often called a Bonjour service), allowing the Android app to detect it. Without Avahi, you will need to manually enter the Femtofox's IP address in the app to connect.\n" ;; 10) return From 11d6d3deda07dbf6d4b7e5e392c43b031e5fda0d Mon Sep 17 00:00:00 2001 From: Ruledo Date: Wed, 14 May 2025 00:32:15 -0700 Subject: [PATCH 149/149] Update foxbuntu-builder.sh Moved pico repo --- environment-setup/foxbuntu-builder.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-setup/foxbuntu-builder.sh b/environment-setup/foxbuntu-builder.sh index 3cb4063..136b3c0 100644 --- a/environment-setup/foxbuntu-builder.sh +++ b/environment-setup/foxbuntu-builder.sh @@ -57,7 +57,8 @@ clone_repos() { fi } - clone_with_retries "https://github.com/LuckfoxTECH/luckfox-pico.git" || return 1 + #clone_with_retries "https://github.com/LuckfoxTECH/luckfox-pico.git" || return 1 + clone_with_retries "https://github.com/Ruledo/luckfox-pico.git" || return 1 clone_with_retries "https://github.com/femtofox/femtofox.git" || return 1 return 0