diff --git a/.dockerignore b/.dockerignore index fbf97f1..d9654f5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -36,3 +36,8 @@ src/plugins/CarbonChat/users src/plugins/CarbonChat/libraries src/plugins/DiscordSRV/accounts.aof + +src/plugins/BlueMap/data/web/maps +src/plugins/BlueMap/data/logs +src/plugins/BlueMap/data/minecraft-client-1.21.jar +src/plugins/BMMarker/data diff --git a/.gitignore b/.gitignore index fbf97f1..d9654f5 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,8 @@ src/plugins/CarbonChat/users src/plugins/CarbonChat/libraries src/plugins/DiscordSRV/accounts.aof + +src/plugins/BlueMap/data/web/maps +src/plugins/BlueMap/data/logs +src/plugins/BlueMap/data/minecraft-client-1.21.jar +src/plugins/BMMarker/data diff --git a/Dockerfile b/Dockerfile index a2b473c..3a15799 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,31 +9,38 @@ ADD ./src ${CONFIG_PATH} RUN mkdir ${DATA_PATH} +# Add symlinks to Minecraft default files RUN touch ${DATA_PATH}/banned-ips.json && \ - ln -sf ${DATA_PATH}/banned-ips.json ${CONFIG_PATH} -RUN touch ${DATA_PATH}/banned-players.json && \ - ln -sf ${DATA_PATH}/banned-players.json ${CONFIG_PATH} -RUN mkdir ${DATA_PATH}/logs && \ - ln -sf ${DATA_PATH}/logs ${CONFIG_PATH} -RUN touch ${DATA_PATH}/ops.json && \ - ln -sf ${DATA_PATH}/ops.json ${CONFIG_PATH} -RUN touch ${DATA_PATH}/usercache.json && \ - ln -sf ${DATA_PATH}/usercache.json ${CONFIG_PATH} -RUN touch ${DATA_PATH}/whitelist.json && \ - ln -sf ${DATA_PATH}/whitelist.json ${CONFIG_PATH} -RUN mkdir ${DATA_PATH}/world && \ - ln -sf ${DATA_PATH}/world ${CONFIG_PATH} -RUN mkdir ${DATA_PATH}/world_nether && \ - ln -sf ${DATA_PATH}/world_nether ${CONFIG_PATH} -RUN mkdir ${DATA_PATH}/world_the_end && \ - ln -sf ${DATA_PATH}/world_the_end ${CONFIG_PATH} + ln -sf ${DATA_PATH}/banned-ips.json ${CONFIG_PATH} && \ + touch ${DATA_PATH}/banned-players.json && \ + ln -sf ${DATA_PATH}/banned-players.json ${CONFIG_PATH} && \ + mkdir ${DATA_PATH}/logs && \ + ln -sf ${DATA_PATH}/logs ${CONFIG_PATH} && \ + touch ${DATA_PATH}/ops.json && \ + ln -sf ${DATA_PATH}/ops.json ${CONFIG_PATH} && \ + touch ${DATA_PATH}/usercache.json && \ + ln -sf ${DATA_PATH}/usercache.json ${CONFIG_PATH} && \ + touch ${DATA_PATH}/whitelist.json && \ + ln -sf ${DATA_PATH}/whitelist.json ${CONFIG_PATH} && \ + mkdir ${DATA_PATH}/world && \ + ln -sf ${DATA_PATH}/world ${CONFIG_PATH} && \ + mkdir ${DATA_PATH}/world_nether && \ + ln -sf ${DATA_PATH}/world_nether ${CONFIG_PATH} && \ + mkdir ${DATA_PATH}/world_the_end && \ + ln -sf ${DATA_PATH}/world_the_end ${CONFIG_PATH} + +# Add symlinks to PlasmoVoice files RUN touch ${DATA_PATH}/pv-voice_mutes.json && \ ln -sf ${DATA_PATH}/pv-voice_mutes.json \ ${CONFIG_PATH}/plugins/PlasmoVoice/voice_mutes.json + +# Add symlinks to SuperVanish files RUN mkdir -p ${DATA_PATH}/SuperVanish && \ touch ${DATA_PATH}/SuperVanish/data.yml && \ ln -sf ${DATA_PATH}/SuperVanish/data.yml \ ${CONFIG_PATH}/plugins/SuperVanish/data.yml + +# Add symlinks to CarbonChat files RUN mkdir -p ${DATA_PATH}/CarbonChat/users && \ ln -sf ${DATA_PATH}/CarbonChat/users \ ${CONFIG_PATH}/plugins/CarbonChat/users @@ -54,13 +61,24 @@ RUN mkdir -p ${DATA_PATH}/CustomizablePlayerModels && \ ln -sf ${DATA_PATH}/CustomizablePlayerModels/ \ ${CONFIG_PATH}/plugins/CustomizablePlayerModels - # Add symlinks to DiscordSRV files RUN mkdir -p ${DATA_PATH}/DiscordSRV && \ touch ${DATA_PATH}/DiscordSRV/accounts.aof && \ ln -sf ${DATA_PATH}/DiscordSRV/accounts.aof \ ${CONFIG_PATH}/plugins/DiscordSRV/accounts.aof +# Add symlinks to BlueMap files +RUN mkdir -p ${DATA_PATH}/BlueMap/maps && \ + mkdir -p ${DATA_PATH}/BlueMap/logs && \ + ln -sf ${DATA_PATH}/BlueMap/maps \ + ${CONFIG_PATH}/plugins/BlueMap/data/web/maps && \ + ln -sf ${DATA_PATH}/BlueMap/logs \ + ${CONFIG_PATH}/plugins/BlueMap/data/logs +RUN mkdir -p ${DATA_PATH}/BMMarker/data && \ + ln -sf ${DATA_PATH}/BMMarker/data \ + ${CONFIG_PATH}/plugins/BMMarker/data + + VOLUME ${DATA_PATH} @@ -85,7 +103,10 @@ ENV DISCORDSRV_BOT_TOKEN=dummy-token WORKDIR ${WORKDIR_PATH}/config +# Minecraft EXPOSE 25565/tcp +# BlueMap +EXPOSE 8100/tcp CMD \ # Add proxy secret diff --git a/src/plugins/BMMarker/language/de.yml b/src/plugins/BMMarker/language/de.yml new file mode 100644 index 0000000..4d34c6b --- /dev/null +++ b/src/plugins/BMMarker/language/de.yml @@ -0,0 +1,125 @@ +#----------------------- Translation ------------------------# +# Content of all messages in BlueMap-Marker. # +#------------------------------------------------------------# +# Some messages support MiniMessage styling (marked with #m) # +# and extra variables (marked with #v). # +# Syntax: -> # +# i is a number from 0 to the message max # +#------------------------------------------------------------# + +creator: Miraculixx +version: 1.0.0 + +#-----------------------------------------# +# Common Translations # +# Translation keys that persist in every # +# project for simple values # +#-----------------------------------------# +common: + cancel: "Abbrechen" + build: "Erstellen" + or: "oder" + notSet: "Nicht gesetzt" + use: "Nutze" + + +#-----------------------------------------# +# Command Responses # +# Translation keys that fires on command # +# executions and help # +#-----------------------------------------# +command: + alreadyStarted: "Du hast bereits angefangen einen Marker zu erstellen!" #m + alreadyStarted2: " vor dem neuerstellen!" #m (Cancel or build ...) + notValidMarker: "Dies ist kein valider Marker! ()" #m #v1 + notValidSet: "Ungültige set-ID oder Map Name! ( - )" #m #v2 + mustProvideID: "Bitte gebe eine Marker ID und ein Markerset an!" #m + mustProvideIDSet: "Bitte gebe eine marker-set ID und eine Zielwelt an!" #m + mustAlphanumeric: "IDs müssen alphanumerisch sein (nur Buchstaben und Zahlen)" #m + switchLang: "Die Sprache wurde zu Deutsch gewechselt!" #m + switchLangFailed: "Deine angegebene Sprache existiert nicht!" #m + createMarker: "Marker setup gestartet! Änderer Werte mit " #m #v1 (using ...) + createMarker2: " und bestätige dein setup mit " #m ( ... ) + createdMarker: "Marker erstellt! Es sollte in ein paar Sekunden auf deiner BlueMap erscheinen" #m + createdSet: "Marker-Set erstellt! Nutze es um neue Marker drin zu erstellen mit " + deleteMarker: "Erfolgreich marker gelöscht! Es sollte in ein paar Sekunden auf deiner BlueMap verschwinden" #m #v1 + deleteSet: "Erfolgreich marker-set gelöscht! Es sollte in ein paar Sekunden auf deiner BlueMap verschwinden" #m #v1 + confirmDelete: "Bist du dir wirklich sicher das '' set auf der Map '' zu löschen? Bitte bestätige es mit " #m #v2 + idAlreadyExist: "Die ID existiert bereits in dem set/der Welt!" #m #v1 + markerReplaced: "Der alte Marker wird ersetzt mit dem neuen..." #m + canceledSetup: "Aktuelles Marker setup abgebrochen!" #m #v1 + notValidPlayer: "Konnte den angegebenen Spieler nicht finden!" #m + changedVisibility: " ist jetzt auf deiner BlueMap" #m #v2 + + + +#-----------------------------------------# +# Creator Messages # +# Translation keys that are used while # +# creating markers(set) # +#-----------------------------------------# +event: + currentSetup: "Der aktuelle Erstellungsstatus ()" #v1 + buildHover: "Erstelle neuen Marker mit den\neingestellten Einstellungen. Rote Werte\nsind Pflicht!" + cancelHover: "Breche das aktuelle Erstellen ab.\nDies löscht alle gesetzten Werte!" + clickToAdd: "Klicke um einen Wert hinzuzufügen" + + +#-----------------------------------------# +# Arguments # +# Translation keys for all modifiers # +# to create markers(set) # +#-----------------------------------------# +arg: + ID: "ID" + MARKER_SET: "MARKER SET" + POSITION: "POSITION" + LABEL: "NAME" + ICON: "BILD" + ANCHOR: "ANKER" + MAX_DISTANCE: "MAX DISTANZ" + MIN_DISTANCE: "MIN DISTANZ" + ADD_POSITION: "NEUE POSITION" + ADD_EDGE: "NEUE ECKE" + DETAIL: "BESCHREIBUNG" + LINK: "LINK" + NEW_TAB: "NEUER TAB" + DEPTH_TEST: "TIEFEN TEST" + LINE_WIDTH: "LINIEN DICKE" + LINE_COLOR: "LINIEN FARBE" + FILL_COLOR: "FÜLLFARBE" + HEIGHT: "HÖHE" + MAX_HEIGHT: "MAX HÖHE" + POINTS: "PUNKTE" + X_RADIUS: "RADIUS X" + Z_RADIUS: "RADIUS Z" + MAP: "MAP" + TOGGLEABLE: "ÄNDERBAR" + DEFAULT_HIDDEN: "DEFAULT VERSTECKT" + +arg-desc: + ID: "Interne ID für den Zugriff auf den Marker(-set)" + MARKER_SET: "Markerset, in dem die Markierung\ngespeichert werden soll (Welt)" + POSITION: "Position wo der Marker gesetzt\nwird. (NICHT die Welt)" + LABEL: "Angezeigter Name in der Marker Liste/Menü" + ICON: "Bild URL für ein angezeigtes Bild\nbei der gegebenen Position (POI exklusiv)" + ANCHOR: "Verschiebung für das angezeigte \nBild/Html Code (in Pixel)" + MAX_DISTANCE: "Max Distanz zu der Kamera\nbei welcher der Marker sichtbar ist" + MIN_DISTANCE: "Min Distanz zu der Kamera\nbei welcher der Marker sichtbar ist" + ADD_POSITION: "Füge neue Positionen zum Marker\nhinzu um die Linie zu bilden (Line exklusiv)" + ADD_EDGE: "Füge neue Ecken zu dem Marker\nhinzu um die Form zu bilden" + DETAIL: "Beschreibung welche sichtbar ist\nbeim anklicken" + LINK: "Eine Verlinkung beim anklicken" + NEW_TAB: "Ob der angeklickte Link in einem\nneuen Tab geöffnet werden soll oder im selben" + DEPTH_TEST: "Wenn false, wird der Marker immer über allem\nangezeigt. Andernfalls respektiert er blockierende Ebenen." + LINE_WIDTH: "Die Dicke der Umrandung/Linie (in Pixel)" + LINE_COLOR: "Farbe der Umrandung/Linie (RGBA)\n- https://htmlcolorcodes.com -" + FILL_COLOR: "Farbe des inneres Feldes (RGBA)\n- https://htmlcolorcodes.com -" + HEIGHT: "Die minimale Höhe des Markierungsfeldes.\nDefinitionshöhe für Form Marker" + MAX_HEIGHT: "Die maximale Höhe des Markerfelds.\nFür eine flache Form auf dieselbe Y-Höhe/Position eingestellt." + POINTS: "Die Anzahl der Punkte, die zum Rendern des\nKreises/der Ellipse verwendet werden. Mehr Punkte\nerzeugen sauberere Ränder, aber zu viele\nPunkte beeinträchtigen die Leistung!" + X_RADIUS: "Der Ellipsen Radius in der +-x Richtung" + Z_RADIUS: "Der Ellipsen Radius in der +-z Richtung" + MAP: "Ziel BlueMap Map\nDies ist nicht die Welt!" + TOGGLEABLE: "Wenn true kann das Marker-Set im\nMenü aktiviert oder deaktiviert werden" + DEFAULT_HIDDEN: "Wenn true ist das Marker-Set standardmäßig\nausgeblendet und kann vom Benutzer aktiviert werden.\nWenn 'ÄNDERBAR' false ist, ist dies der erzwungene Zustand" \ No newline at end of file diff --git a/src/plugins/BMMarker/language/en.yml b/src/plugins/BMMarker/language/en.yml new file mode 100644 index 0000000..659e4ec --- /dev/null +++ b/src/plugins/BMMarker/language/en.yml @@ -0,0 +1,159 @@ +#----------------------- Translation ------------------------# +# Content of all messages in BlueMap-Marker. # +#------------------------------------------------------------# +# Some messages support MiniMessage styling (marked with #m) # +# and extra variables (marked with #v). # +# Syntax: -> # +# i is a number from 0 to the message max # +#------------------------------------------------------------# + +creator: Miraculixx +version: 1.0.0 + +#-----------------------------------------# +# Common Translations # +# Translation keys that persist in every # +# project for simple values # +#-----------------------------------------# +common: + cancel: "Cancel" + build: "Build" + or: "or" + notSet: "Not Set" + use: "Use" + + +#-----------------------------------------# +# Command Responses # +# Translation keys that fires on command # +# executions and help # +#-----------------------------------------# +command: + alreadyStarted: "You already started a marker setup!" #m + alreadyStarted2: " it before creating a new one" #m (Cancel or build ...) + notValidMarker: "This is not a valid marker! ()" #m #v1 + notValidSet: "Invalid set-ID or map name! ( - )" #m #v2 + mustProvideID: "Please provide a marker ID!" #m + mustProvideIDSet: "Please provide a marker-set ID and a target world!" #m + mustAlphanumeric: "IDs must be alphanumeric (only contains letters and numbers)" #m + switchLang: "Switched language to en_US!" #m + switchLangFailed: "Your provided language does not exist!" #m + createMarker: "Marker setup started! Modify values using " #m #v1 (using ...) + createMarker2: " and finish your setup with " #m ( ... ) + createdMarker: "Marker created! It should appear on your BlueMap in a few seconds" #m + createdSet: "Marker-Set created! Use it to add new markers inside this set with " + deleteMarker: "Successfully deleted marker! It should disappear from your BlueMap in a few seconds" #m #v1 + deleteSet: "Successfully deleted marker-set! It should disappear from your BlueMap in a few seconds" #m #v1 + confirmDelete: "Are you really sure you want to delete the '' set on map ''? Please confirm by typing " #m #v2 + idAlreadyExist: "The ID already exist in this set/world!" #m #v1 + canceledSetup: "Canceled current marker setup!" #m #v1 + notValidPlayer: "Could not found given player!" #m + changedVisibility: " is now on your BlueMap" #m #v2 + setNotFound: "Could not find the marker-set with the ID ! (/ set-create)" #m #v1 + mapNotFound: "Could not find the map with the name !" #m #v1 + missingImportant: "Missing one or more important values! Please fill in all red marked values" #m + selectMap: "Select a BlueMap-Map:" #m + selectSet: "Select a Marker-Set:" #m + noSets: "There are no marker-sets in map ! (/ set-create)" #m #v1 + notYourSet: "You are not the owner of this marker-set!" #m + notYourMarker: "You are not the owner of this marker!" #m + maxMarkers: "You reached your maximum amount of markers in this set! ()" #m #v1 + maxSets: "You reached your maximum amount of marker-sets in this map! ()" #m #v1 + notTeleportMarker: "This marker is not setup to be teleportable!" #m + teleportMarker: "Teleported to the marker !" #m #v1 + settings: + current: "Current value: " #m #v1 + changed: "Changed value to: " #m #v1 + template: + help: "Templates are a powerful tool to create markers faster or automated. They can be a bit complicated to setup first, so feel free to ask me for help :)\n\n- Templates have their own custom command (/id)\n- Templates need their own set (/id edit set)\n- Can contain multiple \"template\" marker (/id edit marker)\n- Can be automated by certain events (/id edit automate)" + help-marker: "Template markers are just like normal markers, but they do not appear on the map. They can be put on the map by a single command (/id mark ).\n\n- Markers will copy the position of target\n- Label & detail supports placeholder (%NAME%)" + create: "Template created! Use / edit <...> to add new template markers, rules and more" #m #v1 + delete: "Template deleted with all associated markers and sets!" #m #v1 + setArg: "Applied new value " #m #v1 + addTemplateMarker: "Added template marker to the template! You can now quick place or automate it.\n" #m #v1 + removeMarkerTemplate: "Removed template and all placed markers to it." #m #v1 + updateMarker: "Updated template marker and all placed markers!" #m #v1 + noValidTemplate: " is not a valid template in this set!" #m #v1 + invalidWorld: "The set is not available in your current world!" #m + place: "New marker placed!" #m #v1 + unplace: "Removed your marker!" #m #v1 + mapAlreadyAdded: "The map is already added to the template!" #m #v1 + mapNotAdded: "The map is not added to the template!" #m #v1 + addMap: "Added map to the template! (This action didn't cloned existing markers)" #m #v1 + confirmRemoval: "Are you sure you want to delete this template set? This will also delete all markers inside!\n\nConfirm with " + + +#-----------------------------------------# +# Command Responses # +# Translation keys that fires on command # +# executions and help # +#-----------------------------------------# +event: + currentSetup: "Your current setup state ()" #v1 + buildHover: "Build a new marker with applied\nsettings. Red highlighted values\nare required!" + cancelHover: "Cancel the current marker builder.\nThis will delete all your values!" + clickToAdd: "Click to add a value" + + +#-----------------------------------------# +# Creator Messages # +# Translation keys that are used while # +# creating markers(set) # +#-----------------------------------------# +arg: + ID: "ID" + MARKER_SET: "MARKER SET" + POSITION: "POSITION" + LABEL: "LABEL" + ICON: "ICON" + ANCHOR: "ANCHOR" + MAX_DISTANCE: "MAX DISTANCE" + MIN_DISTANCE: "MIN DISTANCE" + ADD_POSITION: "ADD POSITION" + ADD_EDGE: "ADD EDGE" + DETAIL: "DETAIL" + LINK: "LINK" + NEW_TAB: "NEW TAB" + DEPTH_TEST: "DEPTH TEST" + LINE_WIDTH: "LINE WIDTH" + LINE_COLOR: "LINE COLOR" + FILL_COLOR: "FILL COLOR" + HEIGHT: "HEIGHT" + MAX_HEIGHT: "MAX HEIGHT" + POINTS: "POINTS" + X_RADIUS: "RADIUS X" + Z_RADIUS: "RADIUS Z" + MAP: "MAP" + TOGGLEABLE: "TOGGLEABLE" + DEFAULT_HIDDEN: "DEFAULT HIDDEN" + LISTED: "LISTED" + LISTING_POSITION: "LISTING POSITION" + +arg-desc: + ID: "Internal ID to access the marker(-set)" + MARKER_SET: "Target marker-set where the marker\nshould be stored (provides world)" + POSITION: "Position where the marker will be \nplaced. (NOT the world)" + LABEL: "Displayed label in the marker menu" + ICON: "Image URL for displayed image on\ngiven position (POI exclusive)" + ANCHOR: "Offset for displayed image/html code (in pixel)" + MAX_DISTANCE: "Max distance to the camera at\nwhich the marker is shown" + MIN_DISTANCE: "Min distance to the camera at\nwhich the marker is shown" + ADD_POSITION: "Add more positions to a marker\nto define the path (Line exclusive)" + ADD_EDGE: "Add more edges to a marker\nto define the shape" + DETAIL: "Description that is shown on marker click" + LINK: "A redirect link on marker click" + NEW_TAB: "If the redirect link is opened\nin a new tab or replace BlueMap tab" + DEPTH_TEST: "If false the marker will always\nrender above everything. Otherwise\nit will respect blocking layers" + LINE_WIDTH: "The width of the line/outline (in pixel)" + LINE_COLOR: "Color of the line/outline (RGBA)\n- https://htmlcolorcodes.com -" + FILL_COLOR: "Color of the drawn field (RGBA)\n- https://htmlcolorcodes.com -" + HEIGHT: "The minimal height of the marker field.\nDefinition height for shape markers" + MAX_HEIGHT: "The maximal height of the marker field.\nSet to the same Y height/position\nfor a flat shape" + POINTS: "The amount of points used to render\nthe circle/ellipse. More points\ncreate cleaner borders but to many\npoints affect performance!" + X_RADIUS: "The ellipse radius to the +-x direction" + Z_RADIUS: "The ellipse radius to the +-z direction" + MAP: "Target BlueMap Map\nThis is not world exclusive!" + TOGGLEABLE: "If this is true, the marker-set\ncan be enabled or disabled in the menu" + DEFAULT_HIDDEN: "If this is true, the marker-set\nwill be hidden by default and can be\nenabled by the user. If 'TOGGELABLE' is\nfalse, this is the forced state" + LISTED: "If this is false, the marker will\nnot be listed in the BlueMap set menu" + LISTING_POSITION: "Position of the marker(-set) in the BlueMap menu.\n Higher values are higher in the list compared to others" diff --git a/src/plugins/BMMarker/settings.json b/src/plugins/BMMarker/settings.json new file mode 100644 index 0000000..127a310 --- /dev/null +++ b/src/plugins/BMMarker/settings.json @@ -0,0 +1,5 @@ +{ + "language": "en", + "maxUserSets": 1, + "maxUserMarker": 5 +} \ No newline at end of file diff --git a/src/plugins/BlueMap/core.conf b/src/plugins/BlueMap/core.conf new file mode 100644 index 0000000..81adc67 --- /dev/null +++ b/src/plugins/BlueMap/core.conf @@ -0,0 +1,48 @@ +## ## +## BlueMap ## +## Core-Config ## +## ## + +# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula), +# you confirm that you own a license to Minecraft (Java Edition) +# and you agree that BlueMap will download and use a minecraft-client file (depending on the minecraft-version) from mojangs servers (https://piston-meta.mojang.com/) for you. +# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA. +# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.) +# 2025-07-19T16:02:57 +accept-download: true + +# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later. +# Default is "bluemap" +data: "plugins/BlueMap/data" + +# This changes the amount of threads that BlueMap will use to render the maps. +# A higher value can improve render-speed but could impact performance on the host machine. +# This should be always below or equal to the number of available processor-cores. +# Zero or a negative value means the amount of available processor-cores subtracted by the value. +# (So a value of -2 with 6 cores results in 4 render-processes) +# Default is 1 +render-thread-count: 1 + +# Controls whether BlueMap should try to find and load mod-resources and datapacks from the server/world-directories. +# Default is true +scan-for-mod-resources: false + +# If this is true, BlueMap might send really basic metrics reports containing only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/ +# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :) +# An example report looks like this: {"implementation":"bukkit","version":"5.9","mcVersion":"?"} +# Default is true +metrics: false + +# Config-section for debug-logging +log: { + # The file where the debug-log will be written to. + # Comment out to disable debug-logging completely. + # Java String formatting syntax can be used to add time, see: https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html + # Default is no logging + file: "plugins/BlueMap/data/logs/debug.log" + #file: "bluemap/logs/debug_%1$tF_%1$tT.log" + + # Whether the logger should append to an existing file, or overwrite it + # Default is false + append: false +} diff --git a/src/plugins/BlueMap/data/pluginState.json b/src/plugins/BlueMap/data/pluginState.json new file mode 100644 index 0000000..65c1eb9 --- /dev/null +++ b/src/plugins/BlueMap/data/pluginState.json @@ -0,0 +1 @@ +{"render-threads-enabled":true,"maps":{"world":{"update-enabled":true},"world_the_end":{"update-enabled":true},"world_nether":{"update-enabled":true}},"hidden-players":[]} diff --git a/src/plugins/BlueMap/data/resourceExtensions.zip b/src/plugins/BlueMap/data/resourceExtensions.zip new file mode 100644 index 0000000..af04394 Binary files /dev/null and b/src/plugins/BlueMap/data/resourceExtensions.zip differ diff --git a/src/plugins/BlueMap/data/web/assets/Quicksand-BuVPtn-J.ttf b/src/plugins/BlueMap/data/web/assets/Quicksand-BuVPtn-J.ttf new file mode 100644 index 0000000..0ec2219 Binary files /dev/null and b/src/plugins/BlueMap/data/web/assets/Quicksand-BuVPtn-J.ttf differ diff --git a/src/plugins/BlueMap/data/web/assets/favicon-DEN7TZ5X.png b/src/plugins/BlueMap/data/web/assets/favicon-DEN7TZ5X.png new file mode 100644 index 0000000..382ee48 Binary files /dev/null and b/src/plugins/BlueMap/data/web/assets/favicon-DEN7TZ5X.png differ diff --git a/src/plugins/BlueMap/data/web/assets/index-BgiqB2rB.css b/src/plugins/BlueMap/data/web/assets/index-BgiqB2rB.css new file mode 100644 index 0000000..b3786ae --- /dev/null +++ b/src/plugins/BlueMap/data/web/assets/index-BgiqB2rB.css @@ -0,0 +1 @@ +.number-input{pointer-events:auto;background-color:var(--theme-bg);color:var(--theme-fg);min-height:2em}.number-input .label{display:inline-block;width:1em;padding:0 .5em;color:var(--theme-fg-light)}.number-input input{height:100%;line-height:100%;width:calc(100% - 2em);background-color:inherit;color:inherit;-moz-appearance:textfield}.number-input input::-webkit-inner-spin-button,.number-input input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.position-input{display:flex;-webkit-user-select:none;user-select:none}.position-input>*{width:100%}.position-input>*:not(:first-child){border-left:solid 1px var(--theme-bg-light)}.svg-button{position:relative;pointer-events:auto;overflow:hidden;cursor:pointer;min-width:2em;min-height:2em;background-color:var(--theme-bg);color:var(--theme-fg)}.svg-button:hover{background-color:var(--theme-bg-hover)}.svg-button.active{background-color:var(--theme-bg-light)}.svg-button:active{background-color:var(--theme-fg-light);color:var(--theme-bg)}.svg-button svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);height:1.8em;fill:var(--theme-fg-light)}.svg-button:active svg{fill:var(--theme-bg-light)}.compass svg{height:1.8em}.compass svg .north{fill:var(--theme-fg)}.compass svg .south{fill:var(--theme-fg-light)}.compass:active svg .north{fill:var(--theme-bg)}.compass:active svg .south{fill:var(--theme-bg-light)}.day-night-switch svg{fill:var(--theme-moon-day)}.day-night-switch svg circle{fill:var(--theme-stars-day)}.day-night-switch:active svg{fill:var(--theme-moon-night)}.day-night-switch:active svg circle{fill:var(--theme-stars-night)}.controls-switch{display:flex}.menu-button svg g{transform-origin:center;transition:transform .3s}.menu-button svg path{transition:transform .3s,fill .3s;transform:translate(0) rotate(0)}.menu-button svg path:nth-child(1){transform-origin:15px 9px}.menu-button svg path:nth-child(2){transform-origin:15px 15px}.menu-button svg path:nth-child(3){transform-origin:15px 21px}.menu-button.close svg path:nth-child(1){transform:translateY(5.75px) rotate(45deg)}.menu-button.close svg path:nth-child(2){transform:translate(-100%) rotate(0)}.menu-button.close svg path:nth-child(3){transform:translateY(-5.75px) rotate(-45deg)}.menu-button.close.back svg g{transform:scale(.75)}.menu-button.close.back svg path:nth-child(1){transform:translateY(10px) rotate(30deg)}.menu-button.close.back svg path:nth-child(2){transform:translate(-150%) rotate(0)}.menu-button.close.back svg path:nth-child(3){transform:translateY(-10px) rotate(-30deg)}.control-bar{position:fixed;top:0;left:0;display:flex;filter:drop-shadow(1px 1px 3px rgba(0,0,0,.53));height:2em;margin:.5em;width:calc(100% - 1em)}.control-bar .pos-input{max-width:20em;width:100%}.control-bar>:not(:first-child){border-left:solid 1px var(--theme-bg-light)}.control-bar .space{width:.5em;flex-shrink:0}.control-bar .space.greedy{flex-grow:1}.control-bar .space,.control-bar .space+*{border-left:none}@media (max-width: 575.98px){.control-bar{margin:0;width:100%;background-color:var(--theme-bg)}.control-bar .pos-input{max-width:unset}.control-bar .thin-hide{display:none}.control-bar .space{width:1px}}.side-menu{position:fixed;top:0;left:0;overflow:hidden;pointer-events:auto;width:100%;max-width:20em;height:100%;filter:drop-shadow(1px 1px 3px rgba(0,0,0,.5333333333));background-color:var(--theme-bg);color:var(--theme-fg)}.side-menu-enter-active,.side-menu-leave-active{transition:opacity .3s}.side-menu-enter,.side-menu-leave-to{opacity:0;pointer-events:none}.side-menu-enter *,.side-menu-leave-to *{pointer-events:none!important}.side-menu>.menu-button{position:absolute;top:0;left:0;margin:.5em}@media (max-width: 575.98px){.side-menu>.menu-button{margin:0}}.side-menu>.menu-button.full-close{right:0;left:unset}.side-menu>.title{line-height:2em;text-align:center;background-color:inherit;border-bottom:solid 1px var(--theme-bg-hover);padding:.5em}@media (max-width: 575.98px){.side-menu>.title{padding:0}}.side-menu>.content{position:relative;overflow-y:auto;overflow-x:hidden;padding:.5em;height:calc(100% - 4em - 1px)}@media (max-width: 575.98px){.side-menu>.content{height:calc(100% - 3em - 1px)}}.side-menu>.content hr{border:none;border-bottom:solid 2px var(--theme-bg-hover);margin:.5em 0}.side-menu .simple-button{cursor:pointer;-webkit-user-select:none;user-select:none;display:flex;line-height:2em;padding:0 .5em}.side-menu .simple-button>.label{flex-grow:1;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.side-menu .simple-button:hover{background-color:var(--theme-bg-hover)}.side-menu .simple-button.active{background-color:var(--theme-bg-light)}.side-menu .simple-button>.submenu-icon{width:2em;height:2em;flex-shrink:0;margin-right:-.5em}.side-menu .simple-button>.submenu-icon>svg{fill:var(--theme-fg-light);transform:scale(.75)}.side-menu .simple-button>.submenu-icon>svg path:nth-child(1){transform-origin:15px 9px;transform:translateY(10px) rotate(-30deg)}.side-menu .simple-button>.submenu-icon>svg path:nth-child(2){transform-origin:15px 21px;transform:translateY(-10px) rotate(30deg)}.side-menu .simple-button:active{background-color:var(--theme-fg-light);color:var(--theme-bg)}.side-menu .simple-button:active>.submenu-icon>svg{fill:var(--theme-bg-light)}.side-menu .group{position:relative;margin:2em 0 1em;padding-top:1em;border:solid 2px var(--theme-bg-hover)}.side-menu .group>.title{position:absolute;top:calc(-.5em - 1px);right:.5em;padding:0 .5em;background-color:var(--theme-bg)}.side-menu .group:first-child{margin-top:1em}.side-menu .group>.content{max-height:15em;overflow-y:auto}.side-menu .slider{line-height:2em;padding:0 .5em}.side-menu .slider:hover{background-color:var(--theme-bg-hover)}.side-menu .slider>.label>.value{float:right}.side-menu .slider>label>input{appearance:none;-moz-appearance:none;-webkit-appearance:none;outline:none;width:100%;height:1em;border-radius:1em;overflow:hidden;background-color:var(--theme-bg-light)}.side-menu .slider>label>input::-webkit-slider-thumb{appearance:none;-moz-appearance:none;-webkit-appearance:none;outline:none;width:1em;height:1em;border-radius:1em;border:solid .125em var(--theme-bg-light);background-color:var(--theme-bg)}.side-menu .slider>label>input::-moz-range-thumb{width:.75em;height:.75em;border-radius:.75em;border:solid .125em var(--theme-bg-light);background-color:var(--theme-bg)}.side-menu .switch{height:1em;width:2em;border-radius:1em;background-color:var(--theme-bg-light);transition:background-color .3s}.side-menu .switch:after{content:"";display:block;width:.75em;height:.75em;border-radius:100%;background-color:var(--theme-bg);position:relative;top:.125em;left:.125em;transition:left .3s}.side-menu .switch.on{background-color:var(--theme-switch-button-on)}.side-menu .switch.on:after{left:1.125em}.side-menu .switch-button{cursor:pointer;-webkit-user-select:none;user-select:none;display:flex;line-height:2em;padding:0 .5em}.side-menu .switch-button>.label{flex-grow:1;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.side-menu .switch-button>.switch{margin:.5em 0}.side-menu .switch-button:hover{background-color:var(--theme-bg-hover)}.side-menu .marker-item{display:flex;white-space:nowrap;-webkit-user-select:none;user-select:none;line-height:1em;margin:.5em 0}.side-menu .marker-item:first-child{margin-top:0}.side-menu .marker-item:last-child{margin-bottom:0}.side-menu .marker-item.marker-hidden{opacity:.5;filter:grayscale(1)}.side-menu .marker-item .marker-button{display:flex;flex-grow:1;cursor:pointer}.side-menu .marker-item .marker-button:hover{background-color:var(--theme-bg-hover)}.side-menu .marker-item .marker-button>.info{flex-grow:1;text-overflow:ellipsis;padding:.5em}.side-menu .marker-item .marker-button>.info .label{text-overflow:ellipsis}.side-menu .marker-item .marker-button>.info .stats{display:flex;font-size:.8em;color:var(--theme-fg-light)}.side-menu .marker-item .marker-button>.info .stats>div:not(:first-child){margin-left:.5em;padding-left:.5em;border-left:solid 1px var(--theme-bg-hover)}.side-menu .marker-item .marker-button>.icon{height:2.5em;margin:.5em;flex-shrink:0}.side-menu .marker-item .marker-button>.icon img{image-rendering:pixelated;height:100%}.side-menu .marker-item>.follow-player-button{width:2em;cursor:pointer;background-color:var(--theme-bg)}.side-menu .marker-item>.follow-player-button:hover,.side-menu .marker-item>.follow-player-button.active{background-color:var(--theme-bg-light)}.side-menu .marker-item>.follow-player-button>svg{position:relative;fill:var(--theme-fg-light);stroke:var(--theme-fg-light);top:50%;transform:translateY(-50%) scale(.75)}.side-menu .marker-item>.follow-player-button:active{background-color:var(--theme-fg-light);color:var(--theme-bg)}.side-menu .marker-item>.follow-player-button:active>svg{fill:var(--theme-bg-light);stroke:var(--theme-bg-light)}.side-menu .text-input{background-color:var(--theme-bg-hover);width:calc(100% - 1em);padding:.5em}.side-menu .marker-set{display:flex;-webkit-user-select:none;user-select:none;line-height:1em;margin:.5em 0}.side-menu .marker-set:first-child{margin-top:0}.side-menu .marker-set:last-child{margin-bottom:0}.side-menu .marker-set>.info{flex-grow:1;cursor:pointer;padding:.5em}.side-menu .marker-set>.info:hover{background-color:var(--theme-bg-hover)}.side-menu .marker-set>.info>.marker-set-switch{position:relative}.side-menu .marker-set>.info>.marker-set-switch .label{margin:0 2.5em 0 0}.side-menu .marker-set>.info>.marker-set-switch>.switch{position:absolute;top:0;right:0}.side-menu .marker-set>.info>.stats{display:flex;font-size:.8em;color:var(--theme-fg-light)}.side-menu .marker-set>.info>.stats>div:not(:first-child){margin-left:.5em;padding-left:.5em;border-left:solid 1px var(--theme-bg-light)}.side-menu .marker-set>.open-menu-button{width:2em}.side-menu .marker-set>.open-menu-button.active{cursor:pointer}.side-menu .marker-set>.open-menu-button.active:hover{background-color:var(--theme-bg-hover)}.side-menu .marker-set>.open-menu-button.active>svg{position:relative;fill:var(--theme-fg-light);top:50%;transform:translateY(-50%) scale(.75)}.side-menu .marker-set>.open-menu-button.active>svg path:nth-child(1){transform-origin:15px 9px;transform:translateY(10px) rotate(-30deg)}.side-menu .marker-set>.open-menu-button.active>svg path:nth-child(2){transform-origin:15px 21px;transform:translateY(-10px) rotate(30deg)}.side-menu .marker-set>.open-menu-button.active:active{background-color:var(--theme-fg-light);color:var(--theme-bg)}.side-menu .marker-set>.open-menu-button.active:active>svg{fill:var(--theme-bg-light)}.side-menu .marker-set>.open-menu-button:not(.active) svg{display:none}.choice-box{display:flex;font-size:.8em;text-align:center;border:solid 2px var(--theme-bg-hover);overflow:hidden}.choice-box .title,.choice-box .choice{padding:.3em .5em}.choice-box .title{background-color:var(--theme-bg-hover)}.choice-box .choices{display:flex;flex-grow:1}.choice-box .choices .choice{flex-grow:1;cursor:pointer;-webkit-user-select:none;user-select:none;background-color:var(--theme-bg)}.choice-box .choices .choice:hover{background-color:var(--theme-bg-hover)}.choice-box .choices .choice.selected{background-color:var(--theme-bg-light)}.side-menu .map-button{position:relative;cursor:pointer;-webkit-user-select:none;user-select:none;height:2em;line-height:2em;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.side-menu .map-button.selected{background-color:var(--theme-bg-light)}.side-menu .map-button:hover{background-color:var(--theme-bg-hover)}.side-menu .map-button .sky{float:left;border-radius:100%;width:.5em;height:.5em;margin:0 .25em 0 .5em}.side-menu .map-button .id{font-style:italic;color:var(--theme-fg-light);margin:0 .5em}.info-content{font-size:.8em}.info-content table{border-collapse:collapse;width:100%}.info-content table tr th,.info-content table tr td{padding:.2em .5em;border:solid 1px var(--theme-bg-light)}.info-content table tr th{font-weight:inherit;text-align:inherit}.info-content .info-footer{text-align:center}#ff-mobile-controls{font-size:15vw}#ff-mobile-controls.disabled{display:none}@media (orientation: portrait){#ff-mobile-controls{font-size:15vh}}#ff-mobile-controls .button{width:1em;margin:.1em;opacity:.5;pointer-events:auto}#ff-mobile-controls .button svg{fill:var(--theme-bg)}#ff-mobile-controls .button svg:active{fill:var(--theme-bg-light);opacity:.8}#ff-mobile-controls .button svg.down{transform:scaleY(-1)}#ff-mobile-controls .move-fields{position:fixed;bottom:.2em;left:.2em}#ff-mobile-controls .height-fields{position:fixed;bottom:.2em;right:.2em}#zoom-buttons{position:fixed;bottom:0;right:0;display:flex;flex-direction:column;filter:drop-shadow(1px 1px 3px rgba(0,0,0,.53));width:2em;margin:.5em}@font-face{font-family:Quicksand;font-style:normal;font-display:swap;font-weight:100 900;src:local("Quicksand"),url(./Quicksand-BuVPtn-J.ttf) format("truetype-variations")}:root{line-height:1rem;font-family:Quicksand,sans-serif;font-size:16px;font-weight:400;--theme-bg: #181818;--theme-bg-hover: #222;--theme-bg-light: #444;--theme-fg: #fff;--theme-fg-light: #aaa;--theme-switch-button-on: #00489d;--theme-stars-day: #fff;--theme-moon-day: #ff0;--theme-stars-night: #444;--theme-moon-night: #000}:root .theme-light{font-family:Quicksand,sans-serif;font-size:16px;font-weight:500;--theme-bg: #eee;--theme-bg-hover: #ddd;--theme-bg-light: #999;--theme-fg: #000;--theme-fg-light: #333;--theme-switch-button-on: #6593dc;--theme-stars-day: #444;--theme-moon-day: #000;--theme-stars-night: #fff;--theme-moon-night: #ff0}:root .theme-contrast{font-family:Quicksand,sans-serif;font-size:16px;font-weight:400;--theme-bg: #000;--theme-bg-hover: #222;--theme-bg-light: #666;--theme-fg: #fff;--theme-fg-light: #aaa;--theme-switch-button-on: #006fff;--theme-stars-day: #fff;--theme-moon-day: #ff0;--theme-stars-night: #444;--theme-moon-night: #000}@media (prefers-color-scheme: light){:root{font-family:Quicksand,sans-serif;font-size:16px;font-weight:500;--theme-bg: #eee;--theme-bg-hover: #ddd;--theme-bg-light: #999;--theme-fg: #000;--theme-fg-light: #333;--theme-switch-button-on: #6593dc;--theme-stars-day: #444;--theme-moon-day: #000;--theme-stars-night: #fff;--theme-moon-night: #ff0}:root .theme-dark{font-family:Quicksand,sans-serif;font-size:16px;font-weight:400;--theme-bg: #181818;--theme-bg-hover: #222;--theme-bg-light: #444;--theme-fg: #fff;--theme-fg-light: #aaa;--theme-switch-button-on: #00489d;--theme-stars-day: #fff;--theme-moon-day: #ff0;--theme-stars-night: #444;--theme-moon-night: #000}}body{margin:0;padding:0;overscroll-behavior:none;overflow:hidden}h1,h2,h3,h4,h5,h6{font-weight:inherit;font-size:inherit;text-align:left;margin:1em 0 .5em;padding:0}h1,h2{position:relative;font-size:1.2em;margin-left:0;margin-right:0;padding-left:.5em;padding-bottom:.5em;width:calc(100% - .5em);overflow:hidden}h1:after,h2:after{position:absolute;left:0;bottom:0;content:"";width:100%;height:1px;background-color:var(--theme-bg-light)}h1{width:100%;text-align:center;padding-left:0}p{margin:.5em;padding:0}a{color:inherit;text-decoration:underline}kbd{background-color:var(--theme-bg-light);border-radius:.2em;margin:0;padding:0 .2em}input{display:inline-block;box-sizing:content-box;border:none;outline:none;margin:0;padding:0;font:inherit;color:inherit}::-webkit-scrollbar{width:.5em}::-webkit-scrollbar-track{background:var(--theme-bg)}::-webkit-scrollbar-thumb{background:var(--theme-bg-light);border-radius:.5em;border:solid var(--theme-bg) .1em}::-webkit-scrollbar-thumb:hover{background:var(--theme-fg-light)}#bm-app-err{position:relative;width:100vw;height:100vh;background-color:var(--theme-bg);color:var(--theme-fg)}#bm-app-err>div{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center}#bm-app-err>div img{max-width:10em;min-width:5em;width:90%;border-radius:50%;margin:0 0 3em}#bm-app-err>div .bm-app-err-hint{color:var(--theme-fg-light)}#map-container .bm-marker-html{position:relative;-webkit-user-select:none;user-select:none}#map-container .bm-marker-html .bm-marker-poi-label{position:absolute;top:0;left:0;opacity:0;transition:opacity .3s}#map-container .bm-marker-html .bm-marker-poi-icon{opacity:1;transition:opacity .3s;filter:drop-shadow(1px 1px 3px rgba(0,0,0,.5333333333))}#map-container .bm-marker-html.bm-marker-highlight .bm-marker-poi-label{opacity:1}#map-container .bm-marker-html.bm-marker-highlight .bm-marker-poi-icon{opacity:0}#map-container .bm-marker-html .bm-marker-poi-label,#map-container .bm-marker-labelpopup,#map-container .bm-marker-popup{transform:translate(-50%,-100%) translateY(-.5em);max-width:15em;color:var(--theme-fg);background-color:var(--theme-bg);filter:drop-shadow(1px 1px 3px rgba(0,0,0,.5333333333));padding:.5em}#map-container .bm-marker-html .bm-marker-poi-label>hr,#map-container .bm-marker-labelpopup>hr,#map-container .bm-marker-popup>hr{border:none;border-bottom:solid 1px var(--theme-bg-light);margin:.5em -.5em}#map-container .bm-marker-html .bm-marker-poi-label:after,#map-container .bm-marker-labelpopup:after,#map-container .bm-marker-popup:after{position:absolute;bottom:calc(-1em + 1px);left:50%;transform:translate(-50%);content:"";border:solid .5em transparent;border-top-color:var(--theme-bg)}#map-container .bm-marker-popup{line-height:1.2em}#map-container .bm-marker-popup .group[data-tooltip]{position:relative;pointer-events:auto;-webkit-user-select:none;user-select:none;cursor:pointer;margin:-.5em;padding:.5em}#map-container .bm-marker-popup .group[data-tooltip]:hover:before{display:block;position:absolute;z-index:1;left:50%;bottom:calc(100% + .5em);transform:translate(-50%);content:attr(data-tooltip);background:var(--theme-bg);color:var(--theme-fg-light);filter:drop-shadow(1px 1px 3px rgba(0,0,0,.5333333333));font-size:.75em;line-height:1em;padding:.5em}#map-container .bm-marker-popup .group[data-tooltip]:active{background-color:var(--theme-bg-light)}#map-container .bm-marker-popup .group>.label{position:relative;top:0;left:.5em;margin:0 .5em;font-size:.8em;color:var(--theme-fg-light)}#map-container .bm-marker-popup .group>.content{display:flex;justify-content:center}#map-container .bm-marker-popup .group>.content>.entry{margin:0 .5em}#map-container .bm-marker-popup .group>.content>.entry>.label{color:var(--theme-fg-light)}#map-container .bm-marker-popup .files{font-size:.8em;color:var(--theme-fg-light)}#map-container .bm-marker-player{position:relative;transform:translate(-50%,-50%);filter:drop-shadow(1px 1px 3px rgba(0,0,0,.5333333333))}#map-container .bm-marker-player img{width:32px;image-rendering:pixelated;transition:width .3s}#map-container .bm-marker-player .bm-player-name{position:absolute;top:-.5em;left:50%;transform:translate(-50%,-100%);padding:.25em;background-color:#0008;color:#fff;transition:opacity .3s}#map-container .bm-marker-player[distance-data=med] img,#map-container .bm-marker-player[distance-data=far] img{width:16px}#map-container .bm-marker-player[distance-data=med] .bm-player-name,#map-container .bm-marker-player[distance-data=far] .bm-player-name{opacity:0}#map-container{position:absolute;width:100%;height:100%}#app{position:absolute;width:100%;height:100%;z-index:10000;pointer-events:none;font-size:1rem}@media (max-width: 575.98px){#app{font-size:1.5rem}}#app .map-state-message{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--theme-fg-light);line-height:1em;text-align:center} diff --git a/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js b/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js new file mode 100644 index 0000000..862ea1f --- /dev/null +++ b/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js @@ -0,0 +1,4297 @@ +var ei=Object.defineProperty;var ti=(n,e,t)=>e in n?ei(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var me=(n,e,t)=>ti(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function makeMap(n,e){const t=Object.create(null),i=n.split(",");for(let r=0;r!!t[r.toLowerCase()]:r=>!!t[r]}function normalizeStyle(n){if(isArray$1(n)){const e={};for(let t=0;t{if(t){const i=t.split(propertyDelimiterRE);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function normalizeClass(n){let e="";if(isString$2(n))e=n;else if(isArray$1(n))for(let t=0;tisString$2(n)?n:n==null?"":isArray$1(n)||isObject$2(n)&&(n.toString===objectToString$1||!isFunction$1(n.toString))?JSON.stringify(n,replacer,2):String(n),replacer=(n,e)=>e&&e.__v_isRef?replacer(n,e.value):isMap(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,r])=>(t[`${i} =>`]=r,t),{})}:isSet(e)?{[`Set(${e.size})`]:[...e.values()]}:isObject$2(e)&&!isArray$1(e)&&!isPlainObject$1(e)?String(e):e,EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,onRE=/^on[^a-z]/,isOn=n=>onRE.test(n),isModelListener=n=>n.startsWith("onUpdate:"),extend=Object.assign,remove=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},hasOwnProperty$1=Object.prototype.hasOwnProperty,hasOwn$1=(n,e)=>hasOwnProperty$1.call(n,e),isArray$1=Array.isArray,isMap=n=>toTypeString$1(n)==="[object Map]",isSet=n=>toTypeString$1(n)==="[object Set]",isFunction$1=n=>typeof n=="function",isString$2=n=>typeof n=="string",isSymbol=n=>typeof n=="symbol",isObject$2=n=>n!==null&&typeof n=="object",isPromise$1=n=>isObject$2(n)&&isFunction$1(n.then)&&isFunction$1(n.catch),objectToString$1=Object.prototype.toString,toTypeString$1=n=>objectToString$1.call(n),toRawType=n=>toTypeString$1(n).slice(8,-1),isPlainObject$1=n=>toTypeString$1(n)==="[object Object]",isIntegerKey=n=>isString$2(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},camelizeRE=/-(\w)/g,camelize=cacheStringFunction(n=>n.replace(camelizeRE,(e,t)=>t?t.toUpperCase():"")),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(n=>n.replace(hyphenateRE,"-$1").toLowerCase()),capitalize$1=cacheStringFunction(n=>n.charAt(0).toUpperCase()+n.slice(1)),toHandlerKey=cacheStringFunction(n=>n?`on${capitalize$1(n)}`:""),hasChanged=(n,e)=>!Object.is(n,e),invokeArrayFns=(n,e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},toNumber=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let _globalThis$1;const getGlobalThis$1=()=>_globalThis$1||(_globalThis$1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let activeEffectScope;class EffectScope{constructor(e=!1){this.detached=e,this.active=!0,this.effects=[],this.cleanups=[],this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}run(e){if(this.active){const t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){activeEffectScope=this}off(){activeEffectScope=this.parent}stop(e){if(this.active){let t,i;for(t=0,i=this.effects.length;t{const e=new Set(n);return e.w=0,e.n=0,e},wasTracked=n=>(n.w&trackOpBit)>0,newTracked=n=>(n.n&trackOpBit)>0,initDepMarkers=({deps:n})=>{if(n.length)for(let e=0;e{const{deps:e}=n;if(e.length){let t=0;for(let i=0;i{(u==="length"||u>=l)&&o.push(c)})}else switch(t!==void 0&&o.push(a.get(t)),e){case"add":isArray$1(n)?isIntegerKey(t)&&o.push(a.get("length")):(o.push(a.get(ITERATE_KEY)),isMap(n)&&o.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$1(n)||(o.push(a.get(ITERATE_KEY)),isMap(n)&&o.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap(n)&&o.push(a.get(ITERATE_KEY));break}if(o.length===1)o[0]&&triggerEffects(o[0]);else{const l=[];for(const c of o)c&&l.push(...c);triggerEffects(createDep(l))}}function triggerEffects(n,e){const t=isArray$1(n)?n:[...n];for(const i of t)i.computed&&triggerEffect(i);for(const i of t)i.computed||triggerEffect(i)}function triggerEffect(n,e){(n!==activeEffect||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(isSymbol)),get=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const n={};return["includes","indexOf","lastIndexOf"].forEach(e=>{n[e]=function(...t){const i=toRaw(this);for(let s=0,a=this.length;s{n[e]=function(...t){pauseTracking();const i=toRaw(this)[e].apply(this,t);return resetTracking(),i}}),n}function createGetter(n=!1,e=!1){return function(i,r,s){if(r==="__v_isReactive")return!n;if(r==="__v_isReadonly")return n;if(r==="__v_isShallow")return e;if(r==="__v_raw"&&s===(n?e?shallowReadonlyMap:readonlyMap:e?shallowReactiveMap:reactiveMap).get(i))return i;const a=isArray$1(i);if(!n&&a&&hasOwn$1(arrayInstrumentations,r))return Reflect.get(arrayInstrumentations,r,s);const o=Reflect.get(i,r,s);return(isSymbol(r)?builtInSymbols.has(r):isNonTrackableKeys(r))||(n||track(i,"get",r),e)?o:isRef(o)?a&&isIntegerKey(r)?o:o.value:isObject$2(o)?n?readonly(o):reactive(o):o}}const set=createSetter(),shallowSet=createSetter(!0);function createSetter(n=!1){return function(t,i,r,s){let a=t[i];if(isReadonly(a)&&isRef(a)&&!isRef(r))return!1;if(!n&&(!isShallow(r)&&!isReadonly(r)&&(a=toRaw(a),r=toRaw(r)),!isArray$1(t)&&isRef(a)&&!isRef(r)))return a.value=r,!0;const o=isArray$1(t)&&isIntegerKey(i)?Number(i)n,getProto=n=>Reflect.getPrototypeOf(n);function get$1(n,e,t=!1,i=!1){n=n.__v_raw;const r=toRaw(n),s=toRaw(e);t||(e!==s&&track(r,"get",e),track(r,"get",s));const{has:a}=getProto(r),o=i?toShallow:t?toReadonly:toReactive;if(a.call(r,e))return o(n.get(e));if(a.call(r,s))return o(n.get(s));n!==r&&n.get(e)}function has$1(n,e=!1){const t=this.__v_raw,i=toRaw(t),r=toRaw(n);return e||(n!==r&&track(i,"has",n),track(i,"has",r)),n===r?t.has(n):t.has(n)||t.has(r)}function size(n,e=!1){return n=n.__v_raw,!e&&track(toRaw(n),"iterate",ITERATE_KEY),Reflect.get(n,"size",n)}function add(n){n=toRaw(n);const e=toRaw(this);return getProto(e).has.call(e,n)||(e.add(n),trigger(e,"add",n,n)),this}function set$1(n,e){e=toRaw(e);const t=toRaw(this),{has:i,get:r}=getProto(t);let s=i.call(t,n);s||(n=toRaw(n),s=i.call(t,n));const a=r.call(t,n);return t.set(n,e),s?hasChanged(e,a)&&trigger(t,"set",n,e):trigger(t,"add",n,e),this}function deleteEntry(n){const e=toRaw(this),{has:t,get:i}=getProto(e);let r=t.call(e,n);r||(n=toRaw(n),r=t.call(e,n)),i&&i.call(e,n);const s=e.delete(n);return r&&trigger(e,"delete",n,void 0),s}function clear(){const n=toRaw(this),e=n.size!==0,t=n.clear();return e&&trigger(n,"clear",void 0,void 0),t}function createForEach(n,e){return function(i,r){const s=this,a=s.__v_raw,o=toRaw(a),l=e?toShallow:n?toReadonly:toReactive;return!n&&track(o,"iterate",ITERATE_KEY),a.forEach((c,u)=>i.call(r,l(c),l(u),s))}}function createIterableMethod(n,e,t){return function(...i){const r=this.__v_raw,s=toRaw(r),a=isMap(s),o=n==="entries"||n===Symbol.iterator&&a,l=n==="keys"&&a,c=r[n](...i),u=t?toShallow:e?toReadonly:toReactive;return!e&&track(s,"iterate",l?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:d,done:f}=c.next();return f?{value:d,done:f}:{value:o?[u(d[0]),u(d[1])]:u(d),done:f}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(n){return function(...e){return n==="delete"?!1:this}}function createInstrumentations(){const n={get(s){return get$1(this,s)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!1)},e={get(s){return get$1(this,s,!1,!0)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!0)},t={get(s){return get$1(this,s,!0)},get size(){return size(this,!0)},has(s){return has$1.call(this,s,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},i={get(s){return get$1(this,s,!0,!0)},get size(){return size(this,!0)},has(s){return has$1.call(this,s,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=createIterableMethod(s,!1,!1),t[s]=createIterableMethod(s,!0,!1),e[s]=createIterableMethod(s,!1,!0),i[s]=createIterableMethod(s,!0,!0)}),[n,t,e,i]}const[mutableInstrumentations,readonlyInstrumentations,shallowInstrumentations,shallowReadonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(n,e){const t=e?n?shallowReadonlyInstrumentations:shallowInstrumentations:n?readonlyInstrumentations:mutableInstrumentations;return(i,r,s)=>r==="__v_isReactive"?!n:r==="__v_isReadonly"?n:r==="__v_raw"?i:Reflect.get(hasOwn$1(t,r)&&r in i?t:i,r,s)}const mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(n){return n.__v_skip||!Object.isExtensible(n)?0:targetTypeMap(toRawType(n))}function reactive(n){return isReadonly(n)?n:createReactiveObject(n,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(n){return createReactiveObject(n,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(n){return createReactiveObject(n,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(n,e,t,i,r){if(!isObject$2(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=r.get(n);if(s)return s;const a=getTargetType(n);if(a===0)return n;const o=new Proxy(n,a===2?i:t);return r.set(n,o),o}function isReactive(n){return isReadonly(n)?isReactive(n.__v_raw):!!(n&&n.__v_isReactive)}function isReadonly(n){return!!(n&&n.__v_isReadonly)}function isShallow(n){return!!(n&&n.__v_isShallow)}function isProxy(n){return isReactive(n)||isReadonly(n)}function toRaw(n){const e=n&&n.__v_raw;return e?toRaw(e):n}function markRaw(n){return def(n,"__v_skip",!0),n}const toReactive=n=>isObject$2(n)?reactive(n):n,toReadonly=n=>isObject$2(n)?readonly(n):n;function trackRefValue(n){shouldTrack&&activeEffect&&(n=toRaw(n),trackEffects(n.dep||(n.dep=createDep())))}function triggerRefValue(n,e){n=toRaw(n),n.dep&&triggerEffects(n.dep)}function isRef(n){return!!(n&&n.__v_isRef===!0)}function ref(n){return createRef(n,!1)}function shallowRef(n){return createRef(n,!0)}function createRef(n,e){return isRef(n)?n:new RefImpl(n,e)}class RefImpl{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e)}get value(){return trackRefValue(this),this._value}set value(e){const t=this.__v_isShallow||isShallow(e)||isReadonly(e);e=t?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:toReactive(e),triggerRefValue(this))}}function unref(n){return isRef(n)?n.value:n}const shallowUnwrapHandlers={get:(n,e,t)=>unref(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const r=n[e];return isRef(r)&&!isRef(t)?(r.value=t,!0):Reflect.set(n,e,t,i)}};function proxyRefs(n){return isReactive(n)?n:new Proxy(n,shallowUnwrapHandlers)}var _a;class ComputedRefImpl{constructor(e,t,i,r){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this[_a]=!1,this._dirty=!0,this.effect=new ReactiveEffect(e,()=>{this._dirty||(this._dirty=!0,triggerRefValue(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=i}get value(){const e=toRaw(this);return trackRefValue(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}_a="__v_isReadonly";function computed$1(n,e,t=!1){let i,r;const s=isFunction$1(n);return s?(i=n,r=NOOP):(i=n.get,r=n.set),new ComputedRefImpl(i,r,s||!r,t)}function warn$1(n,...e){}function callWithErrorHandling(n,e,t,i){let r;try{r=i?n(...i):n()}catch(s){handleError(s,e,t)}return r}function callWithAsyncErrorHandling(n,e,t,i){if(isFunction$1(n)){const s=callWithErrorHandling(n,e,t,i);return s&&isPromise$1(s)&&s.catch(a=>{handleError(a,e,t)}),s}const r=[];for(let s=0;s>>1;getId(queue[i])flushIndex&&queue.splice(e,1)}function queuePostFlushCb(n){isArray$1(n)?pendingPostFlushCbs.push(...n):(!activePostFlushCbs||!activePostFlushCbs.includes(n,n.allowRecurse?postFlushIndex+1:postFlushIndex))&&pendingPostFlushCbs.push(n),queueFlush()}function flushPreFlushCbs(n,e=isFlushing?flushIndex+1:0){for(;egetId(t)-getId(i)),postFlushIndex=0;postFlushIndexn.id==null?1/0:n.id,comparator=(n,e)=>{const t=getId(n)-getId(e);if(t===0){if(n.pre&&!e.pre)return-1;if(e.pre&&!n.pre)return 1}return t};function flushJobs(n){isFlushPending=!1,isFlushing=!0,queue.sort(comparator);try{for(flushIndex=0;flushIndexisString$2(m)?m.trim():m)),d&&(r=t.map(toNumber))}let o,l=i[o=toHandlerKey(e)]||i[o=toHandlerKey(camelize(e))];!l&&s&&(l=i[o=toHandlerKey(hyphenate(e))]),l&&callWithAsyncErrorHandling(l,n,6,r);const c=i[o+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[o])return;n.emitted[o]=!0,callWithAsyncErrorHandling(c,n,6,r)}}function normalizeEmitsOptions(n,e,t=!1){const i=e.emitsCache,r=i.get(n);if(r!==void 0)return r;const s=n.emits;let a={},o=!1;if(!isFunction$1(n)){const l=c=>{const u=normalizeEmitsOptions(c,e,!0);u&&(o=!0,extend(a,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!s&&!o?(isObject$2(n)&&i.set(n,null),null):(isArray$1(s)?s.forEach(l=>a[l]=null):extend(a,s),isObject$2(n)&&i.set(n,a),a)}function isEmitListener(n,e){return!n||!isOn(e)?!1:(e=e.slice(2).replace(/Once$/,""),hasOwn$1(n,e[0].toLowerCase()+e.slice(1))||hasOwn$1(n,hyphenate(e))||hasOwn$1(n,e))}let currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(n){const e=currentRenderingInstance;return currentRenderingInstance=n,currentScopeId=n&&n.type.__scopeId||null,e}function withCtx(n,e=currentRenderingInstance,t){if(!e||n._n)return n;const i=(...r)=>{i._d&&setBlockTracking(-1);const s=setCurrentRenderingInstance(e);let a;try{a=n(...r)}finally{setCurrentRenderingInstance(s),i._d&&setBlockTracking(1)}return a};return i._n=!0,i._c=!0,i._d=!0,i}function markAttrsAccessed(){}function renderComponentRoot(n){const{type:e,vnode:t,proxy:i,withProxy:r,props:s,propsOptions:[a],slots:o,attrs:l,emit:c,render:u,renderCache:d,data:f,setupState:m,ctx:v,inheritAttrs:_}=n;let g,x;const S=setCurrentRenderingInstance(n);try{if(t.shapeFlag&4){const b=r||i;g=normalizeVNode(u.call(b,b,d,s,m,f,v)),x=l}else{const b=e;g=normalizeVNode(b.length>1?b(s,{attrs:l,slots:o,emit:c}):b(s,null)),x=e.props?l:getFunctionalFallthrough(l)}}catch(b){blockStack.length=0,handleError(b,n,1),g=createVNode(Comment)}let y=g;if(x&&_!==!1){const b=Object.keys(x),{shapeFlag:w}=y;b.length&&w&7&&(a&&b.some(isModelListener)&&(x=filterModelListeners(x,a)),y=cloneVNode(y,x))}return t.dirs&&(y=cloneVNode(y),y.dirs=y.dirs?y.dirs.concat(t.dirs):t.dirs),t.transition&&(y.transition=t.transition),g=y,setCurrentRenderingInstance(S),g}const getFunctionalFallthrough=n=>{let e;for(const t in n)(t==="class"||t==="style"||isOn(t))&&((e||(e={}))[t]=n[t]);return e},filterModelListeners=(n,e)=>{const t={};for(const i in n)(!isModelListener(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function shouldUpdateComponent(n,e,t){const{props:i,children:r,component:s}=n,{props:a,children:o,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?hasPropsChanged(i,a,c):!!a;if(l&8){const u=e.dynamicProps;for(let d=0;dn.__isSuspense;function queueEffectWithSuspense(n,e){e&&e.pendingBranch?isArray$1(n)?e.effects.push(...n):e.effects.push(n):queuePostFlushCb(n)}function provide(n,e){if(currentInstance){let t=currentInstance.provides;const i=currentInstance.parent&¤tInstance.parent.provides;i===t&&(t=currentInstance.provides=Object.create(i)),t[n]=e}}function inject(n,e,t=!1){const i=currentInstance||currentRenderingInstance;if(i){const r=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(r&&n in r)return r[n];if(arguments.length>1)return t&&isFunction$1(e)?e.call(i.proxy):e}}const INITIAL_WATCHER_VALUE={};function watch(n,e,t){return doWatch(n,e,t)}function doWatch(n,e,{immediate:t,deep:i,flush:r,onTrack:s,onTrigger:a}=EMPTY_OBJ){const o=currentInstance;let l,c=!1,u=!1;if(isRef(n)?(l=()=>n.value,c=isShallow(n)):isReactive(n)?(l=()=>n,i=!0):isArray$1(n)?(u=!0,c=n.some(y=>isReactive(y)||isShallow(y)),l=()=>n.map(y=>{if(isRef(y))return y.value;if(isReactive(y))return traverse(y);if(isFunction$1(y))return callWithErrorHandling(y,o,2)})):isFunction$1(n)?e?l=()=>callWithErrorHandling(n,o,2):l=()=>{if(!(o&&o.isUnmounted))return d&&d(),callWithAsyncErrorHandling(n,o,3,[f])}:l=NOOP,e&&i){const y=l;l=()=>traverse(y())}let d,f=y=>{d=x.onStop=()=>{callWithErrorHandling(y,o,4)}},m;if(isInSSRComponentSetup)if(f=NOOP,e?t&&callWithAsyncErrorHandling(e,o,3,[l(),u?[]:void 0,f]):l(),r==="sync"){const y=useSSRContext();m=y.__watcherHandles||(y.__watcherHandles=[])}else return NOOP;let v=u?new Array(n.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE;const _=()=>{if(x.active)if(e){const y=x.run();(i||c||(u?y.some((b,w)=>hasChanged(b,v[w])):hasChanged(y,v)))&&(d&&d(),callWithAsyncErrorHandling(e,o,3,[y,v===INITIAL_WATCHER_VALUE?void 0:u&&v[0]===INITIAL_WATCHER_VALUE?[]:v,f]),v=y)}else x.run()};_.allowRecurse=!!e;let g;r==="sync"?g=_:r==="post"?g=()=>queuePostRenderEffect(_,o&&o.suspense):(_.pre=!0,o&&(_.id=o.uid),g=()=>queueJob(_));const x=new ReactiveEffect(l,g);e?t?_():v=x.run():r==="post"?queuePostRenderEffect(x.run.bind(x),o&&o.suspense):x.run();const S=()=>{x.stop(),o&&o.scope&&remove(o.scope.effects,x)};return m&&m.push(S),S}function instanceWatch(n,e,t){const i=this.proxy,r=isString$2(n)?n.includes(".")?createPathGetter(i,n):()=>i[n]:n.bind(i,i);let s;isFunction$1(e)?s=e:(s=e.handler,t=e);const a=currentInstance;setCurrentInstance(this);const o=doWatch(r,s.bind(i),t);return a?setCurrentInstance(a):unsetCurrentInstance(),o}function createPathGetter(n,e){const t=e.split(".");return()=>{let i=n;for(let r=0;r{traverse(t,e)});else if(isPlainObject$1(n))for(const t in n)traverse(n[t],e);return n}function useTransitionState(){const n={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{n.isMounted=!0}),onBeforeUnmount(()=>{n.isUnmounting=!0}),n}const TransitionHookValidator=[Function,Array],BaseTransitionImpl={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},setup(n,{slots:e}){const t=getCurrentInstance(),i=useTransitionState();let r;return()=>{const s=e.default&&getTransitionRawChildren(e.default(),!0);if(!s||!s.length)return;let a=s[0];if(s.length>1){for(const _ of s)if(_.type!==Comment){a=_;break}}const o=toRaw(n),{mode:l}=o;if(i.isLeaving)return emptyPlaceholder(a);const c=getKeepAliveChild(a);if(!c)return emptyPlaceholder(a);const u=resolveTransitionHooks(c,o,i,t);setTransitionHooks(c,u);const d=t.subTree,f=d&&getKeepAliveChild(d);let m=!1;const{getTransitionKey:v}=c.type;if(v){const _=v();r===void 0?r=_:_!==r&&(r=_,m=!0)}if(f&&f.type!==Comment&&(!isSameVNodeType(c,f)||m)){const _=resolveTransitionHooks(f,o,i,t);if(setTransitionHooks(f,_),l==="out-in")return i.isLeaving=!0,_.afterLeave=()=>{i.isLeaving=!1,t.update.active!==!1&&t.update()},emptyPlaceholder(a);l==="in-out"&&c.type!==Comment&&(_.delayLeave=(g,x,S)=>{const y=getLeavingNodesForType(i,f);y[String(f.key)]=f,g._leaveCb=()=>{x(),g._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=S})}return a}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function resolveTransitionHooks(n,e,t,i){const{appear:r,mode:s,persisted:a=!1,onBeforeEnter:o,onEnter:l,onAfterEnter:c,onEnterCancelled:u,onBeforeLeave:d,onLeave:f,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:_,onAppear:g,onAfterAppear:x,onAppearCancelled:S}=e,y=String(n.key),b=getLeavingNodesForType(t,n),w=(M,L)=>{M&&callWithAsyncErrorHandling(M,i,9,L)},C=(M,L)=>{const B=L[1];w(M,L),isArray$1(M)?M.every(Z=>Z.length<=1)&&B():M.length<=1&&B()},R={mode:s,persisted:a,beforeEnter(M){let L=o;if(!t.isMounted)if(r)L=_||o;else return;M._leaveCb&&M._leaveCb(!0);const B=b[y];B&&isSameVNodeType(n,B)&&B.el._leaveCb&&B.el._leaveCb(),w(L,[M])},enter(M){let L=l,B=c,Z=u;if(!t.isMounted)if(r)L=g||l,B=x||c,Z=S||u;else return;let q=!1;const X=M._enterCb=G=>{q||(q=!0,G?w(Z,[M]):w(B,[M]),R.delayedLeave&&R.delayedLeave(),M._enterCb=void 0)};L?C(L,[M,X]):X()},leave(M,L){const B=String(n.key);if(M._enterCb&&M._enterCb(!0),t.isUnmounting)return L();w(d,[M]);let Z=!1;const q=M._leaveCb=X=>{Z||(Z=!0,L(),X?w(v,[M]):w(m,[M]),M._leaveCb=void 0,b[B]===n&&delete b[B])};b[B]=n,f?C(f,[M,q]):q()},clone(M){return resolveTransitionHooks(M,e,t,i)}};return R}function emptyPlaceholder(n){if(isKeepAlive(n))return n=cloneVNode(n),n.children=null,n}function getKeepAliveChild(n){return isKeepAlive(n)?n.children?n.children[0]:void 0:n}function setTransitionHooks(n,e){n.shapeFlag&6&&n.component?setTransitionHooks(n.component.subTree,e):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function getTransitionRawChildren(n,e=!1,t){let i=[],r=0;for(let s=0;s1)for(let s=0;s!!n.type.__asyncLoader,isKeepAlive=n=>n.type.__isKeepAlive;function onActivated(n,e){registerKeepAliveHook(n,"a",e)}function onDeactivated(n,e){registerKeepAliveHook(n,"da",e)}function registerKeepAliveHook(n,e,t=currentInstance){const i=n.__wdc||(n.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return n()});if(injectHook(e,i,t),t){let r=t.parent;for(;r&&r.parent;)isKeepAlive(r.parent.vnode)&&injectToKeepAliveRoot(i,e,t,r),r=r.parent}}function injectToKeepAliveRoot(n,e,t,i){const r=injectHook(e,n,i,!0);onUnmounted(()=>{remove(i[e],r)},t)}function injectHook(n,e,t=currentInstance,i=!1){if(t){const r=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...a)=>{if(t.isUnmounted)return;pauseTracking(),setCurrentInstance(t);const o=callWithAsyncErrorHandling(e,t,n,a);return unsetCurrentInstance(),resetTracking(),o});return i?r.unshift(s):r.push(s),s}}const createHook=n=>(e,t=currentInstance)=>(!isInSSRComponentSetup||n==="sp")&&injectHook(n,(...i)=>e(...i),t),onBeforeMount=createHook("bm"),onMounted=createHook("m"),onBeforeUpdate=createHook("bu"),onUpdated=createHook("u"),onBeforeUnmount=createHook("bum"),onUnmounted=createHook("um"),onServerPrefetch=createHook("sp"),onRenderTriggered=createHook("rtg"),onRenderTracked=createHook("rtc");function onErrorCaptured(n,e=currentInstance){injectHook("ec",n,e)}function invokeDirectiveHook(n,e,t,i){const r=n.dirs,s=e&&e.dirs;for(let a=0;ae(a,o,void 0,s));else{const a=Object.keys(n);r=new Array(a.length);for(let o=0,l=a.length;oisVNode$1(e)?!(e.type===Comment||e.type===Fragment&&!ensureValidVNode(e.children)):!0)?n:null}const getPublicInstance=n=>n?isStatefulComponent(n)?getExposeProxy(n)||n.proxy:getPublicInstance(n.parent):null,publicPropertiesMap=extend(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>getPublicInstance(n.parent),$root:n=>getPublicInstance(n.root),$emit:n=>n.emit,$options:n=>resolveMergedOptions(n),$forceUpdate:n=>n.f||(n.f=()=>queueJob(n.update)),$nextTick:n=>n.n||(n.n=nextTick.bind(n.proxy)),$watch:n=>instanceWatch.bind(n)}),hasSetupBinding=(n,e)=>n!==EMPTY_OBJ&&!n.__isScriptSetup&&hasOwn$1(n,e),PublicInstanceProxyHandlers={get({_:n},e){const{ctx:t,setupState:i,data:r,props:s,accessCache:a,type:o,appContext:l}=n;let c;if(e[0]!=="$"){const m=a[e];if(m!==void 0)switch(m){case 1:return i[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(hasSetupBinding(i,e))return a[e]=1,i[e];if(r!==EMPTY_OBJ&&hasOwn$1(r,e))return a[e]=2,r[e];if((c=n.propsOptions[0])&&hasOwn$1(c,e))return a[e]=3,s[e];if(t!==EMPTY_OBJ&&hasOwn$1(t,e))return a[e]=4,t[e];shouldCacheAccess&&(a[e]=0)}}const u=publicPropertiesMap[e];let d,f;if(u)return e==="$attrs"&&track(n,"get",e),u(n);if((d=o.__cssModules)&&(d=d[e]))return d;if(t!==EMPTY_OBJ&&hasOwn$1(t,e))return a[e]=4,t[e];if(f=l.config.globalProperties,hasOwn$1(f,e))return f[e]},set({_:n},e,t){const{data:i,setupState:r,ctx:s}=n;return hasSetupBinding(r,e)?(r[e]=t,!0):i!==EMPTY_OBJ&&hasOwn$1(i,e)?(i[e]=t,!0):hasOwn$1(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:r,propsOptions:s}},a){let o;return!!t[a]||n!==EMPTY_OBJ&&hasOwn$1(n,a)||hasSetupBinding(e,a)||(o=s[0])&&hasOwn$1(o,a)||hasOwn$1(i,a)||hasOwn$1(publicPropertiesMap,a)||hasOwn$1(r.config.globalProperties,a)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:hasOwn$1(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};let shouldCacheAccess=!0;function applyOptions(n){const e=resolveMergedOptions(n),t=n.proxy,i=n.ctx;shouldCacheAccess=!1,e.beforeCreate&&callHook$1(e.beforeCreate,n,"bc");const{data:r,computed:s,methods:a,watch:o,provide:l,inject:c,created:u,beforeMount:d,mounted:f,beforeUpdate:m,updated:v,activated:_,deactivated:g,beforeDestroy:x,beforeUnmount:S,destroyed:y,unmounted:b,render:w,renderTracked:C,renderTriggered:R,errorCaptured:M,serverPrefetch:L,expose:B,inheritAttrs:Z,components:q,directives:X,filters:G}=e;if(c&&resolveInjections(c,i,null,n.appContext.config.unwrapInjectedRef),a)for(const ue in a){const ie=a[ue];isFunction$1(ie)&&(i[ue]=ie.bind(t))}if(r){const ue=r.call(t,t);isObject$2(ue)&&(n.data=reactive(ue))}if(shouldCacheAccess=!0,s)for(const ue in s){const ie=s[ue],ve=isFunction$1(ie)?ie.bind(t,t):isFunction$1(ie.get)?ie.get.bind(t,t):NOOP,_e=!isFunction$1(ie)&&isFunction$1(ie.set)?ie.set.bind(t):NOOP,Q=computed({get:ve,set:_e});Object.defineProperty(i,ue,{enumerable:!0,configurable:!0,get:()=>Q.value,set:ne=>Q.value=ne})}if(o)for(const ue in o)createWatcher(o[ue],i,t,ue);if(l){const ue=isFunction$1(l)?l.call(t):l;Reflect.ownKeys(ue).forEach(ie=>{provide(ie,ue[ie])})}u&&callHook$1(u,n,"c");function he(ue,ie){isArray$1(ie)?ie.forEach(ve=>ue(ve.bind(t))):ie&&ue(ie.bind(t))}if(he(onBeforeMount,d),he(onMounted,f),he(onBeforeUpdate,m),he(onUpdated,v),he(onActivated,_),he(onDeactivated,g),he(onErrorCaptured,M),he(onRenderTracked,C),he(onRenderTriggered,R),he(onBeforeUnmount,S),he(onUnmounted,b),he(onServerPrefetch,L),isArray$1(B))if(B.length){const ue=n.exposed||(n.exposed={});B.forEach(ie=>{Object.defineProperty(ue,ie,{get:()=>t[ie],set:ve=>t[ie]=ve})})}else n.exposed||(n.exposed={});w&&n.render===NOOP&&(n.render=w),Z!=null&&(n.inheritAttrs=Z),q&&(n.components=q),X&&(n.directives=X)}function resolveInjections(n,e,t=NOOP,i=!1){isArray$1(n)&&(n=normalizeInject(n));for(const r in n){const s=n[r];let a;isObject$2(s)?"default"in s?a=inject(s.from||r,s.default,!0):a=inject(s.from||r):a=inject(s),isRef(a)&&i?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:o=>a.value=o}):e[r]=a}}function callHook$1(n,e,t){callWithAsyncErrorHandling(isArray$1(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function createWatcher(n,e,t,i){const r=i.includes(".")?createPathGetter(t,i):()=>t[i];if(isString$2(n)){const s=e[n];isFunction$1(s)&&watch(r,s)}else if(isFunction$1(n))watch(r,n.bind(t));else if(isObject$2(n))if(isArray$1(n))n.forEach(s=>createWatcher(s,e,t,i));else{const s=isFunction$1(n.handler)?n.handler.bind(t):e[n.handler];isFunction$1(s)&&watch(r,s,n)}}function resolveMergedOptions(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=n.appContext,o=s.get(e);let l;return o?l=o:!r.length&&!t&&!i?l=e:(l={},r.length&&r.forEach(c=>mergeOptions(l,c,a,!0)),mergeOptions(l,e,a)),isObject$2(e)&&s.set(e,l),l}function mergeOptions(n,e,t,i=!1){const{mixins:r,extends:s}=e;s&&mergeOptions(n,s,t,!0),r&&r.forEach(a=>mergeOptions(n,a,t,!0));for(const a in e)if(!(i&&a==="expose")){const o=internalOptionMergeStrats[a]||t&&t[a];n[a]=o?o(n[a],e[a]):e[a]}return n}const internalOptionMergeStrats={data:mergeDataFn,props:mergeObjectOptions,emits:mergeObjectOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(n,e){return e?n?function(){return extend(isFunction$1(n)?n.call(this,this):n,isFunction$1(e)?e.call(this,this):e)}:e:n}function mergeInject(n,e){return mergeObjectOptions(normalizeInject(n),normalizeInject(e))}function normalizeInject(n){if(isArray$1(n)){const e={};for(let t=0;t0)&&!(a&16)){if(a&8){const u=n.vnode.dynamicProps;for(let d=0;d{l=!0;const[f,m]=normalizePropsOptions(d,e,!0);extend(a,f),m&&o.push(...m)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!s&&!l)return isObject$2(n)&&i.set(n,EMPTY_ARR),EMPTY_ARR;if(isArray$1(s))for(let u=0;u-1,m[1]=_<0||v<_,(v>-1||hasOwn$1(m,"default"))&&o.push(d)}}}const c=[a,o];return isObject$2(n)&&i.set(n,c),c}function validatePropName(n){return n[0]!=="$"}function getType(n){const e=n&&n.toString().match(/^\s*function (\w+)/);return e?e[1]:n===null?"null":""}function isSameType(n,e){return getType(n)===getType(e)}function getTypeIndex(n,e){return isArray$1(e)?e.findIndex(t=>isSameType(t,n)):isFunction$1(e)&&isSameType(e,n)?0:-1}const isInternalKey=n=>n[0]==="_"||n==="$stable",normalizeSlotValue=n=>isArray$1(n)?n.map(normalizeVNode):[normalizeVNode(n)],normalizeSlot=(n,e,t)=>{if(e._n)return e;const i=withCtx((...r)=>normalizeSlotValue(e(...r)),t);return i._c=!1,i},normalizeObjectSlots=(n,e,t)=>{const i=n._ctx;for(const r in n){if(isInternalKey(r))continue;const s=n[r];if(isFunction$1(s))e[r]=normalizeSlot(r,s,i);else if(s!=null){const a=normalizeSlotValue(s);e[r]=()=>a}}},normalizeVNodeSlots=(n,e)=>{const t=normalizeSlotValue(e);n.slots.default=()=>t},initSlots=(n,e)=>{if(n.vnode.shapeFlag&32){const t=e._;t?(n.slots=toRaw(e),def(e,"_",t)):normalizeObjectSlots(e,n.slots={})}else n.slots={},e&&normalizeVNodeSlots(n,e);def(n.slots,InternalObjectKey,1)},updateSlots=(n,e,t)=>{const{vnode:i,slots:r}=n;let s=!0,a=EMPTY_OBJ;if(i.shapeFlag&32){const o=e._;o?t&&o===1?s=!1:(extend(r,e),!t&&o===1&&delete r._):(s=!e.$stable,normalizeObjectSlots(e,r)),a=e}else e&&(normalizeVNodeSlots(n,e),a={default:1});if(s)for(const o in r)!isInternalKey(o)&&!(o in a)&&delete r[o]};function createAppContext(){return{app:null,config:{isNativeTag:NO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let uid=0;function createAppAPI(n,e){return function(i,r=null){isFunction$1(i)||(i=Object.assign({},i)),r!=null&&!isObject$2(r)&&(r=null);const s=createAppContext(),a=new Set;let o=!1;const l=s.app={_uid:uid++,_component:i,_props:r,_container:null,_context:s,_instance:null,version,get config(){return s.config},set config(c){},use(c,...u){return a.has(c)||(c&&isFunction$1(c.install)?(a.add(c),c.install(l,...u)):isFunction$1(c)&&(a.add(c),c(l,...u))),l},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),l},component(c,u){return u?(s.components[c]=u,l):s.components[c]},directive(c,u){return u?(s.directives[c]=u,l):s.directives[c]},mount(c,u,d){if(!o){const f=createVNode(i,r);return f.appContext=s,n(f,c,d),o=!0,l._container=c,c.__vue_app__=l,getExposeProxy(f.component)||f.component.proxy}},unmount(){o&&(n(null,l._container),delete l._container.__vue_app__)},provide(c,u){return s.provides[c]=u,l}};return l}}function setRef(n,e,t,i,r=!1){if(isArray$1(n)){n.forEach((f,m)=>setRef(f,e&&(isArray$1(e)?e[m]:e),t,i,r));return}if(isAsyncWrapper(i)&&!r)return;const s=i.shapeFlag&4?getExposeProxy(i.component)||i.component.proxy:i.el,a=r?null:s,{i:o,r:l}=n,c=e&&e.r,u=o.refs===EMPTY_OBJ?o.refs={}:o.refs,d=o.setupState;if(c!=null&&c!==l&&(isString$2(c)?(u[c]=null,hasOwn$1(d,c)&&(d[c]=null)):isRef(c)&&(c.value=null)),isFunction$1(l))callWithErrorHandling(l,o,12,[a,u]);else{const f=isString$2(l),m=isRef(l);if(f||m){const v=()=>{if(n.f){const _=f?hasOwn$1(d,l)?d[l]:u[l]:l.value;r?isArray$1(_)&&remove(_,s):isArray$1(_)?_.includes(s)||_.push(s):f?(u[l]=[s],hasOwn$1(d,l)&&(d[l]=u[l])):(l.value=[s],n.k&&(u[n.k]=l.value))}else f?(u[l]=a,hasOwn$1(d,l)&&(d[l]=a)):m&&(l.value=a,n.k&&(u[n.k]=a))};a?(v.id=-1,queuePostRenderEffect(v,t)):v()}}}const queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(n){return baseCreateRenderer(n)}function baseCreateRenderer(n,e){const t=getGlobalThis$1();t.__VUE__=!0;const{insert:i,remove:r,patchProp:s,createElement:a,createText:o,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:f,setScopeId:m=NOOP,insertStaticContent:v}=n,_=(O,D,k,H=null,j=null,Y=null,ce=!1,re=null,se=!!D.dynamicChildren)=>{if(O===D)return;O&&!isSameVNodeType(O,D)&&(H=Le(O),ne(O,j,Y,!0),O=null),D.patchFlag===-2&&(se=!1,D.dynamicChildren=null);const{type:P,ref:N,shapeFlag:T}=D;switch(P){case Text:g(O,D,k,H);break;case Comment:x(O,D,k,H);break;case Static:O==null&&S(D,k,H,ce);break;case Fragment:q(O,D,k,H,j,Y,ce,re,se);break;default:T&1?w(O,D,k,H,j,Y,ce,re,se):T&6?X(O,D,k,H,j,Y,ce,re,se):(T&64||T&128)&&P.process(O,D,k,H,j,Y,ce,re,se,Ce)}N!=null&&j&&setRef(N,O&&O.ref,Y,D||O,!D)},g=(O,D,k,H)=>{if(O==null)i(D.el=o(D.children),k,H);else{const j=D.el=O.el;D.children!==O.children&&c(j,D.children)}},x=(O,D,k,H)=>{O==null?i(D.el=l(D.children||""),k,H):D.el=O.el},S=(O,D,k,H)=>{[O.el,O.anchor]=v(O.children,D,k,H,O.el,O.anchor)},y=({el:O,anchor:D},k,H)=>{let j;for(;O&&O!==D;)j=f(O),i(O,k,H),O=j;i(D,k,H)},b=({el:O,anchor:D})=>{let k;for(;O&&O!==D;)k=f(O),r(O),O=k;r(D)},w=(O,D,k,H,j,Y,ce,re,se)=>{ce=ce||D.type==="svg",O==null?C(D,k,H,j,Y,ce,re,se):L(O,D,j,Y,ce,re,se)},C=(O,D,k,H,j,Y,ce,re)=>{let se,P;const{type:N,props:T,shapeFlag:E,transition:z,dirs:K}=O;if(se=O.el=a(O.type,Y,T&&T.is,T),E&8?u(se,O.children):E&16&&M(O.children,se,null,H,j,Y&&N!=="foreignObject",ce,re),K&&invokeDirectiveHook(O,null,H,"created"),T){for(const $ in T)$!=="value"&&!isReservedProp($)&&s(se,$,null,T[$],Y,O.children,H,j,ae);"value"in T&&s(se,"value",null,T.value),(P=T.onVnodeBeforeMount)&&invokeVNodeHook(P,H,O)}R(se,O,O.scopeId,ce,H),K&&invokeDirectiveHook(O,null,H,"beforeMount");const V=(!j||j&&!j.pendingBranch)&&z&&!z.persisted;V&&z.beforeEnter(se),i(se,D,k),((P=T&&T.onVnodeMounted)||V||K)&&queuePostRenderEffect(()=>{P&&invokeVNodeHook(P,H,O),V&&z.enter(se),K&&invokeDirectiveHook(O,null,H,"mounted")},j)},R=(O,D,k,H,j)=>{if(k&&m(O,k),H)for(let Y=0;Y{for(let P=se;P{const re=D.el=O.el;let{patchFlag:se,dynamicChildren:P,dirs:N}=D;se|=O.patchFlag&16;const T=O.props||EMPTY_OBJ,E=D.props||EMPTY_OBJ;let z;k&&toggleRecurse(k,!1),(z=E.onVnodeBeforeUpdate)&&invokeVNodeHook(z,k,D,O),N&&invokeDirectiveHook(D,O,k,"beforeUpdate"),k&&toggleRecurse(k,!0);const K=j&&D.type!=="foreignObject";if(P?B(O.dynamicChildren,P,re,k,H,K,Y):ce||ie(O,D,re,null,k,H,K,Y,!1),se>0){if(se&16)Z(re,D,T,E,k,H,j);else if(se&2&&T.class!==E.class&&s(re,"class",null,E.class,j),se&4&&s(re,"style",T.style,E.style,j),se&8){const V=D.dynamicProps;for(let $=0;${z&&invokeVNodeHook(z,k,D,O),N&&invokeDirectiveHook(D,O,k,"updated")},H)},B=(O,D,k,H,j,Y,ce)=>{for(let re=0;re{if(k!==H){if(k!==EMPTY_OBJ)for(const re in k)!isReservedProp(re)&&!(re in H)&&s(O,re,k[re],null,ce,D.children,j,Y,ae);for(const re in H){if(isReservedProp(re))continue;const se=H[re],P=k[re];se!==P&&re!=="value"&&s(O,re,P,se,ce,D.children,j,Y,ae)}"value"in H&&s(O,"value",k.value,H.value)}},q=(O,D,k,H,j,Y,ce,re,se)=>{const P=D.el=O?O.el:o(""),N=D.anchor=O?O.anchor:o("");let{patchFlag:T,dynamicChildren:E,slotScopeIds:z}=D;z&&(re=re?re.concat(z):z),O==null?(i(P,k,H),i(N,k,H),M(D.children,k,N,j,Y,ce,re,se)):T>0&&T&64&&E&&O.dynamicChildren?(B(O.dynamicChildren,E,k,j,Y,ce,re),(D.key!=null||j&&D===j.subTree)&&traverseStaticChildren(O,D,!0)):ie(O,D,k,N,j,Y,ce,re,se)},X=(O,D,k,H,j,Y,ce,re,se)=>{D.slotScopeIds=re,O==null?D.shapeFlag&512?j.ctx.activate(D,k,H,ce,se):G(D,k,H,j,Y,ce,se):le(O,D,se)},G=(O,D,k,H,j,Y,ce)=>{const re=O.component=createComponentInstance(O,H,j);if(isKeepAlive(O)&&(re.ctx.renderer=Ce),setupComponent(re),re.asyncDep){if(j&&j.registerDep(re,he),!O.el){const se=re.subTree=createVNode(Comment);x(null,se,D,k)}return}he(re,O,D,k,j,Y,ce)},le=(O,D,k)=>{const H=D.component=O.component;if(shouldUpdateComponent(O,D,k))if(H.asyncDep&&!H.asyncResolved){ue(H,D,k);return}else H.next=D,invalidateJob(H.update),H.update();else D.el=O.el,H.vnode=D},he=(O,D,k,H,j,Y,ce)=>{const re=()=>{if(O.isMounted){let{next:N,bu:T,u:E,parent:z,vnode:K}=O,V=N,$;toggleRecurse(O,!1),N?(N.el=K.el,ue(O,N,ce)):N=K,T&&invokeArrayFns(T),($=N.props&&N.props.onVnodeBeforeUpdate)&&invokeVNodeHook($,z,N,K),toggleRecurse(O,!0);const be=renderComponentRoot(O),ge=O.subTree;O.subTree=be,_(ge,be,d(ge.el),Le(ge),O,j,Y),N.el=be.el,V===null&&updateHOCHostEl(O,be.el),E&&queuePostRenderEffect(E,j),($=N.props&&N.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook($,z,N,K),j)}else{let N;const{el:T,props:E}=D,{bm:z,m:K,parent:V}=O,$=isAsyncWrapper(D);toggleRecurse(O,!1),z&&invokeArrayFns(z),!$&&(N=E&&E.onVnodeBeforeMount)&&invokeVNodeHook(N,V,D),toggleRecurse(O,!0);{const be=O.subTree=renderComponentRoot(O);_(null,be,k,H,O,j,Y),D.el=be.el}if(K&&queuePostRenderEffect(K,j),!$&&(N=E&&E.onVnodeMounted)){const be=D;queuePostRenderEffect(()=>invokeVNodeHook(N,V,be),j)}(D.shapeFlag&256||V&&isAsyncWrapper(V.vnode)&&V.vnode.shapeFlag&256)&&O.a&&queuePostRenderEffect(O.a,j),O.isMounted=!0,D=k=H=null}},se=O.effect=new ReactiveEffect(re,()=>queueJob(P),O.scope),P=O.update=()=>se.run();P.id=O.uid,toggleRecurse(O,!0),P()},ue=(O,D,k)=>{D.component=O;const H=O.vnode.props;O.vnode=D,O.next=null,updateProps(O,D.props,H,k),updateSlots(O,D.children,k),pauseTracking(),flushPreFlushCbs(),resetTracking()},ie=(O,D,k,H,j,Y,ce,re,se=!1)=>{const P=O&&O.children,N=O?O.shapeFlag:0,T=D.children,{patchFlag:E,shapeFlag:z}=D;if(E>0){if(E&128){_e(P,T,k,H,j,Y,ce,re,se);return}else if(E&256){ve(P,T,k,H,j,Y,ce,re,se);return}}z&8?(N&16&&ae(P,j,Y),T!==P&&u(k,T)):N&16?z&16?_e(P,T,k,H,j,Y,ce,re,se):ae(P,j,Y,!0):(N&8&&u(k,""),z&16&&M(T,k,H,j,Y,ce,re,se))},ve=(O,D,k,H,j,Y,ce,re,se)=>{O=O||EMPTY_ARR,D=D||EMPTY_ARR;const P=O.length,N=D.length,T=Math.min(P,N);let E;for(E=0;EN?ae(O,j,Y,!0,!1,T):M(D,k,H,j,Y,ce,re,se,T)},_e=(O,D,k,H,j,Y,ce,re,se)=>{let P=0;const N=D.length;let T=O.length-1,E=N-1;for(;P<=T&&P<=E;){const z=O[P],K=D[P]=se?cloneIfMounted(D[P]):normalizeVNode(D[P]);if(isSameVNodeType(z,K))_(z,K,k,null,j,Y,ce,re,se);else break;P++}for(;P<=T&&P<=E;){const z=O[T],K=D[E]=se?cloneIfMounted(D[E]):normalizeVNode(D[E]);if(isSameVNodeType(z,K))_(z,K,k,null,j,Y,ce,re,se);else break;T--,E--}if(P>T){if(P<=E){const z=E+1,K=zE)for(;P<=T;)ne(O[P],j,Y,!0),P++;else{const z=P,K=P,V=new Map;for(P=K;P<=E;P++){const Re=D[P]=se?cloneIfMounted(D[P]):normalizeVNode(D[P]);Re.key!=null&&V.set(Re.key,P)}let $,be=0;const ge=E-K+1;let oe=!1,Ie=0;const Ne=new Array(ge);for(P=0;P=ge){ne(Re,j,Y,!0);continue}let De;if(Re.key!=null)De=V.get(Re.key);else for($=K;$<=E;$++)if(Ne[$-K]===0&&isSameVNodeType(Re,D[$])){De=$;break}De===void 0?ne(Re,j,Y,!0):(Ne[De-K]=P+1,De>=Ie?Ie=De:oe=!0,_(Re,D[De],k,null,j,Y,ce,re,se),be++)}const Fe=oe?getSequence(Ne):EMPTY_ARR;for($=Fe.length-1,P=ge-1;P>=0;P--){const Re=K+P,De=D[Re],We=Re+1{const{el:Y,type:ce,transition:re,children:se,shapeFlag:P}=O;if(P&6){Q(O.component.subTree,D,k,H);return}if(P&128){O.suspense.move(D,k,H);return}if(P&64){ce.move(O,D,k,Ce);return}if(ce===Fragment){i(Y,D,k);for(let T=0;Tre.enter(Y),j);else{const{leave:T,delayLeave:E,afterLeave:z}=re,K=()=>i(Y,D,k),V=()=>{T(Y,()=>{K(),z&&z()})};E?E(Y,K,V):V()}else i(Y,D,k)},ne=(O,D,k,H=!1,j=!1)=>{const{type:Y,props:ce,ref:re,children:se,dynamicChildren:P,shapeFlag:N,patchFlag:T,dirs:E}=O;if(re!=null&&setRef(re,null,k,O,!0),N&256){D.ctx.deactivate(O);return}const z=N&1&&E,K=!isAsyncWrapper(O);let V;if(K&&(V=ce&&ce.onVnodeBeforeUnmount)&&invokeVNodeHook(V,D,O),N&6)Te(O.component,k,H);else{if(N&128){O.suspense.unmount(k,H);return}z&&invokeDirectiveHook(O,null,D,"beforeUnmount"),N&64?O.type.remove(O,D,k,j,Ce,H):P&&(Y!==Fragment||T>0&&T&64)?ae(P,D,k,!1,!0):(Y===Fragment&&T&384||!j&&N&16)&&ae(se,D,k),H&&ye(O)}(K&&(V=ce&&ce.onVnodeUnmounted)||z)&&queuePostRenderEffect(()=>{V&&invokeVNodeHook(V,D,O),z&&invokeDirectiveHook(O,null,D,"unmounted")},k)},ye=O=>{const{type:D,el:k,anchor:H,transition:j}=O;if(D===Fragment){Me(k,H);return}if(D===Static){b(O);return}const Y=()=>{r(k),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(O.shapeFlag&1&&j&&!j.persisted){const{leave:ce,delayLeave:re}=j,se=()=>ce(k,Y);re?re(O.el,Y,se):se()}else Y()},Me=(O,D)=>{let k;for(;O!==D;)k=f(O),r(O),O=k;r(D)},Te=(O,D,k)=>{const{bum:H,scope:j,update:Y,subTree:ce,um:re}=O;H&&invokeArrayFns(H),j.stop(),Y&&(Y.active=!1,ne(ce,O,D,k)),re&&queuePostRenderEffect(re,D),queuePostRenderEffect(()=>{O.isUnmounted=!0},D),D&&D.pendingBranch&&!D.isUnmounted&&O.asyncDep&&!O.asyncResolved&&O.suspenseId===D.pendingId&&(D.deps--,D.deps===0&&D.resolve())},ae=(O,D,k,H=!1,j=!1,Y=0)=>{for(let ce=Y;ceO.shapeFlag&6?Le(O.component.subTree):O.shapeFlag&128?O.suspense.next():f(O.anchor||O.el),Ee=(O,D,k)=>{O==null?D._vnode&&ne(D._vnode,null,null,!0):_(D._vnode||null,O,D,null,null,null,k),flushPreFlushCbs(),flushPostFlushCbs(),D._vnode=O},Ce={p:_,um:ne,m:Q,r:ye,mt:G,mc:M,pc:ie,pbc:B,n:Le,o:n};return{render:Ee,hydrate:void 0,createApp:createAppAPI(Ee)}}function toggleRecurse({effect:n,update:e},t){n.allowRecurse=e.allowRecurse=t}function traverseStaticChildren(n,e,t=!1){const i=n.children,r=e.children;if(isArray$1(i)&&isArray$1(r))for(let s=0;s>1,n[t[o]]0&&(e[i]=t[s-1]),t[s]=i)}}for(s=t.length,a=t[s-1];s-- >0;)t[s]=a,a=e[a];return t}const isTeleport=n=>n.__isTeleport,Fragment=Symbol(void 0),Text=Symbol(void 0),Comment=Symbol(void 0),Static=Symbol(void 0),blockStack=[];let currentBlock=null;function openBlock(n=!1){blockStack.push(currentBlock=n?null:[])}function closeBlock(){blockStack.pop(),currentBlock=blockStack[blockStack.length-1]||null}let isBlockTreeEnabled=1;function setBlockTracking(n){isBlockTreeEnabled+=n}function setupBlock(n){return n.dynamicChildren=isBlockTreeEnabled>0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(n),n}function createElementBlock(n,e,t,i,r,s){return setupBlock(createBaseVNode(n,e,t,i,r,s,!0))}function createBlock(n,e,t,i,r){return setupBlock(createVNode(n,e,t,i,r,!0))}function isVNode$1(n){return n?n.__v_isVNode===!0:!1}function isSameVNodeType(n,e){return n.type===e.type&&n.key===e.key}const InternalObjectKey="__vInternal",normalizeKey=({key:n})=>n??null,normalizeRef=({ref:n,ref_key:e,ref_for:t})=>n!=null?isString$2(n)||isRef(n)||isFunction$1(n)?{i:currentRenderingInstance,r:n,k:e,f:!!t}:n:null;function createBaseVNode(n,e=null,t=null,i=0,r=null,s=n===Fragment?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&normalizeKey(e),ref:e&&normalizeRef(e),scopeId:currentScopeId,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return o?(normalizeChildren(l,t),s&128&&n.normalize(l)):t&&(l.shapeFlag|=isString$2(t)?8:16),isBlockTreeEnabled>0&&!a&¤tBlock&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&¤tBlock.push(l),l}const createVNode=_createVNode;function _createVNode(n,e=null,t=null,i=0,r=null,s=!1){if((!n||n===NULL_DYNAMIC_COMPONENT)&&(n=Comment),isVNode$1(n)){const o=cloneVNode(n,e,!0);return t&&normalizeChildren(o,t),isBlockTreeEnabled>0&&!s&¤tBlock&&(o.shapeFlag&6?currentBlock[currentBlock.indexOf(n)]=o:currentBlock.push(o)),o.patchFlag|=-2,o}if(isClassComponent(n)&&(n=n.__vccOpts),e){e=guardReactiveProps(e);let{class:o,style:l}=e;o&&!isString$2(o)&&(e.class=normalizeClass(o)),isObject$2(l)&&(isProxy(l)&&!isArray$1(l)&&(l=extend({},l)),e.style=normalizeStyle(l))}const a=isString$2(n)?1:isSuspense(n)?128:isTeleport(n)?64:isObject$2(n)?4:isFunction$1(n)?2:0;return createBaseVNode(n,e,t,i,r,a,s,!0)}function guardReactiveProps(n){return n?isProxy(n)||InternalObjectKey in n?extend({},n):n:null}function cloneVNode(n,e,t=!1){const{props:i,ref:r,patchFlag:s,children:a}=n,o=e?mergeProps(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:n.type,props:o,key:o&&normalizeKey(o),ref:e&&e.ref?t&&r?isArray$1(r)?r.concat(normalizeRef(e)):[r,normalizeRef(e)]:normalizeRef(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Fragment?s===-1?16:s|16:s,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:n.transition,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&cloneVNode(n.ssContent),ssFallback:n.ssFallback&&cloneVNode(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx}}function createTextVNode(n=" ",e=0){return createVNode(Text,null,n,e)}function createStaticVNode(n,e){const t=createVNode(Static,null,n);return t.staticCount=e,t}function createCommentVNode(n="",e=!1){return e?(openBlock(),createBlock(Comment,null,n)):createVNode(Comment,null,n)}function normalizeVNode(n){return n==null||typeof n=="boolean"?createVNode(Comment):isArray$1(n)?createVNode(Fragment,null,n.slice()):typeof n=="object"?cloneIfMounted(n):createVNode(Text,null,String(n))}function cloneIfMounted(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:cloneVNode(n)}function normalizeChildren(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(isArray$1(e))t=16;else if(typeof e=="object")if(i&65){const r=e.default;r&&(r._c&&(r._d=!1),normalizeChildren(n,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!(InternalObjectKey in e)?e._ctx=currentRenderingInstance:r===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else isFunction$1(e)?(e={default:e,_ctx:currentRenderingInstance},t=32):(e=String(e),i&64?(t=16,e=[createTextVNode(e)]):t=8);n.children=e,n.shapeFlag|=t}function mergeProps(...n){const e={};for(let t=0;tcurrentInstance||currentRenderingInstance,setCurrentInstance=n=>{currentInstance=n,n.scope.on()},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),currentInstance=null};function isStatefulComponent(n){return n.vnode.shapeFlag&4}let isInSSRComponentSetup=!1;function setupComponent(n,e=!1){isInSSRComponentSetup=e;const{props:t,children:i}=n.vnode,r=isStatefulComponent(n);initProps(n,t,r,e),initSlots(n,i);const s=r?setupStatefulComponent(n,e):void 0;return isInSSRComponentSetup=!1,s}function setupStatefulComponent(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=markRaw(new Proxy(n.ctx,PublicInstanceProxyHandlers));const{setup:i}=t;if(i){const r=n.setupContext=i.length>1?createSetupContext(n):null;setCurrentInstance(n),pauseTracking();const s=callWithErrorHandling(i,n,0,[n.props,r]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(s)){if(s.then(unsetCurrentInstance,unsetCurrentInstance),e)return s.then(a=>{handleSetupResult(n,a)}).catch(a=>{handleError(a,n,0)});n.asyncDep=s}else handleSetupResult(n,s)}else finishComponentSetup(n)}function handleSetupResult(n,e,t){isFunction$1(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:isObject$2(e)&&(n.setupState=proxyRefs(e)),finishComponentSetup(n)}function finishComponentSetup(n,e,t){const i=n.type;n.render||(n.render=i.render||NOOP),setCurrentInstance(n),pauseTracking(),applyOptions(n),resetTracking(),unsetCurrentInstance()}function createAttrsProxy(n){return new Proxy(n.attrs,{get(e,t){return track(n,"get","$attrs"),e[t]}})}function createSetupContext(n){const e=i=>{n.exposed=i||{}};let t;return{get attrs(){return t||(t=createAttrsProxy(n))},slots:n.slots,emit:n.emit,expose:e}}function getExposeProxy(n){if(n.exposed)return n.exposeProxy||(n.exposeProxy=new Proxy(proxyRefs(markRaw(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in publicPropertiesMap)return publicPropertiesMap[t](n)},has(e,t){return t in e||t in publicPropertiesMap}}))}function getComponentName(n,e=!0){return isFunction$1(n)?n.displayName||n.name:n.name||e&&n.__name}function isClassComponent(n){return isFunction$1(n)&&"__vccOpts"in n}const computed=(n,e)=>computed$1(n,e,isInSSRComponentSetup);function h(n,e,t){const i=arguments.length;return i===2?isObject$2(e)&&!isArray$1(e)?isVNode$1(e)?createVNode(n,null,[e]):createVNode(n,e):createVNode(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&isVNode$1(t)&&(t=[t]),createVNode(n,e,t))}const ssrContextKey=Symbol(""),useSSRContext=()=>inject(ssrContextKey),version="3.2.45",svgNS="http://www.w3.org/2000/svg",doc=typeof document<"u"?document:null,templateContainer=doc&&doc.createElement("template"),nodeOps={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const r=e?doc.createElementNS(svgNS,n):doc.createElement(n,t?{is:t}:void 0);return n==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:n=>doc.createTextNode(n),createComment:n=>doc.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>doc.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,r,s){const a=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{templateContainer.innerHTML=i?`${n}`:n;const o=templateContainer.content;if(i){const l=o.firstChild;for(;l.firstChild;)o.appendChild(l.firstChild);o.removeChild(l)}e.insertBefore(o,t)}return[a?a.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function patchClass(n,e,t){const i=n._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}function patchStyle(n,e,t){const i=n.style,r=isString$2(t);if(t&&!r){for(const s in t)setStyle(i,s,t[s]);if(e&&!isString$2(e))for(const s in e)t[s]==null&&setStyle(i,s,"")}else{const s=i.display;r?e!==t&&(i.cssText=t):e&&n.removeAttribute("style"),"_vod"in n&&(i.display=s)}}const importantRE=/\s*!important$/;function setStyle(n,e,t){if(isArray$1(t))t.forEach(i=>setStyle(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=autoPrefix(n,e);importantRE.test(t)?n.setProperty(hyphenate(i),t.replace(importantRE,""),"important"):n[i]=t}}const prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(n,e){const t=prefixCache[e];if(t)return t;let i=camelize(e);if(i!=="filter"&&i in n)return prefixCache[e]=i;i=capitalize$1(i);for(let r=0;rcachedNow||(p.then(()=>cachedNow=0),cachedNow=Date.now());function createInvoker(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(i,t.value),e,5,[i])};return t.value=n,t.attached=getNow(),t}function patchStopImmediatePropagation(n,e){if(isArray$1(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>r=>!r._stopped&&i&&i(r))}else return e}const nativeOnRE=/^on[a-z]/,patchProp=(n,e,t,i,r=!1,s,a,o,l)=>{e==="class"?patchClass(n,i,r):e==="style"?patchStyle(n,t,i):isOn(e)?isModelListener(e)||patchEvent(n,e,t,i,a):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):shouldSetAsProp(n,e,i,r))?patchDOMProp(n,e,i,s,a,o,l):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),patchAttr(n,e,i,r))};function shouldSetAsProp(n,e,t,i){return i?!!(e==="innerHTML"||e==="textContent"||e in n&&nativeOnRE.test(e)&&isFunction$1(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA"||nativeOnRE.test(e)&&isString$2(t)?!1:e in n}const TRANSITION="transition",ANIMATION="animation",Transition=(n,{slots:e})=>h(BaseTransition,resolveTransitionProps(n),e);Transition.displayName="Transition";const DOMTransitionPropsValidators={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Transition.props=extend({},BaseTransition.props,DOMTransitionPropsValidators);const callHook=(n,e=[])=>{isArray$1(n)?n.forEach(t=>t(...e)):n&&n(...e)},hasExplicitCallback=n=>n?isArray$1(n)?n.some(e=>e.length>1):n.length>1:!1;function resolveTransitionProps(n){const e={};for(const q in n)q in DOMTransitionPropsValidators||(e[q]=n[q]);if(n.css===!1)return e;const{name:t="v",type:i,duration:r,enterFromClass:s=`${t}-enter-from`,enterActiveClass:a=`${t}-enter-active`,enterToClass:o=`${t}-enter-to`,appearFromClass:l=s,appearActiveClass:c=a,appearToClass:u=o,leaveFromClass:d=`${t}-leave-from`,leaveActiveClass:f=`${t}-leave-active`,leaveToClass:m=`${t}-leave-to`}=n,v=normalizeDuration(r),_=v&&v[0],g=v&&v[1],{onBeforeEnter:x,onEnter:S,onEnterCancelled:y,onLeave:b,onLeaveCancelled:w,onBeforeAppear:C=x,onAppear:R=S,onAppearCancelled:M=y}=e,L=(q,X,G)=>{removeTransitionClass(q,X?u:o),removeTransitionClass(q,X?c:a),G&&G()},B=(q,X)=>{q._isLeaving=!1,removeTransitionClass(q,d),removeTransitionClass(q,m),removeTransitionClass(q,f),X&&X()},Z=q=>(X,G)=>{const le=q?R:S,he=()=>L(X,q,G);callHook(le,[X,he]),nextFrame(()=>{removeTransitionClass(X,q?l:s),addTransitionClass(X,q?u:o),hasExplicitCallback(le)||whenTransitionEnds(X,i,_,he)})};return extend(e,{onBeforeEnter(q){callHook(x,[q]),addTransitionClass(q,s),addTransitionClass(q,a)},onBeforeAppear(q){callHook(C,[q]),addTransitionClass(q,l),addTransitionClass(q,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave(q,X){q._isLeaving=!0;const G=()=>B(q,X);addTransitionClass(q,d),forceReflow(),addTransitionClass(q,f),nextFrame(()=>{q._isLeaving&&(removeTransitionClass(q,d),addTransitionClass(q,m),hasExplicitCallback(b)||whenTransitionEnds(q,i,g,G))}),callHook(b,[q,G])},onEnterCancelled(q){L(q,!1),callHook(y,[q])},onAppearCancelled(q){L(q,!0),callHook(M,[q])},onLeaveCancelled(q){B(q),callHook(w,[q])}})}function normalizeDuration(n){if(n==null)return null;if(isObject$2(n))return[NumberOf(n.enter),NumberOf(n.leave)];{const e=NumberOf(n);return[e,e]}}function NumberOf(n){return toNumber(n)}function addTransitionClass(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n._vtc||(n._vtc=new Set)).add(e)}function removeTransitionClass(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const{_vtc:t}=n;t&&(t.delete(e),t.size||(n._vtc=void 0))}function nextFrame(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let endId=0;function whenTransitionEnds(n,e,t,i){const r=n._endId=++endId,s=()=>{r===n._endId&&i()};if(t)return setTimeout(s,t);const{type:a,timeout:o,propCount:l}=getTransitionInfo(n,e);if(!a)return i();const c=a+"end";let u=0;const d=()=>{n.removeEventListener(c,f),s()},f=m=>{m.target===n&&++u>=l&&d()};setTimeout(()=>{u(t[v]||"").split(", "),r=i(`${TRANSITION}Delay`),s=i(`${TRANSITION}Duration`),a=getTimeout(r,s),o=i(`${ANIMATION}Delay`),l=i(`${ANIMATION}Duration`),c=getTimeout(o,l);let u=null,d=0,f=0;e===TRANSITION?a>0&&(u=TRANSITION,d=a,f=s.length):e===ANIMATION?c>0&&(u=ANIMATION,d=c,f=l.length):(d=Math.max(a,c),u=d>0?a>c?TRANSITION:ANIMATION:null,f=u?u===TRANSITION?s.length:l.length:0);const m=u===TRANSITION&&/\b(transform|all)(,|$)/.test(i(`${TRANSITION}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:m}}function getTimeout(n,e){for(;n.lengthtoMs(t)+toMs(n[i])))}function toMs(n){return Number(n.slice(0,-1).replace(",","."))*1e3}function forceReflow(){return document.body.offsetHeight}const rendererOptions=extend({patchProp},nodeOps);let renderer;function ensureRenderer(){return renderer||(renderer=createRenderer(rendererOptions))}const createApp=(...n)=>{const e=ensureRenderer().createApp(...n),{mount:t}=e;return e.mount=i=>{const r=normalizeContainer(i);if(!r)return;const s=e._component;!isFunction$1(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.innerHTML="";const a=t(r,!1,r instanceof SVGElement);return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},e};function normalizeContainer(n){return isString$2(n)?document.querySelector(n):n}const _export_sfc=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},_sfc_main$o={name:"NumberInput",props:{label:String,value:Number},computed:{format(){return n=>Math.floor(n)}}},_hoisted_1$l={class:"number-input"},_hoisted_2$f={class:"label"},_hoisted_3$e=["value"];function _sfc_render$o(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$l,[createBaseVNode("label",null,[createBaseVNode("span",_hoisted_2$f,toDisplayString$1(t.label)+":",1),createBaseVNode("input",{type:"number",value:s.format(t.value),onInput:e[0]||(e[0]=a=>n.$emit("input",a)),onKeydown:e[1]||(e[1]=a=>a.stopPropagation())},null,40,_hoisted_3$e)])])}const NumberInput=_export_sfc(_sfc_main$o,[["render",_sfc_render$o]]),_sfc_main$n={name:"PositionInput",components:{NumberInput},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data,appState:this.$bluemap.appState}}},_hoisted_1$k={class:"position-input"};function _sfc_render$n(n,e,t,i,r,s){const a=resolveComponent("NumberInput");return openBlock(),createElementBlock("div",_hoisted_1$k,[createVNode(a,{label:"x",value:r.controls.position.x,onInput:e[0]||(e[0]=o=>{r.controls.position.x=parseFloat(o.target.value)})},null,8,["value"]),r.appState.controls.state==="free"?(openBlock(),createBlock(a,{key:0,label:"y",value:r.controls.position.y,onInput:e[1]||(e[1]=o=>{r.controls.position.y=parseFloat(o.target.value)})},null,8,["value"])):createCommentVNode("",!0),createVNode(a,{label:"z",value:r.controls.position.z,onInput:e[2]||(e[2]=o=>{r.controls.position.z=parseFloat(o.target.value)})},null,8,["value"])])}const PositionInput=_export_sfc(_sfc_main$n,[["render",_sfc_render$n]]);/** + * @license + * Copyright 2010-2022 Three.js Authors + * SPDX-License-Identifier: MIT + */const REVISION="147",MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},CullFaceNone=0,CullFaceBack=1,CullFaceFront=2,CullFaceFrontBack=3,BasicShadowMap=0,PCFShadowMap=1,PCFSoftShadowMap=2,VSMShadowMap=3,FrontSide=0,BackSide=1,DoubleSide=2,NoBlending=0,NormalBlending=1,AdditiveBlending=2,SubtractiveBlending=3,MultiplyBlending=4,CustomBlending=5,AddEquation=100,SubtractEquation=101,ReverseSubtractEquation=102,MinEquation=103,MaxEquation=104,ZeroFactor=200,OneFactor=201,SrcColorFactor=202,OneMinusSrcColorFactor=203,SrcAlphaFactor=204,OneMinusSrcAlphaFactor=205,DstAlphaFactor=206,OneMinusDstAlphaFactor=207,DstColorFactor=208,OneMinusDstColorFactor=209,SrcAlphaSaturateFactor=210,NeverDepth=0,AlwaysDepth=1,LessDepth=2,LessEqualDepth=3,EqualDepth=4,GreaterEqualDepth=5,GreaterDepth=6,NotEqualDepth=7,MultiplyOperation=0,MixOperation=1,AddOperation=2,NoToneMapping=0,LinearToneMapping=1,ReinhardToneMapping=2,CineonToneMapping=3,ACESFilmicToneMapping=4,CustomToneMapping=5,UVMapping=300,CubeReflectionMapping=301,CubeRefractionMapping=302,EquirectangularReflectionMapping=303,EquirectangularRefractionMapping=304,CubeUVReflectionMapping=306,RepeatWrapping=1e3,ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004,NearestMipMapNearestFilter=1004,NearestMipmapLinearFilter=1005,NearestMipMapLinearFilter=1005,LinearFilter=1006,LinearMipmapNearestFilter=1007,LinearMipMapNearestFilter=1007,LinearMipmapLinearFilter=1008,LinearMipMapLinearFilter=1008,UnsignedByteType=1009,ByteType=1010,ShortType=1011,UnsignedShortType=1012,IntType=1013,UnsignedIntType=1014,FloatType=1015,HalfFloatType=1016,UnsignedShort4444Type=1017,UnsignedShort5551Type=1018,UnsignedInt248Type=1020,AlphaFormat=1021,RGBFormat=1022,RGBAFormat=1023,LuminanceFormat=1024,LuminanceAlphaFormat=1025,DepthFormat=1026,DepthStencilFormat=1027,RedFormat=1028,RedIntegerFormat=1029,RGFormat=1030,RGIntegerFormat=1031,RGBAIntegerFormat=1033,RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT1_Format=33777,RGBA_S3TC_DXT3_Format=33778,RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGB_PVRTC_2BPPV1_Format=35841,RGBA_PVRTC_4BPPV1_Format=35842,RGBA_PVRTC_2BPPV1_Format=35843,RGB_ETC1_Format=36196,RGB_ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,RGBA_ASTC_4x4_Format=37808,RGBA_ASTC_5x4_Format=37809,RGBA_ASTC_5x5_Format=37810,RGBA_ASTC_6x5_Format=37811,RGBA_ASTC_6x6_Format=37812,RGBA_ASTC_8x5_Format=37813,RGBA_ASTC_8x6_Format=37814,RGBA_ASTC_8x8_Format=37815,RGBA_ASTC_10x5_Format=37816,RGBA_ASTC_10x6_Format=37817,RGBA_ASTC_10x8_Format=37818,RGBA_ASTC_10x10_Format=37819,RGBA_ASTC_12x10_Format=37820,RGBA_ASTC_12x12_Format=37821,RGBA_BPTC_Format=36492,LoopOnce=2200,LoopRepeat=2201,LoopPingPong=2202,InterpolateDiscrete=2300,InterpolateLinear=2301,InterpolateSmooth=2302,ZeroCurvatureEnding=2400,ZeroSlopeEnding=2401,WrapAroundEnding=2402,NormalAnimationBlendMode=2500,AdditiveAnimationBlendMode=2501,TrianglesDrawMode=0,TriangleStripDrawMode=1,TriangleFanDrawMode=2,LinearEncoding=3e3,sRGBEncoding=3001,BasicDepthPacking=3200,RGBADepthPacking=3201,TangentSpaceNormalMap=0,ObjectSpaceNormalMap=1,NoColorSpace="",SRGBColorSpace="srgb",LinearSRGBColorSpace="srgb-linear",ZeroStencilOp=0,KeepStencilOp=7680,ReplaceStencilOp=7681,IncrementStencilOp=7682,DecrementStencilOp=7683,IncrementWrapStencilOp=34055,DecrementWrapStencilOp=34056,InvertStencilOp=5386,NeverStencilFunc=512,LessStencilFunc=513,EqualStencilFunc=514,LessEqualStencilFunc=515,GreaterStencilFunc=516,NotEqualStencilFunc=517,GreaterEqualStencilFunc=518,AlwaysStencilFunc=519,StaticDrawUsage=35044,DynamicDrawUsage=35048,StreamDrawUsage=35040,StaticReadUsage=35045,DynamicReadUsage=35049,StreamReadUsage=35041,StaticCopyUsage=35046,DynamicCopyUsage=35050,StreamCopyUsage=35042,GLSL1="100",GLSL3="300 es",_SRGBAFormat=1035;class EventDispatcher{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s>8&255]+_lut[n>>16&255]+_lut[n>>24&255]+"-"+_lut[e&255]+_lut[e>>8&255]+"-"+_lut[e>>16&15|64]+_lut[e>>24&255]+"-"+_lut[t&63|128]+_lut[t>>8&255]+"-"+_lut[t>>16&255]+_lut[t>>24&255]+_lut[i&255]+_lut[i>>8&255]+_lut[i>>16&255]+_lut[i>>24&255]).toLowerCase()}function clamp(n,e,t){return Math.max(e,Math.min(t,n))}function euclideanModulo(n,e){return(n%e+e)%e}function mapLinear(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function inverseLerp(n,e,t){return n!==e?(t-n)/(e-n):0}function lerp(n,e,t){return(1-t)*n+t*e}function damp(n,e,t,i){return lerp(n,e,1-Math.exp(-t*i))}function pingpong(n,e=1){return e-Math.abs(euclideanModulo(n,e*2)-e)}function smoothstep(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function smootherstep(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function randInt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function randFloat(n,e){return n+Math.random()*(e-n)}function randFloatSpread(n){return n*(.5-Math.random())}function seededRandom(n){n!==void 0&&(_seed=n);let e=_seed+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function degToRad(n){return n*DEG2RAD$1}function radToDeg(n){return n*RAD2DEG}function isPowerOfTwo(n){return(n&n-1)===0&&n!==0}function ceilPowerOfTwo(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function floorPowerOfTwo(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function setQuaternionFromProperEuler(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),d=s((e-i)/2),f=a((e-i)/2),m=s((i-e)/2),v=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*d,l*f,o*c);break;case"YZY":n.set(l*f,o*u,l*d,o*c);break;case"ZXZ":n.set(l*d,l*f,o*u,o*c);break;case"XZX":n.set(o*u,l*v,l*m,o*c);break;case"YXY":n.set(l*m,o*u,l*v,o*c);break;case"ZYZ":n.set(l*v,l*m,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function denormalize(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function normalize(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var MathUtils=Object.freeze({__proto__:null,DEG2RAD:DEG2RAD$1,RAD2DEG,generateUUID,clamp,euclideanModulo,mapLinear,inverseLerp,lerp,damp,pingpong,smoothstep,smootherstep,randInt,randFloat,randFloatSpread,seededRandom,degToRad,radToDeg,isPowerOfTwo,ceilPowerOfTwo,floorPowerOfTwo,setQuaternionFromProperEuler,normalize,denormalize});class Vector2{constructor(e=0,t=0){Vector2.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],d=i[7],f=i[2],m=i[5],v=i[8],_=r[0],g=r[3],x=r[6],S=r[1],y=r[4],b=r[7],w=r[2],C=r[5],R=r[8];return s[0]=a*_+o*S+l*w,s[3]=a*g+o*y+l*C,s[6]=a*x+o*b+l*R,s[1]=c*_+u*S+d*w,s[4]=c*g+u*y+d*C,s[7]=c*x+u*b+d*R,s[2]=f*_+m*S+v*w,s[5]=f*g+m*y+v*C,s[8]=f*x+m*b+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,f=o*l-u*s,m=c*s-a*l,v=t*d+i*f+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/v;return e[0]=d*_,e[1]=(r*c-u*i)*_,e[2]=(o*i-r*a)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=m*_,e[7]=(i*l-c*t)*_,e[8]=(a*t-i*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(_m3.makeScale(e,t)),this}rotate(e){return this.premultiply(_m3.makeRotation(-e)),this}translate(e,t){return this.premultiply(_m3.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const _m3=new Matrix3;function arrayNeedsUint32(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const TYPED_ARRAYS={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function getTypedArray(n,e){return new TYPED_ARRAYS[n](e)}function createElementNS(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function SRGBToLinear(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function LinearToSRGB(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const FN={[SRGBColorSpace]:{[LinearSRGBColorSpace]:SRGBToLinear},[LinearSRGBColorSpace]:{[SRGBColorSpace]:LinearToSRGB}},ColorManagement={legacyMode:!0,get workingColorSpace(){return LinearSRGBColorSpace},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(FN[e]&&FN[e][t]!==void 0){const i=FN[e][t];return n.r=i(n.r),n.g=i(n.g),n.b=i(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},_colorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_rgb$1={r:0,g:0,b:0},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function toComponents(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Color{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=SRGBColorSpace){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ColorManagement.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=ColorManagement.workingColorSpace){return this.r=e,this.g=t,this.b=i,ColorManagement.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=ColorManagement.workingColorSpace){if(e=euclideanModulo(e,1),t=clamp(t,0,1),i=clamp(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=hue2rgb(a,s,e+1/3),this.g=hue2rgb(a,s,e),this.b=hue2rgb(a,s,e-1/3)}return ColorManagement.toWorkingColorSpace(this,r),this}setStyle(e,t=SRGBColorSpace){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,ColorManagement.toWorkingColorSpace(this,t),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,ColorManagement.toWorkingColorSpace(this,t),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return i(s[4]),this.setHSL(l,c,u,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,ColorManagement.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,ColorManagement.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=SRGBColorSpace){const i=_colorKeywords[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=SRGBColorSpace){return ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),e),clamp(_rgb$1.r*255,0,255)<<16^clamp(_rgb$1.g*255,0,255)<<8^clamp(_rgb$1.b*255,0,255)<<0}getHexString(e=SRGBColorSpace){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ColorManagement.workingColorSpace){ColorManagement.fromWorkingColorSpace(toComponents(this,_rgb$1),t);const i=_rgb$1.r,r=_rgb$1.g,s=_rgb$1.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case i:l=(r-s)/d+(r"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{_canvas===void 0&&(_canvas=createElementNS("canvas")),_canvas.width=e.width,_canvas.height=e.height;const i=_canvas.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=_canvas}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=createElementNS("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a1)switch(this.wrapS){case RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case MirroredRepeatWrapping:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case MirroredRepeatWrapping:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}Texture.DEFAULT_IMAGE=null;Texture.DEFAULT_MAPPING=UVMapping;Texture.DEFAULT_ANISOTROPY=1;class Vector4{constructor(e=0,t=0,i=0,r=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],f=l[1],m=l[5],v=l[9],_=l[2],g=l[6],x=l[10];if(Math.abs(u-f)<.01&&Math.abs(d-_)<.01&&Math.abs(v-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+_)<.1&&Math.abs(v+g)<.1&&Math.abs(c+m+x-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,b=(m+1)/2,w=(x+1)/2,C=(u+f)/4,R=(d+_)/4,M=(v+g)/4;return y>b&&y>w?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=C/i,s=R/i):b>w?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=C/r,s=M/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=R/s,r=M/s),this.set(i,r,s,t),this}let S=Math.sqrt((g-v)*(g-v)+(d-_)*(d-_)+(f-u)*(f-u));return Math.abs(S)<.001&&(S=1),this.x=(g-v)/S,this.y=(d-_)/S,this.z=(f-u)/S,this.w=Math.acos((c+m+x-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class WebGLRenderTarget extends EventDispatcher{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new Texture(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:LinearFilter,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class DataArrayTexture extends Texture{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WebGLArrayRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new DataArrayTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class Data3DTexture extends Texture{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class WebGL3DRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Data3DTexture(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a=0?1:-1,y=1-x*x;if(y>Number.EPSILON){const w=Math.sqrt(y),C=Math.atan2(w,x*S);g=Math.sin(g*C)/w,o=Math.sin(o*C)/w}const b=o*S;if(l=l*g+f*b,c=c*g+m*b,u=u*g+v*b,d=d*g+_*b,g===1-o){const w=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=w,c*=w,u*=w,d*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],d=s[a],f=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+u*d+l*m-c*f,e[t+1]=l*v+u*f+c*d-o*m,e[t+2]=c*v+u*m+o*f-l*d,e[t+3]=u*v-o*d-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),d=o(s/2),f=l(i/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=f*u*d+c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d-f*m*v;break;case"YXZ":this._x=f*u*d+c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d+f*m*v;break;case"ZXY":this._x=f*u*d-c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d-f*m*v;break;case"ZYX":this._x=f*u*d-c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d+f*m*v;break;case"YZX":this._x=f*u*d+c*m*v,this._y=c*m*d+f*u*v,this._z=c*u*v-f*m*d,this._w=c*u*d-f*m*v;break;case"XZY":this._x=f*u*d-c*m*v,this._y=c*m*d-f*u*v,this._z=c*u*v+f*m*d,this._w=c*u*d+f*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],f=i+o+d;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(i>o&&i>d){const m=2*Math.sqrt(1+i-o-d);this._w=(u-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>d){const m=2*Math.sqrt(1+o-i-d);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+d-i-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*d+this._w*f,this._x=i*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3{constructor(e=0,t=0,i=0){Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(_quaternion$4.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(_quaternion$4.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,u=l*i+o*t-s*r,d=l*r+s*i-a*t,f=-s*t-a*i-o*r;return this.x=c*l+f*-s+u*-o-d*-a,this.y=u*l+f*-a+d*-s-c*-o,this.z=d*l+f*-o+c*-a-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return _vector$c.copy(this).projectOnVector(e),this.sub(_vector$c)}reflect(e){return this.sub(_vector$c.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(clamp(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const _vector$c=new Vector3,_quaternion$4=new Quaternion;class Box3{constructor(e=new Vector3(1/0,1/0,1/0),t=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.length;ls&&(s=u),d>a&&(a=d),f>o&&(o=f)}return this.min.set(t,i,r),this.max.set(s,a,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.count;ls&&(s=u),d>a&&(a=d),f>o&&(o=f)}return this.min.set(t,i,r),this.max.set(s,a,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,_vector$b),_vector$b.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max,_center),_v0$2.subVectors(e.a,_center),_v1$7.subVectors(e.b,_center),_v2$4.subVectors(e.c,_center),_f0.subVectors(_v1$7,_v0$2),_f1.subVectors(_v2$4,_v1$7),_f2.subVectors(_v0$2,_v2$4);let t=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0.z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2.x,0];return!satForAxes(t,_v0$2,_v1$7,_v2$4,_extents)||(t=[1,0,0,0,1,0,0,0,1],!satForAxes(t,_v0$2,_v1$7,_v2$4,_extents))?!1:(_triangleNormal.crossVectors(_f0,_f1),t=[_triangleNormal.x,_triangleNormal.y,_triangleNormal.z],satForAxes(t,_v0$2,_v1$7,_v2$4,_extents))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return _vector$b.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(_vector$b).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_points),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _points=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],_vector$b=new Vector3,_box$3=new Box3,_v0$2=new Vector3,_v1$7=new Vector3,_v2$4=new Vector3,_f0=new Vector3,_f1=new Vector3,_f2=new Vector3,_center=new Vector3,_extents=new Vector3,_triangleNormal=new Vector3,_testAxis=new Vector3;function satForAxes(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_testAxis.fromArray(n,s);const o=r.x*Math.abs(_testAxis.x)+r.y*Math.abs(_testAxis.y)+r.z*Math.abs(_testAxis.z),l=e.dot(_testAxis),c=t.dot(_testAxis),u=i.dot(_testAxis);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const _box$2=new Box3,_v1$6=new Vector3,_v2$3=new Vector3;class Sphere{constructor(e=new Vector3,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):_box$2.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_v1$6.subVectors(e,this.center);const t=_v1$6.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(_v1$6,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(_v2$3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_v1$6.copy(e.center).add(_v2$3)),this.expandByPoint(_v1$6.copy(e.center).sub(_v2$3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const _vector$a=new Vector3,_segCenter=new Vector3,_segDir=new Vector3,_diff=new Vector3,_edge1=new Vector3,_edge2=new Vector3,_normal$1=new Vector3;class Ray{constructor(e=new Vector3,t=new Vector3(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,_vector$a)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=_vector$a.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_vector$a.copy(this.direction).multiplyScalar(t).add(this.origin),_vector$a.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){_segCenter.copy(e).add(t).multiplyScalar(.5),_segDir.copy(t).sub(e).normalize(),_diff.copy(this.origin).sub(_segCenter);const s=e.distanceTo(t)*.5,a=-this.direction.dot(_segDir),o=_diff.dot(this.direction),l=-_diff.dot(_segDir),c=_diff.lengthSq(),u=Math.abs(1-a*a);let d,f,m,v;if(u>0)if(d=a*l-o,f=a*o-l,v=s*u,d>=0)if(f>=-v)if(f<=v){const _=1/u;d*=_,f*=_,m=d*(d+a*f+2*o)+f*(a*d+f+2*l)+c}else f=s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f<=-v?(d=Math.max(0,-(-a*s+o)),f=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c):f<=v?(d=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(d=Math.max(0,-(a*s+o)),f=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c);else f=a>0?-s:s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;return i&&i.copy(this.direction).multiplyScalar(d).add(this.origin),r&&r.copy(_segDir).multiplyScalar(f).add(_segCenter),m}intersectSphere(e,t){_vector$a.subVectors(e.center,this.origin);const i=_vector$a.dot(this.direction),r=_vector$a.dot(_vector$a)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return o<0&&l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a=0?(o=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(o=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),i>l||o>r)||((o>i||i!==i)&&(i=o),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,_vector$a)!==null}intersectTriangle(e,t,i,r,s){_edge1.subVectors(t,e),_edge2.subVectors(i,e),_normal$1.crossVectors(_edge1,_edge2);let a=this.direction.dot(_normal$1),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;_diff.subVectors(this.origin,e);const l=o*this.direction.dot(_edge2.crossVectors(_diff,_edge2));if(l<0)return null;const c=o*this.direction.dot(_edge1.cross(_diff));if(c<0||l+c>a)return null;const u=-o*_diff.dot(_normal$1);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Matrix4{constructor(){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,s,a,o,l,c,u,d,f,m,v,_,g){const x=this.elements;return x[0]=e,x[4]=t,x[8]=i,x[12]=r,x[1]=s,x[5]=a,x[9]=o,x[13]=l,x[2]=c,x[6]=u,x[10]=d,x[14]=f,x[3]=m,x[7]=v,x[11]=_,x[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Matrix4().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/_v1$5.setFromMatrixColumn(e,0).length(),s=1/_v1$5.setFromMatrixColumn(e,1).length(),a=1/_v1$5.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=a*u,m=a*d,v=o*u,_=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,m=l*d,v=c*u,_=c*d;t[0]=f+_*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=m*o-v,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,m=l*d,v=c*u,_=c*d;t[0]=f-_*o,t[4]=-a*d,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,m=a*d,v=o*u,_=o*d;t[0]=l*u,t[4]=v*c-m,t[8]=f*c+_,t[1]=l*d,t[5]=_*c+f,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,m=a*c,v=o*l,_=o*c;t[0]=l*u,t[4]=_-f*d,t[8]=v*d+m,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=m*d+v,t[10]=f-_*d}else if(e.order==="XZY"){const f=a*l,m=a*c,v=o*l,_=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=f*d+_,t[5]=a*u,t[9]=m*d-v,t[2]=v*d-m,t[6]=o*u,t[10]=_*d+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_zero,e,_one)}lookAt(e,t,i){const r=this.elements;return _z.subVectors(e,t),_z.lengthSq()===0&&(_z.z=1),_z.normalize(),_x.crossVectors(i,_z),_x.lengthSq()===0&&(Math.abs(i.z)===1?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(),_x.crossVectors(i,_z)),_x.normalize(),_y.crossVectors(_z,_x),r[0]=_x.x,r[4]=_y.x,r[8]=_z.x,r[1]=_x.y,r[5]=_y.y,r[9]=_z.y,r[2]=_x.z,r[6]=_y.z,r[10]=_z.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],d=i[5],f=i[9],m=i[13],v=i[2],_=i[6],g=i[10],x=i[14],S=i[3],y=i[7],b=i[11],w=i[15],C=r[0],R=r[4],M=r[8],L=r[12],B=r[1],Z=r[5],q=r[9],X=r[13],G=r[2],le=r[6],he=r[10],ue=r[14],ie=r[3],ve=r[7],_e=r[11],Q=r[15];return s[0]=a*C+o*B+l*G+c*ie,s[4]=a*R+o*Z+l*le+c*ve,s[8]=a*M+o*q+l*he+c*_e,s[12]=a*L+o*X+l*ue+c*Q,s[1]=u*C+d*B+f*G+m*ie,s[5]=u*R+d*Z+f*le+m*ve,s[9]=u*M+d*q+f*he+m*_e,s[13]=u*L+d*X+f*ue+m*Q,s[2]=v*C+_*B+g*G+x*ie,s[6]=v*R+_*Z+g*le+x*ve,s[10]=v*M+_*q+g*he+x*_e,s[14]=v*L+_*X+g*ue+x*Q,s[3]=S*C+y*B+b*G+w*ie,s[7]=S*R+y*Z+b*le+w*ve,s[11]=S*M+y*q+b*he+w*_e,s[15]=S*L+y*X+b*ue+w*Q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],f=e[10],m=e[14],v=e[3],_=e[7],g=e[11],x=e[15];return v*(+s*l*d-r*c*d-s*o*f+i*c*f+r*o*m-i*l*m)+_*(+t*l*m-t*c*f+s*a*f-r*a*m+r*c*u-s*l*u)+g*(+t*c*d-t*o*m-s*a*d+i*a*m+s*o*u-i*c*u)+x*(-r*o*u-t*l*d+t*o*f+r*a*d-i*a*f+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],f=e[10],m=e[11],v=e[12],_=e[13],g=e[14],x=e[15],S=d*g*c-_*f*c+_*l*m-o*g*m-d*l*x+o*f*x,y=v*f*c-u*g*c-v*l*m+a*g*m+u*l*x-a*f*x,b=u*_*c-v*d*c+v*o*m-a*_*m-u*o*x+a*d*x,w=v*d*l-u*_*l-v*o*f+a*_*f+u*o*g-a*d*g,C=t*S+i*y+r*b+s*w;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/C;return e[0]=S*R,e[1]=(_*f*s-d*g*s-_*r*m+i*g*m+d*r*x-i*f*x)*R,e[2]=(o*g*s-_*l*s+_*r*c-i*g*c-o*r*x+i*l*x)*R,e[3]=(d*l*s-o*f*s-d*r*c+i*f*c+o*r*m-i*l*m)*R,e[4]=y*R,e[5]=(u*g*s-v*f*s+v*r*m-t*g*m-u*r*x+t*f*x)*R,e[6]=(v*l*s-a*g*s-v*r*c+t*g*c+a*r*x-t*l*x)*R,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*m+t*l*m)*R,e[8]=b*R,e[9]=(v*d*s-u*_*s-v*i*m+t*_*m+u*i*x-t*d*x)*R,e[10]=(a*_*s-v*o*s+v*i*c-t*_*c-a*i*x+t*o*x)*R,e[11]=(u*o*s-a*d*s-u*i*c+t*d*c+a*i*m-t*o*m)*R,e[12]=w*R,e[13]=(u*_*r-v*d*r+v*i*f-t*_*f-u*i*g+t*d*g)*R,e[14]=(v*o*r-a*_*r-v*i*l+t*_*l+a*i*g-t*o*g)*R,e[15]=(a*d*r-u*o*r+u*i*l-t*d*l-a*i*f+t*o*f)*R,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,f=s*c,m=s*u,v=s*d,_=a*u,g=a*d,x=o*d,S=l*c,y=l*u,b=l*d,w=i.x,C=i.y,R=i.z;return r[0]=(1-(_+x))*w,r[1]=(m+b)*w,r[2]=(v-y)*w,r[3]=0,r[4]=(m-b)*C,r[5]=(1-(f+x))*C,r[6]=(g+S)*C,r[7]=0,r[8]=(v+y)*R,r[9]=(g-S)*R,r[10]=(1-(f+_))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=_v1$5.set(r[0],r[1],r[2]).length();const a=_v1$5.set(r[4],r[5],r[6]).length(),o=_v1$5.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],_m1$2.copy(this);const c=1/s,u=1/a,d=1/o;return _m1$2.elements[0]*=c,_m1$2.elements[1]*=c,_m1$2.elements[2]*=c,_m1$2.elements[4]*=u,_m1$2.elements[5]*=u,_m1$2.elements[6]*=u,_m1$2.elements[8]*=d,_m1$2.elements[9]*=d,_m1$2.elements[10]*=d,t.setFromRotationMatrix(_m1$2),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a){const o=this.elements,l=2*s/(t-e),c=2*s/(i-r),u=(t+e)/(t-e),d=(i+r)/(i-r),f=-(a+s)/(a-s),m=-2*a*s/(a-s);return o[0]=l,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,r,s,a){const o=this.elements,l=1/(t-e),c=1/(i-r),u=1/(a-s),d=(t+e)*l,f=(i+r)*c,m=(a+s)*u;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const _v1$5=new Vector3,_m1$2=new Matrix4,_zero=new Vector3(0,0,0),_one=new Vector3(1,1,1),_x=new Vector3,_y=new Vector3,_z=new Vector3,_matrix$1=new Matrix4,_quaternion$3=new Quaternion;class Euler{constructor(e=0,t=0,i=0,r=Euler.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],d=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(clamp(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-clamp(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(clamp(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-clamp(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return _matrix$1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(_matrix$1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _quaternion$3.setFromEuler(this),this.setFromQuaternion(_quaternion$3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Euler.DefaultOrder="XYZ";Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Layers{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),v.length>0&&(i.nodes=v)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){_v0$1.subVectors(r,t),_v1$3.subVectors(i,t),_v2$2.subVectors(e,t);const a=_v0$1.dot(_v0$1),o=_v0$1.dot(_v1$3),l=_v0$1.dot(_v2$2),c=_v1$3.dot(_v1$3),u=_v1$3.dot(_v2$2),d=a*c-o*o;if(d===0)return s.set(-2,-1,-1);const f=1/d,m=(c*l-o*u)*f,v=(a*u-o*l)*f;return s.set(1-m-v,v,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,_v3$1),_v3$1.x>=0&&_v3$1.y>=0&&_v3$1.x+_v3$1.y<=1}static getUV(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,_v3$1),l.set(0,0),l.addScaledVector(s,_v3$1.x),l.addScaledVector(a,_v3$1.y),l.addScaledVector(o,_v3$1.z),l}static isFrontFacing(e,t,i,r){return _v0$1.subVectors(i,t),_v1$3.subVectors(e,t),_v0$1.cross(_v1$3).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _v0$1.subVectors(this.c,this.b),_v1$3.subVectors(this.a,this.b),_v0$1.cross(_v1$3).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Triangle.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;_vab.subVectors(r,i),_vac.subVectors(s,i),_vap.subVectors(e,i);const l=_vab.dot(_vap),c=_vac.dot(_vap);if(l<=0&&c<=0)return t.copy(i);_vbp.subVectors(e,r);const u=_vab.dot(_vbp),d=_vac.dot(_vbp);if(u>=0&&d<=u)return t.copy(r);const f=l*d-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(_vab,a);_vcp.subVectors(e,s);const m=_vab.dot(_vcp),v=_vac.dot(_vcp);if(v>=0&&m<=v)return t.copy(s);const _=m*c-l*v;if(_<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(i).addScaledVector(_vac,o);const g=u*v-m*d;if(g<=0&&d-u>=0&&m-v>=0)return _vbc.subVectors(s,r),o=(d-u)/(d-u+(m-v)),t.copy(r).addScaledVector(_vbc,o);const x=1/(g+_+f);return a=_*x,o=f*x,t.copy(i).addScaledVector(_vab,a).addScaledVector(_vac,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let materialId=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:materialId++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=NormalBlending,this.side=FrontSide,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=SrcAlphaFactor,this.blendDst=OneMinusSrcAlphaFactor,this.blendEquation=AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=AlwaysStencilFunc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=KeepStencilOp,this.stencilZFail=KeepStencilOp,this.stencilZPass=KeepStencilOp,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==NormalBlending&&(i.blending=this.blending),this.side!==FrontSide&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class MeshBasicMaterial extends Material{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const _vector$9=new Vector3,_vector2$1=new Vector2;class BufferAttribute{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=StaticDrawUsage,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,f=c.length;d0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let f=0,m=d.length;f0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;st.far?null:{distance:c,point:_intersectionPointWorld.clone(),object:n}}function checkBufferGeometryIntersection(n,e,t,i,r,s,a,o,l,c,u,d){_vA$1.fromBufferAttribute(r,c),_vB$1.fromBufferAttribute(r,u),_vC$1.fromBufferAttribute(r,d);const f=n.morphTargetInfluences;if(s&&f){_morphA.set(0,0,0),_morphB.set(0,0,0),_morphC.set(0,0,0);for(let v=0,_=s.length;v<_;v++){const g=f[v],x=s[v];g!==0&&(_tempA.fromBufferAttribute(x,c),_tempB.fromBufferAttribute(x,u),_tempC.fromBufferAttribute(x,d),a?(_morphA.addScaledVector(_tempA,g),_morphB.addScaledVector(_tempB,g),_morphC.addScaledVector(_tempC,g)):(_morphA.addScaledVector(_tempA.sub(_vA$1),g),_morphB.addScaledVector(_tempB.sub(_vB$1),g),_morphC.addScaledVector(_tempC.sub(_vC$1),g)))}_vA$1.add(_morphA),_vB$1.add(_morphB),_vC$1.add(_morphC)}n.isSkinnedMesh&&(n.boneTransform(c,_vA$1),n.boneTransform(u,_vB$1),n.boneTransform(d,_vC$1));const m=checkIntersection(n,e,t,i,_vA$1,_vB$1,_vC$1,_intersectionPoint);if(m){o&&(_uvA$1.fromBufferAttribute(o,c),_uvB$1.fromBufferAttribute(o,u),_uvC$1.fromBufferAttribute(o,d),m.uv=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2)),l&&(_uvA$1.fromBufferAttribute(l,c),_uvB$1.fromBufferAttribute(l,u),_uvC$1.fromBufferAttribute(l,d),m.uv2=Triangle.getUV(_intersectionPoint,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector2));const v={a:c,b:u,c:d,normal:new Vector3,materialIndex:0};Triangle.getNormal(_vA$1,_vB$1,_vC$1,v.normal),m.face=v}return m}class BoxGeometry extends BufferGeometry{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let f=0,m=0;v("z","y","x",-1,-1,i,t,e,a,s,0),v("z","y","x",1,-1,i,t,-e,a,s,1),v("x","z","y",1,1,e,i,t,r,a,2),v("x","z","y",1,-1,e,i,-t,r,a,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Float32BufferAttribute(c,3)),this.setAttribute("normal",new Float32BufferAttribute(u,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2));function v(_,g,x,S,y,b,w,C,R,M,L){const B=b/R,Z=w/M,q=b/2,X=w/2,G=C/2,le=R+1,he=M+1;let ue=0,ie=0;const ve=new Vector3;for(let _e=0;_e0?1:-1,u.push(ve.x,ve.y,ve.z),d.push(ne/R),d.push(1-_e/M),ue+=1}}for(let _e=0;_e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class PerspectiveCamera extends Camera{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(DEG2RAD$1*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return RAD2DEG*2*Math.atan(Math.tan(DEG2RAD$1*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(DEG2RAD$1*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const fov=-90,aspect=1;class CubeCamera extends Object3D{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const r=new PerspectiveCamera(fov,aspect,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);const s=new PerspectiveCamera(fov,aspect,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const a=new PerspectiveCamera(fov,aspect,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);const o=new PerspectiveCamera(fov,aspect,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(0,-1,0),this.add(o);const l=new PerspectiveCamera(fov,aspect,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new PerspectiveCamera(fov,aspect,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[r,s,a,o,l,c]=this.children,u=e.getRenderTarget(),d=e.toneMapping,f=e.xr.enabled;e.toneMapping=NoToneMapping,e.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=m,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=d,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:CubeReflectionMapping,super(e,t,i,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new CubeTexture(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:LinearFilter}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new BoxGeometry(5,5,5),s=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:BackSide,blending:NoBlending});s.uniforms.tEquirect.value=t;const a=new Mesh(r,s),o=t.minFilter;return t.minFilter===LinearMipmapLinearFilter&&(t.minFilter=LinearFilter),new CubeCamera(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const _vector1=new Vector3,_vector2=new Vector3,_normalMatrix=new Matrix3;class Plane{constructor(e=new Vector3(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=_vector1.subVectors(i,t).cross(_vector2.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(_vector1),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||_normalMatrix.getNormalMatrix(e),r=this.coplanarPoint(_vector1).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _sphere$2=new Sphere,_vector$7=new Vector3;class Frustum{constructor(e=new Plane,t=new Plane,i=new Plane,r=new Plane,s=new Plane,a=new Plane){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],u=i[6],d=i[7],f=i[8],m=i[9],v=i[10],_=i[11],g=i[12],x=i[13],S=i[14],y=i[15];return t[0].setComponents(o-r,d-l,_-f,y-g).normalize(),t[1].setComponents(o+r,d+l,_+f,y+g).normalize(),t[2].setComponents(o+s,d+c,_+m,y+x).normalize(),t[3].setComponents(o-s,d-c,_-m,y-x).normalize(),t[4].setComponents(o-a,d-u,_-v,y-S).normalize(),t[5].setComponents(o+a,d+u,_+v,y+S).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),_sphere$2.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSprite(e){return _sphere$2.center.set(0,0,0),_sphere$2.radius=.7071067811865476,_sphere$2.applyMatrix4(e.matrixWorld),this.intersectsSphere(_sphere$2)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,_vector$7.y=r.normal.y>0?e.max.y:e.min.y,_vector$7.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_vector$7)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function WebGLAnimation(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function WebGLAttributes(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const d=c.array,f=c.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,d,f),c.onUploadCallback();let v;if(d instanceof Float32Array)v=5126;else if(d instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=5123;else if(d instanceof Int16Array)v=5122;else if(d instanceof Uint32Array)v=5125;else if(d instanceof Int32Array)v=5124;else if(d instanceof Int8Array)v=5120;else if(d instanceof Uint8Array)v=5121;else if(d instanceof Uint8ClampedArray)v=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:m,type:v,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,d){const f=u.array,m=u.updateRange;n.bindBuffer(d,c),m.count===-1?n.bufferSubData(d,0,f):(t?n.bufferSubData(d,m.offset*f.BYTES_PER_ELEMENT,f,m.offset,m.count):n.bufferSubData(d,m.offset*f.BYTES_PER_ELEMENT,f.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +float G_BlinnPhong_Implicit( ) { + return 0.25; +} +float D_BlinnPhong( const in float shininess, const in float dotNH ) { + return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); +} +vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( specularColor, 1.0, dotVH ); + float G = G_BlinnPhong_Implicit( ); + float D = D_BlinnPhong( shininess, dotNH ); + return F * ( G * D ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif`,iridescence_fragment=`#ifdef USE_IRIDESCENCE + const mat3 XYZ_TO_REC709 = mat3( + 3.2404542, -0.9692660, 0.0556434, + -1.5371385, 1.8760108, -0.2040259, + -0.4985314, 0.0415560, 1.0572252 + ); + vec3 Fresnel0ToIor( vec3 fresnel0 ) { + vec3 sqrtF0 = sqrt( fresnel0 ); + return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); + } + vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { + return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); + } + float IorToFresnel0( float transmittedIor, float incidentIor ) { + return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); + } + vec3 evalSensitivity( float OPD, vec3 shift ) { + float phase = 2.0 * PI * OPD * 1.0e-9; + vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); + vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); + vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); + vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); + xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); + xyz /= 1.0685e-7; + vec3 rgb = XYZ_TO_REC709 * xyz; + return rgb; + } + vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { + vec3 I; + float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); + float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); + float cosTheta2Sq = 1.0 - sinTheta2Sq; + if ( cosTheta2Sq < 0.0 ) { + return vec3( 1.0 ); + } + float cosTheta2 = sqrt( cosTheta2Sq ); + float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); + float R12 = F_Schlick( R0, 1.0, cosTheta1 ); + float R21 = R12; + float T121 = 1.0 - R12; + float phi12 = 0.0; + if ( iridescenceIOR < outsideIOR ) phi12 = PI; + float phi21 = PI - phi12; + vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); + vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); + vec3 phi23 = vec3( 0.0 ); + if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; + if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; + if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; + float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; + vec3 phi = vec3( phi21 ) + phi23; + vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); + vec3 r123 = sqrt( R123 ); + vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); + vec3 C0 = R12 + Rs; + I = C0; + vec3 Cm = Rs - T121; + for ( int m = 1; m <= 2; ++ m ) { + Cm *= r123; + vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); + I += Cm * Sm; + } + return max( I, vec3( 0.0 ) ); + } +#endif`,bumpmap_pars_fragment=`#ifdef USE_BUMPMAP + uniform sampler2D bumpMap; + uniform float bumpScale; + vec2 dHdxy_fwd() { + vec2 dSTdx = dFdx( vUv ); + vec2 dSTdy = dFdy( vUv ); + float Hll = bumpScale * texture2D( bumpMap, vUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; + return vec2( dBx, dBy ); + } + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { + vec3 vSigmaX = dFdx( surf_pos.xyz ); + vec3 vSigmaY = dFdy( surf_pos.xyz ); + vec3 vN = surf_norm; + vec3 R1 = cross( vSigmaY, vN ); + vec3 R2 = cross( vN, vSigmaX ); + float fDet = dot( vSigmaX, R1 ) * faceDirection; + vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); + return normalize( abs( fDet ) * surf_norm - vGrad ); + } +#endif`,clipping_planes_fragment=`#if NUM_CLIPPING_PLANES > 0 + vec4 plane; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif +#endif`,clipping_planes_pars_fragment=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,color_pars_fragment=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,color_pars_vertex=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,color_vertex=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif`,common=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +struct GeometricContext { + vec3 position; + vec3 normal; + vec3 viewDir; +#ifdef USE_CLEARCOAT + vec3 clearcoatNormal; +#endif +}; +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +}`,cube_uv_reflection_fragment=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_v0 0.339 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_v1 0.276 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_v4 0.046 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_v5 0.016 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_v6 0.0038 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex=`vec3 transformedNormal = objectNormal; +#ifdef USE_INSTANCING + mat3 m = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + transformedNormal = m * transformedNormal; +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,displacementmap_pars_vertex=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,encodings_fragment="gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment=`vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,envmap_fragment=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,envmap_common_pars_fragment=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,envmap_pars_fragment=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,envmap_pars_vertex=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,envmap_vertex=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fog_pars_fragment=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,lightmap_fragment=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vUv2 ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,lightmap_pars_fragment=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +uniform vec3 lightProbe[ 9 ]; +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + #if defined ( PHYSICALLY_CORRECT_LIGHTS ) + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; + #else + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); + } + return 1.0; + #endif +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometry.position; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometry.position; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,envmap_physical_pars_fragment=`#if defined( USE_ENVMAP ) + vec3 getIBLIrradiance( const in vec3 normal ) { + #if defined( ENVMAP_TYPE_CUBE_UV ) + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #if defined( ENVMAP_TYPE_CUBE_UV ) + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } +#endif`,lights_toon_fragment=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULARINTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; + #endif + #ifdef USE_SPECULARCOLORMAP + specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEENCOLORMAP + material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEENROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; + #endif +#endif`,lights_physical_pars_fragment=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif +}; +vec3 clearcoatSpecular = vec3( 0.0 ); +vec3 sheenSpecular = vec3( 0.0 ); +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometry.normal; + vec3 viewDir = geometry.viewDir; + vec3 position = geometry.position; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); + #endif + #ifdef USE_IRIDESCENCE + reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); + #else + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); + #endif + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,lights_fragment_begin=` +GeometricContext geometry; +geometry.position = - vViewPosition; +geometry.normal = normal; +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +#ifdef USE_CLEARCOAT + geometry.clearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometry.viewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometry, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, geometry, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vUv2 ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometry.normal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); +#endif`,logdepthbuf_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,logdepthbuf_vertex=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + #else + if ( isPerspectiveMatrix( projectionMatrix ) ) { + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; + gl_Position.z *= gl_Position.w; + } + #endif +#endif`,map_fragment=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,map_particle_pars_fragment=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,metalnessmap_fragment=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphcolor_vertex=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } + #else + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; + #endif +#endif`,morphtarget_pars_vertex=`#ifdef USE_MORPHTARGETS + uniform float morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } + #else + #ifndef USE_MORPHNORMALS + uniform float morphTargetInfluences[ 8 ]; + #else + uniform float morphTargetInfluences[ 4 ]; + #endif + #endif +#endif`,morphtarget_vertex=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } + #else + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + #ifndef USE_MORPHNORMALS + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + #endif + #endif +#endif`,normal_fragment_begin=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + #ifdef USE_TANGENT + vec3 tangent = normalize( vTangent ); + vec3 bitangent = normalize( vBitangent ); + #ifdef DOUBLE_SIDED + tangent = tangent * faceDirection; + bitangent = bitangent * faceDirection; + #endif + #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) + mat3 vTBN = mat3( tangent, bitangent, normal ); + #endif + #endif +#endif +vec3 geometryNormal = normal;`,normal_fragment_maps=`#ifdef OBJECTSPACE_NORMALMAP + normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( TANGENTSPACE_NORMALMAP ) + vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + #ifdef USE_TANGENT + normal = normalize( vTBN * mapN ); + #else + normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); + #endif +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,normal_pars_fragment=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,normalmap_pars_fragment=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef OBJECTSPACE_NORMALMAP + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) + vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( vUv.st ); + vec2 st1 = dFdy( vUv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); + return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); + } +#endif`,clearcoat_normal_fragment_begin=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = geometryNormal; +#endif`,clearcoat_normal_fragment_maps=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + #ifdef USE_TANGENT + clearcoatNormal = normalize( vTBN * clearcoatMapN ); + #else + clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); + #endif +#endif`,clearcoat_pars_fragment=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif`,iridescence_pars_fragment=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,output_fragment=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha + 0.1; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + 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 ); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { + return linearClipZ * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * invClipZ - far ); +}`,premultiplied_alpha_fragment=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,roughnessmap_fragment=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); + bool inFrustum = all( inFrustumVec ); + bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); + bool frustumTest = all( frustumTestVec ); + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return shadow; + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + vec3 lightToPosition = shadowCoord.xyz; + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } +#endif`,shadowmap_pars_vertex=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; + #endif + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif`,shadowmask_pars_fragment=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + uniform int boneTextureSize; + mat4 getBoneMatrix( const in float i ) { + float j = i * 4.0; + float x = mod( j, float( boneTextureSize ) ); + float y = floor( j / float( boneTextureSize ) ); + float dx = 1.0 / float( boneTextureSize ); + float dy = 1.0 / float( boneTextureSize ); + y = dy * ( y + 0.5 ); + vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); + vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); + vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); + vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); + mat4 bone = mat4( v1, v2, v3, v4 ); + return bone; + } +#endif`,skinning_vertex=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,skinnormal_vertex=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,specularmap_fragment=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return toneMappingExposure * color; +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmission = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); +#endif`,transmission_pars_fragment=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + #ifdef texture2DLodEXT + return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); + #else + return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); + #endif + } + vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return radiance; + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); + } +#endif`,uv_pars_fragment=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) + varying vec2 vUv; +#endif`,uv_pars_vertex=`#ifdef USE_UV + #ifdef UVS_VERTEX_ONLY + vec2 vUv; + #else + varying vec2 vUv; + #endif + uniform mat3 uvTransform; +#endif`,uv_vertex=`#ifdef USE_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; +#endif`,uv2_pars_fragment=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + varying vec2 vUv2; +#endif`,uv2_pars_vertex=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + attribute vec2 uv2; + varying vec2 vUv2; + uniform mat3 uv2Transform; +#endif`,uv2_vertex=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; +#endif`,worldpos_vertex=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const vertex$h=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,fragment$h=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,vertex$g=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,fragment$g=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,vertex$f=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,fragment$f=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,vertex$e=`#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,fragment$e=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + vec4 diffuseColor = vec4( 1.0 ); + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,vertex$d=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,fragment$d=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + #include + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,vertex$c=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,fragment$c=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,vertex$b=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$b=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +void main() { + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,vertex$a=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$a=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vUv2 ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$9=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,fragment$9=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$8=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,fragment$8=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,vertex$7=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + vViewPosition = - mvPosition.xyz; +#endif +}`,fragment$7=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,vertex$6=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,fragment$6=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$5=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,fragment$5=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULARINTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif + #ifdef USE_SPECULARCOLORMAP + uniform sampler2D specularColorMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEENCOLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEENROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,vertex$4=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,fragment$4=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,vertex$3=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,fragment$3=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,vertex$2=`#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$2=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,vertex$1=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,fragment$1=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,ShaderChunk={alphamap_fragment,alphamap_pars_fragment,alphatest_fragment,alphatest_pars_fragment,aomap_fragment,aomap_pars_fragment,begin_vertex,beginnormal_vertex,bsdfs,iridescence_fragment,bumpmap_pars_fragment,clipping_planes_fragment,clipping_planes_pars_fragment,clipping_planes_pars_vertex,clipping_planes_vertex,color_fragment,color_pars_fragment,color_pars_vertex,color_vertex,common,cube_uv_reflection_fragment,defaultnormal_vertex,displacementmap_pars_vertex,displacementmap_vertex,emissivemap_fragment,emissivemap_pars_fragment,encodings_fragment,encodings_pars_fragment,envmap_fragment,envmap_common_pars_fragment,envmap_pars_fragment,envmap_pars_vertex,envmap_physical_pars_fragment,envmap_vertex,fog_vertex,fog_pars_vertex,fog_fragment,fog_pars_fragment,gradientmap_pars_fragment,lightmap_fragment,lightmap_pars_fragment,lights_lambert_fragment,lights_lambert_pars_fragment,lights_pars_begin,lights_toon_fragment,lights_toon_pars_fragment,lights_phong_fragment,lights_phong_pars_fragment,lights_physical_fragment,lights_physical_pars_fragment,lights_fragment_begin,lights_fragment_maps,lights_fragment_end,logdepthbuf_fragment,logdepthbuf_pars_fragment,logdepthbuf_pars_vertex,logdepthbuf_vertex,map_fragment,map_pars_fragment,map_particle_fragment,map_particle_pars_fragment,metalnessmap_fragment,metalnessmap_pars_fragment,morphcolor_vertex,morphnormal_vertex,morphtarget_pars_vertex,morphtarget_vertex,normal_fragment_begin,normal_fragment_maps,normal_pars_fragment,normal_pars_vertex,normal_vertex,normalmap_pars_fragment,clearcoat_normal_fragment_begin,clearcoat_normal_fragment_maps,clearcoat_pars_fragment,iridescence_pars_fragment,output_fragment,packing,premultiplied_alpha_fragment,project_vertex,dithering_fragment,dithering_pars_fragment,roughnessmap_fragment,roughnessmap_pars_fragment,shadowmap_pars_fragment,shadowmap_pars_vertex,shadowmap_vertex,shadowmask_pars_fragment,skinbase_vertex,skinning_pars_vertex,skinning_vertex,skinnormal_vertex,specularmap_fragment,specularmap_pars_fragment,tonemapping_fragment,tonemapping_pars_fragment,transmission_fragment,transmission_pars_fragment,uv_pars_fragment,uv_pars_vertex,uv_vertex,uv2_pars_fragment,uv2_pars_vertex,uv2_vertex,worldpos_vertex,background_vert:vertex$h,background_frag:fragment$h,backgroundCube_vert:vertex$g,backgroundCube_frag:fragment$g,cube_vert:vertex$f,cube_frag:fragment$f,depth_vert:vertex$e,depth_frag:fragment$e,distanceRGBA_vert:vertex$d,distanceRGBA_frag:fragment$d,equirect_vert:vertex$c,equirect_frag:fragment$c,linedashed_vert:vertex$b,linedashed_frag:fragment$b,meshbasic_vert:vertex$a,meshbasic_frag:fragment$a,meshlambert_vert:vertex$9,meshlambert_frag:fragment$9,meshmatcap_vert:vertex$8,meshmatcap_frag:fragment$8,meshnormal_vert:vertex$7,meshnormal_frag:fragment$7,meshphong_vert:vertex$6,meshphong_frag:fragment$6,meshphysical_vert:vertex$5,meshphysical_frag:fragment$5,meshtoon_vert:vertex$4,meshtoon_frag:fragment$4,points_vert:vertex$3,points_frag:fragment$3,shadow_vert:vertex$2,shadow_frag:fragment$2,sprite_vert:vertex$1,sprite_frag:fragment$1},UniformsLib={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Matrix3},uv2Transform:{value:new Matrix3},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}}},ShaderLib={basic:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.fog]),vertexShader:ShaderChunk.meshbasic_vert,fragmentShader:ShaderChunk.meshbasic_frag},lambert:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshlambert_vert,fragmentShader:ShaderChunk.meshlambert_frag},phong:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:ShaderChunk.meshphong_vert,fragmentShader:ShaderChunk.meshphong_frag},standard:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.roughnessmap,UniformsLib.metalnessmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag},toon:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.gradientmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk.meshtoon_vert,fragmentShader:ShaderChunk.meshtoon_frag},matcap:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk.meshmatcap_vert,fragmentShader:ShaderChunk.meshmatcap_frag},points:{uniforms:mergeUniforms([UniformsLib.points,UniformsLib.fog]),vertexShader:ShaderChunk.points_vert,fragmentShader:ShaderChunk.points_frag},dashed:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk.linedashed_vert,fragmentShader:ShaderChunk.linedashed_frag},depth:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap]),vertexShader:ShaderChunk.depth_vert,fragmentShader:ShaderChunk.depth_frag},normal:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,{opacity:{value:1}}]),vertexShader:ShaderChunk.meshnormal_vert,fragmentShader:ShaderChunk.meshnormal_frag},sprite:{uniforms:mergeUniforms([UniformsLib.sprite,UniformsLib.fog]),vertexShader:ShaderChunk.sprite_vert,fragmentShader:ShaderChunk.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.background_vert,fragmentShader:ShaderChunk.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.backgroundCube_vert,fragmentShader:ShaderChunk.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ShaderChunk.cube_vert,fragmentShader:ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ShaderChunk.equirect_vert,fragmentShader:ShaderChunk.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ShaderChunk.distanceRGBA_vert,fragmentShader:ShaderChunk.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([UniformsLib.lights,UniformsLib.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:ShaderChunk.shadow_vert,fragmentShader:ShaderChunk.shadow_frag}};ShaderLib.physical={uniforms:mergeUniforms([ShaderLib.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag};const _rgb={r:0,b:0,g:0};function WebGLBackground(n,e,t,i,r,s,a){const o=new Color(0);let l=s===!0?0:1,c,u,d=null,f=0,m=null;function v(g,x){let S=!1,y=x.isScene===!0?x.background:null;y&&y.isTexture&&(y=(x.backgroundBlurriness>0?t:e).get(y));const b=n.xr,w=b.getSession&&b.getSession();w&&w.environmentBlendMode==="additive"&&(y=null),y===null?_(o,l):y&&y.isColor&&(_(y,1),S=!0),(n.autoClear||S)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),y&&(y.isCubeTexture||y.mapping===CubeUVReflectionMapping)?(u===void 0&&(u=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(ShaderLib.backgroundCube.uniforms),vertexShader:ShaderLib.backgroundCube.vertexShader,fragmentShader:ShaderLib.backgroundCube.fragmentShader,side:BackSide,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,R,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,(d!==y||f!==y.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,d=y,f=y.version,m=n.toneMapping),u.layers.enableAll(),g.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(ShaderLib.background.uniforms),vertexShader:ShaderLib.background.vertexShader,fragmentShader:ShaderLib.background.fragmentShader,side:FrontSide,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(d!==y||f!==y.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,d=y,f=y.version,m=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function _(g,x){g.getRGB(_rgb,getUnlitUniformColorSpace(n)),i.buffers.color.setClear(_rgb.r,_rgb.g,_rgb.b,x,a)}return{getClearColor:function(){return o},setClearColor:function(g,x=1){o.set(g),l=x,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,_(o,l)},render:v}}function WebGLBindingStates(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=g(null);let c=l,u=!1;function d(G,le,he,ue,ie){let ve=!1;if(a){const _e=_(ue,he,le);c!==_e&&(c=_e,m(c.object)),ve=x(G,ue,he,ie),ve&&S(G,ue,he,ie)}else{const _e=le.wireframe===!0;(c.geometry!==ue.id||c.program!==he.id||c.wireframe!==_e)&&(c.geometry=ue.id,c.program=he.id,c.wireframe=_e,ve=!0)}ie!==null&&t.update(ie,34963),(ve||u)&&(u=!1,M(G,le,he,ue),ie!==null&&n.bindBuffer(34963,t.get(ie).buffer))}function f(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(G){return i.isWebGL2?n.bindVertexArray(G):s.bindVertexArrayOES(G)}function v(G){return i.isWebGL2?n.deleteVertexArray(G):s.deleteVertexArrayOES(G)}function _(G,le,he){const ue=he.wireframe===!0;let ie=o[G.id];ie===void 0&&(ie={},o[G.id]=ie);let ve=ie[le.id];ve===void 0&&(ve={},ie[le.id]=ve);let _e=ve[ue];return _e===void 0&&(_e=g(f()),ve[ue]=_e),_e}function g(G){const le=[],he=[],ue=[];for(let ie=0;ie=0){const Me=ie[ne];let Te=ve[ne];if(Te===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(Te=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(Te=G.instanceColor)),Me===void 0||Me.attribute!==Te||Te&&Me.data!==Te.data)return!0;_e++}return c.attributesNum!==_e||c.index!==ue}function S(G,le,he,ue){const ie={},ve=le.attributes;let _e=0;const Q=he.getAttributes();for(const ne in Q)if(Q[ne].location>=0){let Me=ve[ne];Me===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(Me=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(Me=G.instanceColor));const Te={};Te.attribute=Me,Me&&Me.data&&(Te.data=Me.data),ie[ne]=Te,_e++}c.attributes=ie,c.attributesNum=_e,c.index=ue}function y(){const G=c.newAttributes;for(let le=0,he=G.length;le=0){let ye=ie[Q];if(ye===void 0&&(Q==="instanceMatrix"&&G.instanceMatrix&&(ye=G.instanceMatrix),Q==="instanceColor"&&G.instanceColor&&(ye=G.instanceColor)),ye!==void 0){const Me=ye.normalized,Te=ye.itemSize,ae=t.get(ye);if(ae===void 0)continue;const Le=ae.buffer,Ee=ae.type,Ce=ae.bytesPerElement;if(ye.isInterleavedBufferAttribute){const we=ye.data,O=we.stride,D=ye.offset;if(we.isInstancedInterleavedBuffer){for(let k=0;k0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";R="mediump"}return R==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,d=n.getParameter(34930),f=n.getParameter(35660),m=n.getParameter(3379),v=n.getParameter(34076),_=n.getParameter(34921),g=n.getParameter(36347),x=n.getParameter(36348),S=n.getParameter(36349),y=f>0,b=a||e.has("OES_texture_float"),w=y&&b,C=a?n.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:g,maxVaryings:x,maxFragmentUniforms:S,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:w,maxSamples:C}}function WebGLClipping(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Plane,o=new Matrix3,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f,m){const v=d.length!==0||f||i!==0||r;return r=f,t=u(d,m,0),i=d.length,v},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(d,f,m){const v=d.clippingPlanes,_=d.clipIntersection,g=d.clipShadows,x=n.get(d);if(!r||v===null||v.length===0||s&&!g)s?u(null):c();else{const S=s?0:i,y=S*4;let b=x.clippingState||null;l.value=b,b=u(v,f,y,m);for(let w=0;w!==y;++w)b[w]=t[w];x.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,f,m,v){const _=d!==null?d.length:0;let g=null;if(_!==0){if(g=l.value,v!==!0||g===null){const x=m+_*4,S=f.matrixWorldInverse;o.getNormalMatrix(S),(g===null||g.length0){const c=new WebGLCubeRenderTarget(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class OrthographicCamera extends Camera{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const LOD_MIN=4,EXTRA_LOD_SIGMA=[.125,.215,.35,.446,.526,.582],MAX_SAMPLES=20,_flatCamera=new OrthographicCamera,_clearColor=new Color;let _oldTarget=null;const PHI=(1+Math.sqrt(5))/2,INV_PHI=1/PHI,_axisDirections=[new Vector3(1,1,1),new Vector3(-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,PHI,INV_PHI),new Vector3(0,PHI,-INV_PHI),new Vector3(INV_PHI,0,PHI),new Vector3(-INV_PHI,0,PHI),new Vector3(PHI,INV_PHI,0),new Vector3(-PHI,INV_PHI,0)];class PMREMGenerator{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){_oldTarget=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?y:0,y,y),u.setRenderTarget(r),_&&u.render(v,o),u.render(e,o)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===CubeReflectionMapping||e.mapping===CubeRefractionMapping;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Mesh(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;_setViewport(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,_flatCamera)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rMAX_SAMPLES&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${MAX_SAMPLES}`);const x=[];let S=0;for(let R=0;Ry-LOD_MIN?r-y+LOD_MIN:0),C=4*(this._cubeSize-b);_setViewport(t,w,C,3*b,2*b),l.setRenderTarget(t),l.render(d,_flatCamera)}}function _createPlanes(n){const e=[],t=[],i=[];let r=n;const s=n-LOD_MIN+1+EXTRA_LOD_SIGMA.length;for(let a=0;an-LOD_MIN?l=EXTRA_LOD_SIGMA[a-n+LOD_MIN-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],m=6,v=6,_=3,g=2,x=1,S=new Float32Array(_*v*m),y=new Float32Array(g*v*m),b=new Float32Array(x*v*m);for(let C=0;C2?0:-1,L=[R,M,0,R+2/3,M,0,R+2/3,M+1,0,R,M,0,R+2/3,M+1,0,R,M+1,0];S.set(L,_*v*C),y.set(f,g*v*C);const B=[C,C,C,C,C,C];b.set(B,x*v*C)}const w=new BufferGeometry;w.setAttribute("position",new BufferAttribute(S,_)),w.setAttribute("uv",new BufferAttribute(y,g)),w.setAttribute("faceIndex",new BufferAttribute(b,x)),e.push(w),r>LOD_MIN&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function _createRenderTarget(n,e,t){const i=new WebGLRenderTarget(n,e,t);return i.texture.mapping=CubeUVReflectionMapping,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function _setViewport(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function _getBlurShader(n,e,t){const i=new Float32Array(MAX_SAMPLES),r=new Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:MAX_SAMPLES,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:_getCommonVertexShader(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function WebGLCubeUVMaps(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===EquirectangularReflectionMapping||l===EquirectangularRefractionMapping,u=l===CubeReflectionMapping||l===CubeRefractionMapping;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let d=e.get(o);return t===null&&(t=new PMREMGenerator(n)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),e.set(o,d),d.texture}else{if(e.has(o))return e.get(o).texture;{const d=o.image;if(c&&d&&d.height>0||u&&d&&r(d)){t===null&&(t=new PMREMGenerator(n));const f=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,f),o.addEventListener("dispose",s),f.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(q=Math.ceil(Z/e.maxTextureSize),Z=e.maxTextureSize);const X=new Float32Array(Z*q*4*g),G=new DataArrayTexture(X,Z,q,g);G.type=FloatType,G.needsUpdate=!0;const le=B*4;for(let ue=0;ue0)return n;const r=e*t;let s=arrayCacheF32[r];if(s===void 0&&(s=new Float32Array(r),arrayCacheF32[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function arraysEqual(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${o}: ${t[a]}`)}return i.join(` +`)}function getEncodingComponents(n){switch(n){case LinearEncoding:return["Linear","( value )"];case sRGBEncoding:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function getShaderErrors(n,e,t){const i=n.getShaderParameter(e,35713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+handleSource(n.getShaderSource(e),a)}else return r}function getTexelEncodingFunction(n,e){const t=getEncodingComponents(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function getToneMappingFunction(n,e){let t;switch(e){case LinearToneMapping:t="Linear";break;case ReinhardToneMapping:t="Reinhard";break;case CineonToneMapping:t="OptimizedCineon";break;case ACESFilmicToneMapping:t="ACESFilmic";break;case CustomToneMapping:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function generateExtensions(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(filterEmptyLine).join(` +`)}function generateDefines(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function fetchAttributeLocations(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r/gm;function resolveIncludes(n){return n.replace(includePattern,includeReplacer)}function includeReplacer(n,e){const t=ShaderChunk[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return resolveIncludes(t)}const unrollLoopPattern=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function unrollLoops(n){return n.replace(unrollLoopPattern,loopReplacer)}function loopReplacer(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(g+=` +`),x=[m,v].filter(filterEmptyLine).join(` +`),x.length>0&&(x+=` +`)):(g=[generatePrecision(t),"#define SHADER_NAME "+t.shaderName,v,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(filterEmptyLine).join(` +`),x=[m,generatePrecision(t),"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==NoToneMapping?ShaderChunk.tonemapping_pars_fragment:"",t.toneMapping!==NoToneMapping?getToneMappingFunction("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ShaderChunk.encodings_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(filterEmptyLine).join(` +`)),a=resolveIncludes(a),a=replaceLightNums(a,t),a=replaceClippingPlaneNums(a,t),o=resolveIncludes(o),o=replaceLightNums(o,t),o=replaceClippingPlaneNums(o,t),a=unrollLoops(a),o=unrollLoops(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(S=`#version 300 es +`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+g,x=["#define varying in",t.glslVersion===GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+x);const y=S+g+a,b=S+x+o,w=WebGLShader(r,35633,y),C=WebGLShader(r,35632,b);if(r.attachShader(_,w),r.attachShader(_,C),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),n.debug.checkShaderErrors){const L=r.getProgramInfoLog(_).trim(),B=r.getShaderInfoLog(w).trim(),Z=r.getShaderInfoLog(C).trim();let q=!0,X=!0;if(r.getProgramParameter(_,35714)===!1){q=!1;const G=getShaderErrors(r,w,"vertex"),le=getShaderErrors(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+` + +Program Info Log: `+L+` +`+G+` +`+le)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(B===""||Z==="")&&(X=!1);X&&(this.diagnostics={runnable:q,programLog:L,vertexShader:{log:B,prefix:g},fragmentShader:{log:Z,prefix:x}})}r.deleteShader(w),r.deleteShader(C);let R;this.getUniforms=function(){return R===void 0&&(R=new WebGLUniforms(r,_)),R};let M;return this.getAttributes=function(){return M===void 0&&(M=fetchAttributeLocations(r,_)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.name=t.shaderName,this.id=programIdCount++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=w,this.fragmentShader=C,this}let _id=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new WebGLShaderStage(e),t.set(e,i)),i}}class WebGLShaderStage{constructor(e){this.id=_id++,this.code=e,this.usedTimes=0}}function WebGLPrograms(n,e,t,i,r,s,a){const o=new Layers,l=new WebGLShaderCache,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M,L,B,Z,q){const X=Z.fog,G=q.geometry,le=M.isMeshStandardMaterial?Z.environment:null,he=(M.isMeshStandardMaterial?t:e).get(M.envMap||le),ue=he&&he.mapping===CubeUVReflectionMapping?he.image.height:null,ie=v[M.type];M.precision!==null&&(m=r.getMaxPrecision(M.precision),m!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",m,"instead."));const ve=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,_e=ve!==void 0?ve.length:0;let Q=0;G.morphAttributes.position!==void 0&&(Q=1),G.morphAttributes.normal!==void 0&&(Q=2),G.morphAttributes.color!==void 0&&(Q=3);let ne,ye,Me,Te;if(ie){const O=ShaderLib[ie];ne=O.vertexShader,ye=O.fragmentShader}else ne=M.vertexShader,ye=M.fragmentShader,l.update(M),Me=l.getVertexShaderID(M),Te=l.getFragmentShaderID(M);const ae=n.getRenderTarget(),Le=M.alphaTest>0,Ee=M.clearcoat>0,Ce=M.iridescence>0;return{isWebGL2:u,shaderID:ie,shaderName:M.type,vertexShader:ne,fragmentShader:ye,defines:M.defines,customVertexShaderID:Me,customFragmentShaderID:Te,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:m,instancing:q.isInstancedMesh===!0,instancingColor:q.isInstancedMesh===!0&&q.instanceColor!==null,supportsVertexTextures:f,outputEncoding:ae===null?n.outputEncoding:ae.isXRRenderTarget===!0?ae.texture.encoding:LinearEncoding,map:!!M.map,matcap:!!M.matcap,envMap:!!he,envMapMode:he&&he.mapping,envMapCubeUVHeight:ue,lightMap:!!M.lightMap,aoMap:!!M.aoMap,emissiveMap:!!M.emissiveMap,bumpMap:!!M.bumpMap,normalMap:!!M.normalMap,objectSpaceNormalMap:M.normalMapType===ObjectSpaceNormalMap,tangentSpaceNormalMap:M.normalMapType===TangentSpaceNormalMap,decodeVideoTexture:!!M.map&&M.map.isVideoTexture===!0&&M.map.encoding===sRGBEncoding,clearcoat:Ee,clearcoatMap:Ee&&!!M.clearcoatMap,clearcoatRoughnessMap:Ee&&!!M.clearcoatRoughnessMap,clearcoatNormalMap:Ee&&!!M.clearcoatNormalMap,iridescence:Ce,iridescenceMap:Ce&&!!M.iridescenceMap,iridescenceThicknessMap:Ce&&!!M.iridescenceThicknessMap,displacementMap:!!M.displacementMap,roughnessMap:!!M.roughnessMap,metalnessMap:!!M.metalnessMap,specularMap:!!M.specularMap,specularIntensityMap:!!M.specularIntensityMap,specularColorMap:!!M.specularColorMap,opaque:M.transparent===!1&&M.blending===NormalBlending,alphaMap:!!M.alphaMap,alphaTest:Le,gradientMap:!!M.gradientMap,sheen:M.sheen>0,sheenColorMap:!!M.sheenColorMap,sheenRoughnessMap:!!M.sheenRoughnessMap,transmission:M.transmission>0,transmissionMap:!!M.transmissionMap,thicknessMap:!!M.thicknessMap,combine:M.combine,vertexTangents:!!M.normalMap&&!!G.attributes.tangent,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUvs:!!M.map||!!M.bumpMap||!!M.normalMap||!!M.specularMap||!!M.alphaMap||!!M.emissiveMap||!!M.roughnessMap||!!M.metalnessMap||!!M.clearcoatMap||!!M.clearcoatRoughnessMap||!!M.clearcoatNormalMap||!!M.iridescenceMap||!!M.iridescenceThicknessMap||!!M.displacementMap||!!M.transmissionMap||!!M.thicknessMap||!!M.specularIntensityMap||!!M.specularColorMap||!!M.sheenColorMap||!!M.sheenRoughnessMap,uvsVertexOnly:!(M.map||M.bumpMap||M.normalMap||M.specularMap||M.alphaMap||M.emissiveMap||M.roughnessMap||M.metalnessMap||M.clearcoatNormalMap||M.iridescenceMap||M.iridescenceThicknessMap||M.transmission>0||M.transmissionMap||M.thicknessMap||M.specularIntensityMap||M.specularColorMap||M.sheen>0||M.sheenColorMap||M.sheenRoughnessMap)&&!!M.displacementMap,fog:!!X,useFog:M.fog===!0,fogExp2:X&&X.isFogExp2,flatShading:!!M.flatShading,sizeAttenuation:M.sizeAttenuation,logarithmicDepthBuffer:d,skinning:q.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Q,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&B.length>0,shadowMapType:n.shadowMap.type,toneMapping:M.toneMapped?n.toneMapping:NoToneMapping,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===DoubleSide,flipSided:M.side===BackSide,useDepthPacking:!!M.depthPacking,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:M.extensions&&M.extensions.derivatives,extensionFragDepth:M.extensions&&M.extensions.fragDepth,extensionDrawBuffers:M.extensions&&M.extensions.drawBuffers,extensionShaderTextureLOD:M.extensions&&M.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function g(M){const L=[];if(M.shaderID?L.push(M.shaderID):(L.push(M.customVertexShaderID),L.push(M.customFragmentShaderID)),M.defines!==void 0)for(const B in M.defines)L.push(B),L.push(M.defines[B]);return M.isRawShaderMaterial===!1&&(x(L,M),S(L,M),L.push(n.outputEncoding)),L.push(M.customProgramCacheKey),L.join()}function x(M,L){M.push(L.precision),M.push(L.outputEncoding),M.push(L.envMapMode),M.push(L.envMapCubeUVHeight),M.push(L.combine),M.push(L.vertexUvs),M.push(L.fogExp2),M.push(L.sizeAttenuation),M.push(L.morphTargetsCount),M.push(L.morphAttributeCount),M.push(L.numDirLights),M.push(L.numPointLights),M.push(L.numSpotLights),M.push(L.numSpotLightMaps),M.push(L.numHemiLights),M.push(L.numRectAreaLights),M.push(L.numDirLightShadows),M.push(L.numPointLightShadows),M.push(L.numSpotLightShadows),M.push(L.numSpotLightShadowsWithMaps),M.push(L.shadowMapType),M.push(L.toneMapping),M.push(L.numClippingPlanes),M.push(L.numClipIntersection),M.push(L.depthPacking)}function S(M,L){o.disableAll(),L.isWebGL2&&o.enable(0),L.supportsVertexTextures&&o.enable(1),L.instancing&&o.enable(2),L.instancingColor&&o.enable(3),L.map&&o.enable(4),L.matcap&&o.enable(5),L.envMap&&o.enable(6),L.lightMap&&o.enable(7),L.aoMap&&o.enable(8),L.emissiveMap&&o.enable(9),L.bumpMap&&o.enable(10),L.normalMap&&o.enable(11),L.objectSpaceNormalMap&&o.enable(12),L.tangentSpaceNormalMap&&o.enable(13),L.clearcoat&&o.enable(14),L.clearcoatMap&&o.enable(15),L.clearcoatRoughnessMap&&o.enable(16),L.clearcoatNormalMap&&o.enable(17),L.iridescence&&o.enable(18),L.iridescenceMap&&o.enable(19),L.iridescenceThicknessMap&&o.enable(20),L.displacementMap&&o.enable(21),L.specularMap&&o.enable(22),L.roughnessMap&&o.enable(23),L.metalnessMap&&o.enable(24),L.gradientMap&&o.enable(25),L.alphaMap&&o.enable(26),L.alphaTest&&o.enable(27),L.vertexColors&&o.enable(28),L.vertexAlphas&&o.enable(29),L.vertexUvs&&o.enable(30),L.vertexTangents&&o.enable(31),L.uvsVertexOnly&&o.enable(32),M.push(o.mask),o.disableAll(),L.fog&&o.enable(0),L.useFog&&o.enable(1),L.flatShading&&o.enable(2),L.logarithmicDepthBuffer&&o.enable(3),L.skinning&&o.enable(4),L.morphTargets&&o.enable(5),L.morphNormals&&o.enable(6),L.morphColors&&o.enable(7),L.premultipliedAlpha&&o.enable(8),L.shadowMapEnabled&&o.enable(9),L.physicallyCorrectLights&&o.enable(10),L.doubleSided&&o.enable(11),L.flipSided&&o.enable(12),L.useDepthPacking&&o.enable(13),L.dithering&&o.enable(14),L.specularIntensityMap&&o.enable(15),L.specularColorMap&&o.enable(16),L.transmission&&o.enable(17),L.transmissionMap&&o.enable(18),L.thicknessMap&&o.enable(19),L.sheen&&o.enable(20),L.sheenColorMap&&o.enable(21),L.sheenRoughnessMap&&o.enable(22),L.decodeVideoTexture&&o.enable(23),L.opaque&&o.enable(24),M.push(o.mask)}function y(M){const L=v[M.type];let B;if(L){const Z=ShaderLib[L];B=UniformsUtils.clone(Z.uniforms)}else B=M.uniforms;return B}function b(M,L){let B;for(let Z=0,q=c.length;Z0?i.push(x):m.transparent===!0?r.push(x):t.push(x)}function l(d,f,m,v,_,g){const x=a(d,f,m,v,_,g);m.transmission>0?i.unshift(x):m.transparent===!0?r.unshift(x):t.unshift(x)}function c(d,f){t.length>1&&t.sort(d||painterSortStable),i.length>1&&i.sort(f||reversePainterSortStable),r.length>1&&r.sort(f||reversePainterSortStable)}function u(){for(let d=e,f=n.length;d=s.length?(a=new WebGLRenderList,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function UniformsCache(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Vector3,color:new Color};break;case"SpotLight":t={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":t={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3};break}return n[e.id]=t,t}}}function ShadowUniformsCache(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let nextVersion=0;function shadowCastingAndTexturingLightsFirst(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function WebGLLights(n,e){const t=new UniformsCache,i=ShadowUniformsCache(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)r.probe.push(new Vector3);const s=new Vector3,a=new Matrix4,o=new Matrix4;function l(u,d){let f=0,m=0,v=0;for(let Z=0;Z<9;Z++)r.probe[Z].set(0,0,0);let _=0,g=0,x=0,S=0,y=0,b=0,w=0,C=0,R=0,M=0;u.sort(shadowCastingAndTexturingLightsFirst);const L=d!==!0?Math.PI:1;for(let Z=0,q=u.length;Z0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=UniformsLib.LTC_FLOAT_1,r.rectAreaLTC2=UniformsLib.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=UniformsLib.LTC_HALF_1,r.rectAreaLTC2=UniformsLib.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=m,r.ambient[2]=v;const B=r.hash;(B.directionalLength!==_||B.pointLength!==g||B.spotLength!==x||B.rectAreaLength!==S||B.hemiLength!==y||B.numDirectionalShadows!==b||B.numPointShadows!==w||B.numSpotShadows!==C||B.numSpotMaps!==R)&&(r.directional.length=_,r.spot.length=x,r.rectArea.length=S,r.point.length=g,r.hemi.length=y,r.directionalShadow.length=b,r.directionalShadowMap.length=b,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=b,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=C+R-M,r.spotLightMap.length=R,r.numSpotLightShadowsWithMaps=M,B.directionalLength=_,B.pointLength=g,B.spotLength=x,B.rectAreaLength=S,B.hemiLength=y,B.numDirectionalShadows=b,B.numPointShadows=w,B.numSpotShadows=C,B.numSpotMaps=R,r.version=nextVersion++)}function c(u,d){let f=0,m=0,v=0,_=0,g=0;const x=d.matrixWorldInverse;for(let S=0,y=u.length;S=o.length?(l=new WebGLRenderState(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class MeshDepthMaterial extends Material{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=BasicDepthPacking,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class MeshDistanceMaterial extends Material{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Vector3,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const vertex=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,fragment=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function WebGLShadowMap(n,e,t){let i=new Frustum;const r=new Vector2,s=new Vector2,a=new Vector4,o=new MeshDepthMaterial({depthPacking:RGBADepthPacking}),l=new MeshDistanceMaterial,c={},u=t.maxTextureSize,d={0:BackSide,1:FrontSide,2:DoubleSide},f=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:vertex,fragmentShader:fragment}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const v=new BufferGeometry;v.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Mesh(v,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=PCFShadowMap,this.render=function(b,w,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const R=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),B=n.state;B.setBlending(NoBlending),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);for(let Z=0,q=b.length;Zu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/le.x),r.x=s.x*le.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/le.y),r.y=s.y*le.y,G.mapSize.y=s.y)),G.map===null){const ue=this.type!==VSMShadowMap?{minFilter:NearestFilter,magFilter:NearestFilter}:{};G.map=new WebGLRenderTarget(r.x,r.y,ue),G.map.texture.name=X.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const he=G.getViewportCount();for(let ue=0;ue0||w.map&&w.alphaTest>0){const q=B.uuid,X=w.uuid;let G=c[q];G===void 0&&(G={},c[q]=G);let le=G[X];le===void 0&&(le=B.clone(),G[X]=le),B=le}return B.visible=w.visible,B.wireframe=w.wireframe,L===VSMShadowMap?B.side=w.shadowSide!==null?w.shadowSide:w.side:B.side=w.shadowSide!==null?w.shadowSide:d[w.side],B.alphaMap=w.alphaMap,B.alphaTest=w.alphaTest,B.map=w.map,B.clipShadows=w.clipShadows,B.clippingPlanes=w.clippingPlanes,B.clipIntersection=w.clipIntersection,B.displacementMap=w.displacementMap,B.displacementScale=w.displacementScale,B.displacementBias=w.displacementBias,B.wireframeLinewidth=w.wireframeLinewidth,B.linewidth=w.linewidth,C.isPointLight===!0&&B.isMeshDistanceMaterial===!0&&(B.referencePosition.setFromMatrixPosition(C.matrixWorld),B.nearDistance=R,B.farDistance=M),B}function y(b,w,C,R,M){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===VSMShadowMap)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,b.matrixWorld);const Z=e.update(b),q=b.material;if(Array.isArray(q)){const X=Z.groups;for(let G=0,le=X.length;G=1):ie.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(ie)[1]),he=ue>=2);let ve=null,_e={};const Q=n.getParameter(3088),ne=n.getParameter(2978),ye=new Vector4().fromArray(Q),Me=new Vector4().fromArray(ne);function Te(W,fe,Se){const Ae=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(W,Oe),n.texParameteri(W,10241,9728),n.texParameteri(W,10240,9728);for(let Xe=0;Xe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let _;const g=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(T,E){return x?new OffscreenCanvas(T,E):createElementNS("canvas")}function y(T,E,z,K){let V=1;if((T.width>K||T.height>K)&&(V=K/Math.max(T.width,T.height)),V<1||E===!0)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap){const $=E?floorPowerOfTwo:Math.floor,be=$(V*T.width),ge=$(V*T.height);_===void 0&&(_=S(be,ge));const oe=z?S(be,ge):_;return oe.width=be,oe.height=ge,oe.getContext("2d").drawImage(T,0,0,be,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+be+"x"+ge+")."),oe}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function b(T){return isPowerOfTwo(T.width)&&isPowerOfTwo(T.height)}function w(T){return o?!1:T.wrapS!==ClampToEdgeWrapping||T.wrapT!==ClampToEdgeWrapping||T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter}function C(T,E){return T.generateMipmaps&&E&&T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter}function R(T){n.generateMipmap(T)}function M(T,E,z,K,V=!1){if(o===!1)return E;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let $=E;return E===6403&&(z===5126&&($=33326),z===5131&&($=33325),z===5121&&($=33321)),E===33319&&(z===5126&&($=33328),z===5131&&($=33327),z===5121&&($=33323)),E===6408&&(z===5126&&($=34836),z===5131&&($=34842),z===5121&&($=K===sRGBEncoding&&V===!1?35907:32856),z===32819&&($=32854),z===32820&&($=32855)),($===33325||$===33326||$===33327||$===33328||$===34842||$===34836)&&e.get("EXT_color_buffer_float"),$}function L(T,E,z){return C(T,z)===!0||T.isFramebufferTexture&&T.minFilter!==NearestFilter&&T.minFilter!==LinearFilter?Math.log2(Math.max(E.width,E.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?E.mipmaps.length:1}function B(T){return T===NearestFilter||T===NearestMipmapNearestFilter||T===NearestMipmapLinearFilter?9728:9729}function Z(T){const E=T.target;E.removeEventListener("dispose",Z),X(E),E.isVideoTexture&&v.delete(E)}function q(T){const E=T.target;E.removeEventListener("dispose",q),le(E)}function X(T){const E=i.get(T);if(E.__webglInit===void 0)return;const z=T.source,K=g.get(z);if(K){const V=K[E.__cacheKey];V.usedTimes--,V.usedTimes===0&&G(T),Object.keys(K).length===0&&g.delete(z)}i.remove(T)}function G(T){const E=i.get(T);n.deleteTexture(E.__webglTexture);const z=T.source,K=g.get(z);delete K[E.__cacheKey],a.memory.textures--}function le(T){const E=T.texture,z=i.get(T),K=i.get(E);if(K.__webglTexture!==void 0&&(n.deleteTexture(K.__webglTexture),a.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let V=0;V<6;V++)n.deleteFramebuffer(z.__webglFramebuffer[V]),z.__webglDepthbuffer&&n.deleteRenderbuffer(z.__webglDepthbuffer[V]);else{if(n.deleteFramebuffer(z.__webglFramebuffer),z.__webglDepthbuffer&&n.deleteRenderbuffer(z.__webglDepthbuffer),z.__webglMultisampledFramebuffer&&n.deleteFramebuffer(z.__webglMultisampledFramebuffer),z.__webglColorRenderbuffer)for(let V=0;V=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),he+=1,T}function ve(T){const E=[];return E.push(T.wrapS),E.push(T.wrapT),E.push(T.wrapR||0),E.push(T.magFilter),E.push(T.minFilter),E.push(T.anisotropy),E.push(T.internalFormat),E.push(T.format),E.push(T.type),E.push(T.generateMipmaps),E.push(T.premultiplyAlpha),E.push(T.flipY),E.push(T.unpackAlignment),E.push(T.encoding),E.join()}function _e(T,E){const z=i.get(T);if(T.isVideoTexture&&P(T),T.isRenderTargetTexture===!1&&T.version>0&&z.__version!==T.version){const K=T.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(z,T,E);return}}t.bindTexture(3553,z.__webglTexture,33984+E)}function Q(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ee(z,T,E);return}t.bindTexture(35866,z.__webglTexture,33984+E)}function ne(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ee(z,T,E);return}t.bindTexture(32879,z.__webglTexture,33984+E)}function ye(T,E){const z=i.get(T);if(T.version>0&&z.__version!==T.version){Ce(z,T,E);return}t.bindTexture(34067,z.__webglTexture,33984+E)}const Me={[RepeatWrapping]:10497,[ClampToEdgeWrapping]:33071,[MirroredRepeatWrapping]:33648},Te={[NearestFilter]:9728,[NearestMipmapNearestFilter]:9984,[NearestMipmapLinearFilter]:9986,[LinearFilter]:9729,[LinearMipmapNearestFilter]:9985,[LinearMipmapLinearFilter]:9987};function ae(T,E,z){if(z?(n.texParameteri(T,10242,Me[E.wrapS]),n.texParameteri(T,10243,Me[E.wrapT]),(T===32879||T===35866)&&n.texParameteri(T,32882,Me[E.wrapR]),n.texParameteri(T,10240,Te[E.magFilter]),n.texParameteri(T,10241,Te[E.minFilter])):(n.texParameteri(T,10242,33071),n.texParameteri(T,10243,33071),(T===32879||T===35866)&&n.texParameteri(T,32882,33071),(E.wrapS!==ClampToEdgeWrapping||E.wrapT!==ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,10240,B(E.magFilter)),n.texParameteri(T,10241,B(E.minFilter)),E.minFilter!==NearestFilter&&E.minFilter!==LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const K=e.get("EXT_texture_filter_anisotropic");if(E.type===FloatType&&e.has("OES_texture_float_linear")===!1||o===!1&&E.type===HalfFloatType&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||i.get(E).__currentAnisotropy)&&(n.texParameterf(T,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,r.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy)}}function Le(T,E){let z=!1;T.__webglInit===void 0&&(T.__webglInit=!0,E.addEventListener("dispose",Z));const K=E.source;let V=g.get(K);V===void 0&&(V={},g.set(K,V));const $=ve(E);if($!==T.__cacheKey){V[$]===void 0&&(V[$]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,z=!0),V[$].usedTimes++;const be=V[T.__cacheKey];be!==void 0&&(V[T.__cacheKey].usedTimes--,be.usedTimes===0&&G(E)),T.__cacheKey=$,T.__webglTexture=V[$].texture}return z}function Ee(T,E,z){let K=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(K=35866),E.isData3DTexture&&(K=32879);const V=Le(T,E),$=E.source;t.bindTexture(K,T.__webglTexture,33984+z);const be=i.get($);if($.version!==be.__version||V===!0){t.activeTexture(33984+z),n.pixelStorei(37440,E.flipY),n.pixelStorei(37441,E.premultiplyAlpha),n.pixelStorei(3317,E.unpackAlignment),n.pixelStorei(37443,0);const ge=w(E)&&b(E.image)===!1;let oe=y(E.image,ge,!1,u);oe=N(E,oe);const Ie=b(oe)||o,Ne=s.convert(E.format,E.encoding);let Fe=s.convert(E.type),Re=M(E.internalFormat,Ne,Fe,E.encoding,E.isVideoTexture);ae(K,E,Ie);let De;const We=E.mipmaps,je=o&&E.isVideoTexture!==!0,et=be.__version===void 0||V===!0,W=L(E,oe,Ie);if(E.isDepthTexture)Re=6402,o?E.type===FloatType?Re=36012:E.type===UnsignedIntType?Re=33190:E.type===UnsignedInt248Type?Re=35056:Re=33189:E.type===FloatType&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===DepthFormat&&Re===6402&&E.type!==UnsignedShortType&&E.type!==UnsignedIntType&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=UnsignedIntType,Fe=s.convert(E.type)),E.format===DepthStencilFormat&&Re===6402&&(Re=34041,E.type!==UnsignedInt248Type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=UnsignedInt248Type,Fe=s.convert(E.type))),et&&(je?t.texStorage2D(3553,1,Re,oe.width,oe.height):t.texImage2D(3553,0,Re,oe.width,oe.height,0,Ne,Fe,null));else if(E.isDataTexture)if(We.length>0&&Ie){je&&et&&t.texStorage2D(3553,W,Re,We[0].width,We[0].height);for(let fe=0,Se=We.length;fe>=1,Se>>=1}}else if(We.length>0&&Ie){je&&et&&t.texStorage2D(3553,W,Re,We[0].width,We[0].height);for(let fe=0,Se=We.length;fe0&&et++,t.texStorage2D(34067,et,De,oe[0].width,oe[0].height));for(let fe=0;fe<6;fe++)if(ge){We?t.texSubImage2D(34069+fe,0,0,0,oe[fe].width,oe[fe].height,Fe,Re,oe[fe].data):t.texImage2D(34069+fe,0,De,oe[fe].width,oe[fe].height,0,Fe,Re,oe[fe].data);for(let Se=0;Se=34069&&V<=34074)&&n.framebufferTexture2D(36160,K,V,i.get(z).__webglTexture,0),t.bindFramebuffer(36160,null)}function O(T,E,z){if(n.bindRenderbuffer(36161,T),E.depthBuffer&&!E.stencilBuffer){let K=33189;if(z||se(E)){const V=E.depthTexture;V&&V.isDepthTexture&&(V.type===FloatType?K=36012:V.type===UnsignedIntType&&(K=33190));const $=re(E);se(E)?f.renderbufferStorageMultisampleEXT(36161,$,K,E.width,E.height):n.renderbufferStorageMultisample(36161,$,K,E.width,E.height)}else n.renderbufferStorage(36161,K,E.width,E.height);n.framebufferRenderbuffer(36160,36096,36161,T)}else if(E.depthBuffer&&E.stencilBuffer){const K=re(E);z&&se(E)===!1?n.renderbufferStorageMultisample(36161,K,35056,E.width,E.height):se(E)?f.renderbufferStorageMultisampleEXT(36161,K,35056,E.width,E.height):n.renderbufferStorage(36161,34041,E.width,E.height),n.framebufferRenderbuffer(36160,33306,36161,T)}else{const K=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let V=0;V0&&se(T)===!1){const ge=$?E:[E];z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,z.__webglMultisampledFramebuffer);for(let oe=0;oe0&&se(T)===!1){const E=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],z=T.width,K=T.height;let V=16384;const $=[],be=T.stencilBuffer?33306:36096,ge=i.get(T),oe=T.isWebGLMultipleRenderTargets===!0;if(oe)for(let Ie=0;Ie0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function P(T){const E=a.render.frame;v.get(T)!==E&&(v.set(T,E),T.update())}function N(T,E){const z=T.encoding,K=T.format,V=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||T.format===_SRGBAFormat||z!==LinearEncoding&&(z===sRGBEncoding?o===!1?e.has("EXT_sRGB")===!0&&K===RGBAFormat?(T.format=_SRGBAFormat,T.minFilter=LinearFilter,T.generateMipmaps=!1):E=ImageUtils.sRGBToLinear(E):(K!==RGBAFormat||V!==UnsignedByteType)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",z)),E}this.allocateTextureUnit=ie,this.resetTextureUnits=ue,this.setTexture2D=_e,this.setTexture2DArray=Q,this.setTexture3D=ne,this.setTextureCube=ye,this.rebindTextures=H,this.setupRenderTarget=j,this.updateRenderTargetMipmap=Y,this.updateMultisampleRenderTarget=ce,this.setupDepthRenderbuffer=k,this.setupFrameBufferTexture=we,this.useMultisampledRTT=se}function WebGLUtils(n,e,t){const i=t.isWebGL2;function r(s,a=null){let o;if(s===UnsignedByteType)return 5121;if(s===UnsignedShort4444Type)return 32819;if(s===UnsignedShort5551Type)return 32820;if(s===ByteType)return 5120;if(s===ShortType)return 5122;if(s===UnsignedShortType)return 5123;if(s===IntType)return 5124;if(s===UnsignedIntType)return 5125;if(s===FloatType)return 5126;if(s===HalfFloatType)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===AlphaFormat)return 6406;if(s===RGBAFormat)return 6408;if(s===LuminanceFormat)return 6409;if(s===LuminanceAlphaFormat)return 6410;if(s===DepthFormat)return 6402;if(s===DepthStencilFormat)return 34041;if(s===RGBFormat)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===_SRGBAFormat)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===RedFormat)return 6403;if(s===RedIntegerFormat)return 36244;if(s===RGFormat)return 33319;if(s===RGIntegerFormat)return 33320;if(s===RGBAIntegerFormat)return 36249;if(s===RGB_S3TC_DXT1_Format||s===RGBA_S3TC_DXT1_Format||s===RGBA_S3TC_DXT3_Format||s===RGBA_S3TC_DXT5_Format)if(a===sRGBEncoding)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===RGB_S3TC_DXT1_Format)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT1_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT3_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===RGBA_S3TC_DXT5_Format)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===RGB_S3TC_DXT1_Format)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT1_Format)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===RGBA_S3TC_DXT3_Format)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===RGBA_S3TC_DXT5_Format)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===RGB_PVRTC_4BPPV1_Format||s===RGB_PVRTC_2BPPV1_Format||s===RGBA_PVRTC_4BPPV1_Format||s===RGBA_PVRTC_2BPPV1_Format)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===RGB_PVRTC_4BPPV1_Format)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===RGB_PVRTC_2BPPV1_Format)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===RGBA_PVRTC_4BPPV1_Format)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===RGBA_PVRTC_2BPPV1_Format)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===RGB_ETC1_Format)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===RGB_ETC2_Format||s===RGBA_ETC2_EAC_Format)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===RGB_ETC2_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===RGBA_ETC2_EAC_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===RGBA_ASTC_4x4_Format||s===RGBA_ASTC_5x4_Format||s===RGBA_ASTC_5x5_Format||s===RGBA_ASTC_6x5_Format||s===RGBA_ASTC_6x6_Format||s===RGBA_ASTC_8x5_Format||s===RGBA_ASTC_8x6_Format||s===RGBA_ASTC_8x8_Format||s===RGBA_ASTC_10x5_Format||s===RGBA_ASTC_10x6_Format||s===RGBA_ASTC_10x8_Format||s===RGBA_ASTC_10x10_Format||s===RGBA_ASTC_12x10_Format||s===RGBA_ASTC_12x12_Format)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===RGBA_ASTC_4x4_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===RGBA_ASTC_5x4_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===RGBA_ASTC_5x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===RGBA_ASTC_6x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===RGBA_ASTC_6x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===RGBA_ASTC_8x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===RGBA_ASTC_8x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===RGBA_ASTC_8x8_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===RGBA_ASTC_10x5_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===RGBA_ASTC_10x6_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===RGBA_ASTC_10x8_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===RGBA_ASTC_10x10_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===RGBA_ASTC_12x10_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RGBA_ASTC_12x12_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===RGBA_BPTC_Format)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===RGBA_BPTC_Format)return a===sRGBEncoding?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===UnsignedInt248Type?i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Group$1=class extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}};const _moveEvent={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Group$1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Group$1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Group$1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,i),x=this._getHandJoint(c,_);g!==null&&(x.matrix.fromArray(g.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.jointRadius=g.radius),x.visible=g!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),m=.02,v=.005;c.inputState.pinching&&f>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Group$1;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class DepthTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u){if(u=u!==void 0?u:DepthFormat,u!==DepthFormat&&u!==DepthStencilFormat)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===DepthFormat&&(i=UnsignedIntType),i===void 0&&u===DepthStencilFormat&&(i=UnsignedInt248Type),super(null,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:NearestFilter,this.minFilter=l!==void 0?l:NearestFilter,this.flipY=!1,this.generateMipmaps=!1}}class WebXRManager extends EventDispatcher{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=null,c=null,u=null,d=null,f=null,m=null;const v=t.getContextAttributes();let _=null,g=null;const x=[],S=[],y=new Set,b=new Map,w=new PerspectiveCamera;w.layers.enable(1),w.viewport=new Vector4;const C=new PerspectiveCamera;C.layers.enable(2),C.viewport=new Vector4;const R=[w,C],M=new ArrayCamera;M.layers.enable(1),M.layers.enable(2);let L=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getTargetRaySpace()},this.getControllerGrip=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getGripSpace()},this.getHand=function(Q){let ne=x[Q];return ne===void 0&&(ne=new WebXRController,x[Q]=ne),ne.getHandSpace()};function Z(Q){const ne=S.indexOf(Q.inputSource);if(ne===-1)return;const ye=x[ne];ye!==void 0&&ye.dispatchEvent({type:Q.type,data:Q.inputSource})}function q(){r.removeEventListener("select",Z),r.removeEventListener("selectstart",Z),r.removeEventListener("selectend",Z),r.removeEventListener("squeeze",Z),r.removeEventListener("squeezestart",Z),r.removeEventListener("squeezeend",Z),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",X);for(let Q=0;Q=0&&(S[Me]=null,x[Me].disconnect(ye))}for(let ne=0;ne=S.length){S.push(ye),Me=ae;break}else if(S[ae]===null){S[ae]=ye,Me=ae;break}if(Me===-1)break}const Te=x[Me];Te&&Te.connect(ye)}}const G=new Vector3,le=new Vector3;function he(Q,ne,ye){G.setFromMatrixPosition(ne.matrixWorld),le.setFromMatrixPosition(ye.matrixWorld);const Me=G.distanceTo(le),Te=ne.projectionMatrix.elements,ae=ye.projectionMatrix.elements,Le=Te[14]/(Te[10]-1),Ee=Te[14]/(Te[10]+1),Ce=(Te[9]+1)/Te[5],we=(Te[9]-1)/Te[5],O=(Te[8]-1)/Te[0],D=(ae[8]+1)/ae[0],k=Le*O,H=Le*D,j=Me/(-O+D),Y=j*-O;ne.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(Y),Q.translateZ(j),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert();const ce=Le+j,re=Ee+j,se=k-Y,P=H+(Me-Y),N=Ce*Ee/re*ce,T=we*Ee/re*ce;Q.projectionMatrix.makePerspective(se,P,N,T,ce,re)}function ue(Q,ne){ne===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(ne.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(r===null)return;M.near=C.near=w.near=Q.near,M.far=C.far=w.far=Q.far,(L!==M.near||B!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,B=M.far);const ne=Q.parent,ye=M.cameras;ue(M,ne);for(let Te=0;TeTe&&(b.set(Me,Me.lastChangedTime),i.dispatchEvent({type:"planechanged",data:Me}))}}m=null}const _e=new WebGLAnimation;_e.setAnimationLoop(ve),this.setAnimationLoop=function(Q){ie=Q},this.dispose=function(){}}}function WebGLMaterials(n,e){function t(_,g){g.color.getRGB(_.fogColor.value,getUnlitUniformColorSpace(n)),g.isFog?(_.fogNear.value=g.near,_.fogFar.value=g.far):g.isFogExp2&&(_.fogDensity.value=g.density)}function i(_,g,x,S,y){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(_,g):g.isMeshToonMaterial?(r(_,g),u(_,g)):g.isMeshPhongMaterial?(r(_,g),c(_,g)):g.isMeshStandardMaterial?(r(_,g),d(_,g),g.isMeshPhysicalMaterial&&f(_,g,y)):g.isMeshMatcapMaterial?(r(_,g),m(_,g)):g.isMeshDepthMaterial?r(_,g):g.isMeshDistanceMaterial?(r(_,g),v(_,g)):g.isMeshNormalMaterial?r(_,g):g.isLineBasicMaterial?(s(_,g),g.isLineDashedMaterial&&a(_,g)):g.isPointsMaterial?o(_,g,x,S):g.isSpriteMaterial?l(_,g):g.isShadowMaterial?(_.color.value.copy(g.color),_.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(_,g){_.opacity.value=g.opacity,g.color&&_.diffuse.value.copy(g.color),g.emissive&&_.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.bumpMap&&(_.bumpMap.value=g.bumpMap,_.bumpScale.value=g.bumpScale,g.side===BackSide&&(_.bumpScale.value*=-1)),g.displacementMap&&(_.displacementMap.value=g.displacementMap,_.displacementScale.value=g.displacementScale,_.displacementBias.value=g.displacementBias),g.emissiveMap&&(_.emissiveMap.value=g.emissiveMap),g.normalMap&&(_.normalMap.value=g.normalMap,_.normalScale.value.copy(g.normalScale),g.side===BackSide&&_.normalScale.value.negate()),g.specularMap&&(_.specularMap.value=g.specularMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);const x=e.get(g).envMap;if(x&&(_.envMap.value=x,_.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap){_.lightMap.value=g.lightMap;const b=n.physicallyCorrectLights!==!0?Math.PI:1;_.lightMapIntensity.value=g.lightMapIntensity*b}g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity);let S;g.map?S=g.map:g.specularMap?S=g.specularMap:g.displacementMap?S=g.displacementMap:g.normalMap?S=g.normalMap:g.bumpMap?S=g.bumpMap:g.roughnessMap?S=g.roughnessMap:g.metalnessMap?S=g.metalnessMap:g.alphaMap?S=g.alphaMap:g.emissiveMap?S=g.emissiveMap:g.clearcoatMap?S=g.clearcoatMap:g.clearcoatNormalMap?S=g.clearcoatNormalMap:g.clearcoatRoughnessMap?S=g.clearcoatRoughnessMap:g.iridescenceMap?S=g.iridescenceMap:g.iridescenceThicknessMap?S=g.iridescenceThicknessMap:g.specularIntensityMap?S=g.specularIntensityMap:g.specularColorMap?S=g.specularColorMap:g.transmissionMap?S=g.transmissionMap:g.thicknessMap?S=g.thicknessMap:g.sheenColorMap?S=g.sheenColorMap:g.sheenRoughnessMap&&(S=g.sheenRoughnessMap),S!==void 0&&(S.isWebGLRenderTarget&&(S=S.texture),S.matrixAutoUpdate===!0&&S.updateMatrix(),_.uvTransform.value.copy(S.matrix));let y;g.aoMap?y=g.aoMap:g.lightMap&&(y=g.lightMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),_.uv2Transform.value.copy(y.matrix))}function s(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity}function a(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function o(_,g,x,S){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*x,_.scale.value=S*.5,g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);let y;g.map?y=g.map:g.alphaMap&&(y=g.alphaMap),y!==void 0&&(y.matrixAutoUpdate===!0&&y.updateMatrix(),_.uvTransform.value.copy(y.matrix))}function l(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);let x;g.map?x=g.map:g.alphaMap&&(x=g.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),_.uvTransform.value.copy(x.matrix))}function c(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function u(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function d(_,g){_.roughness.value=g.roughness,_.metalness.value=g.metalness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function f(_,g,x){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),_.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===BackSide&&_.clearcoatNormalScale.value.negate())),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=x.texture,_.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap)}function m(_,g){g.matcap&&(_.matcap.value=g.matcap)}function v(_,g){_.referencePosition.value.copy(g.referencePosition),_.nearDistance.value=g.nearDistance,_.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function WebGLUniformsGroups(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(35375):0;function l(S,y){const b=y.program;i.uniformBlockBinding(S,b)}function c(S,y){let b=r[S.id];b===void 0&&(v(S),b=u(S),r[S.id]=b,S.addEventListener("dispose",g));const w=y.program;i.updateUBOMapping(S,w);const C=e.render.frame;s[S.id]!==C&&(f(S),s[S.id]=C)}function u(S){const y=d();S.__bindingPointIndex=y;const b=n.createBuffer(),w=S.__size,C=S.usage;return n.bindBuffer(35345,b),n.bufferData(35345,w,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,y,b),b}function d(){for(let S=0;S0){C=b%w;const Z=w-C;C!==0&&Z-B.boundary<0&&(b+=w-C,L.__offset=b)}b+=B.storage}return C=b%w,C>0&&(b+=w-C),S.__size=b,S.__cache={},this}function _(S){const y=S.value,b={boundary:0,storage:0};return typeof y=="number"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=48,b.storage=48):y.isMatrix4?(b.boundary=64,b.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),b}function g(S){const y=S.target;y.removeEventListener("dispose",g);const b=a.indexOf(y.__bindingPointIndex);a.splice(b,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function x(){for(const S in r)n.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:x}}function createCanvasElement(){const n=createElementNS("canvas");return n.style.display="block",n}function WebGLRenderer(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:createCanvasElement(),t=n.context!==void 0?n.context:null,i=n.depth!==void 0?n.depth:!0,r=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,a=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,o=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",c=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let u;t!==null?u=t.getContextAttributes().alpha:u=n.alpha!==void 0?n.alpha:!1;let d=null,f=null;const m=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=LinearEncoding,this.physicallyCorrectLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const _=this;let g=!1,x=0,S=0,y=null,b=-1,w=null;const C=new Vector4,R=new Vector4;let M=null,L=e.width,B=e.height,Z=1,q=null,X=null;const G=new Vector4(0,0,L,B),le=new Vector4(0,0,L,B);let he=!1;const ue=new Frustum;let ie=!1,ve=!1,_e=null;const Q=new Matrix4,ne=new Vector2,ye=new Vector3,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Te(){return y===null?Z:1}let ae=t;function Le(F,ee){for(let de=0;de0?f=v[v.length-1]:f=null,m.pop(),m.length>0?d=m[m.length-1]:d=null};function tt(F,ee,de,J){if(F.visible===!1)return;if(F.layers.test(ee.layers)){if(F.isGroup)de=F.renderOrder;else if(F.isLOD)F.autoUpdate===!0&&F.update(ee);else if(F.isLight)f.pushLight(F),F.castShadow&&f.pushShadow(F);else if(F.isSprite){if(!F.frustumCulled||ue.intersectsSprite(F)){J&&ye.setFromMatrixPosition(F.matrixWorld).applyMatrix4(Q);const Ve=re.update(F),Ue=F.material;Ue.visible&&d.push(F,Ve,Ue,de,ye.z,null)}}else if((F.isMesh||F.isLine||F.isPoints)&&(F.isSkinnedMesh&&F.skeleton.frame!==O.render.frame&&(F.skeleton.update(),F.skeleton.frame=O.render.frame),!F.frustumCulled||ue.intersectsObject(F))){J&&ye.setFromMatrixPosition(F.matrixWorld).applyMatrix4(Q);const Ve=re.update(F),Ue=F.material;if(Array.isArray(Ue)){const ze=Ve.groups;for(let $e=0,Ge=ze.length;$e0&&_t(pe,ee,de),J&&we.viewport(C.copy(J)),pe.length>0&&Ke(pe,ee,de),Be.length>0&&Ke(Be,ee,de),Ve.length>0&&Ke(Ve,ee,de),we.buffers.depth.setTest(!0),we.buffers.depth.setMask(!0),we.buffers.color.setMask(!0),we.setPolygonOffset(!1)}function _t(F,ee,de){const J=Ce.isWebGL2;_e===null&&(_e=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:J&&s===!0?4:0})),_.getDrawingBufferSize(ne),J?_e.setSize(ne.x,ne.y):_e.setSize(floorPowerOfTwo(ne.x),floorPowerOfTwo(ne.y));const pe=_.getRenderTarget();_.setRenderTarget(_e),_.clear();const Be=_.toneMapping;_.toneMapping=NoToneMapping,Ke(F,ee,de),_.toneMapping=Be,k.updateMultisampleRenderTarget(_e),k.updateRenderTargetMipmap(_e),_.setRenderTarget(pe)}function Ke(F,ee,de){const J=ee.isScene===!0?ee.overrideMaterial:null;for(let pe=0,Be=F.length;pe0&&k.useMultisampledRTT(F)===!1?pe=D.get(F).__webglMultisampledFramebuffer:pe=Ge,C.copy(F.viewport),R.copy(F.scissor),M=F.scissorTest}else C.copy(G).multiplyScalar(Z).floor(),R.copy(le).multiplyScalar(Z).floor(),M=he;if(we.bindFramebuffer(36160,pe)&&Ce.drawBuffers&&J&&we.drawBuffers(F,pe),we.viewport(C),we.scissor(R),we.setScissorTest(M),Be){const ze=D.get(F.texture);ae.framebufferTexture2D(36160,36064,34069+ee,ze.__webglTexture,de)}else if(Ve){const ze=D.get(F.texture),$e=ee||0;ae.framebufferTextureLayer(36160,36064,ze.__webglTexture,de||0,$e)}b=-1},this.readRenderTargetPixels=function(F,ee,de,J,pe,Be,Ve){if(!(F&&F.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ue=D.get(F).__webglFramebuffer;if(F.isWebGLCubeRenderTarget&&Ve!==void 0&&(Ue=Ue[Ve]),Ue){we.bindFramebuffer(36160,Ue);try{const ze=F.texture,$e=ze.format,Ge=ze.type;if($e!==RGBAFormat&&ge.convert($e)!==ae.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const He=Ge===HalfFloatType&&(Ee.has("EXT_color_buffer_half_float")||Ce.isWebGL2&&Ee.has("EXT_color_buffer_float"));if(Ge!==UnsignedByteType&&ge.convert(Ge)!==ae.getParameter(35738)&&!(Ge===FloatType&&(Ce.isWebGL2||Ee.has("OES_texture_float")||Ee.has("WEBGL_color_buffer_float")))&&!He){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ee>=0&&ee<=F.width-J&&de>=0&&de<=F.height-pe&&ae.readPixels(ee,de,J,pe,ge.convert($e),ge.convert(Ge),Be)}finally{const ze=y!==null?D.get(y).__webglFramebuffer:null;we.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(F,ee,de=0){const J=Math.pow(2,-de),pe=Math.floor(ee.image.width*J),Be=Math.floor(ee.image.height*J);k.setTexture2D(ee,0),ae.copyTexSubImage2D(3553,de,0,0,F.x,F.y,pe,Be),we.unbindTexture()},this.copyTextureToTexture=function(F,ee,de,J=0){const pe=ee.image.width,Be=ee.image.height,Ve=ge.convert(de.format),Ue=ge.convert(de.type);k.setTexture2D(de,0),ae.pixelStorei(37440,de.flipY),ae.pixelStorei(37441,de.premultiplyAlpha),ae.pixelStorei(3317,de.unpackAlignment),ee.isDataTexture?ae.texSubImage2D(3553,J,F.x,F.y,pe,Be,Ve,Ue,ee.image.data):ee.isCompressedTexture?ae.compressedTexSubImage2D(3553,J,F.x,F.y,ee.mipmaps[0].width,ee.mipmaps[0].height,Ve,ee.mipmaps[0].data):ae.texSubImage2D(3553,J,F.x,F.y,Ve,Ue,ee.image),J===0&&de.generateMipmaps&&ae.generateMipmap(3553),we.unbindTexture()},this.copyTextureToTexture3D=function(F,ee,de,J,pe=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Be=F.max.x-F.min.x+1,Ve=F.max.y-F.min.y+1,Ue=F.max.z-F.min.z+1,ze=ge.convert(J.format),$e=ge.convert(J.type);let Ge;if(J.isData3DTexture)k.setTexture3D(J,0),Ge=32879;else if(J.isDataArrayTexture)k.setTexture2DArray(J,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ae.pixelStorei(37440,J.flipY),ae.pixelStorei(37441,J.premultiplyAlpha),ae.pixelStorei(3317,J.unpackAlignment);const He=ae.getParameter(3314),Ze=ae.getParameter(32878),st=ae.getParameter(3316),gt=ae.getParameter(3315),Mt=ae.getParameter(32877),Je=de.isCompressedTexture?de.mipmaps[0]:de.image;ae.pixelStorei(3314,Je.width),ae.pixelStorei(32878,Je.height),ae.pixelStorei(3316,F.min.x),ae.pixelStorei(3315,F.min.y),ae.pixelStorei(32877,F.min.z),de.isDataTexture||de.isData3DTexture?ae.texSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,$e,Je.data):de.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ae.compressedTexSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,Je.data)):ae.texSubImage3D(Ge,pe,ee.x,ee.y,ee.z,Be,Ve,Ue,ze,$e,Je),ae.pixelStorei(3314,He),ae.pixelStorei(32878,Ze),ae.pixelStorei(3316,st),ae.pixelStorei(3315,gt),ae.pixelStorei(32877,Mt),pe===0&&J.generateMipmaps&&ae.generateMipmap(Ge),we.unbindTexture()},this.initTexture=function(F){F.isCubeTexture?k.setTextureCube(F,0):F.isData3DTexture?k.setTexture3D(F,0):F.isDataArrayTexture||F.isCompressedArrayTexture?k.setTexture2DArray(F,0):k.setTexture2D(F,0),we.unbindTexture()},this.resetState=function(){x=0,S=0,y=null,we.reset(),oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class WebGL1Renderer extends WebGLRenderer{}WebGL1Renderer.prototype.isWebGL1Renderer=!0;class FogExp2{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color(e),this.density=t}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Fog{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Color(e),this.near=t,this.far=i}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class InterleavedBuffer{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=StaticDrawUsage,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;re.far||t.push({distance:l,point:_intersectPoint.clone(),uv:Triangle.getUV(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function transformVertex(n,e,t,i,r,s){_alignedPosition.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(_rotatedPosition.x=s*_alignedPosition.x-r*_alignedPosition.y,_rotatedPosition.y=r*_alignedPosition.x+s*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),n.copy(e),n.x+=_rotatedPosition.x,n.y+=_rotatedPosition.y,n.applyMatrix4(_viewWorldMatrix)}const _v1$2=new Vector3,_v2$1=new Vector3;class LOD extends Object3D{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i0){let i,r;for(i=1,r=t.length;i0){_v1$2.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){_v1$2.setFromMatrixPosition(e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const i=_v1$2.distanceTo(_v2$1)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;rl)continue;f.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(f);Me.far||t.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const x=Math.max(0,a.start),S=Math.min(g.count,a.start+a.count);for(let y=x,b=S-1;yl)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);Ce.far||t.push({distance:C,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class VideoTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:LinearFilter,this.magFilter=s!==void 0?s:LinearFilter,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class FramebufferTexture extends Texture{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c,u,d,f){super(null,a,o,l,c,u,r,s,d,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=ClampToEdgeWrapping}}class CanvasTexture extends Texture{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);const u=i[r],f=i[r+1]-u,m=(a-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new Vector2:new Vector3);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new Vector3,r=[],s=[],a=[],o=new Vector3,l=new Matrix4;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new Vector3)}s[0]=new Vector3,a[0]=new Vector3;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),f<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),a[m]=a[m-1].clone(),o.crossVectors(r[m-1],r[m]),o.length()>Number.EPSILON){o.normalize();const v=Math.acos(clamp(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(o,v))}a[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(clamp(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),a[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class EllipseCurve extends Curve{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const i=t||new Vector2,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(tmp.subVectors(r[0],r[1]).add(r[0]),c=tmp);const d=r[o%s],f=r[(o+1)%s];if(this.closed||o+2r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return i.set(CatmullRom(o,l.x,c.x,u.x,d.x),CatmullRom(o,l.y,c.y,u.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const a=r[s]-i,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class LatheGeometry extends BufferGeometry{constructor(e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=clamp(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,d=new Vector3,f=new Vector2,m=new Vector3,v=new Vector3,_=new Vector3;let g=0,x=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:g=e[S+1].x-e[S].x,x=e[S+1].y-e[S].y,m.x=x*1,m.y=-g,m.z=x*0,_.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[S+1].x-e[S].x,x=e[S+1].y-e[S].y,m.x=x*1,m.y=-g,m.z=x*0,v.copy(m),m.x+=_.x,m.y+=_.y,m.z+=_.z,m.normalize(),l.push(m.x,m.y,m.z),_.copy(v)}for(let S=0;S<=t;S++){const y=i+S*u*r,b=Math.sin(y),w=Math.cos(y);for(let C=0;C<=e.length-1;C++){d.x=e[C].x*b,d.y=e[C].y,d.z=e[C].x*w,a.push(d.x,d.y,d.z),f.x=S/t,f.y=C/(e.length-1),o.push(f.x,f.y);const R=l[3*C+0]*b,M=l[3*C+1],L=l[3*C+0]*w;c.push(R,M,L)}}for(let S=0;S0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new Float32BufferAttribute(d,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2));function S(){const b=new Vector3,w=new Vector3;let C=0;const R=(t-e)/i;for(let M=0;M<=s;M++){const L=[],B=M/s,Z=B*(t-e)+e;for(let q=0;q<=r;q++){const X=q/r,G=X*l+o,le=Math.sin(G),he=Math.cos(G);w.x=Z*le,w.y=-B*i+g,w.z=Z*he,d.push(w.x,w.y,w.z),b.set(le,R,he).normalize(),f.push(b.x,b.y,b.z),m.push(X,1-B),L.push(v++)}_.push(L)}for(let M=0;M.9&&R<.1&&(y<.2&&(a[S+0]+=1),b<.2&&(a[S+2]+=1),w<.2&&(a[S+4]+=1))}}function f(S){s.push(S.x,S.y,S.z)}function m(S,y){const b=S*3;y.x=e[b+0],y.y=e[b+1],y.z=e[b+2]}function v(){const S=new Vector3,y=new Vector3,b=new Vector3,w=new Vector3,C=new Vector2,R=new Vector2,M=new Vector2;for(let L=0,B=0;L80*t){o=c=n[0],l=u=n[1];for(let v=t;vc&&(c=d),f>u&&(u=f);m=Math.max(c-o,u-l),m=m!==0?32767/m:0}return earcutLinked(s,a,t,o,l,m,0),a}};function linkedList(n,e,t,i,r){let s,a;if(r===signedArea(n,e,t,i)>0)for(s=e;s=e;s-=i)a=insertNode(s,n[s],n[s+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(equals(t,t.next)||area(t.prev,t,t.next)===0)){if(removeNode(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function earcutLinked(n,e,t,i,r,s,a){if(!n)return;!a&&s&&indexCurve(n,i,r,s);let o=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?isEarHashed(n,i,r,s):isEar(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),removeNode(n),n=c.next,o=c.next;continue}if(n=c,n===o){a?a===1?(n=cureLocalIntersections(filterPoints(n),e,t),earcutLinked(n,e,t,i,r,s,2)):a===2&&splitEarcut(n,e,t,i,r,s):earcutLinked(filterPoints(n),e,t,i,r,s,1);break}}}function isEar(n){const e=n.prev,t=n,i=n.next;if(area(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=rs?r>a?r:a:s>a?s:a,m=o>l?o>c?o:c:l>c?l:c;let v=i.next;for(;v!==e;){if(v.x>=u&&v.x<=f&&v.y>=d&&v.y<=m&&pointInTriangle(r,o,s,l,a,c,v.x,v.y)&&area(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function isEarHashed(n,e,t,i){const r=n.prev,s=n,a=n.next;if(area(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,d=s.y,f=a.y,m=ol?o>c?o:c:l>c?l:c,g=u>d?u>f?u:f:d>f?d:f,x=zOrder(m,v,e,t,i),S=zOrder(_,g,e,t,i);let y=n.prevZ,b=n.nextZ;for(;y&&y.z>=x&&b&&b.z<=S;){if(y.x>=m&&y.x<=_&&y.y>=v&&y.y<=g&&y!==r&&y!==a&&pointInTriangle(o,u,l,d,c,f,y.x,y.y)&&area(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=m&&b.x<=_&&b.y>=v&&b.y<=g&&b!==r&&b!==a&&pointInTriangle(o,u,l,d,c,f,b.x,b.y)&&area(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=x;){if(y.x>=m&&y.x<=_&&y.y>=v&&y.y<=g&&y!==r&&y!==a&&pointInTriangle(o,u,l,d,c,f,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=S;){if(b.x>=m&&b.x<=_&&b.y>=v&&b.y<=g&&b!==r&&b!==a&&pointInTriangle(o,u,l,d,c,f,b.x,b.y)&&area(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function cureLocalIntersections(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!equals(r,s)&&intersects(r,i,i.next,s)&&locallyInside(r,s)&&locallyInside(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),removeNode(i),removeNode(i.next),i=n=s),i=i.next}while(i!==n);return filterPoints(i)}function splitEarcut(n,e,t,i,r,s){let a=n;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){let l=splitPolygon(a,o);a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,e,t,i,r,s,0),earcutLinked(l,e,t,i,r,s,0);return}o=o.next}a=a.next}while(a!==n)}function eliminateHoles(n,e,t,i){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x=t.x&&t.x>=l&&s!==t.x&&pointInTriangle(ar.x||t.x===r.x&§orContainsSector(r,t)))&&(r=t,u=d)),t=t.next;while(t!==o);return r}function sectorContainsSector(n,e){return area(n.prev,n,e.prev)<0&&area(e.next,n,n.next)<0}function indexCurve(n,e,t,i){let r=n;do r.z===0&&(r.z=zOrder(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,sortLinked(r)}function sortLinked(n){let e,t,i,r,s,a,o,l,c=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e0||l>0&&i;)o!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(a>1);return n}function zOrder(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function getLeftmost(n){let e=n,t=n;do(e.x=(n-a)*(s-o)&&(n-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(i-o)}function isValidDiagonal(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!intersectsPolygon(n,e)&&(locallyInside(n,e)&&locallyInside(e,n)&&middleInside(n,e)&&(area(n.prev,n,e.prev)||area(n,e.prev,e))||equals(n,e)&&area(n.prev,n,n.next)>0&&area(e.prev,e,e.next)>0)}function area(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function equals(n,e){return n.x===e.x&&n.y===e.y}function intersects(n,e,t,i){const r=sign(area(n,e,t)),s=sign(area(n,e,i)),a=sign(area(t,i,n)),o=sign(area(t,i,e));return!!(r!==s&&a!==o||r===0&&onSegment(n,t,e)||s===0&&onSegment(n,i,e)||a===0&&onSegment(t,n,i)||o===0&&onSegment(t,e,i))}function onSegment(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function sign(n){return n>0?1:n<0?-1:0}function intersectsPolygon(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&intersects(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function locallyInside(n,e){return area(n.prev,n,n.next)<0?area(n,e,n.next)>=0&&area(n,n.prev,e)>=0:area(n,e,n.prev)<0||area(n,n.next,e)<0}function middleInside(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function splitPolygon(n,e){const t=new Node(n.i,n.x,n.y),i=new Node(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function insertNode(n,e,t,i){const r=new Node(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function removeNode(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Node(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(n,e,t,i){let r=0;for(let s=e,a=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function addContour(n,e){for(let t=0;tNumber.EPSILON){const z=Math.sqrt(T),K=Math.sqrt(P*P+N*N),V=k.x-se/z,$=k.y+re/z,be=H.x-N/K,ge=H.y+P/K,oe=((be-V)*N-(ge-$)*P)/(re*N-se*P);j=V+re*oe-D.x,Y=$+se*oe-D.y;const Ie=j*j+Y*Y;if(Ie<=2)return new Vector2(j,Y);ce=Math.sqrt(Ie/2)}else{let z=!1;re>Number.EPSILON?P>Number.EPSILON&&(z=!0):re<-Number.EPSILON?P<-Number.EPSILON&&(z=!0):Math.sign(se)===Math.sign(N)&&(z=!0),z?(j=-se,Y=re,ce=Math.sqrt(T)):(j=re,Y=se,ce=Math.sqrt(T/2))}return new Vector2(j/ce,Y/ce)}const ve=[];for(let D=0,k=G.length,H=k-1,j=D+1;D=0;D--){const k=D/g,H=m*Math.cos(k*Math.PI/2),j=v*Math.sin(k*Math.PI/2)+_;for(let Y=0,ce=G.length;Y=0;){const j=H;let Y=H-1;Y<0&&(Y=D.length-1);for(let ce=0,re=u+g*2;ce0)&&m.push(y,b,C),(x!==i-1||l0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class MeshPhongMaterial extends Material{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color(16777215),this.specular=new Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class MeshToonMaterial extends Material{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class MeshNormalMaterial extends Material{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class MeshLambertMaterial extends Material{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class MeshMatcapMaterial extends Material{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class LineDashedMaterial extends LineBasicMaterial{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function arraySlice(n,e,t){return isTypedArray(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function convertArray(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function isTypedArray(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function getKeyframeOrder(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function sortedArray(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=n[o+l]}return r}function flattenJSON(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}function subclip(n,e,t,i,r=30){const s=n.clone();s.name=e;const a=[];for(let l=0;l=i)){d.push(c.times[m]);for(let _=0;_s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[v]){const x=v*d+u,S=x+d-u;_=arraySlice(o.values,x,S)}else{const x=o.createInterpolant(),S=u,y=d-u;x.evaluate(s),_=arraySlice(x.resultBuffer,S,y)}l==="quaternion"&&new Quaternion().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let x=0;x=s)){const o=t[1];e=s)break t}a=i,i=0;break i}break e}for(;i>>1;et;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=arraySlice(i,s,a),this.values=arraySlice(this.values,s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&isTypedArray(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=arraySlice(this.times),t=arraySlice(this.values),i=this.getValueSize(),r=this.getInterpolation()===InterpolateSmooth,s=e.length-1;let a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=arraySlice(e,0,a),this.values=arraySlice(t,0,a*i)):(this.times=e,this.values=t),this}clone(){const e=arraySlice(this.times,0),t=arraySlice(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}KeyframeTrack.prototype.TimeBufferType=Float32Array;KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool";BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)Quaternion.slerpFlat(s,0,a,c-o,a,c,l);return s}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion";QuaternionKeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string";StringKeyframeTrack.prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";class AnimationClip{constructor(e,t=-1,i,r=NormalAnimationBlendMode){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(parseKeyframeTrack(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(KeyframeTrack.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let o=0;o1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,f,m,v,_){if(m.length!==0){const g=[],x=[];flattenJSON(m,g,x,v),g.length!==0&&_.push(new d(f,g,x))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{t&&t(s),this.manager.itemEnd(e)},0),s;if(loading[e]!==void 0){loading[e].push({onLoad:t,onProgress:i,onError:r});return}loading[e]=[],loading[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=loading[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=f?parseInt(f):0,v=m!==0;let _=0;const g=new ReadableStream({start(x){S();function S(){d.read().then(({done:y,value:b})=>{if(y)x.close();else{_+=b.byteLength;const w=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:m});for(let C=0,R=u.length;C{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),f=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(f);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{Cache.add(e,c);const u=loading[e];delete loading[e];for(let d=0,f=u.length;d{const u=loading[e];if(u===void 0)throw this.manager.itemError(e),c;delete loading[e];for(let d=0,f=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};class AnimationLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new FileLoader$1(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=i(a.value);break;case"c":r.uniforms[s].value=new Color().setHex(a.value);break;case"v2":r.uniforms[s].value=new Vector2().fromArray(a.value);break;case"v3":r.uniforms[s].value=new Vector3().fromArray(a.value);break;case"v4":r.uniforms[s].value=new Vector4().fromArray(a.value);break;case"m3":r.uniforms[s].value=new Matrix3().fromArray(a.value);break;case"m4":r.uniforms[s].value=new Matrix4().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Vector2().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Vector2().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new t[e]}}class LoaderUtils{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new LoadingManager(t);s=new ImageLoader(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new ImageLoader(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Cache.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Cache.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let _context;class AudioContext{static getContext(){return _context===void 0&&(_context=new(window.AudioContext||window.webkitAudioContext)),_context}static setContext(e){_context=e}}class AudioLoader extends Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new FileLoader$1(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{const l=o.slice(0);AudioContext.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}}class HemisphereLightProbe extends LightProbe{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new Color().set(e),s=new Color().set(t),a=new Vector3(r.r,r.g,r.b),o=new Vector3(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}class AmbientLightProbe extends LightProbe{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Color().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const _eyeRight=new Matrix4,_eyeLeft=new Matrix4,_projectionMatrix=new Matrix4;class StereoCamera{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,_projectionMatrix.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(DEG2RAD$1*t.fov*.5)/t.zoom;let o,l;_eyeLeft.elements[12]=-r,_eyeRight.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,_projectionMatrix.elements[0]=2*t.near/(l-o),_projectionMatrix.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(_projectionMatrix),o=-a*t.aspect-s,l=a*t.aspect-s,_projectionMatrix.elements[0]=2*t.near/(l-o),_projectionMatrix.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(_projectionMatrix)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(_eyeLeft),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_eyeRight)}}class Clock{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function now(){return(typeof performance>"u"?Date:performance).now()}const _position$1=new Vector3,_quaternion$1=new Quaternion,_scale$1=new Vector3,_orientation$1=new Vector3;class AudioListener extends Object3D{constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_position$1,_quaternion$1,_scale$1),_orientation$1.set(0,0,-1).applyQuaternion(_quaternion$1),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(_position$1.x,r),t.positionY.linearRampToValueAtTime(_position$1.y,r),t.positionZ.linearRampToValueAtTime(_position$1.z,r),t.forwardX.linearRampToValueAtTime(_orientation$1.x,r),t.forwardY.linearRampToValueAtTime(_orientation$1.y,r),t.forwardZ.linearRampToValueAtTime(_orientation$1.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(_position$1.x,_position$1.y,_position$1.z),t.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,i.x,i.y,i.z)}}class Audio extends Object3D{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){o.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,a=r;s!==a;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,r){Quaternion.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const a=this._workIndex*s;Quaternion.multiplyQuaternionsFlat(e,a,e,t,e,i),Quaternion.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[i+o]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[i+a]*r}}}const _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=new RegExp("["+_RESERVED_CHARS_RE+"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE.replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar),_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_wordChar),_trackRe=new RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+"$"),_supportedObjectNames=["material","materials","bones","map"];class Composite{constructor(e,t,i){const r=i||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class PropertyBinding{constructor(e,t,i){this.path=t,this.parsedPath=i||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,i):new PropertyBinding(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(e){const t=_trackRe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);_supportedObjectNames.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a=s){const d=s++,f=e[d];t[f.uuid]=u,e[u]=f,t[c]=d,e[d]=l;for(let m=0,v=r;m!==v;++m){const _=i[m],g=_[d],x=_[u];_[u]=g,_[d]=x}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,_=r;v!==_;++v){const g=i[v];g[d]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);r=s.length,i[e]=r,a.push(e),o.push(t),s.push(d);for(let f=u,m=l.length;f!==m;++f){const v=l[f];d[f]=new PropertyBinding(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=i,a[i]=l,a.pop(),s[i]=s[o],s.pop(),r[i]=r[o],r.pop()}}}class AnimationAction{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case NormalAnimationBlendMode:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const a=i===LoopPingPong;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===LoopOnce){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ZeroSlopeEnding,r.endingEnd=ZeroSlopeEnding):(e?r.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:r.endingStart=WrapAroundEnding,t?r.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:r.endingEnd=WrapAroundEnding)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=i,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const f=r[d],m=f.name;let v=u[m];if(v!==void 0)++v.referenceCount,a[d]=v;else{if(v=a[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const _=t&&t._propertyBindings[d].binding.parsedPath;v=new PropertyMixer(PropertyBinding.create(i,m,_),f.ValueTypeName,f.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),a[d]=v}o[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return _vector$4.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _startP=new Vector3,_startEnd=new Vector3;class Line3{constructor(e=new Vector3,t=new Vector3){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){_startP.subVectors(e,this.start),_startEnd.subVectors(this.end,this.start);const i=_startEnd.dot(_startEnd);let s=_startEnd.dot(_startP)/i;return t&&(s=clamp(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const _vector$3=new Vector3;class SpotLightHelper extends Object3D{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new BufferGeometry,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{_axis.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(_axis,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class AxesHelper extends LineSegments{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute(t,3)),r.setAttribute("color",new Float32BufferAttribute(i,3));const s=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Color,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ShapePath{constructor(){this.type="ShapePath",this.color=new Color,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(x){const S=[];for(let y=0,b=x.length;yNumber.EPSILON){if(B<0&&(R=S[C],L=-L,M=S[w],B=-B),x.yM.y)continue;if(x.y===R.y){if(x.x===R.x)return!0}else{const Z=B*(x.x-R.x)-L*(x.y-R.y);if(Z===0)return!0;if(Z<0)continue;b=!b}}else{if(x.y!==R.y)continue;if(M.x<=x.x&&x.x<=R.x||R.x<=x.x&&x.x<=M.x)return!0}}return b}const r=ShapeUtils.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Shape,l.curves=o.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const d=[],f=[];let m=[],v=0,_;f[v]=void 0,m[v]=[];for(let x=0,S=s.length;x1){let x=!1,S=0;for(let y=0,b=f.length;y0&&x===!1&&(m=d)}let g;for(let x=0,S=f.length;x>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function toHalfFloat(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=clamp(n,-65504,65504),_tables.floatView[0]=n;const e=_tables.uint32View[0],t=e>>23&511;return _tables.baseTable[t]+((e&8388607)>>_tables.shiftTable[t])}function fromHalfFloat(n){const e=n>>10;return _tables.uint32View[0]=_tables.mantissaTable[_tables.offsetTable[e]+(n&1023)]+_tables.exponentTable[e],_tables.floatView[0]}var DataUtils=Object.freeze({__proto__:null,toHalfFloat,fromHalfFloat});function ImmediateRenderObject(){console.error("THREE.ImmediateRenderObject has been removed.")}class WebGLMultisampleRenderTarget extends WebGLRenderTarget{constructor(e,t,i){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,i),this.samples=4}}class DataTexture2DArray extends DataArrayTexture{constructor(e,t,i,r){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,i,r)}}class DataTexture3D extends Data3DTexture{constructor(e,t,i,r){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,i,r)}}class BoxBufferGeometry extends BoxGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,i,r,s,a)}}class CapsuleBufferGeometry extends CapsuleGeometry{constructor(e,t,i,r){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,i,r)}}class CircleBufferGeometry extends CircleGeometry{constructor(e,t,i,r){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,i,r)}}class ConeBufferGeometry extends ConeGeometry{constructor(e,t,i,r,s,a,o){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,i,r,s,a,o)}}class CylinderBufferGeometry extends CylinderGeometry{constructor(e,t,i,r,s,a,o,l){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,i,r,s,a,o,l)}}class DodecahedronBufferGeometry extends DodecahedronGeometry{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class ExtrudeBufferGeometry extends ExtrudeGeometry{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class IcosahedronBufferGeometry extends IcosahedronGeometry{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class LatheBufferGeometry extends LatheGeometry{constructor(e,t,i,r){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,i,r)}}class OctahedronBufferGeometry extends OctahedronGeometry{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class PlaneBufferGeometry extends PlaneGeometry{constructor(e,t,i,r){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,i,r)}}class PolyhedronBufferGeometry extends PolyhedronGeometry{constructor(e,t,i,r){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,i,r)}}class RingBufferGeometry extends RingGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,i,r,s,a)}}class ShapeBufferGeometry extends ShapeGeometry{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class SphereBufferGeometry extends SphereGeometry{constructor(e,t,i,r,s,a,o){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,i,r,s,a,o)}}class TetrahedronBufferGeometry extends TetrahedronGeometry{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class TorusBufferGeometry extends TorusGeometry{constructor(e,t,i,r,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,i,r,s)}}class TorusKnotBufferGeometry extends TorusKnotGeometry{constructor(e,t,i,r,s,a){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,i,r,s,a)}}class TubeBufferGeometry extends TubeGeometry{constructor(e,t,i,r,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,i,r,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:REVISION}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=REVISION);const three_module=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AlphaFormat,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AmbientLightProbe,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxBufferGeometry,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleBufferGeometry,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleBufferGeometry,CircleGeometry,ClampToEdgeWrapping,Clock,Color,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedTexture,CompressedTextureLoader,ConeBufferGeometry,ConeGeometry,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderBufferGeometry,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTexture2DArray,DataTexture3D,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DodecahedronBufferGeometry,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher,ExtrudeBufferGeometry,ExtrudeGeometry,FileLoader:FileLoader$1,Float16BufferAttribute,Float32BufferAttribute,Float64BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterDepth,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group:Group$1,HalfFloatType,HemisphereLight,HemisphereLightHelper,HemisphereLightProbe,IcosahedronBufferGeometry,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,ImmediateRenderObject,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheBufferGeometry,LatheGeometry,Layers,LessDepth,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearEncoding,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace,LinearToneMapping,Loader,LoaderUtils,LoadingManager,LoopOnce,LoopPingPong,LoopRepeat,LuminanceAlphaFormat,LuminanceFormat,MOUSE,Material,MaterialLoader,MathUtils,Matrix3,Matrix4,MaxEquation,Mesh,MeshBasicMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,MinEquation,MirroredRepeatWrapping,MixOperation,MultiplyBlending,MultiplyOperation,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronBufferGeometry,OctahedronGeometry,OneFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneBufferGeometry,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronBufferGeometry,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,REVISION,RGBADepthPacking,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingBufferGeometry,RingGeometry,SRGBColorSpace,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeBufferGeometry,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereBufferGeometry,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronBufferGeometry,TetrahedronGeometry,Texture,TextureLoader,TorusBufferGeometry,TorusGeometry,TorusKnotBufferGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeBufferGeometry,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL1Renderer,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLMultisampleRenderTarget,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,_SRGBAFormat,sRGBEncoding},Symbol.toStringTag,{value:"Module"})),VEC2_ZERO=new Vector2(0,0),VEC3_ZERO=new Vector3(0,0,0),VEC3_X=new Vector3(1,0,0),VEC3_Y=new Vector3(0,1,0),VEC3_Z=new Vector3(0,0,1),stringToImage=n=>{let e=document.createElementNS("http://www.w3.org/1999/xhtml","img");return e.src=n,e},pathFromCoords=(n,e)=>{let t="x";return t+=splitNumberToPath(n),t+="z",t+=splitNumberToPath(e),t=t.substring(0,t.length-1),t},splitNumberToPath=n=>{let e="";n<0&&(n=-n,e+="-");let t=n.toString();for(let i=0;i`x${n}z${e}`,generateCacheHash=()=>Math.round(Math.random()*1e6),dispatchEvent=(n,e,t={})=>{if(!(!n||!n.dispatchEvent))return n.dispatchEvent(new CustomEvent(e,{detail:t}))},alert=(n,e,t="info")=>{dispatchEvent(n,"bluemapAlert",{message:e,level:t})!==!1&&(t==="info"?console.log(`[BlueMap/${t}]`,e):t==="warning"?console.warn(`[BlueMap/${t}]`,e):t==="error"?console.error(`[BlueMap/${t}]`,e):console.debug(`[BlueMap/${t}]`,e))},htmlToElement=n=>{let e=document.createElement("template");return e.innerHTML=n.trim(),e.content.firstChild},htmlToElements=n=>{let e=document.createElement("template");return e.innerHTML=n,e.content.childNodes},animate=function(n,e=1e3,t=null){let i={animationStart:-1,lastFrame:-1,cancelled:!1,frame:function(r){if(this.cancelled)return;this.animationStart===-1&&(this.animationStart=r,this.lastFrame=r);let s=e===0?1:MathUtils.clamp((r-this.animationStart)/e,0,1),a=r-this.lastFrame;n(s,a),s<1?window.requestAnimationFrame(o=>this.frame(o)):t&&t(!0),this.lastFrame=r},cancel:function(){this.cancelled=!0,t&&t(!1)}};return e!==0?window.requestAnimationFrame(r=>i.frame(r)):i.frame(0),i},EasingFunctions={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>n*(2-n),easeInOutQuad:n=>n<.5?2*n*n:-1+(4-2*n)*n,easeInCubic:n=>n*n*n,easeOutCubic:n=>--n*n*n+1,easeInOutCubic:n=>n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1- --n*n*n*n,easeInOutQuart:n=>n<.5?8*n*n*n*n:1-8*--n*n*n*n,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1+--n*n*n*n*n,easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n},elementOffset=n=>{let e=n.getBoundingClientRect(),t=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+t}},deepEquals=(n,e)=>{if(Object.is(n,e))return!0;let t=typeof n;if(t!==typeof e||t==="number"||t==="boolean"||t==="string")return!1;if(Array.isArray(n)){let i=n.length;if(i!==e.length)return!1;for(let r=0;r{Array.isArray(e)||(e=e.trim().split(" ")),e.forEach(r=>n.addEventListener(r,t,i))},removeEventListeners=(n,e,t,i)=>{Array.isArray(e)||(e=e.trim().split(" ")),e.forEach(r=>n.removeEventListener(r,t,i))},softMin=(n,e,t)=>{if(n>=e)return n;let i=e-n;return i<1e-4?e:n+i*t},softMax=(n,e,t)=>{if(n<=e)return n;let i=n-e;return i<1e-4?e:n-i*t},softClamp=(n,e,t,i)=>softMax(softMin(n,e,i),t,i),softSet=(n,e,t)=>softClamp(n,e,e,t),vecArrToObj=(n,e=!1)=>n&&n.length>=2?e?{x:n[0],z:n[1]}:{x:n[0],y:n[1]}:{},pixel=document.createElement("canvas");pixel.width=1;pixel.height=1;const pixelContext=pixel.getContext("2d",{willReadFrequently:!0}),getPixel=(n,e,t)=>(pixelContext.drawImage(n,Math.floor(e),Math.floor(t),1,1,0,0,1,1),pixelContext.getImageData(0,0,1,1).data),_sfc_main$m={name:"SvgButton",props:{active:Boolean}};function _sfc_render$m(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["svg-button",{active:t.active}]),onClick:e[0]||(e[0]=a=>n.$emit("action",a))},[renderSlot(n.$slots,"default")],2)}const SvgButton=_export_sfc(_sfc_main$m,[["render",_sfc_render$m]]);let animation$1;const _sfc_main$l={name:"Compass",components:{SvgButton},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data}},computed:{style(){return{transform:"translate(-50%, -50%) rotate("+-this.controls.rotation+"rad)"}}},methods:{action(n){n.preventDefault(),animation$1&&animation$1.cancel();let e=this.controls.rotation;animation$1=animate(t=>{this.controls.rotation=e*(1-EasingFunctions.easeOutQuad(t))},300)}}},_hoisted_1$j=createBaseVNode("path",{class:"north",d:`M14.792,1.04c0.114-0.354,0.299-0.354,0.412,0l4.089,12.729c0.114,0.353-0.097,0.642-0.468,0.642\r + l-7.651,0.001c-0.371,0-0.581-0.288-0.468-0.642L14.792,1.04z`},null,-1),_hoisted_2$e=createBaseVNode("path",{class:"south",d:`M10.707,16.23c-0.114-0.353,0.097-0.642,0.468-0.642l7.651-0.001c0.371,0,0.581,0.289,0.468,0.642\r + l-4.086,12.73c-0.113,0.353-0.299,0.353-0.412,0L10.707,16.23z`},null,-1),_hoisted_3$d=[_hoisted_1$j,_hoisted_2$e];function _sfc_render$l(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:"compass",onAction:s.action},{default:withCtx(()=>[(openBlock(),createElementBlock("svg",{viewBox:"0 0 30 30",style:normalizeStyle(s.style)},_hoisted_3$d,4))]),_:1},8,["onAction"])}const Compass=_export_sfc(_sfc_main$l,[["render",_sfc_render$l]]);let animation;const _sfc_main$k={name:"DayNightSwitch",components:{SvgButton},data(){return{mapViewer:this.$bluemap.mapViewer.data}},computed:{isDay(){return this.mapViewer.uniforms.sunlightStrength.value>.6}},methods:{action(n){n.preventDefault(),animation&&animation.cancel();let e=this.mapViewer.uniforms.sunlightStrength.value,t=this.isDay?.25:1;animation=animate(i=>{let r=EasingFunctions.easeOutQuad(i);this.mapViewer.uniforms.sunlightStrength.value=e*(1-r)+t*r,this.$bluemap.mapViewer.redraw()},300)}}},_hoisted_1$i=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M17.011,19.722c-3.778-1.613-5.533-5.982-3.921-9.76c0.576-1.348,1.505-2.432,2.631-3.204\r + c-3.418-0.243-6.765,1.664-8.186,4.992c-1.792,4.197,0.159,9.053,4.356,10.844c3.504,1.496,7.462,0.377,9.717-2.476\r + C20.123,20.465,18.521,20.365,17.011,19.722z`}),createBaseVNode("circle",{cx:"5.123",cy:"7.64",r:"1.196"}),createBaseVNode("circle",{cx:"23.178",cy:"5.249",r:"1.195"}),createBaseVNode("circle",{cx:"20.412",cy:"13.805",r:"1.195"}),createBaseVNode("circle",{cx:"25.878",cy:"23.654",r:"1.195"})],-1);function _sfc_render$k(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:"day-night-switch",active:!s.isDay,onAction:s.action},{default:withCtx(()=>[_hoisted_1$i]),_:1},8,["active","onAction"])}const DayNightSwitch=_export_sfc(_sfc_main$k,[["render",_sfc_render$k]]),_sfc_main$j={name:"ControlsSwitch",components:{SvgButton},data(){return{controls:this.$bluemap.appState.controls,mapViewer:this.$bluemap.mapViewer.data}},computed:{isPerspectiveView(){return this.controls.state==="perspective"},isFlatView(){return this.controls.state==="flat"},isFreeFlight(){return this.controls.state==="free"}},methods:{setPerspectiveView(){this.$bluemap.setPerspectiveView(500,this.isFreeFlight?100:0)},setFlatView(){this.$bluemap.setFlatView(500,this.isFreeFlight?100:0)},setFreeFlight(){this.$bluemap.setFreeFlight(500)}}},_hoisted_1$h={class:"controls-switch"},_hoisted_2$d=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M19.475,10.574c-0.166-0.021-0.337-0.036-0.51-0.045c-0.174-0.009-0.35-0.013-0.525-0.011\r + c-0.176,0.002-0.353,0.01-0.526,0.024c-0.175,0.015-0.347,0.036-0.515,0.063l-13.39,2.189\r + c-0.372,0.061-0.7,0.146-0.975,0.247c-0.276,0.102-0.5,0.221-0.66,0.349c-0.161,0.129-0.259,0.268-0.282,0.408\r + c-0.024,0.141,0.028,0.285,0.165,0.421l5.431,5.511c0.086,0.087,0.191,0.167,0.314,0.241s0.263,0.142,0.417,0.202\r + c0.155,0.062,0.323,0.115,0.502,0.162c0.18,0.046,0.371,0.085,0.569,0.116s0.405,0.054,0.616,0.068\r + c0.211,0.015,0.427,0.021,0.645,0.017c0.217-0.003,0.436-0.016,0.652-0.037c0.217-0.022,0.431-0.054,0.641-0.095L27.12,17.43\r + c0.371-0.073,0.679-0.175,0.917-0.296c0.236-0.12,0.404-0.259,0.497-0.407c0.093-0.147,0.111-0.305,0.052-0.461\r + c-0.059-0.156-0.195-0.313-0.415-0.46l-7.089-4.742c-0.089-0.06-0.192-0.115-0.308-0.166\r + c-0.116-0.051-0.243-0.097-0.381-0.138c-0.137-0.041-0.283-0.078-0.438-0.108C19.803,10.621,19.641,10.595,19.475,10.574`})],-1),_hoisted_3$c=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:"M22.371,4.158c1.65,0,3,1.35,3,3v15.684c0,1.65-1.35,3-3,3H7.629c-1.65,0-3-1.35-3-3V7.158c0-1.65,1.35-3,3-3H22.371z"})],-1),_hoisted_4$8=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M21.927,11.253c-0.256-0.487-0.915-0.885-1.465-0.885h-2.004c-0.55,0-0.726-0.356-0.39-0.792c0,0,0.698-0.905,0.698-2.041\r + c0-2.08-1.687-3.767-3.767-3.767s-3.767,1.687-3.767,3.767c0,1.136,0.698,2.041,0.698,2.041c0.336,0.436,0.161,0.794-0.389,0.797\r + l-2.005,0.01c-0.55,0.002-1.21,0.403-1.467,0.889l-3.656,6.924c-0.257,0.487-0.088,1.128,0.375,1.425l1.824,1.171\r + c0.462,0.297,1.116,0.184,1.451-0.253l0.839-1.092c0.335-0.437,0.662-0.346,0.726,0.2l0.637,5.415\r + c0.064,0.546,0.567,0.993,1.117,0.993h7.234c0.55,0,1.053-0.447,1.117-0.993l0.635-5.401c0.064-0.546,0.392-0.637,0.727-0.2\r + l0.828,1.078c0.335,0.437,0.988,0.55,1.451,0.253l1.823-1.171c0.463-0.297,0.633-0.938,0.377-1.425L21.927,11.253z`})],-1);function _sfc_render$j(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createElementBlock("div",_hoisted_1$h,[r.mapViewer.map.perspectiveView?(openBlock(),createBlock(a,{key:0,active:s.isPerspectiveView,onAction:s.setPerspectiveView,title:n.$t("controls.perspective.tooltip")},{default:withCtx(()=>[_hoisted_2$d]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0),r.mapViewer.map.flatView?(openBlock(),createBlock(a,{key:1,active:s.isFlatView,onAction:s.setFlatView,title:n.$t("controls.flatView.tooltip")},{default:withCtx(()=>[_hoisted_3$c]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0),r.mapViewer.map.freeFlightView?(openBlock(),createBlock(a,{key:2,active:s.isFreeFlight,onAction:s.setFreeFlight,title:n.$t("controls.freeFlight.tooltip")},{default:withCtx(()=>[_hoisted_4$8]),_:1},8,["active","onAction","title"])):createCommentVNode("",!0)])}const ControlsSwitch=_export_sfc(_sfc_main$j,[["render",_sfc_render$j]]),_sfc_main$i={name:"MenuButton",components:{SvgButton},props:{close:Boolean,back:Boolean}},_hoisted_1$g=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,15c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,13.539,25.004,14.193,25.004,15L25.004,15z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})])],-1);function _sfc_render$i(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createBlock(a,{class:normalizeClass(["menu-button",{close:t.close,back:t.back}])},{default:withCtx(()=>[_hoisted_1$g]),_:1},8,["class"])}const MenuButton=_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]),_sfc_main$h={name:"ControlBar",components:{SvgButton,MenuButton,ControlsSwitch,DayNightSwitch,PositionInput,Compass},data(){return{appState:this.$bluemap.appState,markers:this.$bluemap.mapViewer.markers.data,mapViewer:this.$bluemap.mapViewer.data}},computed:{playerMarkerSet(){for(let n of this.markers.markerSets)if(n.id==="bm-players")return n;return{id:"bm-players",label:"Players",markerSets:[],markers:[],fake:!0}},showMapMenu(){return this.mapViewer.mapState==="loading"||this.mapViewer.mapState==="loaded"},showViewControls(){return this.mapViewer.map?this.mapViewer.map.views.length>1:!1},showMarkerMenu(){return this.hasMarkers(this.markers)}},methods:{openPlayerList(){let n=this.playerMarkerSet;this.appState.menu.openPage("markers",this.$t("players.title"),{markerSet:n})},hasMarkers(n){if(n.markers.length>0)return!0;for(let e of n.markerSets)if(e.id!=="bm-players"&&e.id!=="bm-popup-set"&&this.hasMarkers(e))return!0;return!1}}},_hoisted_1$f={class:"control-bar"},_hoisted_2$c=createBaseVNode("div",{class:"space thin-hide"},null,-1),_hoisted_3$b=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("polygon",{points:"26.708,22.841 19.049,25.186 11.311,20.718 3.292,22.841 7.725,5.96 13.475,4.814 19.314,7.409 25.018,6.037 "})],-1),_hoisted_4$7=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M15,3.563c-4.459,0-8.073,3.615-8.073,8.073c0,6.483,8.196,14.802,8.196,14.802s7.951-8.013,7.951-14.802\r + C23.073,7.177,19.459,3.563,15,3.563z M15,15.734c-2.263,0-4.098-1.835-4.098-4.099c0-2.263,1.835-4.098,4.098-4.098\r + c2.263,0,4.098,1.835,4.098,4.098C19.098,13.899,17.263,15.734,15,15.734z`})],-1),_hoisted_5$3=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M8.95,14.477c0.409-0.77,1.298-1.307,2.164-1.309h0.026c-0.053-0.234-0.087-0.488-0.087-0.755\r + c0-1.381,0.715-2.595,1.791-3.301c-0.01,0-0.021-0.006-0.03-0.006h-1.427c-0.39,0-0.514-0.251-0.276-0.563\r + c0,0,0.497-0.645,0.497-1.452c0-1.48-1.2-2.681-2.679-2.681c-1.481,0-2.679,1.2-2.679,2.681c0,0.807,0.496,1.452,0.496,1.452\r + c0.24,0.311,0.114,0.565-0.275,0.565L5.042,9.118C4.649,9.119,4.182,9.405,3.998,9.75l-2.601,4.927\r + c-0.184,0.347-0.062,0.802,0.265,1.015l1.297,0.83c0.332,0.213,0.794,0.135,1.034-0.18l0.598-0.775\r + c0.238-0.31,0.471-0.245,0.516,0.141l0.454,3.854c0.035,0.311,0.272,0.566,0.564,0.66c0.018-0.279,0.087-0.561,0.225-0.82\r + L8.95,14.477z`}),createBaseVNode("path",{d:`M28.604,14.677l-2.597-4.94c-0.185-0.346-0.65-0.631-1.042-0.631h-1.428c-0.39,0-0.514-0.251-0.274-0.563\r + c0,0,0.496-0.645,0.496-1.452c0-1.48-1.2-2.681-2.68-2.681c-1.481,0-2.679,1.2-2.679,2.681c0,0.807,0.496,1.452,0.496,1.452\r + c0.239,0.311,0.114,0.565-0.275,0.565l-1.428,0.009c-0.005,0-0.009,0.002-0.015,0.002c1.067,0.708,1.774,1.917,1.774,3.292\r + c0,0.263-0.031,0.513-0.084,0.744h0.02c0.868,0,1.758,0.537,2.166,1.305l2.598,4.944c0.137,0.262,0.205,0.539,0.222,0.818\r + c0.296-0.092,0.538-0.35,0.574-0.664l0.451-3.842c0.044-0.389,0.28-0.452,0.519-0.143l0.588,0.768\r + c0.239,0.313,0.702,0.391,1.033,0.182l1.297-0.833C28.667,15.479,28.787,15.026,28.604,14.677z`})]),createBaseVNode("path",{d:`M19.932,15.058c-0.184-0.346-0.651-0.63-1.043-0.63h-1.427c-0.39,0-0.515-0.252-0.275-0.564c0,0,0.496-0.645,0.496-1.451\r + c0-1.479-1.199-2.68-2.679-2.68c-1.482,0-2.679,1.201-2.679,2.68c0,0.806,0.496,1.451,0.496,1.451\r + c0.24,0.312,0.114,0.566-0.275,0.566l-1.427,0.009c-0.393,0.001-0.861,0.287-1.045,0.632l-2.602,4.925\r + c-0.185,0.348-0.062,0.803,0.266,1.016l1.297,0.832c0.332,0.213,0.794,0.133,1.034-0.18l0.598-0.775\r + c0.239-0.311,0.472-0.246,0.517,0.141l0.454,3.854c0.043,0.389,0.403,0.705,0.794,0.705h5.148c0.392,0,0.749-0.316,0.794-0.705\r + l0.45-3.844c0.045-0.389,0.282-0.451,0.52-0.143l0.587,0.768c0.239,0.313,0.703,0.393,1.033,0.182l1.297-0.832\r + c0.331-0.213,0.451-0.666,0.269-1.016L19.932,15.058z`})],-1),_hoisted_6$3=createBaseVNode("div",{class:"space thin-hide greedy"},null,-1),_hoisted_7$3=createBaseVNode("div",{class:"space thin-hide"},null,-1),_hoisted_8$3={key:5,class:"space thin-hide"},_hoisted_9$2=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("rect",{x:"7.085",y:"4.341",transform:"matrix(0.9774 0.2116 -0.2116 0.9774 3.2046 -1.394)",width:"2.063",height:"19.875"}),createBaseVNode("path",{d:`M12.528,5.088c0,0,3.416-0.382,4.479-0.031c1.005,0.332,2.375,2.219,3.382,2.545c1.096,0.354,4.607-0.089,4.607-0.089\r + l-2.738,8.488c0,0-3.285,0.641-4.344,0.381c-1.049-0.257-2.607-2.015-3.642-2.324c-0.881-0.264-3.678-0.052-3.678-0.052\r + L12.528,5.088z`})],-1);function _sfc_render$h(n,e,t,i,r,s){const a=resolveComponent("MenuButton"),o=resolveComponent("SvgButton"),l=resolveComponent("DayNightSwitch"),c=resolveComponent("ControlsSwitch"),u=resolveComponent("PositionInput"),d=resolveComponent("Compass");return openBlock(),createElementBlock("div",_hoisted_1$f,[createVNode(a,{close:r.appState.menu.isOpen,back:!1,onAction:e[0]||(e[0]=f=>r.appState.menu.reOpenPage()),title:n.$t("menu.tooltip")},null,8,["close","title"]),_hoisted_2$c,r.appState.maps.length>1?(openBlock(),createBlock(o,{key:0,class:"thin-hide",title:n.$t("maps.tooltip"),onAction:e[1]||(e[1]=f=>r.appState.menu.openPage("maps",n.$t("maps.title")))},{default:withCtx(()=>[_hoisted_3$b]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu&&s.showMarkerMenu?(openBlock(),createBlock(o,{key:1,class:"thin-hide",title:n.$t("markers.tooltip"),onAction:e[2]||(e[2]=f=>r.appState.menu.openPage("markers",n.$t("markers.title"),{markerSet:r.markers}))},{default:withCtx(()=>[_hoisted_4$7]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu&&!s.playerMarkerSet.fake?(openBlock(),createBlock(o,{key:2,class:"thin-hide",title:n.$t("players.tooltip"),onAction:s.openPlayerList},{default:withCtx(()=>[_hoisted_5$3]),_:1},8,["title","onAction"])):createCommentVNode("",!0),_hoisted_6$3,s.showMapMenu?(openBlock(),createBlock(l,{key:3,class:"thin-hide",title:n.$t("lighting.dayNightSwitch.tooltip")},null,8,["title"])):createCommentVNode("",!0),_hoisted_7$3,s.showMapMenu&&s.showViewControls?(openBlock(),createBlock(c,{key:4,class:"thin-hide"})):createCommentVNode("",!0),s.showViewControls?(openBlock(),createElementBlock("div",_hoisted_8$3)):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(o,{key:6,class:"thin-hide",title:n.$t("resetCamera.tooltip"),onAction:e[3]||(e[3]=f=>n.$bluemap.resetCamera())},{default:withCtx(()=>[_hoisted_9$2]),_:1},8,["title"])):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(u,{key:7,class:"pos-input"})):createCommentVNode("",!0),s.showMapMenu?(openBlock(),createBlock(d,{key:8,title:n.$t("compass.tooltip")},null,8,["title"])):createCommentVNode("",!0)])}const ControlBar=_export_sfc(_sfc_main$h,[["render",_sfc_render$h]]),_sfc_main$g={name:"SideMenu",components:{MenuButton},props:{title:{type:String,default:"Menu"},open:{type:Boolean,default:!0},back:Boolean},data(){return{rendered:!1}},methods:{async buttonEnterAnimation(){this.rendered=!1,await this.$nextTick(),await this.$nextTick(),this.rendered=!0}}},_hoisted_1$e={key:0,class:"side-menu"},_hoisted_2$b={class:"title"},_hoisted_3$a={class:"content"};function _sfc_render$g(n,e,t,i,r,s){const a=resolveComponent("MenuButton");return openBlock(),createBlock(Transition,{name:"side-menu",onEnter:e[2]||(e[2]=o=>{s.buttonEnterAnimation(),n.$emit("enter",o)})},{default:withCtx(()=>[t.open?(openBlock(),createElementBlock("div",_hoisted_1$e,[createVNode(a,{close:t.open&&r.rendered,back:t.back,onAction:e[0]||(e[0]=o=>n.$emit("back",o))},null,8,["close","back"]),t.open&&t.back?(openBlock(),createBlock(a,{key:0,class:"full-close",close:!0,onAction:e[1]||(e[1]=o=>n.$emit("close",o))})):createCommentVNode("",!0),createBaseVNode("div",_hoisted_2$b,toDisplayString$1(t.title),1),createBaseVNode("div",_hoisted_3$a,[renderSlot(n.$slots,"default")])])):createCommentVNode("",!0)]),_:3})}const SideMenu=_export_sfc(_sfc_main$g,[["render",_sfc_render$g]]),_sfc_main$f={name:"SimpleButton",props:{submenu:Boolean,active:{type:Boolean,default:!1}}},_hoisted_1$d={class:"label"},_hoisted_2$a={key:0,class:"submenu-icon"},_hoisted_3$9=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})],-1),_hoisted_4$6=[_hoisted_3$9];function _sfc_render$f(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["simple-button",{active:t.active}]),onClick:e[0]||(e[0]=a=>n.$emit("action"))},[createBaseVNode("div",_hoisted_1$d,[renderSlot(n.$slots,"default")]),t.submenu?(openBlock(),createElementBlock("div",_hoisted_2$a,_hoisted_4$6)):createCommentVNode("",!0)],2)}const SimpleButton=_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]),_sfc_main$e={name:"Group",props:{title:String}},_hoisted_1$c={class:"group"},_hoisted_2$9={class:"title"},_hoisted_3$8={class:"content"};function _sfc_render$e(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$c,[createBaseVNode("span",_hoisted_2$9,toDisplayString$1(t.title),1),createBaseVNode("div",_hoisted_3$8,[renderSlot(n.$slots,"default")])])}const Group=_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);function countDecimals(n){return Math.floor(n)===n?0:n.toString().split(".")[1].length||0}const _sfc_main$d={name:"Slider",props:{value:Number,min:Number,max:Number,step:Number,formatter:{type:Function,default:function(n){return parseFloat(n).toFixed(countDecimals(this.step))}}}},_hoisted_1$b={class:"slider"},_hoisted_2$8={class:"label"},_hoisted_3$7={class:"value"},_hoisted_4$5=["min","max","step","value"];function _sfc_render$d(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$b,[createBaseVNode("div",_hoisted_2$8,[renderSlot(n.$slots,"default"),createTextVNode(": "),createBaseVNode("span",_hoisted_3$7,toDisplayString$1(t.formatter(t.value)),1)]),createBaseVNode("label",null,[createBaseVNode("input",{type:"range",min:t.min,max:t.max,step:t.step,value:t.value,onInput:e[0]||(e[0]=a=>n.$emit("update",parseFloat(a.target.value))),onChange:e[1]||(e[1]=a=>n.$emit("lazy",parseFloat(a.target.value)))},null,40,_hoisted_4$5)])])}const Slider=_export_sfc(_sfc_main$d,[["render",_sfc_render$d]]),_sfc_main$c={name:"SwitchHandle",props:{on:Boolean}};function _sfc_render$c(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["switch",{on:t.on}])},null,2)}const SwitchHandle=_export_sfc(_sfc_main$c,[["render",_sfc_render$c]]),_sfc_main$b={name:"SwitchButton",components:{SwitchHandle},props:{on:Boolean}},_hoisted_1$a={class:"label"};function _sfc_render$b(n,e,t,i,r,s){const a=resolveComponent("SwitchHandle");return openBlock(),createElementBlock("div",{class:"switch-button",onClick:e[0]||(e[0]=o=>n.$emit("action"))},[createBaseVNode("div",_hoisted_1$a,[renderSlot(n.$slots,"default")]),createVNode(a,{on:t.on},null,8,["on"])])}const SwitchButton=_export_sfc(_sfc_main$b,[["render",_sfc_render$b]]);/*! + * shared v9.14.3 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */const inBrowser=typeof window<"u",makeSymbol=(n,e=!1)=>e?Symbol.for(n):Symbol(n),generateFormatCacheKey=(n,e,t)=>friendlyJSONstringify({l:n,k:e,s:t}),friendlyJSONstringify=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=n=>typeof n=="number"&&isFinite(n),isDate=n=>toTypeString(n)==="[object Date]",isRegExp=n=>toTypeString(n)==="[object RegExp]",isEmptyObject=n=>isPlainObject(n)&&Object.keys(n).length===0,assign$1=Object.assign,_create=Object.create,create=(n=null)=>_create(n);let _globalThis;const getGlobalThis=()=>_globalThis||(_globalThis=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:create());function escapeHtml(n){return n.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const hasOwnProperty=Object.prototype.hasOwnProperty;function hasOwn(n,e){return hasOwnProperty.call(n,e)}const isArray=Array.isArray,isFunction=n=>typeof n=="function",isString$1=n=>typeof n=="string",isBoolean=n=>typeof n=="boolean",isObject$1=n=>n!==null&&typeof n=="object",isPromise=n=>isObject$1(n)&&isFunction(n.then)&&isFunction(n.catch),objectToString=Object.prototype.toString,toTypeString=n=>objectToString.call(n),isPlainObject=n=>{if(!isObject$1(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},toDisplayString=n=>n==null?"":isArray(n)||isPlainObject(n)&&n.toString===objectToString?JSON.stringify(n,null,2):String(n);function join$1(n,e=""){return n.reduce((t,i,r)=>r===0?t+i:t+e+i,"")}function incrementer(n){let e=n;return()=>++e}function warn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const isNotObjectOrIsArray=n=>!isObject$1(n)||isArray(n);function deepCopy(n,e){if(isNotObjectOrIsArray(n)||isNotObjectOrIsArray(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:i,des:r}=t.pop();Object.keys(i).forEach(s=>{s!=="__proto__"&&(isObject$1(i[s])&&!isObject$1(r[s])&&(r[s]=Array.isArray(i[s])?[]:create()),isNotObjectOrIsArray(r[s])||isNotObjectOrIsArray(i[s])?r[s]=i[s]:t.push({src:i[s],des:r[s]}))})}}/*! + * message-compiler v9.14.3 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */function createPosition(n,e,t){return{line:n,column:e,offset:t}}function createLocation(n,e,t){return{start:n,end:e}}const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(n,...e){return e.length===1&&isObject(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(RE_ARGS,(t,i)=>e.hasOwnProperty(i)?e[i]:"")}const assign=Object.assign,isString=n=>typeof n=="string",isObject=n=>n!==null&&typeof n=="object";function join(n,e=""){return n.reduce((t,i,r)=>r===0?t+i:t+e+i,"")}const CompileWarnCodes={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},warnMessages={[CompileWarnCodes.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function createCompileWarn(n,e,...t){const i=format$1(warnMessages[n],...t||[]),r={message:String(i),code:n};return e&&(r.location=e),r}const CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},errorMessages={[CompileErrorCodes.EXPECTED_TOKEN]:"Expected token: '{0}'",[CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[CompileErrorCodes.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[CompileErrorCodes.EMPTY_PLACEHOLDER]:"Empty placeholder",[CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[CompileErrorCodes.INVALID_LINKED_FORMAT]:"Invalid linked format",[CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function createCompileError(n,e,t={}){const{domain:i,messages:r,args:s}=t,a=format$1((r||errorMessages)[n]||"",...s||[]),o=new SyntaxError(String(a));return o.code=n,e&&(o.location=e),o.domain=i,o}function defaultOnError(n){throw n}const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF=` +`,CHAR_LS="\u2028",CHAR_PS="\u2029";function createScanner(n){const e=n;let t=0,i=1,r=1,s=0;const a=R=>e[R]===CHAR_CR&&e[R+1]===CHAR_LF,o=R=>e[R]===CHAR_LF,l=R=>e[R]===CHAR_PS,c=R=>e[R]===CHAR_LS,u=R=>a(R)||o(R)||l(R)||c(R),d=()=>t,f=()=>i,m=()=>r,v=()=>s,_=R=>a(R)||l(R)||c(R)?CHAR_LF:e[R],g=()=>_(t),x=()=>_(t+s);function S(){return s=0,u(t)&&(i++,r=0),a(t)&&t++,t++,r++,e[t]}function y(){return a(t+s)&&s++,s++,e[t+s]}function b(){t=0,i=1,r=1,s=0}function w(R=0){s=R}function C(){const R=t+s;for(;R!==t;)S();s=0}return{index:d,line:f,column:m,peekOffset:v,charAt:_,currentChar:g,currentPeek:x,next:S,peek:y,reset:b,resetPeek:w,skipToPeek:C}}const EOF=void 0,DOT=".",LITERAL_DELIMITER="'",ERROR_DOMAIN$3="tokenizer";function createTokenizer(n,e={}){const t=e.location!==!1,i=createScanner(n),r=()=>i.index(),s=()=>createPosition(i.line(),i.column(),i.index()),a=s(),o=r(),l={currentType:14,offset:o,startLoc:a,endLoc:a,lastType:14,lastOffset:o,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function d(P,N,T,...E){const z=c();if(N.column+=T,N.offset+=T,u){const K=t?createLocation(z.startLoc,N):null,V=createCompileError(P,K,{domain:ERROR_DOMAIN$3,args:E});u(V)}}function f(P,N,T){P.endLoc=s(),P.currentType=N;const E={type:N};return t&&(E.loc=createLocation(P.startLoc,P.endLoc)),T!=null&&(E.value=T),E}const m=P=>f(P,14);function v(P,N){return P.currentChar()===N?(P.next(),N):(d(CompileErrorCodes.EXPECTED_TOKEN,s(),0,N),"")}function _(P){let N="";for(;P.currentPeek()===CHAR_SP||P.currentPeek()===CHAR_LF;)N+=P.currentPeek(),P.peek();return N}function g(P){const N=_(P);return P.skipToPeek(),N}function x(P){if(P===EOF)return!1;const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N===95}function S(P){if(P===EOF)return!1;const N=P.charCodeAt(0);return N>=48&&N<=57}function y(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=x(P.currentPeek());return P.resetPeek(),E}function b(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=P.currentPeek()==="-"?P.peek():P.currentPeek(),z=S(E);return P.resetPeek(),z}function w(P,N){const{currentType:T}=N;if(T!==2)return!1;_(P);const E=P.currentPeek()===LITERAL_DELIMITER;return P.resetPeek(),E}function C(P,N){const{currentType:T}=N;if(T!==8)return!1;_(P);const E=P.currentPeek()===".";return P.resetPeek(),E}function R(P,N){const{currentType:T}=N;if(T!==9)return!1;_(P);const E=x(P.currentPeek());return P.resetPeek(),E}function M(P,N){const{currentType:T}=N;if(!(T===8||T===12))return!1;_(P);const E=P.currentPeek()===":";return P.resetPeek(),E}function L(P,N){const{currentType:T}=N;if(T!==10)return!1;const E=()=>{const K=P.currentPeek();return K==="{"?x(P.peek()):K==="@"||K==="%"||K==="|"||K===":"||K==="."||K===CHAR_SP||!K?!1:K===CHAR_LF?(P.peek(),E()):q(P,!1)},z=E();return P.resetPeek(),z}function B(P){_(P);const N=P.currentPeek()==="|";return P.resetPeek(),N}function Z(P){const N=_(P),T=P.currentPeek()==="%"&&P.peek()==="{";return P.resetPeek(),{isModulo:T,hasSpace:N.length>0}}function q(P,N=!0){const T=(z=!1,K="",V=!1)=>{const $=P.currentPeek();return $==="{"?K==="%"?!1:z:$==="@"||!$?K==="%"?!0:z:$==="%"?(P.peek(),T(z,"%",!0)):$==="|"?K==="%"||V?!0:!(K===CHAR_SP||K===CHAR_LF):$===CHAR_SP?(P.peek(),T(!0,CHAR_SP,V)):$===CHAR_LF?(P.peek(),T(!0,CHAR_LF,V)):!0},E=T();return N&&P.resetPeek(),E}function X(P,N){const T=P.currentChar();return T===EOF?EOF:N(T)?(P.next(),T):null}function G(P){const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36}function le(P){return X(P,G)}function he(P){const N=P.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36||N===45}function ue(P){return X(P,he)}function ie(P){const N=P.charCodeAt(0);return N>=48&&N<=57}function ve(P){return X(P,ie)}function _e(P){const N=P.charCodeAt(0);return N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102}function Q(P){return X(P,_e)}function ne(P){let N="",T="";for(;N=ve(P);)T+=N;return T}function ye(P){g(P);const N=P.currentChar();return N!=="%"&&d(CompileErrorCodes.EXPECTED_TOKEN,s(),0,N),P.next(),"%"}function Me(P){let N="";for(;;){const T=P.currentChar();if(T==="{"||T==="}"||T==="@"||T==="|"||!T)break;if(T==="%")if(q(P))N+=T,P.next();else break;else if(T===CHAR_SP||T===CHAR_LF)if(q(P))N+=T,P.next();else{if(B(P))break;N+=T,P.next()}else N+=T,P.next()}return N}function Te(P){g(P);let N="",T="";for(;N=ue(P);)T+=N;return P.currentChar()===EOF&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T}function ae(P){g(P);let N="";return P.currentChar()==="-"?(P.next(),N+=`-${ne(P)}`):N+=ne(P),P.currentChar()===EOF&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),N}function Le(P){return P!==LITERAL_DELIMITER&&P!==CHAR_LF}function Ee(P){g(P),v(P,"'");let N="",T="";for(;N=X(P,Le);)N==="\\"?T+=Ce(P):T+=N;const E=P.currentChar();return E===CHAR_LF||E===EOF?(d(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),E===CHAR_LF&&(P.next(),v(P,"'")),T):(v(P,"'"),T)}function Ce(P){const N=P.currentChar();switch(N){case"\\":case"'":return P.next(),`\\${N}`;case"u":return we(P,N,4);case"U":return we(P,N,6);default:return d(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),0,N),""}}function we(P,N,T){v(P,N);let E="";for(let z=0;z{const E=P.currentChar();return E==="{"||E==="%"||E==="@"||E==="|"||E==="("||E===")"||!E||E===CHAR_SP?T:(T+=E,P.next(),N(T))};return N("")}function j(P){g(P);const N=v(P,"|");return g(P),N}function Y(P,N){let T=null;switch(P.currentChar()){case"{":return N.braceNest>=1&&d(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),P.next(),T=f(N,2,"{"),g(P),N.braceNest++,T;case"}":return N.braceNest>0&&N.currentType===2&&d(CompileErrorCodes.EMPTY_PLACEHOLDER,s(),0),P.next(),T=f(N,3,"}"),N.braceNest--,N.braceNest>0&&g(P),N.inLinked&&N.braceNest===0&&(N.inLinked=!1),T;case"@":return N.braceNest>0&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T=ce(P,N)||m(N),N.braceNest=0,T;default:{let z=!0,K=!0,V=!0;if(B(P))return N.braceNest>0&&d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),T=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,T;if(N.braceNest>0&&(N.currentType===5||N.currentType===6||N.currentType===7))return d(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),0),N.braceNest=0,re(P,N);if(z=y(P,N))return T=f(N,5,Te(P)),g(P),T;if(K=b(P,N))return T=f(N,6,ae(P)),g(P),T;if(V=w(P,N))return T=f(N,7,Ee(P)),g(P),T;if(!z&&!K&&!V)return T=f(N,13,D(P)),d(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,T.value),g(P),T;break}}return T}function ce(P,N){const{currentType:T}=N;let E=null;const z=P.currentChar();switch((T===8||T===9||T===12||T===10)&&(z===CHAR_LF||z===CHAR_SP)&&d(CompileErrorCodes.INVALID_LINKED_FORMAT,s(),0),z){case"@":return P.next(),E=f(N,8,"@"),N.inLinked=!0,E;case".":return g(P),P.next(),f(N,9,".");case":":return g(P),P.next(),f(N,10,":");default:return B(P)?(E=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,E):C(P,N)||M(P,N)?(g(P),ce(P,N)):R(P,N)?(g(P),f(N,12,k(P))):L(P,N)?(g(P),z==="{"?Y(P,N)||E:f(N,11,H(P))):(T===8&&d(CompileErrorCodes.INVALID_LINKED_FORMAT,s(),0),N.braceNest=0,N.inLinked=!1,re(P,N))}}function re(P,N){let T={type:14};if(N.braceNest>0)return Y(P,N)||m(N);if(N.inLinked)return ce(P,N)||m(N);switch(P.currentChar()){case"{":return Y(P,N)||m(N);case"}":return d(CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),0),P.next(),f(N,3,"}");case"@":return ce(P,N)||m(N);default:{if(B(P))return T=f(N,1,j(P)),N.braceNest=0,N.inLinked=!1,T;const{isModulo:z,hasSpace:K}=Z(P);if(z)return K?f(N,0,Me(P)):f(N,4,ye(P));if(q(P))return f(N,0,Me(P));break}}return T}function se(){const{currentType:P,offset:N,startLoc:T,endLoc:E}=l;return l.lastType=P,l.lastOffset=N,l.lastStartLoc=T,l.lastEndLoc=E,l.offset=r(),l.startLoc=s(),i.currentChar()===EOF?f(l,14):re(i,l)}return{nextToken:se,currentOffset:r,currentPosition:s,context:c}}const ERROR_DOMAIN$2="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function createParser(n={}){const e=n.location!==!1,{onError:t,onWarn:i}=n;function r(y,b,w,C,...R){const M=y.currentPosition();if(M.offset+=C,M.column+=C,t){const L=e?createLocation(w,M):null,B=createCompileError(b,L,{domain:ERROR_DOMAIN$2,args:R});t(B)}}function s(y,b,w,C,...R){const M=y.currentPosition();if(M.offset+=C,M.column+=C,i){const L=e?createLocation(w,M):null;i(createCompileWarn(b,L,R))}}function a(y,b,w){const C={type:y};return e&&(C.start=b,C.end=b,C.loc={start:w,end:w}),C}function o(y,b,w,C){e&&(y.end=b,y.loc&&(y.loc.end=w))}function l(y,b){const w=y.context(),C=a(3,w.offset,w.startLoc);return C.value=b,o(C,y.currentOffset(),y.currentPosition()),C}function c(y,b){const w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(5,C,R);return M.index=parseInt(b,10),y.nextToken(),o(M,y.currentOffset(),y.currentPosition()),M}function u(y,b,w){const C=y.context(),{lastOffset:R,lastStartLoc:M}=C,L=a(4,R,M);return L.key=b,w===!0&&(L.modulo=!0),y.nextToken(),o(L,y.currentOffset(),y.currentPosition()),L}function d(y,b){const w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(9,C,R);return M.value=b.replace(KNOWN_ESCAPES,fromEscapeSequence),y.nextToken(),o(M,y.currentOffset(),y.currentPosition()),M}function f(y){const b=y.nextToken(),w=y.context(),{lastOffset:C,lastStartLoc:R}=w,M=a(8,C,R);return b.type!==12?(r(y,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),M.value="",o(M,C,R),{nextConsumeToken:b,node:M}):(b.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,getTokenCaption(b)),M.value=b.value||"",o(M,y.currentOffset(),y.currentPosition()),{node:M})}function m(y,b){const w=y.context(),C=a(7,w.offset,w.startLoc);return C.value=b,o(C,y.currentOffset(),y.currentPosition()),C}function v(y){const b=y.context(),w=a(6,b.offset,b.startLoc);let C=y.nextToken();if(C.type===9){const R=f(y);w.modifier=R.node,C=R.nextConsumeToken||y.nextToken()}switch(C.type!==10&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),C=y.nextToken(),C.type===2&&(C=y.nextToken()),C.type){case 11:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=m(y,C.value||"");break;case 5:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=u(y,C.value||"");break;case 6:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=c(y,C.value||"");break;case 7:C.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(C)),w.key=d(y,C.value||"");break;default:{r(y,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,b.lastStartLoc,0);const R=y.context(),M=a(7,R.offset,R.startLoc);return M.value="",o(M,R.offset,R.startLoc),w.key=M,o(w,R.offset,R.startLoc),{nextConsumeToken:C,node:w}}}return o(w,y.currentOffset(),y.currentPosition()),{node:w}}function _(y){const b=y.context(),w=b.currentType===1?y.currentOffset():b.offset,C=b.currentType===1?b.endLoc:b.startLoc,R=a(2,w,C);R.items=[];let M=null,L=null;do{const q=M||y.nextToken();switch(M=null,q.type){case 0:q.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(q)),R.items.push(l(y,q.value||""));break;case 6:q.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(q)),R.items.push(c(y,q.value||""));break;case 4:L=!0;break;case 5:q.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(q)),R.items.push(u(y,q.value||"",!!L)),L&&(s(y,CompileWarnCodes.USE_MODULO_SYNTAX,b.lastStartLoc,0,getTokenCaption(q)),L=null);break;case 7:q.value==null&&r(y,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,getTokenCaption(q)),R.items.push(d(y,q.value||""));break;case 8:{const X=v(y);R.items.push(X.node),M=X.nextConsumeToken||null;break}}}while(b.currentType!==14&&b.currentType!==1);const B=b.currentType===1?b.lastOffset:y.currentOffset(),Z=b.currentType===1?b.lastEndLoc:y.currentPosition();return o(R,B,Z),R}function g(y,b,w,C){const R=y.context();let M=C.items.length===0;const L=a(1,b,w);L.cases=[],L.cases.push(C);do{const B=_(y);M||(M=B.items.length===0),L.cases.push(B)}while(R.currentType!==14);return M&&r(y,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),o(L,y.currentOffset(),y.currentPosition()),L}function x(y){const b=y.context(),{offset:w,startLoc:C}=b,R=_(y);return b.currentType===14?R:g(y,w,C,R)}function S(y){const b=createTokenizer(y,assign({},n)),w=b.context(),C=a(0,w.offset,w.startLoc);return e&&C.loc&&(C.loc.source=y),C.body=x(b),n.onCacheKey&&(C.cacheKey=n.onCacheKey(y)),w.currentType!==14&&r(b,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,y[w.offset]||""),o(C,b.currentOffset(),b.currentPosition()),C}return{parse:S}}function getTokenCaption(n){if(n.type===14)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function createTransformer(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function traverseNodes(n,e){for(let t=0;toptimizeMessageNode(t)),n}function optimizeMessageNode(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;ta;function l(_,g){a.code+=_}function c(_,g=!0){const x=g?i:"";l(r?x+" ".repeat(_):x)}function u(_=!0){const g=++a.indentLevel;_&&c(g)}function d(_=!0){const g=--a.indentLevel;_&&c(g)}function f(){c(a.indentLevel)}return{context:o,push:l,indent:u,deindent:d,newline:f,helper:_=>`_${_}`,needIndent:()=>a.needIndent}}function generateLinkedNode(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),generateNode(n,e.key),e.modifier?(n.push(", "),generateNode(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function generateMessageNode(n,e){const{helper:t,needIndent:i}=n;n.push(`${t("normalize")}([`),n.indent(i());const r=e.items.length;for(let s=0;s1){n.push(`${t("plural")}([`),n.indent(i());const r=e.cases.length;for(let s=0;s{const t=isString(e.mode)?e.mode:"normal",i=isString(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` +`,s=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],o=createCodeGenerator(n,{filename:i,breakLineCode:r,needIndent:s});o.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),o.indent(s),a.length>0&&(o.push(`const { ${join(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),o.newline()),o.push("return "),generateNode(o,n),o.deindent(s),o.push("}"),delete n.helpers;const{code:l,map:c}=o.context();return{ast:n,code:l,map:c?c.toJSON():void 0}};function baseCompile$1(n,e={}){const t=assign({},e),i=!!t.jit,r=!!t.minify,s=t.optimize==null?!0:t.optimize,o=createParser(t).parse(n);return i?(s&&optimize(o),r&&minify(o),{ast:o,code:""}):(transform(o,t),generate(o,t))}/*! + * core-base v9.14.3 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */function initFeatureFlags$1(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(getGlobalThis().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]};pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]};pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]};pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]};pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]};pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]};pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(n){return literalValueRE.test(n)}function stripQuotes(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function getPathCharType(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function formatSubPath(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:isLiteral(e)?stripQuotes(e):"*"+e}function parse(n){const e=[];let t=-1,i=0,r=0,s,a,o,l,c,u,d;const f=[];f[0]=()=>{a===void 0?a=o:a+=o},f[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},f[2]=()=>{f[0](),r++},f[3]=()=>{if(r>0)r--,i=4,f[0]();else{if(r=0,a===void 0||(a=formatSubPath(a),a===!1))return!1;f[1]()}};function m(){const v=n[t+1];if(i===5&&v==="'"||i===6&&v==='"')return t++,o="\\"+v,f[0](),!0}for(;i!==null;)if(t++,s=n[t],!(s==="\\"&&m())){if(l=getPathCharType(s),d=pathStateMachine[i],c=d[l]||d.l||8,c===8||(i=c[0],c[1]!==void 0&&(u=f[c[1]],u&&(o=s,u()===!1))))return;if(i===7)return e}}const cache=new Map;function resolveWithKeyValue(n,e){return isObject$1(n)?n[e]:null}function resolveValue$1(n,e){if(!isObject$1(n))return null;let t=cache.get(e);if(t||(t=parse(e),t&&cache.set(e,t)),!t)return null;const i=t.length;let r=n,s=0;for(;sn,DEFAULT_MESSAGE=n=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=n=>n.length===0?"":join$1(n),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function getPluralIndex(n){const e=isNumber(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(isNumber(n.named.count)||isNumber(n.named.n))?isNumber(n.named.count)?n.named.count:isNumber(n.named.n)?n.named.n:e:e}function normalizeNamed(n,e){e.count||(e.count=n),e.n||(e.n=n)}function createMessageContext(n={}){const e=n.locale,t=getPluralIndex(n),i=isObject$1(n.pluralRules)&&isString$1(e)&&isFunction(n.pluralRules[e])?n.pluralRules[e]:pluralDefault,r=isObject$1(n.pluralRules)&&isString$1(e)&&isFunction(n.pluralRules[e])?pluralDefault:void 0,s=x=>x[i(t,x.length,r)],a=n.list||[],o=x=>a[x],l=n.named||create();isNumber(n.pluralIndex)&&normalizeNamed(t,l);const c=x=>l[x];function u(x){const S=isFunction(n.messages)?n.messages(x):isObject$1(n.messages)?n.messages[x]:!1;return S||(n.parent?n.parent.message(x):DEFAULT_MESSAGE)}const d=x=>n.modifiers?n.modifiers[x]:DEFAULT_MODIFIER,f=isPlainObject(n.processor)&&isFunction(n.processor.normalize)?n.processor.normalize:DEFAULT_NORMALIZE,m=isPlainObject(n.processor)&&isFunction(n.processor.interpolate)?n.processor.interpolate:DEFAULT_INTERPOLATE,v=isPlainObject(n.processor)&&isString$1(n.processor.type)?n.processor.type:DEFAULT_MESSAGE_DATA_TYPE,g={list:o,named:c,plural:s,linked:(x,...S)=>{const[y,b]=S;let w="text",C="";S.length===1?isObject$1(y)?(C=y.modifier||C,w=y.type||w):isString$1(y)&&(C=y||C):S.length===2&&(isString$1(y)&&(C=y||C),isString$1(b)&&(w=b||w));const R=u(x)(g),M=w==="vnode"&&isArray(R)&&C?R[0]:R;return C?d(C)(M,w):M},message:u,type:v,interpolate:m,normalize:f,values:assign$1(create(),a,l)};return g}const code$1$1=CompileWarnCodes.__EXTEND_POINT__,inc$1$1=incrementer(code$1$1),CoreWarnCodes={FALLBACK_TO_TRANSLATE:inc$1$1(),CANNOT_FORMAT_NUMBER:inc$1$1(),FALLBACK_TO_NUMBER_FORMAT:inc$1$1(),CANNOT_FORMAT_DATE:inc$1$1(),FALLBACK_TO_DATE_FORMAT:inc$1$1(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:inc$1$1(),__EXTEND_POINT__:inc$1$1()},code$2=CompileErrorCodes.__EXTEND_POINT__,inc$2=incrementer(code$2),CoreErrorCodes={INVALID_ARGUMENT:code$2,INVALID_DATE_ARGUMENT:inc$2(),INVALID_ISO_DATE_ARGUMENT:inc$2(),NOT_SUPPORT_NON_STRING_MESSAGE:inc$2(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:inc$2(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:inc$2(),NOT_SUPPORT_LOCALE_TYPE:inc$2(),__EXTEND_POINT__:inc$2()};function createCoreError(n){return createCompileError(n,null,void 0)}function getLocale(n,e){return e.locale!=null?resolveLocale(e.locale):resolveLocale(n.locale)}let _resolveLocale;function resolveLocale(n){if(isString$1(n))return n;if(isFunction(n)){if(n.resolvedOnce&&_resolveLocale!=null)return _resolveLocale;if(n.constructor.name==="Function"){const e=n();if(isPromise(e))throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=e}else throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(n,e,t){return[...new Set([t,...isArray(e)?e:isObject$1(e)?Object.keys(e):isString$1(e)?[e]:[t]])]}function fallbackWithLocaleChain(n,e,t){const i=isString$1(t)?t:DEFAULT_LOCALE,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let s=r.__localeChainCache.get(i);if(!s){s=[];let a=[t];for(;isArray(a);)a=appendBlockToChain(s,a,e);const o=isArray(e)||!isPlainObject(e)?e:e.default?e.default:null;a=isString$1(o)?[o]:o,isArray(a)&&appendBlockToChain(s,a,!1),r.__localeChainCache.set(i,s)}return s}function appendBlockToChain(n,e,t){let i=!0;for(let r=0;r`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(n,e)=>e==="text"&&isString$1(n)?n.toUpperCase():e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&isString$1(n)?n.toLowerCase():e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&isString$1(n)?capitalize(n):e==="vnode"&&isObject$1(n)&&"__v_isVNode"in n?capitalize(n.children):n}}let _compiler;function registerMessageCompiler(n){_compiler=n}let _resolver;function registerMessageResolver(n){_resolver=n}let _fallbacker;function registerLocaleFallbacker(n){_fallbacker=n}const setAdditionalMeta=n=>{};let _fallbackContext=null;const setFallbackContext=n=>{_fallbackContext=n},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(n={}){const e=isFunction(n.onWarn)?n.onWarn:warn,t=isString$1(n.version)?n.version:VERSION$1,i=isString$1(n.locale)||isFunction(n.locale)?n.locale:DEFAULT_LOCALE,r=isFunction(i)?DEFAULT_LOCALE:i,s=isArray(n.fallbackLocale)||isPlainObject(n.fallbackLocale)||isString$1(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=isPlainObject(n.messages)?n.messages:createResources(r),o=isPlainObject(n.datetimeFormats)?n.datetimeFormats:createResources(r),l=isPlainObject(n.numberFormats)?n.numberFormats:createResources(r),c=assign$1(create(),n.modifiers,getDefaultLinkedModifiers()),u=n.pluralRules||create(),d=isFunction(n.missing)?n.missing:null,f=isBoolean(n.missingWarn)||isRegExp(n.missingWarn)?n.missingWarn:!0,m=isBoolean(n.fallbackWarn)||isRegExp(n.fallbackWarn)?n.fallbackWarn:!0,v=!!n.fallbackFormat,_=!!n.unresolving,g=isFunction(n.postTranslation)?n.postTranslation:null,x=isPlainObject(n.processor)?n.processor:null,S=isBoolean(n.warnHtmlMessage)?n.warnHtmlMessage:!0,y=!!n.escapeParameter,b=isFunction(n.messageCompiler)?n.messageCompiler:_compiler,w=isFunction(n.messageResolver)?n.messageResolver:_resolver||resolveWithKeyValue,C=isFunction(n.localeFallbacker)?n.localeFallbacker:_fallbacker||fallbackWithSimple,R=isObject$1(n.fallbackContext)?n.fallbackContext:void 0,M=n,L=isObject$1(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,B=isObject$1(M.__numberFormatters)?M.__numberFormatters:new Map,Z=isObject$1(M.__meta)?M.__meta:{};_cid++;const q={version:t,cid:_cid,locale:i,fallbackLocale:s,messages:a,modifiers:c,pluralRules:u,missing:d,missingWarn:f,fallbackWarn:m,fallbackFormat:v,unresolving:_,postTranslation:g,processor:x,warnHtmlMessage:S,escapeParameter:y,messageCompiler:b,messageResolver:w,localeFallbacker:C,fallbackContext:R,onWarn:e,__meta:Z};return q.datetimeFormats=o,q.numberFormats=l,q.__datetimeFormatters=L,q.__numberFormatters=B,q}const createResources=n=>({[n]:create()});function handleMissing(n,e,t,i,r){const{missing:s,onWarn:a}=n;if(s!==null){const o=s(n,t,e,r);return isString$1(o)?o:e}else return e}function updateFallbackLocale(n,e,t){const i=n;i.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function isAlmostSameLocale(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function isImplicitFallback(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let i=t+1;iformatParts(t,n)}function formatParts(n,e){const t=resolveBody(e);if(t==null)throw createUnhandleNodeError(0);if(resolveType(t)===1){const s=resolveCases(t);return n.plural(s.reduce((a,o)=>[...a,formatMessageParts(n,o)],[]))}else return formatMessageParts(n,t)}const PROPS_BODY=["b","body"];function resolveBody(n){return resolveProps(n,PROPS_BODY)}const PROPS_CASES=["c","cases"];function resolveCases(n){return resolveProps(n,PROPS_CASES,[])}function formatMessageParts(n,e){const t=resolveStatic(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const i=resolveItems(e).reduce((r,s)=>[...r,formatMessagePart(n,s)],[]);return n.normalize(i)}}const PROPS_STATIC=["s","static"];function resolveStatic(n){return resolveProps(n,PROPS_STATIC)}const PROPS_ITEMS=["i","items"];function resolveItems(n){return resolveProps(n,PROPS_ITEMS,[])}function formatMessagePart(n,e){const t=resolveType(e);switch(t){case 3:return resolveValue(e,t);case 9:return resolveValue(e,t);case 4:{const i=e;if(hasOwn(i,"k")&&i.k)return n.interpolate(n.named(i.k));if(hasOwn(i,"key")&&i.key)return n.interpolate(n.named(i.key));throw createUnhandleNodeError(t)}case 5:{const i=e;if(hasOwn(i,"i")&&isNumber(i.i))return n.interpolate(n.list(i.i));if(hasOwn(i,"index")&&isNumber(i.index))return n.interpolate(n.list(i.index));throw createUnhandleNodeError(t)}case 6:{const i=e,r=resolveLinkedModifier(i),s=resolveLinkedKey(i);return n.linked(formatMessagePart(n,s),r?formatMessagePart(n,r):void 0,n.type)}case 7:return resolveValue(e,t);case 8:return resolveValue(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const PROPS_TYPE=["t","type"];function resolveType(n){return resolveProps(n,PROPS_TYPE)}const PROPS_VALUE=["v","value"];function resolveValue(n,e){const t=resolveProps(n,PROPS_VALUE);if(t)return t;throw createUnhandleNodeError(e)}const PROPS_MODIFIER=["m","modifier"];function resolveLinkedModifier(n){return resolveProps(n,PROPS_MODIFIER)}const PROPS_KEY=["k","key"];function resolveLinkedKey(n){const e=resolveProps(n,PROPS_KEY);if(e)return e;throw createUnhandleNodeError(6)}function resolveProps(n,e,t){for(let i=0;in;let compileCache=create();function isMessageAST(n){return isObject$1(n)&&resolveType(n)===0&&(hasOwn(n,"b")||hasOwn(n,"body"))}function baseCompile(n,e={}){let t=!1;const i=e.onError||defaultOnError;return e.onError=r=>{t=!0,i(r)},{...baseCompile$1(n,e),detectError:t}}const compileToFunction=(n,e)=>{if(!isString$1(n))throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);{isBoolean(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||defaultOnCacheKey)(n),r=compileCache[i];if(r)return r;const{code:s,detectError:a}=baseCompile(n,e),o=new Function(`return ${s}`)();return a?o:compileCache[i]=o}};function compile(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&isString$1(n)){isBoolean(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||defaultOnCacheKey)(n),r=compileCache[i];if(r)return r;const{ast:s,detectError:a}=baseCompile(n,{...e,location:!1,jit:!0}),o=format(s);return a?o:compileCache[i]=o}else{const t=n.cacheKey;if(t){const i=compileCache[t];return i||(compileCache[t]=format(n))}else return format(n)}}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=n=>isFunction(n);function translate(n,...e){const{fallbackFormat:t,postTranslation:i,unresolving:r,messageCompiler:s,fallbackLocale:a,messages:o}=n,[l,c]=parseTranslateArgs(...e),u=isBoolean(c.missingWarn)?c.missingWarn:n.missingWarn,d=isBoolean(c.fallbackWarn)?c.fallbackWarn:n.fallbackWarn,f=isBoolean(c.escapeParameter)?c.escapeParameter:n.escapeParameter,m=!!c.resolvedMessage,v=isString$1(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:t?s?l:()=>l:"",_=t||v!=="",g=getLocale(n,c);f&&escapeParams(c);let[x,S,y]=m?[l,g,o[g]||create()]:resolveMessageFormat(n,l,g,a,d,u),b=x,w=l;if(!m&&!(isString$1(b)||isMessageAST(b)||isMessageFunction(b))&&_&&(b=v,w=b),!m&&(!(isString$1(b)||isMessageAST(b)||isMessageFunction(b))||!isString$1(S)))return r?NOT_REOSLVED:l;let C=!1;const R=()=>{C=!0},M=isMessageFunction(b)?b:compileMessageFormat(n,l,S,b,w,R);if(C)return b;const L=getMessageContextOptions(n,S,y,c),B=createMessageContext(L),Z=evaluateMessage(n,M,B);return i?i(Z,l):Z}function escapeParams(n){isArray(n.list)?n.list=n.list.map(e=>isString$1(e)?escapeHtml(e):e):isObject$1(n.named)&&Object.keys(n.named).forEach(e=>{isString$1(n.named[e])&&(n.named[e]=escapeHtml(n.named[e]))})}function resolveMessageFormat(n,e,t,i,r,s){const{messages:a,onWarn:o,messageResolver:l,localeFallbacker:c}=n,u=c(n,i,t);let d=create(),f,m=null;const v="translate";for(let _=0;_i;return c.locale=t,c.key=e,c}const l=a(i,getCompileContext(n,t,r,i,o,s));return l.locale=t,l.key=e,l.source=i,l}function evaluateMessage(n,e,t){return e(t)}function parseTranslateArgs(...n){const[e,t,i]=n,r=create();if(!isString$1(e)&&!isNumber(e)&&!isMessageFunction(e)&&!isMessageAST(e))throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(e)?String(e):(isMessageFunction(e),e);return isNumber(t)?r.plural=t:isString$1(t)?r.default=t:isPlainObject(t)&&!isEmptyObject(t)?r.named=t:isArray(t)&&(r.list=t),isNumber(i)?r.plural=i:isString$1(i)?r.default=i:isPlainObject(i)&&assign$1(r,i),[s,r]}function getCompileContext(n,e,t,i,r,s){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw s&&s(a),a},onCacheKey:a=>generateFormatCacheKey(e,t,a)}}function getMessageContextOptions(n,e,t,i){const{modifiers:r,pluralRules:s,messageResolver:a,fallbackLocale:o,fallbackWarn:l,missingWarn:c,fallbackContext:u}=n,f={locale:e,modifiers:r,pluralRules:s,messages:m=>{let v=a(t,m);if(v==null&&u){const[,,_]=resolveMessageFormat(u,m,e,o,l,c);v=a(_,m)}if(isString$1(v)||isMessageAST(v)){let _=!1;const x=compileMessageFormat(n,m,e,v,m,()=>{_=!0});return _?NOOP_MESSAGE_FUNCTION:x}else return isMessageFunction(v)?v:NOOP_MESSAGE_FUNCTION}};return n.processor&&(f.processor=n.processor),i.list&&(f.list=i.list),i.named&&(f.named=i.named),isNumber(i.plural)&&(f.pluralIndex=i.plural),f}function datetime(n,...e){const{datetimeFormats:t,unresolving:i,fallbackLocale:r,onWarn:s,localeFallbacker:a}=n,{__datetimeFormatters:o}=n,[l,c,u,d]=parseDateTimeArgs(...e),f=isBoolean(u.missingWarn)?u.missingWarn:n.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const m=!!u.part,v=getLocale(n,u),_=a(n,r,v);if(!isString$1(l)||l==="")return new Intl.DateTimeFormat(v,d).format(c);let g={},x,S=null;const y="datetime format";for(let C=0;C<_.length&&(x=_[C],g=t[x]||{},S=g[l],!isPlainObject(S));C++)handleMissing(n,l,x,f,y);if(!isPlainObject(S)||!isString$1(x))return i?NOT_REOSLVED:l;let b=`${x}__${l}`;isEmptyObject(d)||(b=`${b}__${JSON.stringify(d)}`);let w=o.get(b);return w||(w=new Intl.DateTimeFormat(x,assign$1({},S,d)),o.set(b,w)),m?w.formatToParts(c):w.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...n){const[e,t,i,r]=n,s=create();let a=create(),o;if(isString$1(e)){const l=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!l)throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const c=l[3]?l[3].trim().startsWith("T")?`${l[1].trim()}${l[3].trim()}`:`${l[1].trim()}T${l[3].trim()}`:l[1].trim();o=new Date(c);try{o.toISOString()}catch{throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(e)){if(isNaN(e.getTime()))throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT);o=e}else if(isNumber(e))o=e;else throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);return isString$1(t)?s.key=t:isPlainObject(t)&&Object.keys(t).forEach(l=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(l)?a[l]=t[l]:s[l]=t[l]}),isString$1(i)?s.locale=i:isPlainObject(i)&&(a=i),isPlainObject(r)&&(a=r),[s.key||"",o,s,a]}function clearDateTimeFormat(n,e,t){const i=n;for(const r in t){const s=`${e}__${r}`;i.__datetimeFormatters.has(s)&&i.__datetimeFormatters.delete(s)}}function number(n,...e){const{numberFormats:t,unresolving:i,fallbackLocale:r,onWarn:s,localeFallbacker:a}=n,{__numberFormatters:o}=n,[l,c,u,d]=parseNumberArgs(...e),f=isBoolean(u.missingWarn)?u.missingWarn:n.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const m=!!u.part,v=getLocale(n,u),_=a(n,r,v);if(!isString$1(l)||l==="")return new Intl.NumberFormat(v,d).format(c);let g={},x,S=null;const y="number format";for(let C=0;C<_.length&&(x=_[C],g=t[x]||{},S=g[l],!isPlainObject(S));C++)handleMissing(n,l,x,f,y);if(!isPlainObject(S)||!isString$1(x))return i?NOT_REOSLVED:l;let b=`${x}__${l}`;isEmptyObject(d)||(b=`${b}__${JSON.stringify(d)}`);let w=o.get(b);return w||(w=new Intl.NumberFormat(x,assign$1({},S,d)),o.set(b,w)),m?w.formatToParts(c):w.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...n){const[e,t,i,r]=n,s=create();let a=create();if(!isNumber(e))throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);const o=e;return isString$1(t)?s.key=t:isPlainObject(t)&&Object.keys(t).forEach(l=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(l)?a[l]=t[l]:s[l]=t[l]}),isString$1(i)?s.locale=i:isPlainObject(i)&&(a=i),isPlainObject(r)&&(a=r),[s.key||"",o,s,a]}function clearNumberFormat(n,e,t){const i=n;for(const r in t){const s=`${e}__${r}`;i.__numberFormatters.has(s)&&i.__numberFormatters.delete(s)}}initFeatureFlags$1();/*! + * vue-i18n v9.14.3 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */const VERSION="9.14.3";function initFeatureFlags(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(getGlobalThis().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const code$1=CoreWarnCodes.__EXTEND_POINT__,inc$1=incrementer(code$1);inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1(),inc$1();const code=CoreErrorCodes.__EXTEND_POINT__,inc=incrementer(code),I18nErrorCodes={UNEXPECTED_RETURN_TYPE:code,INVALID_ARGUMENT:inc(),MUST_BE_CALL_SETUP_TOP:inc(),NOT_INSTALLED:inc(),NOT_AVAILABLE_IN_LEGACY_MODE:inc(),REQUIRED_VALUE:inc(),INVALID_VALUE:inc(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:inc(),NOT_INSTALLED_WITH_PROVIDE:inc(),UNEXPECTED_ERROR:inc(),NOT_COMPATIBLE_LEGACY_VUE_I18N:inc(),BRIDGE_SUPPORT_VUE_2_ONLY:inc(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:inc(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:inc(),__EXTEND_POINT__:inc()};function createI18nError(n,...e){return createCompileError(n,null,void 0)}const TranslateVNodeSymbol=makeSymbol("__translateVNode"),DatetimePartsSymbol=makeSymbol("__datetimeParts"),NumberPartsSymbol=makeSymbol("__numberParts"),SetPluralRulesSymbol=makeSymbol("__setPluralRules"),InejctWithOptionSymbol=makeSymbol("__injectWithOption"),DisposeSymbol=makeSymbol("__dispose");function handleFlatJson(n){if(!isObject$1(n))return n;for(const e in n)if(hasOwn(n,e))if(!e.includes("."))isObject$1(n[e])&&handleFlatJson(n[e]);else{const t=e.split("."),i=t.length-1;let r=n,s=!1;for(let a=0;a{if("locale"in o&&"resource"in o){const{locale:l,resource:c}=o;l?(a[l]=a[l]||create(),deepCopy(c,a[l])):deepCopy(c,a)}else isString$1(o)&&deepCopy(JSON.parse(o),a)}),r==null&&s)for(const o in a)hasOwn(a,o)&&handleFlatJson(a[o]);return a}function getComponentOptions(n){return n.type}function adjustI18nResources(n,e,t){let i=isObject$1(e.messages)?e.messages:create();"__i18nGlobal"in t&&(i=getLocaleMessages(n.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const r=Object.keys(i);r.length&&r.forEach(s=>{n.mergeLocaleMessage(s,i[s])});{if(isObject$1(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(isObject$1(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function createTextNode(n){return createVNode(Text,null,n,0)}const DEVTOOLS_META="__INTLIFY_META__",NOOP_RETURN_ARRAY=()=>[],NOOP_RETURN_FALSE=()=>!1;let composerID=0;function defineCoreMissingHandler(n){return(e,t,i,r)=>n(t,i,getCurrentInstance()||void 0,r)}const getMetaInfo=()=>{const n=getCurrentInstance();let e=null;return n&&(e=getComponentOptions(n)[DEVTOOLS_META])?{[DEVTOOLS_META]:e}:null};function createComposer(n={},e){const{__root:t,__injectWithOption:i}=n,r=t===void 0,s=n.flatJson,a=inBrowser?ref:shallowRef,o=!!n.translateExistCompatible;let l=isBoolean(n.inheritLocale)?n.inheritLocale:!0;const c=a(t&&l?t.locale.value:isString$1(n.locale)?n.locale:DEFAULT_LOCALE),u=a(t&&l?t.fallbackLocale.value:isString$1(n.fallbackLocale)||isArray(n.fallbackLocale)||isPlainObject(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:c.value),d=a(getLocaleMessages(c.value,n)),f=a(isPlainObject(n.datetimeFormats)?n.datetimeFormats:{[c.value]:{}}),m=a(isPlainObject(n.numberFormats)?n.numberFormats:{[c.value]:{}});let v=t?t.missingWarn:isBoolean(n.missingWarn)||isRegExp(n.missingWarn)?n.missingWarn:!0,_=t?t.fallbackWarn:isBoolean(n.fallbackWarn)||isRegExp(n.fallbackWarn)?n.fallbackWarn:!0,g=t?t.fallbackRoot:isBoolean(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,S=isFunction(n.missing)?n.missing:null,y=isFunction(n.missing)?defineCoreMissingHandler(n.missing):null,b=isFunction(n.postTranslation)?n.postTranslation:null,w=t?t.warnHtmlMessage:isBoolean(n.warnHtmlMessage)?n.warnHtmlMessage:!0,C=!!n.escapeParameter;const R=t?t.modifiers:isPlainObject(n.modifiers)?n.modifiers:{};let M=n.pluralRules||t&&t.pluralRules,L;L=(()=>{r&&setFallbackContext(null);const V={version:VERSION,locale:c.value,fallbackLocale:u.value,messages:d.value,modifiers:R,pluralRules:M,missing:y===null?void 0:y,missingWarn:v,fallbackWarn:_,fallbackFormat:x,unresolving:!0,postTranslation:b===null?void 0:b,warnHtmlMessage:w,escapeParameter:C,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};V.datetimeFormats=f.value,V.numberFormats=m.value,V.__datetimeFormatters=isPlainObject(L)?L.__datetimeFormatters:void 0,V.__numberFormatters=isPlainObject(L)?L.__numberFormatters:void 0;const $=createCoreContext(V);return r&&setFallbackContext($),$})(),updateFallbackLocale(L,c.value,u.value);function Z(){return[c.value,u.value,d.value,f.value,m.value]}const q=computed({get:()=>c.value,set:V=>{c.value=V,L.locale=c.value}}),X=computed({get:()=>u.value,set:V=>{u.value=V,L.fallbackLocale=u.value,updateFallbackLocale(L,c.value,V)}}),G=computed(()=>d.value),le=computed(()=>f.value),he=computed(()=>m.value);function ue(){return isFunction(b)?b:null}function ie(V){b=V,L.postTranslation=V}function ve(){return S}function _e(V){V!==null&&(y=defineCoreMissingHandler(V)),S=V,L.missing=y}const Q=(V,$,be,ge,oe,Ie)=>{Z();let Ne;try{r||(L.fallbackContext=t?getFallbackContext():void 0),Ne=V(L)}finally{r||(L.fallbackContext=void 0)}if(be!=="translate exists"&&isNumber(Ne)&&Ne===NOT_REOSLVED||be==="translate exists"&&!Ne){const[Fe,Re]=$();return t&&g?ge(t):oe(Fe)}else{if(Ie(Ne))return Ne;throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE)}};function ne(...V){return Q($=>Reflect.apply(translate,null,[$,...V]),()=>parseTranslateArgs(...V),"translate",$=>Reflect.apply($.t,$,[...V]),$=>$,$=>isString$1($))}function ye(...V){const[$,be,ge]=V;if(ge&&!isObject$1(ge))throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);return ne($,be,assign$1({resolvedMessage:!0},ge||{}))}function Me(...V){return Q($=>Reflect.apply(datetime,null,[$,...V]),()=>parseDateTimeArgs(...V),"datetime format",$=>Reflect.apply($.d,$,[...V]),()=>MISSING_RESOLVE_VALUE,$=>isString$1($))}function Te(...V){return Q($=>Reflect.apply(number,null,[$,...V]),()=>parseNumberArgs(...V),"number format",$=>Reflect.apply($.n,$,[...V]),()=>MISSING_RESOLVE_VALUE,$=>isString$1($))}function ae(V){return V.map($=>isString$1($)||isNumber($)||isBoolean($)?createTextNode(String($)):$)}const Ee={normalize:ae,interpolate:V=>V,type:"vnode"};function Ce(...V){return Q($=>{let be;const ge=$;try{ge.processor=Ee,be=Reflect.apply(translate,null,[ge,...V])}finally{ge.processor=null}return be},()=>parseTranslateArgs(...V),"translate",$=>$[TranslateVNodeSymbol](...V),$=>[createTextNode($)],$=>isArray($))}function we(...V){return Q($=>Reflect.apply(number,null,[$,...V]),()=>parseNumberArgs(...V),"number format",$=>$[NumberPartsSymbol](...V),NOOP_RETURN_ARRAY,$=>isString$1($)||isArray($))}function O(...V){return Q($=>Reflect.apply(datetime,null,[$,...V]),()=>parseDateTimeArgs(...V),"datetime format",$=>$[DatetimePartsSymbol](...V),NOOP_RETURN_ARRAY,$=>isString$1($)||isArray($))}function D(V){M=V,L.pluralRules=M}function k(V,$){return Q(()=>{if(!V)return!1;const be=isString$1($)?$:c.value,ge=Y(be),oe=L.messageResolver(ge,V);return o?oe!=null:isMessageAST(oe)||isMessageFunction(oe)||isString$1(oe)},()=>[V],"translate exists",be=>Reflect.apply(be.te,be,[V,$]),NOOP_RETURN_FALSE,be=>isBoolean(be))}function H(V){let $=null;const be=fallbackWithLocaleChain(L,u.value,c.value);for(let ge=0;ge{l&&(c.value=V,L.locale=V,updateFallbackLocale(L,c.value,u.value))}),watch(t.fallbackLocale,V=>{l&&(u.value=V,L.fallbackLocale=V,updateFallbackLocale(L,c.value,u.value))}));const K={id:composerID,locale:q,fallbackLocale:X,get inheritLocale(){return l},set inheritLocale(V){l=V,V&&t&&(c.value=t.locale.value,u.value=t.fallbackLocale.value,updateFallbackLocale(L,c.value,u.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:G,get modifiers(){return R},get pluralRules(){return M||{}},get isGlobal(){return r},get missingWarn(){return v},set missingWarn(V){v=V,L.missingWarn=v},get fallbackWarn(){return _},set fallbackWarn(V){_=V,L.fallbackWarn=_},get fallbackRoot(){return g},set fallbackRoot(V){g=V},get fallbackFormat(){return x},set fallbackFormat(V){x=V,L.fallbackFormat=x},get warnHtmlMessage(){return w},set warnHtmlMessage(V){w=V,L.warnHtmlMessage=V},get escapeParameter(){return C},set escapeParameter(V){C=V,L.escapeParameter=V},t:ne,getLocaleMessage:Y,setLocaleMessage:ce,mergeLocaleMessage:re,getPostTranslationHandler:ue,setPostTranslationHandler:ie,getMissingHandler:ve,setMissingHandler:_e,[SetPluralRulesSymbol]:D};return K.datetimeFormats=le,K.numberFormats=he,K.rt=ye,K.te=k,K.tm=j,K.d=Me,K.n=Te,K.getDateTimeFormat=se,K.setDateTimeFormat=P,K.mergeDateTimeFormat=N,K.getNumberFormat=T,K.setNumberFormat=E,K.mergeNumberFormat=z,K[InejctWithOptionSymbol]=i,K[TranslateVNodeSymbol]=Ce,K[DatetimePartsSymbol]=O,K[NumberPartsSymbol]=we,K}const baseFormatProps={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function getInterpolateArg({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((i,r)=>[...i,...r.type===Fragment?r.children:[r]],[]):e.reduce((t,i)=>{const r=n[i];return r&&(t[i]=r()),t},create())}function getFragmentableTag(n){return Fragment}const TranslationImpl=defineComponent({name:"i18n-t",props:assign$1({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>isNumber(n)||!isNaN(n)}},baseFormatProps),setup(n,e){const{slots:t,attrs:i}=e,r=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(d=>d!=="_"),a=create();n.locale&&(a.locale=n.locale),n.plural!==void 0&&(a.plural=isString$1(n.plural)?+n.plural:n.plural);const o=getInterpolateArg(e,s),l=r[TranslateVNodeSymbol](n.keypath,o,a),c=assign$1(create(),i),u=isString$1(n.tag)||isObject$1(n.tag)?n.tag:getFragmentableTag();return h(u,c,l)}}}),Translation=TranslationImpl;function isVNode(n){return isArray(n)&&!isString$1(n[0])}function renderFormatter(n,e,t,i){const{slots:r,attrs:s}=e;return()=>{const a={part:!0};let o=create();n.locale&&(a.locale=n.locale),isString$1(n.format)?a.key=n.format:isObject$1(n.format)&&(isString$1(n.format.key)&&(a.key=n.format.key),o=Object.keys(n.format).reduce((f,m)=>t.includes(m)?assign$1(create(),f,{[m]:n.format[m]}):f,create()));const l=i(n.value,a,o);let c=[a.key];isArray(l)?c=l.map((f,m)=>{const v=r[f.type],_=v?v({[f.type]:f.value,index:m,parts:l}):[f.value];return isVNode(_)&&(_[0].key=`${f.type}-${m}`),_}):isString$1(l)&&(c=[l]);const u=assign$1(create(),s),d=isString$1(n.tag)||isObject$1(n.tag)?n.tag:getFragmentableTag();return h(d,u,c)}}const NumberFormatImpl=defineComponent({name:"i18n-n",props:assign$1({value:{type:Number,required:!0},format:{type:[String,Object]}},baseFormatProps),setup(n,e){const t=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return renderFormatter(n,e,NUMBER_FORMAT_OPTIONS_KEYS,(...i)=>t[NumberPartsSymbol](...i))}}),NumberFormat=NumberFormatImpl,DatetimeFormatImpl=defineComponent({name:"i18n-d",props:assign$1({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},baseFormatProps),setup(n,e){const t=n.i18n||useI18n({useScope:n.scope,__useComponent:!0});return renderFormatter(n,e,DATETIME_FORMAT_OPTIONS_KEYS,(...i)=>t[DatetimePartsSymbol](...i))}}),DatetimeFormat=DatetimeFormatImpl;function getComposer$2(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const i=t.__getInstance(e);return i!=null?i.__composer:n.global.__composer}}function vTDirective(n){const e=a=>{const{instance:o,modifiers:l,value:c}=a;if(!o||!o.$)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);const u=getComposer$2(n,o.$),d=parseValue(c);return[Reflect.apply(u.t,u,[...makeParams(d)]),u]};return{created:(a,o)=>{const[l,c]=e(o);inBrowser&&n.global===c&&(a.__i18nWatcher=watch(c.locale,()=>{o.instance&&o.instance.$forceUpdate()})),a.__composer=c,a.textContent=l},unmounted:a=>{inBrowser&&a.__i18nWatcher&&(a.__i18nWatcher(),a.__i18nWatcher=void 0,delete a.__i18nWatcher),a.__composer&&(a.__composer=void 0,delete a.__composer)},beforeUpdate:(a,{value:o})=>{if(a.__composer){const l=a.__composer,c=parseValue(o);a.textContent=Reflect.apply(l.t,l,[...makeParams(c)])}},getSSRProps:a=>{const[o]=e(a);return{textContent:o}}}}function parseValue(n){if(isString$1(n))return{path:n};if(isPlainObject(n)){if(!("path"in n))throw createI18nError(I18nErrorCodes.REQUIRED_VALUE,"path");return n}else throw createI18nError(I18nErrorCodes.INVALID_VALUE)}function makeParams(n){const{path:e,locale:t,args:i,choice:r,plural:s}=n,a={},o=i||{};return isString$1(t)&&(a.locale=t),isNumber(r)&&(a.plural=r),isNumber(s)&&(a.plural=s),[e,o,a]}function apply(n,e,...t){const i=isPlainObject(t[0])?t[0]:{},r=!!i.useI18nComponentName;(isBoolean(i.globalInstall)?i.globalInstall:!0)&&([r?"i18n":Translation.name,"I18nT"].forEach(a=>n.component(a,Translation)),[NumberFormat.name,"I18nN"].forEach(a=>n.component(a,NumberFormat)),[DatetimeFormat.name,"I18nD"].forEach(a=>n.component(a,DatetimeFormat))),n.directive("t",vTDirective(e))}const I18nInjectionKey=makeSymbol("global-vue-i18n");function createI18n(n={},e){const t=isBoolean(n.globalInjection)?n.globalInjection:!0,i=!0,r=new Map,[s,a]=createGlobal(n),o=makeSymbol("");function l(d){return r.get(d)||null}function c(d,f){r.set(d,f)}function u(d){r.delete(d)}{const d={get mode(){return"composition"},get allowComposition(){return i},async install(f,...m){if(f.__VUE_I18N_SYMBOL__=o,f.provide(f.__VUE_I18N_SYMBOL__,d),isPlainObject(m[0])){const g=m[0];d.__composerExtend=g.__composerExtend,d.__vueI18nExtend=g.__vueI18nExtend}let v=null;t&&(v=injectGlobalFields(f,d.global)),apply(f,d,...m);const _=f.unmount;f.unmount=()=>{v&&v(),d.dispose(),_()}},get global(){return a},dispose(){s.stop()},__instances:r,__getInstance:l,__setInstance:c,__deleteInstance:u};return d}}function useI18n(n={}){const e=getCurrentInstance();if(e==null)throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw createI18nError(I18nErrorCodes.NOT_INSTALLED);const t=getI18nInstance(e),i=getGlobalComposer(t),r=getComponentOptions(e),s=getScope(n,r);if(s==="global")return adjustI18nResources(i,n,r),i;if(s==="parent"){let l=getComposer(t,e,n.__useComponent);return l==null&&(l=i),l}const a=t;let o=a.__getInstance(e);if(o==null){const l=assign$1({},n);"__i18n"in r&&(l.__i18n=r.__i18n),i&&(l.__root=i),o=createComposer(l),a.__composerExtend&&(o[DisposeSymbol]=a.__composerExtend(o)),setupLifeCycle(a,e,o),a.__setInstance(e,o)}return o}function createGlobal(n,e,t){const i=effectScope();{const r=i.run(()=>createComposer(n));if(r==null)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);return[i,r]}}function getI18nInstance(n){{const e=inject(n.isCE?I18nInjectionKey:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw createI18nError(n.isCE?I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE:I18nErrorCodes.UNEXPECTED_ERROR);return e}}function getScope(n,e){return isEmptyObject(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function getGlobalComposer(n){return n.mode==="composition"?n.global:n.global.__composer}function getComposer(n,e,t=!1){let i=null;const r=e.root;let s=getParentComponentInstance(e,t);for(;s!=null;){const a=n;if(n.mode==="composition"&&(i=a.__getInstance(s)),i!=null||r===s)break;s=s.parent}return i}function getParentComponentInstance(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function setupLifeCycle(n,e,t){onMounted(()=>{},e),onUnmounted(()=>{const i=t;n.__deleteInstance(e);const r=i[DisposeSymbol];r&&(r(),delete i[DisposeSymbol])},e)}const globalExportProps=["locale","fallbackLocale","availableLocales"],globalExportMethods=["t","rt","d","n","tm","te"];function injectGlobalFields(n,e){const t=Object.create(null);return globalExportProps.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);const a=isRef(s.value)?{get(){return s.value.value},set(o){s.value.value=o}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,r,a)}),n.config.globalProperties.$i18n=t,globalExportMethods.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s||!s.value)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,s)}),()=>{delete n.config.globalProperties.$i18n,globalExportMethods.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}initFeatureFlags();__INTLIFY_JIT_COMPILATION__?registerMessageCompiler(compile):registerMessageCompiler(compileToFunction);registerMessageResolver(resolveValue$1);registerLocaleFallbacker(fallbackWithLocaleChain);function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hoconParser$1={exports:{}},hoconParser=hoconParser$1.exports,hasRequiredHoconParser;function requireHoconParser(){return hasRequiredHoconParser||(hasRequiredHoconParser=1,function(module){(function(n,e){module.exports?module.exports=e():n.parseHocon=e()})(hoconParser,function(){function parseHocon(text){var index=0,result=readHocon(text);return handleSubtitutions(result);function readHocon(n){for(var e=!1,t="",i=!1,r=!1,s=!1,a=!1,o=!1,l=!1,c=!1,u=!1,d="",f="",m={};index0){var C=y.substring(0,w);b[C]=b[C]||{},g(y.substring(w+1),b[C]);return}!e&&typeof f=="string"&&(/^\d+$/.test(f)?f=parseInt(f):/^\d+\.\d+$/.test(f)?f=parseFloat(f):f==="true"?f=!0:f==="false"?f=!1:f==="null"&&(f=null)),s?b.push(f):(typeof b[y]=="object"&&typeof f=="object"?extend(b[y],f):b[y]=f,a=!1),o=!1,d="",f=""}}function handleSubtitutions(mainObj,intermidiateObj,loops){if(loops=loops||0,loops>8)return null;if(intermidiateObj=typeof intermidiateObj>"u"?mainObj:intermidiateObj,intermidiateObj==null)return intermidiateObj;if(Array.isArray(intermidiateObj))intermidiateObj.forEach(function(n,e){intermidiateObj[e]=handleSubtitutions(mainObj,n)});else if(typeof intermidiateObj=="string"){var match=/^\$\{(.+?)\}$/.exec(intermidiateObj);if(match&&match.length==2){var val=eval("mainObj."+match[1]);return typeof val>"u"?null:handleSubtitutions(mainObj,val,loops+1)}}else typeof intermidiateObj=="object"&&Object.keys(intermidiateObj).forEach(function(n,e){intermidiateObj[n]=handleSubtitutions(mainObj,intermidiateObj[n])});return intermidiateObj}function extend(){for(var n=1;n{localStorage.setItem(n,JSON.stringify(e))},getLocalStorage=n=>{const e=localStorage.getItem(n);if(e!=null)try{return JSON.parse(e)}catch{return e}},round=(n,e)=>{let t=Math.pow(10,e);return Math.round(n*t)/t},fetchHocon=async n=>fetch(n).then(e=>e.text()).then(e=>parseHocon(e)),i18nModule=createI18n({locale:"none",fallbackLocale:"en",warnHtmlMessage:!1,messages:{}}),i18n=i18nModule.global;async function setLanguage(n){return loadLanguage(n),i18n.locale.value=n,document.querySelector("html").setAttribute("lang",n),nextTick()}async function loadLanguage(n){try{if(!i18n.availableLocales.includes(n)){let e=await fetchHocon(`./lang/${n}.conf`);i18n.setLocaleMessage(n,e)}}catch(e){console.error(`Failed to load language '${n}'!`,e)}}async function loadLanguageSettings(){let n=await fetchHocon("./lang/settings.conf"),e=null;if(n.useBrowserLanguage){const t=n.languages.map(i=>i.locale);for(let i of navigator.languages){if(e=t.find(s=>s===i),e)break;let r=i.split("-")[0];if(e=t.find(s=>s.startsWith(r)),e)break}}e||(e=n.default),await loadLanguage("en"),await loadLanguage(n.default),i18nModule.global.fallbackLocale=[n.default,"en"],i18n.languages=n.languages,await setLanguage(e)}const themes=[{get name(){return i18n.t("theme.default")},value:null},{get name(){return i18n.t("theme.dark")},value:"dark"},{get name(){return i18n.t("theme.light")},value:"light"},{get name(){return i18n.t("theme.contrast")},value:"contrast"}],qualityStages=[{get name(){return i18n.t("resolution.high")},value:2},{get name(){return i18n.t("resolution.normal")},value:1},{get name(){return i18n.t("resolution.low")},value:.5}],_sfc_main$a={name:"SettingsMenu",components:{SwitchButton,Slider,SimpleButton,Group},data(){return{appState:this.$bluemap.appState,mapViewer:this.$bluemap.mapViewer.data,settings:{hiresSliderMax:500,hiresSliderMin:50,lowresSliderMax:1e4,lowresSliderMin:500,...this.$bluemap.settings},languages:i18n.languages,qualityStages,themes}},computed:{showViewControls(){return this.mapViewer.map?this.mapViewer.map.views.length>1:!1}},methods:{switchChunkBorders(){this.$bluemap.setChunkBorders(!this.mapViewer.uniforms.chunkBorders.value)},switchDebug(){this.$bluemap.setDebug(!this.appState.debug)},renderDistanceFormatter(n){let e=parseFloat(n);return e===0?this.$t("renderDistance.off"):e.toFixed(0)},async changeLanguage(n){await setLanguage(n),this.$bluemap.updatePageAddress(),this.$bluemap.saveUserSettings()}}};function _sfc_render$a(n,e,t,i,r,s){const a=resolveComponent("SimpleButton"),o=resolveComponent("Group"),l=resolveComponent("Slider"),c=resolveComponent("SwitchButton");return openBlock(),createElementBlock("div",null,[s.showViewControls?(openBlock(),createBlock(o,{key:0,title:n.$t("controls.title")},{default:withCtx(()=>[r.mapViewer.map.perspectiveView?(openBlock(),createBlock(a,{key:0,active:r.appState.controls.state==="perspective",onAction:e[0]||(e[0]=u=>n.$bluemap.setPerspectiveView(500,r.appState.controls.state==="free"?100:0))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.perspective.button")),1)]),_:1},8,["active"])):createCommentVNode("",!0),r.mapViewer.map.flatView?(openBlock(),createBlock(a,{key:1,active:r.appState.controls.state==="flat",onAction:e[1]||(e[1]=u=>n.$bluemap.setFlatView(500,r.appState.controls.state==="free"?100:0))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.flatView.button")),1)]),_:1},8,["active"])):createCommentVNode("",!0),r.mapViewer.map.freeFlightView?(openBlock(),createBlock(a,{key:2,active:r.appState.controls.state==="free",onAction:e[2]||(e[2]=u=>n.$bluemap.setFreeFlight(500))},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("controls.freeFlight.button")),1)]),_:1},8,["active"])):createCommentVNode("",!0)]),_:1},8,["title"])):createCommentVNode("",!0),createVNode(o,{title:n.$t("lighting.title")},{default:withCtx(()=>[createVNode(l,{value:r.mapViewer.uniforms.sunlightStrength.value,min:0,max:1,step:.01,onUpdate:e[3]||(e[3]=u=>{r.mapViewer.uniforms.sunlightStrength.value=u,n.$bluemap.mapViewer.redraw()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("lighting.sunlight")),1)]),_:1},8,["value","step"]),createVNode(l,{value:r.mapViewer.uniforms.ambientLight.value,min:0,max:1,step:.01,onUpdate:e[4]||(e[4]=u=>{r.mapViewer.uniforms.ambientLight.value=u,n.$bluemap.mapViewer.redraw()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("lighting.ambientLight")),1)]),_:1},8,["value","step"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("resolution.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.qualityStages,u=>(openBlock(),createBlock(a,{key:u.name,active:r.mapViewer.superSampling===u.value,onAction:d=>{n.$bluemap.mapViewer.superSampling=u.value,n.$bluemap.saveUserSettings(),n.$bluemap.mapViewer.redraw()}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"]),createVNode(o,{title:n.$t("renderDistance.title")},{default:withCtx(()=>[createVNode(l,{value:r.mapViewer.loadedHiresViewDistance,min:r.settings.hiresSliderMin,max:r.settings.hiresSliderMax,step:10,formatter:s.renderDistanceFormatter,onUpdate:e[5]||(e[5]=u=>{r.mapViewer.loadedHiresViewDistance=u,n.$bluemap.mapViewer.updateLoadedMapArea()}),onLazy:e[6]||(e[6]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.hiresLayer")),1)]),_:1},8,["value","min","max","formatter"]),createVNode(l,{value:r.mapViewer.loadedLowresViewDistance,min:r.settings.lowresSliderMin,max:r.settings.lowresSliderMax,step:100,onUpdate:e[7]||(e[7]=u=>{r.mapViewer.loadedLowresViewDistance=u,n.$bluemap.mapViewer.updateLoadedMapArea()}),onLazy:e[8]||(e[8]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.lowersLayer")),1)]),_:1},8,["value","min","max"]),createVNode(c,{on:!r.appState.controls.pauseTileLoading,onAction:e[9]||(e[9]=u=>{r.appState.controls.pauseTileLoading=!r.appState.controls.pauseTileLoading,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("renderDistance.loadHiresWhileMoving")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("mapControls.title")},{default:withCtx(()=>[createVNode(c,{on:r.appState.controls.showZoomButtons,onAction:e[10]||(e[10]=u=>{r.appState.controls.showZoomButtons=!r.appState.controls.showZoomButtons,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("mapControls.showZoomButtons")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("freeFlightControls.title")},{default:withCtx(()=>[createVNode(l,{value:r.appState.controls.mouseSensitivity,min:.1,max:5,step:.05,onUpdate:e[11]||(e[11]=u=>{r.appState.controls.mouseSensitivity=u,n.$bluemap.updateControlsSettings()}),onLazy:e[12]||(e[12]=u=>n.$bluemap.saveUserSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("freeFlightControls.mouseSensitivity")),1)]),_:1},8,["value","min","step"]),createVNode(c,{on:r.appState.controls.invertMouse,onAction:e[13]||(e[13]=u=>{r.appState.controls.invertMouse=!r.appState.controls.invertMouse,n.$bluemap.updateControlsSettings(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("freeFlightControls.invertMouseY")),1)]),_:1},8,["on"])]),_:1},8,["title"]),createVNode(o,{title:n.$t("theme.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.themes,u=>(openBlock(),createBlock(a,{key:u.name,active:r.appState.theme===u.value,onAction:d=>{n.$bluemap.setTheme(u.value),n.$bluemap.saveUserSettings()}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"]),createVNode(o,{title:n.$t("screenshot.title")},{default:withCtx(()=>[createVNode(c,{on:r.appState.screenshot.clipboard,onAction:e[14]||(e[14]=u=>{r.appState.screenshot.clipboard=!r.appState.screenshot.clipboard,n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("screenshot.clipboard")),1)]),_:1},8,["on"])]),_:1},8,["title"]),r.languages.length>1?(openBlock(),createBlock(o,{key:1,title:n.$t("language.title")},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.languages,u=>(openBlock(),createBlock(a,{key:u.locale,active:u.locale===n.$i18n.locale,onAction:d=>{s.changeLanguage(u.locale)}},{default:withCtx(()=>[createTextVNode(toDisplayString$1(u.name),1)]),_:2},1032,["active","onAction"]))),128))]),_:1},8,["title"])):createCommentVNode("",!0),createVNode(c,{on:r.mapViewer.uniforms.chunkBorders.value,onAction:e[15]||(e[15]=u=>{s.switchChunkBorders(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("chunkBorders.button")),1)]),_:1},8,["on"]),createVNode(c,{on:r.appState.debug,onAction:e[16]||(e[16]=u=>{s.switchDebug(),n.$bluemap.saveUserSettings()})},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("debug.button")),1)]),_:1},8,["on"]),createVNode(a,{onAction:e[17]||(e[17]=u=>n.$bluemap.resetSettings())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("resetAllSettings.button")),1)]),_:1})])}const SettingsMenu=_export_sfc(_sfc_main$a,[["render",_sfc_render$a]]);var Nt;let MainMenu$1=(Nt=class{constructor(){this.isOpen=!1,this.pageStack=[]}currentPage(){return this.pageStack.length===0?Nt.NULL_PAGE:this.pageStack[this.pageStack.length-1]}openPage(e="root",t=()=>i18n.t("menu.title"),i={}){this.isOpen||(this.pageStack.splice(0,this.pageStack.length),this.isOpen=!0),typeof t=="function"?this.pageStack.push({id:e,get title(){return t()},...i}):this.pageStack.push({id:e,title:t,...i})}closePage(){this.pageStack.splice(this.pageStack.length-1,1),this.pageStack.length<1&&(this.isOpen=!1)}reOpenPage(){this.pageStack.length===0?this.openPage():this.pageStack[0].id!=="root"?(this.pageStack.splice(0,this.pageStack.length),this.openPage()):this.isOpen=!0}closeAll(){this.isOpen=!1}},me(Nt,"NULL_PAGE",{id:"-",title:"-"}),Nt);const _sfc_main$9={name:"MarkerItem",props:{marker:Object},data(){return{appState:this.$bluemap.appState,controls:this.$bluemap.mapViewer.controlsManager.data,mapId:this.$bluemap.mapViewer.data.map.id}},computed:{markerLabel(){switch(this.marker.type){case"player":return this.marker.name}if(this.marker.label){let n=/^(?:<[^>]*>\s*)*([^<>]*\S[^<>]*)(?:<|$)/gi.exec(this.marker.label);if(n&&n.length>1)return n[1]}return this.marker.id},position(){return n=>Math.floor(n)}},methods:{async click(n){let e=this.$bluemap.mapViewer.controlsManager;if(e.controls&&e.controls.stopFollowingPlayerMarker&&e.controls.stopFollowingPlayerMarker(),this.marker.type==="player"){if(this.marker.foreign){let t=await this.$bluemap.findPlayerMap(this.marker.playerUuid);if(!t)return;await this.$bluemap.switchMap(t.data.id)}n&&e.controls&&e.controls.followPlayerMarker&&this.marker.visible&&e.controls.followPlayerMarker(this.marker)}else if(!this.marker.visible)return;e.position.copy(this.marker.position)},steve(n){n.target.src="assets/steve.png"}}},_hoisted_1$9=["title"],_hoisted_2$7={key:0,class:"icon"},_hoisted_3$6=["src"],_hoisted_4$4={class:"info"},_hoisted_5$2={class:"label"},_hoisted_6$2={class:"stats"},_hoisted_7$2={key:0},_hoisted_8$2=["title"],_hoisted_9$1=createStaticVNode('',1),_hoisted_10$1=[_hoisted_9$1];function _sfc_render$9(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["marker-item",{"marker-hidden":!t.marker.visible}])},[createBaseVNode("div",{class:"marker-button",title:t.marker.id,onClick:e[1]||(e[1]=a=>s.click(!1))},[t.marker.type==="player"?(openBlock(),createElementBlock("div",_hoisted_2$7,[createBaseVNode("img",{src:"maps/"+r.mapId+"/assets/playerheads/"+t.marker.playerUuid+".png",alt:"playerhead",onError:e[0]||(e[0]=(...a)=>s.steve&&s.steve(...a))},null,40,_hoisted_3$6)])):createCommentVNode("",!0),createBaseVNode("div",_hoisted_4$4,[createBaseVNode("div",_hoisted_5$2,toDisplayString$1(s.markerLabel),1),createBaseVNode("div",_hoisted_6$2,[r.appState.debug?(openBlock(),createElementBlock("div",_hoisted_7$2,toDisplayString$1(t.marker.type)+"-marker ",1)):createCommentVNode("",!0),createBaseVNode("div",null," ("+toDisplayString$1(s.position(t.marker.position.x))+" | "+toDisplayString$1(s.position(t.marker.position.y))+" | "+toDisplayString$1(s.position(t.marker.position.z))+") ",1)])])],8,_hoisted_1$9),t.marker.type==="player"?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(["follow-player-button",{active:r.controls.controls.followingPlayer&&r.controls.controls.followingPlayer.id===t.marker.id}]),onClick:e[2]||(e[2]=a=>s.click(!0)),title:n.$t("markers.followPlayerTitle")},_hoisted_10$1,10,_hoisted_8$2)):createCommentVNode("",!0)],2)}const MarkerItem=_export_sfc(_sfc_main$9,[["render",_sfc_render$9]]),_sfc_main$8={name:"TextInput",props:{value:String}},_hoisted_1$8=["value"];function _sfc_render$8(n,e,t,i,r,s){return openBlock(),createElementBlock("input",{class:"text-input",type:"text",value:t.value,onInput:e[0]||(e[0]=a=>n.$emit("input",a)),onKeydown:e[1]||(e[1]=a=>a.stopPropagation())},null,40,_hoisted_1$8)}const TextInput=_export_sfc(_sfc_main$8,[["render",_sfc_render$8]]),_sfc_main$7={name:"MarkerSet",components:{SwitchHandle},props:{markerSet:Object},computed:{filteredMarkerSetCount(){let n=0;for(let e of this.markerSet.markerSets)e.listed&&n++;return n},filteredMarkerCount(){let n=0;for(let e of this.markerSet.markers)e.listed&&n++;return n},label(){return this.markerSet.id==="bm-players"?this.$t("players.title"):this.markerSet.label},active(){for(let n of this.markerSet.markers)if(n.listed)return!0;for(let n of this.markerSet.markerSets)if(n.listed)return!0;return!1}},methods:{toggle(){this.markerSet.toggleable&&(this.markerSet.visible=!this.markerSet.visible,this.markerSet.saveState())},more(n){this.active&&this.$emit("more",n)}}},_hoisted_1$7=["title"],_hoisted_2$6={class:"marker-set-switch"},_hoisted_3$5={class:"label"},_hoisted_4$3={class:"stats"},_hoisted_5$1={key:0},_hoisted_6$1={key:1},_hoisted_7$1=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M25.004,9.294c0,0.806-0.75,1.46-1.676,1.46H6.671c-0.925,0-1.674-0.654-1.674-1.46l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,7.833,25.004,8.487,25.004,9.294L25.004,9.294z`}),createBaseVNode("path",{d:`M25.004,20.706c0,0.807-0.75,1.461-1.676,1.461H6.671c-0.925,0-1.674-0.654-1.674-1.461l0,0\r + c0-0.807,0.749-1.461,1.674-1.461h16.657C24.254,19.245,25.004,19.899,25.004,20.706L25.004,20.706z`})],-1),_hoisted_8$1=[_hoisted_7$1];function _sfc_render$7(n,e,t,i,r,s){const a=resolveComponent("SwitchHandle");return openBlock(),createElementBlock("div",{class:"marker-set",title:t.markerSet.id},[createBaseVNode("div",{class:"info",onClick:e[0]||(e[0]=(...o)=>s.toggle&&s.toggle(...o))},[createBaseVNode("div",_hoisted_2$6,[createBaseVNode("div",_hoisted_3$5,toDisplayString$1(s.label),1),t.markerSet.toggleable?(openBlock(),createBlock(a,{key:0,on:t.markerSet.visible},null,8,["on"])):createCommentVNode("",!0)]),createBaseVNode("div",_hoisted_4$3,[s.filteredMarkerCount>0?(openBlock(),createElementBlock("div",_hoisted_5$1,toDisplayString$1(s.filteredMarkerCount)+" "+toDisplayString$1(n.$t("markers.marker",s.filteredMarkerCount)),1)):createCommentVNode("",!0),s.filteredMarkerSetCount>0?(openBlock(),createElementBlock("div",_hoisted_6$1,toDisplayString$1(s.filteredMarkerSetCount)+" "+toDisplayString$1(n.$t("markers.markerSet",s.filteredMarkerSetCount)),1)):createCommentVNode("",!0)])]),createBaseVNode("div",{class:normalizeClass(["open-menu-button",{active:s.active}]),onClick:e[1]||(e[1]=o=>s.more(o))},_hoisted_8$1,2)],8,_hoisted_1$7)}const MarkerSet$1=_export_sfc(_sfc_main$7,[["render",_sfc_render$7]]),_sfc_main$6={name:"ChoiceBox",props:{title:{type:String,required:!1,default:""},choices:Array,selection:String}},_hoisted_1$6={class:"choice-box"},_hoisted_2$5={key:0,class:"title"},_hoisted_3$4={class:"choices"},_hoisted_4$2=["onClick"];function _sfc_render$6(n,e,t,i,r,s){return openBlock(),createElementBlock("div",_hoisted_1$6,[t.title?(openBlock(),createElementBlock("div",_hoisted_2$5,toDisplayString$1(t.title),1)):createCommentVNode("",!0),createBaseVNode("div",_hoisted_3$4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(t.choices,a=>(openBlock(),createElementBlock("div",{class:normalizeClass(["choice",{selected:t.selection===a.id}]),key:a.id,onClick:o=>n.$emit("choice",a)},toDisplayString$1(a.name),11,_hoisted_4$2))),128))])])}const ChoiceBox=_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]),_sfc_main$5={name:"MarkerSetMenu",components:{ChoiceBox,SimpleButton,MarkerSet:MarkerSet$1,TextInput,MarkerItem,Group},props:{menu:MainMenu$1},data(){return{controls:this.$bluemap.mapViewer.controlsManager.data,filter:{search:"",order:"default"}}},computed:{thisMarkerSet(){return this.menu.currentPage().markerSet},filteredMarkers(){return this.thisMarkerSet.markers.filter(n=>n.listed?!this.filter.search||n.id.includesCI(this.filter.search)||n.label&&n.label.includesCI(this.filter.search)?!0:n.type==="player"&&(n.name.includesCI(this.filter.search)||n.playerUuid.includesCI(this.filter.search)):!1).sort((n,e)=>{if(this.filter.order==="label"){let t=(n.type==="player"?n.name:n.label).toLowerCase(),i=(e.type==="player"?e.name:e.label).toLowerCase();return ti?1:0}return this.filter.order==="distance"?n.position.distanceToSquared(this.controls.position)-e.position.distanceToSquared(this.controls.position):(n.sorting||0)-(e.sorting||0)})},filteredMarkerSets(){return this.thisMarkerSet.markerSets.filter(n=>n.listed).sort((n,e)=>(n.sorting||0)-(e.sorting||0))}},methods:{openMore(n){this.menu.openPage(this.menu.currentPage().id,this.menu.currentPage().title+" > "+this.labelOf(n),{markerSet:n})},labelOf(n){return n.id==="bm-players"?this.$t("players.title"):n.label}}},_hoisted_1$5={class:"marker-sets"},_hoisted_2$4={key:0},_hoisted_3$3={key:1,class:"markers"};function _sfc_render$5(n,e,t,i,r,s){const a=resolveComponent("MarkerSet"),o=resolveComponent("TextInput"),l=resolveComponent("ChoiceBox"),c=resolveComponent("MarkerItem");return openBlock(),createElementBlock("div",null,[createBaseVNode("div",_hoisted_1$5,[(openBlock(!0),createElementBlock(Fragment,null,renderList(s.filteredMarkerSets,u=>(openBlock(),createBlock(a,{key:u.id,"marker-set":u,onMore:d=>s.openMore(u)},null,8,["marker-set","onMore"]))),128))]),s.filteredMarkerSets.length>0&s.thisMarkerSet.markers.length>0?(openBlock(),createElementBlock("hr",_hoisted_2$4)):createCommentVNode("",!0),s.thisMarkerSet.markers.length>0?(openBlock(),createElementBlock("div",_hoisted_3$3,[createVNode(o,{value:r.filter.search,onInput:e[0]||(e[0]=u=>r.filter.search=u.target.value),placeholder:n.$t("markers.searchPlaceholder")},null,8,["value","placeholder"]),createVNode(l,{title:n.$t("markers.sort.title"),choices:[{id:"default",name:n.$t("markers.sort.by.default")},{id:"label",name:n.$t("markers.sort.by.label")},{id:"distance",name:n.$t("markers.sort.by.distance")}],selection:r.filter.order,onChoice:e[1]||(e[1]=u=>r.filter.order=u.id)},null,8,["title","choices","selection"]),(openBlock(!0),createElementBlock(Fragment,null,renderList(s.filteredMarkers,u=>(openBlock(),createBlock(c,{key:u.id,marker:u},null,8,["marker"]))),128))])):createCommentVNode("",!0)])}const MarkerSetMenu=_export_sfc(_sfc_main$5,[["render",_sfc_render$5]]),_sfc_main$4={name:"MapButton",props:{map:Object},data(){return{mapViewer:this.$bluemap.mapViewer.data,appState:this.$bluemap.appState}},computed:{selectedMapId(){return this.mapViewer.map?this.mapViewer.map.id:null}},methods:{switchMap(n){this.$bluemap.switchMap(n)}}},_hoisted_1$4=["title"],_hoisted_2$3={class:"name"};function _sfc_render$4(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{class:normalizeClass(["map-button",{selected:t.map.id===s.selectedMapId}]),onClick:e[0]||(e[0]=a=>s.switchMap(t.map.id)),title:t.map.id},[createBaseVNode("span",{class:"sky",style:normalizeStyle({color:"rgb("+t.map.skyColor.r*255+","+t.map.skyColor.g*255+","+t.map.skyColor.b*255+")"})},"•",4),createBaseVNode("span",_hoisted_2$3,toDisplayString$1(t.map.name),1)],10,_hoisted_1$4)}const MapButton=_export_sfc(_sfc_main$4,[["render",_sfc_render$4]]),_sfc_main$3={name:"MainMenu",components:{MapButton,MarkerSetMenu,SettingsMenu,SimpleButton,SideMenu},props:{menu:MainMenu$1},data(){return{appState:this.$bluemap.appState,markers:this.$bluemap.mapViewer.markers.data}},methods:{goFullscreen(){document.body.requestFullscreen()}}},_hoisted_1$3={key:0},_hoisted_2$2=createBaseVNode("hr",null,null,-1),_hoisted_3$2={key:1},_hoisted_4$1=["innerHTML"];function _sfc_render$3(n,e,t,i,r,s){const a=resolveComponent("SimpleButton"),o=resolveComponent("MapButton"),l=resolveComponent("MarkerSetMenu"),c=resolveComponent("SettingsMenu"),u=resolveComponent("SideMenu");return openBlock(),createBlock(u,{open:t.menu.isOpen,title:t.menu.currentPage().title,back:t.menu.pageStack.length>1,onBack:e[7]||(e[7]=d=>t.menu.closePage()),onClose:e[8]||(e[8]=d=>t.menu.closeAll())},{default:withCtx(()=>[t.menu.currentPage().id==="root"?(openBlock(),createElementBlock("div",_hoisted_1$3,[createVNode(a,{onAction:e[0]||(e[0]=d=>t.menu.openPage("maps",()=>n.$t("maps.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("maps.button")),1)]),_:1}),createVNode(a,{onAction:e[1]||(e[1]=d=>t.menu.openPage("markers",()=>n.$t("markers.title"),{markerSet:r.markers})),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("markers.button")),1)]),_:1}),createVNode(a,{onAction:e[2]||(e[2]=d=>t.menu.openPage("settings",()=>n.$t("settings.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("settings.button")),1)]),_:1}),createVNode(a,{onAction:e[3]||(e[3]=d=>t.menu.openPage("info",()=>n.$t("info.title"))),submenu:!0},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("info.button")),1)]),_:1}),_hoisted_2$2,createVNode(a,{onAction:s.goFullscreen},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("goFullscreen.button")),1)]),_:1},8,["onAction"]),createVNode(a,{onAction:e[4]||(e[4]=d=>n.$bluemap.resetCamera())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("resetCamera.button")),1)]),_:1}),createVNode(a,{onAction:e[5]||(e[5]=d=>n.$bluemap.takeScreenshot())},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("screenshot.button")),1)]),_:1}),createVNode(a,{onAction:e[6]||(e[6]=d=>n.$bluemap.updateMap()),title:n.$t("updateMap.tooltip")},{default:withCtx(()=>[createTextVNode(toDisplayString$1(n.$t("updateMap.button")),1)]),_:1},8,["title"])])):createCommentVNode("",!0),t.menu.currentPage().id==="maps"?(openBlock(),createElementBlock("div",_hoisted_3$2,[(openBlock(!0),createElementBlock(Fragment,null,renderList(r.appState.maps,d=>(openBlock(),createBlock(o,{key:d.id,map:d},null,8,["map"]))),128))])):createCommentVNode("",!0),t.menu.currentPage().id==="markers"?(openBlock(),createBlock(l,{key:2,menu:t.menu},null,8,["menu"])):createCommentVNode("",!0),t.menu.currentPage().id==="settings"?(openBlock(),createBlock(c,{key:3})):createCommentVNode("",!0),t.menu.currentPage().id==="info"?(openBlock(),createElementBlock("div",{key:4,class:"info-content",innerHTML:n.$t("info.content",{version:n.$bluemap.settings.version})},null,8,_hoisted_4$1)):createCommentVNode("",!0)]),_:1},8,["open","title","back"])}const MainMenu=_export_sfc(_sfc_main$3,[["render",_sfc_render$3]]),_sfc_main$2={name:"FreeFlightMobileControls",data(){return{enabled:!1,forward:0,forwardPointer:-1,up:0,upPointer:-1}},methods:{onTouchStop(n){console.log("Stop: ",n),n.changedTouches[0].identifier===this.forwardPointer&&(this.forward=0),n.changedTouches[0].identifier===this.upPointer&&(this.up=0)},onFrame(n){let e=this.$bluemap.mapViewer.controlsManager;e.position.x+=this.forward*Math.sin(e.rotation)*n.detail.delta*.02,e.position.z+=this.forward*-Math.cos(e.rotation)*n.detail.delta*.02,e.position.y+=this.up*n.detail.delta*.01},enable(){this.enabled=!0}},mounted(){window.addEventListener("touchstart",this.enable,{passive:!0}),window.addEventListener("touchend",this.onTouchStop),window.addEventListener("touchcancel",this.onTouchStop),this.$bluemap.events.addEventListener("bluemapRenderFrame",this.onFrame)},beforeUnmount(){window.removeEventListener("touchstart",this.enable),window.removeEventListener("touchend",this.onTouchStop),window.removeEventListener("touchcancel",this.onTouchStop),this.$bluemap.events.removeEventListener("bluemapRenderFrame",this.onFrame)}},_hoisted_1$2={class:"move-fields"},_hoisted_2$1=createBaseVNode("svg",{viewBox:"0 0 100 50"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792\r + c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_3$1=[_hoisted_2$1],_hoisted_4=createBaseVNode("svg",{viewBox:"0 0 100 50",class:"down"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792\r + c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_5=[_hoisted_4],_hoisted_6={class:"height-fields"},_hoisted_7=createBaseVNode("svg",{viewBox:"0 0 100 50"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792\r + c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_8=[_hoisted_7],_hoisted_9=createBaseVNode("svg",{viewBox:"0 0 100 50",class:"down"},[createBaseVNode("path",{d:`M6.75,48.375c-2.75,0-3.384-1.565-1.409-3.479L46.41,5.104c1.975-1.914,5.207-1.913,7.182,0l41.067,39.792\r + c1.975,1.914,1.341,3.479-1.409,3.479H6.75z`})],-1),_hoisted_10=[_hoisted_9];function _sfc_render$2(n,e,t,i,r,s){return openBlock(),createElementBlock("div",{id:"ff-mobile-controls",class:normalizeClass({disabled:!r.enabled})},[createBaseVNode("div",_hoisted_1$2,[createBaseVNode("div",{class:"button up-button",onTouchstartPassive:e[0]||(e[0]=a=>{r.forward=1,r.forwardPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_3$1,32),createBaseVNode("div",{class:"button down-button",onTouchstartPassive:e[1]||(e[1]=a=>{r.forward=-1,r.forwardPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_5,32)]),createBaseVNode("div",_hoisted_6,[createBaseVNode("div",{class:"button up-button",onTouchstartPassive:e[2]||(e[2]=a=>{r.up=1,r.upPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_8,32),createBaseVNode("div",{class:"button down-button",onTouchstartPassive:e[3]||(e[3]=a=>{r.up=-1,r.upPointer=a.changedTouches[0].identifier,a.preventDefault()})},_hoisted_10,32)])],2)}const FreeFlightMobileControls=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),_sfc_main$1={name:"ZoomButtons",components:{SvgButton},methods:{zoom(n){var t;let e=(t=this.$bluemap.mapViewer.controlsManager.controls)==null?void 0:t.mouseZoom;e&&(e.deltaZoom+=n)}}},_hoisted_1$1={id:"zoom-buttons"},_hoisted_2=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("path",{d:`M22.471,12.95H17.05V7.527c0-1.297-0.917-2.348-2.05-2.348c-1.132,0-2.05,1.051-2.05,2.348v5.423H7.527\r + c-1.297,0-2.348,0.917-2.348,2.05c0,1.132,1.051,2.05,2.348,2.05h5.423v5.421c0,1.299,0.918,2.351,2.05,2.351\r + c1.133,0,2.05-1.052,2.05-2.351V17.05h5.421c1.299,0,2.351-0.918,2.351-2.05C24.821,13.867,23.77,12.95,22.471,12.95z`})],-1),_hoisted_3=createBaseVNode("svg",{viewBox:"0 0 30 30"},[createBaseVNode("g",null,[createBaseVNode("path",{d:`M24.821,15c0,1.132-1.052,2.05-2.351,2.05H7.527c-1.297,0-2.348-0.918-2.348-2.05l0,0c0-1.133,1.051-2.05,2.348-2.05\r + h14.944C23.77,12.95,24.821,13.867,24.821,15L24.821,15z`})])],-1);function _sfc_render$1(n,e,t,i,r,s){const a=resolveComponent("SvgButton");return openBlock(),createElementBlock("div",_hoisted_1$1,[createVNode(a,{onAction:e[0]||(e[0]=o=>s.zoom(-3))},{default:withCtx(()=>[_hoisted_2]),_:1}),createVNode(a,{onAction:e[1]||(e[1]=o=>s.zoom(3))},{default:withCtx(()=>[_hoisted_3]),_:1})])}const ZoomButtons=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]),_sfc_main={name:"App",components:{FreeFlightMobileControls,MainMenu,ControlBar,ZoomButtons},computed:{showMapMenu(){return this.mapViewer.mapState==="loading"||this.mapViewer.mapState==="loaded"}},data(){return{appState:this.$bluemap.appState,mapViewer:this.$bluemap.mapViewer.data}}},_hoisted_1={key:2,class:"map-state-message"};function _sfc_render(n,e,t,i,r,s){const a=resolveComponent("FreeFlightMobileControls"),o=resolveComponent("ZoomButtons"),l=resolveComponent("ControlBar"),c=resolveComponent("MainMenu");return openBlock(),createElementBlock("div",{id:"app",class:normalizeClass({"theme-light":r.appState.theme==="light","theme-dark":r.appState.theme==="dark","theme-contrast":r.appState.theme==="contrast"})},[r.mapViewer.mapState==="loaded"&&r.appState.controls.state==="free"?(openBlock(),createBlock(a,{key:0})):createCommentVNode("",!0),s.showMapMenu&&r.appState.controls.showZoomButtons&&r.appState.controls.state!=="free"?(openBlock(),createBlock(o,{key:1})):createCommentVNode("",!0),createVNode(l),r.mapViewer.mapState!=="loaded"?(openBlock(),createElementBlock("div",_hoisted_1,toDisplayString$1(n.$t("map."+r.mapViewer.mapState)),1)):createCommentVNode("",!0),createVNode(c,{menu:r.appState.menu},null,8,["menu"])],2)}const App=_export_sfc(_sfc_main,[["render",_sfc_render]]);var hammer={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */var hasRequiredHammer;function requireHammer(){return hasRequiredHammer||(hasRequiredHammer=1,function(n){(function(e,t,i,r){var s=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),o="function",l=Math.round,c=Math.abs,u=Date.now;function d(A,I,U){return setTimeout(y(A,U),I)}function f(A,I,U){return Array.isArray(A)?(m(A,U[I],U),!0):!1}function m(A,I,U){var te;if(A)if(A.forEach)A.forEach(I,U);else if(A.length!==r)for(te=0;te\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",qe=e.console&&(e.console.warn||e.console.log);return qe&&qe.call(e.console,te,Pe),A.apply(this,arguments)}}var _;typeof Object.assign!="function"?_=function(I){if(I===r||I===null)throw new TypeError("Cannot convert undefined or null to object");for(var U=Object(I),te=1;te-1}function B(A){return A.trim().split(/\s+/g)}function Z(A,I,U){if(A.indexOf&&!U)return A.indexOf(I);for(var te=0;teht[I]}),te}function G(A,I){for(var U,te,xe=I[0].toUpperCase()+I.slice(1),Pe=0;Pe1&&!U.firstMultiple?U.firstMultiple=$(I):xe===1&&(U.firstMultiple=!1);var Pe=U.firstInput,qe=U.firstMultiple,rt=qe?qe.center:Pe.center,ot=I.center=be(te);I.timeStamp=u(),I.deltaTime=I.timeStamp-Pe.timeStamp,I.angle=Ne(rt,ot),I.distance=Ie(rt,ot),K(U,I),I.offsetDirection=oe(I.deltaX,I.deltaY);var ht=ge(I.deltaTime,I.deltaX,I.deltaY);I.overallVelocityX=ht.x,I.overallVelocityY=ht.y,I.overallVelocity=c(ht.x)>c(ht.y)?ht.x:ht.y,I.scale=qe?Re(qe.pointers,te):1,I.rotation=qe?Fe(qe.pointers,te):0,I.maxPointers=U.prevInput?I.pointers.length>U.prevInput.maxPointers?I.pointers.length:U.prevInput.maxPointers:I.pointers.length,V(U,I);var xt=A.element;M(I.srcEvent.target,xt)&&(xt=I.srcEvent.target),I.target=xt}function K(A,I){var U=I.center,te=A.offsetDelta||{},xe=A.prevDelta||{},Pe=A.prevInput||{};(I.eventType===Le||Pe.eventType===Ce)&&(xe=A.prevDelta={x:Pe.deltaX||0,y:Pe.deltaY||0},te=A.offsetDelta={x:U.x,y:U.y}),I.deltaX=xe.x+(U.x-te.x),I.deltaY=xe.y+(U.y-te.y)}function V(A,I){var U=A.lastInterval||I,te=I.timeStamp-U.timeStamp,xe,Pe,qe,rt;if(I.eventType!=we&&(te>ae||U.velocity===r)){var ot=I.deltaX-U.deltaX,ht=I.deltaY-U.deltaY,xt=ge(te,ot,ht);Pe=xt.x,qe=xt.y,xe=c(xt.x)>c(xt.y)?xt.x:xt.y,rt=oe(ot,ht),A.lastInterval=I}else xe=U.velocity,Pe=U.velocityX,qe=U.velocityY,rt=U.direction;I.velocity=xe,I.velocityX=Pe,I.velocityY=qe,I.direction=rt}function $(A){for(var I=[],U=0;U=c(I)?A<0?D:k:I<0?H:j}function Ie(A,I,U){U||(U=se);var te=I[U[0]]-A[U[0]],xe=I[U[1]]-A[U[1]];return Math.sqrt(te*te+xe*xe)}function Ne(A,I,U){U||(U=se);var te=I[U[0]]-A[U[0]],xe=I[U[1]]-A[U[1]];return Math.atan2(xe,te)*180/Math.PI}function Fe(A,I){return Ne(I[1],I[0],P)+Ne(A[1],A[0],P)}function Re(A,I){return Ie(I[0],I[1],P)/Ie(A[0],A[1],P)}var De={mousedown:Le,mousemove:Ee,mouseup:Ce},We="mousedown",je="mousemove mouseup";function et(){this.evEl=We,this.evWin=je,this.pressed=!1,N.apply(this,arguments)}S(et,N,{handler:function(I){var U=De[I.type];U&Le&&I.button===0&&(this.pressed=!0),U&Ee&&I.which!==1&&(U=Ce),this.pressed&&(U&Ce&&(this.pressed=!1),this.callback(this.manager,U,{pointers:[I],changedPointers:[I],pointerType:Me,srcEvent:I}))}});var W={pointerdown:Le,pointermove:Ee,pointerup:Ce,pointercancel:we,pointerout:we},fe={2:ne,3:ye,4:Me,5:Te},Se="pointerdown",Ae="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(Se="MSPointerDown",Ae="MSPointerMove MSPointerUp MSPointerCancel");function Oe(){this.evEl=Se,this.evWin=Ae,N.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}S(Oe,N,{handler:function(I){var U=this.store,te=!1,xe=I.type.toLowerCase().replace("ms",""),Pe=W[xe],qe=fe[I.pointerType]||I.pointerType,rt=qe==ne,ot=Z(U,I.pointerId,"pointerId");Pe&Le&&(I.button===0||rt)?ot<0&&(U.push(I),ot=U.length-1):Pe&(Ce|we)&&(te=!0),!(ot<0)&&(U[ot]=I,this.callback(this.manager,Pe,{pointers:U,changedPointers:[I],pointerType:qe,srcEvent:I}),te&&U.splice(ot,1))}});var Xe={touchstart:Le,touchmove:Ee,touchend:Ce,touchcancel:we},tt="touchstart",it="touchstart touchmove touchend touchcancel";function _t(){this.evTarget=tt,this.evWin=it,this.started=!1,N.apply(this,arguments)}S(_t,N,{handler:function(I){var U=Xe[I.type];if(U===Le&&(this.started=!0),!!this.started){var te=Ke.call(this,I,U);U&(Ce|we)&&te[0].length-te[1].length===0&&(this.started=!1),this.callback(this.manager,U,{pointers:te[0],changedPointers:te[1],pointerType:ne,srcEvent:I})}}});function Ke(A,I){var U=q(A.touches),te=q(A.changedTouches);return I&(Ce|we)&&(U=X(U.concat(te),"identifier")),[U,te]}var mt={touchstart:Le,touchmove:Ee,touchend:Ce,touchcancel:we},ut="touchstart touchmove touchend touchcancel";function Lt(){this.evTarget=ut,this.targetIds={},N.apply(this,arguments)}S(Lt,N,{handler:function(I){var U=mt[I.type],te=Ht.call(this,I,U);te&&this.callback(this.manager,U,{pointers:te[0],changedPointers:te[1],pointerType:ne,srcEvent:I})}});function Ht(A,I){var U=q(A.touches),te=this.targetIds;if(I&(Le|Ee)&&U.length===1)return te[U[0].identifier]=!0,[U,U];var xe,Pe,qe=q(A.changedTouches),rt=[],ot=this.target;if(Pe=U.filter(function(ht){return M(ht.target,ot)}),I===Le)for(xe=0;xe-1&&te.splice(Pe,1)};setTimeout(xe,Wt)}}function J(A){for(var I=A.srcEvent.clientX,U=A.srcEvent.clientY,te=0;te-1&&this.requireFail.splice(I,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(A){return!!this.simultaneous[A.id]},emit:function(A){var I=this,U=this.state;function te(xe){I.manager.emit(xe,A)}U=Ye&&te(I.options.event+nt(U))},tryEmit:function(A){if(this.canEmit())return this.emit(A);this.state=lt},canEmit:function(){for(var A=0;AI.threshold&&xe&I.direction},attrTest:function(A){return Qe.prototype.attrTest.call(this,A)&&(this.state&ke||!(this.state&ke)&&this.directionTest(A))},emit:function(A){this.pX=A.deltaX,this.pY=A.deltaY;var I=yt(A.direction);I&&(A.additionalEvent=this.options.event+I),this._super.emit.call(this,A)}});function Ot(){Qe.apply(this,arguments)}S(Ot,Qe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[$e]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.scale-1)>this.options.threshold||this.state&ke)},emit:function(A){if(A.scale!==1){var I=A.scale<1?"in":"out";A.additionalEvent=this.options.event+I}this._super.emit.call(this,A)}});function Ft(){dt.apply(this,arguments),this._timer=null,this._input=null}S(Ft,dt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ue]},process:function(A){var I=this.options,U=A.pointers.length===I.pointers,te=A.distanceI.time;if(this._input=A,!te||!U||A.eventType&(Ce|we)&&!xe)this.reset();else if(A.eventType&Le)this.reset(),this._timer=d(function(){this.state=at,this.tryEmit()},I.time,this);else if(A.eventType&Ce)return at;return lt},reset:function(){clearTimeout(this._timer)},emit:function(A){this.state===at&&(A&&A.eventType&Ce?this.manager.emit(this.options.event+"up",A):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function qt(){Qe.apply(this,arguments)}S(qt,Qe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[$e]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.rotation)>this.options.threshold||this.state&ke)}});function Xt(){Qe.apply(this,arguments)}S(Xt,Qe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Y|ce,pointers:1},getTouchAction:function(){return Et.prototype.getTouchAction.call(this)},attrTest:function(A){var I=this.options.direction,U;return I&(Y|ce)?U=A.overallVelocity:I&Y?U=A.overallVelocityX:I&ce&&(U=A.overallVelocityY),this._super.attrTest.call(this,A)&&I&A.offsetDirection&&A.distance>this.options.threshold&&A.maxPointers==this.options.pointers&&c(U)>this.options.velocity&&A.eventType&Ce},emit:function(A){var I=yt(A.offsetDirection);I&&this.manager.emit(this.options.event+I,A),this.manager.emit(this.options.event,A)}});function $t(){dt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}S($t,dt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ze]},process:function(A){var I=this.options,U=A.pointers.length===I.pointers,te=A.distance{KeyCombination.oneUp(e,...ct.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.DOWN)&&(this.down=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneUp(e,...ct.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...ct.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...ct.KEYS.DOWN)&&(this.down=!1),KeyCombination.oneUp(e,...ct.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...ct.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1,this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaPosition=new Vector2,this.up=!1,this.down=!1,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaPosition.y-=1),this.down&&(this.deltaPosition.y+=1),this.left&&(this.deltaPosition.x-=1),this.right&&(this.deltaPosition.x+=1),this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=ct.temp_v2.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.speed*e*.06,this.manager.position.z+=r.y*i*this.speed*e*.06,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}},me(ct,"KEYS",{LEFT:[new KeyCombination("ArrowLeft"),new KeyCombination("KeyA")],UP:[new KeyCombination("ArrowUp"),new KeyCombination("KeyW")],RIGHT:[new KeyCombination("ArrowRight"),new KeyCombination("KeyD")],DOWN:[new KeyCombination("ArrowDown"),new KeyCombination("KeyS")]}),me(ct,"temp_v2",new Vector2),ct),MouseRotateControls$1=class{constructor(e,t,i,r,s){me(this,"onMouseDown",e=>{this.moving=!0,this.deltaRotation=0,this.lastX=e.x});me(this,"onMouseMove",e=>{document.pointerLockElement?this.deltaRotation-=e.movementX*this.speedCapture*this.pixelToSpeedMultiplier:this.moving&&(e.buttons===1?this.deltaRotation-=(e.x-this.lastX)*this.speedLeft*this.pixelToSpeedMultiplier:this.deltaRotation-=(e.x-this.lastX)*this.speedRight*this.pixelToSpeedMultiplier),this.lastX=e.x});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplier=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight)});this.target=e,this.manager=null,this.moving=!1,this.lastX=0,this.deltaRotation=0,this.speedLeft=t,this.speedRight=i,this.speedCapture=r,this.stiffness=s,this.pixelToSpeedMultiplier=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}},MouseAngleControls$1=class{constructor(e,t,i,r,s){me(this,"onMouseDown",e=>{this.moving=!0,this.deltaAngle=0,this.lastY=e.y});me(this,"onMouseMove",e=>{document.pointerLockElement?this.deltaAngle+=e.movementY*this.speedCapture*this.pixelToSpeedMultiplier:this.moving&&(e.buttons===1?this.deltaAngle+=(e.y-this.lastY)*this.speedLeft*this.pixelToSpeedMultiplier:this.deltaAngle+=(e.y-this.lastY)*this.speedRight*this.pixelToSpeedMultiplier),this.lastY=e.y});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplier=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.speedLeft=t,this.speedRight=i,this.speedCapture=r,this.stiffness=s,this.pixelToSpeedMultiplier=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i,this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}};const Pt=class Pt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneUp(e,...Pt.KEYS.UP)?(this.up=!0,e.preventDefault()):KeyCombination.oneUp(e,...Pt.KEYS.DOWN)&&(this.down=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Pt.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...Pt.KEYS.DOWN)&&(this.down=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1});this.target=e,this.manager=null,this.deltaY=0,this.up=!1,this.down=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaY+=1),this.down&&(this.deltaY-=1),this.deltaY===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.position.y+=this.deltaY*i*this.speed*e*.06,this.deltaY*=1-i,Math.abs(this.deltaY)<1e-4&&(this.deltaY=0)}};me(Pt,"KEYS",{UP:[new KeyCombination("Space"),new KeyCombination("PageUp")],DOWN:[new KeyCombination("ShiftLeft"),new KeyCombination("ShiftRight"),new KeyCombination("PageDown")]});let KeyHeightControls=Pt;const Gt=class Gt{constructor(e,t,i,r){me(this,"onTouchDown",e=>{e.pointerType!=="mouse"&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.center.x,e.center.y))});me(this,"onTouchMove",e=>{if(e.pointerType==="mouse")return;let t=Gt.tempVec2_1.set(e.center.x,e.center.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onTouchUp",e=>{e.pointerType!=="mouse"&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("movestart",this.onTouchDown),this.hammer.on("movemove",this.onTouchMove),this.hammer.on("moveend",this.onTouchUp),this.hammer.on("movecancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("movestart",this.onTouchDown),this.hammer.off("movemove",this.onTouchMove),this.hammer.off("moveend",this.onTouchUp),this.hammer.off("movecancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaPosition.x*this.speed*this.pixelToSpeedMultiplierX*this.stiffness,this.manager.angle-=this.deltaPosition.y*this.speed*this.pixelToSpeedMultiplierY*this.stiffness,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(Gt,"tempVec2_1",new Vector2);let TouchPanControls=Gt;const DEG2RAD=Math.PI/180,Bt=class Bt{constructor(e){me(this,"onContextMenu",e=>{e.preventDefault()});me(this,"onMouseDown",e=>{this.clickStart.set(e.x,e.y)});me(this,"onMouseUp",e=>{Math.abs(this.clickStart.x-e.x)>5||Math.abs(this.clickStart.y-e.y)>5||document.body.requestFullscreen().finally(()=>{this.target.requestPointerLock()})});me(this,"onWheel",e=>{e.preventDefault();let t=e.deltaY;e.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(t*=.01),e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(t*=.33),this.moveSpeed*=Math.pow(1.5,-t*.25),this.moveSpeed=MathUtils.clamp(this.moveSpeed,.05,5),this.keyMove.speed=this.moveSpeed,this.keyHeight.speed=this.moveSpeed});this.target=e,this.manager=null,this.data=reactive({followingPlayer:null}),this.hammer=new hammerExports.Manager(this.target),this.initializeHammer(),this.keyMove=new KeyMoveControls$1(this.target,.5,.1),this.keyHeight=new KeyHeightControls(this.target,.5,.2),this.mouseRotate=new MouseRotateControls$1(this.target,1.5,-2,-1.5,.5),this.mouseAngle=new MouseAngleControls$1(this.target,1.5,-2,-1.5,.5),this.touchPan=new TouchPanControls(this.target,this.hammer,5,.15),this.started=!1,this.clickStart=new Vector2,this.moveSpeed=.5,this.animationTargetHeight=0}start(e){this.manager=e,this.keyMove.start(e),this.keyHeight.start(e),this.mouseRotate.start(e),this.mouseAngle.start(e),this.touchPan.start(e),this.target.addEventListener("contextmenu",this.onContextMenu),this.target.addEventListener("mousedown",this.onMouseDown),this.target.addEventListener("mouseup",this.onMouseUp),this.target.addEventListener("wheel",this.onWheel,{passive:!1})}stop(){this.keyMove.stop(),this.keyHeight.stop(),this.mouseRotate.stop(),this.mouseAngle.stop(),this.touchPan.stop(),this.target.removeEventListener("contextmenu",this.onContextMenu),this.target.removeEventListener("mousedown",this.onMouseDown),this.target.removeEventListener("mouseup",this.onMouseUp),this.target.removeEventListener("wheel",this.onWheel)}update(e,t){Bt._beforeMoveTemp.copy(this.manager.position);let i=this.manager.rotation,r=this.manager.angle;this.keyMove.update(e,t),this.keyHeight.update(e,t),this.mouseRotate.update(e,t),this.mouseAngle.update(e,t),this.touchPan.update(e,t),this.data.followingPlayer&&(!Bt._beforeMoveTemp.equals(this.manager.position)||i!==this.manager.rotation||r!==this.manager.angle)&&this.stopFollowingPlayerMarker(),this.data.followingPlayer&&(this.manager.position.copy(this.data.followingPlayer.position),this.manager.rotation=(this.data.followingPlayer.rotation.yaw-180)*DEG2RAD,this.manager.angle=-(this.data.followingPlayer.rotation.pitch-90)*DEG2RAD),this.manager.angle=MathUtils.clamp(this.manager.angle,0,Math.PI),this.manager.distance=0,this.manager.ortho=0}initializeHammer(){let e=new hammerExports.Pan({event:"move",pointers:1,direction:hammerExports.DIRECTION_ALL,threshold:0});this.hammer.add(e)}followPlayerMarker(e){e.isPlayerMarker&&(e=e.data),this.data.followingPlayer=e,this.keyMove.deltaPosition.set(0,0)}stopFollowingPlayerMarker(){this.data.followingPlayer=null}};me(Bt,"_beforeMoveTemp",new Vector3);let FreeFlightControls=Bt;const kt=class kt{constructor(e,t,i){me(this,"onMouseDown",e=>{(e.buttons!==void 0?e.buttons===1:e.button===0)&&!e.altKey&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.x,e.y))});me(this,"onMouseMove",e=>{let t=kt.tempVec2_1.set(e.x,e.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onMouseUp",e=>{e.button===0&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=kt.tempVec2_1.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierX,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierY,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(kt,"tempVec2_1",new Vector2);let MouseMoveControls=kt;class MouseZoomControls{constructor(e,t,i){me(this,"onMouseWheel",e=>{e.preventDefault();let t=e.deltaY;e.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(t*=.01),e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(t*=.33),this.deltaZoom+=t});this.target=e,this.manager=null,this.stiffness=i,this.speed=t,this.deltaZoom=0}start(e){this.manager=e,this.target.addEventListener("wheel",this.onMouseWheel,{passive:!1})}stop(){this.target.removeEventListener("wheel",this.onMouseWheel)}update(e,t){if(this.deltaZoom===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.distance*=Math.pow(1.5,this.deltaZoom*i*this.speed),this.manager.angle=Math.min(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance)),this.deltaZoom*=1-i,Math.abs(this.deltaZoom)<1e-4&&(this.deltaZoom=0)}reset(){this.deltaZoom=0}}class MouseRotateControls{constructor(e,t,i){me(this,"onMouseDown",e=>{((e.buttons!==void 0?e.buttons===2:e.button===2)||(e.altKey||e.ctrlKey)&&(e.buttons!==void 0?e.buttons===1:e.button===0))&&(this.moving=!0,this.deltaRotation=0,this.lastX=e.x)});me(this,"onMouseMove",e=>{this.moving&&(this.deltaRotation+=e.x-this.lastX),this.lastX=e.x});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth});this.target=e,this.manager=null,this.moving=!1,this.lastX=0,this.deltaRotation=0,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierX=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed*this.pixelToSpeedMultiplierX,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}}class MouseAngleControls{constructor(e,t,i){me(this,"onMouseDown",e=>{((e.buttons!==void 0?e.buttons===2:e.button===2)||(e.altKey||e.ctrlKey)&&(e.buttons!==void 0?e.buttons===1:e.button===0))&&(this.moving=!0,this.deltaAngle=0,this.lastY=e.y,this.startDistance=this.manager.distance,this.dynamicDistance=this.manager.distance<1e3)});me(this,"onMouseMove",e=>{this.moving&&(this.deltaAngle-=e.y-this.lastY),this.lastY=e.y});me(this,"onMouseUp",e=>{this.moving=!1});me(this,"onWheel",e=>{this.dynamicDistance=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.dynamicDistance=!1,this.startDistance=0,this.speed=t,this.stiffness=i,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.target.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("wheel",this.onWheel),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.target.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("wheel",this.onWheel),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);if(i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*this.pixelToSpeedMultiplierY,this.dynamicDistance){let r=this.startDistance;r=Math.min(r,MapControls.getMaxDistanceForPerspectiveAngle(this.manager.angle)),r=Math.max(r,this.manager.controls.minDistance),this.manager.distance=softSet(this.manager.distance,r,.4),this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(r),.8)}else this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8);this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}}class MapHeightControls{constructor(e,t){this.manager=null,this.cameraHeightStiffness=e,this.targetHeightStiffness=t,this.targetHeight=0,this.cameraHeight=0,this.minCameraHeight=0,this.distanceTagretHeight=0}start(e){this.manager=e}stop(){}update(e,t){this.updateHeights(e,t),this.manager.position.y=Math.max(this.manager.position.y,this.getSuggestedHeight())}updateHeights(e,t){let i=this.targetHeightStiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=t.terrainHeightAt(this.manager.position.x,this.manager.position.z)+3||0,s=r-this.targetHeight;this.targetHeight+=s*i,Math.abs(s)<.001&&(this.targetHeight=r),this.minCameraHeight=0;let a=MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance);if(a>=.1){let o=this.cameraHeightStiffness/(16.666/e);o=MathUtils.clamp(o,0,1);let l=t.terrainHeightAt(this.manager.camera.position.x,this.manager.camera.position.z)||0,c=l-this.cameraHeight;this.cameraHeight+=c*o,Math.abs(c)<.001&&(this.cameraHeight=l);let u=Math.cos(a)*this.manager.distance;this.minCameraHeight=this.cameraHeight-u+1}this.distanceTagretHeight=MathUtils.lerp(this.targetHeight,0,Math.min(this.manager.distance/500,1))}getSuggestedHeight(){return Math.max(this.distanceTagretHeight,this.minCameraHeight)}}const ft=class ft{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...ft.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.DOWN)&&(this.down=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneDown(e,...ft.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...ft.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...ft.KEYS.DOWN)&&(this.down=!1),KeyCombination.oneUp(e,...ft.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...ft.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1,this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaPosition=new Vector2,this.up=!1,this.down=!1,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaPosition.y-=1),this.down&&(this.deltaPosition.y+=1),this.left&&(this.deltaPosition.x-=1),this.right&&(this.deltaPosition.x+=1),this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=ft.temp_v2.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*e*.06,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*e*.06,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}};me(ft,"KEYS",{LEFT:[new KeyCombination("ArrowLeft"),new KeyCombination("KeyA")],UP:[new KeyCombination("ArrowUp"),new KeyCombination("KeyW")],RIGHT:[new KeyCombination("ArrowRight"),new KeyCombination("KeyD")],DOWN:[new KeyCombination("ArrowDown"),new KeyCombination("KeyS")]}),me(ft,"temp_v2",new Vector2);let KeyMoveControls=ft;const Rt=class Rt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...Rt.KEYS.UP)&&(this.up=!0,e.preventDefault()),KeyCombination.oneDown(e,...Rt.KEYS.DOWN)&&(this.down=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Rt.KEYS.UP)&&(this.up=!1),KeyCombination.oneUp(e,...Rt.KEYS.DOWN)&&(this.down=!1)});me(this,"onStop",e=>{this.up=!1,this.down=!1});this.target=e,this.manager=null,this.deltaAngle=0,this.up=!1,this.down=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.up&&(this.deltaAngle-=1),this.down&&(this.deltaAngle+=1),this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*e*.06,this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8),this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}};me(Rt,"KEYS",{UP:[new KeyCombination("ArrowUp",KeyCombination.ALT),new KeyCombination("KeyW",KeyCombination.ALT),new KeyCombination("PageUp")],DOWN:[new KeyCombination("ArrowDown",KeyCombination.ALT),new KeyCombination("KeyS",KeyCombination.ALT),new KeyCombination("PageDown")]});let KeyAngleControls=Rt;const It=class It{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...It.KEYS.LEFT)&&(this.left=!0,e.preventDefault()),KeyCombination.oneDown(e,...It.KEYS.RIGHT)&&(this.right=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...It.KEYS.LEFT)&&(this.left=!1),KeyCombination.oneUp(e,...It.KEYS.RIGHT)&&(this.right=!1)});me(this,"onStop",e=>{this.left=!1,this.right=!1});this.target=e,this.manager=null,this.deltaRotation=0,this.left=!1,this.right=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.left&&(this.deltaRotation+=1),this.right&&(this.deltaRotation-=1),this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed*e*.06,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}};me(It,"KEYS",{LEFT:[new KeyCombination("ArrowLeft",KeyCombination.ALT),new KeyCombination("KeyA",KeyCombination.ALT),new KeyCombination("Delete")],RIGHT:[new KeyCombination("ArrowRight",KeyCombination.ALT),new KeyCombination("KeyD",KeyCombination.ALT),new KeyCombination("End")]});let KeyRotateControls=It;const Dt=class Dt{constructor(e,t,i){me(this,"onKeyDown",e=>{KeyCombination.oneDown(e,...Dt.KEYS.IN)&&(this.in=!0,e.preventDefault()),KeyCombination.oneDown(e,...Dt.KEYS.OUT)&&(this.out=!0,e.preventDefault())});me(this,"onKeyUp",e=>{KeyCombination.oneUp(e,...Dt.KEYS.IN)&&(this.in=!1),KeyCombination.oneUp(e,...Dt.KEYS.OUT)&&(this.out=!1)});me(this,"onStop",e=>{this.in=!1,this.out=!1});this.target=e,this.manager=null,this.deltaZoom=0,this.in=!1,this.out=!1,this.speed=t,this.stiffness=i}start(e){this.manager=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),window.addEventListener("blur",this.onStop)}stop(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),window.removeEventListener("blur",this.onStop)}update(e,t){if(this.in&&(this.deltaZoom-=1),this.out&&(this.deltaZoom+=1),this.deltaZoom===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.distance*=Math.pow(1.5,this.deltaZoom*i*this.speed*e*.06),this.manager.angle=Math.min(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance)),this.deltaZoom*=1-i,Math.abs(this.deltaZoom)<1e-4&&(this.deltaZoom=0)}};me(Dt,"KEYS",{IN:[new KeyCombination("NumpadAdd"),new KeyCombination("Insert")],OUT:[new KeyCombination("NumpadSubtract"),new KeyCombination("Home")]});let KeyZoomControls=Dt;const Vt=class Vt{constructor(e,t,i,r){me(this,"onTouchDown",e=>{e.pointerType!=="mouse"&&(this.moving=!0,this.deltaPosition.set(0,0),this.lastPosition.set(e.center.x,e.center.y))});me(this,"onTouchMove",e=>{if(e.pointerType==="mouse")return;let t=Vt.tempVec2_1.set(e.center.x,e.center.y);this.moving&&this.deltaPosition.sub(t).add(this.lastPosition),this.lastPosition.copy(t)});me(this,"onTouchUp",e=>{e.pointerType!=="mouse"&&(this.moving=!1)});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierX=1/this.target.clientWidth*(this.target.clientWidth/this.target.clientHeight),this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastPosition=new Vector2,this.deltaPosition=new Vector2,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierX=0,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("movestart",this.onTouchDown),this.hammer.on("movemove",this.onTouchMove),this.hammer.on("moveend",this.onTouchUp),this.hammer.on("movecancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("movestart",this.onTouchDown),this.hammer.off("movemove",this.onTouchMove),this.hammer.off("moveend",this.onTouchUp),this.hammer.off("movecancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaPosition.x===0&&this.deltaPosition.y===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1);let r=Vt.tempVec2_1.copy(this.deltaPosition);r.rotateAround(VEC2_ZERO,this.manager.rotation),this.manager.position.x+=r.x*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierX,this.manager.position.z+=r.y*i*this.manager.distance*this.speed*this.pixelToSpeedMultiplierY,this.deltaPosition.multiplyScalar(1-i),this.deltaPosition.lengthSq()<1e-4&&this.deltaPosition.set(0,0)}reset(){this.deltaPosition.set(0,0)}};me(Vt,"tempVec2_1",new Vector2);let TouchMoveControls=Vt;class TouchRotateControls{constructor(e,t,i){me(this,"onTouchDown",e=>{this.moving=!0,this.deltaRotation=0,this.lastRotation=e.rotation});me(this,"onTouchMove",e=>{if(this.moving){let t=e.rotation-this.lastRotation;t>180&&(t-=360),t<-180&&(t+=360),this.deltaRotation-=t}this.lastRotation=e.rotation});me(this,"onTouchUp",e=>{this.moving=!1});this.hammer=e,this.manager=null,this.moving=!1,this.lastRotation=0,this.deltaRotation=0,this.speed=t,this.stiffness=i}start(e){this.manager=e,this.hammer.on("rotatestart",this.onTouchDown),this.hammer.on("rotatemove",this.onTouchMove),this.hammer.on("rotateend",this.onTouchUp),this.hammer.on("rotatecancel",this.onTouchUp)}stop(){this.hammer.off("rotatestart",this.onTouchDown),this.hammer.off("rotatemove",this.onTouchMove),this.hammer.off("rotateend",this.onTouchUp),this.hammer.off("rotatecancel",this.onTouchUp)}update(e,t){if(this.deltaRotation===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.rotation+=this.deltaRotation*i*this.speed,this.deltaRotation*=1-i,Math.abs(this.deltaRotation)<1e-4&&(this.deltaRotation=0)}reset(){this.deltaRotation=0}}class TouchAngleControls{constructor(e,t,i,r){me(this,"onTouchDown",e=>{this.moving=!0,this.deltaAngle=0,this.lastY=e.center.y});me(this,"onTouchMove",e=>{this.moving&&(this.deltaAngle-=e.center.y-this.lastY),this.lastY=e.center.y});me(this,"onTouchUp",e=>{this.moving=!1});me(this,"updatePixelToSpeedMultiplier",()=>{this.pixelToSpeedMultiplierY=1/this.target.clientHeight});this.target=e,this.hammer=t,this.manager=null,this.moving=!1,this.lastY=0,this.deltaAngle=0,this.speed=i,this.stiffness=r,this.pixelToSpeedMultiplierY=0,this.updatePixelToSpeedMultiplier()}start(e){this.manager=e,this.hammer.on("tiltstart",this.onTouchDown),this.hammer.on("tiltmove",this.onTouchMove),this.hammer.on("tiltend",this.onTouchUp),this.hammer.on("tiltcancel",this.onTouchUp),window.addEventListener("resize",this.updatePixelToSpeedMultiplier)}stop(){this.hammer.off("tiltstart",this.onTouchDown),this.hammer.off("tiltmove",this.onTouchMove),this.hammer.off("tiltend",this.onTouchUp),this.hammer.off("tiltcancel",this.onTouchUp),window.removeEventListener("resize",this.updatePixelToSpeedMultiplier)}update(e,t){if(this.deltaAngle===0)return;let i=this.stiffness/(16.666/e);i=MathUtils.clamp(i,0,1),this.manager.angle+=this.deltaAngle*i*this.speed*this.pixelToSpeedMultiplierY,this.manager.angle=softMax(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance),.8),this.deltaAngle*=1-i,Math.abs(this.deltaAngle)<1e-4&&(this.deltaAngle=0)}reset(){this.deltaAngle=0}}class TouchZoomControls{constructor(e){me(this,"onTouchDown",e=>{this.moving=!0,this.lastZoom=1});me(this,"onTouchMove",e=>{this.moving&&(this.deltaZoom*=e.scale/this.lastZoom,this.manager.angle=Math.min(this.manager.angle,MapControls.getMaxPerspectiveAngleForDistance(this.manager.distance))),this.lastZoom=e.scale});me(this,"onTouchUp",e=>{this.moving=!1});this.hammer=e,this.manager=null,this.moving=!1,this.deltaZoom=1,this.lastZoom=1}start(e){this.manager=e,this.hammer.on("zoomstart",this.onTouchDown),this.hammer.on("zoommove",this.onTouchMove),this.hammer.on("zoomend",this.onTouchUp),this.hammer.on("zoomcancel",this.onTouchUp)}stop(){this.hammer.off("zoomstart",this.onTouchDown),this.hammer.off("zoommove",this.onTouchMove),this.hammer.off("zoomend",this.onTouchUp),this.hammer.off("zoomcancel",this.onTouchUp)}update(e,t){this.deltaZoom!==1&&(this.manager.distance/=this.deltaZoom,this.deltaZoom=1)}reset(){this.deltaZoom=1}}const HALF_PI=Math.PI*.5,HALF_PI_DIV=1/HALF_PI,Ut=class Ut{constructor(e,t){me(this,"onContextMenu",e=>{e.preventDefault()});me(this,"onTap",e=>{let t=!1,i=new Vector2(e.center.x,e.center.y),r=Date.now();this.lastTap>0&&this.lastTapCenter&&r-this.lastTap<500&&this.lastTapCenter.distanceTo(i)<5?(t=!0,this.lastTap=-1):(this.lastTap=r,this.lastTapCenter=i),this.manager.handleMapInteraction(new Vector2(e.center.x,e.center.y),{doubleTap:t})});this.rootElement=e,this.scrollCaptureElement=t,this.data=reactive({followingPlayer:null}),this.manager=null,this.hammer=new hammerExports.Manager(this.rootElement),this.initializeHammer(),this.mouseMove=new MouseMoveControls(this.rootElement,1.5,.3),this.mouseRotate=new MouseRotateControls(this.rootElement,6,.3),this.mouseAngle=new MouseAngleControls(this.rootElement,3,.3),this.mouseZoom=new MouseZoomControls(this.scrollCaptureElement,1,.2),this.keyMove=new KeyMoveControls(this.rootElement,.025,.2),this.keyRotate=new KeyRotateControls(this.rootElement,.06,.15),this.keyAngle=new KeyAngleControls(this.rootElement,.04,.15),this.keyZoom=new KeyZoomControls(this.rootElement,.2,.15),this.touchMove=new TouchMoveControls(this.rootElement,this.hammer,1.5,.3),this.touchRotate=new TouchRotateControls(this.hammer,.0174533,.3),this.touchAngle=new TouchAngleControls(this.rootElement,this.hammer,3,.3),this.touchZoom=new TouchZoomControls(this.hammer),this.mapHeight=new MapHeightControls(.2,.1),this.lastTap=-1,this.lastTapCenter=null,this.minDistance=5,this.maxDistance=1e5}start(e){this.manager=e,this.rootElement.addEventListener("contextmenu",this.onContextMenu),this.hammer.on("tap",this.onTap),this.mouseMove.start(e),this.mouseRotate.start(e),this.mouseAngle.start(e),this.mouseZoom.start(e),this.keyMove.start(e),this.keyRotate.start(e),this.keyAngle.start(e),this.keyZoom.start(e),this.touchMove.start(e),this.touchRotate.start(e),this.touchAngle.start(e),this.touchZoom.start(e),this.mapHeight.start(e)}stop(){this.stopFollowingPlayerMarker(),this.rootElement.removeEventListener("contextmenu",this.onContextMenu),this.hammer.off("tap",this.onTap),this.mouseMove.stop(),this.mouseRotate.stop(),this.mouseAngle.stop(),this.mouseZoom.stop(),this.keyMove.stop(),this.keyRotate.stop(),this.keyAngle.stop(),this.keyZoom.stop(),this.touchMove.stop(),this.touchRotate.stop(),this.touchAngle.stop(),this.touchZoom.stop(),this.mapHeight.stop()}update(e,t){this.manager.position.y=-1e4,Ut._beforeMoveTemp.copy(this.manager.position),this.mouseMove.update(e,t),this.keyMove.update(e,t),this.touchMove.update(e,t),this.data.followingPlayer&&!Ut._beforeMoveTemp.equals(this.manager.position)&&this.stopFollowingPlayerMarker(),this.data.followingPlayer&&this.manager.position.copy(this.data.followingPlayer.position),this.mouseZoom.update(e,t),this.keyZoom.update(e,t),this.touchZoom.update(e,t),this.manager.distance=softClamp(this.manager.distance,this.minDistance,this.maxDistance,.8),this.mouseRotate.update(e,t),this.keyRotate.update(e,t),this.touchRotate.update(e,t);const i=this.mouseRotate.moving||this.touchRotate.moving||this.keyRotate.left||this.keyRotate.right;this.manager.ortho!==0&&Math.abs(this.manager.rotation)<(i?.05:.3)&&(this.manager.rotation=softClamp(this.manager.rotation,0,0,.1)),this.manager.ortho===0&&(this.mouseAngle.update(e,t),this.keyAngle.update(e,t),this.touchAngle.update(e,t),this.manager.angle=softClamp(this.manager.angle,0,HALF_PI,.8)),(this.manager.ortho===0||this.manager.angle===0)&&this.mapHeight.update(e,t)}reset(){this.mouseMove.reset(),this.mouseRotate.reset(),this.mouseAngle.reset(),this.mouseZoom.reset(),this.touchMove.reset(),this.touchRotate.reset(),this.touchAngle.reset(),this.touchZoom.reset()}static getMaxPerspectiveAngleForDistance(e){return MathUtils.clamp((1-Math.pow(Math.max(e-5,.001)*5e-4,.5))*HALF_PI,0,HALF_PI)}static getMaxDistanceForPerspectiveAngle(e){return Math.pow(-(e*HALF_PI_DIV)+1,2)*2e3+5}initializeHammer(){let e=new hammerExports.Tap({event:"tap",pointers:1,taps:1,threshold:5}),t=new hammerExports.Pan({event:"move",pointers:1,direction:hammerExports.DIRECTION_ALL,threshold:0}),i=new hammerExports.Pan({event:"tilt",pointers:2,direction:hammerExports.DIRECTION_VERTICAL,threshold:0}),r=new hammerExports.Rotate({event:"rotate",pointers:2,threshold:0}),s=new hammerExports.Pinch({event:"zoom",pointers:2,threshold:0});t.recognizeWith(r),t.recognizeWith(i),t.recognizeWith(s),i.recognizeWith(r),i.recognizeWith(s),r.recognizeWith(s),this.hammer.add(e),this.hammer.add(i),this.hammer.add(t),this.hammer.add(r),this.hammer.add(s)}followPlayerMarker(e){e.isPlayerMarker&&(e=e.data),this.data.followingPlayer=e}stopFollowingPlayerMarker(){this.data.followingPlayer=null}};me(Ut,"_beforeMoveTemp",new Vector3);let MapControls=Ut;class Tile{constructor(e,t,i,r){Object.defineProperty(this,"isTile",{value:!0}),this.model=null,this.onLoad=i,this.onUnload=r,this.x=e,this.z=t,this.unloaded=!0,this.loading=!1}load(e){return this.loading?Promise.reject("tile is already loading!"):(this.loading=!0,this.unload(),this.unloaded=!1,e.load(this.x,this.z,()=>this.unloaded).then(t=>{if(this.unloaded){Tile.disposeModel(t);return}this.model=t,this.onLoad(this)},()=>{this.unload()}).finally(()=>{this.loading=!1}))}unload(){this.unloaded=!0,this.model&&(this.onUnload(this),Tile.disposeModel(this.model),this.model=null)}static disposeModel(e){var t,i;((t=e.userData)==null?void 0:t.tileType)==="hires"?e.geometry.dispose():((i=e.userData)==null?void 0:i.tileType)==="lowres"&&(e.material.uniforms.textureImage.value.dispose(),e.material.dispose())}get loaded(){return!!this.model}}class TileMap{constructor(e,t){this.canvas=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.canvas.width=e,this.canvas.height=t,this.tileMapContext=this.canvas.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.texture=new Texture(this.canvas),this.texture.generateMipmaps=!1,this.texture.magFilter=LinearFilter,this.texture.minFilter=LinearFilter,this.texture.wrapS=ClampToEdgeWrapping,this.texture.wrapT=ClampToEdgeWrapping,this.texture.flipY=!1,this.texture.needsUpdate=!0}setAll(e){this.tileMapContext.fillStyle=e,this.tileMapContext.fillRect(0,0,this.canvas.width,this.canvas.height),this.texture.needsUpdate=!0}setTile(e,t,i){this.tileMapContext.fillStyle=i,this.tileMapContext.fillRect(e,t,1,1),this.texture.needsUpdate=!0}}me(TileMap,"EMPTY","#000"),me(TileMap,"LOADED","#fff");const pt=class pt{constructor(e,t=null,i=null,r=null){me(this,"loadCloseTiles",()=>{this.unloaded||this.loadNextTile()&&(this.loadTimeout&&clearTimeout(this.loadTimeout),this.currentlyLoading<8?this.loadTimeout=setTimeout(this.loadCloseTiles,0):this.loadTimeout=setTimeout(this.loadCloseTiles,1e3))});me(this,"handleLoadedTile",e=>{this.tileMap.setTile(e.x-this.centerTile.x+pt.tileMapHalfSize,e.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.LOADED),this.scene.add(e.model),this.onTileLoad(e)});me(this,"handleUnloadedTile",e=>{this.tileMap.setTile(e.x-this.centerTile.x+pt.tileMapHalfSize,e.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.EMPTY),this.scene.remove(e.model),this.onTileUnload(e)});Object.defineProperty(this,"isTileManager",{value:!0}),this.sceneParent=new Scene,this.scene=new Group$1,this.sceneParent.add(this.scene),this.events=r,this.tileLoader=e,this.onTileLoad=t||function(){},this.onTileUnload=i||function(){},this.viewDistanceX=1,this.viewDistanceZ=1,this.centerTile=new Vector2(0,0),this.currentlyLoading=0,this.loadTimeout=null,this.tiles=new Map,this.tileMap=new TileMap(pt.tileMapSize,pt.tileMapSize),this.unloaded=!0}loadAroundTile(e,t,i,r){this.unloaded=!1;let s=!1;if((this.viewDistanceX>i||this.viewDistanceZ>r)&&(s=!0),this.viewDistanceX=i,this.viewDistanceZ=r,i<=0||r<=0){this.removeAllTiles();return}(s||this.centerTile.x!==e||this.centerTile.y!==t)&&(this.centerTile.set(e,t),this.removeFarTiles(),this.tileMap.setAll(TileMap.EMPTY),this.tiles.forEach(a=>{!a.loading&&!a.unloaded&&this.tileMap.setTile(a.x-this.centerTile.x+pt.tileMapHalfSize,a.z-this.centerTile.y+pt.tileMapHalfSize,TileMap.LOADED)})),this.loadCloseTiles()}unload(){this.unloaded=!0,this.removeAllTiles()}removeFarTiles(){this.tiles.forEach((e,t,i)=>{(e.x+this.viewDistanceXthis.centerTile.x||e.z+this.viewDistanceZthis.centerTile.y)&&(e.unload(),i.delete(t))})}removeAllTiles(){this.tileMap.setAll(TileMap.EMPTY),this.tiles.forEach(e=>{e.unload()}),this.tiles.clear()}loadNextTile(){if(this.unloaded)return!1;let e=0,t=0,i=1,r=1;for(;rthis.viewDistanceX||Math.abs(t-this.centerTile.y)>this.viewDistanceZ)return!1;let i=hashTile(e,t),r=this.tiles.get(i);return r!==void 0?!1:(this.currentlyLoading++,r=new Tile(e,t,this.handleLoadedTile,this.handleUnloadedTile),this.tiles.set(i,r),r.load(this.tileLoader).then(()=>{dispatchEvent(this.events,"bluemapTileLoaded",{tileManager:this,tile:r}),this.loadTimeout&&clearTimeout(this.loadTimeout),this.loadTimeout=setTimeout(this.loadCloseTiles,0)}).catch(s=>{}).finally(()=>{this.currentlyLoading--}),!0)}};me(pt,"tileMapSize",100),me(pt,"tileMapHalfSize",pt.tileMapSize/2);let TileManager=pt,bigEndianPlatform=null;function isBigEndianPlatform(){if(bigEndianPlatform===null){let n=new ArrayBuffer(2),e=new Uint8Array(n),t=new Uint16Array(n);e[0]=170,e[1]=187,bigEndianPlatform=t[0]===43707}return bigEndianPlatform}let InvertedEncodingTypes=[null,Float32Array,null,Int8Array,Int16Array,null,Int32Array,Uint8Array,Uint16Array,null,Uint32Array],getMethods={Uint16Array:"getUint16",Uint32Array:"getUint32",Int16Array:"getInt16",Int32Array:"getInt32",Float32Array:"getFloat32",Float64Array:"getFloat64"};function copyFromBuffer(n,e,t,i,r){let s=e.BYTES_PER_ELEMENT,a;if(r===isBigEndianPlatform()||s===1)a=new e(n,t,i);else{console.debug("PRWM file has opposite encoding, loading will be slow...");let o=new DataView(n,t,i*s),l=getMethods[e.name],c=!r,u=0;for(a=new e(i);u>7&1),a=r>>6&1,o=(r>>5&1)===1,l=r&31,c=0,u=0;if(o?(c=(t[2]<<16)+(t[3]<<8)+t[4],u=(t[5]<<16)+(t[6]<<8)+t[7]):(c=t[2]+(t[3]<<8)+(t[4]<<16),u=t[5]+(t[6]<<8)+(t[7]<<16)),e/4%1!==0)throw new Error("PRWM decoder: Offset should be a multiple of 4, received "+e);if(i===0)throw new Error("PRWM decoder: Invalid format version: 0");if(i!==1)throw new Error("PRWM decoder: Unsupported format version: "+i);if(!s){if(a!==0)throw new Error("PRWM decoder: Indices type must be set to 0 for non-indexed geometries");if(u!==0)throw new Error("PRWM decoder: Number of indices must be set to 0 for non-indexed geometries")}let d=8,f={},m,v,_,g,x,S,y,b,w,C,R,M;for(M=0;M>7&1,S=r>>6&1,g=(r>>4&3)+1,x=r&15,y=InvertedEncodingTypes[x],d++,d=Math.ceil(d/4)*4,b=copyFromBuffer(n,y,d+e,g*c,o),d+=y.BYTES_PER_ELEMENT*g*c,f[m]={type:_,cardinality:g,values:b,normalized:S===1}}for(w=null,s&&(d=Math.ceil(d/4)*4,w=copyFromBuffer(n,a===1?Uint32Array:Uint16Array,d+e,u,o)),C=[],d=Math.ceil(d/4)*4;dPromise.resolve(),s=0){me(this,"load",(e,t,i=()=>!1)=>{let r=this.tilePath+pathFromCoords(e,t)+".prbm";return new Promise((s,a)=>{this.fileLoader.load(r+"?"+this.tileCacheHash,async o=>{if(await this.loadBlocker(),i()){a({status:"cancelled"});return}let l=this.bufferGeometryLoader.parse(o),c=new Mesh(l,this.material),u=this.tileSettings.tileSize,d=this.tileSettings.translate,f=this.tileSettings.scale;c.position.set(e*u.x+d.x,0,t*u.z+d.z),c.scale.set(f.x,1,f.z),c.userData.tileUrl=r,c.userData.tileType="hires",c.updateMatrixWorld(!0),s(c)},()=>{},a)})});Object.defineProperty(this,"isTileLoader",{value:!0}),this.tilePath=e,this.material=t,this.tileSettings=i,this.tileCacheHash=s,this.loadBlocker=r,this.fileLoader=new FileLoader$1,this.fileLoader.setResponseType("arraybuffer"),this.bufferGeometryLoader=new PRBMLoader}}class LowresTileLoader{constructor(e,t,i,r,s,a,o=()=>Promise.resolve(),l=0){me(this,"load",(e,t,i=()=>!1)=>{let r=this.tilePath+this.lod+"/"+pathFromCoords(e,t)+".png";return new Promise((s,a)=>{this.textureLoader.load(r+"?"+this.tileCacheHash,async o=>{if(o.anisotropy=1,o.generateMipmaps=!1,o.magFilter=NearestFilter,o.minFilter=o.generateMipmaps?NearestMipMapLinearFilter:NearestFilter,o.wrapS=ClampToEdgeWrapping,o.wrapT=ClampToEdgeWrapping,o.flipY=!1,o.flatShading=!0,await this.loadBlocker(),i()){o.dispose(),a({status:"cancelled"});return}const l=Math.pow(this.tileSettings.lodFactor,this.lod-1);let c=new ShaderMaterial({uniforms:{...this.uniforms,tileSize:{value:new Vector2(this.tileSettings.tileSize.x,this.tileSettings.tileSize.z)},textureSize:{value:new Vector2(o.image.width,o.image.height)},textureImage:{type:"t",value:o},lod:{value:this.lod},lodScale:{value:l}},vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1}),u=new Mesh(this.geometry,c);u.position.set(e*this.tileSettings.tileSize.x*l,0,t*this.tileSettings.tileSize.z*l),u.scale.set(l,1,l),u.userData.tileUrl=r,u.userData.tileType="lowres",u.updateMatrixWorld(!0),s(u)},void 0,a)})});Object.defineProperty(this,"isLowresTileLoader",{value:!0}),this.tilePath=e,this.tileSettings=t,this.lod=i,this.loadBlocker=o,this.tileCacheHash=l,this.vertexShader=r,this.fragmentShader=s,this.uniforms=a,this.textureLoader=new TextureLoader,this.geometry=new PlaneGeometry(t.tileSize.x+1,t.tileSize.z+1,Math.ceil(100/(i*2)),Math.ceil(100/(i*2))),this.geometry.deleteAttribute("normal"),this.geometry.deleteAttribute("uv"),this.geometry.rotateX(-Math.PI/2),this.geometry.translate(t.tileSize.x/2+1,0,t.tileSize.x/2+1)}}class TextureAnimation{constructor(e,t){this.uniforms=e,this.data={interpolate:!1,width:1,height:1,frametime:1,...t},this.frameImages=1,this.frameDelta=0,this.frameTime=this.data.frametime*50,this.frames=1,this.frameIndex=0}init(e,t){this.frameImages=t/e,this.uniforms.animationFrameHeight.value=1/this.frameImages,this.frames=this.frameImages,this.data.frames&&this.data.frames.length>0?this.frames=this.data.frames.length:this.data.frames=null}step(e){if(this.frameDelta+=e,this.frameDelta>this.frameTime)if(this.frameDelta-=this.frameTime,this.frameDelta%=this.frameTime,this.frameIndex++,this.frameIndex%=this.frames,this.data.frames){let t=this.data.frames[this.frameIndex],i=this.data.frames[(this.frameIndex+1)%this.frames];this.uniforms.animationFrameIndex.value=t.index,this.uniforms.animationInterpolationFrameIndex.value=i.index,this.frameTime=t.time*50}else this.uniforms.animationFrameIndex.value=this.frameIndex,this.uniforms.animationInterpolationFrameIndex.value=(this.frameIndex+1)%this.frames;this.data.interpolate&&(this.uniforms.animationInterpolation.value=this.frameDelta/this.frameTime)}}let Map$1=class{constructor(e,t,i,r,s=null){me(this,"onTileLoad",e=>t=>{dispatchEvent(this.events,"bluemapMapTileLoaded",{tile:t,layer:e})});me(this,"onTileUnload",e=>t=>{dispatchEvent(this.events,"bluemapMapTileUnloaded",{tile:t,layer:e})});Object.defineProperty(this,"isMap",{value:!0}),this.loadBlocker=r,this.events=s,this.data=reactive({id:e,sorting:1e6,mapDataRoot:t,liveDataRoot:i,settingsUrl:t+"/settings.json",texturesUrl:t+"/textures.json",name:e,startPos:{x:0,z:0},skyColor:new Color,voidColor:new Color(0,0,0),ambientLight:0,skyLight:1,hires:{tileSize:{x:32,z:32},scale:{x:1,z:1},translate:{x:2,z:2}},lowres:{tileSize:{x:32,z:32},lodFactor:5,lodCount:3},perspectiveView:!1,flatView:!1,freeFlightView:!1,views:["perspective","flat","free"]}),this.raycaster=new Raycaster,this.hiresMaterial=null,this.lowresMaterial=null,this.loadedTextures=[],this.animations=[],this.hiresTileManager=null,this.lowresTileManager=null}load(e,t,i,r,s,a=0){this.unload();let o=this.loadSettings(a),l=this.loadTexturesFile(a);return this.lowresMaterial=this.createLowresMaterial(i,r,s),Promise.all([o,l]).then(c=>{let u=c[1];if(u===null)throw new Error("Failed to parse textures.json!");this.hiresMaterial=this.createHiresMaterial(e,t,s,u),this.hiresTileManager=new TileManager(new TileLoader(`${this.data.mapDataRoot}/tiles/0/`,this.hiresMaterial,this.data.hires,this.loadBlocker,a),this.onTileLoad("hires"),this.onTileUnload("hires"),this.events),this.hiresTileManager.scene.matrixWorldAutoUpdate=!1,this.lowresTileManager=[];for(let d=0;d{},a),this.onTileLoad("lowres"),this.onTileUnload("lowres"),this.events),this.lowresTileManager[d].scene.matrixWorldAutoUpdate=!1;alert(this.events,`Map '${this.data.id}' is loaded.`,"fine")})}loadSettings(e){return this.loadSettingsFile(e).then(t=>{this.data.name=t.name?t.name:this.data.name,this.data.sorting=Number.isInteger(t.sorting)?t.sorting:this.data.sorting,this.data.startPos={...this.data.startPos,...vecArrToObj(t.startPos,!0)},t.skyColor&&t.skyColor.length>=3&&this.data.skyColor.setRGB(t.skyColor[0],t.skyColor[1],t.skyColor[2]),t.voidColor&&t.voidColor.length>=3&&this.data.voidColor.setRGB(t.voidColor[0],t.voidColor[1],t.voidColor[2]),this.data.ambientLight=t.ambientLight?t.ambientLight:this.data.ambientLight,this.data.skyLight=t.skyLight?t.skyLight:this.data.skyLight,t.hires===void 0&&(t.hires={}),t.lowres===void 0&&(t.lowres={}),this.data.hires={tileSize:{...this.data.hires.tileSize,...vecArrToObj(t.hires.tileSize,!0)},scale:{...this.data.hires.scale,...vecArrToObj(t.hires.scale,!0)},translate:{...this.data.hires.translate,...vecArrToObj(t.hires.translate,!0)}},this.data.lowres={tileSize:{...this.data.lowres.tileSize,...vecArrToObj(t.lowres.tileSize,!0)},lodFactor:t.lowres.lodFactor!==void 0?t.lowres.lodFactor:this.data.lowres.lodFactor,lodCount:t.lowres.lodCount!==void 0?t.lowres.lodCount:this.data.lowres.lodCount},this.data.perspectiveView=t.perspectiveView!==void 0?t.perspectiveView:this.data.perspectiveView,this.data.flatView=t.flatView!==void 0?t.flatView:this.data.flatView,this.data.freeFlightView=t.freeFlightView!==void 0?t.freeFlightView:this.data.freeFlightView,this.data.views=[],this.data.perspectiveView&&this.data.views.push("perspective"),this.data.flatView&&this.data.views.push("flat"),this.data.freeFlightView&&this.data.views.push("free"),alert(this.events,`Settings for map '${this.data.id}' loaded.`,"fine")})}loadMapArea(e,t,i,r){if(!this.isLoaded)return;for(let c=this.lowresTileManager.length-1;c>=0;c--){const u=c+1,d=Math.pow(this.data.lowres.lodFactor,u-1),f=Math.floor(e/(this.data.lowres.tileSize.x*d)),m=Math.floor(t/(this.data.lowres.tileSize.z*d)),v=Math.floor(r/this.data.lowres.tileSize.x),_=Math.floor(r/this.data.lowres.tileSize.z);this.lowresTileManager[c].loadAroundTile(f,m,v,_)}const s=Math.floor((e-this.data.hires.translate.x)/this.data.hires.tileSize.x),a=Math.floor((t-this.data.hires.translate.z)/this.data.hires.tileSize.z),o=Math.floor(i/this.data.hires.tileSize.x),l=Math.floor(i/this.data.hires.tileSize.z);this.hiresTileManager.loadAroundTile(s,a,o,l)}loadSettingsFile(e){return new Promise((t,i)=>{alert(this.events,`Loading settings for map '${this.data.id}'...`,"fine");let r=new FileLoader$1;r.setResponseType("json"),r.load(this.data.settingsUrl+"?"+e,t,()=>{},()=>i(`Failed to load the settings.json for map: ${this.data.id}`))})}loadTexturesFile(e){return new Promise((t,i)=>{alert(this.events,`Loading textures for map '${this.data.id}'...`,"fine");let r=new FileLoader$1;r.setResponseType("json"),r.load(this.data.texturesUrl+"?"+e,t,()=>{},()=>i(`Failed to load the textures.json for map: ${this.data.id}`))})}createHiresMaterial(e,t,i,r){let s=[];if(!Array.isArray(r))throw new Error("Invalid texture.json: 'textures' is not an array!");for(let a=0;a{d.needsUpdate=!0,m&&m.init(d.image.naturalWidth,d.image.naturalHeight)}),this.loadedTextures.push(d);let v=new ShaderMaterial({uniforms:{...i,textureImage:{type:"t",value:d},...f},vertexShader:e,fragmentShader:t,transparent:u,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1});v.needsUpdate=!0,s[a]=v}return s}createLowresMaterial(e,t,i){return new ShaderMaterial({uniforms:i,vertexShader:e,fragmentShader:t,transparent:!1,depthWrite:!0,depthTest:!0,vertexColors:!0,side:FrontSide,wireframe:!1})}unload(){if(this.hiresTileManager&&this.hiresTileManager.unload(),this.hiresTileManager=null,this.lowresTileManager){for(let e=0;ee.dispose()),this.hiresMaterial=null,this.lowresMaterial&&this.lowresMaterial.dispose(),this.lowresMaterial=null,this.loadedTextures.forEach(e=>e.dispose()),this.loadedTextures=[],this.animations=[]}terrainHeightAt(e,t){var s,a,o;if(!this.isLoaded)return!1;this.raycaster.set(new Vector3(e,300,t),new Vector3(0,-1,0)),this.raycaster.near=1,this.raycaster.far=300,this.raycaster.layers.enableAll();let i=hashTile(Math.floor((e-this.data.hires.translate.x)/this.data.hires.tileSize.x),Math.floor((t-this.data.hires.translate.z)/this.data.hires.tileSize.z)),r=this.hiresTileManager.tiles.get(i);if(r!=null&&r.model)try{let l=this.raycaster.intersectObjects([r.model]);if(l.length>0)return l[0].point.y}catch{}for(let l=0;l=32768?-(65535-x):x}return!1}hasView(e){return this.data.views.some(t=>t===e)}dispose(){this.unload()}get isLoaded(){return!!(this.hiresMaterial&&this.lowresMaterial)}};class ControlsManager{constructor(e,t){Object.defineProperty(this,"isControlsManager",{value:!0}),this.data=reactive({mapViewer:null,camera:null,controls:null,position:new Vector3(0,0,0),rotation:0,angle:0,tilt:0}),this.mapViewer=e,this.camera=t,this.lastPosition=this.position.clone(),this.lastRotation=this.rotation,this.lastAngle=this.angle,this.lastDistance=this.distance,this.lastOrtho=this.ortho,this.lastTilt=this.tilt,this.lastMapUpdatePosition=null,this.lastMapUpdateDistance=null,this.averageDeltaTime=16,this._controls=null,this.distance=300,this.position.set(0,0,0),this.rotation=0,this.angle=0,this.tilt=0,this.ortho=0,this.updateCamera()}update(e,t){e>50&&(e=50),this.averageDeltaTime=this.averageDeltaTime*.9+e*.1,this._controls&&this._controls.update(this.averageDeltaTime,t),this.updateCamera()}updateCamera(){let e=this.isValueChanged();if(e){for(this.resetValueChanged();this.rotation>=Math.PI;)this.rotation-=Math.PI*2;for(;this.rotation<=-Math.PI;)this.rotation+=Math.PI*2;let t=this.angle;Math.abs(t)<=1e-4?t=1e-4:Math.abs(t)-Math.PI<=1e-4&&(t=t-1e-4);let i=this.distance;Math.abs(i)<=1e-4&&(i=1e-4),this.ortho>0&&(i=MathUtils.lerp(i,Math.max(i,300),Math.pow(this.ortho,8)));let r=new Vector3(Math.sin(this.rotation),0,-Math.cos(this.rotation)),s=new Vector3(0,1,0).cross(r);if(r.applyAxisAngle(s,Math.PI/2-t),r.multiplyScalar(i),this.camera.rotation.set(0,0,0),this.camera.position.copy(this.position).sub(r),this.camera.lookAt(this.position),this.camera.rotateZ(this.tilt+t<0?Math.PI:0),this.ortho<=0){let a=MathUtils.clamp(i/1e3,.01,1),o=MathUtils.clamp(i*2,Math.max(a+1,2e3),i+5e3);o-a>1e4&&(a=o-1e4),this.camera.near=a,this.camera.far=o}else this.angle===0?(this.camera.near=1,this.camera.far=i+300):(this.camera.near=1,this.camera.far=1e5);dispatchEvent(this.mapViewer.events,"bluemapCameraMoved",{controlsManager:this,camera:this.camera})}if(this.mapViewer.map){let t=1;e&&(this.distance>300?t=this.mapViewer.data.loadedLowresViewDistance*.5:t=this.mapViewer.data.loadedHiresViewDistance*.5),(this.lastMapUpdatePosition===null||this.lastMapUpdateDistance===null||Math.abs(this.lastMapUpdatePosition.x-this.position.x)>=t||Math.abs(this.lastMapUpdatePosition.z-this.position.z)>=t||this.distance<1e3&&this.lastMapUpdateDistance>=1e3)&&(this.lastMapUpdatePosition=this.position.clone(),this.lastMapUpdateDistance=this.distance,this.mapViewer.loadMapArea(this.position.x,this.position.z))}}handleMapInteraction(e,t={}){this.mapViewer.handleMapInteraction(e,t)}isValueChanged(){return!(this.data.position.equals(this.lastPosition)&&this.data.rotation===this.lastRotation&&this.data.angle===this.lastAngle&&this.distance===this.lastDistance&&this.ortho===this.lastOrtho&&this.data.tilt===this.lastTilt)}resetValueChanged(){this.lastPosition.copy(this.data.position),this.lastRotation=this.data.rotation,this.lastAngle=this.data.angle,this.lastDistance=this.distance,this.lastOrtho=this.ortho,this.lastTilt=this.data.tilt}get ortho(){return this.camera.ortho}set ortho(e){this.camera.ortho=e}get distance(){return this.camera.distance}set distance(e){this.camera.distance=e}set controls(e){this._controls&&this._controls.stop&&this._controls.stop(),this._controls=e,e&&(this.data.controls=e.data||null),this._controls&&this._controls.start&&this._controls.start(this)}get controls(){return this._controls}get mapViewer(){return this._mapViewer}set mapViewer(e){this._mapViewer=e,this.data.mapViewer=e.data}get camera(){return this._camera}set camera(e){this._camera=e,this.data.camera=e.data}get position(){return this.data.position}set position(e){this.data.position=e}get rotation(){return this.data.rotation}set rotation(e){this.data.rotation=e}get angle(){return this.data.angle}set angle(e){this.data.angle=e}get tilt(){return this.data.tilt}set tilt(e){this.data.tilt=e}}const HIRES_FRAGMENT_SHADER=` +${ShaderChunk.logdepthbuf_pars_fragment} + +#ifndef texture + #define texture texture2D +#endif + +uniform float distance; +uniform sampler2D textureImage; +uniform float sunlightStrength; +uniform float ambientLight; +uniform float animationFrameHeight; +uniform float animationFrameIndex; +uniform float animationInterpolationFrameIndex; +uniform float animationInterpolation; +uniform bool chunkBorders; + +varying vec3 vPosition; +varying vec3 vWorldPosition; +varying vec3 vNormal; +varying vec2 vUv; +varying vec3 vColor; +varying float vAo; +varying float vSunlight; +varying float vBlocklight; +//varying float vDistance; + +void main() { + + vec4 color = texture(textureImage, vec2(vUv.x, animationFrameHeight * (vUv.y + animationFrameIndex))); + if (animationInterpolation > 0.0) { + color = mix(color, texture(textureImage, vec2(vUv.x, animationFrameHeight * (vUv.y + animationInterpolationFrameIndex))), animationInterpolation); + } + + if (color.a <= 0.01) discard; + + //apply vertex-color + color.rgb *= vColor.rgb; + + //apply ao + color.rgb *= vAo; + + //apply light + float light = mix(vBlocklight, max(vSunlight, vBlocklight), sunlightStrength); + color.rgb *= mix(ambientLight, 1.0, light / 15.0); + + if (chunkBorders) { + vec4 lineColour = vec4(1.0, 0.0, 1.0, 0.4); + float lineInterval = 16.0; + float lineThickness = 0.125; //width of two Minecraft pixels + float offset = 0.5; + + vec2 worldPos = vWorldPosition.xz; + worldPos += offset; + float x = abs(mod(worldPos.x, lineInterval) - offset); + float y = abs(mod(worldPos.y, lineInterval) - offset); + bool isChunkBorder = x < lineThickness || y < lineThickness; + + //only show line on upwards facing surfaces + bool showChunkBorder = isChunkBorder && vNormal.y > 0.1; + + float distFac = smoothstep(200.0, 600.0, distance); + color.rgb = mix(mix(color.rgb, lineColour.rgb, float(showChunkBorder) * lineColour.a), color.rgb, distFac); + } + + gl_FragColor = color; + + ${ShaderChunk.logdepthbuf_fragment} +} +`,HIRES_VERTEX_SHADER=` +#include +${ShaderChunk.logdepthbuf_pars_vertex} + +const vec2 lightDirection = normalize(vec2(1.0, 0.5)); + +uniform float distance; + +attribute float ao; +attribute float sunlight; +attribute float blocklight; + +varying vec3 vPosition; +varying vec3 vWorldPosition; +varying vec3 vNormal; +varying vec2 vUv; +varying vec3 vColor; +varying float vAo; +varying float vSunlight; +varying float vBlocklight; + +void main() { + vPosition = position; + vec4 worldPos = modelMatrix * vec4(vPosition, 1); + vWorldPosition = worldPos.xyz; + vNormal = normal; + vUv = uv; + vColor = color; + vAo = ao; + vSunlight = sunlight; + vBlocklight = blocklight; + + // apply directional lighting + if (vNormal.y != 0.0 || abs(abs(vNormal.x) - abs(vNormal.z)) != 0.0) { + float distFac = smoothstep(1000.0, 50.0, distance); + vAo *= 1.0 - abs(dot(vNormal.xz, lightDirection)) * 0.4 * distFac; + vAo *= 1.0 - max(0.0, -vNormal.y) * 0.6 * distFac; + } + + gl_Position = projectionMatrix * (viewMatrix * modelMatrix * vec4(position, 1)); + + ${ShaderChunk.logdepthbuf_vertex} +} +`,LOWRES_FRAGMENT_SHADER=` +${ShaderChunk.logdepthbuf_pars_fragment} + +#define PI 3.1415926535897932 + +#ifndef texture + #define texture texture2D +#endif + +struct TileMap { + sampler2D map; + float size; + vec2 scale; + vec2 translate; + vec2 pos; +}; + +uniform float distance; +uniform float sunlightStrength; +uniform float ambientLight; +uniform TileMap hiresTileMap; +uniform sampler2D textureImage; +uniform vec2 tileSize; +uniform vec2 textureSize; +uniform float lod; +uniform float lodScale; +uniform vec3 voidColor; +uniform bool chunkBorders; + +varying vec3 vPosition; +varying vec3 vWorldPosition; +//varying float vDistance; + +float metaToHeight(vec4 meta) { + float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0; + if (heightUnsigned >= 32768.0) { + return -(65535.0 - heightUnsigned); + } else { + return heightUnsigned; + } +} + +float metaToLight(vec4 meta) { + return meta.r * 255.0; +} + +vec2 posToColorUV(vec2 pos) { + return vec2(pos.x / textureSize.x, min(pos.y, tileSize.y) / textureSize.y); +} + +vec2 posToMetaUV(vec2 pos) { + return vec2(pos.x / textureSize.x, pos.y / textureSize.y + 0.5); +} + +vec3 adjustColor(vec3 color) { + return vec3(color * max(sunlightStrength * sunlightStrength, ambientLight)); +} + +void main() { + //discard if hires tile is loaded at that position + if (distance < 1000.0 && texture(hiresTileMap.map, ((vWorldPosition.xz - hiresTileMap.translate) / hiresTileMap.scale - hiresTileMap.pos) / hiresTileMap.size + 0.5).r > 0.75) discard; + + vec4 color = texture(textureImage, posToColorUV(vPosition.xz)); + + vec4 meta = texture(textureImage, posToMetaUV(vPosition.xz)); + + float height = metaToHeight(meta); + + float heightX = metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(1.0, 0.0)))); + float heightZ = metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(0.0, 1.0)))); + float heightDiff = ((height - heightX) + (height - heightZ)) / lodScale; + float shade = clamp(heightDiff * 0.06, -0.2, 0.04); + + float ao = 0.0; + float aoStrength = 0.0; + float distFac = smoothstep(200.0, 600.0, distance); + if(lod == 1.0) { + aoStrength = smoothstep(PI - 0.8, PI - 0.2, acos(-clamp(viewMatrix[1][2], 0.0, 1.0))); + aoStrength *= 1.0 - distFac; + + if (aoStrength > 0.0) { + const float r = 3.0; + const float step = 0.2; + const float o = step / r * 0.1; + for (float vx = -r; vx <= r; vx++) { + for (float vz = -r; vz <= r; vz++) { + heightDiff = height - metaToHeight(texture(textureImage, posToMetaUV(vPosition.xz + vec2(vx * step, vz * step)))); + if (heightDiff < 0.0) { + ao -= o; + } + } + } + } + } + + color.rgb += mix(shade, shade * 0.3 + ao, aoStrength); + + float blockLight = metaToLight(meta); + float light = mix(blockLight, 15.0, sunlightStrength); + color.rgb *= mix(ambientLight, 1.0, light / 15.0); + + if (chunkBorders) { + vec4 lineColour = vec4(1.0, 0.0, 1.0, 0.4); + float lineInterval = 16.0; + float lineThickness = 0.125; //width of two Minecraft pixels + float offset = 0.5; + + vec2 worldPos = vWorldPosition.xz; + worldPos += offset; + float x = abs(mod(worldPos.x, lineInterval) - offset); + float y = abs(mod(worldPos.y, lineInterval) - offset); + bool isChunkBorder = x < lineThickness || y < lineThickness; + + color.rgb = mix(mix(color.rgb, lineColour.rgb, float(isChunkBorder) * lineColour.a), color.rgb, distFac); + } + + vec3 adjustedVoidColor = adjustColor(voidColor); + //where there's transparency, there is void that needs to be coloured + color.rgb = mix(adjustedVoidColor, color.rgb, color.a); + color.a = 1.0; //but don't actually display the transparency + + gl_FragColor = color; + + ${ShaderChunk.logdepthbuf_fragment} +} + +`,LOWRES_VERTEX_SHADER=` +#include +${ShaderChunk.logdepthbuf_pars_vertex} + +uniform sampler2D textureImage; +uniform vec2 tileSize; +uniform vec2 textureSize; + +varying vec3 vPosition; +varying vec3 vWorldPosition; +//varying float vDistance; + +float metaToHeight(vec4 meta) { + float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0; + if (heightUnsigned >= 32768.0) { + return -(65535.0 - heightUnsigned); + } else { + return heightUnsigned; + } +} + +vec2 posToMetaUV(vec2 pos) { + return vec2(pos.x / textureSize.x, pos.y / textureSize.y + 0.5); +} + +void main() { + vPosition = position; + + vec4 meta = texture(textureImage, posToMetaUV(position.xz)); + vPosition.y = metaToHeight(meta) + 1.0 - position.x * 0.0001 - position.z * 0.0002; //including small offset-tilt to prevent z-fighting + + vec4 worldPos = modelMatrix * vec4(vPosition, 1); + vec4 viewPos = viewMatrix * worldPos; + + vWorldPosition = worldPos.xyz; + //vDistance = -viewPos.z; + + gl_Position = projectionMatrix * viewPos; + + ${ShaderChunk.logdepthbuf_vertex} +} + +`;UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ShaderLib.line={uniforms:UniformsUtils.merge([UniformsLib.common,UniformsLib.fog,UniformsLib.line]),vertexShader:` + #include + #include + #include + #include + #include + + uniform float linewidth; + uniform vec2 resolution; + + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #ifdef USE_DASH + + uniform float dashScale; + attribute float instanceDistanceStart; + attribute float instanceDistanceEnd; + varying float vLineDistance; + + #endif + + void trimSegment( const in vec4 start, inout vec4 end ) { + + // trim end segment so it terminates between the camera plane and the near plane + + // conservative estimate of the near plane + float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column + float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column + float nearEstimate = - 0.5 * b / a; + + float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); + + end.xyz = mix( start.xyz, end.xyz, alpha ); + + } + + void main() { + + #ifdef USE_COLOR + + vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; + + #endif + + #ifdef USE_DASH + + vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; + vUv = uv; + + #endif + + float aspect = resolution.x / resolution.y; + + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + + #ifdef WORLD_UNITS + + worldStart = start.xyz; + worldEnd = end.xyz; + + #else + + vUv = uv; + + #endif + + // special case for perspective projection, and segments that terminate either in, or behind, the camera plane + // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space + // but we need to perform ndc-space calculations in the shader, so we must address this issue directly + // perhaps there is a more elegant solution -- WestLangley + + bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column + + if ( perspective ) { + + if ( start.z < 0.0 && end.z >= 0.0 ) { + + trimSegment( start, end ); + + } else if ( end.z < 0.0 && start.z >= 0.0 ) { + + trimSegment( end, start ); + + } + + } + + // clip space + vec4 clipStart = projectionMatrix * start; + vec4 clipEnd = projectionMatrix * end; + + // ndc space + vec3 ndcStart = clipStart.xyz / clipStart.w; + vec3 ndcEnd = clipEnd.xyz / clipEnd.w; + + // direction + vec2 dir = ndcEnd.xy - ndcStart.xy; + + // account for clip-space aspect ratio + dir.x *= aspect; + dir = normalize( dir ); + + #ifdef WORLD_UNITS + + // get the offset direction as perpendicular to the view vector + vec3 worldDir = normalize( end.xyz - start.xyz ); + vec3 offset; + if ( position.y < 0.5 ) { + + offset = normalize( cross( start.xyz, worldDir ) ); + + } else { + + offset = normalize( cross( end.xyz, worldDir ) ); + + } + + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + + float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) ); + + // don't extend the line if we're rendering dashes because we + // won't be rendering the endcaps + #ifndef USE_DASH + + // extend the line bounds to encompass endcaps + start.xyz += - worldDir * linewidth * 0.5; + end.xyz += worldDir * linewidth * 0.5; + + // shift the position of the quad so it hugs the forward edge of the line + offset.xy -= dir * forwardOffset; + offset.z += 0.5; + + #endif + + // endcaps + if ( position.y > 1.0 || position.y < 0.0 ) { + + offset.xy += dir * 2.0 * forwardOffset; + + } + + // adjust for linewidth + offset *= linewidth * 0.5; + + // set the world position + worldPos = ( position.y < 0.5 ) ? start : end; + worldPos.xyz += offset; + + // project the worldpos + vec4 clip = projectionMatrix * worldPos; + + // shift the depth of the projected points so the line + // segments overlap neatly + vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; + clip.z = clipPose.z * clip.w; + + #else + + vec2 offset = vec2( dir.y, - dir.x ); + // undo aspect ratio adjustment + dir.x /= aspect; + offset.x /= aspect; + + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + + // endcaps + if ( position.y < 0.0 ) { + + offset += - dir; + + } else if ( position.y > 1.0 ) { + + offset += dir; + + } + + // adjust for linewidth + offset *= linewidth; + + // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... + offset /= resolution.y; + + // select end + vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; + + // back to clip space + offset *= clip.w; + + clip.xy += offset; + + #endif + + gl_Position = clip; + + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + + #include + #include + #include + + } + `,fragmentShader:` + uniform vec3 diffuse; + uniform float opacity; + uniform float linewidth; + + #ifdef USE_DASH + + uniform float dashOffset; + uniform float dashSize; + uniform float gapSize; + + #endif + + varying float vLineDistance; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #include + #include + #include + #include + #include + + vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { + + float mua; + float mub; + + vec3 p13 = p1 - p3; + vec3 p43 = p4 - p3; + + vec3 p21 = p2 - p1; + + float d1343 = dot( p13, p43 ); + float d4321 = dot( p43, p21 ); + float d1321 = dot( p13, p21 ); + float d4343 = dot( p43, p43 ); + float d2121 = dot( p21, p21 ); + + float denom = d2121 * d4343 - d4321 * d4321; + + float numer = d1343 * d4321 - d1321 * d4343; + + mua = numer / denom; + mua = clamp( mua, 0.0, 1.0 ); + mub = ( d1343 + d4321 * ( mua ) ) / d4343; + mub = clamp( mub, 0.0, 1.0 ); + + return vec2( mua, mub ); + + } + + void main() { + + #include + + #ifdef USE_DASH + + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + + if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + + #endif + + float alpha = opacity; + + #ifdef WORLD_UNITS + + // Find the closest points on the view ray and the line segment + vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; + vec3 lineDir = worldEnd - worldStart; + vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); + + vec3 p1 = worldStart + lineDir * params.x; + vec3 p2 = rayEnd * params.y; + vec3 delta = p1 - p2; + float len = length( delta ); + float norm = len / linewidth; + + #ifndef USE_DASH + + #ifdef USE_ALPHA_TO_COVERAGE + + float dnorm = fwidth( norm ); + alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); + + #else + + if ( norm > 0.5 ) { + + discard; + + } + + #endif + + #endif + + #else + + #ifdef USE_ALPHA_TO_COVERAGE + + // artifacts appear on some hardware if a derivative is taken within a conditional + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + float dlen = fwidth( len2 ); + + if ( abs( vUv.y ) > 1.0 ) { + + alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); + + } + + #else + + if ( abs( vUv.y ) > 1.0 ) { + + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + + if ( len2 > 1.0 ) discard; + + } + + #endif + + #endif + + vec4 diffuseColor = vec4( diffuse, alpha ); + + #include + #include + + gl_FragColor = vec4( diffuseColor.rgb, alpha ); + + #include + #include + #include + #include + + } + `};class LineMaterial extends ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:UniformsUtils.clone(ShaderLib.line.uniforms),vertexShader:ShaderLib.line.vertexShader,fragmentShader:ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const MARKER_FILL_VERTEX_SHADER=` +#include +${ShaderChunk.logdepthbuf_pars_vertex} + +varying vec3 vPosition; +//varying vec3 vWorldPosition; +//varying vec3 vNormal; +//varying vec2 vUv; +//varying vec3 vColor; +varying float vDistance; + +void main() { + vec4 worldPos = modelMatrix * vec4(position, 1); + vec4 viewPos = viewMatrix * worldPos; + + vPosition = position; + //vWorldPosition = worldPos.xyz; + //vNormal = normal; + //vUv = uv; + //vColor = vec3(1.0); + vDistance = -viewPos.z; + + gl_Position = projectionMatrix * viewPos; + + ${ShaderChunk.logdepthbuf_vertex} +} +`,MARKER_FILL_FRAGMENT_SHADER=` +${ShaderChunk.logdepthbuf_pars_fragment} + +#define FLT_MAX 3.402823466e+38 + +varying vec3 vPosition; +//varying vec3 vWorldPosition; +//varying vec3 vNormal; +//varying vec2 vUv; +//varying vec3 vColor; +varying float vDistance; + +uniform vec3 markerColor; +uniform float markerOpacity; + +uniform float fadeDistanceMax; +uniform float fadeDistanceMin; + +void main() { + vec4 color = vec4(markerColor, markerOpacity); + + // distance fading + float fdMax = FLT_MAX; + if ( fadeDistanceMax > 0.0 ) fdMax = fadeDistanceMax; + + float minDelta = (vDistance - fadeDistanceMin) / fadeDistanceMin; + float maxDelta = (vDistance - fadeDistanceMax) / (fadeDistanceMax * 0.5); + float distanceOpacity = min( + clamp(minDelta, 0.0, 1.0), + 1.0 - clamp(maxDelta + 1.0, 0.0, 1.0) + ); + + color.a *= distanceOpacity; + + // apply vertex-color + //color.rgb *= vColor.rgb; + + gl_FragColor = color; + + ${ShaderChunk.logdepthbuf_fragment} +} +`,_box$1=new Box3,_vector=new Vector3;class LineSegmentsGeometry extends InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Float32BufferAttribute(e,3)),this.setAttribute("uv",new Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),_box$1.setFromBufferAttribute(t),this.boundingBox.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let s=0,a=e.count;su&&_end4.z>u)continue;if(_start4.z>u){const S=_start4.z-_end4.z,y=(_start4.z-u)/S;_start4.lerp(_end4,y)}else if(_end4.z>u){const S=_end4.z-_start4.z,y=(_end4.z-u)/S;_end4.lerp(_start4,y)}_start4.applyMatrix4(i),_end4.applyMatrix4(i),_start4.multiplyScalar(1/_start4.w),_end4.multiplyScalar(1/_end4.w),_start4.x*=s.x/2,_start4.y*=s.y/2,_end4.x*=s.x/2,_end4.y*=s.y/2,_line.start.copy(_start4),_line.start.z=0,_line.end.copy(_end4),_line.end.z=0;const v=_line.closestPointToPointParameter(_ssOrigin3,!0);_line.at(v,_closestPoint);const _=MathUtils.lerp(_start4.z,_end4.z,v),g=_>=-1&&_<=1,x=_ssOrigin3.distanceTo(_closestPoint)<_lineWidth*.5;if(g&&x){_line.start.fromBufferAttribute(l,d),_line.end.fromBufferAttribute(c,d),_line.start.applyMatrix4(a),_line.end.applyMatrix4(a);const S=new Vector3,y=new Vector3;_ray.distanceSqToSegment(_line.start,_line.end,y,S),t.push({point:y,pointOnLine:S,distance:_ray.origin.distanceTo(y),object:n,face:null,faceIndex:d,uv:null,uv2:null})}}}class LineSegments2 extends Mesh{constructor(e=new LineSegmentsGeometry,t=new LineMaterial({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a{let a=!1,o=Date.now();o-i<500&&(a=!0),i=o;let l={doubleTap:a};this.onClick({event:s,data:l})?(s.preventDefault(),s.stopPropagation()):dispatchEvent(this.events,"bluemapMapInteraction",{data:l,object:this})};this.element.addEventListener("click",r),this.element.addEventListener("touch",r)}}var CSS2DRenderer=function(n=null){var e=this,t,i,r,s,a=new Vector3,o=new Matrix4,l=new Matrix4,c={objects:new WeakMap},u=document.createElement("div");u.style.overflow="hidden",this.domElement=u,this.events=n,this.getSize=function(){return{width:t,height:i}},this.setSize=function(_,g){t=_,i=g,r=t/2,s=i/2,u.style.width=_+"px",u.style.height=g+"px"};var d=function(_,g,x,S){if(_ instanceof CSS2DObject){_.events=e.events,_.onBeforeRender(e,g,x),a.setFromMatrixPosition(_.matrixWorld),a.applyMatrix4(l);var y=_.element,b="translate("+(a.x*r+r-_.anchor.x)+"px,"+(-a.y*s+s-_.anchor.y)+"px)";y.style.WebkitTransform=b,y.style.MozTransform=b,y.style.oTransform=b,y.style.transform=b,y.style.display=S&&_.visible&&a.z>=-1&&a.z<=1&&y.style.opacity!=="0"?"":"none";var w={distanceToCameraSquared:f(x,_)};c.objects.set(_,w),y.parentNode!==u&&u.appendChild(y),_.onAfterRender(e,g,x)}for(var C=0,R=_.children.length;C${e}`))}open(e=!0){let t=this.element.style.opacity||1;this.element.style.opacity=0;let i=animate(r=>{this.element.style.opacity=(r*t).toString()},300);if(e){let r=s=>{s.composedPath().includes(this.element)||(i.cancel(),this.close(),window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r),window.removeEventListener("keydown",r),window.removeEventListener("mousewheel",r))};window.setTimeout(()=>{window.addEventListener("mousedown",r),window.addEventListener("touchstart",r,{passive:!0}),window.addEventListener("keydown",r),window.addEventListener("mousewheel",r)},100)}}close(e=!0){let t=parseFloat(this.element.style.opacity);animate(i=>{this.element.style.opacity=(t-i*t).toString()},300,i=>{e&&i&&this.parent&&this.parent.remove(this)})}}const lineShader={uniforms:UniformsUtils.merge([UniformsLib.common,UniformsLib.fog,UniformsLib.line]),vertexShader:` + #include + #include + #include + #include + #include + + uniform float linewidth; + uniform vec2 resolution; + + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + + varying vec2 vUv; + + varying float vDistance; + + #ifdef USE_DASH + + uniform float dashScale; + attribute float instanceDistanceStart; + attribute float instanceDistanceEnd; + varying float vLineDistance; + + #endif + + void trimSegment( const in vec4 start, inout vec4 end ) { + + // trim end segment so it terminates between the camera plane and the near plane + + // conservative estimate of the near plane + float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column + float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column + float nearEstimate = - 0.5 * b / a; + + float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); + + end.xyz = mix( start.xyz, end.xyz, alpha ); + + } + + void main() { + + #ifdef USE_COLOR + + vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; + + #endif + + #ifdef USE_DASH + + vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; + + #endif + + float aspect = resolution.x / resolution.y; + + vUv = uv; + + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + + // special case for perspective projection, and segments that terminate either in, or behind, the camera plane + // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space + // but we need to perform ndc-space calculations in the shader, so we must address this issue directly + // perhaps there is a more elegant solution -- WestLangley + + bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column + + if ( perspective ) { + + if ( start.z < 0.0 && end.z >= 0.0 ) { + + trimSegment( start, end ); + + } else if ( end.z < 0.0 && start.z >= 0.0 ) { + + trimSegment( end, start ); + + } + + } + + // clip space + vec4 clipStart = projectionMatrix * start; + vec4 clipEnd = projectionMatrix * end; + + // ndc space + vec2 ndcStart = clipStart.xy / clipStart.w; + vec2 ndcEnd = clipEnd.xy / clipEnd.w; + + // direction + vec2 dir = ndcEnd - ndcStart; + + // account for clip-space aspect ratio + dir.x *= aspect; + dir = normalize( dir ); + + // perpendicular to dir + vec2 offset = vec2( dir.y, - dir.x ); + + // undo aspect ratio adjustment + dir.x /= aspect; + offset.x /= aspect; + + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + + // endcaps + if ( position.y < 0.0 ) { + + offset += - dir; + + } else if ( position.y > 1.0 ) { + + offset += dir; + + } + + // adjust for linewidth + offset *= linewidth; + + // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... + offset /= resolution.y; + + // select end + vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; + + // back to clip space + offset *= clip.w; + + clip.xy += offset; + + gl_Position = clip; + + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + + vDistance = -mvPosition.z; + + #include + #include + #include + + } + `,fragmentShader:` + #define FLT_MAX 3.402823466e+38 + + uniform vec3 diffuse; + uniform float opacity; + + uniform float fadeDistanceMax; + uniform float fadeDistanceMin; + + #ifdef USE_DASH + + uniform float dashSize; + uniform float gapSize; + + #endif + + varying float vLineDistance; + + #include + #include + #include + #include + #include + + varying vec2 vUv; + + varying float vDistance; + + void main() { + + #include + + #ifdef USE_DASH + + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + + if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + + #endif + + if ( abs( vUv.y ) > 1.0 ) { + + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + + if ( len2 > 1.0 ) discard; + + } + + // distance fading + float fdMax = FLT_MAX; + if ( fadeDistanceMax > 0.0 ) fdMax = fadeDistanceMax; + + float minDelta = (vDistance - fadeDistanceMin) / fadeDistanceMin; + float maxDelta = (vDistance - fadeDistanceMax) / (fadeDistanceMax * 0.5); + float distanceOpacity = min( + clamp(minDelta, 0.0, 1.0), + 1.0 - clamp(maxDelta + 1.0, 0.0, 1.0) + ); + + vec4 diffuseColor = vec4( diffuse, opacity * distanceOpacity ); + + #include + #include + + gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a ); + + #include + #include + #include + #include + + } + `};class ExtrudeMarker extends ObjectMarker{constructor(e){super(e),Object.defineProperty(this,"isExtrudeMarker",{value:!0}),this.data.type="extrude";let t=new Vector2,i=new Shape([t,t,t]);this.fill=new ExtrudeMarkerFill(i),this.border=new ExtrudeMarkerBorder(i),this.border.renderOrder=-1,this.add(this.border,this.fill),this._markerData={}}setShapeY(e,t){let i=t-this.position.y,r=t-e;this.fill.position.y=i,this.border.position.y=i,this.fill.scale.y=r,this.border.scale.y=r}setShape(e){this.fill.updateGeometry(e),this.border.updateGeometry(e)}updateFromData(e){super.updateFromData(e),(!this._markerData.shape||!deepEquals(e.shape,this._markerData.shape)||!this._markerData.holes||!deepEquals(e.holes,this._markerData.holes)||!this._markerData.position||!deepEquals(e.position,this._markerData.position))&&this.setShape(this.createShapeWithHolesFromData(e.shape,e.holes)),this.setShapeY((e.shapeMinY||0)-.01,(e.shapeMaxY||0)+.01),this.border.depthTest=!!e.depthTest,this.fill.depthTest=!!e.depthTest,this.border.linewidth=e.lineWidth!==void 0?e.lineWidth:2;let t=e.lineColor||{};this.border.color.setRGB((t.r||0)/255,(t.g||0)/255,(t.b||0)/255),this.border.opacity=t.a||0;let i=e.fillColor||{};this.fill.color.setRGB((i.r||0)/255,(i.g||0)/255,(i.b||0)/255),this.fill.opacity=i.a||0;let r=e.minDistance||0,s=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE;this.border.fadeDistanceMin=r,this.border.fadeDistanceMax=s,this.fill.fadeDistanceMin=r,this.fill.fadeDistanceMax=s,this._markerData=e}dispose(){super.dispose(),this.fill.dispose(),this.border.dispose()}createShapeFromData(e){let t=[];return Array.isArray(e)?(e.forEach(i=>{let r=(i.x||0)-this.position.x+.01,s=(i.z||0)-this.position.z+.01;t.push(new Vector2(r,s))}),new Shape(t)):!1}createShapeWithHolesFromData(e,t){const i=this.createShapeFromData(e);return i&&Array.isArray(t)&&t.forEach(r=>{const s=this.createShapeFromData(r);s&&i.holes.push(s)}),i}}class ExtrudeMarkerFill extends Mesh{constructor(e){let t=ExtrudeMarkerFill.createGeometry(e),i=new ShaderMaterial({vertexShader:MARKER_FILL_VERTEX_SHADER,fragmentShader:MARKER_FILL_FRAGMENT_SHADER,side:DoubleSide,depthTest:!0,transparent:!0,uniforms:{markerColor:{value:new Color},markerOpacity:{value:0},fadeDistanceMin:{value:0},fadeDistanceMax:{value:Number.MAX_VALUE}}});super(t,i)}get color(){return this.material.uniforms.markerColor.value}get opacity(){return this.material.uniforms.markerOpacity.value}set opacity(e){this.material.uniforms.markerOpacity.value=e,this.visible=e>0}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distancet.push(...this.convertPoints(i))),t}static convertPoints(e){let t=[];e.push(e[0]);let i=null;return e.forEach(r=>{t.push(r.x,0,r.y),t.push(r.x,-1,r.y),i&&(t.push(i.x,0,i.y),t.push(r.x,0,r.y),t.push(i.x,-1,i.y),t.push(r.x,-1,r.y)),i=r}),t}}class HtmlMarker extends Marker{constructor(e){super(e),Object.defineProperty(this,"isHtmlMarker",{value:!0}),this.data.type="html",this.data.label=null,this.data.classes=[],this.elementObject=new CSS2DObject(htmlToElement(`
`)),this.elementObject.onBeforeRender=(t,i,r)=>this.onBeforeRender(t,i,r),this.fadeDistanceMin=0,this.fadeDistanceMax=Number.MAX_VALUE,this.addEventListener("removed",()=>{var t;(t=this.element)!=null&&t.parentNode&&this.element.parentNode.removeChild(this.element)}),this.add(this.elementObject)}onBeforeRender(e,t,i){this.fadeDistanceMax===Number.MAX_VALUE&&this.fadeDistanceMin<=0?this.element.parentNode.style.opacity=void 0:this.element.parentNode.style.opacity=Marker.calculateDistanceOpacity(this.position,i,this.fadeDistanceMin,this.fadeDistanceMax).toString()}get html(){return this.element.innerHTML}set html(e){this.element.innerHTML=e}get anchor(){return this.elementObject.anchor}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}updateFromData(e){let t=e.position||{};this.position.setX(t.x||0),this.position.setY(t.y||0),this.position.setZ(t.z||0),this.data.label!==e.label&&(this.data.label=e.label||null),this.data.sorting!==e.sorting&&(this.data.sorting=e.sorting||0),this.data.listed!==e.listed&&(this.data.listed=e.listed===void 0?!0:e.listed);let i=e.anchor||{};this.anchor.setX(i.x||0),this.anchor.setY(i.y||0),this.element.innerHTML!==e.html&&(this.element.innerHTML=e.html),this.data.classes!==e.classes&&(this.data.classes=e.classes,this.element.classList.value=`bm-marker-${this.data.type}`,this.element.classList.add(...e.classes)),this.fadeDistanceMin=e.minDistance||0,this.fadeDistanceMax=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE}dispose(){super.dispose(),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class LineMarker extends ObjectMarker{constructor(e){super(e),Object.defineProperty(this,"isLineMarker",{value:!0}),this.data.type="line",this.line=new LineMarkerLine([0,0,0]),this.add(this.line),this._markerData={}}setLine(e){let t;if((e.type==="Curve"||e.type==="CurvePath")&&(e=e.getPoints(5)),Array.isArray(e))e.length===0?t=[]:e[0].isVector3?(t=[],e.forEach(i=>{t.push(i.x,i.y,i.z)})):t=e;else throw new Error("Invalid argument type!");this.line.updateGeometry(t)}updateFromData(e){super.updateFromData(e),(!this._markerData.line||!deepEquals(e.line,this._markerData.line)||!this._markerData.position||!deepEquals(e.position,this._markerData.position))&&this.setLine(this.createPointsFromData(e.line)),this.line.depthTest=!!e.depthTest,this.line.linewidth=e.lineWidth!==void 0?e.lineWidth:2;let t=e.lineColor||{};this.line.color.setRGB((t.r||0)/255,(t.g||0)/255,(t.b||0)/255),this.line.opacity=t.a||0;let i=e.minDistance||0,r=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE;this.line.fadeDistanceMin=i,this.line.fadeDistanceMax=r,this._markerData=e}dispose(){super.dispose(),this.line.dispose()}createPointsFromData(e){let t=[];return Array.isArray(e)&&e.forEach(i=>{let r=(i.x||0)-this.position.x,s=(i.y||0)-this.position.y,a=(i.z||0)-this.position.z;t.push(r,s,a)}),t}}class LineMarkerLine extends Line2{constructor(e){let t=new LineGeometry;t.setPositions(e);let i=new LineMaterial({color:new Color,opacity:0,transparent:!0,linewidth:1,depthTest:!0,vertexColors:!1,dashed:!1,uniforms:UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader});i.uniforms.fadeDistanceMin={value:0},i.uniforms.fadeDistanceMax={value:Number.MAX_VALUE},i.resolution.set(window.innerWidth,window.innerHeight),super(t,i),this.computeLineDistances()}get color(){return this.material.color}get opacity(){return this.material.opacity}set opacity(e){this.material.opacity=e,this.visible=e>0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance{let r=(i.x||0)-this.position.x,s=(i.z||0)-this.position.z;t.push(new Vector2(r,s))}),new Shape(t)):!1}createShapeWithHolesFromData(e,t){const i=this.createShapeFromData(e);return i&&Array.isArray(t)&&t.forEach(r=>{const s=this.createShapeFromData(r);s&&i.holes.push(s)}),i}}class ShapeMarkerFill extends Mesh{constructor(e){let t=ShapeMarkerFill.createGeometry(e),i=new ShaderMaterial({vertexShader:MARKER_FILL_VERTEX_SHADER,fragmentShader:MARKER_FILL_FRAGMENT_SHADER,side:DoubleSide,depthTest:!0,transparent:!0,uniforms:{markerColor:{value:new Color},markerOpacity:{value:0},fadeDistanceMin:{value:0},fadeDistanceMax:{value:Number.MAX_VALUE}}});super(t,i)}get color(){return this.material.uniforms.markerColor.value}get opacity(){return this.material.uniforms.markerOpacity.value}set opacity(e){this.material.uniforms.markerOpacity.value=e,this.visible=e>0}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distance0}get linewidth(){return this.material.linewidth}set linewidth(e){this.material.linewidth=e}get depthTest(){return this.material.depthTest}set depthTest(e){this.material.depthTest=e}get fadeDistanceMin(){return this.material.uniforms.fadeDistanceMin.value}set fadeDistanceMin(e){this.material.uniforms.fadeDistanceMin.value=e}get fadeDistanceMax(){return this.material.uniforms.fadeDistanceMax.value}set fadeDistanceMax(e){this.material.uniforms.fadeDistanceMax.value=e}onClick(e){return e.intersection&&(e.intersection.distance>this.fadeDistanceMax||e.intersection.distancet.push(...this.convertPoints(i))),t}static convertPoints(e){e.push(e[0]);let t=[],i=null;return e.forEach(r=>{i&&(t.push(i.x,0,i.y),t.push(r.x,0,r.y)),i=r}),t}}class PoiMarker extends HtmlMarker{constructor(e){super(e),Object.defineProperty(this,"isPoiMarker",{value:!0}),this.data.type="poi",this.data.detail=null,this.html=`POI Icon (${this.data.id})
`,this.iconElement=this.element.getElementsByTagName("img").item(0),this.labelElement=this.element.getElementsByTagName("div").item(0),this._lastIcon=null}onClick(e){if(e.data.doubleTap)return!1;if(this.highlight||!this.data.label)return!0;this.highlight=!0;let t=i=>{i.composedPath().includes(this.element)||(this.highlight=!1,window.removeEventListener("mousedown",t),window.removeEventListener("touchstart",t),window.removeEventListener("keydown",t),window.removeEventListener("mousewheel",t))};return setTimeout(function(){window.addEventListener("mousedown",t),window.addEventListener("touchstart",t,{passive:!0}),window.addEventListener("keydown",t),window.addEventListener("mousewheel",t)},0),!0}set highlight(e){e?this.element.classList.add("bm-marker-highlight"):this.element.classList.remove("bm-marker-highlight")}get highlight(){return this.element.classList.contains("bm-marker-highlight")}updateFromData(e){let t=e.position||{};this.position.setX(t.x||0),this.position.setY(t.y||0),this.position.setZ(t.z||0);let i=e.anchor||e.iconAnchor||{};if(this.iconElement.style.transform=`translate(${-i.x}px, ${-i.y}px)`,this.data.label!==e.label&&(this.data.label=e.label||""),this.data.sorting!==e.sorting&&(this.data.sorting=e.sorting||0),this.data.listed!==e.listed&&(this.data.listed=e.listed===void 0?!0:e.listed),this.data.detail!==e.detail&&(this.data.detail=e.detail||this.data.label,this.labelElement.innerHTML=this.data.detail||""),this._lastIcon!==e.icon&&(this.iconElement.src=e.icon||"assets/poi.svg",this._lastIcon=e.icon),this.data.classes!==e.classes){this.data.classes=e.classes;let r=this.element.classList.contains("bm-marker-highlight");this.element.classList.value="bm-marker-html",r&&this.element.classList.add("bm-marker-highlight"),this.element.classList.add(...e.classes)}this.fadeDistanceMin=e.minDistance||0,this.fadeDistanceMax=e.maxDistance!==void 0?e.maxDistance:Number.MAX_VALUE}}class MarkerSet extends Scene{constructor(e,t=null){if(super(),Object.defineProperty(this,"isMarkerSet",{value:!0}),this.markerSets=new Map,this.markers=new Map,this.data=reactive({id:e,label:e,toggleable:!0,defaultHide:!1,sorting:0,markerSets:[],markers:[],visible:this.visible,get listed(){return this.toggleable||this.markers.filter(i=>i.listed).length>0||this.markerSets.filter(i=>i.listed).length>0},saveState:()=>{setLocalStorage(this.localStorageKey("visible"),this.visible)}}),Object.defineProperty(this,"visible",{get(){return this.data.visible},set(i){this.data.visible=i}}),t&&this.updateFromData(t),this.data.toggleable){let i=getLocalStorage(this.localStorageKey("visible"));i!==void 0?this.visible=!!i:this.data.defaultHide&&(this.visible=!1)}}updateFromData(e){this.data.label=e.label||this.data.id,this.data.toggleable=!!e.toggleable,this.data.defaultHide=!!e.defaultHidden,this.data.sorting=e.sorting||this.data.sorting,this.updateMarkerSetsFromData(e.markerSets),this.updateMarkersFromData(e.markers)}updateMarkerSetsFromData(e={},t=[]){let i=new Set(t);Object.keys(e).forEach(r=>{if(i.has(r))return;i.add(r);let s=e[r];try{this.updateMarkerSetFromData(r,s)}catch(a){alert(this.events,a,"fine")}}),this.markerSets.forEach((r,s)=>{i.has(s)||this.remove(r)})}updateMarkerSetFromData(e,t){let i=this.markerSets.get(e);i?i.updateFromData(t):(i=new MarkerSet(e,t),this.add(i))}updateMarkersFromData(e={},t=[]){let i=new Set(t);Object.keys(e).forEach(r=>{if(i.has(r))return;let s=e[r];try{this.updateMarkerFromData(r,s),i.add(r)}catch(a){alert(this.events,a,"fine"),console.debug(a)}}),this.markers.forEach((r,s)=>{i.has(s)||this.remove(r)})}updateMarkerFromData(e,t){if(!t.type)throw new Error("marker-data has no type!");let i=this.markers.get(e);if(!i||i.data.type!==t.type){switch(i&&this.remove(i),t.type){case"shape":i=new ShapeMarker(e);break;case"extrude":i=new ExtrudeMarker(e);break;case"line":i=new LineMarker(e);break;case"html":i=new HtmlMarker(e);break;case"poi":i=new PoiMarker(e);break;default:throw new Error(`Unknown marker-type: '${t.type}'`)}this.add(i)}i.updateFromData(t)}clear(){[...this.markerSets.values()].forEach(e=>this.remove(e)),[...this.markers.values()].forEach(e=>this.remove(e))}add(...e){if(e.length===1){let t=e[0];t.isMarkerSet&&!this.markerSets.has(t.data.id)&&(this.markerSets.set(t.data.id,t),this.data.markerSets.push(t.data)),t.isMarker&&!this.markers.has(t.data.id)&&(this.markers.set(t.data.id,t),this.data.markers.push(t.data))}return super.add(...e)}remove(...e){if(e.length===1){let t=e[0];if(t.isMarkerSet){let i=this.data.markerSets.indexOf(t.data);i>-1&&this.data.markerSets.splice(i,1),this.markerSets.delete(t.data.id),t.dispose()}if(t.isMarker){let i=this.data.markers.indexOf(t.data);i>-1&&this.data.markers.splice(i,1),this.markers.delete(t.data.id),t.dispose()}}return super.remove(...e)}dispose(){this.children.forEach(e=>{e.dispose&&e.dispose()})}localStorageKey(e){return"bluemap-markerset-"+encodeURIComponent(this.data.id)+"-"+e}}class MarkerManager{constructor(e,t,i=null){Object.defineProperty(this,"isMarkerManager",{value:!0}),this.root=e,this.fileUrl=t,this.events=i,this.disposed=!1,this._updateInterval=null}setAutoUpdateInterval(e){if(this._updateInterval&&clearTimeout(this._updateInterval),e>0){let t=()=>{this.disposed||this.update().then(i=>{i?this._updateInterval=setTimeout(t,e):this._updateInterval=setTimeout(t,Math.max(e,15e3))}).catch(i=>{alert(this.events,i,"warning"),this._updateInterval=setTimeout(t,Math.max(e,15e3))})};this._updateInterval=setTimeout(t,e)}}update(){return this.loadMarkerFile().then(e=>this.updateFromData(e)).catch(()=>this.clear())}updateFromData(e){}dispose(){this.disposed=!0,this.setAutoUpdateInterval(0),this.clear()}clear(){this.root.clear()}loadMarkerFile(){return new Promise((e,t)=>{let i=new FileLoader$1;i.setResponseType("json"),i.load(this.fileUrl+"?"+generateCacheHash(),r=>{r?e(r):t(`Failed to parse '${this.fileUrl}'!`)},()=>{},()=>t(`Failed to load '${this.fileUrl}'!`))})}}class PlayerMarker extends Marker{constructor(e,t,i="assets/steve.png"){super(e),Object.defineProperty(this,"isPlayerMarker",{value:!0}),this.data.type="player",this.data.playerUuid=t,this.data.name=t,this.data.playerHead=i,this.data.rotation={pitch:0,yaw:0},this.elementObject=new CSS2DObject(htmlToElement(` +
+ playerhead +
+
+ `)),this.elementObject.onBeforeRender=(r,s,a)=>this.onBeforeRender(r,s,a),this.playerHeadElement=this.element.getElementsByTagName("img")[0],this.playerNameElement=this.element.getElementsByTagName("div")[0],this.addEventListener("removed",()=>{this.element.parentNode&&this.element.parentNode.removeChild(this.element)}),this.playerHeadElement.addEventListener("error",()=>{this.playerHeadElement.src="assets/steve.png"},{once:!0}),this.add(this.elementObject)}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}onBeforeRender(e,t,i){let r=Marker.calculateDistanceToCameraPlane(this.position,i),s="near";r>1e3&&(s="med"),r>5e3&&(s="far"),this.element.setAttribute("distance-data",s)}updateFromData(e){let t=e.position||{},i=e.rotation||{};if(!this.position.x&&!this.position.y&&!this.position.z)this.position.set(t.x||0,(t.y||0)+1.8,t.z||0),this.data.rotation.pitch=i.pitch||0,this.data.rotation.yaw=i.yaw||0;else{let s={x:this.position.x,y:this.position.y,z:this.position.z,pitch:this.data.rotation.pitch,yaw:this.data.rotation.yaw},a={x:(t.x||0)-s.x,y:(t.y||0)+1.8-s.y,z:(t.z||0)-s.z,pitch:(i.pitch||0)-s.pitch,yaw:(i.yaw||0)-s.yaw};for(;a.yaw>180;)a.yaw-=360;for(;a.yaw<-180;)a.yaw+=360;(a.x||a.y||a.z||a.pitch||a.yaw)&&animate(o=>{let l=EasingFunctions.easeInOutCubic(o);this.position.set(s.x+a.x*l||0,s.y+a.y*l||0,s.z+a.z*l||0),this.data.rotation.pitch=s.pitch+a.pitch*l||0,this.data.rotation.yaw=s.yaw+a.yaw*l||0},1e3)}let r=e.name||this.data.playerUuid;this.data.name=r,this.playerNameElement.innerHTML!==r&&(this.playerNameElement.innerHTML=r),this.data.foreign=e.foreign}dispose(){super.dispose();let e=this.elementObject.element;e.parentNode&&e.parentNode.removeChild(e)}}class PlayerMarkerSet extends MarkerSet{constructor(e,t,i=null){super(e,i),this.data.label="Player",this.data.toggleable=!0,this.data.defaultHide=!1,this.data.playerheadsUrl=t}updateFromPlayerData(e){if(!Array.isArray(e.players))return this.clear(),!1;let t=new Set;return e.players.forEach(i=>{try{let r=this.updatePlayerMarkerFromData(i);t.add(r)}catch(r){alert(this.events,r,"fine")}}),this.markers.forEach(i=>{t.has(i)||this.remove(i)}),!0}updatePlayerMarkerFromData(e){let t=e.uuid;if(!t)throw new Error("player-data has no uuid!");let i=this.getPlayerMarkerId(t),r=this.markers.get(i);return(!r||!r.isPlayerMarker)&&(r&&this.remove(r),r=new PlayerMarker(i,t,`${this.data.playerheadsUrl}${t}.png`),this.add(r)),r.updateFromData(e),r.visible=!e.foreign,r}getPlayerMarker(e){return this.markers.get(this.getPlayerMarkerId(e))}getPlayerMarkerId(e){return"bm-player-"+e}}const PLAYER_MARKER_SET_ID="bm-players";class PlayerMarkerManager extends MarkerManager{constructor(e,t,i,r=null){super(e,t,r),this.playerheadsUrl=i}updateFromData(e){let t=this.getPlayerMarkerSet(Array.isArray(e.players));return t?t.updateFromPlayerData(e):!1}getPlayerMarkerSet(e=!0){let t=this.root.markerSets.get(PLAYER_MARKER_SET_ID);return!t&&e&&(t=new PlayerMarkerSet(PLAYER_MARKER_SET_ID,this.playerheadsUrl),this.root.add(t)),t}getPlayerMarker(e){return this.getPlayerMarkerSet().getPlayerMarker(e)}clear(){var e;(e=this.getPlayerMarkerSet(!1))==null||e.clear()}}class NormalMarkerManager extends MarkerManager{constructor(e,t,i=null){super(e,t,i)}updateFromData(e){return this.root.updateMarkerSetsFromData(e,[PLAYER_MARKER_SET_ID,"bm-popup-set"]),!0}clear(){this.root.updateMarkerSetsFromData({},[PLAYER_MARKER_SET_ID,"bm-popup-set"])}}const SKY_FRAGMENT_SHADER=` +uniform float sunlightStrength; +uniform float ambientLight; +uniform vec3 skyColor; +uniform vec3 voidColor; + +varying vec3 vPosition; + +vec3 adjustColor(vec3 color) { + return vec3(color * max(sunlightStrength * sunlightStrength, ambientLight)); +} + +void main() { + float horizonWidth = 0.005; + float horizonHeight = 0.0; + + vec3 adjustedSkyColor = adjustColor(skyColor); + vec3 adjustedVoidColor = adjustColor(voidColor); + float voidMultiplier = (clamp(vPosition.y - horizonHeight, -horizonWidth, horizonWidth) + horizonWidth) / (horizonWidth * 2.0); + vec3 color = mix(adjustedVoidColor, adjustedSkyColor, voidMultiplier); + + gl_FragColor = vec4(color, 1.0); +} +`,SKY_VERTEX_SHADER=` +varying vec3 vPosition; +void main() { + vPosition = position; + + gl_Position = + projectionMatrix * + modelViewMatrix * + vec4(position, 1); +} +`;class SkyboxScene extends Scene{constructor(e){super(),this.matrixWorldAutoUpdate=!1,Object.defineProperty(this,"isSkyboxScene",{value:!0});let t=new SphereGeometry(1,40,5),i=new ShaderMaterial({uniforms:e,vertexShader:SKY_VERTEX_SHADER,fragmentShader:SKY_FRAGMENT_SHADER,side:BackSide}),r=new Mesh(t,i);this.add(r)}}class CombinedCamera extends PerspectiveCamera{constructor(e,t,i,r,s){super(e,t,i,r),this.needsUpdate=!0,this.data=reactive({fov:this.fov,aspect:this.aspect,near:this.near,far:this.far,zoom:this.zoom,ortho:s,distance:1}),Object.defineProperty(this,"fov",{get(){return this.data.fov},set(a){a!==this.data.fov&&(this.data.fov=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"aspect",{get(){return this.data.aspect},set(a){a!==this.data.aspect&&(this.data.aspect=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"near",{get(){return this.data.near},set(a){a!==this.data.near&&(this.data.near=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"far",{get(){return this.data.far},set(a){a!==this.data.far&&(this.data.far=a,this.needsUpdate=!0)}}),Object.defineProperty(this,"zoom",{get(){return this.data.zoom},set(a){a!==this.data.zoom&&(this.data.zoom=a,this.needsUpdate=!0)}}),this.updateProjectionMatrix()}updateProjectionMatrix(){if(!this.needsUpdate)return;this.ortographicProjection||(this.ortographicProjection=new Matrix4),this.perspectiveProjection||(this.perspectiveProjection=new Matrix4);const e=this.near;let t=e*Math.tan(MathUtils.DEG2RAD*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const m=a.fullWidth,v=a.fullHeight;s+=a.offsetX*r/m,t-=a.offsetY*i/v,r*=a.width/m,i*=a.height/v}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth());let l=-Math.pow(this.ortho-1,6)+1,c=Math.max(this.distance,1e-4)*Math.tan(MathUtils.DEG2RAD*.5*this.fov)/this.zoom,u=2*c,d=this.aspect*u,f=-.5*d;this.perspectiveProjection.makePerspective(s,s+r,t,t-i,e,this.far),this.ortographicProjection.makeOrthographic(f,f+d,c,c-u,e,this.far);for(let m=0;m<16;m++)this.projectionMatrix.elements[m]=this.perspectiveProjection.elements[m]*(1-l)+this.ortographicProjection.elements[m]*l;this.projectionMatrixInverse.copy(this.projectionMatrix).invert(),this.needsUpdate=!1}get isPerspectiveCamera(){return this.ortho<1}set isPerspectiveCamera(e){}get isOrthographicCamera(){return!this.isPerspectiveCamera}set isOrthographicCamera(e){}get type(){return this.isPerspectiveCamera?"PerspectiveCamera":"OrthographicCamera"}set type(e){}get ortho(){return this.data.ortho}set ortho(e){e!==this.data.ortho&&(this.data.ortho=e,this.needsUpdate=!0)}get distance(){return this.data.distance}set distance(e){e!==this.data.distance&&(this.data.distance=e,this.needsUpdate=!0)}}let Stats=function(){let n=0,e=document.createElement("div");e.style.cssText="position:absolute;bottom:5px;right:5px;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++n%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(let v=0;v=a+1e3&&(c.update(o*1e3/(m-a),100),a=m,o=0,f)){let v=performance.memory;f.update(v.usedJSHeapSize/1048576,v.jsHeapSizeLimit/1048576)}return m},update:function(){s=this.end(),l=s},domElement:e,setMode:i}};Stats.Panel=function(n,e,t){let i=1/0,r=0,s=Math.round,a=s(window.devicePixelRatio||1),o=160*a,l=96*a,c=3*a,u=3*a,d=3*a,f=15*a,m=154*a,v=77*a,_=document.createElement("canvas");_.width=o,_.height=l,_.style.cssText="width:160px;height:96px";let g=_.getContext("2d");return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=t,g.fillRect(0,0,o,l),g.fillStyle=e,g.fillText(n,c,u),g.fillRect(d,f,m,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(d,f,m,v),{dom:_,update:function(x,S){i=Math.min(i,x),r=Math.max(r,x),g.fillStyle=t,g.globalAlpha=1,g.fillRect(0,0,o,f),g.fillStyle=e,g.fillText(s(x)+" "+n+" ("+s(i)+"-"+s(r)+")",c,u),g.drawImage(_,d+a,f,m-a,v,d,f,m-a,v),g.fillRect(d+m-a,f,a,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(d+m-a,f,a,s((1-x/S)*v))}}};class WebGL{static isWebGLAvailable(){try{const e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}static isWebGL2Available(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}static getWebGLErrorMessage(){return this.getErrorMessage(1)}static getWebGL2ErrorMessage(){return this.getErrorMessage(2)}static getErrorMessage(e){const t={1:"WebGL",2:"WebGL 2"},i={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext};let r='Your $0 does not seem to support $1';const s=document.createElement("div");return s.id="webglmessage",s.style.fontFamily="monospace",s.style.fontSize="13px",s.style.fontWeight="normal",s.style.textAlign="center",s.style.background="#fff",s.style.color="#000",s.style.padding="1.5em",s.style.width="400px",s.style.margin="5em auto 0",i[e]?r=r.replace("$0","graphics card"):r=r.replace("$0","browser"),r=r.replace("$1",t[e]),s.innerHTML=r,s}}class MapViewer{constructor(e,t=e){me(this,"handleContainerResize",()=>{this.renderer.setSize(this.rootElement.clientWidth,this.rootElement.clientHeight),this.renderer.setPixelRatio(window.devicePixelRatio*this.superSampling),this.css2dRenderer.setSize(this.rootElement.clientWidth,this.rootElement.clientHeight),this.camera.aspect=this.rootElement.clientWidth/this.rootElement.clientHeight,this.camera.updateProjectionMatrix(),this.redraw()});me(this,"redraw",()=>{this.lastRedrawChange=Date.now()});me(this,"renderLoop",e=>{requestAnimationFrame(this.renderLoop),this.lastFrame<=0&&(this.lastFrame=e);let t=e-this.lastFrame;this.stats.begin(),this.map!=null&&this.controlsManager.update(t,this.map),(t>=50||Date.now()-this.lastRedrawChange<1e3)&&(this.lastFrame=e,this.render(t)),this.stats.update()});me(this,"updateLoadedMapArea",()=>{this.map&&(this.controlsManager.distance<1e3?this.map.loadMapArea(this.data.loadedCenter.x,this.data.loadedCenter.y,this.data.loadedHiresViewDistance,this.data.loadedLowresViewDistance):this.map.loadMapArea(this.data.loadedCenter.x,this.data.loadedCenter.y,0,this.data.loadedLowresViewDistance))});if(Object.defineProperty(this,"isMapViewer",{value:!0}),this.rootElement=e,this.events=t,this.data=reactive({map:null,mapState:"unloaded",camera:null,controlsManager:null,uniforms:{distance:{value:0},sunlightStrength:{value:1},ambientLight:{value:0},skyColor:{value:new Color(.5,.5,1)},voidColor:{value:new Color(0,0,0)},chunkBorders:{value:!1},hiresTileMap:{value:{map:null,size:TileManager.tileMapSize,scale:new Vector2(1,1),translate:new Vector2,pos:new Vector2}}},superSampling:1,loadedCenter:new Vector2(0,0),loadedHiresViewDistance:200,loadedLowresViewDistance:2e3}),this.tileCacheHash=generateCacheHash(),this.stats=new Stats,this.stats.hide(),!WebGL.isWebGL2Available())throw new Error("WebGL2 is not available in your browser. It's not bluemaps fault, i promise ;_; !");this.renderer=new WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0}),this.renderer.autoClear=!1,this.renderer.uniforms=this.data.uniforms,this.css2dRenderer=new CSS2DRenderer(this.events),this.skyboxScene=new SkyboxScene(this.data.uniforms),this.camera=new CombinedCamera(75,1,.1,1e4,0),this.skyboxCamera=new PerspectiveCamera(75,1,.1,1e4),this.skyboxCamera.updateProjectionMatrix(),this.controlsManager=new ControlsManager(this,this.camera),this.raycaster=new Raycaster,this.raycaster.layers.enableAll(),this.raycaster.params.Line2={threshold:20},this.map=null,this.markers=new MarkerSet("bm-root"),this.lastFrame=0,this.lastRedrawChange=0,t.addEventListener("bluemapCameraMoved",this.redraw),t.addEventListener("bluemapTileLoaded",this.redraw),this.initializeRootElement(),window.addEventListener("resize",this.handleContainerResize),requestAnimationFrame(this.renderLoop)}initializeRootElement(){this.rootElement.innerHTML="";let e=htmlToElement('
');this.rootElement.appendChild(e),e.appendChild(this.renderer.domElement),this.css2dRenderer.domElement.style.position="absolute",this.css2dRenderer.domElement.style.top="0",this.css2dRenderer.domElement.style.left="0",this.css2dRenderer.domElement.style.pointerEvents="none",e.appendChild(this.css2dRenderer.domElement),e.appendChild(this.stats.dom),this.handleContainerResize()}handleMapInteraction(e,t={}){let i=elementOffset(this.rootElement),r=new Vector2((e.x-i.left)/this.rootElement.clientWidth*2-1,-((e.y-i.top)/this.rootElement.clientHeight)*2+1);if(this.map&&this.map.isLoaded){this.camera.updateMatrixWorld(),this.raycaster.setFromCamera(r,this.camera);let s=this.map.hiresTileManager.scene.position;s.x=0,s.z=0,this.map.hiresTileManager.scene.updateMatrixWorld();const a=[this.map.hiresTileManager.scene,this.markers];for(let f=0;fo.step(e));const t=1e4,i=Math.round(this.camera.position.x/t)*t,r=Math.round(this.camera.position.z/t)*t;this.camera.position.x-=i,this.camera.position.z-=r,this.data.uniforms.distance.value=this.controlsManager.distance,this.data.uniforms.hiresTileMap.value.pos.copy(this.map.hiresTileManager.centerTile),this.data.uniforms.hiresTileMap.value.translate.set(this.map.data.hires.translate.x-i,this.map.data.hires.translate.z-r);const s=this.camera.far;this.controlsManager.distance<1e3&&(this.camera.far=1e6),this.camera.updateProjectionMatrix();const a=this.map.lowresTileManager.length-1;for(let o=this.map.lowresTileManager.length-1;o>=0;o--)if(o===a||this.controlsManager.distance<1e3*Math.pow(this.map.data.lowres.lodFactor,o+1)){let l=this.map.lowresTileManager[o].scene.position;l.x=-i,l.z=-r,o===0&&(this.camera.far=s,this.camera.updateProjectionMatrix()),this.renderer.render(this.map.lowresTileManager[o].sceneParent,this.camera),o!==0&&this.renderer.clearDepth()}if(this.camera.far=s,this.controlsManager.distance<1e3){this.camera.updateProjectionMatrix();let o=this.map.hiresTileManager.scene.position;o.x=-i,o.z=-r,this.renderer.render(this.map.hiresTileManager.sceneParent,this.camera)}this.camera.position.x+=i,this.camera.position.z+=r}this.renderer.render(this.markers,this.camera),this.css2dRenderer.render(this.markers,this.camera)}switchMap(e=null){return this.map&&this.map.isMap&&this.map.unload(),this.data.mapState="loading",this.map=e,this.map&&this.map.isMap?e.load(HIRES_VERTEX_SHADER,HIRES_FRAGMENT_SHADER,LOWRES_VERTEX_SHADER,LOWRES_FRAGMENT_SHADER,this.data.uniforms,this.tileCacheHash).then(()=>{for(let t of this.map.loadedTextures)this.renderer.initTexture(t);this.data.uniforms.distance.value=this.controlsManager.distance,this.data.uniforms.skyColor.value=e.data.skyColor,this.data.uniforms.voidColor.value=e.data.voidColor,this.data.uniforms.ambientLight.value=e.data.ambientLight,this.data.uniforms.sunlightStrength.value=e.data.skyLight,this.data.uniforms.hiresTileMap.value.map=e.hiresTileManager.tileMap.texture,this.data.uniforms.hiresTileMap.value.scale.set(e.data.hires.tileSize.x,e.data.hires.tileSize.z),this.data.uniforms.hiresTileMap.value.translate.set(e.data.hires.translate.x,e.data.hires.translate.z),setTimeout(this.updateLoadedMapArea),this.data.mapState="loaded",dispatchEvent(this.events,"bluemapMapChanged",{map:e})}).catch(t=>{throw this.data.mapState="errored",this.map=null,t}):Promise.resolve()}loadMapArea(e,t,i=-1,r=-1){this.data.loadedCenter.set(e,t),i>=0&&(this.data.loadedHiresViewDistance=i),r>=0&&(this.data.loadedLowresViewDistance=r),this.updateLoadedMapArea()}clearTileCache(e){if(e||(e=generateCacheHash()),this.tileCacheHash=e,this.map){for(let t=0;t{var s,a,o,l,c,u;let i=!0,r=t.detail.hiresHit;if(t.detail.lowresHits)for(let d=0;d +
${i18n.t("blockTooltip.block")}:
+
+
x: ${this.position.x}
+
y: ${this.position.y}
+
z: ${this.position.z}
+
+ + `:this.element.innerHTML=` +
+
${i18n.t("blockTooltip.position")}:
+
+
x: ${this.position.x}
+
z: ${this.position.z}
+
+
+ `,this.appState.debug){let d=this.position.clone().divideScalar(16).floor(),f=new Vector2(this.position.x,this.position.z).divideScalar(512).floor(),m=`r.${f.x}.${f.y}.mca`;i?this.element.innerHTML+=` +
+
+
${i18n.t("blockTooltip.chunk")}:
+
+
x: ${d.x}
+
y: ${d.y}
+
z: ${d.z}
+
+
+ `:this.element.innerHTML+=` +
+
+
${i18n.t("blockTooltip.chunk")}:
+
+
x: ${d.x}
+
z: ${d.z}
+
+
+ `,this.element.innerHTML+=` +
+
+
${i18n.t("blockTooltip.region.region")}:
+
+
x: ${f.x}
+
z: ${f.y}
+
+
+
${i18n.t("blockTooltip.region.file")}: ${m}
+
+
+ `}if(this.appState.debug){let d=r.faceIndex,f=r.object.geometry.attributes;if(f.sunlight&&f.blocklight){let m=f.sunlight.array[d*3],v=f.blocklight.array[d*3];this.element.innerHTML+=` +
+
+
${i18n.t("blockTooltip.light.light")}:
+
+
${i18n.t("blockTooltip.light.sun")}: ${m}
+
${i18n.t("blockTooltip.light.block")}: ${v}
+
+
+ `}}if(this.appState.debug){let d="";if(i){let f=(o=(a=(s=t.detail.hiresHit)==null?void 0:s.object)==null?void 0:a.userData)==null?void 0:o.tileUrl;d+=`
${f}
`}if(t.detail.lowresHits)for(let f=0;f${m}`)}this.element.innerHTML+=` +
+
+ ${d} +
+ `}this.appState.debug&&console.debug("Clicked Position Data:",t.detail),this.open()}});me(this,"removeHandler",t=>{t.composedPath().includes(this.element)||this.close()});this.data.type="popup",this.data.label="Last Map Interaction",this.data.listed=!1,this.appState=i,this.events=r,this.visible=!1,this.elementObject=new CSS2DObject(htmlToElement(`
Test
`)),this.elementObject.position.set(.5,1,.5),this.elementObject.disableDepthTest=!0,this.addEventListener("removed",()=>{this.element.parentNode&&this.element.parentNode.removeChild(this.element)});let s=new BoxGeometry(1.01,1.01,1.01).translate(.5,.5,.5),a=new MeshBasicMaterial({color:16777215,opacity:.5,transparent:!0});this.cube=new Mesh(s,a),this.cube.onClick=o=>this.onClick(o),this.add(this.elementObject),this.add(this.cube),this.animation=null,this.events.addEventListener("bluemapMapInteraction",o=>window.setTimeout(()=>this.onMapInteraction(o))),window.addEventListener("mousedown",this.removeHandler),window.addEventListener("touchstart",this.removeHandler,{passive:!0}),window.addEventListener("keydown",this.removeHandler),window.addEventListener("mousewheel",this.removeHandler)}onClick(t){return!0}open(){this.animation&&this.animation.cancel(),this.visible=!0,this.cube.visible=!0;let t=1;this.element.style.opacity="0",this.animation=animate(i=>{this.element.style.opacity=(i*t).toString()},300)}close(){this.animation&&this.animation.cancel(),this.cube.visible=!1;let t=parseFloat(this.element.style.opacity);this.animation=animate(i=>{this.element.style.opacity=(t-i*t).toString()},300,i=>{i&&(this.visible=!1)})}get element(){return this.elementObject.element.getElementsByTagName("div")[0]}dispose(){super.dispose(),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}};me(bt,"blockClipboardFormat",(t,i)=>i?`${t.x} ${t.y} ${t.z}`:`${t.x} ${t.z}`),me(bt,"chunkClipboardFormat",(t,i)=>i?`${t.x} ${t.y} ${t.z}`:`${t.x} ${t.z}`),me(bt,"regionClipboardFormat",t=>`r.${t.x}.${t.z}.mca`);let PopupMarker=bt;class BlueMapApp{constructor(e){me(this,"update",async()=>{await this.followPlayerMarkerWorld(),this.updateLoop=setTimeout(this.update,1e3)});me(this,"cameraMoved",()=>{this.hashUpdateTimeout&&clearTimeout(this.hashUpdateTimeout),this.hashUpdateTimeout=setTimeout(this.updatePageAddress,1500),this.lastCameraMove=Date.now()});me(this,"loadBlocker",async()=>{if(!this.appState.controls.pauseTileLoading)return;let e;do e=250-(Date.now()-this.lastCameraMove),e>0&&await this.sleep(e);while(e>0)});me(this,"updatePageAddress",()=>{let e="#";if(this.mapViewer.map){e+=this.mapViewer.map.data.id;let t=this.mapViewer.controlsManager;e+=":"+round(t.position.x,0),e+=":"+round(t.position.y,0),e+=":"+round(t.position.z,0),e+=":"+round(t.distance,0),e+=":"+round(t.rotation,2),e+=":"+round(t.angle,2),e+=":"+round(t.tilt,2),e+=":"+round(t.ortho,0),e+=":"+this.appState.controls.state}history.replaceState(void 0,void 0,e),document.title=i18n.t("pageTitle",{map:this.mapViewer.map?this.mapViewer.map.data.name:"?",version:this.settings.version})});me(this,"loadPageAddress",async()=>{var r;let t=(((r=window.location.hash)==null?void 0:r.substring(1))||this.settings.startLocation||"").split(":");if(t.length===1&&(!this.mapViewer.map||this.mapViewer.map.data.id!==t[0])){try{await this.switchMap(t[0])}catch{return!1}return!0}if(t.length!==10)return!1;let i=this.mapViewer.controlsManager;if(i.controls=null,!this.mapViewer.map||this.mapViewer.map.data.id!==t[0])try{await this.switchMap(t[0])}catch{return!1}switch(t[9]){case"flat":this.setFlatView(0);break;case"free":this.setFreeFlight(0,i.position.y);break;default:this.setPerspectiveView(0);break}return i.position.x=parseFloat(t[1]),i.position.y=parseFloat(t[2]),i.position.z=parseFloat(t[3]),i.distance=parseFloat(t[4]),i.rotation=parseFloat(t[5]),i.angle=parseFloat(t[6]),i.tilt=parseFloat(t[7]),i.ortho=parseFloat(t[8]),this.updatePageAddress(),this.mapViewer.updateLoadedMapArea(),!0});me(this,"mapInteraction",e=>{var t,i;if(e.detail.data.doubleTap){let r=this.mapViewer.controlsManager,s=((t=e.detail.hit)==null?void 0:t.point)||((i=e.detail.object)==null?void 0:i.getWorldPosition(new Vector3));if(!s)return;let a=r.distance,o=Math.max(a*.25,5),l=r.position.x,c=s.x,u=r.position.z,d=s.z;this.viewAnimation=animate(f=>{let m=EasingFunctions.easeInOutQuad(f);r.distance=MathUtils.lerp(a,o,m),r.position.x=MathUtils.lerp(l,c,m),r.position.z=MathUtils.lerp(u,d,m)},500)}});me(this,"takeScreenshot",()=>{let e=document.createElement("a");e.download="bluemap-screenshot.png",e.href=this.mapViewer.renderer.domElement.toDataURL("image/png"),e.click(),this.appState.screenshot.clipboard&&this.mapViewer.renderer.domElement.toBlob(t=>{navigator.clipboard.write([new ClipboardItem({"image/png":t})]).catch(i=>{alert(this.events,"Failed to copy screenshot to clipboard: "+i,"error")})})});this.events=e,this.mapViewer=new MapViewer(e,this.events),this.mapControls=new MapControls(this.mapViewer.renderer.domElement,e),this.freeFlightControls=new FreeFlightControls(this.mapViewer.renderer.domElement),this.playerMarkerManager=null,this.markerFileManager=null,this.settings=null,this.savedUserSettings=new Map,this.maps=[],this.mapsMap=new Map,this.lastCameraMove=0,this.mainMenu=reactive(new MainMenu$1),this.appState=reactive({controls:{state:"perspective",mouseSensitivity:1,showZoomButtons:!0,invertMouse:!1,pauseTileLoading:!1},menu:this.mainMenu,maps:[],theme:null,screenshot:{clipboard:!0},debug:!1}),this.updateControlsSettings(),this.initGeneralEvents(),this.popupMarkerSet=new MarkerSet("bm-popup-set"),this.popupMarkerSet.data.toggleable=!1,this.popupMarker=new PopupMarker("bm-popup",this.appState,this.events),this.popupMarkerSet.add(this.popupMarker),this.mapViewer.markers.add(this.popupMarkerSet),this.updateLoop=null,this.hashUpdateTimeout=null,this.viewAnimation=null}async load(){let e=this.maps;if(this.maps=[],this.appState.maps.splice(0,this.appState.maps.length),this.mapsMap.clear(),await this.getSettings(),this.mapControls.minDistance=this.settings.minZoomDistance,this.mapControls.maxDistance=this.settings.maxZoomDistance,this.settings.styles)for(let t of this.settings.styles){let i=document.createElement("link");i.rel="stylesheet",i.href=t,alert(this.events,"Loading style: "+t,"fine"),document.head.appendChild(i)}await this.mapViewer.switchMap(null),e.forEach(t=>t.dispose()),await this.loadUserSettings(),this.maps=await this.loadMaps();for(let t of this.maps)this.mapsMap.set(t.data.id,t),this.appState.maps.push(t.data);try{await this.loadPageAddress()||(this.maps.length>0&&await this.switchMap(this.maps[0].data.id),this.resetCamera())}catch(t){console.error("Failed to load map!",t)}if(window.addEventListener("hashchange",this.loadPageAddress),this.events.addEventListener("bluemapCameraMoved",this.cameraMoved),this.events.addEventListener("bluemapMapInteraction",this.mapInteraction),this.updateLoop&&clearTimeout(this.updateLoop),this.updateLoop=setTimeout(this.update,1e3),this.saveUserSettings(),this.settings.scripts)for(let t of this.settings.scripts){let i=document.createElement("script");i.src=t,alert(this.events,"Loading script: "+t,"fine"),document.body.appendChild(i)}}async followPlayerMarkerWorld(){var t;let e=(t=this.mapViewer.controlsManager.controls)==null?void 0:t.data.followingPlayer;if(this.mapViewer.map&&e&&e.foreign){let i=await this.findPlayerMap(e.playerUuid);if(i){this.mainMenu.closeAll(),await this.switchMap(i.data.id,!1);let r=this.playerMarkerManager.getPlayerMarker(e.playerUuid);r&&this.mapViewer.controlsManager.controls.followPlayerMarker&&this.mapViewer.controlsManager.controls.followPlayerMarker(r)}else this.mapViewer.controlsManager.controls.stopFollowingPlayerMarker&&this.mapViewer.controlsManager.controls.stopFollowingPlayerMarker()}}async findPlayerMap(e){let t=null;if(this.maps.length<20)for(let i of this.maps){let r=await this.loadPlayerData(i);if(Array.isArray(r.players)){for(let s of r.players)if(s.uuid===e&&!s.foreign){t=i;break}if(t)break}}return t}async switchMap(e,t=!0){let i=this.mapsMap.get(e);if(!i)return Promise.reject(`There is no map with the id "${e}" loaded!`);this.playerMarkerManager&&this.playerMarkerManager.dispose(),this.markerFileManager&&this.markerFileManager.dispose(),await this.mapViewer.switchMap(i),(t||!this.mapViewer.map.hasView(this.appState.controls.state))&&this.resetCamera(),this.updatePageAddress(),await Promise.all([this.initPlayerMarkerManager(),this.initMarkerFileManager()])}resetCamera(){let e=this.mapViewer.map,t=this.mapViewer.controlsManager;e&&(t.position.set(e.data.startPos.x,0,e.data.startPos.z),t.distance=1500,t.angle=0,t.rotation=0,t.tilt=0,t.ortho=0),t.controls=this.mapControls,this.appState.controls.state="perspective",this.settings.defaultToFlatView&&e.hasView("flat")?this.setFlatView():e.hasView("perspective")||(e.hasView("flat")?this.setFlatView():this.setFreeFlight()),this.updatePageAddress()}async loadMaps(){let e=this.settings,t=[];if(e.maps!==void 0){let i=e.maps.map(r=>{let s=new Map$1(r,e.mapDataRoot+"/"+r,e.liveDataRoot+"/"+r,this.loadBlocker,this.mapViewer.events);return t.push(s),s.loadSettings(this.mapViewer.tileCacheHash).catch(a=>{alert(this.events,`Failed to load settings for map '${s.data.id}':`+a,"warning")})});await Promise.all(i)}return t.sort((i,r)=>{let s=i.data.sorting-r.data.sorting;return isNaN(s)?0:s}),t}async getSettings(){if(!this.settings){let e=await this.loadSettings();this.settings={version:"?",useCookies:!1,defaultToFlatView:!1,resolutionDefault:1,minZoomDistance:5,maxZoomDistance:1e5,hiresSliderMax:500,hiresSliderDefault:100,hiresSliderMin:0,lowresSliderMax:7e3,lowresSliderDefault:2e3,lowresSliderMin:500,mapDataRoot:"maps",liveDataRoot:"maps",maps:["world","world_the_end","world_nether"],scripts:[],styles:[],...e}}return this.settings}loadSettings(){return new Promise((e,t)=>{let i=new FileLoader$1;i.setResponseType("json"),i.load("settings.json?"+generateCacheHash(),e,()=>{},()=>t("Failed to load the settings.json!"))})}loadPlayerData(e){return new Promise((t,i)=>{let r=new FileLoader$1;r.setResponseType("json"),r.load(e.data.liveDataRoot+"/live/players.json?"+generateCacheHash(),s=>{s?t(s):i(`Failed to parse '${this.fileUrl}'!`)},()=>{},()=>i(`Failed to load '${this.fileUrl}'!`))})}initPlayerMarkerManager(){this.playerMarkerManager&&this.playerMarkerManager.dispose();const e=this.mapViewer.map;if(e)return this.playerMarkerManager=new PlayerMarkerManager(this.mapViewer.markers,e.data.liveDataRoot+"/live/players.json",e.data.mapDataRoot+"/assets/playerheads/",this.events),this.playerMarkerManager.setAutoUpdateInterval(0),this.playerMarkerManager.update().then(()=>{this.playerMarkerManager.setAutoUpdateInterval(1e3)}).catch(t=>{alert(this.events,t,"warning"),this.playerMarkerManager.dispose()})}initMarkerFileManager(){this.markerFileManager&&this.markerFileManager.dispose();const e=this.mapViewer.map;if(e)return this.markerFileManager=new NormalMarkerManager(this.mapViewer.markers,e.data.liveDataRoot+"/live/markers.json",this.events),this.markerFileManager.update().then(()=>{this.markerFileManager.setAutoUpdateInterval(1e3*10)}).catch(t=>{alert(this.events,t,"warning"),this.markerFileManager.dispose()})}updateControlsSettings(){let e=this.appState.controls.invertMouse?-1:1;this.freeFlightControls.mouseRotate.speedCapture=-1.5*this.appState.controls.mouseSensitivity,this.freeFlightControls.mouseAngle.speedCapture=-1.5*this.appState.controls.mouseSensitivity*e,this.freeFlightControls.mouseRotate.speedRight=-2*this.appState.controls.mouseSensitivity,this.freeFlightControls.mouseAngle.speedRight=-2*this.appState.controls.mouseSensitivity*e}initGeneralEvents(){document.addEventListener("fullscreenchange",e=>{document.fullscreenElement&&this.mainMenu.closeAll()})}setPerspectiveView(e=0,t=5){if(!this.mapViewer.map||!this.mapViewer.map.data.perspectiveView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=Math.max(5,t,r),a=i.position.y,o=MathUtils.lerp(this.mapViewer.map.terrainHeightAt(i.position.x,i.position.z)+3,0,s/500),l=i.angle,c=Math.min(Math.PI/2,l,MapControls.getMaxPerspectiveAngleForDistance(s)),u=i.ortho,d=i.tilt;this.viewAnimation=animate(f=>{let m=EasingFunctions.easeInOutQuad(f);i.position.y=MathUtils.lerp(a,o,m),i.distance=MathUtils.lerp(r,s,m),i.angle=MathUtils.lerp(l,c,m),i.ortho=MathUtils.lerp(u,0,f),i.tilt=MathUtils.lerp(d,0,m)},e,f=>{this.mapControls.reset(),f&&(i.controls=this.mapControls,this.updatePageAddress())}),this.appState.controls.state="perspective"}setFlatView(e=0,t=5){if(!this.mapViewer.map||!this.mapViewer.map.data.flatView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=Math.max(5,t,r),a=i.rotation,o=i.angle,l=i.ortho,c=i.tilt;this.viewAnimation=animate(u=>{let d=EasingFunctions.easeInOutQuad(u);i.distance=MathUtils.lerp(r,s,d),i.rotation=MathUtils.lerp(a,0,d),i.angle=MathUtils.lerp(o,0,d),i.ortho=MathUtils.lerp(l,1,u),i.tilt=MathUtils.lerp(c,0,d)},e,u=>{this.mapControls.reset(),u&&(i.controls=this.mapControls,this.updatePageAddress())}),this.appState.controls.state="flat"}setFreeFlight(e=0,t=void 0){if(!this.mapViewer.map||!this.mapViewer.map.data.freeFlightView)return;this.viewAnimation&&this.viewAnimation.cancel();let i=this.mapViewer.controlsManager;i.controls=null;let r=i.distance,s=i.position.y;t||(t=this.mapViewer.map.terrainHeightAt(i.position.x,i.position.z)+3||s);let a=i.angle,o=Math.PI/2,l=i.ortho,c=i.tilt;this.viewAnimation=animate(u=>{let d=EasingFunctions.easeInOutQuad(u);i.position.y=MathUtils.lerp(s,t,d),i.distance=MathUtils.lerp(r,0,d),i.angle=MathUtils.lerp(a,o,d),i.ortho=MathUtils.lerp(l,0,Math.min(u*2,1)),i.tilt=MathUtils.lerp(c,0,d)},e,u=>{u&&(i.controls=this.freeFlightControls,this.updatePageAddress())}),this.appState.controls.state="free"}setChunkBorders(e){this.mapViewer.data.uniforms.chunkBorders.value=e}setDebug(e){this.appState.debug=e,e?this.mapViewer.stats.showPanel(0):this.mapViewer.stats.showPanel(-1)}setTheme(e){this.appState.theme=e,e==="light"?(this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.remove("theme-contrast"),this.mapViewer.rootElement.classList.add("theme-light")):e==="dark"?(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-contrast"),this.mapViewer.rootElement.classList.add("theme-dark")):e==="contrast"?(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.add("theme-contrast")):(this.mapViewer.rootElement.classList.remove("theme-light"),this.mapViewer.rootElement.classList.remove("theme-dark"),this.mapViewer.rootElement.classList.remove("theme-contrast"))}setScreenshotClipboard(e){this.appState.screenshot.clipboard=e}async updateMap(){try{this.mapViewer.clearTileCache(),this.mapViewer.map&&await this.switchMap(this.mapViewer.map.data.id,!1),this.saveUserSettings()}catch(e){alert(this.events,e,"error")}}resetSettings(){this.saveUserSetting("resetSettings",!0),location.reload()}async loadUserSettings(){if(isNaN(this.settings.resolutionDefault)||(this.mapViewer.data.superSampling=this.settings.resolutionDefault),isNaN(this.settings.hiresSliderDefault)||(this.mapViewer.data.loadedHiresViewDistance=this.settings.hiresSliderDefault),isNaN(this.settings.lowresSliderDefault)||(this.mapViewer.data.loadedLowresViewDistance=this.settings.lowresSliderDefault),!this.settings.useCookies)return;if(this.loadUserSetting("resetSettings",!1)){alert(this.events,"Settings reset!","info"),this.saveUserSettings();return}const[e]=performance.getEntriesByType("navigation");e.type!="reload"&&this.mapViewer.clearTileCache(this.loadUserSetting("tileCacheHash",this.mapViewer.tileCacheHash)),this.mapViewer.superSampling=this.loadUserSetting("superSampling",this.mapViewer.data.superSampling),this.mapViewer.data.loadedHiresViewDistance=this.loadUserSetting("hiresViewDistance",this.mapViewer.data.loadedHiresViewDistance),this.mapViewer.data.loadedLowresViewDistance=this.loadUserSetting("lowresViewDistance",this.mapViewer.data.loadedLowresViewDistance),this.mapViewer.updateLoadedMapArea(),this.appState.controls.mouseSensitivity=this.loadUserSetting("mouseSensitivity",this.appState.controls.mouseSensitivity),this.appState.controls.invertMouse=this.loadUserSetting("invertMouse",this.appState.controls.invertMouse),this.appState.controls.pauseTileLoading=this.loadUserSetting("pauseTileLoading",this.appState.controls.pauseTileLoading),this.appState.controls.showZoomButtons=this.loadUserSetting("showZoomButtons",this.appState.controls.showZoomButtons),this.updateControlsSettings(),this.setTheme(this.loadUserSetting("theme",this.appState.theme)),this.setScreenshotClipboard(this.loadUserSetting("screenshotClipboard",this.appState.screenshot.clipboard)),await setLanguage(this.loadUserSetting("lang",i18n.locale.value)),this.setChunkBorders(this.loadUserSetting("chunkBorders",this.mapViewer.data.uniforms.chunkBorders.value)),this.setDebug(this.loadUserSetting("debug",this.appState.debug)),alert(this.events,"Settings loaded!","info")}saveUserSettings(){this.settings.useCookies&&(this.saveUserSetting("resetSettings",!1),this.saveUserSetting("tileCacheHash",this.mapViewer.tileCacheHash),this.saveUserSetting("superSampling",this.mapViewer.data.superSampling),this.saveUserSetting("hiresViewDistance",this.mapViewer.data.loadedHiresViewDistance),this.saveUserSetting("lowresViewDistance",this.mapViewer.data.loadedLowresViewDistance),this.saveUserSetting("mouseSensitivity",this.appState.controls.mouseSensitivity),this.saveUserSetting("invertMouse",this.appState.controls.invertMouse),this.saveUserSetting("pauseTileLoading",this.appState.controls.pauseTileLoading),this.saveUserSetting("showZoomButtons",this.appState.controls.showZoomButtons),this.saveUserSetting("theme",this.appState.theme),this.saveUserSetting("screenshotClipboard",this.appState.screenshot.clipboard),this.saveUserSetting("lang",i18n.locale.value),this.saveUserSetting("chunkBorders",this.mapViewer.data.uniforms.chunkBorders.value),this.saveUserSetting("debug",this.appState.debug),alert(this.events,"Settings saved!","info"))}loadUserSetting(e,t){let i=getLocalStorage("bluemap-"+e);return i===void 0?t:i}saveUserSetting(e,t){this.savedUserSettings.get(e)!==t&&(this.savedUserSettings.set(e,t),setLocalStorage("bluemap-"+e,t))}sleep(e){return new Promise(t=>setTimeout(t,e))}}Object3D.prototype.onClick=function(n){return this.parent?(Array.isArray(n.eventStack)||(n.eventStack=[]),n.eventStack.push(this),this.parent.onClick(n)):!1};const BlueMap=Object.freeze(Object.defineProperty({__proto__:null,BlueMapApp,CSS2DObject,CSS2DRenderer,CombinedCamera,ControlsManager,EasingFunctions,ExtrudeMarker,FreeFlightControls,FreeFlightKeyMoveControls:KeyMoveControls$1,FreeFlightMouseAngleControls:MouseAngleControls$1,FreeFlightMouseRotateControls:MouseRotateControls$1,HIRES_FRAGMENT_SHADER,HIRES_VERTEX_SHADER,HtmlMarker,KeyAngleControls,KeyCombination,KeyHeightControls,KeyRotateControls,KeyZoomControls,LOWRES_FRAGMENT_SHADER,LOWRES_VERTEX_SHADER,LabelPopup,LineMarker,LowresTileLoader,MARKER_FILL_FRAGMENT_SHADER,MARKER_FILL_VERTEX_SHADER,MainMenu:MainMenu$1,Map:Map$1,MapControls,MapHeightControls,MapKeyMoveControls:KeyMoveControls,MapMouseAngleControls:MouseAngleControls,MapMouseRotateControls:MouseRotateControls,MapViewer,Marker,MarkerManager,MarkerSet,MouseMoveControls,MouseZoomControls,NormalMarkerManager,ObjectMarker,PLAYER_MARKER_SET_ID,PlayerMarker,PlayerMarkerManager,PlayerMarkerSet,PoiMarker,PopupMarker,SKY_FRAGMENT_SHADER,SKY_VERTEX_SHADER,ShapeMarker,SkyboxScene,Three:three_module,Tile,TileLoader,TileManager,TileMap,TouchAngleControls,TouchMoveControls,TouchPanControls,TouchRotateControls,TouchZoomControls,VEC2_ZERO,VEC3_X,VEC3_Y,VEC3_Z,VEC3_ZERO,addEventListeners,alert,animate,deepEquals,dispatchEvent,elementOffset,fetchHocon,generateCacheHash,getLocalStorage,getPixel,hashTile,htmlToElement,htmlToElements,lineShader,pathFromCoords,removeEventListeners,round,setLocalStorage,softClamp,softMax,softMin,softSet,stringToImage,vecArrToObj},Symbol.toStringTag,{value:"Module"}));String.prototype.includesCI=function(n){return this.toLowerCase().includes(n.toLowerCase())};async function load(){try{const n=new BlueMapApp(document.getElementById("map-container"));window.bluemap=n,window.BlueMap=BlueMap;const e=createApp(App,{i18nModule,render:i=>i(App)});e.config.globalProperties.$bluemap=n,e.use(i18nModule),await loadLanguageSettings(),await e.mount("#app").$nextTick(),await n.load()}catch(n){console.error("Failed to load BlueMap webapp!",n),document.body.innerHTML=` +
+
+ bluemap logo +
Failed to load BlueMap webapp!
+
Make sure you have WebGL2 enabled on your browser.
+
+
+ `}}load().catch(n=>console.error(n)); +//# sourceMappingURL=index-Q7i7_FGJ.js.map diff --git a/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js.map b/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js.map new file mode 100644 index 0000000..f7a1157 --- /dev/null +++ b/src/plugins/BlueMap/data/web/assets/index-Q7i7_FGJ.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index-Q7i7_FGJ.js","sources":["../../node_modules/@vue/shared/dist/shared.esm-bundler.js","../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js","../../src/components/ControlBar/NumberInput.vue","../../src/components/ControlBar/PositionInput.vue","../../node_modules/three/build/three.module.js","../../src/js/util/Utils.js","../../src/components/ControlBar/SvgButton.vue","../../src/components/ControlBar/Compass.vue","../../src/components/ControlBar/DayNightSwitch.vue","../../src/components/ControlBar/ControlsSwitch.vue","../../src/components/ControlBar/MenuButton.vue","../../src/components/ControlBar/ControlBar.vue","../../src/components/Menu/SideMenu.vue","../../src/components/Menu/SimpleButton.vue","../../src/components/Menu/Group.vue","../../src/components/Menu/Slider.vue","../../src/components/Menu/SwitchHandle.vue","../../src/components/Menu/SwitchButton.vue","../../node_modules/@intlify/shared/dist/shared.mjs","../../node_modules/@intlify/message-compiler/dist/message-compiler.esm-browser.js","../../node_modules/@intlify/core-base/dist/core-base.mjs","../../node_modules/vue-i18n/dist/vue-i18n.mjs","../../node_modules/hocon-parser/index.js","../../src/js/Utils.js","../../src/i18n.js","../../src/components/Menu/SettingsMenu.vue","../../src/js/MainMenu.js","../../src/components/Menu/MarkerItem.vue","../../src/components/Menu/TextInput.vue","../../src/components/Menu/MarkerSet.vue","../../src/components/Menu/ChoiceBox.vue","../../src/components/Menu/MarkerSetMenu.vue","../../src/components/Menu/MapButton.vue","../../src/components/Menu/MainMenu.vue","../../src/components/Controls/FreeFlightMobileControls.vue","../../src/components/Controls/ZoomButtons.vue","../../src/App.vue","../../node_modules/hammerjs/hammer.js","../../src/js/controls/KeyCombination.js","../../src/js/controls/freeflight/keyboard/KeyMoveControls.js","../../src/js/controls/freeflight/mouse/MouseRotateControls.js","../../src/js/controls/freeflight/mouse/MouseAngleControls.js","../../src/js/controls/freeflight/keyboard/KeyHeightControls.js","../../src/js/controls/freeflight/touch/TouchPanControls.js","../../node_modules/three/src/math/MathUtils.js","../../src/js/controls/freeflight/FreeFlightControls.js","../../src/js/controls/map/mouse/MouseMoveControls.js","../../src/js/controls/map/mouse/MouseZoomControls.js","../../src/js/controls/map/mouse/MouseRotateControls.js","../../src/js/controls/map/mouse/MouseAngleControls.js","../../src/js/controls/map/MapHeightControls.js","../../src/js/controls/map/keyboard/KeyMoveControls.js","../../src/js/controls/map/keyboard/KeyAngleControls.js","../../src/js/controls/map/keyboard/KeyRotateControls.js","../../src/js/controls/map/keyboard/KeyZoomControls.js","../../src/js/controls/map/touch/TouchMoveControls.js","../../src/js/controls/map/touch/TouchRotateControls.js","../../src/js/controls/map/touch/TouchAngleControls.js","../../src/js/controls/map/touch/TouchZoomControls.js","../../src/js/controls/map/MapControls.js","../../src/js/map/Tile.js","../../src/js/map/TileMap.js","../../src/js/map/TileManager.js","../../src/js/map/hires/PRBMLoader.js","../../src/js/map/TileLoader.js","../../src/js/map/LowresTileLoader.js","../../src/js/map/TextureAnimation.js","../../src/js/map/Map.js","../../src/js/controls/ControlsManager.js","../../src/js/map/hires/HiresFragmentShader.js","../../src/js/map/hires/HiresVertexShader.js","../../src/js/map/lowres/LowresFragmentShader.js","../../src/js/map/lowres/LowresVertexShader.js","../../node_modules/three/examples/jsm/lines/LineMaterial.js","../../src/js/markers/MarkerFillVertexShader.js","../../src/js/markers/MarkerFillFragmentShader.js","../../node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js","../../node_modules/three/examples/jsm/lines/LineSegments2.js","../../node_modules/three/examples/jsm/lines/LineGeometry.js","../../node_modules/three/examples/jsm/lines/Line2.js","../../src/js/markers/Marker.js","../../src/js/util/CSS2DRenderer.js","../../src/js/markers/ObjectMarker.js","../../src/js/util/LineShader.js","../../src/js/markers/ExtrudeMarker.js","../../src/js/markers/HtmlMarker.js","../../src/js/markers/LineMarker.js","../../src/js/markers/ShapeMarker.js","../../src/js/markers/PoiMarker.js","../../src/js/markers/MarkerSet.js","../../src/js/markers/MarkerManager.js","../../src/js/markers/PlayerMarker.js","../../src/js/markers/PlayerMarkerSet.js","../../src/js/markers/PlayerMarkerManager.js","../../src/js/markers/NormalMarkerManager.js","../../src/js/skybox/SkyFragmentShader.js","../../src/js/skybox/SkyVertexShader.js","../../src/js/skybox/SkyboxScene.js","../../src/js/util/CombinedCamera.js","../../src/js/util/Stats.js","../../node_modules/three/examples/jsm/capabilities/WebGL.js","../../src/js/MapViewer.js","../../src/js/PopupMarker.js","../../src/js/BlueMapApp.js","../../src/js/BlueMap.js","../../src/main.js"],"sourcesContent":["/**\n * Make a map and return a function for checking if a key\n * is in that map.\n * IMPORTANT: all calls of this function must be prefixed with\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\n * So that rollup can tree-shake them if necessary.\n */\nfunction makeMap(str, expectsLowerCase) {\n const map = Object.create(null);\n const list = str.split(',');\n for (let i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];\n}\n\n/**\n * dev only flag -> name mapping\n */\nconst PatchFlagNames = {\n [1 /* PatchFlags.TEXT */]: `TEXT`,\n [2 /* PatchFlags.CLASS */]: `CLASS`,\n [4 /* PatchFlags.STYLE */]: `STYLE`,\n [8 /* PatchFlags.PROPS */]: `PROPS`,\n [16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,\n [32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,\n [64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,\n [128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,\n [256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,\n [512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,\n [1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,\n [2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,\n [-1 /* PatchFlags.HOISTED */]: `HOISTED`,\n [-2 /* PatchFlags.BAIL */]: `BAIL`\n};\n\n/**\n * Dev only\n */\nconst slotFlagsText = {\n [1 /* SlotFlags.STABLE */]: 'STABLE',\n [2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',\n [3 /* SlotFlags.FORWARDED */]: 'FORWARDED'\n};\n\nconst GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +\n 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +\n 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';\nconst isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n // Split the content into individual lines but capture the newline sequence\n // that separated each line. This is important because the actual sequence is\n // needed to properly take into account the full line length for offset\n // comparison\n let lines = source.split(/(\\r?\\n)/);\n // Separate the lines and newline sequences into separate arrays for easier referencing\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count +=\n lines[i].length +\n ((newlineSequences[i] && newlineSequences[i].length) || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length)\n continue;\n const line = j + 1;\n res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);\n const lineLength = lines[j].length;\n const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;\n if (j === i) {\n // push underline\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(1, end > count ? lineLength - pad : end - start);\n res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));\n }\n else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + '^'.repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join('\\n');\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item)\n ? parseStringStyle(item)\n : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n }\n else if (isString(value)) {\n return value;\n }\n else if (isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\\/\\*.*?\\*\\//gs;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText\n .replace(styleCommentRE, '')\n .split(listDelimiterRE)\n .forEach(item => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n let ret = '';\n if (!styles || isString(styles)) {\n return ret;\n }\n for (const key in styles) {\n const value = styles[key];\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n if (isString(value) || typeof value === 'number') {\n // only render valid values\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = '';\n if (isString(value)) {\n res = value;\n }\n else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + ' ';\n }\n }\n }\n else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + ' ';\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props)\n return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\n// These tag configs are shared between compiler-dom and runtime-dom, so they\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\nconst HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\n 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\n 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\n 'option,output,progress,select,textarea,details,dialog,menu,' +\n 'summary,template,blockquote,iframe,tfoot';\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\nconst SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\n 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\n 'text,textPath,title,tspan,unknown,use,view';\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);\n\n/**\n * On the client we only need to offer special cases for boolean attributes that\n * have different names from their corresponding dom properties:\n * - itemscope -> N/A\n * - allowfullscreen -> allowFullscreen\n * - formnovalidate -> formNoValidate\n * - ismap -> isMap\n * - nomodule -> noModule\n * - novalidate -> noValidate\n * - readonly -> readOnly\n */\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);\n/**\n * The full list is needed during SSR to produce the correct initial markup.\n */\nconst isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +\n `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +\n `loop,open,required,reversed,scoped,seamless,` +\n `checked,muted,multiple,selected`);\n/**\n * Boolean attributes should be included if the value is truthy or ''.\n * e.g. `