diff --git a/app/shapes/page.module.css b/app/shapes/page.module.css new file mode 100644 index 00000000..e889f522 --- /dev/null +++ b/app/shapes/page.module.css @@ -0,0 +1,161 @@ +.CanvasContainer { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 0; +} + +.LoadingIndicator { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + display: flex; + flex-direction: column; + align-items: center; + gap: 16px; + pointer-events: none; + z-index: 1; + opacity: 0.8; +} + +.LoadingIndicator[data-complete="true"] { + animation: loadingComplete 0.3s ease-out forwards; +} + +.Spinner { + width: 48px; + height: 48px; + border: 4px solid rgba(255, 255, 255, 0.2); + border-top-color: white; + border-radius: 50%; + animation: spin 1s linear infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +@keyframes loadingComplete { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +.Sidebar { + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 260px; + background: rgba(0, 0, 0, 0.7); + backdrop-filter: blur(8px); + color: #fff; + font-size: 13px; + z-index: 2; + display: flex; + flex-direction: column; + overflow: hidden; +} + +.SidebarSection { + padding: 10px 12px; + border-bottom: 1px solid rgba(255, 255, 255, 0.1); +} + +.SidebarSection:last-child { + border-bottom: none; +} + +.SectionLabel { + font-size: 10px; + text-transform: uppercase; + letter-spacing: 0.05em; + color: rgba(255, 255, 255, 0.4); + margin-bottom: 6px; +} + +.AnimationList { + flex: 1; + overflow-y: auto; + padding: 0 12px 12px; +} + +.AnimationItem { + display: flex; + align-items: center; + gap: 6px; + padding: 4px 6px; + border-radius: 4px; + cursor: pointer; + user-select: none; +} + +.AnimationItem:hover { + background: rgba(255, 255, 255, 0.08); +} + +.AnimationItem[data-active="true"] { + background: rgba(255, 255, 255, 0.15); +} + +.PlayButton { + flex-shrink: 0; + width: 22px; + height: 22px; + display: flex; + align-items: center; + justify-content: center; + border: none; + border-radius: 4px; + background: rgba(255, 255, 255, 0.1); + color: rgba(255, 255, 255, 0.6); + cursor: pointer; + font-size: 11px; + padding: 0; +} + +.PlayButton:hover { + background: rgba(255, 255, 255, 0.2); + color: #fff; +} + +.AnimationItem[data-active="true"] .PlayButton { + background: rgba(100, 180, 255, 0.3); + color: #fff; +} + +.AnimationName { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.ClipName { + flex-shrink: 0; + font-size: 10px; + color: rgba(255, 255, 255, 0.3); + white-space: nowrap; +} + +.CyclicIcon { + flex-shrink: 0; + font-size: 13px; + color: rgba(255, 255, 255, 0.3); + title: "Cyclic (looping)"; +} + +.CheckboxField { + display: flex; + align-items: center; + gap: 6px; +} diff --git a/app/shapes/page.tsx b/app/shapes/page.tsx new file mode 100644 index 00000000..eeb58ba7 --- /dev/null +++ b/app/shapes/page.tsx @@ -0,0 +1,444 @@ +"use client"; + +import { + useState, + useEffect, + useEffectEvent, + useCallback, + Suspense, + useMemo, +} from "react"; +import { Canvas, GLProps } from "@react-three/fiber"; +import * as THREE from "three"; +import { NoToneMapping, SRGBColorSpace, PCFShadowMap } from "three"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { OrbitControls, Center, Bounds, useBounds } from "@react-three/drei"; +import { + SettingsProvider, + useDebug, +} from "@/src/components/SettingsProvider"; +import { ShapeRenderer, useStaticShape } from "@/src/components/GenericShape"; +import { ShapeInfoProvider } from "@/src/components/ShapeInfoProvider"; +import { DebugElements } from "@/src/components/DebugElements"; +import { TickProvider } from "@/src/components/TickProvider"; +import { ShapeSelect } from "@/src/components/ShapeSelect"; +import { engineStore, useEngineSelector } from "@/src/state"; +import { + getResourceList, + getResourceMap, + getResourceKey, + getSourceAndPath, +} from "@/src/manifest"; +import { createParser, useQueryState } from "nuqs"; +import { createScriptLoader } from "@/src/torqueScript/scriptLoader.browser"; +import picomatch from "picomatch"; +import { + createScriptCache, + type FileSystemHandler, + runServer, + type TorqueObject, + type TorqueRuntime, +} from "@/src/torqueScript"; +import styles from "./page.module.css"; +import { ignoreScripts } from "@/src/torqueScript/ignoreScripts"; + +const queryClient = new QueryClient(); +const sceneBg = new THREE.Color(0.1, 0.1, 0.1); + +const glSettings: GLProps = { + toneMapping: NoToneMapping, + outputColorSpace: SRGBColorSpace, +}; + +const loadScript = createScriptLoader(); +const scriptCache = createScriptCache(); +const fileSystem: FileSystemHandler = { + findFiles: (pattern) => { + const isMatch = picomatch(pattern, { nocase: true }); + return getResourceList() + .filter((path) => isMatch(path)) + .map((resourceKey) => { + const [, actualPath] = getSourceAndPath(resourceKey); + return actualPath; + }); + }, + isFile: (resourcePath) => { + const resourceKeys = getResourceMap(); + const resourceKey = getResourceKey(resourcePath); + return resourceKeys[resourceKey] != null; + }, +}; + +const defaultShape = "deploy_inventory.dts"; + +const parseAsShape = createParser({ + parse: (query: string) => query, + serialize: (value: string) => value, + eq: (a, b) => a === b, +}).withDefault(defaultShape); + +/** + * Hook to run the TorqueScript runtime once (hardcoded to SC_Normal/CTF) + * so deploy animations and other script-driven behaviors work. + */ +function useShapeRuntime(): TorqueRuntime | null { + const [runtime, setRuntime] = useState(null); + + useEffect(() => { + const controller = new AbortController(); + let isDisposed = false; + + const { runtime, ready } = runServer({ + missionName: "SC_Normal", + missionType: "CTF", + runtimeOptions: { + loadScript, + fileSystem, + cache: scriptCache, + signal: controller.signal, + ignoreScripts, + }, + }); + + void ready + .then(() => { + if (isDisposed || controller.signal.aborted) return; + engineStore.getState().setRuntime(runtime); + setRuntime(runtime); + }) + .catch((err) => { + if (err instanceof Error && err.name === "AbortError") return; + console.error("Shape runtime failed:", err); + }); + + // Seed store immediately + engineStore.getState().setRuntime(runtime); + + const unsubscribe = runtime.subscribeRuntimeEvents((event) => { + if (event.type !== "batch.flushed") return; + engineStore.getState().applyRuntimeBatch(event.events, { + tick: event.tick, + }); + }); + + return () => { + isDisposed = true; + controller.abort(); + unsubscribe(); + engineStore.getState().clearRuntime(); + runtime.destroy(); + }; + }, []); + + return runtime; +} + +/** Create a minimal TorqueObject for the shape viewer. */ +function createFakeObject( + runtime: TorqueRuntime | null, + shapeName: string, +): TorqueObject { + // Try to find a matching datablock for this shape so deploy animations work. + let datablockName: string | undefined; + if (runtime) { + for (const obj of runtime.state.objectsById.values()) { + if ( + obj.shapeFile && + String(obj.shapeFile).toLowerCase() === shapeName.toLowerCase() + ) { + datablockName = obj._name; + break; + } + } + } + return { + _id: 99999, + _class: "StaticShapeData", + _className: "StaticShape", + ...(datablockName ? { datablock: datablockName } : {}), + } as TorqueObject; +} + +function FitOnLoad() { + const bounds = useBounds(); + useEffect(() => { + bounds.refresh().fit(); + }, [bounds]); + return null; +} + +interface AnimationInfo { + name: string; + alias: string | null; + cyclic: boolean | null; +} + +/** Reports available animations (with cyclic and alias info when available). */ +function AnimationReporter({ + shapeName, + onAnimations, +}: { + shapeName: string; + onAnimations: (anims: AnimationInfo[]) => void; +}) { + const gltf = useStaticShape(shapeName); + const shapeAliases = useEngineSelector((state) => + state.runtime.sequenceAliases.get(shapeName.toLowerCase()), + ); + const anims = useMemo(() => { + // Collect cyclic info from vis_sequence nodes on the scene + const visCyclic = new Map(); + gltf.scene.traverse((node: any) => { + const ud = node.userData; + if (ud?.vis_sequence && ud.vis_cyclic != null) { + visCyclic.set(ud.vis_sequence.toLowerCase(), !!ud.vis_cyclic); + } + }); + // Build reverse alias map: clip name -> alias + let reverseAliases: Map | undefined; + if (shapeAliases) { + reverseAliases = new Map(); + for (const [alias, clipName] of shapeAliases) { + reverseAliases.set(clipName, alias); + } + } + return gltf.animations.map((clip) => ({ + name: clip.name, + alias: reverseAliases?.get(clip.name.toLowerCase()) ?? null, + cyclic: visCyclic.get(clip.name.toLowerCase()) ?? null, + })); + }, [gltf, shapeAliases]); + const reportAnimations = useEffectEvent(onAnimations); + useEffect(() => { + reportAnimations(anims); + }, [anims]); + return null; +} + +/** Plays the selected animation via the TorqueScript runtime. */ +function AnimationPlayer({ + object, + runtime, + animation, +}: { + object: TorqueObject; + runtime: TorqueRuntime | null; + animation: string; +}) { + useEffect(() => { + if (!runtime || !animation) return; + // Use nsCall to dispatch directly on the ShapeBase namespace, bypassing + // class chain resolution (the fake object's _className won't resolve + // to ShapeBase through the namespace parent chain). + for (let slot = 0; slot < 4; slot++) { + runtime.$.nsCall("ShapeBase", "stopThread", object, slot); + } + runtime.$.nsCall("ShapeBase", "playThread", object, 0, animation); + return () => { + for (let slot = 0; slot < 4; slot++) { + runtime.$.nsCall("ShapeBase", "stopThread", object, slot); + } + }; + }, [runtime, object, animation]); + return null; +} + +function ShapeViewer({ + shapeName, + runtime, + onAnimations, + selectedAnimation, +}: { + shapeName: string; + runtime: TorqueRuntime | null; + onAnimations: (anims: AnimationInfo[]) => void; + selectedAnimation: string; +}) { + const object = useMemo( + () => createFakeObject(runtime, shapeName), + [runtime, shapeName], + ); + + return ( + +
+ + + + +
+
+ ); +} + +function SceneLighting() { + return ( + <> + + + + ); +} + +function ShapeInspector() { + const [currentShape, setCurrentShape] = useQueryState("shape", parseAsShape); + const runtime = useShapeRuntime(); + const [availableAnimations, setAvailableAnimations] = useState< + AnimationInfo[] + >([]); + const [selectedAnimation, setSelectedAnimation] = useState(""); + + const handleAnimations = useCallback((anims: AnimationInfo[]) => { + setAvailableAnimations(anims); + setSelectedAnimation(""); + }, []); + + const [showLoading, setShowLoading] = useState(true); + useEffect(() => { + if (runtime) { + const timer = setTimeout(() => setShowLoading(false), 300); + return () => clearTimeout(timer); + } + }, [runtime]); + + return ( + +
+ {}}> +
+ {showLoading && ( +
+
+
+ )} + + + + + + + + + + + + +
+ + +
+
+ ); +} + +function ShapeControls({ + currentShape, + onChangeShape, + animations, + selectedAnimation, + onChangeAnimation, +}: { + currentShape: string; + onChangeShape: (shape: string) => void; + animations: AnimationInfo[]; + selectedAnimation: string; + onChangeAnimation: (name: string) => void; +}) { + const { debugMode, setDebugMode } = useDebug(); + + return ( +
+
+ +
+
+
+ setDebugMode(e.target.checked)} + /> + +
+
+ {animations.length > 0 && ( + <> +
+
Animations
+
+
+ {animations.map((anim) => ( +
+ onChangeAnimation( + selectedAnimation === anim.name ? "" : anim.name, + ) + } + > + + + {anim.alias ?? anim.name} + + {anim.alias && ( + + {anim.name} + + )} + {anim.cyclic === true && ( + + {"\u221E"} + + )} +
+ ))} +
+ + )} +
+ ); +} + +export default function ShapesPage() { + return ( + + + + ); +} diff --git a/docs/404.html b/docs/404.html index 4854656f..39dae335 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index 4854656f..39dae335 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/__next.__PAGE__.txt b/docs/__next.__PAGE__.txt index 66aad164..ecad3619 100644 --- a/docs/__next.__PAGE__.txt +++ b/docs/__next.__PAGE__.txt @@ -1,10 +1,11 @@ 1:"$Sreact.fragment" -2:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -3:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/c339a594c158eab3.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/f12455938f261f57.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] -6:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] +2:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +3:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/8206544674c0f63e.js","/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js"],"default"] +6:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] 7:"$Sreact.suspense" -:HL["/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","style"] -0:{"buildId":"YSDmiCN1S-sDYVxEL27I6","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c339a594c158eab3.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/f12455938f261f57.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +:HL["/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","style"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/8206544674c0f63e.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","async":true}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} 4:{} 5:"$0:rsc:props:children:0:props:serverProvidedParams:params" 8:null diff --git a/docs/__next._full.txt b/docs/__next._full.txt index bf7ac3b3..e1c2e50c 100644 --- a/docs/__next._full.txt +++ b/docs/__next._full.txt @@ -1,20 +1,21 @@ 1:"$Sreact.fragment" -2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] -3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -5:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/c339a594c158eab3.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/f12455938f261f57.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] -9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/8206544674c0f63e.js","/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js"],"default"] +9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" -c:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] -e:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] +c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] -:HL["/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","style"] -0:{"P":null,"b":"YSDmiCN1S-sDYVxEL27I6","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c339a594c158eab3.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/f12455938f261f57.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +:HL["/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","style"] +0:{"P":null,"b":"AwXCwaoi1jnfKLMnIzgVt","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/8206544674c0f63e.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] -11:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] +11:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] b:null f:[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L11","3",{}]] diff --git a/docs/__next._head.txt b/docs/__next._head.txt index 0969284a..d5ce669f 100644 --- a/docs/__next._head.txt +++ b/docs/__next._head.txt @@ -1,6 +1,6 @@ 1:"$Sreact.fragment" -2:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] -3:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] +2:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +3:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 4:"$Sreact.suspense" -5:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] -0:{"buildId":"YSDmiCN1S-sDYVxEL27I6","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} +5:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} diff --git a/docs/__next._index.txt b/docs/__next._index.txt index bfcbae61..37d57782 100644 --- a/docs/__next._index.txt +++ b/docs/__next._index.txt @@ -1,6 +1,6 @@ 1:"$Sreact.fragment" -2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] -3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] -0:{"buildId":"YSDmiCN1S-sDYVxEL27I6","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/__next._tree.txt b/docs/__next._tree.txt index 950e9512..ce8c2216 100644 --- a/docs/__next._tree.txt +++ b/docs/__next._tree.txt @@ -1,3 +1,4 @@ :HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] -:HL["/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","style"] -0:{"buildId":"YSDmiCN1S-sDYVxEL27I6","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +:HL["/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","style"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_buildManifest.js b/docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_buildManifest.js similarity index 100% rename from docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_buildManifest.js rename to docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_buildManifest.js diff --git a/docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_clientMiddlewareManifest.json b/docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_clientMiddlewareManifest.json rename to docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_clientMiddlewareManifest.json diff --git a/docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_ssgManifest.js b/docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_ssgManifest.js similarity index 100% rename from docs/_next/static/YSDmiCN1S-sDYVxEL27I6/_ssgManifest.js rename to docs/_next/static/AwXCwaoi1jnfKLMnIzgVt/_ssgManifest.js diff --git a/docs/_next/static/chunks/045c83caa4d15373.js b/docs/_next/static/chunks/045c83caa4d15373.js new file mode 100644 index 00000000..9de4243d --- /dev/null +++ b/docs/_next/static/chunks/045c83caa4d15373.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,62262,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,l=e[r];if(0>>1;ro(u,t))so(c,u)?(e[r]=c,e[s]=t,r=s):(e[r]=u,e[i]=t,r=i);else if(so(c,t))e[r]=c,e[s]=t,r=s;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var i,u=performance;t.unstable_now=function(){return u.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}var f=[],d=[],p=1,m=null,h=3,g=!1,v=!1,y=!1,b=!1,k="function"==typeof setTimeout?setTimeout:null,w="function"==typeof clearTimeout?clearTimeout:null,S="u">typeof setImmediate?setImmediate:null;function E(e){for(var n=l(d);null!==n;){if(null===n.callback)a(d);else if(n.startTime<=e)a(d),n.sortIndex=n.expirationTime,r(f,n);else break;n=l(d)}}function x(e){if(y=!1,E(e),!v)if(null!==l(f))v=!0,N||(N=!0,i());else{var n=l(d);null!==n&&D(x,n.startTime-e)}}var N=!1,C=-1,P=5,z=-1;function T(){return!!b||!(t.unstable_now()-ze&&T());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var u=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof u){m.callback=u,E(e),n=!0;break n}m===l(f)&&a(f),E(e)}else a(f);m=l(f)}if(null!==m)n=!0;else{var s=l(d);null!==s&&D(x,s.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?i():N=!1}}}if("function"==typeof S)i=function(){S(_)};else if("u">typeof MessageChannel){var L=new MessageChannel,O=L.port2;L.port1.onmessage=_,i=function(){O.postMessage(null)}}else i=function(){k(_,0)};function D(e,n){C=k(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=a,r(d,e),null===l(f)&&e===l(d)&&(y?(w(C),C=-1):y=!0,D(x,a-o))):(e.sortIndex=u,r(f,e),v||g||(v=!0,N||(N=!0,i()))),e},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},53389,(e,n,t)=>{"use strict";n.exports=e.r(62262)},46480,(e,n,t)=>{"use strict";var r,l=e.i(47167),a=e.r(53389),o=e.r(71645),i=e.r(74080);function u(e){var n="https://react.dev/errors/"+e;if(1G||(e.current=Y[G],Y[G]=null,G--)}function J(e,n){Y[++G]=e.current,e.current=n}var ee=X(null),en=X(null),et=X(null),er=X(null);function el(e,n){switch(J(et,n),J(en,e),J(ee,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?cs(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)e=cc(n=cs(n),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Z(ee),J(ee,e)}function ea(){Z(ee),Z(en),Z(et)}function eo(e){var n=e.memoizedState;null!==n&&(fv._currentValue=n.memoizedState,J(er,e));var t=cc(n=ee.current,e.type);n!==t&&(J(en,e),J(ee,t))}function ei(e){en.current===e&&(Z(ee),Z(en)),er.current===e&&(Z(er),fv._currentValue=K)}function eu(e){if(void 0===nY)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);nY=n&&n[1]||"",nG=-1)":-1l||u[r]!==s[l]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=l)break}}}finally{es=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?eu(t):""}function ef(e){try{var n="",t=null;do n+=function(e,n){switch(e.tag){case 26:case 27:case 5:return eu(e.type);case 16:return eu("Lazy");case 13:return e.child!==n&&null!==n?eu("Suspense Fallback"):eu("Suspense");case 19:return eu("SuspenseList");case 0:case 15:return ec(e.type,!1);case 11:return ec(e.type.render,!1);case 1:return ec(e.type,!0);case 31:return eu("Activity");case 30:return eu("ViewTransition");default:return""}}(e,t),t=e,e=e.return;while(e)return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var ed=Object.prototype.hasOwnProperty,ep=a.unstable_scheduleCallback,em=a.unstable_cancelCallback,eh=a.unstable_shouldYield,eg=a.unstable_requestPaint,ev=a.unstable_now,ey=a.unstable_getCurrentPriorityLevel,eb=a.unstable_ImmediatePriority,ek=a.unstable_UserBlockingPriority,ew=a.unstable_NormalPriority,eS=a.unstable_LowPriority,eE=a.unstable_IdlePriority,ex=(a.log,a.unstable_setDisableYieldValue,null),eN=null,eC=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(eP(e)/ez|0)|0},eP=Math.log,ez=Math.LN2,eT=256,e_=262144,eL=4194304;function eO(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function eD(e,n,t){var r=e.pendingLanes;if(0===r)return 0;var l=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var i=0x7ffffff&r;return 0!==i?0!=(r=i&~a)?l=eO(r):0!=(o&=i)?l=eO(o):t||0!=(t=i&~e)&&(l=eO(t)):0!=(i=r&~a)?l=eO(i):0!==o?l=eO(o):t||0!=(t=r&~e)&&(l=eO(t)),0===l?0:0!==n&&n!==l&&0==(n&a)&&((a=l&-l)>=(t=n&-n)||32===a&&0!=(4194048&t))?n:l}function eF(e,n){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function eI(){var e=eL;return 0==(0x3c00000&(eL<<=1))&&(eL=4194304),e}function eM(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function eA(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function eR(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-eC(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|261930&t}function eU(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-eC(t),l=1<typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(n){return e.body}}var np=/[\n"\\]/g;function nm(e){return e.replace(np,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function nh(e,n,t,r,l,a,o,i){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=n?"number"===o?(0===n&&""===e.value||e.value!=n)&&(e.value=""+nu(n)):e.value!==""+nu(n)&&(e.value=""+nu(n)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=n?nv(e,o,nu(n)):null!=t?nv(e,o,nu(t)):null!=r&&e.removeAttribute("value"),null==l&&null!=a&&(e.defaultChecked=!!a),null!=l&&(e.checked=l&&"function"!=typeof l&&"symbol"!=typeof l),null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.name=""+nu(i):e.removeAttribute("name")}function ng(e,n,t,r,l,a,o,i){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=n||null!=t){if(("submit"===a||"reset"===a)&&null==n)return void nc(e);t=null!=t?""+nu(t):"",n=null!=n?""+nu(n):t,i||n===e.value||(e.value=n),e.defaultValue=n}r="function"!=typeof(r=null!=r?r:l)&&"symbol"!=typeof r&&!!r,e.checked=i?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o),nc(e)}function nv(e,n,t){"number"===n&&nd(e.ownerDocument)===e||e.defaultValue===""+t||(e.defaultValue=""+t)}function ny(e,n,t,r){if(e=e.options,n){n={};for(var l=0;ltypeof window&&void 0!==window.document&&void 0!==window.document.createElement,nU=!1;if(nR)try{var nV={};Object.defineProperty(nV,"passive",{get:function(){nU=!0}}),window.addEventListener("test",nV,nV),window.removeEventListener("test",nV,nV)}catch(e){nU=!1}var nB=null,n$=null,nj=null;function nH(){if(nj)return nj;var e,n,t=n$,r=t.length,l="value"in nB?nB.value:nB.textContent,a=l.length;for(e=0;e=tm),tv=!1;function ty(e,n){switch(e){case"keyup":return -1!==td.indexOf(n.keyCode);case"keydown":return 229!==n.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tb(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var tk=!1,tw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function tS(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===n?!!tw[e.type]:"textarea"===n}function tE(e,n,t,r){nO?nD?nD.push(r):nD=[r]:nO=r,0<(n=s5(n,"onChange")).length&&(t=new n1("onChange","change",null,t,r),e.push({event:t,listeners:n}))}var tx=null,tN=null;function tC(e){sX(e,0)}function tP(e){if(nf(e3(e)))return e}function tz(e,n){if("change"===e)return n}var tT=!1;if(nR){if(nR){var t_="oninput"in document;if(!t_){var tL=document.createElement("div");tL.setAttribute("oninput","return;"),t_="function"==typeof tL.oninput}r=t_}else r=!1;tT=r&&(!document.documentMode||9=n)return{node:r,offset:n-e};e=t}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=tV(r)}}function t$(e){e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;for(var n=nd(e.document);n instanceof e.HTMLIFrameElement;){try{var t="string"==typeof n.contentWindow.location.href}catch(e){t=!1}if(t)e=n.contentWindow;else break;n=nd(e.document)}return n}function tj(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&("input"===n&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===n||"true"===e.contentEditable)}var tH=nR&&"documentMode"in document&&11>=document.documentMode,tQ=null,tW=null,tq=null,tK=!1;function tY(e,n,t){var r=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;tK||null==tQ||tQ!==nd(r)||(r="selectionStart"in(r=tQ)&&tj(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},tq&&tU(tq,r)||(tq=r,0<(r=s5(tW,"onSelect")).length&&(n=new n1("onSelect","select",null,n,t),e.push({event:n,listeners:r}),n.target=tQ)))}function tG(e,n){var t={};return t[e.toLowerCase()]=n.toLowerCase(),t["Webkit"+e]="webkit"+n,t["Moz"+e]="moz"+n,t}var tX={animationend:tG("Animation","AnimationEnd"),animationiteration:tG("Animation","AnimationIteration"),animationstart:tG("Animation","AnimationStart"),transitionrun:tG("Transition","TransitionRun"),transitionstart:tG("Transition","TransitionStart"),transitioncancel:tG("Transition","TransitionCancel"),transitionend:tG("Transition","TransitionEnd")},tZ={},tJ={};function t0(e){if(tZ[e])return tZ[e];if(!tX[e])return e;var n,t=tX[e];for(n in t)if(t.hasOwnProperty(n)&&n in tJ)return tZ[e]=t[n];return e}nR&&(tJ=document.createElement("div").style,"AnimationEvent"in window||(delete tX.animationend.animation,delete tX.animationiteration.animation,delete tX.animationstart.animation),"TransitionEvent"in window||delete tX.transitionend.transition);var t1=t0("animationend"),t2=t0("animationiteration"),t3=t0("animationstart"),t4=t0("transitionrun"),t5=t0("transitionstart"),t8=t0("transitioncancel"),t6=t0("transitionend"),t9=new Map,t7="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function re(e,n){t9.set(e,n),e9(n,[e])}t7.push("scrollEnd");var rn=0;function rt(e,n){return null!=e.name&&"auto"!==e.name?e.name:null!==n.autoName?n.autoName:n.autoName=e="_"+(e=uq.identifierPrefix)+"t_"+(rn++).toString(32)+"_"}function rr(e){if(null==e||"string"==typeof e)return e;var n=null,t=u1;if(null!==t)for(var r=0;r>=o,l-=o,rI=1<<32-eC(n)+l|t<typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},la=a.unstable_scheduleCallback,lo=a.unstable_NormalPriority,li={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lu(){return{controller:new ll,data:new Map,refCount:0}}function ls(e){e.refCount--,0===e.refCount&&la(lo,function(){e.controller.abort()})}function lc(e,n){if(0!=(4194048&e.pendingLanes)){var t=e.transitionTypes;for(null===t&&(t=e.transitionTypes=[]),e=0;eh?(g=f,f=null):g=f.sibling;var v=p(l,f,i[h],u);if(null===v){null===f&&(f=g);break}e&&f&&null===v.alternate&&n(l,f),o=a(v,o,h),null===c?s=v:c.sibling=v,c=v,f=g}if(h===i.length)return t(l,f),rH&&rA(l,h),s;if(null===f){for(;hg?(v=h,h=null):v=h.sibling;var b=p(l,h,y.value,s);if(null===b){null===h&&(h=v);break}e&&h&&null===b.alternate&&n(l,h),o=a(b,o,g),null===f?c=b:f.sibling=b,f=b,h=v}if(y.done)return t(l,h),rH&&rA(l,g),c;if(null===h){for(;!y.done;g++,y=i.next())null!==(y=d(l,y.value,s))&&(o=a(y,o,g),null===f?c=y:f.sibling=y,f=y);return rH&&rA(l,g),c}for(h=r(h);!y.done;g++,y=i.next())null!==(y=m(h,l,g,y.value,s))&&(e&&null!==(v=y.alternate)&&h.delete(null===v.key?g:v.key),o=a(y,o,g),null===f?c=y:f.sibling=y,f=y);return e&&h.forEach(function(e){return n(l,e)}),rH&&rA(l,g),c}(s,c,f=g.call(f),h)}if("function"==typeof f.then)return i(s,c,lF(f),h);if(f.$$typeof===O)return i(s,c,lt(s,f),h);lM(s,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==c&&6===c.tag?(t(s,c.sibling),(h=l(c,f)).return=s):(t(s,c),(h=rE(f,s.mode,h)).return=s),o(s=h)):t(s,c)}(i,s,c,f);return lO=null,h}catch(e){if(e===lS||e===lx)throw e;var g=rv(29,e,null,i.mode);return g.lanes=f,g.return=i,g}finally{}}}var lR=lA(!0),lU=lA(!1),lV=!1;function lB(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function l$(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function lj(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function lH(e,n,t){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&uS)){var l=r.pending;return null===l?n.next=n:(n.next=l.next,l.next=n),r.pending=n,n=rm(e),rp(e,null,t),n}return rc(e,r,n,t),rm(e)}function lQ(e,n,t){if(null!==(n=n.updateQueue)&&(n=n.shared,0!=(4194048&t))){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,eU(e,t)}}function lW(e,n){var t=e.updateQueue,r=e.alternate;if(null!==r&&t===(r=r.updateQueue)){var l=null,a=null;if(null!==(t=t.firstBaseUpdate)){do{var o={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};null===a?l=a=o:a=a.next=o,t=t.next}while(null!==t)null===a?l=a=n:a=a.next=n}else l=a=n;t={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=t;return}null===(e=t.lastBaseUpdate)?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}var lq=!1;function lK(){if(lq){var e=lh;if(null!==e)throw e}}function lY(e,n,t,r){lq=!1;var l=e.updateQueue;lV=!1;var a=l.firstBaseUpdate,o=l.lastBaseUpdate,i=l.shared.pending;if(null!==i){l.shared.pending=null;var u=i,s=u.next;u.next=null,null===o?a=s:o.next=s,o=u;var c=e.alternate;null!==c&&(i=(c=c.updateQueue).lastBaseUpdate)!==o&&(null===i?c.firstBaseUpdate=s:i.next=s,c.lastBaseUpdate=u)}if(null!==a){var f=l.baseState;for(o=0,c=s=u=null,i=a;;){var d=-0x20000001&i.lane,p=d!==i.lane;if(p?(uN&d)===d:(r&d)===d){0!==d&&d===lm&&(lq=!0),null!==c&&(c=c.next={lane:0,tag:i.tag,payload:i.payload,callback:null,next:null});e:{var m=e,h=i;switch(d=n,h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(t,f,d);break e}f=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(d="function"==typeof(m=h.payload)?m.call(t,f,d):m))break e;f=x({},f,d);break e;case 2:lV=!0}}null!==(d=i.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=l.callbacks)?l.callbacks=[d]:p.push(d))}else p={lane:d,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===c?(s=c=p,u=f):c=c.next=p,o|=d;if(null===(i=i.next))if(null===(i=l.shared.pending))break;else i=(p=i).next,p.next=null,l.lastBaseUpdate=p,l.shared.pending=null}null===c&&(u=f),l.baseState=u,l.firstBaseUpdate=s,l.lastBaseUpdate=c,null===a&&(l.shared.lanes=0),uD|=o,e.lanes=o,e.memoizedState=f}}function lG(e,n){if("function"!=typeof e)throw Error(u(191,e));e.call(n)}function lX(e,n){var t=e.callbacks;if(null!==t)for(e.callbacks=null,e=0;ea?a:8;var o=W.T,i={};i.types=null!==o?o.types:null,W.T=i,oy(e,!1,n,t);try{var u=l(),s=W.S;if(null!==s&&s(i,u),null!==u&&"object"==typeof u&&"function"==typeof u.then){var c,f,d=(c=[],f={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},u.then(function(){f.status="fulfilled",f.value=r;for(var e=0;e title"))),cl(l,r,n),l[eW]=e,e5(l),r=l;break e;case"link":if(a=fl("link","href",t).get(r+(n.href||""))){for(var o=0;oi)break;var c=u.transferSize,f=u.initiatorType;c&&ca(f)&&(o+=c*((u=u.responseEnd)fc?50:800)+h);return m.unsuspend=e,function(){m.unsuspend=null,clearTimeout(n),clearTimeout(t)}}:null))){uY=a,e.cancelPendingCommit=g(sh.bind(null,e,n,a,t,r,l,o,i,u,c,f,null,d,p)),se(e,a,o,!s);return}sh(e,n,a,t,r,l,o,i,u,c,f)}function se(e,n,t,r){n&=~uI,n&=~uF,e.suspendedLanes|=n,e.pingedLanes&=~n,r&&(e.warmLanes|=n),r=e.expirationTimes;for(var l=n;0",a=a.removeChild(a.firstChild);break;case"select":a="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a="string"==typeof r.is?o.createElement(l,{is:r.is}):o.createElement(l)}}a[eW]=n,a[eq]=r;e:for(o=n.child;null!==o;){if(5===o.tag||6===o.tag)a.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===n)break;for(;null===o.sibling;){if(null===o.return||o.return===n)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(n.stateNode=a,cl(a,l,r),l){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break;case"img":r=!0;break;default:r=!1}r&&ii(n)}}return ip(n),n.subtreeFlags&=-0x2000001,iu(n,n.type,null===e?null:e.memoizedProps,n.pendingProps,t),null;case 6:if(e&&null!=n.stateNode)e.memoizedProps!==r&&ii(n);else{if("string"!=typeof r&&null===n.stateNode)throw Error(u(166));if(e=et.current,rX(n)){if(e=n.stateNode,t=n.memoizedProps,r=null,null!==(l=r$))switch(l.tag){case 27:case 5:r=l.memoizedProps}e[eW]=n,(e=!!(e.nodeValue===t||null!==r&&!0===r.suppressHydrationWarning||cn(e.nodeValue,t)))||rK(n,!0)}else(e=cu(e).createTextNode(r))[eW]=n,n.stateNode=e}return ip(n),null;case 31:if(t=n.memoizedState,null===e||null!==e.memoizedState){if(r=rX(n),null!==t){if(null===e){if(!r)throw Error(u(318));if(!(e=null!==(e=n.memoizedState)?e.dehydrated:null))throw Error(u(557));e[eW]=n}else rZ(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;ip(n),e=!1}else t=rJ(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=t),e=!0;if(!e){if(256&n.flags)return l7(n),n;return l7(n),null}if(0!=(128&n.flags))throw Error(u(558))}return ip(n),null;case 13:if(r=n.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(l=rX(n),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(u(318));if(!(l=null!==(l=n.memoizedState)?l.dehydrated:null))throw Error(u(317));l[eW]=n}else rZ(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;ip(n),l=!1}else l=rJ(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l){if(256&n.flags)return l7(n),n;return l7(n),null}}if(l7(n),0!=(128&n.flags))return n.lanes=t,n;return t=null!==r,e=null!==e&&null!==e.memoizedState,t&&(r=n.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),t!==e&&t&&(n.child.flags|=8192),ic(n,n.updateQueue),ip(n),null;case 4:return ea(),null===e&&s1(n.stateNode.containerInfo),n.flags|=0x4000000,ip(n),null;case 10:return r5(n.type),ip(n),null;case 19:if(at(n),null===(r=n.memoizedState))return ip(n),null;if(l=0!=(128&n.flags),null===(a=r.rendering))if(l)id(r,!1);else{if(0!==uO||null!==e&&0!=(128&e.flags))for(e=n.child;null!==e;){if(null!==(a=ar(e))){for(n.flags|=128,id(r,!1),n.updateQueue=e=a.updateQueue,ic(n,e),n.subtreeFlags=0,e=t,t=n.child;null!==t;)rk(t,e),t=t.sibling;return an(n,1&ae.current|2),rH&&rA(n,r.treeForkCount),n.child}e=e.sibling}null!==r.tail&&ev()>uj&&(n.flags|=128,l=!0,id(r,!1),n.lanes=4194304)}else{if(!l)if(null!==(e=ar(a))){if(n.flags|=128,l=!0,n.updateQueue=e=e.updateQueue,ic(n,e),id(r,!0),null===r.tail&&"collapsed"!==r.tailMode&&"visible"!==r.tailMode&&!a.alternate&&!rH)return ip(n),null}else 2*ev()-r.renderingStartTime>uj&&0x20000000!==t&&(n.flags|=128,l=!0,id(r,!1),n.lanes=4194304);r.isBackwards?(a.sibling=n.child,n.child=a):(null!==(e=r.last)?e.sibling=a:n.child=a,r.last=a)}if(null!==r.tail){e=r.tail;e:{for(t=e;null!==t;){if(null!==t.alternate){t=!1;break e}t=t.sibling}t=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ev(),e.sibling=null,a=ae.current,a=l?1&a|2:1&a,"visible"===r.tailMode||"collapsed"===r.tailMode||!t||rH?an(n,a):(t=a,J(l3,n),J(ae,t),null===l4&&(l4=n)),rH&&rA(n,r.treeForkCount),e}return ip(n),null;case 22:case 23:return l7(n),l2(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(ip(n),6&n.subtreeFlags&&(n.flags|=8192)):ip(n),null!==(t=n.updateQueue)&&ic(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&Z(ly),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),r5(li),ip(n),null;case 25:return null;case 30:return n.flags|=0x2000000,ip(n),null}throw Error(u(156,n.tag))}(n.alternate,n,uL);if(null!==t){ux=t;return}if(null!==(n=n.sibling)){ux=n;return}ux=n=e}while(null!==n)0===uO&&(uO=5)}function sm(e,n){do{var t=function(e,n){switch(rV(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return r5(li),ea(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return ei(n),null;case 31:if(null!==n.memoizedState){if(l7(n),null===n.alternate)throw Error(u(340));rZ()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(l7(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(u(340));rZ()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return at(n),65536&(e=n.flags)?(n.flags=-65537&e|128,null!==(e=n.memoizedState)&&(e.rendering=null,e.tail=null),n.flags|=4,n):null;case 4:return ea(),null;case 10:return r5(n.type),null;case 22:case 23:return l7(n),l2(),null!==e&&Z(ly),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return r5(li),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,ux=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){ux=e;return}ux=e=t}while(null!==e)uO=6,ux=null}function sh(e,n,t,r,l,a,o,i,s,c,f){e.cancelPendingCommit=null;do sS();while(0!==uW)if(0!=(6&uS))throw Error(u(327));if(null!==n){var d;if(n===e.current)throw Error(u(177));if(!function(e,n,t,r,l,a){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var i=e.entanglements,u=e.expirationTimes,s=e.hiddenUpdates;for(t=o&~t;0fc){i.length=o;break}d=new Promise(cC.bind(d)),i.push(d)}}}return 0g&&(o=g,g=h,h=o);var v=tB(i,h),y=tB(i,g);if(v&&y&&(1!==p.rangeCount||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var b=f.createRange();b.setStart(v.node,v.offset),p.removeAllRanges(),h>g?(p.addRange(b),p.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),p.addRange(b))}}}}for(f=[],p=i;p=p.parentNode;)1===p.nodeType&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;it?32:t,W.T=null,t=uX,uX=null;var a=uq,o=uY;if(uW=0,uK=uq=null,uY=0,0!=(6&uS))throw Error(u(331));var i=uS;if(uS|=4,uy(a.current),uf(a,a.current,o,t),uS=i,sR(0,!1),eN&&"function"==typeof eN.onPostCommitFiberRoot)try{eN.onPostCommitFiberRoot(ex,a)}catch(e){}return!0}finally{q.p=l,W.T=r,sw(e,n)}}function sx(e,n,t){n=rP(t,n),n=oM(e.stateNode,n,2),null!==(e=lH(e,n,2))&&(eA(e,2),sA(e))}function sN(e,n,t){if(3===e.tag)sx(e,e,t);else for(;null!==n;){if(3===n.tag){sx(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===uQ||!uQ.has(r))){e=rP(t,e),null!==(r=lH(n,t=oA(2),2))&&(oR(t,r,n,e),eA(r,2),sA(r));break}}n=n.return}}function sC(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new uw;var l=new Set;r.set(n,l)}else void 0===(l=r.get(n))&&(l=new Set,r.set(n,l));l.has(t)||(u_=!0,l.add(t),e=sP.bind(null,e,n,t),n.then(e,e))}function sP(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,uE===e&&(uN&t)===t&&(4===uO||3===uO&&(0x3c00000&uN)===uN&&300>ev()-uB?0==(2&uS)&&sr(e,0):uI|=t,uA===uN&&(uA=0)),sA(e)}function sz(e,n){0===n&&(n=eI()),null!==(e=rd(e,n))&&(eA(e,n),sA(e))}function sT(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),sz(e,t)}function s_(e,n){var t=0;switch(e.tag){case 31:case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(t=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(u(314))}null!==r&&r.delete(n),sz(e,t)}var sL=null,sO=null,sD=!1,sF=!1,sI=!1,sM=0;function sA(e){e!==sO&&null===e.next&&(null===sO?sL=sO=e:sO=sO.next=e),sF=!0,sD||(sD=!0,cg(function(){0!=(6&uS)?ep(eb,sU):sV()}))}function sR(e,n){if(!sI&&sF){sI=!0;do for(var t=!1,r=sL;null!==r;){if(!n)if(0!==e){var l=r.pendingLanes;if(0===l)var a=0;else{var o=r.suspendedLanes,i=r.pingedLanes;a=0xc000095&(a=(1<<31-eC(42|e)+1)-1&(l&~(o&~i)))?0xc000095&a|1:a?2|a:0}0!==a&&(t=!0,sj(r,a))}else a=uN,0==(3&(a=eD(r,r===uE?a:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||eF(r,a)||(t=!0,sj(r,a));r=r.next}while(t)sI=!1}}function sU(){sV()}function sV(){sF=sD=!1;var e,n=0;0===sM||((e=window.event)&&"popstate"===e.type?e===cd||(cd=e,0):(cd=null,1))||(n=sM);for(var t=ev(),r=null,l=sL;null!==l;){var a=l.next,o=sB(l,t);0===o?(l.next=null,null===r?sL=a:r.next=a,null===a&&(sO=r)):(r=l,(0!==n||0!=(3&o))&&(sF=!0)),l=a}0!==uW&&5!==uW||sR(n,!1),0!==sM&&(sM=0)}function sB(e,n){for(var t=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0 title"):null)}function fo(e,n){return"img"===e&&null!=n.src&&""!==n.src&&null==n.onLoad&&"lazy"!==n.loading}function fi(e){return"stylesheet"!==e.type||0!=(3&e.state.loading)}function fu(e){return(e.width||100)*(e.height||100)*("number"==typeof devicePixelRatio?devicePixelRatio:1)*.25}function fs(e,n){"function"==typeof n.decode&&(e.imgCount++,n.complete||(e.imgBytes+=fu(n),e.suspenseyImages.push(n)),e=fp.bind(e),n.decode().then(e,e))}var fc=0;function ff(e){if(0===e.count&&(0===e.imgCount||!e.waitingForImages)){if(e.stylesheets)fh(e,e.stylesheets);else if(e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}}}function fd(){this.count--,ff(this)}function fp(){this.imgCount--,ff(this)}var fm=null;function fh(e,n){e.stylesheets=null,null!==e.unsuspend&&(e.count++,fm=new Map,n.forEach(fg,e),fm=null,fd.call(e))}function fg(e,n){if(!(4&n.state.loading)){var t=fm.get(e);if(t)var r=t.get(null);else{t=new Map,fm.set(e,t);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;atypeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var f1=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!f1.isDisabled&&f1.supportsFiber)try{ex=f1.inject({bundleType:0,version:"19.3.0-canary-f93b9fd4-20251217",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.3.0-canary-f93b9fd4-20251217"}),eN=f1}catch(e){}}t.createRoot=function(e,n){if(!s(e))throw Error(u(299));var t=!1,r="",l=oL,a=oO,o=oD;return null!=n&&(!0===n.unstable_strictMode&&(t=!0),void 0!==n.identifierPrefix&&(r=n.identifierPrefix),void 0!==n.onUncaughtError&&(l=n.onUncaughtError),void 0!==n.onCaughtError&&(a=n.onCaughtError),void 0!==n.onRecoverableError&&(o=n.onRecoverableError)),n=fb(e,1,!1,null,null,t,r,null,l,a,o,fX),e[eK]=n.current,s1(e),new fZ(n)},t.hydrateRoot=function(e,n,t){if(!s(e))throw Error(u(299));var r,l=!1,a="",o=oL,i=oO,c=oD,f=null;return null!=t&&(!0===t.unstable_strictMode&&(l=!0),void 0!==t.identifierPrefix&&(a=t.identifierPrefix),void 0!==t.onUncaughtError&&(o=t.onUncaughtError),void 0!==t.onCaughtError&&(i=t.onCaughtError),void 0!==t.onRecoverableError&&(c=t.onRecoverableError),void 0!==t.formState&&(f=t.formState)),(n=fb(e,1,!0,n,null!=t?t:null,l,a,f,o,i,c,fX)).context=(r=null,rh),t=n.current,(a=lj(l=eB(l=u4()))).callback=null,lH(t,a,l),t=l,n.current.lanes=t,eA(n,t),sA(n),e[eK]=n.current,s1(e),new fJ(n)},t.version="19.3.0-canary-f93b9fd4-20251217"},88014,(e,n,t)=>{"use strict";!function e(){if("u">typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),n.exports=e.r(46480)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/07f1e4bb8e7d8066.js b/docs/_next/static/chunks/07f1e4bb8e7d8066.js new file mode 100644 index 00000000..bf893e01 --- /dev/null +++ b/docs/_next/static/chunks/07f1e4bb8e7d8066.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,66027,t=>{"use strict";var e=t.i(69230),r=t.i(69637);function c(t,c){return(0,r.useBaseQuery)(t,e.QueryObserver,c)}t.s(["useQuery",()=>c])},11152,40141,t=>{"use strict";var e=t.i(71645),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},c=e.default.createContext&&e.default.createContext(r),n=["attr","size","title"];function o(){return(o=Object.assign.bind()).apply(this,arguments)}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);e&&(c=c.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,c)}return r}function l(t){for(var e=1;ee.default.createElement(u,o({attr:l({},t.attr)},r),function t(r){return r&&r.map((r,c)=>e.default.createElement(r.tag,l({key:c},r.attr),t(r.child)))}(t.child))}function u(t){var i=r=>{var c,{attr:i,size:a,title:u}=t,s=function(t,e){if(null==t)return{};var r,c,n=function(t,e){if(null==t)return{};var r={};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){if(e.indexOf(c)>=0)continue;r[c]=t[c]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}(t,n),f=a||r.size||"1em";return r.className&&(c=r.className),t.className&&(c=(c?c+" ":"")+t.className),e.default.createElement("svg",o({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,s,{className:c,style:l(l({color:t.color||r.color},r.style),t.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),u&&e.default.createElement("title",null,u),t.children)};return void 0!==c?e.default.createElement(c.Consumer,null,t=>i(t)):i(r)}function s(t){return a({tag:"svg",attr:{viewBox:"0 0 288 512"},child:[{tag:"path",attr:{d:"M112 316.94v156.69l22.02 33.02c4.75 7.12 15.22 7.12 19.97 0L176 473.63V316.94c-10.39 1.92-21.06 3.06-32 3.06s-21.61-1.14-32-3.06zM144 0C64.47 0 0 64.47 0 144s64.47 144 144 144 144-64.47 144-144S223.53 0 144 0zm0 76c-37.5 0-68 30.5-68 68 0 6.62-5.38 12-12 12s-12-5.38-12-12c0-50.73 41.28-92 92-92 6.62 0 12 5.38 12 12s-5.38 12-12 12z"},child:[]}]})(t)}function f(t){return a({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},child:[]}]})(t)}function p(t){return a({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},child:[]}]})(t)}t.s(["GenIcon",()=>a],40141),t.s(["FaMapPin",()=>s,"FaVolumeMute",()=>f,"FaVolumeUp",()=>p],11152)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/6e74e9455d83b68c.js b/docs/_next/static/chunks/13f8b467e8aa89cb.js similarity index 99% rename from docs/_next/static/chunks/6e74e9455d83b68c.js rename to docs/_next/static/chunks/13f8b467e8aa89cb.js index d775bbba..376611e8 100644 --- a/docs/_next/static/chunks/6e74e9455d83b68c.js +++ b/docs/_next/static/chunks/13f8b467e8aa89cb.js @@ -1,4 +1,4 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42585,e=>{"use strict";var t=e.i(43476),a=e.i(932),o=e.i(71645),i=e.i(31067),r=e.i(90072);let n=o.forwardRef(({args:e,children:t,...a},r)=>{let n=o.useRef(null);return o.useImperativeHandle(r,()=>n.current),o.useLayoutEffect(()=>void 0),o.createElement("mesh",(0,i.default)({ref:n},a),o.createElement("boxGeometry",{attach:"geometry",args:e}),t)});var l=e.i(47071),s=e.i(49774),u=e.i(73949),c=e.i(12979),f=e.i(62395),v=e.i(75567),d=e.i(48066),m=e.i(47021);let p=` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42585,e=>{"use strict";var t=e.i(43476),a=e.i(932),o=e.i(71645),i=e.i(31067),r=e.i(90072);let n=o.forwardRef(({args:e,children:t,...a},r)=>{let n=o.useRef(null);return o.useImperativeHandle(r,()=>n.current),o.useLayoutEffect(()=>void 0),o.createElement("mesh",(0,i.default)({ref:n},a),o.createElement("boxGeometry",{attach:"geometry",args:e}),t)});var l=e.i(47071),s=e.i(71753),u=e.i(15080),c=e.i(12979),f=e.i(62395),v=e.i(75567),d=e.i(48066),m=e.i(47021);let p=` #include #ifdef USE_FOG diff --git a/docs/_next/static/chunks/dce1ee0e89ee93db.js b/docs/_next/static/chunks/1627bf2f54f2038d.js similarity index 56% rename from docs/_next/static/chunks/dce1ee0e89ee93db.js rename to docs/_next/static/chunks/1627bf2f54f2038d.js index 6f3e6eba..16c05926 100644 --- a/docs/_next/static/chunks/dce1ee0e89ee93db.js +++ b/docs/_next/static/chunks/1627bf2f54f2038d.js @@ -1,4 +1,4 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12718,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"InvariantError",{enumerable:!0,get:function(){return n}});class n extends Error{constructor(e,t){super(`Invariant: ${e.endsWith(".")?e:e+"."} This is a bug in Next.js.`,t),this.name="InvariantError"}}},55682,(e,t,r)=>{"use strict";r._=function(e){return e&&e.__esModule?e:{default:e}}},32061,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={BailoutToCSRError:function(){return u},isBailoutToCSRError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="BAILOUT_TO_CLIENT_SIDE_RENDERING";class u extends Error{constructor(e){super(`Bail out to client-side rendering: ${e}`),this.reason=e,this.digest=a}}function i(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===a}},54394,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={HTTPAccessErrorStatus:function(){return a},HTTP_ERROR_FALLBACK_ERROR_CODE:function(){return i},getAccessFallbackErrorTypeByStatus:function(){return l},getAccessFallbackHTTPStatus:function(){return s},isHTTPAccessFallbackError:function(){return c}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a={NOT_FOUND:404,FORBIDDEN:403,UNAUTHORIZED:401},u=new Set(Object.values(a)),i="NEXT_HTTP_ERROR_FALLBACK";function c(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,r]=e.digest.split(";");return t===i&&u.has(Number(r))}function s(e){return Number(e.digest.split(";")[1])}function l(e){switch(e){case 401:return"unauthorized";case 403:return"forbidden";case 404:return"not-found";default:return}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},76963,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"RedirectStatusCode",{enumerable:!0,get:function(){return o}});var n,o=((n={})[n.SeeOther=303]="SeeOther",n[n.TemporaryRedirect=307]="TemporaryRedirect",n[n.PermanentRedirect=308]="PermanentRedirect",n);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},68391,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o={REDIRECT_ERROR_CODE:function(){return i},RedirectType:function(){return c},isRedirectError:function(){return s}};for(var a in o)Object.defineProperty(r,a,{enumerable:!0,get:o[a]});let u=e.r(76963),i="NEXT_REDIRECT";var c=((n={}).push="push",n.replace="replace",n);function s(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let t=e.digest.split(";"),[r,n]=t,o=t.slice(2,-2).join(";"),a=Number(t.at(-2));return r===i&&("replace"===n||"push"===n)&&"string"==typeof o&&!isNaN(a)&&a in u.RedirectStatusCode}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},65713,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isNextRouterError",{enumerable:!0,get:function(){return a}});let n=e.r(54394),o=e.r(68391);function a(e){return(0,o.isRedirectError)(e)||(0,n.isHTTPAccessFallbackError)(e)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},3680,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ReadonlyURLSearchParams",{enumerable:!0,get:function(){return o}});class n extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class o extends URLSearchParams{append(){throw new n}delete(){throw new n}set(){throw new n}sort(){throw new n}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},61994,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={NavigationPromisesContext:function(){return l},PathParamsContext:function(){return s},PathnameContext:function(){return c},ReadonlyURLSearchParams:function(){return u.ReadonlyURLSearchParams},SearchParamsContext:function(){return i},createDevToolsInstrumentedPromise:function(){return d}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(71645),u=e.r(3680),i=(0,a.createContext)(null),c=(0,a.createContext)(null),s=(0,a.createContext)(null),l=(0,a.createContext)(null);function d(e,t){let r=Promise.resolve(t);return r.status="fulfilled",r.value=t,r.displayName=`${e} (SSR)`,r}},45955,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workUnitAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},21768,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ACTION_HEADER:function(){return u},FLIGHT_HEADERS:function(){return y},NEXT_ACTION_NOT_FOUND_HEADER:function(){return R},NEXT_ACTION_REVALIDATED_HEADER:function(){return P},NEXT_DID_POSTPONE_HEADER:function(){return h},NEXT_HMR_REFRESH_HASH_COOKIE:function(){return d},NEXT_HMR_REFRESH_HEADER:function(){return l},NEXT_HTML_REQUEST_ID_HEADER:function(){return v},NEXT_IS_PRERENDER_HEADER:function(){return g},NEXT_REQUEST_ID_HEADER:function(){return O},NEXT_REWRITTEN_PATH_HEADER:function(){return b},NEXT_REWRITTEN_QUERY_HEADER:function(){return E},NEXT_ROUTER_PREFETCH_HEADER:function(){return c},NEXT_ROUTER_SEGMENT_PREFETCH_HEADER:function(){return s},NEXT_ROUTER_STALE_TIME_HEADER:function(){return m},NEXT_ROUTER_STATE_TREE_HEADER:function(){return i},NEXT_RSC_UNION_QUERY:function(){return _},NEXT_URL:function(){return f},RSC_CONTENT_TYPE_HEADER:function(){return p},RSC_HEADER:function(){return a}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="rsc",u="next-action",i="next-router-state-tree",c="next-router-prefetch",s="next-router-segment-prefetch",l="next-hmr-refresh",d="__next_hmr_refresh_hash__",f="next-url",p="text/x-component",y=[a,i,c,l,s],_="_rsc",m="x-nextjs-stale-time",h="x-nextjs-postponed",b="x-nextjs-rewritten-path",E="x-nextjs-rewritten-query",g="x-nextjs-prerender",R="x-nextjs-action-not-found",O="x-nextjs-request-id",v="x-nextjs-html-request-id",P="x-action-revalidated";("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},62141,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getCacheSignal:function(){return m},getDraftModeProviderForCacheScope:function(){return _},getHmrRefreshHash:function(){return f},getPrerenderResumeDataCache:function(){return l},getRenderResumeDataCache:function(){return d},getRuntimeStagePromise:function(){return h},getServerComponentsHmrCache:function(){return y},isHmrRefresh:function(){return p},throwForMissingRequestStore:function(){return c},throwInvariantForMissingStore:function(){return s},workUnitAsyncStorage:function(){return a.workUnitAsyncStorageInstance}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(45955),u=e.r(21768),i=e.r(12718);function c(e){throw Object.defineProperty(Error(`\`${e}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`),"__NEXT_ERROR_CODE",{value:"E251",enumerable:!1,configurable:!0})}function s(){throw Object.defineProperty(new i.InvariantError("Expected workUnitAsyncStorage to have a store."),"__NEXT_ERROR_CODE",{value:"E696",enumerable:!1,configurable:!0})}function l(e){switch(e.type){case"prerender":case"prerender-runtime":case"prerender-ppr":case"prerender-client":return e.prerenderResumeDataCache;case"request":if(e.prerenderResumeDataCache)return e.prerenderResumeDataCache;case"prerender-legacy":case"cache":case"private-cache":case"unstable-cache":return null;default:return e}}function d(e){switch(e.type){case"request":case"prerender":case"prerender-runtime":case"prerender-client":if(e.renderResumeDataCache)return e.renderResumeDataCache;case"prerender-ppr":return e.prerenderResumeDataCache??null;case"cache":case"private-cache":case"unstable-cache":case"prerender-legacy":return null;default:return e}}function f(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"prerender":case"prerender-runtime":return t.hmrRefreshHash;case"request":var r;return null==(r=t.cookies.get(u.NEXT_HMR_REFRESH_HASH_COOKIE))?void 0:r.value}}function p(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"request":return t.isHmrRefresh??!1}return!1}function y(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"request":return t.serverComponentsHmrCache}}function _(e,t){if(e.isDraftMode)switch(t.type){case"cache":case"private-cache":case"unstable-cache":case"prerender-runtime":case"request":return t.draftMode}}function m(e){switch(e.type){case"prerender":case"prerender-client":case"prerender-runtime":return e.cacheSignal;case"request":if(e.cacheSignal)return e.cacheSignal;case"prerender-ppr":case"prerender-legacy":case"cache":case"private-cache":case"unstable-cache":return null;default:return e}}function h(e){switch(e.type){case"prerender-runtime":case"private-cache":return e.runtimeStagePromise;case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":case"request":case"cache":case"unstable-cache":return null;default:return e}}},90809,(e,t,r)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}r._=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var o={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(o,u,i):o[u]=e[u]}return o.default=e,r&&r.set(e,o),o}},13258,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DEFAULT_SEGMENT_KEY:function(){return d},NOT_FOUND_SEGMENT_KEY:function(){return f},PAGE_SEGMENT_KEY:function(){return l},addSearchParamsIfPageSegment:function(){return c},computeSelectedLayoutSegment:function(){return s},getSegmentValue:function(){return a},getSelectedLayoutSegmentPath:function(){return function e(t,r,n=!0,o=[]){let u;if(n)u=t[1][r];else{let e=t[1];u=e.children??Object.values(e)[0]}if(!u)return o;let i=a(u[0]);return!i||i.startsWith(l)?o:(o.push(i),e(u,r,!1,o))}},isGroupSegment:function(){return u},isParallelRouteSegment:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){return Array.isArray(e)?e[1]:e}function u(e){return"("===e[0]&&e.endsWith(")")}function i(e){return e.startsWith("@")&&"@children"!==e}function c(e,t){if(e.includes(l)){let e=JSON.stringify(t);return"{}"!==e?l+"?"+e:l}return e}function s(e,t){if(!e||0===e.length)return null;let r="children"===t?e[0]:e[e.length-1];return r===d?null:r}let l="__PAGE__",d="__DEFAULT__",f="/_not-found"},92838,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={UnrecognizedActionError:function(){return a},unstable_isUnrecognizedActionError:function(){return u}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});class a extends Error{constructor(...e){super(...e),this.name="UnrecognizedActionError"}}function u(e){return!!(e&&"object"==typeof e&&e instanceof a)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},34457,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"actionAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},62266,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"actionAsyncStorage",{enumerable:!0,get:function(){return n.actionAsyncStorageInstance}});let n=e.r(34457)},24063,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return p},getRedirectTypeFromError:function(){return f},getURLFromRedirectError:function(){return d},permanentRedirect:function(){return l},redirect:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(76963),u=e.r(68391),i="undefined"==typeof window?e.r(62266).actionAsyncStorage:void 0;function c(e,t,r=a.RedirectStatusCode.TemporaryRedirect){let n=Object.defineProperty(Error(u.REDIRECT_ERROR_CODE),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n.digest=`${u.REDIRECT_ERROR_CODE};${t};${e};${r};`,n}function s(e,t){throw c(e,t??=i?.getStore()?.isAction?u.RedirectType.push:u.RedirectType.replace,a.RedirectStatusCode.TemporaryRedirect)}function l(e,t=u.RedirectType.replace){throw c(e,t,a.RedirectStatusCode.PermanentRedirect)}function d(e){return(0,u.isRedirectError)(e)?e.digest.split(";").slice(2,-2).join(";"):null}function f(e){if(!(0,u.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return e.digest.split(";",2)[1]}function p(e){if(!(0,u.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return Number(e.digest.split(";").at(-2))}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},8372,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={AppRouterContext:function(){return u},GlobalLayoutRouterContext:function(){return c},LayoutRouterContext:function(){return i},MissingSlotContext:function(){return l},TemplateContext:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(55682)._(e.r(71645)),u=a.default.createContext(null),i=a.default.createContext(null),c=a.default.createContext(null),s=a.default.createContext(null),l=a.default.createContext(new Set)},13957,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ServerInsertedHTMLContext:function(){return u},useServerInsertedHTML:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(90809)._(e.r(71645)),u=a.default.createContext(null);function i(e){let t=(0,a.useContext)(u);t&&t(e)}},22783,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"notFound",{enumerable:!0,get:function(){return a}});let n=e.r(54394),o=`${n.HTTP_ERROR_FALLBACK_ERROR_CODE};404`;function a(){let e=Object.defineProperty(Error(o),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});throw e.digest=o,e}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},79854,(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E488",enumerable:!1,configurable:!0})}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"forbidden",{enumerable:!0,get:function(){return n}}),e.r(54394).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},22683,(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E411",enumerable:!1,configurable:!0})}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unauthorized",{enumerable:!0,get:function(){return n}}),e.r(54394).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},15507,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,o.isNextRouterError)(t)||(0,n.isBailoutToCSRError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=e.r(32061),o=e.r(65713);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},63138,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={isHangingPromiseRejectionError:function(){return a},makeDevtoolsIOAwarePromise:function(){return d},makeHangingPromise:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===u}let u="HANGING_PROMISE_REJECTION";class i extends Error{constructor(e,t){super(`During prerendering, ${t} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${t} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context. This occurred at route "${e}".`),this.route=e,this.expression=t,this.digest=u}}let c=new WeakMap;function s(e,t,r){if(e.aborted)return Promise.reject(new i(t,r));{let n=new Promise((n,o)=>{let a=o.bind(null,new i(t,r)),u=c.get(e);if(u)u.push(a);else{let t=[a];c.set(e,t),e.addEventListener("abort",()=>{for(let e=0;e{setTimeout(()=>{t(e)},0)})}},67287,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isPostpone",{enumerable:!0,get:function(){return o}});let n=Symbol.for("react.postpone");function o(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}},76353,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DynamicServerError:function(){return u},isDynamicServerError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="DYNAMIC_SERVER_USAGE";class u extends Error{constructor(e){super(`Dynamic server usage: ${e}`),this.description=e,this.digest=a}}function i(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===a}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},43248,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={StaticGenBailoutError:function(){return u},isStaticGenBailoutError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="NEXT_STATIC_GEN_BAILOUT";class u extends Error{constructor(...e){super(...e),this.code=a}}function i(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===a}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},54839,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={METADATA_BOUNDARY_NAME:function(){return a},OUTLET_BOUNDARY_NAME:function(){return i},ROOT_LAYOUT_BOUNDARY_NAME:function(){return c},VIEWPORT_BOUNDARY_NAME:function(){return u}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="__next_metadata_boundary__",u="__next_viewport_boundary__",i="__next_outlet_boundary__",c="__next_root_layout_boundary__"},29419,(e,t,r)=>{"use strict";var n=e.i(47167);Object.defineProperty(r,"__esModule",{value:!0});var o={atLeastOneTask:function(){return c},scheduleImmediate:function(){return i},scheduleOnNextTick:function(){return u},waitAtLeastOneReactRenderTask:function(){return s}};for(var a in o)Object.defineProperty(r,a,{enumerable:!0,get:o[a]});let u=e=>{Promise.resolve().then(()=>{n.default.nextTick(e)})},i=e=>{setImmediate(e)};function c(){return new Promise(e=>i(e))}function s(){return new Promise(e=>setImmediate(e))}},67673,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o,a={Postpone:function(){return T},PreludeState:function(){return J},abortAndThrowOnSynchronousRequestDataAccess:function(){return S},abortOnSynchronousPlatformIOAccess:function(){return j},accessedDynamicData:function(){return k},annotateDynamicAccess:function(){return $},consumeDynamicAccess:function(){return I},createDynamicTrackingState:function(){return b},createDynamicValidationState:function(){return E},createHangingInputAbortSignal:function(){return L},createRenderInBrowserAbortSignal:function(){return H},delayUntilRuntimeStage:function(){return er},formatDynamicAPIAccesses:function(){return U},getFirstDynamicReason:function(){return g},getStaticShellDisallowedDynamicReasons:function(){return et},isDynamicPostpone:function(){return x},isPrerenderInterruptedError:function(){return N},logDisallowedDynamicError:function(){return Z},markCurrentScopeAsDynamic:function(){return R},postponeWithTracking:function(){return w},throwIfDisallowedDynamic:function(){return ee},throwToInterruptStaticGeneration:function(){return O},trackAllowedDynamicAccess:function(){return z},trackDynamicDataInDynamicRender:function(){return v},trackDynamicHoleInRuntimeShell:function(){return K},trackDynamicHoleInStaticShell:function(){return V},useDynamicRouteParams:function(){return X},useDynamicSearchParams:function(){return B}};for(var u in a)Object.defineProperty(r,u,{enumerable:!0,get:a[u]});let i=(n=e.r(71645))&&n.__esModule?n:{default:n},c=e.r(76353),s=e.r(43248),l=e.r(62141),d=e.r(63599),f=e.r(63138),p=e.r(54839),y=e.r(29419),_=e.r(32061),m=e.r(12718),h="function"==typeof i.default.unstable_postpone;function b(e){return{isDebugDynamicAccesses:e,dynamicAccesses:[],syncDynamicErrorWithStack:null}}function E(){return{hasSuspenseAboveBody:!1,hasDynamicMetadata:!1,dynamicMetadata:null,hasDynamicViewport:!1,hasAllowedDynamic:!1,dynamicErrors:[]}}function g(e){var t;return null==(t=e.dynamicAccesses[0])?void 0:t.expression}function R(e,t,r){if(t)switch(t.type){case"cache":case"unstable-cache":case"private-cache":return}if(!e.forceDynamic&&!e.forceStatic){if(e.dynamicShouldError)throw Object.defineProperty(new s.StaticGenBailoutError(`Route ${e.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${r}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E553",enumerable:!1,configurable:!0});if(t)switch(t.type){case"prerender-ppr":return w(e.route,r,t.dynamicTracking);case"prerender-legacy":t.revalidate=0;let n=Object.defineProperty(new c.DynamicServerError(`Route ${e.route} couldn't be rendered statically because it used ${r}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E550",enumerable:!1,configurable:!0});throw e.dynamicUsageDescription=r,e.dynamicUsageStack=n.stack,n}}}function O(e,t,r){let n=Object.defineProperty(new c.DynamicServerError(`Route ${t.route} couldn't be rendered statically because it used \`${e}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E558",enumerable:!1,configurable:!0});throw r.revalidate=0,t.dynamicUsageDescription=e,t.dynamicUsageStack=n.stack,n}function v(e){switch(e.type){case"cache":case"unstable-cache":case"private-cache":return}}function P(e,t,r){let n=C(`Route ${e} needs to bail out of prerendering at this point because it used ${t}.`);r.controller.abort(n);let o=r.dynamicTracking;o&&o.dynamicAccesses.push({stack:o.isDebugDynamicAccesses?Error().stack:void 0,expression:t})}function j(e,t,r,n){let o=n.dynamicTracking;P(e,t,n),o&&null===o.syncDynamicErrorWithStack&&(o.syncDynamicErrorWithStack=r)}function S(e,t,r,n){if(!1===n.controller.signal.aborted){P(e,t,n);let o=n.dynamicTracking;o&&null===o.syncDynamicErrorWithStack&&(o.syncDynamicErrorWithStack=r)}throw C(`Route ${e} needs to bail out of prerendering at this point because it used ${t}.`)}function T({reason:e,route:t}){let r=l.workUnitAsyncStorage.getStore();w(t,e,r&&"prerender-ppr"===r.type?r.dynamicTracking:null)}function w(e,t,r){(function(){if(!h)throw Object.defineProperty(Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E224",enumerable:!1,configurable:!0})})(),r&&r.dynamicAccesses.push({stack:r.isDebugDynamicAccesses?Error().stack:void 0,expression:t}),i.default.unstable_postpone(D(e,t))}function D(e,t){return`Route ${e} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`}function x(e){return"object"==typeof e&&null!==e&&"string"==typeof e.message&&A(e.message)}function A(e){return e.includes("needs to bail out of prerendering at this point because it used")&&e.includes("Learn more: https://nextjs.org/docs/messages/ppr-caught-error")}if(!1===A(D("%%%","^^^")))throw Object.defineProperty(Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E296",enumerable:!1,configurable:!0});let M="NEXT_PRERENDER_INTERRUPTED";function C(e){let t=Object.defineProperty(Error(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t.digest=M,t}function N(e){return"object"==typeof e&&null!==e&&e.digest===M&&"name"in e&&"message"in e&&e instanceof Error}function k(e){return e.length>0}function I(e,t){return e.dynamicAccesses.push(...t.dynamicAccesses),e.dynamicAccesses}function U(e){return e.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12718,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"InvariantError",{enumerable:!0,get:function(){return n}});class n extends Error{constructor(e,t){super(`Invariant: ${e.endsWith(".")?e:e+"."} This is a bug in Next.js.`,t),this.name="InvariantError"}}},55682,(e,t,r)=>{"use strict";r._=function(e){return e&&e.__esModule?e:{default:e}}},32061,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={BailoutToCSRError:function(){return u},isBailoutToCSRError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="BAILOUT_TO_CLIENT_SIDE_RENDERING";class u extends Error{constructor(e){super(`Bail out to client-side rendering: ${e}`),this.reason=e,this.digest=a}}function i(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===a}},54394,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={HTTPAccessErrorStatus:function(){return a},HTTP_ERROR_FALLBACK_ERROR_CODE:function(){return i},getAccessFallbackErrorTypeByStatus:function(){return l},getAccessFallbackHTTPStatus:function(){return s},isHTTPAccessFallbackError:function(){return c}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a={NOT_FOUND:404,FORBIDDEN:403,UNAUTHORIZED:401},u=new Set(Object.values(a)),i="NEXT_HTTP_ERROR_FALLBACK";function c(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,r]=e.digest.split(";");return t===i&&u.has(Number(r))}function s(e){return Number(e.digest.split(";")[1])}function l(e){switch(e){case 401:return"unauthorized";case 403:return"forbidden";case 404:return"not-found";default:return}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},76963,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"RedirectStatusCode",{enumerable:!0,get:function(){return o}});var n,o=((n={})[n.SeeOther=303]="SeeOther",n[n.TemporaryRedirect=307]="TemporaryRedirect",n[n.PermanentRedirect=308]="PermanentRedirect",n);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},68391,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o={REDIRECT_ERROR_CODE:function(){return i},RedirectType:function(){return c},isRedirectError:function(){return s}};for(var a in o)Object.defineProperty(r,a,{enumerable:!0,get:o[a]});let u=e.r(76963),i="NEXT_REDIRECT";var c=((n={}).push="push",n.replace="replace",n);function s(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let t=e.digest.split(";"),[r,n]=t,o=t.slice(2,-2).join(";"),a=Number(t.at(-2));return r===i&&("replace"===n||"push"===n)&&"string"==typeof o&&!isNaN(a)&&a in u.RedirectStatusCode}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},65713,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isNextRouterError",{enumerable:!0,get:function(){return a}});let n=e.r(54394),o=e.r(68391);function a(e){return(0,o.isRedirectError)(e)||(0,n.isHTTPAccessFallbackError)(e)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},3680,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ReadonlyURLSearchParams",{enumerable:!0,get:function(){return o}});class n extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class o extends URLSearchParams{append(){throw new n}delete(){throw new n}set(){throw new n}sort(){throw new n}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},61994,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={NavigationPromisesContext:function(){return l},PathParamsContext:function(){return s},PathnameContext:function(){return c},ReadonlyURLSearchParams:function(){return u.ReadonlyURLSearchParams},SearchParamsContext:function(){return i},createDevToolsInstrumentedPromise:function(){return d}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(71645),u=e.r(3680),i=(0,a.createContext)(null),c=(0,a.createContext)(null),s=(0,a.createContext)(null),l=(0,a.createContext)(null);function d(e,t){let r=Promise.resolve(t);return r.status="fulfilled",r.value=t,r.displayName=`${e} (SSR)`,r}},45955,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workUnitAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},21768,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ACTION_HEADER:function(){return u},FLIGHT_HEADERS:function(){return y},NEXT_ACTION_NOT_FOUND_HEADER:function(){return R},NEXT_ACTION_REVALIDATED_HEADER:function(){return P},NEXT_DID_POSTPONE_HEADER:function(){return h},NEXT_HMR_REFRESH_HASH_COOKIE:function(){return d},NEXT_HMR_REFRESH_HEADER:function(){return l},NEXT_HTML_REQUEST_ID_HEADER:function(){return v},NEXT_IS_PRERENDER_HEADER:function(){return g},NEXT_REQUEST_ID_HEADER:function(){return O},NEXT_REWRITTEN_PATH_HEADER:function(){return b},NEXT_REWRITTEN_QUERY_HEADER:function(){return E},NEXT_ROUTER_PREFETCH_HEADER:function(){return c},NEXT_ROUTER_SEGMENT_PREFETCH_HEADER:function(){return s},NEXT_ROUTER_STALE_TIME_HEADER:function(){return m},NEXT_ROUTER_STATE_TREE_HEADER:function(){return i},NEXT_RSC_UNION_QUERY:function(){return _},NEXT_URL:function(){return f},RSC_CONTENT_TYPE_HEADER:function(){return p},RSC_HEADER:function(){return a}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="rsc",u="next-action",i="next-router-state-tree",c="next-router-prefetch",s="next-router-segment-prefetch",l="next-hmr-refresh",d="__next_hmr_refresh_hash__",f="next-url",p="text/x-component",y=[a,i,c,l,s],_="_rsc",m="x-nextjs-stale-time",h="x-nextjs-postponed",b="x-nextjs-rewritten-path",E="x-nextjs-rewritten-query",g="x-nextjs-prerender",R="x-nextjs-action-not-found",O="x-nextjs-request-id",v="x-nextjs-html-request-id",P="x-action-revalidated";("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},62141,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getCacheSignal:function(){return m},getDraftModeProviderForCacheScope:function(){return _},getHmrRefreshHash:function(){return f},getPrerenderResumeDataCache:function(){return l},getRenderResumeDataCache:function(){return d},getRuntimeStagePromise:function(){return h},getServerComponentsHmrCache:function(){return y},isHmrRefresh:function(){return p},throwForMissingRequestStore:function(){return c},throwInvariantForMissingStore:function(){return s},workUnitAsyncStorage:function(){return a.workUnitAsyncStorageInstance}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(45955),u=e.r(21768),i=e.r(12718);function c(e){throw Object.defineProperty(Error(`\`${e}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`),"__NEXT_ERROR_CODE",{value:"E251",enumerable:!1,configurable:!0})}function s(){throw Object.defineProperty(new i.InvariantError("Expected workUnitAsyncStorage to have a store."),"__NEXT_ERROR_CODE",{value:"E696",enumerable:!1,configurable:!0})}function l(e){switch(e.type){case"prerender":case"prerender-runtime":case"prerender-ppr":case"prerender-client":return e.prerenderResumeDataCache;case"request":if(e.prerenderResumeDataCache)return e.prerenderResumeDataCache;case"prerender-legacy":case"cache":case"private-cache":case"unstable-cache":return null;default:return e}}function d(e){switch(e.type){case"request":case"prerender":case"prerender-runtime":case"prerender-client":if(e.renderResumeDataCache)return e.renderResumeDataCache;case"prerender-ppr":return e.prerenderResumeDataCache??null;case"cache":case"private-cache":case"unstable-cache":case"prerender-legacy":return null;default:return e}}function f(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"prerender":case"prerender-runtime":return t.hmrRefreshHash;case"request":var r;return null==(r=t.cookies.get(u.NEXT_HMR_REFRESH_HASH_COOKIE))?void 0:r.value}}function p(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"request":return t.isHmrRefresh??!1}return!1}function y(e,t){if(e.dev)switch(t.type){case"cache":case"private-cache":case"request":return t.serverComponentsHmrCache}}function _(e,t){if(e.isDraftMode)switch(t.type){case"cache":case"private-cache":case"unstable-cache":case"prerender-runtime":case"request":return t.draftMode}}function m(e){switch(e.type){case"prerender":case"prerender-client":case"prerender-runtime":return e.cacheSignal;case"request":if(e.cacheSignal)return e.cacheSignal;case"prerender-ppr":case"prerender-legacy":case"cache":case"private-cache":case"unstable-cache":return null;default:return e}}function h(e){switch(e.type){case"prerender-runtime":case"private-cache":return e.runtimeStagePromise;case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":case"request":case"cache":case"unstable-cache":return null;default:return e}}},90809,(e,t,r)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}r._=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var o={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(o,u,i):o[u]=e[u]}return o.default=e,r&&r.set(e,o),o}},13258,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DEFAULT_SEGMENT_KEY:function(){return d},NOT_FOUND_SEGMENT_KEY:function(){return f},PAGE_SEGMENT_KEY:function(){return l},addSearchParamsIfPageSegment:function(){return c},computeSelectedLayoutSegment:function(){return s},getSegmentValue:function(){return a},getSelectedLayoutSegmentPath:function(){return function e(t,r,n=!0,o=[]){let u;if(n)u=t[1][r];else{let e=t[1];u=e.children??Object.values(e)[0]}if(!u)return o;let i=a(u[0]);return!i||i.startsWith(l)?o:(o.push(i),e(u,r,!1,o))}},isGroupSegment:function(){return u},isParallelRouteSegment:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){return Array.isArray(e)?e[1]:e}function u(e){return"("===e[0]&&e.endsWith(")")}function i(e){return e.startsWith("@")&&"@children"!==e}function c(e,t){if(e.includes(l)){let e=JSON.stringify(t);return"{}"!==e?l+"?"+e:l}return e}function s(e,t){if(!e||0===e.length)return null;let r="children"===t?e[0]:e[e.length-1];return r===d?null:r}let l="__PAGE__",d="__DEFAULT__",f="/_not-found"},92838,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={UnrecognizedActionError:function(){return a},unstable_isUnrecognizedActionError:function(){return u}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});class a extends Error{constructor(...e){super(...e),this.name="UnrecognizedActionError"}}function u(e){return!!(e&&"object"==typeof e&&e instanceof a)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},34457,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"actionAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},62266,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"actionAsyncStorage",{enumerable:!0,get:function(){return n.actionAsyncStorageInstance}});let n=e.r(34457)},24063,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return p},getRedirectTypeFromError:function(){return f},getURLFromRedirectError:function(){return d},permanentRedirect:function(){return l},redirect:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(76963),u=e.r(68391),i="u"{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={AppRouterContext:function(){return u},GlobalLayoutRouterContext:function(){return c},LayoutRouterContext:function(){return i},MissingSlotContext:function(){return l},TemplateContext:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(55682)._(e.r(71645)),u=a.default.createContext(null),i=a.default.createContext(null),c=a.default.createContext(null),s=a.default.createContext(null),l=a.default.createContext(new Set)},13957,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ServerInsertedHTMLContext:function(){return u},useServerInsertedHTML:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(90809)._(e.r(71645)),u=a.default.createContext(null);function i(e){let t=(0,a.useContext)(u);t&&t(e)}},22783,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"notFound",{enumerable:!0,get:function(){return a}});let n=e.r(54394),o=`${n.HTTP_ERROR_FALLBACK_ERROR_CODE};404`;function a(){let e=Object.defineProperty(Error(o),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});throw e.digest=o,e}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},79854,(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E488",enumerable:!1,configurable:!0})}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"forbidden",{enumerable:!0,get:function(){return n}}),e.r(54394).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},22683,(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E411",enumerable:!1,configurable:!0})}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unauthorized",{enumerable:!0,get:function(){return n}}),e.r(54394).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},15507,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,o.isNextRouterError)(t)||(0,n.isBailoutToCSRError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=e.r(32061),o=e.r(65713);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},63138,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={isHangingPromiseRejectionError:function(){return a},makeDevtoolsIOAwarePromise:function(){return d},makeHangingPromise:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function a(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===u}let u="HANGING_PROMISE_REJECTION";class i extends Error{constructor(e,t){super(`During prerendering, ${t} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${t} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context. This occurred at route "${e}".`),this.route=e,this.expression=t,this.digest=u}}let c=new WeakMap;function s(e,t,r){if(e.aborted)return Promise.reject(new i(t,r));{let n=new Promise((n,o)=>{let a=o.bind(null,new i(t,r)),u=c.get(e);if(u)u.push(a);else{let t=[a];c.set(e,t),e.addEventListener("abort",()=>{for(let e=0;e{setTimeout(()=>{t(e)},0)})}},67287,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isPostpone",{enumerable:!0,get:function(){return o}});let n=Symbol.for("react.postpone");function o(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}},76353,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DynamicServerError:function(){return u},isDynamicServerError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="DYNAMIC_SERVER_USAGE";class u extends Error{constructor(e){super(`Dynamic server usage: ${e}`),this.description=e,this.digest=a}}function i(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===a}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},43248,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={StaticGenBailoutError:function(){return u},isStaticGenBailoutError:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="NEXT_STATIC_GEN_BAILOUT";class u extends Error{constructor(...e){super(...e),this.code=a}}function i(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===a}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},54839,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={METADATA_BOUNDARY_NAME:function(){return a},OUTLET_BOUNDARY_NAME:function(){return i},ROOT_LAYOUT_BOUNDARY_NAME:function(){return c},VIEWPORT_BOUNDARY_NAME:function(){return u}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a="__next_metadata_boundary__",u="__next_viewport_boundary__",i="__next_outlet_boundary__",c="__next_root_layout_boundary__"},29419,(e,t,r)=>{"use strict";var n=e.i(47167);Object.defineProperty(r,"__esModule",{value:!0});var o={atLeastOneTask:function(){return c},scheduleImmediate:function(){return i},scheduleOnNextTick:function(){return u},waitAtLeastOneReactRenderTask:function(){return s}};for(var a in o)Object.defineProperty(r,a,{enumerable:!0,get:o[a]});let u=e=>{Promise.resolve().then(()=>{n.default.nextTick(e)})},i=e=>{setImmediate(e)};function c(){return new Promise(e=>i(e))}function s(){return new Promise(e=>setImmediate(e))}},67673,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o,a={Postpone:function(){return T},PreludeState:function(){return J},abortAndThrowOnSynchronousRequestDataAccess:function(){return S},abortOnSynchronousPlatformIOAccess:function(){return j},accessedDynamicData:function(){return k},annotateDynamicAccess:function(){return $},consumeDynamicAccess:function(){return I},createDynamicTrackingState:function(){return b},createDynamicValidationState:function(){return E},createHangingInputAbortSignal:function(){return L},createRenderInBrowserAbortSignal:function(){return H},delayUntilRuntimeStage:function(){return er},formatDynamicAPIAccesses:function(){return U},getFirstDynamicReason:function(){return g},getStaticShellDisallowedDynamicReasons:function(){return et},isDynamicPostpone:function(){return x},isPrerenderInterruptedError:function(){return N},logDisallowedDynamicError:function(){return Z},markCurrentScopeAsDynamic:function(){return R},postponeWithTracking:function(){return w},throwIfDisallowedDynamic:function(){return ee},throwToInterruptStaticGeneration:function(){return O},trackAllowedDynamicAccess:function(){return z},trackDynamicDataInDynamicRender:function(){return v},trackDynamicHoleInRuntimeShell:function(){return K},trackDynamicHoleInStaticShell:function(){return V},useDynamicRouteParams:function(){return X},useDynamicSearchParams:function(){return B}};for(var u in a)Object.defineProperty(r,u,{enumerable:!0,get:a[u]});let i=(n=e.r(71645))&&n.__esModule?n:{default:n},c=e.r(76353),s=e.r(43248),l=e.r(62141),d=e.r(63599),f=e.r(63138),p=e.r(54839),y=e.r(29419),_=e.r(32061),m=e.r(12718),h="function"==typeof i.default.unstable_postpone;function b(e){return{isDebugDynamicAccesses:e,dynamicAccesses:[],syncDynamicErrorWithStack:null}}function E(){return{hasSuspenseAboveBody:!1,hasDynamicMetadata:!1,dynamicMetadata:null,hasDynamicViewport:!1,hasAllowedDynamic:!1,dynamicErrors:[]}}function g(e){var t;return null==(t=e.dynamicAccesses[0])?void 0:t.expression}function R(e,t,r){if(t)switch(t.type){case"cache":case"unstable-cache":case"private-cache":return}if(!e.forceDynamic&&!e.forceStatic){if(e.dynamicShouldError)throw Object.defineProperty(new s.StaticGenBailoutError(`Route ${e.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${r}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E553",enumerable:!1,configurable:!0});if(t)switch(t.type){case"prerender-ppr":return w(e.route,r,t.dynamicTracking);case"prerender-legacy":t.revalidate=0;let n=Object.defineProperty(new c.DynamicServerError(`Route ${e.route} couldn't be rendered statically because it used ${r}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E550",enumerable:!1,configurable:!0});throw e.dynamicUsageDescription=r,e.dynamicUsageStack=n.stack,n}}}function O(e,t,r){let n=Object.defineProperty(new c.DynamicServerError(`Route ${t.route} couldn't be rendered statically because it used \`${e}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E558",enumerable:!1,configurable:!0});throw r.revalidate=0,t.dynamicUsageDescription=e,t.dynamicUsageStack=n.stack,n}function v(e){switch(e.type){case"cache":case"unstable-cache":case"private-cache":return}}function P(e,t,r){let n=C(`Route ${e} needs to bail out of prerendering at this point because it used ${t}.`);r.controller.abort(n);let o=r.dynamicTracking;o&&o.dynamicAccesses.push({stack:o.isDebugDynamicAccesses?Error().stack:void 0,expression:t})}function j(e,t,r,n){let o=n.dynamicTracking;P(e,t,n),o&&null===o.syncDynamicErrorWithStack&&(o.syncDynamicErrorWithStack=r)}function S(e,t,r,n){if(!1===n.controller.signal.aborted){P(e,t,n);let o=n.dynamicTracking;o&&null===o.syncDynamicErrorWithStack&&(o.syncDynamicErrorWithStack=r)}throw C(`Route ${e} needs to bail out of prerendering at this point because it used ${t}.`)}function T({reason:e,route:t}){let r=l.workUnitAsyncStorage.getStore();w(t,e,r&&"prerender-ppr"===r.type?r.dynamicTracking:null)}function w(e,t,r){(function(){if(!h)throw Object.defineProperty(Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E224",enumerable:!1,configurable:!0})})(),r&&r.dynamicAccesses.push({stack:r.isDebugDynamicAccesses?Error().stack:void 0,expression:t}),i.default.unstable_postpone(D(e,t))}function D(e,t){return`Route ${e} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`}function x(e){return"object"==typeof e&&null!==e&&"string"==typeof e.message&&A(e.message)}function A(e){return e.includes("needs to bail out of prerendering at this point because it used")&&e.includes("Learn more: https://nextjs.org/docs/messages/ppr-caught-error")}if(!1===A(D("%%%","^^^")))throw Object.defineProperty(Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E296",enumerable:!1,configurable:!0});let M="NEXT_PRERENDER_INTERRUPTED";function C(e){let t=Object.defineProperty(Error(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t.digest=M,t}function N(e){return"object"==typeof e&&null!==e&&e.digest===M&&"name"in e&&"message"in e&&e instanceof Error}function k(e){return e.length>0}function I(e,t){return e.dynamicAccesses.push(...t.dynamicAccesses),e.dynamicAccesses}function U(e){return e.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: ${t}`))}function H(){let e=new AbortController;return e.abort(Object.defineProperty(new _.BailoutToCSRError("Render in Browser"),"__NEXT_ERROR_CODE",{value:"E721",enumerable:!1,configurable:!0})),e.signal}function L(e){switch(e.type){case"prerender":case"prerender-runtime":let t=new AbortController;if(e.cacheSignal)e.cacheSignal.inputReady().then(()=>{t.abort()});else{let r=(0,l.getRuntimeStagePromise)(e);r?r.then(()=>(0,y.scheduleOnNextTick)(()=>t.abort())):(0,y.scheduleOnNextTick)(()=>t.abort())}return t.signal;case"prerender-client":case"prerender-ppr":case"prerender-legacy":case"request":case"cache":case"private-cache":case"unstable-cache":return}}function $(e,t){let r=t.dynamicTracking;r&&r.dynamicAccesses.push({stack:r.isDebugDynamicAccesses?Error().stack:void 0,expression:e})}function X(e){let t=d.workAsyncStorage.getStore(),r=l.workUnitAsyncStorage.getStore();if(t&&r)switch(r.type){case"prerender-client":case"prerender":{let n=r.fallbackRouteParams;n&&n.size>0&&i.default.use((0,f.makeHangingPromise)(r.renderSignal,t.route,e));break}case"prerender-ppr":{let n=r.fallbackRouteParams;if(n&&n.size>0)return w(t.route,e,r.dynamicTracking);break}case"prerender-runtime":throw Object.defineProperty(new m.InvariantError(`\`${e}\` was called during a runtime prerender. Next.js should be preventing ${e} from being included in server components statically, but did not in this case.`),"__NEXT_ERROR_CODE",{value:"E771",enumerable:!1,configurable:!0});case"cache":case"private-cache":throw Object.defineProperty(new m.InvariantError(`\`${e}\` was called inside a cache scope. Next.js should be preventing ${e} from being included in server components statically, but did not in this case.`),"__NEXT_ERROR_CODE",{value:"E745",enumerable:!1,configurable:!0})}}function B(e){let t=d.workAsyncStorage.getStore(),r=l.workUnitAsyncStorage.getStore();if(t)switch(!r&&(0,l.throwForMissingRequestStore)(e),r.type){case"prerender-client":i.default.use((0,f.makeHangingPromise)(r.renderSignal,t.route,e));break;case"prerender-legacy":case"prerender-ppr":if(t.forceStatic)return;throw Object.defineProperty(new _.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});case"prerender":case"prerender-runtime":throw Object.defineProperty(new m.InvariantError(`\`${e}\` was called from a Server Component. Next.js should be preventing ${e} from being included in server components statically, but did not in this case.`),"__NEXT_ERROR_CODE",{value:"E795",enumerable:!1,configurable:!0});case"cache":case"unstable-cache":case"private-cache":throw Object.defineProperty(new m.InvariantError(`\`${e}\` was called inside a cache scope. Next.js should be preventing ${e} from being included in server components statically, but did not in this case.`),"__NEXT_ERROR_CODE",{value:"E745",enumerable:!1,configurable:!0});case"request":return}}let F=/\n\s+at Suspense \(\)/,W=RegExp(`\\n\\s+at Suspense \\(\\)(?:(?!\\n\\s+at (?:body|div|main|section|article|aside|header|footer|nav|form|p|span|h1|h2|h3|h4|h5|h6) \\(\\))[\\s\\S])*?\\n\\s+at ${p.ROOT_LAYOUT_BOUNDARY_NAME} \\([^\\n]*\\)`),G=RegExp(`\\n\\s+at ${p.METADATA_BOUNDARY_NAME}[\\n\\s]`),q=RegExp(`\\n\\s+at ${p.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`),Y=RegExp(`\\n\\s+at ${p.OUTLET_BOUNDARY_NAME}[\\n\\s]`);function z(e,t,r,n){if(!Y.test(t)){if(G.test(t)){r.hasDynamicMetadata=!0;return}if(q.test(t)){r.hasDynamicViewport=!0;return}if(W.test(t)){r.hasAllowedDynamic=!0,r.hasSuspenseAboveBody=!0;return}else if(F.test(t)){r.hasAllowedDynamic=!0;return}else{if(n.syncDynamicErrorWithStack)return void r.dynamicErrors.push(n.syncDynamicErrorWithStack);let o=Q(`Route "${e.route}": Uncached data was accessed outside of . This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`,t);return void r.dynamicErrors.push(o)}}}function K(e,t,r,n){if(!Y.test(t)){if(G.test(t)){r.dynamicMetadata=Q(`Route "${e.route}": Uncached data or \`connection()\` was accessed inside \`generateMetadata\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`,t);return}if(q.test(t)){let n=Q(`Route "${e.route}": Uncached data or \`connection()\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`,t);r.dynamicErrors.push(n);return}if(W.test(t)){r.hasAllowedDynamic=!0,r.hasSuspenseAboveBody=!0;return}else if(F.test(t)){r.hasAllowedDynamic=!0;return}else{if(n.syncDynamicErrorWithStack)return void r.dynamicErrors.push(n.syncDynamicErrorWithStack);let o=Q(`Route "${e.route}": Uncached data or \`connection()\` was accessed outside of \`\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`,t);return void r.dynamicErrors.push(o)}}}function V(e,t,r,n){if(!Y.test(t)){if(G.test(t)){r.dynamicMetadata=Q(`Route "${e.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`,t);return}if(q.test(t)){let n=Q(`Route "${e.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`,t);r.dynamicErrors.push(n);return}if(W.test(t)){r.hasAllowedDynamic=!0,r.hasSuspenseAboveBody=!0;return}else if(F.test(t)){r.hasAllowedDynamic=!0;return}else{if(n.syncDynamicErrorWithStack)return void r.dynamicErrors.push(n.syncDynamicErrorWithStack);let o=Q(`Route "${e.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`,t);return void r.dynamicErrors.push(o)}}}function Q(e,t){let r=Object.defineProperty(Error(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return r.stack=r.name+": "+e+t,r}var J=((o={})[o.Full=0]="Full",o[o.Empty=1]="Empty",o[o.Errored=2]="Errored",o);function Z(e,t){console.error(t),e.dev||(e.hasReadableErrorStacks?console.error(`To get a more detailed stack trace and pinpoint the issue, start the app in development mode by running \`next dev\`, then open "${e.route}" in your browser to investigate the error.`):console.error(`To get a more detailed stack trace and pinpoint the issue, try one of the following: - Start the app in development mode by running \`next dev\`, then open "${e.route}" in your browser to investigate the error. - - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.`))}function ee(e,t,r,n){if(n.syncDynamicErrorWithStack)throw Z(e,n.syncDynamicErrorWithStack),new s.StaticGenBailoutError;if(0!==t){if(r.hasSuspenseAboveBody)return;let n=r.dynamicErrors;if(n.length>0){for(let t=0;t0)return n;if(1===t)return[Object.defineProperty(new m.InvariantError(`Route "${e.route}" did not produce a static shell and Next.js was unable to determine a reason.`),"__NEXT_ERROR_CODE",{value:"E936",enumerable:!1,configurable:!0})]}else if(!1===r.hasAllowedDynamic&&0===r.dynamicErrors.length&&r.dynamicMetadata)return[r.dynamicMetadata];return[]}function er(e,t){return e.runtimeStagePromise?e.runtimeStagePromise.then(()=>t):t}},91414,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,u.isNextRouterError)(t)||(0,a.isBailoutToCSRError)(t)||(0,c.isDynamicServerError)(t)||(0,i.isDynamicPostpone)(t)||(0,o.isPostpone)(t)||(0,n.isHangingPromiseRejectionError)(t)||(0,i.isPrerenderInterruptedError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=e.r(63138),o=e.r(67287),a=e.r(32061),u=e.r(65713),i=e.r(67673),c=e.r(76353);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},90508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return n}});let n="undefined"==typeof window?e.r(91414).unstable_rethrow:e.r(15507).unstable_rethrow;("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},92805,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ReadonlyURLSearchParams:function(){return a.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},forbidden:function(){return s.forbidden},notFound:function(){return c.notFound},permanentRedirect:function(){return u.permanentRedirect},redirect:function(){return u.redirect},unauthorized:function(){return l.unauthorized},unstable_isUnrecognizedActionError:function(){return f},unstable_rethrow:function(){return d.unstable_rethrow}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(3680),u=e.r(24063),i=e.r(68391),c=e.r(22783),s=e.r(79854),l=e.r(22683),d=e.r(90508);function f(){throw Object.defineProperty(Error("`unstable_isUnrecognizedActionError` can only be used on the client."),"__NEXT_ERROR_CODE",{value:"E776",enumerable:!1,configurable:!0})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},76562,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return d.RedirectType},ServerInsertedHTMLContext:function(){return s.ServerInsertedHTMLContext},forbidden:function(){return d.forbidden},notFound:function(){return d.notFound},permanentRedirect:function(){return d.permanentRedirect},redirect:function(){return d.redirect},unauthorized:function(){return d.unauthorized},unstable_isUnrecognizedActionError:function(){return l.unstable_isUnrecognizedActionError},unstable_rethrow:function(){return d.unstable_rethrow},useParams:function(){return h},usePathname:function(){return _},useRouter:function(){return m},useSearchParams:function(){return y},useSelectedLayoutSegment:function(){return E},useSelectedLayoutSegments:function(){return b},useServerInsertedHTML:function(){return s.useServerInsertedHTML}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(90809)._(e.r(71645)),u=e.r(8372),i=e.r(61994),c=e.r(13258),s=e.r(13957),l=e.r(92838),d=e.r(92805),f="undefined"==typeof window?e.r(67673).useDynamicRouteParams:void 0,p="undefined"==typeof window?e.r(67673).useDynamicSearchParams:void 0;function y(){p?.("useSearchParams()");let e=(0,a.useContext)(i.SearchParamsContext);return(0,a.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e])}function _(){return f?.("usePathname()"),(0,a.useContext)(i.PathnameContext)}function m(){let e=(0,a.useContext)(u.AppRouterContext);if(null===e)throw Object.defineProperty(Error("invariant expected app router to be mounted"),"__NEXT_ERROR_CODE",{value:"E238",enumerable:!1,configurable:!0});return e}function h(){return f?.("useParams()"),(0,a.useContext)(i.PathParamsContext)}function b(e="children"){f?.("useSelectedLayoutSegments()");let t=(0,a.useContext)(u.LayoutRouterContext);return t?(0,c.getSelectedLayoutSegmentPath)(t.parentTree,e):null}function E(e="children"){f?.("useSelectedLayoutSegment()"),(0,a.useContext)(i.NavigationPromisesContext);let t=b(e);return(0,c.computeSelectedLayoutSegment)(t,e)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]); \ No newline at end of file + - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.`))}function ee(e,t,r,n){if(n.syncDynamicErrorWithStack)throw Z(e,n.syncDynamicErrorWithStack),new s.StaticGenBailoutError;if(0!==t){if(r.hasSuspenseAboveBody)return;let n=r.dynamicErrors;if(n.length>0){for(let t=0;t0)return n;if(1===t)return[Object.defineProperty(new m.InvariantError(`Route "${e.route}" did not produce a static shell and Next.js was unable to determine a reason.`),"__NEXT_ERROR_CODE",{value:"E936",enumerable:!1,configurable:!0})]}else if(!1===r.hasAllowedDynamic&&0===r.dynamicErrors.length&&r.dynamicMetadata)return[r.dynamicMetadata];return[]}function er(e,t){return e.runtimeStagePromise?e.runtimeStagePromise.then(()=>t):t}},91414,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,u.isNextRouterError)(t)||(0,a.isBailoutToCSRError)(t)||(0,c.isDynamicServerError)(t)||(0,i.isDynamicPostpone)(t)||(0,o.isPostpone)(t)||(0,n.isHangingPromiseRejectionError)(t)||(0,i.isPrerenderInterruptedError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=e.r(63138),o=e.r(67287),a=e.r(32061),u=e.r(65713),i=e.r(67673),c=e.r(76353);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},90508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unstable_rethrow",{enumerable:!0,get:function(){return n}});let n="u"{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ReadonlyURLSearchParams:function(){return a.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},forbidden:function(){return s.forbidden},notFound:function(){return c.notFound},permanentRedirect:function(){return u.permanentRedirect},redirect:function(){return u.redirect},unauthorized:function(){return l.unauthorized},unstable_isUnrecognizedActionError:function(){return f},unstable_rethrow:function(){return d.unstable_rethrow}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(3680),u=e.r(24063),i=e.r(68391),c=e.r(22783),s=e.r(79854),l=e.r(22683),d=e.r(90508);function f(){throw Object.defineProperty(Error("`unstable_isUnrecognizedActionError` can only be used on the client."),"__NEXT_ERROR_CODE",{value:"E776",enumerable:!1,configurable:!0})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},76562,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return d.RedirectType},ServerInsertedHTMLContext:function(){return s.ServerInsertedHTMLContext},forbidden:function(){return d.forbidden},notFound:function(){return d.notFound},permanentRedirect:function(){return d.permanentRedirect},redirect:function(){return d.redirect},unauthorized:function(){return d.unauthorized},unstable_isUnrecognizedActionError:function(){return l.unstable_isUnrecognizedActionError},unstable_rethrow:function(){return d.unstable_rethrow},useParams:function(){return h},usePathname:function(){return _},useRouter:function(){return m},useSearchParams:function(){return y},useSelectedLayoutSegment:function(){return E},useSelectedLayoutSegments:function(){return b},useServerInsertedHTML:function(){return s.useServerInsertedHTML}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(90809)._(e.r(71645)),u=e.r(8372),i=e.r(61994),c=e.r(13258),s=e.r(13957),l=e.r(92838),d=e.r(92805),f="u"e?new i.ReadonlyURLSearchParams(e):null,[e])}function _(){return f?.("usePathname()"),(0,a.useContext)(i.PathnameContext)}function m(){let e=(0,a.useContext)(u.AppRouterContext);if(null===e)throw Object.defineProperty(Error("invariant expected app router to be mounted"),"__NEXT_ERROR_CODE",{value:"E238",enumerable:!1,configurable:!0});return e}function h(){return f?.("useParams()"),(0,a.useContext)(i.PathParamsContext)}function b(e="children"){f?.("useSelectedLayoutSegments()");let t=(0,a.useContext)(u.LayoutRouterContext);return t?(0,c.getSelectedLayoutSegmentPath)(t.parentTree,e):null}function E(e="children"){f?.("useSelectedLayoutSegment()"),(0,a.useContext)(i.NavigationPromisesContext);let t=b(e);return(0,c.computeSelectedLayoutSegment)(t,e)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/20b7c805b0b1f5f3.js b/docs/_next/static/chunks/20b7c805b0b1f5f3.js new file mode 100644 index 00000000..c8aa7a68 --- /dev/null +++ b/docs/_next/static/chunks/20b7c805b0b1f5f3.js @@ -0,0 +1,362 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55838,(e,n,t)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!a(e,t)}catch(e){return!0}}var c="u"{"use strict";n.exports=e.r(55838)},52822,(e,n,t)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,n,t,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var n=f.value;if(a(n,e))return l=n}return l=e}if(n=l,i(o,e))return n;var t=r(e);return void 0!==a&&a(n,t)?(o=e,n):(o=e,l=t)}var o,l,s=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]},[n,t,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,n,t)=>{"use strict";n.exports=e.r(52822)},66936,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S=!1,E="function"==typeof setTimeout?setTimeout:null,T="function"==typeof clearTimeout?clearTimeout:null,M="u">typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function x(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,R||(R=!0,l());else{var n=a(f);null!==n&&U(x,n.startTime-e)}}var R=!1,C=-1,y=5,A=-1;function P(){return!!S||!(t.unstable_now()-Ae&&P());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&U(x,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():R=!1}}}if("function"==typeof M)l=function(){M(w)};else if("u">typeof MessageChannel){var L=new MessageChannel,N=L.port2;L.port1.onmessage=w,l=function(){N.postMessage(null)}}else l=function(){E(w,0)};function U(e,n){C=E(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(T(C),C=-1):v=!0,U(x,i-o))):(e.sortIndex=s,r(d,e),_||g||(_=!0,R||(R=!0,l()))),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},89499,(e,n,t)=>{"use strict";n.exports=e.r(66936)},40859,8560,8155,66748,46791,e=>{"use strict";let n,t,r,a,i,o,l,s,u;var c,d,f,p,m,h,g=e.i(47167),_=e.i(71645),v=e.i(90072),S=v;function E(){let e=null,n=!1,t=null,r=null;function a(n,i){t(n,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===n||null!==t&&(r=e.requestAnimationFrame(a),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(e){t=e},setContext:function(n){e=n}}}function T(e){let n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){let e=n.get(t);(!e||e.versiontypeof Float16Array&&a instanceof Float16Array)r=e.HALF_FLOAT;else if(a instanceof Uint16Array)r=n.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=e.SHORT;else if(a instanceof Uint32Array)r=e.UNSIGNED_INT;else if(a instanceof Int32Array)r=e.INT;else if(a instanceof Int8Array)r=e.BYTE;else if(a instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:l,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:n.version,size:o}}(t,r));else if(a.versione.start-n.start);let n=0;for(let e=1;e 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},b={common:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new S.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new S.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new S.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new S.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new S.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new S.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new S.Matrix3},normalScale:{value:new S.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new S.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new S.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new S.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new S.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new S.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0},uvTransform:{value:new S.Matrix3}},sprite:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},center:{value:new S.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new S.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0}}},x={basic:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.fog]),vertexShader:M.meshbasic_vert,fragmentShader:M.meshbasic_frag},lambert:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.fog,b.lights,{emissive:{value:new S.Color(0)}}]),vertexShader:M.meshlambert_vert,fragmentShader:M.meshlambert_frag},phong:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.fog,b.lights,{emissive:{value:new S.Color(0)},specular:{value:new S.Color(1118481)},shininess:{value:30}}]),vertexShader:M.meshphong_vert,fragmentShader:M.meshphong_frag},standard:{uniforms:(0,S.mergeUniforms)([b.common,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.roughnessmap,b.metalnessmap,b.fog,b.lights,{emissive:{value:new S.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag},toon:{uniforms:(0,S.mergeUniforms)([b.common,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.gradientmap,b.fog,b.lights,{emissive:{value:new S.Color(0)}}]),vertexShader:M.meshtoon_vert,fragmentShader:M.meshtoon_frag},matcap:{uniforms:(0,S.mergeUniforms)([b.common,b.bumpmap,b.normalmap,b.displacementmap,b.fog,{matcap:{value:null}}]),vertexShader:M.meshmatcap_vert,fragmentShader:M.meshmatcap_frag},points:{uniforms:(0,S.mergeUniforms)([b.points,b.fog]),vertexShader:M.points_vert,fragmentShader:M.points_frag},dashed:{uniforms:(0,S.mergeUniforms)([b.common,b.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:M.linedashed_vert,fragmentShader:M.linedashed_frag},depth:{uniforms:(0,S.mergeUniforms)([b.common,b.displacementmap]),vertexShader:M.depth_vert,fragmentShader:M.depth_frag},normal:{uniforms:(0,S.mergeUniforms)([b.common,b.bumpmap,b.normalmap,b.displacementmap,{opacity:{value:1}}]),vertexShader:M.meshnormal_vert,fragmentShader:M.meshnormal_frag},sprite:{uniforms:(0,S.mergeUniforms)([b.sprite,b.fog]),vertexShader:M.sprite_vert,fragmentShader:M.sprite_frag},background:{uniforms:{uvTransform:{value:new S.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:M.background_vert,fragmentShader:M.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new S.Matrix3}},vertexShader:M.backgroundCube_vert,fragmentShader:M.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:M.cube_vert,fragmentShader:M.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:M.equirect_vert,fragmentShader:M.equirect_frag},distance:{uniforms:(0,S.mergeUniforms)([b.common,b.displacementmap,{referencePosition:{value:new S.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:M.distance_vert,fragmentShader:M.distance_frag},shadow:{uniforms:(0,S.mergeUniforms)([b.lights,b.fog,{color:{value:new S.Color(0)},opacity:{value:1}}]),vertexShader:M.shadow_vert,fragmentShader:M.shadow_frag}};x.physical={uniforms:(0,S.mergeUniforms)([x.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new S.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new S.Matrix3},clearcoatNormalScale:{value:new S.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new S.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new S.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new S.Matrix3},sheen:{value:0},sheenColor:{value:new S.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new S.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new S.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new S.Matrix3},transmissionSamplerSize:{value:new S.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new S.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new S.Color(0)},specularColor:{value:new S.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new S.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new S.Matrix3},anisotropyVector:{value:new S.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new S.Matrix3}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag};let R={r:0,b:0,g:0},C=new S.Euler,y=new S.Matrix4;function A(e,n,t,r,a,i,o){let l,s,u=new S.Color(0),c=+(!0!==i),d=null,f=0,p=null;function m(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?t:n).get(r)),r}function h(n,t){n.getRGB(R,(0,S.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(R.r,R.g,R.b,t,o)}return{getClearColor:function(){return u},setClearColor:function(e,n=1){u.set(e),h(u,c=n)},getClearAlpha:function(){return c},setClearAlpha:function(e){h(u,c=e)},render:function(n){let t=!1,a=m(n);null===a?h(u,c):a&&a.isColor&&(h(a,1),t=!0);let i=e.xr.getEnvironmentBlendMode();"additive"===i?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===i&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||t)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,t){let r=m(t);r&&(r.isCubeTexture||r.mapping===S.CubeUVReflectionMapping)?(void 0===s&&((s=new S.Mesh(new S.BoxGeometry(1,1,1),new S.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,S.cloneUniforms)(x.backgroundCube.uniforms),vertexShader:x.backgroundCube.vertexShader,fragmentShader:x.backgroundCube.fragmentShader,side:S.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,n,t){this.matrixWorld.copyPosition(t.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(s)),C.copy(t.backgroundRotation),C.x*=-1,C.y*=-1,C.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(C.y*=-1,C.z*=-1),s.material.uniforms.envMap.value=r,s.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,s.material.uniforms.backgroundBlurriness.value=t.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(y.makeRotationFromEuler(C)),s.material.toneMapped=S.ColorManagement.getTransfer(r.colorSpace)!==S.SRGBTransfer,(d!==r||f!==r.version||p!==e.toneMapping)&&(s.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new S.Mesh(new S.PlaneGeometry(2,2),new S.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,S.cloneUniforms)(x.background.uniforms),vertexShader:x.background.vertexShader,fragmentShader:x.background.fragmentShader,side:S.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,l.material.toneMapped=S.ColorManagement.getTransfer(r.colorSpace)!==S.SRGBTransfer,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function P(e,n){let t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(n){return e.bindVertexArray(n)}function s(n){return e.deleteVertexArray(n)}function u(e){let n=[],r=[],a=[];for(let e=0;e=0){let t=a[n],r=o[n];if(void 0===r&&("instanceMatrix"===n&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(r=e.instanceColor)),void 0===t||t.attribute!==r||r&&t.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(t,h,s,g))&&function(e,n,t,r){let a={},o=n.attributes,l=0,s=t.getAttributes();for(let n in s)if(s[n].location>=0){let t=o[n];void 0===t&&("instanceMatrix"===n&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(t=e.instanceColor));let r={};r.attribute=t,t&&t.data&&(r.data=t.data),a[n]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(t,h,s,g),null!==g&&n.update(g,e.ELEMENT_ARRAY_BUFFER),(x||o)&&(o=!1,function(t,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&t.instanceMatrix&&(l=t.instanceMatrix),"instanceColor"===r&&t.instanceColor&&(l=t.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=n.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===S.IntType;if(l.isInterleavedBufferAttribute){let n=l.data,s=n.stride,g=l.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";n="mediump"}return"mediump"===n&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==t.precision?t.precision:"highp",l=i(o);return l!==o&&((0,S.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(n){return n===S.RGBAFormat||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(t){let a=t===S.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return t===S.UnsignedByteType||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||t===S.FloatType||!!a},precision:o,logarithmicDepthBuffer:!0===t.logarithmicDepthBuffer,reversedDepthBuffer:!0===t.reversedDepthBuffer&&n.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function N(e){let n=this,t=null,r=0,a=!1,i=!1,o=new S.Plane,l=new S.Matrix3,s={value:null,needsUpdate:!1};function u(e,t,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let n=r+4*i,a=t.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length0),n.numPlanes=r,n.numIntersection=0)}}function U(e){let n=new WeakMap;function t(e,n){return n===S.EquirectangularReflectionMapping?e.mapping=S.CubeReflectionMapping:n===S.EquirectangularRefractionMapping&&(e.mapping=S.CubeRefractionMapping),e}function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping;if(i===S.EquirectangularReflectionMapping||i===S.EquirectangularRefractionMapping)if(n.has(a))return t(n.get(a).texture,a.mapping);else{let i=a.image;if(!i||!(i.height>0))return null;{let o=new S.WebGLCubeRenderTarget(i.height);return o.fromEquirectangularTexture(e,a),n.set(a,o),a.addEventListener("dispose",r),t(o.texture,a.mapping)}}}return a},dispose:function(){n=new WeakMap}}}let D=[.125,.215,.35,.446,.526,.582],I=new S.OrthographicCamera,F=new S.Color,O=null,B=0,G=0,H=!1,k=new S.Vector3;class V{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,t=.1,r=100,a={}){let{size:i=256,position:o=k}=a;O=this._renderer.getRenderTarget(),B=this._renderer.getActiveCubeFace(),G=this._renderer.getActiveMipmapLevel(),H=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,t,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=j(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=X(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=D[o-e+4-1]:0===o&&(l=0),t.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let n=e%3*2/3-1,t=e>2?0:-1,r=[n,t,0,n+2/3,t,0,n+2/3,t+1,0,n,t,0,n+2/3,t+1,0,n,t+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new S.BufferGeometry;h.setAttribute("position",new S.BufferAttribute(f,3)),h.setAttribute("uv",new S.BufferAttribute(p,2)),h.setAttribute("faceIndex",new S.BufferAttribute(m,1)),r.push(new S.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:n,sigmas:t}}(d)),this._blurMaterial=(a=d,i=e,o=n,r=new Float32Array(20),c=new S.Vector3(0,1,0),new S.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=d,s=e,u=n,new S.ShaderMaterial({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/s,CUBEUV_TEXEL_HEIGHT:1/u,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:q(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 3.2: Transform view direction to hemisphere configuration + vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); + + // Section 4.1: Orthonormal basis + float lensq = Vh.x * Vh.x + Vh.y * Vh.y; + vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(Vh, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + Vh.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:S.NoBlending,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let n=new S.Mesh(new S.BufferGeometry,e);this._renderer.compile(n,I)}_sceneToCubeUV(e,n,t,r,a){let i=new S.PerspectiveCamera(90,1,n,t),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,c=s.toneMapping;s.getClearColor(F),s.toneMapping=S.NoToneMapping,s.autoClear=!1,s.state.buffers.depth.getReversed()&&(s.setRenderTarget(r),s.clearDepth(),s.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new S.Mesh(new S.BoxGeometry,new S.MeshBasicMaterial({name:"PMREM.Background",side:S.BackSide,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(F),p=!0);for(let n=0;n<6;n++){let t=n%3;0===t?(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x+l[n],a.y,a.z)):1===t?(i.up.set(0,0,o[n]),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y+l[n],a.z)):(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y,a.z+l[n]));let u=this._cubeSize;W(r,t*u,n>2?u:0,u,u),s.setRenderTarget(r),p&&s.render(d,i),s.render(e,i)}s.toneMapping=c,s.autoClear=u,e.background=m}_textureToCubeUV(e,n){let t=this._renderer,r=e.mapping===S.CubeReflectionMapping||e.mapping===S.CubeRefractionMapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=j()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=X());let a=r?this._cubemapMaterial:this._equirectMaterial,i=this._lodMeshes[0];i.material=a,a.uniforms.envMap.value=e;let o=this._cubeSize;W(n,0,0,3*o,2*o),t.setRenderTarget(n),t.render(i,I)}_applyPMREM(e){let n=this._renderer,t=n.autoClear;n.autoClear=!1;let r=this._lodMeshes.length;for(let n=1;nd-4?t-d+4:0),m=4*(this._cubeSize-f);l.envMap.value=e.texture,l.roughness.value=c*(0+1.25*s),l.mipInt.value=d-n,W(a,p,m,3*f,2*f),r.setRenderTarget(a),r.render(o,I),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=d-t,W(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,I)}_blur(e,n,t,r,a){let i=this._pingPongRenderTarget;this._halfBlur(e,i,n,t,r,"latitudinal",a),this._halfBlur(i,e,t,t,r,"longitudinal",a)}_halfBlur(e,n,t,r,a,i,o){let l=this._renderer,s=this._blurMaterial;"latitudinal"!==i&&"longitudinal"!==i&&(0,S.error)("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[r];u.material=s;let c=s.uniforms,d=this._sizeLods[t]-1,f=isFinite(a)?Math.PI/(2*d):2*Math.PI/39,p=a/f,m=isFinite(a)?1+Math.floor(3*p):20;m>20&&(0,S.warn)(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);let h=[],g=0;for(let e=0;e<20;++e){let n=e/p,t=Math.exp(-n*n/2);h.push(t),0===e?g+=t:e_-4?r-_+4:0),E,3*v,2*v),l.setRenderTarget(n),l.render(u,I)}}function z(e,n,t){let r=new S.WebGLRenderTarget(e,n,t);return r.texture.mapping=S.CubeUVReflectionMapping,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function W(e,n,t,r,a){e.viewport.set(n,t,r,a),e.scissor.set(n,t,r,a)}function X(){return new S.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})}function j(){return new S.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})}function q(){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 Y(e){let n=new WeakMap,t=null;function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping,o=i===S.EquirectangularReflectionMapping||i===S.EquirectangularRefractionMapping,l=i===S.CubeReflectionMapping||i===S.CubeRefractionMapping;if(o||l){let i=n.get(a),s=void 0!==i?i.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==s)return null===t&&(t=new V(e)),(i=o?t.fromEquirectangular(a,i):t.fromCubemap(a,i)).texture.pmremVersion=a.pmremVersion,n.set(a,i),i.texture;{if(void 0!==i)return i.texture;let s=a.image;return o&&s&&s.height>0||l&&s&&function(e){let n=0;for(let t=0;t<6;t++)void 0!==e[t]&&n++;return 6===n}(s)?(null===t&&(t=new V(e)),(i=o?t.fromEquirectangular(a):t.fromCubemap(a)).texture.pmremVersion=a.pmremVersion,n.set(a,i),a.addEventListener("dispose",r),i.texture):null}}}return a},dispose:function(){n=new WeakMap,null!==t&&(t.dispose(),t=null)}}}function K(e){let n={};function t(t){if(void 0!==n[t])return n[t];let r=e.getExtension(t);return n[t]=r,r}return{has:function(e){return null!==t(e)},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(e){let n=t(e);return null===n&&(0,S.warnOnce)("WebGLRenderer: "+e+" extension not supported."),n}}}function $(e,n,t,r){let a={},i=new WeakMap;function o(e){let l=e.target;for(let e in null!==l.index&&n.remove(l.index),l.attributes)n.remove(l.attributes[e]);l.removeEventListener("dispose",o),delete a[l.id];let s=i.get(l);s&&(n.remove(s),i.delete(l)),r.releaseStatesOfGeometry(l),!0===l.isInstancedBufferGeometry&&delete l._maxInstanceCount,t.memory.geometries--}function l(e){let t=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){let e=r.array;o=r.version;for(let n=0,r=e.length;nn.maxTextureSize&&(m=Math.ceil(p/n.maxTextureSize),p=n.maxTextureSize);let h=new Float32Array(p*m*4*c),g=new S.DataArrayTexture(h,p,m,c);g.type=S.FloatType,g.needsUpdate=!0;let _=4*f;for(let n=0;n + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),c=new S.Mesh(s,u),d=new S.OrthographicCamera(-1,1,1,-1,0,1),f=null,p=null,m=!1,h=null,g=[],_=!1;this.setSize=function(e,n){o.setSize(e,n),l.setSize(e,n);for(let t=0;t0&&!0===g[0].isRenderPass;let n=o.width,t=o.height;for(let e=0;e0)return e;let a=n*t,i=es[a];if(void 0===i&&(i=new Float32Array(a),es[a]=i),0!==n){r.toArray(i,0);for(let r=1,a=0;r!==n;++r)a+=t,e[r].toArray(i,a)}return i}function em(e,n){if(e.length!==n.length)return!1;for(let t=0,r=e.length;t0&&(this.seq=r.concat(a))}setValue(e,n,t,r){let a=this.map[n];void 0!==a&&a.setValue(e,t,r)}setOptional(e,n,t){let r=n[t];void 0!==r&&this.setValue(e,t,r)}static upload(e,n,t,r){for(let a=0,i=n.length;a!==i;++a){let i=n[a],o=t[i.id];!1!==o.needsUpdate&&i.setValue(e,o.value,r)}}static seqWithValue(e,n){let t=[];for(let r=0,a=e.length;r!==a;++r){let a=e[r];a.id in n&&t.push(a)}return t}}function e8(e,n,t){let r=e.createShader(n);return e.shaderSource(r,t),e.compileShader(r),r}let e9=0,e7=new S.Matrix3;function ne(e,n,t){let r=e.getShaderParameter(n,e.COMPILE_STATUS),a=(e.getShaderInfoLog(n)||"").trim();if(r&&""===a)return"";let i=/ERROR: 0:(\d+)/.exec(a);if(!i)return a;{let r=parseInt(i[1]);return t.toUpperCase()+"\n\n"+a+"\n\n"+function(e,n){let t=e.split("\n"),r=[],a=Math.max(n-6,0),i=Math.min(n+6,t.length);for(let e=a;e":" "} ${a}: ${t[e]}`)}return r.join("\n")}(e.getShaderSource(n),r)}}let nn={[S.LinearToneMapping]:"Linear",[S.ReinhardToneMapping]:"Reinhard",[S.CineonToneMapping]:"Cineon",[S.ACESFilmicToneMapping]:"ACESFilmic",[S.AgXToneMapping]:"AgX",[S.NeutralToneMapping]:"Neutral",[S.CustomToneMapping]:"Custom"},nt=new S.Vector3;function nr(e){return""!==e}function na(e,n){let t=n.numSpotLightShadows+n.numSpotLightMaps-n.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,n.numDirLights).replace(/NUM_SPOT_LIGHTS/g,n.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,n.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,n.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,n.numPointLights).replace(/NUM_HEMI_LIGHTS/g,n.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,n.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,n.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,n.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,n.numPointLightShadows)}function ni(e,n){return e.replace(/NUM_CLIPPING_PLANES/g,n.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,n.numClippingPlanes-n.numClipIntersection)}let no=/^[ \t]*#include +<([\w\d./]+)>/gm;function nl(e){return e.replace(no,nu)}let ns=new Map;function nu(e,n){let t=M[n];if(void 0===t){let e=ns.get(n);if(void 0!==e)t=M[e],(0,S.warn)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',n,e);else throw Error("Can not resolve #include <"+n+">")}return nl(t)}let nc=/#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 nd(e){return e.replace(nc,nf)}function nf(e,n,t,r){let a="";for(let e=parseInt(n);e0&&(o+="\n"),(l=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T].filter(nr).join("\n")).length>0&&(l+="\n");else{let e,n,r,s,u;o=[np(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+g:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&!1===t.flatShading?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+m:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(nr).join("\n"),l=[np(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+g:"",t.envMap?"#define "+_:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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 "+m:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==S.NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==S.NoToneMapping?M.tonemapping_pars_fragment:"",t.toneMapping!==S.NoToneMapping?(a="toneMapping",void 0===(e=nn[i=t.toneMapping])?((0,S.warn)("WebGLProgram: Unsupported toneMapping:",i),"vec3 "+a+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+a+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",M.colorspace_pars_fragment,(n=function(e){S.ColorManagement._getMatrix(e7,S.ColorManagement.workingColorSpace,e);let n=`mat3( ${e7.elements.map(e=>e.toFixed(4))} )`;switch(S.ColorManagement.getTransfer(e)){case S.LinearTransfer:return[n,"LinearTransferOETF"];case S.SRGBTransfer:return[n,"sRGBTransferOETF"];default:return(0,S.warn)("WebGLProgram: Unsupported color space: ",e),[n,"LinearTransferOETF"]}}(t.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { + return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) ); +}`),(S.ColorManagement.getLuminanceCoefficients(nt),r=nt.x.toFixed(4),s=nt.y.toFixed(4),u=nt.z.toFixed(4),`float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( ${r}, ${s}, ${u} ); + return dot( weights, rgb ); +}`),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"","\n"].filter(nr).join("\n")}f=ni(f=na(f=nl(f),t),t),p=ni(p=na(p=nl(p),t),t),f=nd(f),p=nd(p),!0!==t.isRawShaderMaterial&&(x="#version 300 es\n",o=[E,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+o,l=["#define varying in",t.glslVersion===S.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===S.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+l);let R=x+o+f,C=x+l+p,y=e8(c,c.VERTEX_SHADER,R),A=e8(c,c.FRAGMENT_SHADER,C);function P(n){if(e.debug.checkShaderErrors){let t=c.getProgramInfoLog(b)||"",r=c.getShaderInfoLog(y)||"",a=c.getShaderInfoLog(A)||"",i=t.trim(),s=r.trim(),u=a.trim(),d=!0,f=!0;if(!1===c.getProgramParameter(b,c.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,y,A);else{let e=ne(c,y,"vertex"),t=ne(c,A,"fragment");(0,S.error)("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+n.name+"\nMaterial Type: "+n.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+t)}else""!==i?(0,S.warn)("WebGLProgram: Program Info Log:",i):(""===s||""===u)&&(f=!1);f&&(n.diagnostics={runnable:d,programLog:i,vertexShader:{log:s,prefix:o},fragmentShader:{log:u,prefix:l}})}c.deleteShader(y),c.deleteShader(A),s=new e6(c,b),u=function(e,n){let t={},r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let a=0;a0,Y=i.clearcoat>0,K=i.dispersion>0,$=i.iridescence>0,Q=i.sheen>0,Z=i.transmission>0,J=q&&!!i.anisotropyMap,ee=Y&&!!i.clearcoatMap,en=Y&&!!i.clearcoatNormalMap,et=Y&&!!i.clearcoatRoughnessMap,er=$&&!!i.iridescenceMap,ea=$&&!!i.iridescenceThicknessMap,ei=Q&&!!i.sheenColorMap,eo=Q&&!!i.sheenRoughnessMap,el=!!i.specularMap,es=!!i.specularColorMap,eu=!!i.specularIntensityMap,ec=Z&&!!i.transmissionMap,ed=Z&&!!i.thicknessMap,ef=!!i.gradientMap,ep=!!i.alphaMap,em=i.alphaTest>0,eh=!!i.alphaHash,eg=!!i.extensions,e_=S.NoToneMapping;i.toneMapped&&(null===N||!0===N.isXRRenderTarget)&&(e_=e.toneMapping);let ev={shaderID:A,shaderType:i.type,shaderName:i.name,vertexShader:_,fragmentShader:v,defines:i.defines,customVertexShaderID:E,customFragmentShaderID:T,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:p,batching:I,batchingColor:I&&null!==g._colorsTexture,instancing:D,instancingColor:D&&null!==g.instanceColor,instancingMorph:D&&null!==g.morphTexture,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:S.LinearSRGBColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:F,matcap:O,envMap:B,envMapMode:B&&C.mapping,envMapCubeUVHeight:y,aoMap:G,lightMap:H,bumpMap:k,normalMap:V,displacementMap:z,emissiveMap:W,normalMapObjectSpace:V&&i.normalMapType===S.ObjectSpaceNormalMap,normalMapTangentSpace:V&&i.normalMapType===S.TangentSpaceNormalMap,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:J,clearcoat:Y,clearcoatMap:ee,clearcoatNormalMap:en,clearcoatRoughnessMap:et,dispersion:K,iridescence:$,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:Q,sheenColorMap:ei,sheenRoughnessMap:eo,specularMap:el,specularColorMap:es,specularIntensityMap:eu,transmission:Z,transmissionMap:ec,thicknessMap:ed,gradientMap:ef,opaque:!1===i.transparent&&i.blending===S.NormalBlending&&!1===i.alphaToCoverage,alphaMap:ep,alphaTest:em,alphaHash:eh,combine:i.combine,mapUv:F&&h(i.map.channel),aoMapUv:G&&h(i.aoMap.channel),lightMapUv:H&&h(i.lightMap.channel),bumpMapUv:k&&h(i.bumpMap.channel),normalMapUv:V&&h(i.normalMap.channel),displacementMapUv:z&&h(i.displacementMap.channel),emissiveMapUv:W&&h(i.emissiveMap.channel),metalnessMapUv:X&&h(i.metalnessMap.channel),roughnessMapUv:j&&h(i.roughnessMap.channel),anisotropyMapUv:J&&h(i.anisotropyMap.channel),clearcoatMapUv:ee&&h(i.clearcoatMap.channel),clearcoatNormalMapUv:en&&h(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&h(i.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&h(i.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&h(i.iridescenceThicknessMap.channel),sheenColorMapUv:ei&&h(i.sheenColorMap.channel),sheenRoughnessMapUv:eo&&h(i.sheenRoughnessMap.channel),specularMapUv:el&&h(i.specularMap.channel),specularColorMapUv:es&&h(i.specularColorMap.channel),specularIntensityMapUv:eu&&h(i.specularIntensityMap.channel),transmissionMapUv:ec&&h(i.transmissionMap.channel),thicknessMapUv:ed&&h(i.thicknessMap.channel),alphaMapUv:ep&&h(i.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(V||q),vertexColors:i.vertexColors,vertexAlphas:!0===i.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!b.attributes.uv&&(F||ep),fog:!!M,useFog:!0===i.fog,fogExp2:!!M&&M.isFogExp2,flatShading:!0===i.flatShading&&!1===i.wireframe,sizeAttenuation:!0===i.sizeAttenuation,logarithmicDepthBuffer:f,reversedDepthBuffer:U,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:w,morphTextureStride:L,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,numLightProbes:l.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:e_,decodeVideoTexture:F&&!0===i.map.isVideoTexture&&S.ColorManagement.getTransfer(i.map.colorSpace)===S.SRGBTransfer,decodeVideoTextureEmissive:W&&!0===i.emissiveMap.isVideoTexture&&S.ColorManagement.getTransfer(i.emissiveMap.colorSpace)===S.SRGBTransfer,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===S.DoubleSide,flipSided:i.side===S.BackSide,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:eg&&!0===i.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eg&&!0===i.extensions.multiDraw||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:i.customProgramCacheKey()};return ev.vertexUv1s=u.has(1),ev.vertexUv2s=u.has(2),ev.vertexUv3s=u.has(3),u.clear(),ev},getProgramCacheKey:function(n){var t,r,a,i;let o=[];if(n.shaderID?o.push(n.shaderID):(o.push(n.customVertexShaderID),o.push(n.customFragmentShaderID)),void 0!==n.defines)for(let e in n.defines)o.push(e),o.push(n.defines[e]);return!1===n.isRawShaderMaterial&&(t=o,r=n,t.push(r.precision),t.push(r.outputColorSpace),t.push(r.envMapMode),t.push(r.envMapCubeUVHeight),t.push(r.mapUv),t.push(r.alphaMapUv),t.push(r.lightMapUv),t.push(r.aoMapUv),t.push(r.bumpMapUv),t.push(r.normalMapUv),t.push(r.displacementMapUv),t.push(r.emissiveMapUv),t.push(r.metalnessMapUv),t.push(r.roughnessMapUv),t.push(r.anisotropyMapUv),t.push(r.clearcoatMapUv),t.push(r.clearcoatNormalMapUv),t.push(r.clearcoatRoughnessMapUv),t.push(r.iridescenceMapUv),t.push(r.iridescenceThicknessMapUv),t.push(r.sheenColorMapUv),t.push(r.sheenRoughnessMapUv),t.push(r.specularMapUv),t.push(r.specularColorMapUv),t.push(r.specularIntensityMapUv),t.push(r.transmissionMapUv),t.push(r.thicknessMapUv),t.push(r.combine),t.push(r.fogExp2),t.push(r.sizeAttenuation),t.push(r.morphTargetsCount),t.push(r.morphAttributeCount),t.push(r.numDirLights),t.push(r.numPointLights),t.push(r.numSpotLights),t.push(r.numSpotLightMaps),t.push(r.numHemiLights),t.push(r.numRectAreaLights),t.push(r.numDirLightShadows),t.push(r.numPointLightShadows),t.push(r.numSpotLightShadows),t.push(r.numSpotLightShadowsWithMaps),t.push(r.numLightProbes),t.push(r.shadowMapType),t.push(r.toneMapping),t.push(r.numClippingPlanes),t.push(r.numClipIntersection),t.push(r.depthPacking),a=o,i=n,l.disableAll(),i.instancing&&l.enable(0),i.instancingColor&&l.enable(1),i.instancingMorph&&l.enable(2),i.matcap&&l.enable(3),i.envMap&&l.enable(4),i.normalMapObjectSpace&&l.enable(5),i.normalMapTangentSpace&&l.enable(6),i.clearcoat&&l.enable(7),i.iridescence&&l.enable(8),i.alphaTest&&l.enable(9),i.vertexColors&&l.enable(10),i.vertexAlphas&&l.enable(11),i.vertexUv1s&&l.enable(12),i.vertexUv2s&&l.enable(13),i.vertexUv3s&&l.enable(14),i.vertexTangents&&l.enable(15),i.anisotropy&&l.enable(16),i.alphaHash&&l.enable(17),i.batching&&l.enable(18),i.dispersion&&l.enable(19),i.batchingColor&&l.enable(20),i.gradientMap&&l.enable(21),a.push(l.mask),l.disableAll(),i.fog&&l.enable(0),i.useFog&&l.enable(1),i.flatShading&&l.enable(2),i.logarithmicDepthBuffer&&l.enable(3),i.reversedDepthBuffer&&l.enable(4),i.skinning&&l.enable(5),i.morphTargets&&l.enable(6),i.morphNormals&&l.enable(7),i.morphColors&&l.enable(8),i.premultipliedAlpha&&l.enable(9),i.shadowMapEnabled&&l.enable(10),i.doubleSided&&l.enable(11),i.flipSided&&l.enable(12),i.useDepthPacking&&l.enable(13),i.dithering&&l.enable(14),i.transmission&&l.enable(15),i.sheen&&l.enable(16),i.opaque&&l.enable(17),i.pointsUvs&&l.enable(18),i.decodeVideoTexture&&l.enable(19),i.decodeVideoTextureEmissive&&l.enable(20),i.alphaToCoverage&&l.enable(21),a.push(l.mask),o.push(e.outputColorSpace)),o.push(n.customProgramCacheKey),o.join()},getUniforms:function(e){let n,t=m[e.type];if(t){let e=x[t];n=S.UniformsUtils.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(n,t){let r=d.get(t);return void 0!==r?++r.usedTimes:(r=new nv(e,t,n,i),c.push(r),d.set(t,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let n=c.indexOf(e);c[n]=c[c.length-1],c.pop(),d.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){s.remove(e)},programs:c,dispose:function(){s.dispose()}}}function nb(){let e=new WeakMap;return{has:function(n){return e.has(n)},get:function(n){let t=e.get(n);return void 0===t&&(t={},e.set(n,t)),t},remove:function(n){e.delete(n)},update:function(n,t,r){e.get(n)[t]=r},dispose:function(){e=new WeakMap}}}function nx(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.material.id!==n.material.id?e.material.id-n.material.id:e.z!==n.z?e.z-n.z:e.id-n.id}function nR(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.z!==n.z?n.z-e.z:e.id-n.id}function nC(){let e=[],n=0,t=[],r=[],a=[];function i(t,r,a,i,o,l){let s=e[n];return void 0===s?(s={id:t.id,object:t,geometry:r,material:a,groupOrder:i,renderOrder:t.renderOrder,z:o,group:l},e[n]=s):(s.id=t.id,s.object=t,s.geometry=r,s.material=a,s.groupOrder=i,s.renderOrder=t.renderOrder,s.z=o,s.group=l),n++,s}return{opaque:t,transmissive:r,transparent:a,init:function(){n=0,t.length=0,r.length=0,a.length=0},push:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.push(c):!0===o.transparent?a.push(c):t.push(c)},unshift:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.unshift(c):!0===o.transparent?a.unshift(c):t.unshift(c)},finish:function(){for(let t=n,r=e.length;t1&&t.sort(e||nx),r.length>1&&r.sort(n||nR),a.length>1&&a.sort(n||nR)}}}function ny(){let e=new WeakMap;return{get:function(n,t){let r,a=e.get(n);return void 0===a?(r=new nC,e.set(n,[r])):t>=a.length?(r=new nC,a.push(r)):r=a[t],r},dispose:function(){e=new WeakMap}}}function nA(){let e={};return{get:function(n){let t;if(void 0!==e[n.id])return e[n.id];switch(n.type){case"DirectionalLight":t={direction:new S.Vector3,color:new S.Color};break;case"SpotLight":t={position:new S.Vector3,direction:new S.Vector3,color:new S.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new S.Vector3,color:new S.Color,distance:0,decay:0};break;case"HemisphereLight":t={direction:new S.Vector3,skyColor:new S.Color,groundColor:new S.Color};break;case"RectAreaLight":t={color:new S.Color,position:new S.Vector3,halfWidth:new S.Vector3,halfHeight:new S.Vector3}}return e[n.id]=t,t}}}let nP=0;function nw(e,n){return 2*!!n.castShadow-2*!!e.castShadow+ +!!n.map-!!e.map}function nL(e){let n,t=new nA,r=(n={},{get:function(e){let t;if(void 0!==n[e.id])return n[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new S.Vector2};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new S.Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)a.probe.push(new S.Vector3);let i=new S.Vector3,o=new S.Matrix4,l=new S.Matrix4;return{setup:function(n){let i=0,o=0,l=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let s=0,u=0,c=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;n.sort(nw);for(let e=0,E=n.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=b.LTC_FLOAT_1,a.rectAreaLTC2=b.LTC_FLOAT_2):(a.rectAreaLTC1=b.LTC_HALF_1,a.rectAreaLTC2=b.LTC_HALF_2)),a.ambient[0]=i,a.ambient[1]=o,a.ambient[2]=l;let E=a.hash;(E.directionalLength!==s||E.pointLength!==u||E.spotLength!==c||E.rectAreaLength!==d||E.hemiLength!==f||E.numDirectionalShadows!==p||E.numPointShadows!==m||E.numSpotShadows!==h||E.numSpotMaps!==g||E.numLightProbes!==v)&&(a.directional.length=s,a.spot.length=c,a.rectArea.length=d,a.point.length=u,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+g-_,a.spotLightMap.length=g,a.numSpotLightShadowsWithMaps=_,a.numLightProbes=v,E.directionalLength=s,E.pointLength=u,E.spotLength=c,E.rectAreaLength=d,E.hemiLength=f,E.numDirectionalShadows=p,E.numPointShadows=m,E.numSpotShadows=h,E.numSpotMaps=g,E.numLightProbes=v,a.version=nP++)},setupView:function(e,n){let t=0,r=0,s=0,u=0,c=0,d=n.matrixWorldInverse;for(let n=0,f=e.length;n=i.length?(a=new nN(e),i.push(a)):a=i[r],a},dispose:function(){n=new WeakMap}}}let nD=[new S.Vector3(1,0,0),new S.Vector3(-1,0,0),new S.Vector3(0,1,0),new S.Vector3(0,-1,0),new S.Vector3(0,0,1),new S.Vector3(0,0,-1)],nI=[new S.Vector3(0,-1,0),new S.Vector3(0,-1,0),new S.Vector3(0,0,1),new S.Vector3(0,0,-1),new S.Vector3(0,-1,0),new S.Vector3(0,-1,0)],nF=new S.Matrix4,nO=new S.Vector3,nB=new S.Vector3;function nG(e,n,t){let r=new S.Frustum,a=new S.Vector2,i=new S.Vector2,o=new S.Vector4,l=new S.MeshDepthMaterial,s=new S.MeshDistanceMaterial,u={},c=t.maxTextureSize,d={[S.FrontSide]:S.BackSide,[S.BackSide]:S.FrontSide,[S.DoubleSide]:S.DoubleSide},f=new S.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new S.Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new S.BufferGeometry;m.setAttribute("position",new S.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new S.Mesh(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=S.PCFShadowMap;let _=this.type;function v(n,t,r,a){let i=null,o=!0===r.isPointLight?n.customDistanceMaterial:n.customDepthMaterial;if(void 0!==o)i=o;else if(i=!0===r.isPointLight?s:l,e.localClippingEnabled&&!0===t.clipShadows&&Array.isArray(t.clippingPlanes)&&0!==t.clippingPlanes.length||t.displacementMap&&0!==t.displacementScale||t.alphaMap&&t.alphaTest>0||t.map&&t.alphaTest>0||!0===t.alphaToCoverage){let e=i.uuid,n=t.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let a=r[n];void 0===a&&(a=i.clone(),r[n]=a,t.addEventListener("dispose",E)),i=a}return i.visible=t.visible,i.wireframe=t.wireframe,a===S.VSMShadowMap?i.side=null!==t.shadowSide?t.shadowSide:t.side:i.side=null!==t.shadowSide?t.shadowSide:d[t.side],i.alphaMap=t.alphaMap,i.alphaTest=!0===t.alphaToCoverage?.5:t.alphaTest,i.map=t.map,i.clipShadows=t.clipShadows,i.clippingPlanes=t.clippingPlanes,i.clipIntersection=t.clipIntersection,i.displacementMap=t.displacementMap,i.displacementScale=t.displacementScale,i.displacementBias=t.displacementBias,i.wireframeLinewidth=t.wireframeLinewidth,i.linewidth=t.linewidth,!0===r.isPointLight&&!0===i.isMeshDistanceMaterial&&(e.properties.get(i).light=r),i}function E(e){for(let n in e.target.removeEventListener("dispose",E),u){let t=u[n],r=e.target.uuid;r in t&&(t[r].dispose(),delete t[r])}}this.render=function(t,l,s){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===t.length)return;t.type===S.PCFSoftShadowMap&&((0,S.warn)("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),t.type=S.PCFShadowMap);let u=e.getRenderTarget(),d=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),E=e.state;E.setBlending(S.NoBlending),!0===E.buffers.depth.getReversed()?E.buffers.color.setClear(0,0,0,0):E.buffers.color.setClear(1,1,1,1),E.buffers.depth.setTest(!0),E.setScissorTest(!1);let T=_!==this.type;T&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,d=t.length;uc||a.y>c)&&(a.x>c&&(i.x=Math.floor(c/g.x),a.x=i.x*g.x,m.mapSize.x=i.x),a.y>c&&(i.y=Math.floor(c/g.y),a.y=i.y*g.y,m.mapSize.y=i.y)),null===m.map||!0===T){if(null!==m.map&&(null!==m.map.depthTexture&&(m.map.depthTexture.dispose(),m.map.depthTexture=null),m.map.dispose()),this.type===S.VSMShadowMap){if(d.isPointLight){(0,S.warn)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new S.WebGLRenderTarget(a.x,a.y,{format:S.RGFormat,type:S.HalfFloatType,minFilter:S.LinearFilter,magFilter:S.LinearFilter,generateMipmaps:!1}),m.map.texture.name=d.name+".shadowMap",m.map.depthTexture=new S.DepthTexture(a.x,a.y,S.FloatType),m.map.depthTexture.name=d.name+".shadowMapDepth",m.map.depthTexture.format=S.DepthFormat,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=S.NearestFilter,m.map.depthTexture.magFilter=S.NearestFilter}else{d.isPointLight?(m.map=new S.WebGLCubeRenderTarget(a.x),m.map.depthTexture=new S.CubeDepthTexture(a.x,S.UnsignedIntType)):(m.map=new S.WebGLRenderTarget(a.x,a.y),m.map.depthTexture=new S.DepthTexture(a.x,a.y,S.UnsignedIntType)),m.map.depthTexture.name=d.name+".shadowMap",m.map.depthTexture.format=S.DepthFormat;let n=e.state.buffers.depth.getReversed();this.type===S.PCFShadowMap?(m.map.depthTexture.compareFunction=n?S.GreaterEqualCompare:S.LessEqualCompare,m.map.depthTexture.minFilter=S.LinearFilter,m.map.depthTexture.magFilter=S.LinearFilter):(m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=S.NearestFilter,m.map.depthTexture.magFilter=S.NearestFilter)}m.camera.updateProjectionMatrix()}let _=m.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(m.map.isWebGLCubeRenderTarget)e.setRenderTarget(m.map,t),e.clear();else{0===t&&(e.setRenderTarget(m.map),e.clear());let n=m.getViewport(t);o.set(i.x*n.x,i.y*n.y,i.x*n.z,i.y*n.w),E.viewport(o)}if(d.isPointLight){let e=m.camera,n=m.matrix,r=d.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),nO.setFromMatrixPosition(d.matrixWorld),e.position.copy(nO),nB.copy(e.position),nB.add(nD[t]),e.up.copy(nI[t]),e.lookAt(nB),e.updateMatrixWorld(),n.makeTranslation(-nO.x,-nO.y,-nO.z),nF.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),m._frustum.setFromProjectionMatrix(nF,e.coordinateSystem,e.reversedDepth)}else m.updateMatrices(d);r=m.getFrustum(),function t(a,i,o,l,s){if(!1===a.visible)return;if(a.layers.test(i.layers)&&(a.isMesh||a.isLine||a.isPoints)&&(a.castShadow||a.receiveShadow&&s===S.VSMShadowMap)&&(!a.frustumCulled||r.intersectsObject(a))){a.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,a.matrixWorld);let t=n.update(a),r=a.material;if(Array.isArray(r)){let n=t.groups;for(let u=0,c=n.length;u=1:-1!==L.indexOf("OpenGL ES")&&(w=parseFloat(/^OpenGL ES (\d)/.exec(L)[1])>=2);let N=null,U={},D=e.getParameter(e.SCISSOR_BOX),I=e.getParameter(e.VIEWPORT),F=new S.Vector4().fromArray(D),O=new S.Vector4().fromArray(I);function B(n,t,r,a){let i=new Uint8Array(4),o=e.createTexture();e.bindTexture(n,o),e.texParameteri(n,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(n,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;otypeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new S.Vector2,d=new WeakMap,f=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,n){return p?new OffscreenCanvas(e,n):(0,S.createElementNS)("canvas")}function h(e,n,t){let r=1,a=z(e);if((a.width>t||a.height>t)&&(r=t/Math.max(a.width,a.height)),r<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let t=Math.floor(r*a.width),i=Math.floor(r*a.height);void 0===l&&(l=m(t,i));let o=n?m(t,i):l;return o.width=t,o.height=i,o.getContext("2d").drawImage(e,0,0,t,i),(0,S.warn)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+t+"x"+i+")."),o}else"data"in e&&(0,S.warn)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function g(e){return e.generateMipmaps}function _(n){e.generateMipmap(n)}function v(t,r,a,i,o=!1){if(null!==t){if(void 0!==e[t])return e[t];(0,S.warn)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let l=r;if(r===e.RED&&(a===e.FLOAT&&(l=e.R32F),a===e.HALF_FLOAT&&(l=e.R16F),a===e.UNSIGNED_BYTE&&(l=e.R8)),r===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.R8UI),a===e.UNSIGNED_SHORT&&(l=e.R16UI),a===e.UNSIGNED_INT&&(l=e.R32UI),a===e.BYTE&&(l=e.R8I),a===e.SHORT&&(l=e.R16I),a===e.INT&&(l=e.R32I)),r===e.RG&&(a===e.FLOAT&&(l=e.RG32F),a===e.HALF_FLOAT&&(l=e.RG16F),a===e.UNSIGNED_BYTE&&(l=e.RG8)),r===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RG8UI),a===e.UNSIGNED_SHORT&&(l=e.RG16UI),a===e.UNSIGNED_INT&&(l=e.RG32UI),a===e.BYTE&&(l=e.RG8I),a===e.SHORT&&(l=e.RG16I),a===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGB8UI),a===e.UNSIGNED_SHORT&&(l=e.RGB16UI),a===e.UNSIGNED_INT&&(l=e.RGB32UI),a===e.BYTE&&(l=e.RGB8I),a===e.SHORT&&(l=e.RGB16I),a===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),a===e.UNSIGNED_INT&&(l=e.RGBA32UI),a===e.BYTE&&(l=e.RGBA8I),a===e.SHORT&&(l=e.RGBA16I),a===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(a===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let n=o?S.LinearTransfer:S.ColorManagement.getTransfer(i);a===e.FLOAT&&(l=e.RGBA32F),a===e.HALF_FLOAT&&(l=e.RGBA16F),a===e.UNSIGNED_BYTE&&(l=n===S.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&n.get("EXT_color_buffer_float"),l}function E(n,t){let r;return n?null===t||t===S.UnsignedIntType||t===S.UnsignedInt248Type?r=e.DEPTH24_STENCIL8:t===S.FloatType?r=e.DEPTH32F_STENCIL8:t===S.UnsignedShortType&&(r=e.DEPTH24_STENCIL8,(0,S.warn)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===t||t===S.UnsignedIntType||t===S.UnsignedInt248Type?r=e.DEPTH_COMPONENT24:t===S.FloatType?r=e.DEPTH_COMPONENT32F:t===S.UnsignedShortType&&(r=e.DEPTH_COMPONENT16),r}function T(e,n){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==S.NearestFilter&&e.minFilter!==S.LinearFilter?Math.log2(Math.max(n.width,n.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?n.mipmaps.length:1}function M(e){let n=e.target;n.removeEventListener("dispose",M),function(e){let n=r.get(e);if(void 0===n.__webglInit)return;let t=e.source,a=f.get(t);if(a){let r=a[n.__cacheKey];r.usedTimes--,0===r.usedTimes&&x(e),0===Object.keys(a).length&&f.delete(t)}r.remove(e)}(n),n.isVideoTexture&&d.delete(n)}function b(n){let t=n.target;t.removeEventListener("dispose",b),function(n){let t=r.get(n);if(n.depthTexture&&(n.depthTexture.dispose(),r.remove(n.depthTexture)),n.isWebGLCubeRenderTarget)for(let n=0;n<6;n++){if(Array.isArray(t.__webglFramebuffer[n]))for(let r=0;r0&&s.__version!==n.version){let e=n.image;if(null===e)(0,S.warn)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void U(s,n,a);(0,S.warn)("WebGLRenderer: Texture marked for update but image is incomplete")}}else n.isExternalTexture&&(s.__webglTexture=n.sourceTexture?n.sourceTexture:null);t.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+a)}let y={[S.RepeatWrapping]:e.REPEAT,[S.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[S.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},A={[S.NearestFilter]:e.NEAREST,[S.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[S.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[S.LinearFilter]:e.LINEAR,[S.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[S.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},P={[S.NeverCompare]:e.NEVER,[S.AlwaysCompare]:e.ALWAYS,[S.LessCompare]:e.LESS,[S.LessEqualCompare]:e.LEQUAL,[S.EqualCompare]:e.EQUAL,[S.GreaterEqualCompare]:e.GEQUAL,[S.GreaterCompare]:e.GREATER,[S.NotEqualCompare]:e.NOTEQUAL};function w(t,i){if((i.type===S.FloatType&&!1===n.has("OES_texture_float_linear")&&(i.magFilter===S.LinearFilter||i.magFilter===S.LinearMipmapNearestFilter||i.magFilter===S.NearestMipmapLinearFilter||i.magFilter===S.LinearMipmapLinearFilter||i.minFilter===S.LinearFilter||i.minFilter===S.LinearMipmapNearestFilter||i.minFilter===S.NearestMipmapLinearFilter||i.minFilter===S.LinearMipmapLinearFilter)&&(0,S.warn)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,y[i.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,y[i.wrapT]),(t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY)&&e.texParameteri(t,e.TEXTURE_WRAP_R,y[i.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,A[i.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,A[i.minFilter]),i.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,P[i.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic"))&&i.magFilter!==S.NearestFilter&&(i.minFilter===S.NearestMipmapLinearFilter||i.minFilter===S.LinearMipmapLinearFilter)&&(i.type!==S.FloatType||!1!==n.has("OES_texture_float_linear"))&&(i.anisotropy>1||r.get(i).__currentAnisotropy)){let o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}function L(n,t){let r,a=!1;void 0===n.__webglInit&&(n.__webglInit=!0,t.addEventListener("dispose",M));let i=t.source,l=f.get(i);void 0===l&&(l={},f.set(i,l));let s=((r=[]).push(t.wrapS),r.push(t.wrapT),r.push(t.wrapR||0),r.push(t.magFilter),r.push(t.minFilter),r.push(t.anisotropy),r.push(t.internalFormat),r.push(t.format),r.push(t.type),r.push(t.generateMipmaps),r.push(t.premultiplyAlpha),r.push(t.flipY),r.push(t.unpackAlignment),r.push(t.colorSpace),r.join());if(s!==n.__cacheKey){void 0===l[s]&&(l[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,a=!0),l[s].usedTimes++;let r=l[n.__cacheKey];void 0!==r&&(l[n.__cacheKey].usedTimes--,0===r.usedTimes&&x(t)),n.__cacheKey=s,n.__webglTexture=l[s].texture}return a}function N(e,n,t){return Math.floor(Math.floor(e/t)/n)}function U(n,o,l){let s=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(s=e.TEXTURE_3D);let u=L(n,o),c=o.source;t.bindTexture(s,n.__webglTexture,e.TEXTURE0+l);let d=r.get(c);if(c.version!==d.__version||!0===u){let n;t.activeTexture(e.TEXTURE0+l);let r=S.ColorManagement.getPrimaries(S.ColorManagement.workingColorSpace),f=o.colorSpace===S.NoColorSpace?null:S.ColorManagement.getPrimaries(o.colorSpace),p=o.colorSpace===S.NoColorSpace||r===f?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let m=h(o.image,!1,a.maxTextureSize);m=V(o,m);let M=i.convert(o.format,o.colorSpace),b=i.convert(o.type),x=v(o.internalFormat,M,b,o.colorSpace,o.isVideoTexture);w(s,o);let R=o.mipmaps,C=!0!==o.isVideoTexture,y=void 0===d.__version||!0===u,A=c.dataReady,P=T(o,m);if(o.isDepthTexture)x=E(o.format===S.DepthStencilFormat,o.type),y&&(C?t.texStorage2D(e.TEXTURE_2D,1,x,m.width,m.height):t.texImage2D(e.TEXTURE_2D,0,x,m.width,m.height,0,M,b,null));else if(o.isDataTexture)if(R.length>0){C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;re.start-n.start);let l=0;for(let e=1;e0){let a=(0,S.getByteLength)(n.width,n.height,o.format,o.type);for(let i of o.layerUpdates){let o=n.data.subarray(i*a/n.data.BYTES_PER_ELEMENT,(i+1)*a/n.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,i,n.width,n.height,1,M,o)}o.clearLayerUpdates()}else t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,M,n.data)}else t.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,n.data,0,0);else(0,S.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?A&&t.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,M,b,n.data):t.texImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,M,b,n.data)}else{C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;r0){let n=(0,S.getByteLength)(m.width,m.height,o.format,o.type);for(let r of o.layerUpdates){let a=m.data.subarray(r*n/m.data.BYTES_PER_ELEMENT,(r+1)*n/m.data.BYTES_PER_ELEMENT);t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,m.width,m.height,1,M,b,a)}o.clearLayerUpdates()}else t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,M,b,m.data)}else t.texImage3D(e.TEXTURE_2D_ARRAY,0,x,m.width,m.height,m.depth,0,M,b,m.data);else if(o.isData3DTexture)C?(y&&t.texStorage3D(e.TEXTURE_3D,P,x,m.width,m.height,m.depth),A&&t.texSubImage3D(e.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,M,b,m.data)):t.texImage3D(e.TEXTURE_3D,0,x,m.width,m.height,m.depth,0,M,b,m.data);else if(o.isFramebufferTexture){if(y)if(C)t.texStorage2D(e.TEXTURE_2D,P,x,m.width,m.height);else{let n=m.width,r=m.height;for(let a=0;a>=1,r>>=1}}else if(R.length>0){if(C&&y){let n=z(R[0]);t.texStorage2D(e.TEXTURE_2D,P,x,n.width,n.height)}for(let r=0,a=R.length;r>c),r=Math.max(1,a.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?t.texImage3D(u,c,p,n,r,a.depth,0,d,f,null):t.texImage2D(u,c,p,n,r,0,d,f,null)}t.bindFramebuffer(e.FRAMEBUFFER,n),k(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,h.__webglTexture,0,H(a)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,h.__webglTexture,c),t.bindFramebuffer(e.FRAMEBUFFER,null)}function I(n,t,r){if(e.bindRenderbuffer(e.RENDERBUFFER,n),t.depthBuffer){let a=t.depthTexture,i=a&&a.isDepthTexture?a.type:null,o=E(t.stencilBuffer,i),l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;k(t)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,H(t),o,t.width,t.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,H(t),o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,n)}else{let n=t.textures;for(let a=0;a{delete a.__boundDepthTexture,delete a.__depthDisposeCallback,e.removeEventListener("dispose",n)};e.addEventListener("dispose",n),a.__depthDisposeCallback=n}a.__boundDepthTexture=e}if(n.depthTexture&&!a.__autoAllocateDepthBuffer)if(i)for(let e=0;e<6;e++)F(a.__webglFramebuffer[e],n,e);else{let e=n.texture.mipmaps;e&&e.length>0?F(a.__webglFramebuffer[0],n,0):F(a.__webglFramebuffer,n,0)}else if(i){a.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[r]),void 0===a.__webglDepthbuffer[r])a.__webglDepthbuffer[r]=e.createRenderbuffer(),I(a.__webglDepthbuffer[r],n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=a.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,i)}}else{let r=n.texture.mipmaps;if(r&&r.length>0?t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[0]):t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),void 0===a.__webglDepthbuffer)a.__webglDepthbuffer=e.createRenderbuffer(),I(a.__webglDepthbuffer,n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=a.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,r)}}t.bindFramebuffer(e.FRAMEBUFFER,null)}let B=[],G=[];function H(e){return Math.min(a.maxSamples,e.samples)}function k(e){let t=r.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function V(e,n){let t=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||t!==S.LinearSRGBColorSpace&&t!==S.NoColorSpace&&(S.ColorManagement.getTransfer(t)===S.SRGBTransfer?(r!==S.RGBAFormat||a!==S.UnsignedByteType)&&(0,S.warn)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,S.error)("WebGLTextures: Unsupported texture color space:",t)),n}function z(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=R;return e>=a.maxTextures&&(0,S.warn)("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),R+=1,e},this.resetTextureUnits=function(){R=0},this.setTexture2D=C,this.setTexture2DArray=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?U(i,n,a):(n.isExternalTexture&&(i.__webglTexture=n.sourceTexture?n.sourceTexture:null),t.bindTexture(e.TEXTURE_2D_ARRAY,i.__webglTexture,e.TEXTURE0+a))},this.setTexture3D=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?U(i,n,a):t.bindTexture(e.TEXTURE_3D,i.__webglTexture,e.TEXTURE0+a)},this.setTextureCube=function(n,o){let l=r.get(n);!0!==n.isCubeDepthTexture&&n.version>0&&l.__version!==n.version?function(n,o,l){if(6!==o.image.length)return;let s=L(n,o),u=o.source;t.bindTexture(e.TEXTURE_CUBE_MAP,n.__webglTexture,e.TEXTURE0+l);let c=r.get(u);if(u.version!==c.__version||!0===s){let n;t.activeTexture(e.TEXTURE0+l);let r=S.ColorManagement.getPrimaries(S.ColorManagement.workingColorSpace),d=o.colorSpace===S.NoColorSpace?null:S.ColorManagement.getPrimaries(o.colorSpace),f=o.colorSpace===S.NoColorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=o.isCompressedTexture||o.image[0].isCompressedTexture,m=o.image[0]&&o.image[0].isDataTexture,E=[];for(let e=0;e<6;e++)p||m?E[e]=m?o.image[e].image:o.image[e]:E[e]=h(o.image[e],!0,a.maxCubemapSize),E[e]=V(o,E[e]);let M=E[0],b=i.convert(o.format,o.colorSpace),x=i.convert(o.type),R=v(o.internalFormat,b,x,o.colorSpace),C=!0!==o.isVideoTexture,y=void 0===c.__version||!0===s,A=u.dataReady,P=T(o,M);if(w(e.TEXTURE_CUBE_MAP,o),p){C&&y&&t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,M.width,M.height);for(let r=0;r<6;r++){n=E[r].mipmaps;for(let a=0;a0&&P++;let r=z(E[0]);t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,r.width,r.height)}for(let r=0;r<6;r++)if(m){C?A&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,E[r].width,E[r].height,b,x,E[r].data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,R,E[r].width,E[r].height,0,b,x,E[r].data);for(let a=0;a1;if(!d&&(void 0===s.__webglTexture&&(s.__webglTexture=e.createTexture()),s.__version=a.version,o.memory.textures++),c){l.__webglFramebuffer=[];for(let n=0;n<6;n++)if(a.mipmaps&&a.mipmaps.length>0){l.__webglFramebuffer[n]=[];for(let t=0;t0){l.__webglFramebuffer=[];for(let n=0;n0&&!1===k(n)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],t.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let t=0;t0)for(let r=0;r0)for(let t=0;t0){if(!1===k(n)){let a=n.textures,i=n.width,o=n.height,l=e.COLOR_BUFFER_BIT,s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(n),d=a.length>1;if(d)for(let n=0;n0?t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let t=0;t= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class nj{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let t=new S.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=t}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,t=new S.ShaderMaterial({vertexShader:nW,fragmentShader:nX,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new S.Mesh(new S.PlaneGeometry(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nq extends S.EventDispatcher{constructor(e,n){super();const t=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="u">typeof XRWebGLBinding,h=new nj,g={},_=n.getContextAttributes();let v=null,T=null;const M=[],b=[],x=new S.Vector2;let R=null;const C=new S.PerspectiveCamera;C.viewport=new S.Vector4;const y=new S.PerspectiveCamera;y.viewport=new S.Vector4;const A=[C,y],P=new S.ArrayCamera;let w=null,L=null;function N(e){let n=b.indexOf(e.inputSource);if(-1===n)return;let t=M[n];void 0!==t&&(t.update(e.inputSource,e.frame,s||i),t.dispatchEvent({type:e.type,data:e.inputSource}))}function U(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",D);for(let e=0;e=0&&(b[r]=null,M[r].disconnect(t))}for(let n=0;n=b.length){b.push(t),r=e;break}else if(null===b[e]){b[e]=t,r=e;break}if(-1===r)break}let a=M[r];a&&a.connect(t)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getGripSpace()},this.getHand=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&(0,S.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&(0,S.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,n)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(v=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",U),r.addEventListener("inputsourceschange",D),!0!==_.xrCompatible&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(x),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,o=null;_.depth&&(o=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=_.stencil?S.DepthStencilFormat:S.DepthFormat,i=_.stencil?S.UnsignedInt248Type:S.UnsignedIntType);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new S.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:S.RGBAFormat,type:S.UnsignedByteType,depthTexture:new S.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:4*!!_.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let t={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,n,t),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),T=new S.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:S.RGBAFormat,type:S.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new S.Vector3,F=new S.Vector3;function O(e,n){null===n?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(n.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,t,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),P.near=y.near=C.near=i,P.far=y.far=C.far=o,(w!==P.near||L!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),w=P.near,L=P.far),P.layers.mask=6|e.layers.mask,C.layers.mask=3&P.layers.mask,y.layers.mask=5&P.layers.mask;let l=e.parent,s=P.cameras;O(P,l);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let a=n.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,nY.copy(o),nY.x*=-1,nY.y*=-1,nY.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(nY.y*=-1,nY.z*=-1),e.envMapRotation.value.setFromMatrix4(nK.makeRotationFromEuler(nY)),e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,t(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,t(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,t){t.color.getRGB(n.fogColor.value,(0,S.getUnlitUniformColorSpace)(e)),t.isFog?(n.fogNear.value=t.near,n.fogFar.value=t.far):t.isFogExp2&&(n.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,g,_,v,E,T,M,b,x,R,C,y,A,P,w,L;let N;a.isMeshBasicMaterial||a.isMeshLambertMaterial?r(e,a):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,g=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===S.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),_=e,(v=a).matcap&&(_.matcap.value=v.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),E=e,T=a,N=n.get(T).light,E.referencePosition.value.setFromMatrixPosition(N.matrixWorld),E.nearDistance.value=N.shadow.camera.near,E.farDistance.value=N.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(M=e,b=a,M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform)),a.isLineDashedMaterial&&(x=e,R=a,x.dashSize.value=R.dashSize,x.totalSize.value=R.dashSize+R.gapSize,x.scale.value=R.scale)):a.isPointsMaterial?(C=e,y=a,A=i,P=o,C.diffuse.value.copy(y.color),C.opacity.value=y.opacity,C.size.value=y.size*A,C.scale.value=.5*P,y.map&&(C.map.value=y.map,t(y.map,C.uvTransform)),y.alphaMap&&(C.alphaMap.value=y.alphaMap,t(y.alphaMap,C.alphaMapTransform)),y.alphaTest>0&&(C.alphaTest.value=y.alphaTest)):a.isSpriteMaterial?(w=e,L=a,w.diffuse.value.copy(L.color),w.opacity.value=L.opacity,w.rotation.value=L.rotation,L.map&&(w.map.value=L.map,t(L.map,w.mapTransform)),L.alphaMap&&(w.alphaMap.value=L.alphaMap,t(L.alphaMap,w.alphaMapTransform)),L.alphaTest>0&&(w.alphaTest.value=L.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function nQ(e,n,t,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,S.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,S.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function u(n){let t=n.target;t.removeEventListener("dispose",u);let r=o.indexOf(t.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[t.id]),delete a[t.id],delete i[t.id]}return{bind:function(e,n){let t=n.program;r.uniformBlockBinding(e,t)},update:function(t,c){var d;let f,p,m,h,g=a[t.id];void 0===g&&(function(e){let n=e.uniforms,t=0;for(let e=0,r=n.length;e0&&(t+=16-r),e.__size=t,e.__cache={}}(t),(d=t).__bindingPointIndex=f=function(){for(let e=0;etypeof WebGLRenderingContext&&F instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");n=F.getContextAttributes().alpha}else n=G;const q=new Set([S.RGBAIntegerFormat,S.RGIntegerFormat,S.RedIntegerFormat]),en=new Set([S.UnsignedByteType,S.UnsignedIntType,S.UnsignedShortType,S.UnsignedInt248Type,S.UnsignedShort4444Type,S.UnsignedShort5551Type]),er=new Uint32Array(4),ea=new Int32Array(4);let ei=null,eo=null;const el=[],es=[];let eu=null;this.domElement=I,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=S.NoToneMapping,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const ec=this;let ed=!1;this._outputColorSpace=S.SRGBColorSpace;let ef=0,ep=0,em=null,eh=-1,eg=null;const e_=new S.Vector4,ev=new S.Vector4;let eS=null;const eE=new S.Color(0);let eT=0,eM=I.width,eb=I.height,ex=1,eR=null,eC=null;const ey=new S.Vector4(0,0,eM,eb),eA=new S.Vector4(0,0,eM,eb);let eP=!1;const ew=new S.Frustum;let eL=!1,eN=!1;const eU=new S.Matrix4,eD=new S.Vector3,eI=new S.Vector4,eF={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eO=!1;function eB(){return null===em?ex:1}let eG=F;function eH(e,n){return I.getContext(e,n)}try{if("setAttribute"in I&&I.setAttribute("data-engine",`three.js r${S.REVISION}`),I.addEventListener("webglcontextlost",ez,!1),I.addEventListener("webglcontextrestored",eW,!1),I.addEventListener("webglcontextcreationerror",eX,!1),null===eG){const e="webgl2";if(eG=eH(e,{alpha:!0,depth:O,stencil:B,antialias:H,premultipliedAlpha:k,preserveDrawingBuffer:V,powerPreference:z,failIfMajorPerformanceCaveat:W}),null===eG)if(eH(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw(0,S.error)("WebGLRenderer: "+e.message),e}function ek(){(t=new K(eG)).init(),C=new nz(eG,t),r=new L(eG,t,e,C),a=new nk(eG,t),r.reversedDepthBuffer&&X&&a.buffers.depth.setReversed(!0),i=new Z(eG),o=new nb,l=new nV(eG,t,a,o,r,C,i),s=new U(ec),u=new Y(ec),c=new T(eG),y=new P(eG,c),d=new $(eG,c,i,y),f=new ee(eG,d,c,i),b=new J(eG,r,l),_=new N(o),p=new nM(ec,s,u,t,r,y,_),m=new n$(ec,o),h=new ny,g=new nU(t),M=new A(ec,s,u,a,f,n,k),v=new nG(ec,f,r),D=new nQ(eG,i,r,a),x=new w(eG,t,i),R=new Q(eG,t,i),i.programs=p.programs,ec.capabilities=r,ec.extensions=t,ec.properties=o,ec.renderLists=h,ec.shadowMap=v,ec.state=a,ec.info=i}ek(),j!==S.UnsignedByteType&&(eu=new et(j,I.width,I.height,O,B));const eV=new nq(ec,eG);function ez(e){e.preventDefault(),(0,S.log)("WebGLRenderer: Context Lost."),ed=!0}function eW(){(0,S.log)("WebGLRenderer: Context Restored."),ed=!1;let e=i.autoReset,n=v.enabled,t=v.autoUpdate,r=v.needsUpdate,a=v.type;ek(),i.autoReset=e,v.enabled=n,v.autoUpdate=t,v.needsUpdate=r,v.type=a}function eX(e){(0,S.error)("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ej(e){var n,t;let r,a=e.target;a.removeEventListener("dispose",ej),t=n=a,void 0!==(r=o.get(t).programs)&&(r.forEach(function(e){p.releaseProgram(e)}),t.isShaderMaterial&&p.releaseShaderCache(t)),o.remove(n)}function eq(e,n,t){!0===e.transparent&&e.side===S.DoubleSide&&!1===e.forceSinglePass?(e.side=S.BackSide,e.needsUpdate=!0,e2(e,n,t),e.side=S.FrontSide,e.needsUpdate=!0,e2(e,n,t),e.side=S.DoubleSide):e2(e,n,t)}this.xr=eV,this.getContext=function(){return eG},this.getContextAttributes=function(){return eG.getContextAttributes()},this.forceContextLoss=function(){let e=t.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=t.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ex},this.setPixelRatio=function(e){void 0!==e&&(ex=e,this.setSize(eM,eb,!1))},this.getSize=function(e){return e.set(eM,eb)},this.setSize=function(e,n,t=!0){eV.isPresenting?(0,S.warn)("WebGLRenderer: Can't change size while VR device is presenting."):(eM=e,eb=n,I.width=Math.floor(e*ex),I.height=Math.floor(n*ex),!0===t&&(I.style.width=e+"px",I.style.height=n+"px"),null!==eu&&eu.setSize(I.width,I.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(eM*ex,eb*ex).floor()},this.setDrawingBufferSize=function(e,n,t){eM=e,eb=n,ex=t,I.width=Math.floor(e*t),I.height=Math.floor(n*t),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(j===S.UnsignedByteType)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let n=0;np.matrixWorld.determinant(),E=function(e,n,t,i,c){var d,f;!0!==n.isScene&&(n=eF),l.resetTextureUnits();let p=n.fog,h=i.isMeshStandardMaterial?n.environment:null,g=null===em?ec.outputColorSpace:!0===em.isXRRenderTarget?em.texture.colorSpace:S.LinearSRGBColorSpace,v=(i.isMeshStandardMaterial?u:s).get(i.envMap||h),E=!0===i.vertexColors&&!!t.attributes.color&&4===t.attributes.color.itemSize,T=!!t.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),M=!!t.morphAttributes.position,x=!!t.morphAttributes.normal,R=!!t.morphAttributes.color,C=S.NoToneMapping;i.toneMapped&&(null===em||!0===em.isXRRenderTarget)&&(C=ec.toneMapping);let y=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,A=void 0!==y?y.length:0,P=o.get(i),w=eo.state.lights;if(!0===eL&&(!0===eN||e!==eg)){let n=e===eg&&i.id===eh;_.setState(i,e,n)}let L=!1;i.version===P.__version?P.needsLights&&P.lightsStateVersion!==w.state.version||P.outputColorSpace!==g||c.isBatchedMesh&&!1===P.batching?L=!0:c.isBatchedMesh||!0!==P.batching?c.isBatchedMesh&&!0===P.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===P.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===P.instancing?L=!0:c.isInstancedMesh||!0!==P.instancing?c.isSkinnedMesh&&!1===P.skinning?L=!0:c.isSkinnedMesh||!0!==P.skinning?c.isInstancedMesh&&!0===P.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===P.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===P.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===P.instancingMorph&&null!==c.morphTexture||P.envMap!==v||!0===i.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==_.numPlanes||P.numIntersection!==_.numIntersection)||P.vertexAlphas!==E||P.vertexTangents!==T||P.morphTargets!==M||P.morphNormals!==x||P.morphColors!==R||P.toneMapping!==C?L=!0:P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=i.version);let N=P.currentProgram;!0===L&&(N=e2(i,n,c));let U=!1,I=!1,F=!1,O=N.getUniforms(),B=P.uniforms;if(a.useProgram(N.program)&&(U=!0,I=!0,F=!0),i.id!==eh&&(eh=i.id,I=!0),U||eg!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eG,"projectionMatrix",e.projectionMatrix),O.setValue(eG,"viewMatrix",e.matrixWorldInverse);let n=O.map.cameraPosition;void 0!==n&&n.setValue(eG,eD.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eG,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&O.setValue(eG,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,I=!0,F=!0)}if(P.needsLights&&(w.state.directionalShadowMap.length>0&&O.setValue(eG,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&O.setValue(eG,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&O.setValue(eG,"pointShadowMap",w.state.pointShadowMap,l)),c.isSkinnedMesh){O.setOptional(eG,c,"bindMatrix"),O.setOptional(eG,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eG,"boneTexture",e.boneTexture,l))}c.isBatchedMesh&&(O.setOptional(eG,c,"batchingTexture"),O.setValue(eG,"batchingTexture",c._matricesTexture,l),O.setOptional(eG,c,"batchingIdTexture"),O.setValue(eG,"batchingIdTexture",c._indirectTexture,l),O.setOptional(eG,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eG,"batchingColorTexture",c._colorsTexture,l));let G=t.morphAttributes;if((void 0!==G.position||void 0!==G.normal||void 0!==G.color)&&b.update(c,t,N),(I||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,O.setValue(eG,"receiveShadow",c.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=v,B.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==n.environment&&(B.envMapIntensity.value=n.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===nJ&&((nJ=new S.DataTexture(nZ,16,16,S.RGFormat,S.HalfFloatType)).name="DFG_LUT",nJ.minFilter=S.LinearFilter,nJ.magFilter=S.LinearFilter,nJ.wrapS=S.ClampToEdgeWrapping,nJ.wrapT=S.ClampToEdgeWrapping,nJ.generateMipmaps=!1,nJ.needsUpdate=!0),nJ)),I&&(O.setValue(eG,"toneMappingExposure",ec.toneMappingExposure),P.needsLights&&(d=B,f=F,d.ambientLightColor.needsUpdate=f,d.lightProbe.needsUpdate=f,d.directionalLights.needsUpdate=f,d.directionalLightShadows.needsUpdate=f,d.pointLights.needsUpdate=f,d.pointLightShadows.needsUpdate=f,d.spotLights.needsUpdate=f,d.spotLightShadows.needsUpdate=f,d.rectAreaLights.needsUpdate=f,d.hemisphereLights.needsUpdate=f),p&&!0===i.fog&&m.refreshFogUniforms(B,p),m.refreshMaterialUniforms(B,i,ex,eb,eo.state.transmissionRenderTarget[e.id]),e6.upload(eG,e4(P),B,l)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e6.upload(eG,e4(P),B,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(eG,"center",c.center),O.setValue(eG,"modelViewMatrix",c.modelViewMatrix),O.setValue(eG,"normalMatrix",c.normalMatrix),O.setValue(eG,"modelMatrix",c.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){let e=i.uniformsGroups;for(let n=0,t=e.length;n{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?n(e):setTimeout(r,10)}null!==t.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eK(){eQ.stop()}function e$(){eQ.start()}const eQ=new E;function eZ(e,n,t,r){if(!1===e.visible)return;if(e.layers.test(n.layers)){if(e.isGroup)t=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)eo.pushLight(e),e.castShadow&&eo.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ew.intersectsSprite(e)){r&&eI.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eU);let n=f.update(e),a=e.material;a.visible&&ei.push(e,n,a,t,eI.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ew.intersectsObject(e))){let n=f.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eI.copy(e.boundingSphere.center)):(null===n.boundingSphere&&n.computeBoundingSphere(),eI.copy(n.boundingSphere.center)),eI.applyMatrix4(e.matrixWorld).applyMatrix4(eU)),Array.isArray(a)){let r=n.groups;for(let i=0,o=r.length;i0&&e1(i,n,t),o.length>0&&e1(o,n,t),l.length>0&&e1(l,n,t),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e0(e,n,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===eo.state.transmissionRenderTarget[i.id]){let e=t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float");eo.state.transmissionRenderTarget[i.id]=new S.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?S.HalfFloatType:S.UnsignedByteType,minFilter:S.LinearMipmapLinearFilter,samples:r.samples,stencilBuffer:B,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:S.ColorManagement.workingColorSpace})}let o=eo.state.transmissionRenderTarget[i.id],s=i.viewport||e_;o.setSize(s.z*ec.transmissionResolutionScale,s.w*ec.transmissionResolutionScale);let u=ec.getRenderTarget(),c=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(eE),(eT=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eO&&M.render(a);let f=ec.toneMapping;ec.toneMapping=S.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),eo.setupLightsView(i),!0===eL&&_.setGlobalState(ec.clippingPlanes,i),e1(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===t.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let t=0,r=n.length;ttypeof self&&eQ.setContext(self),this.setAnimationLoop=function(e){eY=e,eV.setAnimationLoop(e),null===e?eQ.stop():eQ.start()},eV.addEventListener("sessionstart",eK),eV.addEventListener("sessionend",e$),this.render=function(e,n){if(void 0!==n&&!0!==n.isCamera)return void(0,S.error)("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===ed)return;let t=!0===eV.enabled&&!0===eV.isPresenting,r=null!==eu&&(null===em||t)&&eu.begin(ec,em);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===n.parent&&!0===n.matrixWorldAutoUpdate&&n.updateMatrixWorld(),!0===eV.enabled&&!0===eV.isPresenting&&(null===eu||!1===eu.isCompositing())&&(!0===eV.cameraAutoUpdate&&eV.updateCamera(n),n=eV.getCamera()),!0===e.isScene&&e.onBeforeRender(ec,e,n,em),(eo=g.get(e,es.length)).init(n),es.push(eo),eU.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),ew.setFromProjectionMatrix(eU,S.WebGLCoordinateSystem,n.reversedDepth),eN=this.localClippingEnabled,eL=_.init(this.clippingPlanes,eN),(ei=h.get(e,el.length)).init(),el.push(ei),!0===eV.enabled&&!0===eV.isPresenting){let e=ec.xr.getDepthSensingMesh();null!==e&&eZ(e,n,-1/0,ec.sortObjects)}eZ(e,n,0,ec.sortObjects),ei.finish(),!0===ec.sortObjects&&ei.sort(eR,eC),(eO=!1===eV.enabled||!1===eV.isPresenting||!1===eV.hasDepthSensing())&&M.addToRenderList(ei,e),this.info.render.frame++,!0===eL&&_.beginShadows();let a=eo.state.shadowsArray;if(v.render(a,e,n),!0===eL&&_.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(r&&eu.hasRenderPass())){let t=ei.opaque,r=ei.transmissive;if(eo.setupLights(),n.isArrayCamera){let a=n.cameras;if(r.length>0)for(let n=0,i=a.length;n0&&e0(t,r,e,n),eO&&M.render(e),eJ(ei,e,n)}null!==em&&0===ep&&(l.updateMultisampleRenderTarget(em),l.updateRenderTargetMipmap(em)),r&&eu.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,n),y.resetDefaultState(),eh=-1,eg=null,es.pop(),es.length>0?(eo=es[es.length-1],!0===eL&&_.setGlobalState(ec.clippingPlanes,eo.state.camera)):eo=null,el.pop(),ei=el.length>0?el[el.length-1]:null},this.getActiveCubeFace=function(){return ef},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return em},this.setRenderTargetTextures=function(e,n,t){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=n,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:t,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,n){let t=o.get(e);t.__webglFramebuffer=n,t.__useDefaultFramebuffer=void 0===n};const e8=eG.createFramebuffer();this.setRenderTarget=function(e,n=0,t=0){em=e,ef=n,ep=t;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eG.FRAMEBUFFER,u.__webglFramebuffer),e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest,a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),eh=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let n=e.depthTexture;if(u.__boundDepthTexture!==n){if(null!==n&&o.has(n)&&(e.width!==n.image.width||e.height!==n.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(d[n])?d[n][t]:d[n],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[t]:d,e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest}else e_.copy(ey).multiplyScalar(ex).floor(),ev.copy(eA).multiplyScalar(ex).floor(),eS=eP;if(0!==t&&(r=e8),a.bindFramebuffer(eG.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),i){let r=o.get(e.texture);eG.framebufferTexture2D(eG.FRAMEBUFFER,eG.COLOR_ATTACHMENT0,eG.TEXTURE_CUBE_MAP_POSITIVE_X+n,r.__webglTexture,t)}else if(s)for(let r=0;r=0&&n<=e.width-i&&t>=0&&t<=e.height-l&&(e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,C.convert(o),C.convert(u),s))}finally{let e=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,t,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(n>=0&&n<=e.width-i&&t>=0&&t<=e.height-l){a.bindFramebuffer(eG.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eG.createBuffer();eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.bufferData(eG.PIXEL_PACK_BUFFER,s.byteLength,eG.STREAM_READ),e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,C.convert(f),C.convert(p),0);let h=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,h);let g=eG.fenceSync(eG.SYNC_GPU_COMMANDS_COMPLETE,0);return eG.flush(),await (0,S.probeAsync)(eG,g,4),eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.getBufferSubData(eG.PIXEL_PACK_BUFFER,0,s),eG.deleteBuffer(m),eG.deleteSync(g),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,n=null,t=0){let r=Math.pow(2,-t),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==n?n.x:0,u=null!==n?n.y:0;l.setTexture2D(e,0),eG.copyTexSubImage2D(eG.TEXTURE_2D,t,0,0,s,u,i,o),a.unbindTexture()};const e9=eG.createFramebuffer(),e7=eG.createFramebuffer();this.copyTextureToTexture=function(e,n,t=null,r=null,i=0,s=null){let u,c,d,f,p,m,h,g,_,v;null===s&&(0!==i?((0,S.warnOnce)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);let E=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==t)u=t.max.x-t.min.x,c=t.max.y-t.min.y,d=t.isBox3?t.max.z-t.min.z:1,f=t.min.x,p=t.min.y,m=t.isBox3?t.min.z:0;else{let n=Math.pow(2,-i);u=Math.floor(E.width*n),c=Math.floor(E.height*n),d=e.isDataArrayTexture?E.depth:e.isData3DTexture?Math.floor(E.depth*n):1,f=0,p=0,m=0}null!==r?(h=r.x,g=r.y,_=r.z):(h=0,g=0,_=0);let T=C.convert(n.format),M=C.convert(n.type);n.isData3DTexture?(l.setTexture3D(n,0),v=eG.TEXTURE_3D):n.isDataArrayTexture||n.isCompressedArrayTexture?(l.setTexture2DArray(n,0),v=eG.TEXTURE_2D_ARRAY):(l.setTexture2D(n,0),v=eG.TEXTURE_2D),eG.pixelStorei(eG.UNPACK_FLIP_Y_WEBGL,n.flipY),eG.pixelStorei(eG.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eG.pixelStorei(eG.UNPACK_ALIGNMENT,n.unpackAlignment);let b=eG.getParameter(eG.UNPACK_ROW_LENGTH),x=eG.getParameter(eG.UNPACK_IMAGE_HEIGHT),R=eG.getParameter(eG.UNPACK_SKIP_PIXELS),y=eG.getParameter(eG.UNPACK_SKIP_ROWS),A=eG.getParameter(eG.UNPACK_SKIP_IMAGES);eG.pixelStorei(eG.UNPACK_ROW_LENGTH,E.width),eG.pixelStorei(eG.UNPACK_IMAGE_HEIGHT,E.height),eG.pixelStorei(eG.UNPACK_SKIP_PIXELS,f),eG.pixelStorei(eG.UNPACK_SKIP_ROWS,p),eG.pixelStorei(eG.UNPACK_SKIP_IMAGES,m);let P=e.isDataArrayTexture||e.isData3DTexture,w=n.isDataArrayTexture||n.isData3DTexture;if(e.isDepthTexture){let t=o.get(e),r=o.get(n),l=o.get(t.__renderTarget),v=o.get(r.__renderTarget);a.bindFramebuffer(eG.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eG.DRAW_FRAMEBUFFER,v.__webglFramebuffer);for(let t=0;ttypeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return S.WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let n=this.getContext();n.drawingBufferColorSpace=S.ColorManagement._getDrawingBufferColorSpace(e),n.unpackColorSpace=S.ColorManagement._getUnpackColorSpace()}}e.s(["PMREMGenerator",()=>V,"ShaderChunk",()=>M,"ShaderLib",()=>x,"UniformsLib",()=>b,"WebGLRenderer",()=>n0,"WebGLUtils",()=>nz],8560);var n1=e.i(30224);let n3=e=>{let n,t=new Set,r=(e,r)=>{let a="function"==typeof e?e(n):e;if(!Object.is(a,n)){let e=n;n=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},n,a),t.forEach(t=>t(n,e))}},a=()=>n,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(t.add(e),()=>t.delete(e))},o=n=e(r,a,i);return i},n2=e=>e?n3(e):n3;e.s(["createStore",()=>n2],8155);let{useSyncExternalStoreWithSelector:n4}=n1.default,n5=e=>e;function n6(e,n=n5,t){let r=n4(e.subscribe,e.getState,e.getInitialState,n,t);return _.default.useDebugValue(r),r}let n8=(e,n)=>{let t=n2(e),r=(e,r=n)=>n6(t,e,r);return Object.assign(r,t),r},n9=(e,n)=>e?n8(e,n):n8;e.s(["createWithEqualityFn",()=>n9,"useStoreWithEqualityFn",()=>n6],66748);let n7=[];function te(e,n,t=(e,n)=>e===n){if(e===n)return!0;if(!e||!n)return!1;let r=e.length;if(n.length!==r)return!1;for(let a=0;a0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}let a={keys:n,equal:r.equal,remove:()=>{let e=n7.indexOf(a);-1!==e&&n7.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...n)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(n7.push(a),!t)throw a.promise}var tt=e.i(89499),tr=e.i(43476),ta=_;function ti(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=ti(r,n,t);if(e)return e;r=n?null:r.sibling}}function to(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(n){return e}}"u">typeof window&&((null==(c=window.document)?void 0:c.createElement)||(null==(d=window.navigator)?void 0:d.product)==="ReactNative")?ta.useLayoutEffect:ta.useEffect;let tl=to(ta.createContext(null));class ts extends ta.Component{render(){return ta.createElement(tl.Provider,{value:this._reactInternals},this.props.children)}}function tu(){let e=ta.useContext(tl);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=ta.useId();return ta.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=ti(t,!1,e=>{let t=e.memoizedState;for(;t;){if(t.memoizedState===n)return!0;t=t.next}});if(e)return e}},[e,n])}let tc=Symbol.for("react.context"),td=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===tc;function tf(){let e=function(){let e=tu(),[n]=ta.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;td(e)&&e!==tl&&!n.has(e)&&n.set(e,ta.use(to(e))),t=t.return}return n}();return ta.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>ta.createElement(n,null,ta.createElement(t.Provider,{...r,value:e.get(t)})),e=>ta.createElement(ts,{...e})),[e])}function tp(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>ts,"traverseFiber",()=>ti,"useContextBridge",()=>tf,"useFiber",()=>tu],46791),_.act;let tm=e=>e&&e.hasOwnProperty("current"),th=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),tg="u">typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?_.useLayoutEffect:_.useEffect;function t_(e){let n=_.useRef(e);return tg(()=>void(n.current=e),[e]),n}function tv(){let e=tu(),n=tf();return _.useMemo(()=>({children:t})=>{let r=ti(e,!0,e=>e.type===_.StrictMode)?_.StrictMode:_.Fragment;return(0,tr.jsx)(r,{children:(0,tr.jsx)(n,{children:t})})},[e,n])}function tS({set:e}){return tg(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let tE=((s=class extends _.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function tT(e){var n;let t="u">typeof window?null!=(n=window.devicePixelRatio)?n:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function tM(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tb={obj:e=>e===Object(e)&&!tb.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,n,{arrays:t="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof n||!!e!=!!n)return!1;if(tb.str(e)||tb.num(e)||tb.boo(e))return e===n;let o=tb.obj(e);if(o&&"reference"===r)return e===n;let l=tb.arr(e);if(l&&"reference"===t)return e===n;if((l||o)&&e===n)return!0;for(i in e)if(!(i in n))return!1;if(o&&"shallow"===t&&"shallow"===r){for(i in a?n:e)if(!tb.equ(e[i],n[i],{strict:a,objects:"reference"}))return!1}else for(i in a?n:e)if(e[i]!==n[i])return!1;if(tb.und(i)){if(l&&0===e.length&&0===n.length||o&&0===Object.keys(e).length&&0===Object.keys(n).length)return!0;if(e!==n)return!1}return!0}},tx=["children","key","ref"];function tR(e,n,t,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:n,type:t,parent:null,children:[],props:function(e){let n={};for(let t in e)tx.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tC(e,n){if(!n.includes("-")||n in e)return{root:e,key:n,target:e[n]};let t=e,r=n.split("-");for(let a of r){if("object"!=typeof t||null===t){if(void 0!==t)return{root:t,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:n,target:void 0}}n=a,e=t,t=t[n]}return{root:e,key:n,target:t}}let ty=/-\d+$/;function tA(e,n){if(tb.str(n.props.attach)){if(ty.test(n.props.attach)){let t=n.props.attach.replace(ty,""),{root:r,key:a}=tC(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tC(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tb.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function tP(e,n){if(tb.str(n.props.attach)){let{root:t,key:r}=tC(e.object,n.props.attach),a=n.previousAttach;void 0===a?delete t[r]:t[r]=a}else null==n.previousAttach||n.previousAttach(e.object,n.object);delete n.previousAttach}let tw=[...tx,"args","dispose","attach","object","onUpdate","dispose"],tL=new Map,tN=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tU=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tD(e,n){var t,r;let a=e.__r3f,i=a&&tp(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tw.includes(t))continue;if(a&&tU.test(t)){"function"==typeof o?a.handlers[t]=o:delete a.handlers[t],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;let{root:l,key:s,target:u}=tC(e,t);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${t}". Ensure it is an object before setting "${s}".`);u instanceof v.Layers&&o instanceof v.Layers?u.mask=o.mask:u instanceof v.Color&&th(o)?u.set(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor?u.copy(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o)?"function"==typeof u.fromArray?u.fromArray(o):u.set(...o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o?"function"==typeof u.setScalar?u.setScalar(o):u.set(o):(l[s]=o,i&&!i.linear&&tN.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===v.RGBAFormat&&l[s].type===v.UnsignedByteType&&(l[s].colorSpace=v.SRGBColorSpace))}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(t=a.object)&&t.isObject3D&&o!==a.eventCount){let e=a.object,n=i.internal.interaction.indexOf(e);n>-1&&i.internal.interaction.splice(n,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&tI(a),e}function tI(e){var n;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let t=null==(n=e.root)||null==n.getState?void 0:n.getState();t&&0===t.internal.frames&&t.invalidate()}let tF=e=>null==e?void 0:e.isObject3D;function tO(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tB(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tG=e=>!!(null!=e&&e.render),tH=_.createContext(null);function tk(){let e=_.useContext(tH);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tV(e=e=>e,n){return tk()(e,n)}function tz(e,n=0){let t=tk(),r=t.getState().internal.subscribe,a=t_(e);return tg(()=>r(a,n,t),[n,r,t]),null}let tW=new WeakMap;function tX(e,n){return function(t,...r){var a;let i;return"function"==typeof t&&(null==t||null==(a=t.prototype)?void 0:a.constructor)===t?(i=tW.get(t))||(i=new t,tW.set(t,i)):i=t,e&&e(i),Promise.all(r.map(e=>new Promise((t,r)=>i.load(e,e=>{var n;let r;tF(null==e?void 0:e.scene)&&Object.assign(e,(n=e.scene,r={nodes:{},materials:{},meshes:{}},n&&n.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),t(e)},n,n=>r(Error(`Could not load ${e}: ${null==n?void 0:n.message}`))))))}}function tj(e,n,t,r){let a=Array.isArray(n)?n:[n],i=tn(tX(t,r),[e,...a],!1,{equal:tb.equ});return Array.isArray(n)?i:i[0]}tj.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];tn(tX(t),[e,...a],!0,r)},tj.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n7.splice(0,n7.length);else{let e=n7.find(e=>te(t,e.keys,e.equal));e&&e.remove()}};var tq={exports:{}},tY={exports:{}};tY.exports;let tK=(h||(h=1,m||(m=1,tY.exports=function(e){function n(e,n,t,r){return new rK(e,n,t,r)}function t(){}function r(e){var n="https://react.dev/errors/"+e;if(1oR||(e.current=ox[oR],ox[oR]=null,oR--)}function d(e,n){ox[++oR]=e.current,e.current=n}function f(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function p(e,n,t){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=0x7ffffff&r;return 0!==l?0!=(r=l&~i)?a=f(r):0!=(o&=l)?a=f(o):t||0!=(t=l&~e)&&(a=f(t)):0!=(l=r&~i)?a=f(l):0!==o?a=f(o):t||0!=(t=r&~e)&&(a=f(t)),0===a?0:0!==n&&n!==a&&(n&i)==0&&((i=a&-a)>=(t=n&-n)||32===i&&(4194048&t)!=0)?n:a}function m(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)==0}function h(){var e=oN;return(0x3c00000&(oN<<=1))==0&&(oN=4194304),e}function v(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function S(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function E(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-oy(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|261930&t}function T(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-oy(t),a=1<)":-1a||s[r]!==u[a]){var c=` +`+s[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=a)break}}}finally{oK=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?C(t):""}function A(e){try{var n="",t=null;do n+=function(e,n){switch(e.tag){case 26:case 27:case 5:return C(e.type);case 16:return C("Lazy");case 13:return e.child!==n&&null!==n?C("Suspense Fallback"):C("Suspense");case 19:return C("SuspenseList");case 0:case 15:return y(e.type,!1);case 11:return y(e.type.render,!1);case 1:return y(e.type,!0);case 31:return C("Activity");default:return""}}(e,t),t=e,e=e.return;while(e)return n}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}function P(e,n){if("object"==typeof e&&null!==e){var t=o$.get(e);return void 0!==t?t:(n={value:e,source:n,stack:A(n)},o$.set(e,n),n)}return{value:e,source:n,stack:A(n)}}function w(e,n){oQ[oZ++]=o0,oQ[oZ++]=oJ,oJ=e,o0=n}function L(e,n,t){o1[o3++]=o4,o1[o3++]=o5,o1[o3++]=o2,o2=e;var r=o4;e=o5;var a=32-oy(r)-1;r&=~(1<>=o,a-=o,o4=1<<32-oy(n)+a|t<f?(p=d,d=null):p=d.sibling;var _=h(n,d,o[f],l);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&t(n,d),r=s(_,r,f),null===c?u=_:c.sibling=_,c=_,d=p}if(f===o.length)return a(n,d),lt&&w(n,f),u;if(null===d){for(;fp?(_=f,f=null):_=f.sibling;var S=h(n,f,v.value,u);if(null===S){null===f&&(f=_);break}e&&f&&null===S.alternate&&t(n,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=_}if(v.done)return a(n,f),lt&&w(n,p),c;if(null===f){for(;!v.done;p++,v=l.next())null!==(v=m(n,v.value,u))&&(o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return lt&&w(n,p),c}for(f=i(f);!v.done;p++,v=l.next())null!==(v=g(f,n,p,v.value,u))&&(e&&null!==v.alternate&&f.delete(null===v.key?p:v.key),o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return t(n,e)}),lt&&w(n,p),c}(c,d,f=_.call(f),p)}if("function"==typeof f.then)return n(c,d,eb(f),p);if(f.$$typeof===ad)return n(c,d,ee(c,f),p);eR(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(a(c,d.sibling),(p=o(d,f)).return=c):(a(c,d),(p=r1(f,c.mode,p)).return=c),u(c=p)):a(c,d)}(c,d,f,p);return lw=null,_}catch(e){if(e===lR||e===ly)throw e;var v=n(29,e,null,c.mode);return v.lanes=p,v.return=c,v}finally{}}}function ey(){for(var e=lI,n=lF=lI=0;ni?i:8);var o=aM.T,l={};aM.T=l,nZ(e,!1,n,t);try{var s=a(),u=aM.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;for(var e=0;e";case sc:return":has("+(rf(e)||"")+")";case sd:return'[role="'+e.value+'"]';case sp:return'"'+e.value+'"';case sf:return'[data-testname="'+e.value+'"]';default:throw Error(r(365))}}function rp(e,n){var t=[];e=[e,0];for(var r=0;rsO&&(n.flags|=128,i=!0,tO(a,!1),n.lanes=4194304)}else{if(!i)if(null!==(e=eQ(o))){if(n.flags|=128,i=!0,n.updateQueue=e=e.updateQueue,tF(n,e),tO(a,!0),null===a.tail&&"hidden"===a.tailMode&&!o.alternate&&!lt)return tB(n),null}else 2*oO()-a.renderingStartTime>sO&&0x20000000!==t&&(n.flags|=128,i=!0,tO(a,!1),n.lanes=4194304);a.isBackwards?(o.sibling=n.child,n.child=o):(null!==(e=a.last)?e.sibling=o:n.child=o,a.last=o)}return null!==a.tail?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=oO(),e.sibling=null,t=lz.current,d(lz,i?1&t|2:1&t),lt&&w(n,a.treeForkCount),e):(tB(n),null);case 22:case 23:return e$(n),eX(),a=null!==n.memoizedState,null!==e?null!==e.memoizedState!==a&&(n.flags|=8192):a&&(n.flags|=8192),a?(0x20000000&t)!=0&&(128&n.flags)==0&&(tB(n),6&n.subtreeFlags&&(n.flags|=8192)):tB(n),null!==(t=n.updateQueue)&&tF(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),a=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(a=n.memoizedState.cachePool.pool),a!==t&&(n.flags|=2048),null!==e&&c(lx),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),q(lf),tB(n),null;case 25:case 30:return null}throw Error(r(156,n.tag))}(n.alternate,n,sR);if(null!==t){sv=t;return}if(null!==(n=n.sibling)){sv=n;return}sv=n=e}while(null!==n)0===sC&&(sC=5)}function rD(e,n){do{var t=function(e,n){switch(U(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return q(lf),F(),(65536&(e=n.flags))!=0&&(128&e)==0?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return B(n),null;case 31:if(null!==n.memoizedState){if(e$(n),null===n.alternate)throw Error(r(340));z()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(e$(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(r(340));z()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return c(lz),null;case 4:return F(),null;case 10:return q(n.type),null;case 22:case 23:return e$(n),eX(),null!==e&&c(lx),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return q(lf),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,sv=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){sv=e;return}sv=e=t}while(null!==e)sC=6,sv=null}function rI(e,n,t,a,i,o,l,s,u){e.cancelPendingCommit=null;do rH();while(0!==sH)if((6&sg)!=0)throw Error(r(327));if(null!==n){if(n===e.current)throw Error(r(177));if(function(e,n,t,r,a,i){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(t=o&~t;0t?32:t;t=aM.T;var i=aj();try{aX(a),aM.T=null,a=sX,sX=null;var o=sk,l=sz;if(sH=0,sV=sk=null,sz=0,(6&sg)!=0)throw Error(r(331));var s=sg;if(sg|=4,rs(o.current),rt(o,o.current,l,a),sg=s,eo(0,!1),oX&&"function"==typeof oX.onPostCommitFiberRoot)try{oX.onPostCommitFiberRoot(oW,o)}catch{}return!0}finally{aX(i),aM.T=t,rG(e,n)}}function rV(e,n,t){n=P(t,n),n=n9(e.stateNode,n,2),null!==(e=eF(e,n,2))&&(S(e,2),ei(e))}function rz(e,n,t){if(3===e.tag)rV(e,e,t);else for(;null!==n;){if(3===n.tag){rV(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===sG||!sG.has(r))){e=P(t,e),null!==(r=eF(n,t=n7(2),2))&&(te(t,r,n,e),S(r,2),ei(r));break}}n=n.return}}function rW(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new sh;var a=new Set;r.set(n,a)}else void 0===(a=r.get(n))&&(a=new Set,r.set(n,a));a.has(t)||(sx=!0,a.add(t),e=rX.bind(null,e,n,t),n.then(e,e))}function rX(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,s_===e&&(sS&t)===t&&(4===sC||3===sC&&(0x3c00000&sS)===sS&&300>oO()-sI?(2&sg)==0&&rb(e,0):sP|=t,sL===sS&&(sL=0)),ei(e)}function rj(e,n){0===n&&(n=h()),null!==(e=ew(e,n))&&(S(e,n),ei(e))}function rq(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),rj(e,t)}function rY(e,n){var t=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;null!==i&&(t=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==a&&a.delete(n),rj(e,t)}function rK(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function r$(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rQ(e,t){var r=e.alternate;return null===r?((r=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x3e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rZ(e,n){e.flags&=0x3e00002;var t=e.alternate;return null===t?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,e.type=t.type,e.dependencies=null===(n=t.dependencies)?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function rJ(e,t,a,i,o,l){var s=0;if(i=e,"function"==typeof e)r$(e)&&(s=1);else if("string"==typeof e)s=oa&&ov?oi(e,a,o6.current)?26:oM(e)?27:5:oa?oi(e,a,o6.current)?26:5:ov&&oM(e)?27:5;else t:switch(e){case a_:return(e=n(31,a,t,o)).elementType=a_,e.lanes=l,e;case al:return r0(a.children,o,l,t);case as:s=8,o|=24;break;case au:return(e=n(12,a,t,2|o)).elementType=au,e.lanes=l,e;case ap:return(e=n(13,a,t,o)).elementType=ap,e.lanes=l,e;case am:return(e=n(19,a,t,o)).elementType=am,e.lanes=l,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ad:s=10;break t;case ac:s=9;break t;case af:s=11;break t;case ah:s=14;break t;case ag:s=16,i=null;break t}s=29,a=Error(r(130,null===e?"null":typeof e,"")),i=null}return(t=n(s,a,t,o)).elementType=e,t.type=i,t.lanes=l,t}function r0(e,t,r,a){return(e=n(7,e,a,t)).lanes=r,e}function r1(e,t,r){return(e=n(6,e,null,t)).lanes=r,e}function r3(e){var t=n(18,null,null,0);return t.stateNode=e,t}function r2(e,t,r){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function r4(e,n,t,r,a,i,o,l,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=aB,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=v(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v(0),this.hiddenUpdates=v(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=new Map}function r5(e,t,r,a,i,o,l,s,u,c,d,f){return e=new r4(e,t,r,l,u,c,d,f,s),t=1,!0===o&&(t|=24),o=n(3,null,null,t),e.current=o,o.stateNode=e,t=et(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:t},eU(o),e}function r6(e){var n=e._reactInternals;if(void 0===n)throw"function"==typeof e.render?Error(r(188)):Error(r(268,e=Object.keys(e).join(",")));return null===(e=null!==(e=o(n))?function e(n){var t=n.tag;if(5===t||26===t||27===t||6===t)return n;for(n=n.child;null!==n;){if(null!==(t=e(n)))return t;n=n.sibling}return null}(e):null)?null:aC(e.stateNode)}function r8(e,n,t,r,a,i){a=oC,null===r.context?r.context=a:r.pendingContext=a,(r=eI(n)).payload={element:t},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(t=eF(e,r,n))&&(r_(t,e,n),eO(t,e,n))}function r9(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t>>=0)?32:31-(oA(e)/oP|0)|0},oA=Math.log,oP=Math.LN2,ow=256,oL=262144,oN=4194304,oU=at.unstable_scheduleCallback,oD=at.unstable_cancelCallback,oI=at.unstable_shouldYield,oF=at.unstable_requestPaint,oO=at.unstable_now,oB=at.unstable_ImmediatePriority,oG=at.unstable_UserBlockingPriority,oH=at.unstable_NormalPriority,ok=at.unstable_IdlePriority,oV=at.log,oz=at.unstable_setDisableYieldValue,oW=null,oX=null,oj="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},oq="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof g.default&&"function"==typeof g.default.emit)return void g.default.emit("uncaughtException",e);console.error(e)},oY=Object.prototype.hasOwnProperty,oK=!1,o$=new WeakMap,oQ=[],oZ=0,oJ=null,o0=0,o1=[],o3=0,o2=null,o4=1,o5="",o6=u(null),o8=u(null),o9=u(null),o7=u(null),le=null,ln=null,lt=!1,lr=null,la=!1,li=Error(r(519)),lo=u(null),ll=null,ls=null,lu="u">typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},lc=at.unstable_scheduleCallback,ld=at.unstable_NormalPriority,lf={$$typeof:ad,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},lp=null,lm=null,lh=!1,lg=!1,l_=!1,lv=0,lS=null,lE=0,lT=0,lM=null,lb=aM.S;aM.S=function(e,n){sF=oO(),"object"==typeof n&&null!==n&&"function"==typeof n.then&&function(e,n){if(null===lS){var t=lS=[];lE=0,lT=ef(),lM={status:"pending",value:void 0,then:function(e){t.push(e)}}}lE++,n.then(ep,ep)}(0,n),null!==lb&&lb(e,n)};var lx=u(null),lR=Error(r(460)),lC=Error(r(474)),ly=Error(r(542)),lA={then:function(){}},lP=null,lw=null,lL=0,lN=eC(!0),lU=eC(!1),lD=[],lI=0,lF=0,lO=!1,lB=!1,lG=u(null),lH=u(0),lk=u(null),lV=null,lz=u(0),lW=0,lX=null,lj=null,lq=null,lY=!1,lK=!1,l$=!1,lQ=0,lZ=0,lJ=null,l0=0,l1={readContext:J,use:nn,useCallback:eZ,useContext:eZ,useEffect:eZ,useImperativeHandle:eZ,useLayoutEffect:eZ,useInsertionEffect:eZ,useMemo:eZ,useReducer:eZ,useRef:eZ,useState:eZ,useDebugValue:eZ,useDeferredValue:eZ,useTransition:eZ,useSyncExternalStore:eZ,useId:eZ,useHostTransitionStatus:eZ,useFormState:eZ,useActionState:eZ,useOptimistic:eZ,useMemoCache:eZ,useCacheRefresh:eZ};l1.useEffectEvent=eZ;var l3={readContext:J,use:nn,useCallback:function(e,n){return e8().memoizedState=[e,void 0===n?null:n],e},useContext:J,useEffect:nL,useImperativeHandle:function(e,n,t){t=null!=t?t.concat([e]):null,nP(4194308,4,nF.bind(null,n,e),t)},useLayoutEffect:function(e,n){return nP(4194308,4,e,n)},useInsertionEffect:function(e,n){nP(4,2,e,n)},useMemo:function(e,n){var t=e8();n=void 0===n?null:n;var r=e();return t.memoizedState=[r,n],r},useReducer:function(e,n,t){var r=e8();if(void 0!==t)var a=t(n);else a=n;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=nK.bind(null,lX,e),[r.memoizedState,e]},useRef:function(e){return e8().memoizedState={current:e}},useState:function(e){var n=(e=np(e)).queue,t=n$.bind(null,lX,n);return n.dispatch=t,[e.memoizedState,t]},useDebugValue:nB,useDeferredValue:function(e,n){return nk(e8(),e,n)},useTransition:function(){var e=np(!1);return e=nz.bind(null,lX,e.queue,!0,!1),e8().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,t){var a=lX,i=e8();if(lt){if(void 0===t)throw Error(r(407));t=t()}else{if(t=n(),null===s_)throw Error(r(349));(127&sS)!=0||ns(a,n,t)}i.memoizedState=t;var o={value:t,getSnapshot:n};return i.queue=o,nL(nc.bind(null,a,o,e),[e]),a.flags|=2048,ny(9,{destroy:void 0},nu.bind(null,a,o,t,n),null),t},useId:function(){var e=e8(),n=s_.identifierPrefix;if(lt){var t=o5,r=o4;n="_"+n+"R_"+(t=(r&~(1<<32-oy(r)-1)).toString(32)+t),0<(t=lQ++)&&(n+="H"+t.toString(32)),n+="_"}else n="_"+n+"r_"+(t=l0++).toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:nX,useFormState:nM,useActionState:nM,useOptimistic:function(e){var n=e8();n.memoizedState=n.baseState=e;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=t,n=nZ.bind(null,lX,!0,t),t.dispatch=n,[e,n]},useMemoCache:nt,useCacheRefresh:function(){return e8().memoizedState=nY.bind(null,lX)},useEffectEvent:function(e){var n=e8(),t={impl:e};return n.memoizedState=t,function(){if((2&sg)!=0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}},l2={readContext:J,use:nn,useCallback:nG,useContext:J,useEffect:nN,useImperativeHandle:nO,useInsertionEffect:nD,useLayoutEffect:nI,useMemo:nH,useReducer:na,useRef:nA,useState:function(){return na(nr)},useDebugValue:nB,useDeferredValue:function(e,n){return nV(e9(),lj.memoizedState,e,n)},useTransition:function(){var e=na(nr)[0],n=e9().memoizedState;return["boolean"==typeof e?e:ne(e),n]},useSyncExternalStore:nl,useId:nj,useHostTransitionStatus:nX,useFormState:nb,useActionState:nb,useOptimistic:function(e,n){return nm(e9(),lj,e,n)},useMemoCache:nt,useCacheRefresh:nq};l2.useEffectEvent=nU;var l4={readContext:J,use:nn,useCallback:nG,useContext:J,useEffect:nN,useImperativeHandle:nO,useInsertionEffect:nD,useLayoutEffect:nI,useMemo:nH,useReducer:no,useRef:nA,useState:function(){return no(nr)},useDebugValue:nB,useDeferredValue:function(e,n){var t=e9();return null===lj?nk(t,e,n):nV(t,lj.memoizedState,e,n)},useTransition:function(){var e=no(nr)[0],n=e9().memoizedState;return["boolean"==typeof e?e:ne(e),n]},useSyncExternalStore:nl,useId:nj,useHostTransitionStatus:nX,useFormState:nC,useActionState:nC,useOptimistic:function(e,n){var t=e9();return null!==lj?nm(t,lj,e,n):(t.baseState=e,[e,t.queue.dispatch])},useMemoCache:nt,useCacheRefresh:nq};l4.useEffectEvent=nU;var l5={enqueueSetState:function(e,n,t){e=e._reactInternals;var r=rh(),a=eI(r);a.payload=n,null!=t&&(a.callback=t),null!==(n=eF(e,a,r))&&(r_(n,e,r),eO(n,e,r))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=rh(),a=eI(r);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=eF(e,a,r))&&(r_(n,e,r),eO(n,e,r))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=rh(),r=eI(t);r.tag=2,null!=n&&(r.callback=n),null!==(n=eF(e,r,t))&&(r_(n,e,t),eO(n,e,t))}},l6=Error(r(461)),l8=!1,l9={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},l7=!1,se=!1,sn=!1,st="function"==typeof WeakSet?WeakSet:Set,sr=null,sa=null,si=!1,so=null,sl=8192,ss={getCacheForType:function(e){var n=J(lf),t=n.data.get(e);return void 0===t&&(t=e(),n.data.set(e,t)),t},cacheSignal:function(){return J(lf).controller.signal}},su=0,sc=1,sd=2,sf=3,sp=4;if("function"==typeof Symbol&&Symbol.for){var sm=Symbol.for;su=sm("selector.component"),sc=sm("selector.has_pseudo_class"),sd=sm("selector.role"),sf=sm("selector.test_id"),sp=sm("selector.text")}var sh="function"==typeof WeakMap?WeakMap:Map,sg=0,s_=null,sv=null,sS=0,sE=0,sT=null,sM=!1,sb=!1,sx=!1,sR=0,sC=0,sy=0,sA=0,sP=0,sw=0,sL=0,sN=null,sU=null,sD=!1,sI=0,sF=0,sO=1/0,sB=null,sG=null,sH=0,sk=null,sV=null,sz=0,sW=0,sX=null,sj=null,sq=0,sY=null;return ae.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var n=ew(e,0x4000000);null!==n&&r_(n,e,0x4000000),r7(e,0x4000000)}},ae.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var n=rh(),t=ew(e,n=b(n));null!==t&&r_(t,e,n),r7(e,n)}},ae.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var n=f(e.pendingLanes);if(0!==n){for(e.pendingLanes|=2,e.entangledLanes|=2;n;){var t=1<<31-oy(n);e.entanglements[1]|=t,n&=~t}ei(e),(6&sg)==0&&(sO=oO()+500,eo(0,!1))}}break;case 31:case 13:null!==(n=ew(e,2))&&r_(n,e,2),rT(),r7(e,2)}},ae.batchedUpdates=function(e,n){return e(n)},ae.createComponentSelector=function(e){return{$$typeof:su,value:e}},ae.createContainer=function(e,n,t,r,a,i,o,l,s,u){return r5(e,n,!1,null,t,r,i,null,o,l,s,u)},ae.createHasPseudoClassSelector=function(e){return{$$typeof:sc,value:e}},ae.createHydrationContainer=function(e,n,t,r,a,i,o,l,s,u,c,d,f,p){var m;return(e=r5(t,r,!0,e,a,i,l,p,s,u,c,d)).context=oC,t=e.current,(a=eI(r=b(r=rh()))).callback=null!=(m=n)?m:null,eF(t,a,r),n=r,e.current.lanes=n,S(e,n),ei(e),e},ae.createPortal=function(e,n,t){var r=3=c&&o>=f&&i<=d&&l<=p){e.splice(n,1);break}if(a!==c||t.width!==u.width||pl){if(!(o!==f||t.height!==u.height||di)){c>a&&(u.width+=c-a,u.x=a),do&&(u.height+=f-o,u.y=o),pt&&(t=s)),s ")+` + +No matching component was found for: + `+e.join(" > ")}return null},ae.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return aC(e.child.stateNode);default:return e.child.stateNode}},ae.injectIntoDevTools=function(){var e={bundleType:0,version:ab,rendererPackageName:ax,currentDispatcherRef:aM,reconcilerVersion:"19.2.0"};if(null!==aR&&(e.rendererConfig=aR),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{oW=n.inject(e),oX=n}catch{}e=!!n.checkDCE}}return e},ae.isAlreadyRendering=function(){return(6&sg)!=0},ae.observeVisibleRects=function(e,n,t,a){if(!a9)throw Error(r(363));var i=io(e=rm(e,n),t,a).disconnect;return{disconnect:function(){i()}}},ae.shouldError=function(){return null},ae.shouldSuspend=function(){return!1},ae.startHostTransition=function(e,n,a,i){if(5!==e.tag)throw Error(r(476));var o=nW(e).queue;nz(e,o,n,a2,null===a?t:function(){var n=nW(e);return null===n.next&&(n=e.alternate.memoizedState),nQ(e,n.next.queue,{},rh()),a(i)})},ae.updateContainer=function(e,n,t,r){var a=n.current,i=rh();return r8(a,i,e,n,t,r),i},ae.updateContainerSync=function(e,n,t,r){return r8(n.current,2,e,n,t,r),2},ae},tY.exports.default=tY.exports,Object.defineProperty(tY.exports,"__esModule",{value:!0})),tq.exports=tY.exports),(f=tq.exports)&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default"))?f.default:f,t$={},tQ=/^three(?=[A-Z])/,tZ=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tJ=0;function t0(e){if("function"==typeof e){let n=`${tJ++}`;return t$[n]=e,n}Object.assign(t$,e)}function t1(e,n){let t=tZ(e),r=t$[t];if("primitive"!==e&&!r)throw Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!n.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==n.args&&!Array.isArray(n.args))throw Error("R3F: The args prop must be an array!")}function t3(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tA(e.parent,e):tF(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tI(e)}}function t2(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=t$[tZ(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tD(n.object,n.props),n.props.attach)tA(e,n);else if(tF(n.object)&&tF(e.object)){let r=e.object.children.indexOf(null==t?void 0:t.object);if(t&&-1!==r){let t=e.object.children.indexOf(n.object);-1!==t?(e.object.children.splice(t,1),e.object.children.splice(t{try{e.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?n():(0,tt.unstable_scheduleCallback)(tt.unstable_IdlePriority,n)}}function t8(e,n,t){if(!n)return;n.parent=null;let r=e.children.indexOf(n);-1!==r&&e.children.splice(r,1),n.props.attach?tP(e,n):tF(n.object)&&tF(e.object)&&(e.object.remove(n.object),function(e,n){let{internal:t}=e.getState();t.interaction=t.interaction.filter(e=>e!==n),t.initialHits=t.initialHits.filter(e=>e!==n),t.hovered.forEach((e,r)=>{(e.eventObject===n||e.object===n)&&t.hovered.delete(r)}),t.capturedMap.forEach((e,r)=>{tB(t.capturedMap,n,e,r)})}(tp(n),n.object));let a=null!==n.props.dispose&&!1!==t;for(let e=n.children.length-1;e>=0;e--){let t=n.children[e];t8(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&t6(n.object),void 0===t&&tI(n)}let t9=[],t7=()=>{},re={},rn=0,rt=(p={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return t1(e=tZ(e)in t$?e:e.replace(tQ,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tR(n.object,t,e,n)},removeChild:t8,appendChild:t4,appendInitialChild:t4,insertBefore:t5,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t4(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t8(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&t5(r,n,t)},getRootHostContext:()=>re,getChildHostContext:()=>re,commitUpdate(e,n,t,r,a){var i,o,l;t1(n,r);let s=!1;if("primitive"===e.type&&t.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=t.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,n)=>{var r;return e!==(null==(r=t.args)?void 0:r[n])})&&(s=!0),s)t9.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tw.includes(r)&&!tb.equ(n[r],e.props[r]))for(let e in t[r]=n[r],n)e.startsWith(`${r}-`)&&(t[e]=n[e]);for(let r in e.props){if(tw.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tC(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tL.get(e.constructor);try{n||(n=new e.constructor,tL.set(e.constructor,n))}catch(e){}return n}(a);tb.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tD(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t9){let n=e.parent;if(n)for(let t of(e.props.attach?tP(n,e):tF(e.object)&&tF(n.object)&&n.object.remove(e.object),e.children))t.props.attach?tP(e,t):tF(t.object)&&tF(e.object)&&e.object.remove(t.object);e.isHidden&&t3(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&t6(e.object)}for(let[r,a,i]of t9){r.props=a;let o=r.parent;if(o){let a=t$[tZ(r.type)];r.object=null!=(e=r.props.object)?e:new a(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r;var e,n,t=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let n=e.ref(t);"function"==typeof n&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t);for(let e of(tD(r.object,r.props),r.props.attach?tA(o,r):tF(r.object)&&tF(o.object)&&o.object.add(r.object),r.children))e.props.attach?tA(r,e):tF(e.object)&&tF(r.object)&&r.object.add(e.object);tI(r)}}t9.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tR(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tP(e.parent,e):tF(e.object)&&(e.object.visible=!1),e.isHidden=!0,tI(e)}},unhideInstance:t3,createTextInstance:t7,hideTextInstance:t7,unhideTextInstance:t7,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:_.createContext(null),setCurrentUpdatePriority(e){rn=e},getCurrentUpdatePriority:()=>rn,resolveUpdatePriority(){var e;if(0!==rn)return rn;switch("u">typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.5.0",applyViewTransitionName(e,n,t){},restoreViewTransitionName(e,n){},cancelViewTransitionName(e,n,t){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,n)=>!1,hasInstanceAffectedParent:(e,n)=>!1,suspendOnActiveViewTransition(e,n){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(e){},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,n)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw Error("Not implemented.")},removeRootViewTransitionClone(e,n){throw Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,n){},commitNewChildToFragmentInstance(e,n){},deleteChildFromFragmentInstance(e,n){},measureClonedInstance:e=>null,maySuspendCommitOnUpdate:(e,n,t)=>!1,maySuspendCommitInSyncRender:(e,n)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,n)=>null},(u=tK(p)).injectIntoDevTools(),u),rr=new Map,ra={objects:"shallow",strict:!1};function ri(e){var n,t;let r,a,i,o,l,s,u,c=rr.get(e),d=null==c?void 0:c.fiber,f=null==c?void 0:c.store;c&&console.warn("R3F.createRoot should only be called once!");let p="function"==typeof reportError?reportError:console.error,m=f||(n=rE,t=rT,l=(o=(i=n9((e,r)=>{let a,i=new v.Vector3,o=new v.Vector3,l=new v.Vector3;function s(e=r().camera,n=o,t=r().size){let{width:a,height:u,top:c,left:d}=t,f=a/u;n.isVector3?l.copy(n):l.set(...n);let p=e.getWorldPosition(i).distanceTo(l);if(e&&e.isOrthographicCamera)return{width:a/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let n=2*Math.tan(e.fov*Math.PI/180/2)*p,t=a/u*n;return{width:t,height:n,top:c,left:d,factor:a/t,distance:p,aspect:f}}}let u=n=>e(e=>({performance:{...e.performance,current:n}})),c=new v.Vector2;return{set:e,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>n(r(),e),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new v.Clock,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();a&&clearTimeout(a),e.performance.current!==e.performance.min&&u(e.performance.min),a=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:n=>e(e=>({...e,events:{...e.events,...n}})),setSize:(n,t,a=0,i=0)=>{let l=r().camera,u={width:n,height:t,top:a,left:i};e(e=>({size:u,viewport:{...e.viewport,...s(l,o,u)}}))},setDpr:n=>e(e=>{let t=tT(n);return{viewport:{...e.viewport,dpr:t,initialDpr:e.viewport.initialDpr||t}}}),setFrameloop:(n="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==n&&(t.start(),t.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:_.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,t)=>{let a=r().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:t}),a.subscribers=a.subscribers.sort((e,n)=>e.priority-n.priority),()=>{let t=r().internal;null!=t&&t.subscribers&&(t.priority=t.priority-(n>0),t.subscribers=t.subscribers.filter(n=>n.ref!==e))}}}}})).getState()).size,s=o.viewport.dpr,u=o.camera,i.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=i.getState();if(n.width!==l.width||n.height!==l.height||t.dpr!==s){l=n,s=t.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(n.width/2),e.right=n.width/2,e.top=n.height/2,e.bottom=-(n.height/2)):e.aspect=n.width/n.height,e.updateProjectionMatrix());t.dpr>0&&r.setPixelRatio(t.dpr);let a="u">typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(n.width,n.height,a)}e!==u&&(u=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),i.subscribe(e=>n(e)),i),h=d||rt.createContainer(m,1,null,!1,null,"",p,p,p,null);c||rr.set(e,{fiber:h,store:m});let g=!1,S=null;return{async configure(n={}){var t,i;let o;S=new Promise(e=>o=e);let{gl:l,size:s,scene:u,events:c,onCreated:d,shadows:f=!1,linear:p=!1,flat:h=!1,legacy:_=!1,orthographic:E=!1,frameloop:T="always",dpr:M=[1,2],performance:b,raycaster:x,camera:R,onPointerMissed:C}=n,y=m.getState(),A=y.gl;if(!y.gl){let n={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},t="function"==typeof l?await l(n):l;A=tG(t)?t:new n0({...n,...l}),y.set({gl:A})}let P=y.raycaster;P||y.set({raycaster:P=new v.Raycaster});let{params:w,...L}=x||{};if(tb.equ(L,P,ra)||tD(P,{...L}),tb.equ(w,P.params,ra)||tD(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tb.equ(a,R,ra)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:E?new v.OrthographicCamera(0,0,0,0,.1,1e3):new v.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tD(n,R),!n.manual&&("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(n.manual=!0,n.updateProjectionMatrix())),y.camera||null!=R&&R.rotation||n.lookAt(0,0,0)),y.set({camera:n}),P.camera=n}if(!y.scene){let e;null!=u&&u.isScene?tR(e=u,m,"",{}):(tR(e=new v.Scene,m,"",{}),u&&tD(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(m)});let N=function(e,n){if(!n&&"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:n,height:t,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:n,height:t,top:r,left:a}}return!n&&"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...n}}(e,s);if(tb.equ(N,y.size,ra)||y.setSize(N.width,N.height,N.top,N.left),M&&y.viewport.dpr!==tT(M)&&y.setDpr(M),y.frameloop!==T&&y.setFrameloop(T),y.onPointerMissed||y.set({onPointerMissed:C}),b&&!tb.equ(b,y.performance,ra)&&y.set(e=>({performance:{...e.performance,...b}})),!y.xr){let e=(e,n)=>{let t=m.getState();"never"!==t.frameloop&&rT(e,!0,t,n)},n=()=>{let n=m.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rE(n)},r={connect(){let e=m.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=m.getState().gl;e.xr.removeEventListener("sessionstart",n),e.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(t=A.xr)?void 0:t.addEventListener)&&r.connect(),y.set({xr:r})}if(A.shadowMap){let e=A.shadowMap.enabled,n=A.shadowMap.type;if(A.shadowMap.enabled=!!f,tb.boo(f))A.shadowMap.type=v.PCFSoftShadowMap;else if(tb.str(f)){let e={basic:v.BasicShadowMap,percentage:v.PCFShadowMap,soft:v.PCFSoftShadowMap,variance:v.VSMShadowMap};A.shadowMap.type=null!=(i=e[f])?i:v.PCFSoftShadowMap}else tb.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return v.ColorManagement.enabled=!_,g||(A.outputColorSpace=p?v.LinearSRGBColorSpace:v.SRGBColorSpace,A.toneMapping=h?v.NoToneMapping:v.ACESFilmicToneMapping),y.legacy!==_&&y.set(()=>({legacy:_})),y.linear!==p&&y.set(()=>({linear:p})),y.flat!==h&&y.set(()=>({flat:h})),!l||tb.fun(l)||tG(l)||tb.equ(l,A,ra)||tD(A,l),r=d,g=!0,o(),this},render(n){return g||S||this.configure(),S.then(()=>{rt.updateContainer((0,tr.jsx)(ro,{store:m,children:n,onCreated:r,rootElement:e}),h,null,()=>void 0)}),m},unmount(){rl(e)}}}function ro({store:e,children:n,onCreated:t,rootElement:r}){return tg(()=>{let n=e.getState();n.set(e=>({internal:{...e.internal,active:!0}})),t&&t(n),e.getState().events.connected||null==n.events.connect||n.events.connect(r)},[]),(0,tr.jsx)(tH.Provider,{value:e,children:n})}function rl(e,n){let t=rr.get(e),r=null==t?void 0:t.fiber;if(r){let a=null==t?void 0:t.store.getState();a&&(a.internal.active=!1),rt.updateContainer(null,r,null,()=>{a&&setTimeout(()=>{try{null==a.events.disconnect||a.events.disconnect(),null==(t=a.gl)||null==(r=t.renderLists)||null==r.dispose||r.dispose(),null==(i=a.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=a.gl)&&o.xr&&a.xr.disconnect();var t,r,i,o,l=a.scene;for(let e in"Scene"!==l.type&&(null==l.dispose||l.dispose()),l){let n=l[e];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}rr.delete(e),n&&n(e)}catch(e){}},500)})}}function rs(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let ru=new Set,rc=new Set,rd=new Set,rf=e=>rs(e,ru),rp=e=>rs(e,rc);function rm(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rh(e,n){switch(e){case"before":return rm(ru,n);case"after":return rm(rc,n);case"tail":return rm(rd,n)}}function rg(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),n=r.internal.subscribers;for(let e=0;e0)&&!(null!=(n=i.gl.xr)&&n.isPresenting)&&(r+=rg(e,i))}if(rv=!1,rh("after",e),0===r)return rh("tail",e),r_=!1,cancelAnimationFrame(a)}function rE(e,n=1){var t;if(!e)return rr.forEach(e=>rE(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):rv?e.internal.frames=2:e.internal.frames=1,r_||(r_=!0,requestAnimationFrame(rS)))}function rT(e,n=!0,t,r){if(n&&rh("before",e),t)rg(e,t,r);else for(let n of rr.values())rg(e,n.store.getState());n&&rh("after",e)}let rM={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rb(e){let{handlePointer:n}=function(e){function n(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(n=>{var t;return null==(t=e.__r3f)?void 0:t.handlers["onPointer"+n]}))}function t(n){let{internal:t}=e.getState();for(let e of t.hovered.values())if(!n.length||!n.find(n=>n.object===e.object&&n.index===e.index&&n.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(t.hovered.delete(tO(e)),null!=r&&r.eventCount){let t=r.handlers,a={...e,intersections:n};null==t.onPointerOut||t.onPointerOut(a),null==t.onPointerLeave||t.onPointerLeave(a)}}}function r(e,n){for(let t=0;tt([]);case"onLostPointerCapture":return n=>{let{internal:r}=e.getState();"pointerId"in n&&r.capturedMap.has(n.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(n.pointerId)&&(r.capturedMap.delete(n.pointerId),t([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(n,t){let r=e.getState(),a=new Set,i=[],o=t?t(r.internal.interaction):r.internal.interaction;for(let e=0;e{let t=tM(e.object),r=tM(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tO(e);return!a.has(n)&&(a.add(n),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let n=e.object;for(;n;){var s;null!=(s=n.__r3f)&&s.eventCount&&i.push({...e,eventObject:n}),n=n.parent}}if("pointerId"in n&&r.internal.capturedMap.has(n.pointerId))for(let e of r.internal.capturedMap.get(n.pointerId).values())a.has(tO(e.intersection))||i.push(e.intersection);return i}(i,s?n:void 0),d=u?function(n){let{internal:t}=e.getState(),r=n.offsetX-t.initialClick[0],a=n.offsetY-t.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&t(c),!function(e,n,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=tM(o.object);if(l||o.object.traverseAncestors(e=>{let n=tM(e);if(n)return l=n,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new v.Vector3(u.x,u.y,0).unproject(c),p=e=>{var n,t;return null!=(n=null==(t=d.capturedMap.get(e))?void 0:t.has(o.eventObject))&&n},m=e=>{let t={intersection:o,target:n.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),n.target.setPointerCapture(e)},h=e=>{let n=d.capturedMap.get(e);n&&tB(d.capturedMap,o.eventObject,n,e)},g={};for(let e in n){let t=n[e];"function"!=typeof t&&(g[e]=t)}let _={...o,...g,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in n&&d.capturedMap.get(n.pointerId);(!r||r.has(o.eventObject))&&(_.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&t([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},nativeEvent:n};if(a(_),!0===i.stopped)break}}}}(c,i,d,function(e){let n=e.eventObject,t=n.__r3f;if(!(null!=t&&t.eventCount))return;let o=t.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let n=tO(e),t=l.hovered.get(n);t?t.stopped&&e.stopPropagation():(l.hovered.set(n,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let t=o[a];t?(!u||l.initialHits.includes(n))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),t(e)):u&&l.initialHits.includes(n)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,n,t){n.pointer.set(e.offsetX/n.size.width*2-1,-(2*(e.offsetY/n.size.height))+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(rM).reduce((e,t)=>({...e,[t]:n(t)}),{}),update:()=>{var n;let{events:t,internal:r}=e.getState();null!=(n=r.lastEvent)&&n.current&&t.handlers&&t.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{let{set:t,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),t(e=>({events:{...e.events,connected:n}})),r.handlers)for(let e in r.handlers){let t=r.handlers[e],[a,i]=rM[e];n.addEventListener(a,t,{passive:i})}},disconnect:()=>{let{set:n,events:t}=e.getState();if(t.connected){if(t.handlers)for(let e in t.handlers){let n=t.handlers[e],[r]=rM[e];t.connected.removeEventListener(r,n)}n(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>tS,"C",()=>tV,"D",()=>tz,"E",()=>tE,"G",()=>tj,"a",()=>t_,"b",()=>tg,"c",()=>ri,"d",()=>rl,"e",()=>t0,"f",()=>rb,"i",()=>tm,"j",()=>rf,"k",()=>rp,"u",()=>tv],40859)},15080,e=>{"use strict";var n=e.i(40859);e.s(["useThree",()=>n.C])},71753,e=>{"use strict";var n=e.i(40859);e.s(["useFrame",()=>n.D])},79123,e=>{"use strict";var n=e.i(43476),t=e.i(71645);let r=(0,t.createContext)(null),a=(0,t.createContext)(null),i=(0,t.createContext)(null);function o(){return(0,t.useContext)(r)}function l(){return(0,t.useContext)(a)}function s(){return(0,t.useContext)(i)}function u({children:e,fogEnabledOverride:o,onClearFogEnabledOverride:l}){let[s,u]=(0,t.useState)(!0),[c,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(1),[m,h]=(0,t.useState)(90),[g,_]=(0,t.useState)(!1),[v,S]=(0,t.useState)(!0),[E,T]=(0,t.useState)(!1),[M,b]=(0,t.useState)("moveLookStick"),x=(0,t.useCallback)(e=>{u(e),l()},[l]),R=(0,t.useMemo)(()=>({fogEnabled:o??s,setFogEnabled:x,highQualityFog:c,setHighQualityFog:d,fov:m,setFov:h,audioEnabled:g,setAudioEnabled:_,animationEnabled:v,setAnimationEnabled:S}),[s,o,x,c,m,g,v]),C=(0,t.useMemo)(()=>({debugMode:E,setDebugMode:T}),[E,T]),y=(0,t.useMemo)(()=>({speedMultiplier:f,setSpeedMultiplier:p,touchMode:M,setTouchMode:b}),[f,p,M,b]);(0,t.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&T(e.debugMode),null!=e.audioEnabled&&_(e.audioEnabled),null!=e.animationEnabled&&S(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&d(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&h(e.fov),null!=e.touchMode&&b(e.touchMode)},[]);let A=(0,t.useRef)(null);return(0,t.useEffect)(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:s,highQualityFog:c,speedMultiplier:f,fov:m,audioEnabled:g,animationEnabled:v,debugMode:E,touchMode:M}))}catch(e){}},500),()=>{A.current&&clearTimeout(A.current)}),[s,c,f,m,g,v,E,M]),(0,n.jsx)(r.Provider,{value:R,children:(0,n.jsx)(a.Provider,{value:C,children:(0,n.jsx)(i.Provider,{value:y,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>s,"useDebug",()=>l,"useSettings",()=>o])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/22ebafda1e5f0224.js b/docs/_next/static/chunks/22ebafda1e5f0224.js deleted file mode 100644 index 98bd14e7..00000000 --- a/docs/_next/static/chunks/22ebafda1e5f0224.js +++ /dev/null @@ -1,351 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24478,(e,n,t)=>{"use strict";t.ConcurrentRoot=1,t.ContinuousEventPriority=8,t.DefaultEventPriority=32,t.DiscreteEventPriority=2,t.IdleEventPriority=0x10000000,t.LegacyRoot=0,t.NoEventPriority=0},39695,(e,n,t)=>{"use strict";n.exports=e.r(24478)},55838,(e,n,t)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!a(e,t)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),r=i({inst:{value:t,getSnapshot:n}}),a=r[0].inst,c=r[1];return l(function(){a.value=t,a.getSnapshot=n,u(a)&&c({inst:a})},[e,t,n]),o(function(){return u(a)&&c({inst:a}),e(function(){u(a)&&c({inst:a})})},[e]),s(t),t};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,n,t)=>{"use strict";n.exports=e.r(55838)},52822,(e,n,t)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,n,t,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var n=f.value;if(a(n,e))return l=n}return l=e}if(n=l,i(o,e))return n;var t=r(e);return void 0!==a&&a(n,t)?(o=e,n):(o=e,l=t)}var o,l,s=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]},[n,t,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,n,t)=>{"use strict";n.exports=e.r(52822)},29779,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},28563,(e,n,t)=>{"use strict";n.exports=e.r(29779)},40336,(e,n,t)=>{"use strict";var r=e.i(47167);n.exports=function(n){function t(e,n,t,r){return new rw(e,n,t,r)}function a(){}function i(e){var n="https://react.dev/errors/"+e;if(1)":-1a||u[r]!==c[a]){var d="\n"+u[r].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=r&&0<=a)break}}}finally{ao=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?s(t):""}function c(e){try{var n="";do n+=function(e){switch(e.tag){case 26:case 27:case 5:return s(e.type);case 16:return s("Lazy");case 13:return s("Suspense");case 19:return s("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function d(e){var n=e,t=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do 0!=(4098&(n=e).flags)&&(t=n.return),e=n.return;while(e)}return 3===n.tag?t:null}function f(e){if(d(e)!==e)throw Error(i(188))}function p(e){var n=e.alternate;if(!n){if(null===(n=d(e)))throw Error(i(188));return n!==e?null:e}for(var t=e,r=n;;){var a=t.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){t=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===t)return f(a),e;if(o===r)return f(a),n;o=o.sibling}throw Error(i(188))}if(t.return!==r.return)t=a,r=o;else{for(var l=!1,s=a.child;s;){if(s===t){l=!0,t=a,r=o;break}if(s===r){l=!0,r=a,t=o;break}s=s.sibling}if(!l){for(s=o.child;s;){if(s===t){l=!0,t=o,r=a;break}if(s===r){l=!0,r=o,t=a;break}s=s.sibling}if(!l)throw Error(i(189))}}if(t.alternate!==r)throw Error(i(190))}if(3!==t.tag)throw Error(i(188));return t.stateNode.current===t?e:n}function m(e){return{current:e}}function h(e){0>i4||(e.current=i2[i4],i2[i4]=null,i4--)}function g(e,n){i2[++i4]=e.current,e.current=n}function _(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function v(e,n){var t=e.pendingLanes;if(0===t)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,o=e.warmLanes;e=0!==e.finishedLanes;var l=0x7ffffff&t;return 0!==l?0!=(t=l&~a)?r=_(t):0!=(i&=l)?r=_(i):e||0!=(o=l&~o)&&(r=_(o)):0!=(l=t&~a)?r=_(l):0!==i?r=_(i):e||0!=(o=t&~o)&&(r=_(o)),0===r?0:0!==n&&n!==r&&0==(n&a)&&((a=r&-r)>=(o=n&-n)||32===a&&0!=(4194176&o))?n:r}function S(e,n){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function E(){var e=i7;return 0==(4194176&(i7<<=1))&&(i7=128),e}function T(){var e=oe;return 0==(0x3c00000&(oe<<=1))&&(oe=4194304),e}function b(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function M(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function x(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-i6(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&t}function R(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-i6(t),a=1<>=o,a-=o,oT=1<<32-i6(n)+a|t<f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],l);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&n(t,d),i=s(_,i,f),null===c?u=_:c.sibling=_,c=_,d=p}if(f===o.length)return r(t,d),oP&&A(t,f),u;if(null===d){for(;fp?(_=f,f=null):_=f.sibling;var S=h(t,f,v.value,u);if(null===S){null===f&&(f=_);break}e&&f&&null===S.alternate&&n(t,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=_}if(v.done)return r(t,f),oP&&A(t,p),c;if(null===f){for(;!v.done;p++,v=l.next())null!==(v=m(t,v.value,u))&&(o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return oP&&A(t,p),c}for(f=a(f);!v.done;p++,v=l.next())null!==(v=g(f,t,p,v.value,u))&&(e&&null!==v.alternate&&f.delete(null===v.key?p:v.key),o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return n(t,e)}),oP&&A(t,p),c}(c,d,f=_.call(f),p)}if("function"==typeof f.then)return t(c,d,e_(f),p);if(f.$$typeof===r2)return t(c,d,ts(c,f),p);eS(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(r(c,d.sibling),(p=l(d,f)).return=c):(r(c,d),(p=rO(f,c.mode,p)).return=c),u(c=p)):r(c,d)}(c,d,f,p);return oJ=null,_}catch(e){if(e===oK)throw e;var v=t(29,e,null,c.mode);return v.lanes=p,v.return=c,v}finally{}}}function eb(e,n){g(o4,e=l1),g(o2,n),l1=e|n.baseLanes}function eM(){g(o4,l1),g(o2,o2.current)}function ex(){l1=o4.current,h(o2),h(o4)}function eR(e){var n=e.alternate;g(o8,1&o8.current),g(o5,e),null===o6&&(null===n||null!==o2.current?o6=e:null!==n.memoizedState&&(o6=e))}function eC(e){if(22===e.tag){if(g(o8,o8.current),g(o5,e),null===o6){var n=e.alternate;null!==n&&null!==n.memoizedState&&(o6=e)}}else ey(e)}function ey(){g(o8,o8.current),g(o5,o5.current)}function eA(e){h(o5),o6===e&&(o6=null),h(o8)}function eP(e){for(var n=e;null!==n;){if(13===n.tag){var t=n.memoizedState;if(null!==t&&(null===(t=t.dehydrated)||ip(t)||im(t)))return n}else if(19===n.tag&&void 0!==n.memoizedProps.revealOrder){if(0!=(128&n.flags))return n}else if(null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}function ew(){throw Error(i(321))}function eL(e,n){if(null===n)return!1;for(var t=0;ti?i:8);var o=ai.T,l={};ai.T=l,nA(e,!1,n,t);try{var s=a(),u=ai.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;for(var e=0;e";case lk:return":has("+(t6(e)||"")+")";case lH:return'[role="'+e.value+'"]';case lz:return'"'+e.value+'"';case lV:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function t8(e,n){var t=[];e=[e,0];for(var r=0;rst&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304)}else{if(!r)if(null!==(e=eP(o))){if(n.flags|=128,r=!0,e=e.updateQueue,n.updateQueue=e,tb(n,e),tM(a,!0),null===a.tail&&"hidden"===a.tailMode&&!o.alternate&&!oP)return tx(n),null}else 2*oi()-a.renderingStartTime>st&&0x20000000!==t&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304);a.isBackwards?(o.sibling=n.child,n.child=o):(null!==(e=a.last)?e.sibling=o:n.child=o,a.last=o)}if(null!==a.tail)return n=a.tail,a.rendering=n,a.tail=n.sibling,a.renderingStartTime=oi(),n.sibling=null,e=o8.current,g(o8,r?1&e|2:1&e),n;return tx(n),null;case 22:case 23:return eA(n),ex(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(tx(n),6&n.subtreeFlags&&(n.flags|=8192)):tx(n),null!==(t=n.updateQueue)&&tb(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&h(ly),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),tn(lR),tx(n),null;case 25:return null}throw Error(i(156,n.tag))}(n.alternate,n,l1);if(null!==t){lY=t;return}if(null!==(n=n.sibling)){lY=n;return}lY=n=e}while(null!==n)0===l3&&(l3=5)}function rS(e,n){do{var t=function(e,n){switch(L(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return tn(lR),D(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return I(n),null;case 13:if(eA(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(i(340));k()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return h(o8),null;case 4:return D(),null;case 10:return tn(n.type),null;case 22:case 23:return eA(n),ex(),null!==e&&h(ly),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return tn(lR),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,lY=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){lY=e;return}lY=e=t}while(null!==e)l3=6,lY=null}function rE(e,n,t,r,a,o,l,s,u,c){var d=ai.T,f=aL();try{aw(2),ai.T=null,function(e,n,t,r,a,o,l,s){do rb();while(null!==so)if(0!=(6&lj))throw Error(i(327));var u,c,d=e.finishedWork;if(r=e.finishedLanes,null!==d){if(e.finishedWork=null,e.finishedLanes=0,d===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var f=d.lanes|d.childLanes;!function(e,n,t,r,a,i){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(t=o&~t;0t?32:t;t=ai.T;var a=aL();try{if(aw(r),ai.T=null,null===so)var o=!1;else{r=su,su=null;var l=so,s=sl;if(so=null,sl=0,0!=(6&lj))throw Error(i(331));var u=lj;if(lj|=4,t3(l.current),t$(l,l.current,s,r),lj=u,K(0,!1),od&&"function"==typeof od.onPostCommitFiberRoot)try{od.onPostCommitFiberRoot(oc,l)}catch(e){}o=!0}return o}finally{aw(a),ai.T=t,rT(e,n)}}return!1}function rM(e,n,t){n=y(t,n),n=nB(e.stateNode,n,2),null!==(e=ei(e,n,2))&&(M(e,2),Y(e))}function rx(e,n,t){if(3===e.tag)rM(e,e,t);else for(;null!==n;){if(3===n.tag){rM(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===sa||!sa.has(r))){e=y(t,e),null!==(r=ei(n,t=nG(2),2))&&(nk(t,r,n,e),M(r,2),Y(r));break}}n=n.return}}function rR(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new lX;var a=new Set;r.set(n,a)}else void 0===(a=r.get(n))&&(a=new Set,r.set(n,a));a.has(t)||(l0=!0,a.add(t),e=rC.bind(null,e,n,t),n.then(e,e))}function rC(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,lq===e&&(lK&t)===t&&(4===l3||3===l3&&(0x3c00000&lK)===lK&&300>oi()-sn?0==(2&lj)&&rs(e,0):l5|=t,l8===lK&&(l8=0)),Y(e)}function ry(e,n){0===n&&(n=T()),null!==(e=X(e,n))&&(M(e,n),Y(e))}function rA(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),ry(e,t)}function rP(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(t=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(n),ry(e,t)}function rw(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rL(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rU(e,n){var r=e.alternate;return null===r?((r=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rD(e,n){e.flags&=0x1e00002;var t=e.alternate;return null===t?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,e.type=t.type,e.dependencies=null===(n=t.dependencies)?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function rN(e,n,r,a,o,l){var s=0;if(a=e,"function"==typeof e)rL(e)&&(s=1);else if("string"==typeof e)s=iO&&iQ?iB(e,r,oM.current)?26:i3(e)?27:5:iO?iB(e,r,oM.current)?26:5:iQ&&i3(e)?27:5;else e:switch(e){case rZ:return rI(r.children,o,l,n);case rJ:s=8,o|=24;break;case r0:return(e=t(12,r,n,2|o)).elementType=r0,e.lanes=l,e;case r5:return(e=t(13,r,n,o)).elementType=r5,e.lanes=l,e;case r6:return(e=t(19,r,n,o)).elementType=r6,e.lanes=l,e;case r7:return rF(r,o,l,n);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r2:s=10;break e;case r3:s=9;break e;case r4:s=11;break e;case r8:s=14;break e;case r9:s=16,a=null;break e}s=29,r=Error(i(130,null===e?"null":typeof e,"")),a=null}return(n=t(s,r,n,o)).elementType=e,n.type=a,n.lanes=l,n}function rI(e,n,r,a){return(e=t(7,e,a,n)).lanes=r,e}function rF(e,n,r,a){(e=t(22,e,a,n)).elementType=r7,e.lanes=r;var o={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0==(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility|=2,rn(n,e,2))}},attach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0!=(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility&=-3,rn(n,e,2))}}};return e.stateNode=o,e}function rO(e,n,r){return(e=t(6,e,null,n)).lanes=r,e}function rB(e,n,r){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function rG(e,n,t,r,a,i,o,l){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=aM,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function rk(e,n,r,a,i,o,l,s,u,c,d,f){return e=new rG(e,n,r,l,s,u,c,f),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=tc(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:n},et(o),e}function rH(e){var n=e._reactInternals;if(void 0===n){if("function"==typeof e.render)throw Error(i(188));throw Error(i(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(n))?function e(n){var t=n.tag;if(5===t||26===t||27===t||6===t)return n;for(n=n.child;null!==n;){if(null!==(t=e(n)))return t;n=n.sibling}return null}(e):null)?null:ad(e.stateNode)}function rV(e,n,t,r,a,i){a=a?i5:i5,null===r.context?r.context=a:r.pendingContext=a,(r=ea(n)).payload={element:t},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(t=ei(e,r,n))&&(rn(t,e,n),eo(t,e,n))}function rz(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t>>=0)?32:31-(i8(e)/i9|0)|0},i8=Math.log,i9=Math.LN2,i7=128,oe=4194304,on=rq.unstable_scheduleCallback,ot=rq.unstable_cancelCallback,or=rq.unstable_shouldYield,oa=rq.unstable_requestPaint,oi=rq.unstable_now,oo=rq.unstable_ImmediatePriority,ol=rq.unstable_UserBlockingPriority,os=rq.unstable_NormalPriority,ou=rq.unstable_IdlePriority,oc=(rq.log,rq.unstable_setDisableYieldValue,null),od=null,of="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},op=new WeakMap,om=[],oh=0,og=null,o_=0,ov=[],oS=0,oE=null,oT=1,ob="",oM=m(null),ox=m(null),oR=m(null),oC=m(null),oy=null,oA=null,oP=!1,ow=null,oL=!1,oU=Error(i(519)),oD=[],oN=0,oI=0,oF=null,oO=null,oB=!1,oG=!1,ok=!1,oH=0,oV=null,oz=0,oW=0,oX=null,oj=!1,oq=!1,oY=Object.prototype.hasOwnProperty,oK=Error(i(460)),o$=Error(i(474)),oQ={then:function(){}},oZ=null,oJ=null,o0=0,o1=eT(!0),o3=eT(!1),o2=m(null),o4=m(0),o5=m(null),o6=null,o8=m(0),o9=0,o7=null,le=null,ln=null,lt=!1,lr=!1,la=!1,li=0,lo=0,ll=null,ls=0,lu=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},lc={readContext:tl,use:eV,useCallback:ew,useContext:ew,useEffect:ew,useImperativeHandle:ew,useLayoutEffect:ew,useInsertionEffect:ew,useMemo:ew,useReducer:ew,useRef:ew,useState:ew,useDebugValue:ew,useDeferredValue:ew,useTransition:ew,useSyncExternalStore:ew,useId:ew};lc.useCacheRefresh=ew,lc.useMemoCache=ew,lc.useHostTransitionStatus=ew,lc.useFormState=ew,lc.useActionState=ew,lc.useOptimistic=ew;var ld={readContext:tl,use:eV,useCallback:function(e,n){return eG().memoizedState=[e,void 0===n?null:n],e},useContext:tl,useEffect:ns,useImperativeHandle:function(e,n,t){t=null!=t?t.concat([e]):null,no(4194308,4,nf.bind(null,n,e),t)},useLayoutEffect:function(e,n){return no(4194308,4,e,n)},useInsertionEffect:function(e,n){no(4,2,e,n)},useMemo:function(e,n){var t=eG();n=void 0===n?null:n;var r=e();return t.memoizedState=[r,n],r},useReducer:function(e,n,t){var r=eG();if(void 0!==t)var a=t(n);else a=n;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=nR.bind(null,o7,e),[r.memoizedState,e]},useRef:function(e){return eG().memoizedState={current:e}},useState:function(e){var n=(e=e0(e)).queue,t=nC.bind(null,o7,n);return n.dispatch=t,[e.memoizedState,t]},useDebugValue:nm,useDeferredValue:function(e,n){return n_(eG(),e,n)},useTransition:function(){var e=e0(!1);return e=nS.bind(null,o7,e.queue,!0,!1),eG().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,t){var r=o7,a=eG();if(oP){if(void 0===t)throw Error(i(407));t=t()}else{if(t=n(),null===lq)throw Error(i(349));0!=(60&lK)||eK(r,n,t)}a.memoizedState=t;var o={value:t,getSnapshot:n};return a.queue=o,ns(eQ.bind(null,r,o,e),[e]),r.flags|=2048,na(9,e$.bind(null,r,o,t,n),{destroy:void 0},null),t},useId:function(){var e=eG(),n=lq.identifierPrefix;if(oP){var t=ob,r=oT;n=":"+n+"R"+(t=(r&~(1<<32-i6(r)-1)).toString(32)+t),0<(t=li++)&&(n+="H"+t.toString(32)),n+=":"}else n=":"+n+"r"+(t=ls++).toString(32)+":";return e.memoizedState=n},useCacheRefresh:function(){return eG().memoizedState=nx.bind(null,o7)}};ld.useMemoCache=ez,ld.useHostTransitionStatus=nT,ld.useFormState=e7,ld.useActionState=e7,ld.useOptimistic=function(e){var n=eG();n.memoizedState=n.baseState=e;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=t,n=nA.bind(null,o7,!0,t),t.dispatch=n,[e,n]};var lf={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eX,useRef:ni,useState:function(){return eX(eW)},useDebugValue:nm,useDeferredValue:function(e,n){return nv(ek(),le.memoizedState,e,n)},useTransition:function(){var e=eX(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lf.useCacheRefresh=nM,lf.useMemoCache=ez,lf.useHostTransitionStatus=nT,lf.useFormState=ne,lf.useActionState=ne,lf.useOptimistic=function(e,n){return e1(ek(),le,e,n)};var lp={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eq,useRef:ni,useState:function(){return eq(eW)},useDebugValue:nm,useDeferredValue:function(e,n){var t=ek();return null===le?n_(t,e,n):nv(t,le.memoizedState,e,n)},useTransition:function(){var e=eq(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lp.useCacheRefresh=nM,lp.useMemoCache=ez,lp.useHostTransitionStatus=nT,lp.useFormState=nr,lp.useActionState=nr,lp.useOptimistic=function(e,n){var t=ek();return null!==le?e1(t,le,e,n):(t.baseState=e,[e,t.queue.dispatch])};var lm={isMounted:function(e){return!!(e=e._reactInternals)&&d(e)===e},enqueueSetState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=t7(),r=ea(t);r.tag=2,null!=n&&(r.callback=n),null!==(n=ei(e,r,t))&&(rn(n,e,t),eo(n,e,t))}},lh="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},lg=Error(i(461)),l_=!1,lv={dehydrated:null,treeContext:null,retryLane:0},lS=m(null),lE=null,lT=null,lb="undefined"!=typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},lM=rq.unstable_scheduleCallback,lx=rq.unstable_NormalPriority,lR={$$typeof:r2,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},lC=ai.S;ai.S=function(e,n){"object"==typeof n&&null!==n&&"function"==typeof n.then&&function(e,n){if(null===oV){var t=oV=[];oz=0,oW=ee(),oX={status:"pending",value:void 0,then:function(e){t.push(e)}}}oz++,n.then(en,en)}(0,n),null!==lC&&lC(e,n)};var ly=m(null),lA=!1,lP=!1,lw=!1,lL="function"==typeof WeakSet?WeakSet:Set,lU=null,lD=!1,lN=null,lI=!1,lF=null,lO=8192,lB={getCacheForType:function(e){var n=tl(lR),t=n.data.get(e);return void 0===t&&(t=e(),n.data.set(e,t)),t}},lG=0,lk=1,lH=2,lV=3,lz=4;if("function"==typeof Symbol&&Symbol.for){var lW=Symbol.for;lG=lW("selector.component"),lk=lW("selector.has_pseudo_class"),lH=lW("selector.role"),lV=lW("selector.test_id"),lz=lW("selector.text")}var lX="function"==typeof WeakMap?WeakMap:Map,lj=0,lq=null,lY=null,lK=0,l$=0,lQ=null,lZ=!1,lJ=!1,l0=!1,l1=0,l3=0,l2=0,l4=0,l5=0,l6=0,l8=0,l9=null,l7=null,se=!1,sn=0,st=1/0,sr=null,sa=null,si=!1,so=null,sl=0,ss=0,su=null,sc=0,sd=null;return rX.attemptContinuousHydration=function(e){if(13===e.tag){var n=X(e,0x4000000);null!==n&&rn(n,e,0x4000000),rW(e,0x4000000)}},rX.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var n=t7(),t=X(e,n);null!==t&&rn(t,e,n),rW(e,n)}},rX.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var n=_(e.pendingLanes);if(0!==n){for(e.pendingLanes|=2,e.entangledLanes|=2;n;){var t=1<<31-i6(n);e.entanglements[1]|=t,n&=~t}Y(e),0==(6&lj)&&(st=oi()+500,K(0,!1))}}break;case 13:null!==(n=X(e,2))&&rn(n,e,2),ro(),rW(e,2)}},rX.batchedUpdates=function(e,n){return e(n)},rX.createComponentSelector=function(e){return{$$typeof:lG,value:e}},rX.createContainer=function(e,n,t,r,a,i,o,l,s,u){return rk(e,n,!1,null,t,r,i,o,l,s,u,null)},rX.createHasPseudoClassSelector=function(e){return{$$typeof:lk,value:e}},rX.createHydrationContainer=function(e,n,t,r,a,i,o,l,s,u,c,d,f){var p;return(e=rk(t,r,!0,e,a,i,l,s,u,c,d,f)).context=(p=null,i5),t=e.current,(a=ea(r=t7())).callback=null!=n?n:null,ei(t,a,r),e.current.lanes=r,M(e,r),Y(e),e},rX.createPortal=function(e,n,t){var r=3=c&&o>=f&&a<=d&&l<=p){e.splice(n,1);break}if(r!==c||t.width!==u.width||pl){if(!(o!==f||t.height!==u.height||da)){c>r&&(u.width+=c-r,u.x=r),do&&(u.height+=f-o,u.y=o),pt&&(t=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},rX.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return ad(e.child.stateNode);default:return e.child.stateNode}},rX.injectIntoDevTools=function(){var e={bundleType:0,version:as,rendererPackageName:au,currentDispatcherRef:ai,findFiberByHostInstance:aA,reconcilerVersion:"19.0.0"};if(null!==ac&&(e.rendererConfig=ac),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{oc=n.inject(e),od=n}catch(e){}e=!!n.checkDCE}}return e},rX.isAlreadyRendering=function(){return!1},rX.observeVisibleRects=function(e,n,t,r){if(!aX)throw Error(i(363));var a=aZ(e=t9(e,n),t,r).disconnect;return{disconnect:function(){a()}}},rX.shouldError=function(){return null},rX.shouldSuspend=function(){return!1},rX.startHostTransition=function(e,n,t,r){if(5!==e.tag)throw Error(i(476));var o=nE(e).queue;nS(e,o,n,ak,null===t?a:function(){var n=nE(e).next.queue;return ny(e,n,{},t7()),t(r)})},rX.updateContainer=function(e,n,t,r){var a=n.current,i=t7();return rV(a,i,e,n,t,r),i},rX.updateContainerSync=function(e,n,t,r){return 0===n.tag&&rb(),rV(n.current,2,e,n,t,r),2},rX},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})},98133,(e,n,t)=>{"use strict";n.exports=e.r(40336)},45015,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},95087,(e,n,t)=>{"use strict";n.exports=e.r(45015)},91037,8560,8155,66748,46791,e=>{"use strict";let n,t,r,a,i,o,l,s,u;var c,d,f,p=e.i(71645),m=e.i(39695),h=e.i(90072),g=h;function _(){let e=null,n=!1,t=null,r=null;function a(n,i){t(n,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===n||null!==t&&(r=e.requestAnimationFrame(a),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(e){t=e},setContext:function(n){e=n}}}function v(e){let n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){let e=n.get(t);(!e||e.versione.start-n.start);let n=0;for(let e=1;e 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},E={common:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new g.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new g.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new g.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new g.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new g.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new g.Matrix3},normalScale:{value:new g.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new g.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new g.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new g.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new g.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new g.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0},uvTransform:{value:new g.Matrix3}},sprite:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},center:{value:new g.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}}},T={basic:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.fog]),vertexShader:S.meshbasic_vert,fragmentShader:S.meshbasic_frag},lambert:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshlambert_vert,fragmentShader:S.meshlambert_frag},phong:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},specular:{value:new g.Color(1118481)},shininess:{value:30}}]),vertexShader:S.meshphong_vert,fragmentShader:S.meshphong_frag},standard:{uniforms:(0,g.mergeUniforms)([E.common,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.roughnessmap,E.metalnessmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag},toon:{uniforms:(0,g.mergeUniforms)([E.common,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.gradientmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshtoon_vert,fragmentShader:S.meshtoon_frag},matcap:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,E.fog,{matcap:{value:null}}]),vertexShader:S.meshmatcap_vert,fragmentShader:S.meshmatcap_frag},points:{uniforms:(0,g.mergeUniforms)([E.points,E.fog]),vertexShader:S.points_vert,fragmentShader:S.points_frag},dashed:{uniforms:(0,g.mergeUniforms)([E.common,E.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:S.linedashed_vert,fragmentShader:S.linedashed_frag},depth:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap]),vertexShader:S.depth_vert,fragmentShader:S.depth_frag},normal:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,{opacity:{value:1}}]),vertexShader:S.meshnormal_vert,fragmentShader:S.meshnormal_frag},sprite:{uniforms:(0,g.mergeUniforms)([E.sprite,E.fog]),vertexShader:S.sprite_vert,fragmentShader:S.sprite_frag},background:{uniforms:{uvTransform:{value:new g.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:S.background_vert,fragmentShader:S.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new g.Matrix3}},vertexShader:S.backgroundCube_vert,fragmentShader:S.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:S.cube_vert,fragmentShader:S.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:S.equirect_vert,fragmentShader:S.equirect_frag},distance:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap,{referencePosition:{value:new g.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:S.distance_vert,fragmentShader:S.distance_frag},shadow:{uniforms:(0,g.mergeUniforms)([E.lights,E.fog,{color:{value:new g.Color(0)},opacity:{value:1}}]),vertexShader:S.shadow_vert,fragmentShader:S.shadow_frag}};T.physical={uniforms:(0,g.mergeUniforms)([T.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new g.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new g.Matrix3},clearcoatNormalScale:{value:new g.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new g.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new g.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new g.Matrix3},sheen:{value:0},sheenColor:{value:new g.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new g.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new g.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new g.Matrix3},transmissionSamplerSize:{value:new g.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new g.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new g.Color(0)},specularColor:{value:new g.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new g.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new g.Matrix3},anisotropyVector:{value:new g.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new g.Matrix3}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag};let b={r:0,b:0,g:0},M=new g.Euler,x=new g.Matrix4;function R(e,n,t,r,a,i,o){let l,s,u=new g.Color(0),c=+(!0!==i),d=null,f=0,p=null;function m(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?t:n).get(r)),r}function h(n,t){n.getRGB(b,(0,g.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(b.r,b.g,b.b,t,o)}return{getClearColor:function(){return u},setClearColor:function(e,n=1){u.set(e),h(u,c=n)},getClearAlpha:function(){return c},setClearAlpha:function(e){h(u,c=e)},render:function(n){let t=!1,a=m(n);null===a?h(u,c):a&&a.isColor&&(h(a,1),t=!0);let i=e.xr.getEnvironmentBlendMode();"additive"===i?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===i&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||t)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,t){let r=m(t);r&&(r.isCubeTexture||r.mapping===g.CubeUVReflectionMapping)?(void 0===s&&((s=new g.Mesh(new g.BoxGeometry(1,1,1),new g.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,g.cloneUniforms)(T.backgroundCube.uniforms),vertexShader:T.backgroundCube.vertexShader,fragmentShader:T.backgroundCube.fragmentShader,side:g.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,n,t){this.matrixWorld.copyPosition(t.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(s)),M.copy(t.backgroundRotation),M.x*=-1,M.y*=-1,M.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(M.y*=-1,M.z*=-1),s.material.uniforms.envMap.value=r,s.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,s.material.uniforms.backgroundBlurriness.value=t.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(x.makeRotationFromEuler(M)),s.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,(d!==r||f!==r.version||p!==e.toneMapping)&&(s.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new g.Mesh(new g.PlaneGeometry(2,2),new g.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,g.cloneUniforms)(T.background.uniforms),vertexShader:T.background.vertexShader,fragmentShader:T.background.fragmentShader,side:g.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,l.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function C(e,n){let t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(n){return e.bindVertexArray(n)}function s(n){return e.deleteVertexArray(n)}function u(e){let n=[],r=[],a=[];for(let e=0;e=0){let t=a[n],r=o[n];if(void 0===r&&("instanceMatrix"===n&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(r=e.instanceColor)),void 0===t||t.attribute!==r||r&&t.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(t,h,s,_))&&function(e,n,t,r){let a={},o=n.attributes,l=0,s=t.getAttributes();for(let n in s)if(s[n].location>=0){let t=o[n];void 0===t&&("instanceMatrix"===n&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(t=e.instanceColor));let r={};r.attribute=t,t&&t.data&&(r.data=t.data),a[n]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(t,h,s,_),null!==_&&n.update(_,e.ELEMENT_ARRAY_BUFFER),(x||o)&&(o=!1,function(t,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&t.instanceMatrix&&(l=t.instanceMatrix),"instanceColor"===r&&t.instanceColor&&(l=t.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=n.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===g.IntType;if(l.isInterleavedBufferAttribute){let n=l.data,s=n.stride,g=l.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";n="mediump"}return"mediump"===n&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==t.precision?t.precision:"highp",l=i(o);return l!==o&&((0,g.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(n){return n===g.RGBAFormat||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(t){let a=t===g.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return t===g.UnsignedByteType||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||t===g.FloatType||!!a},precision:o,logarithmicDepthBuffer:!0===t.logarithmicDepthBuffer,reversedDepthBuffer:!0===t.reversedDepthBuffer&&n.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function P(e){let n=this,t=null,r=0,a=!1,i=!1,o=new g.Plane,l=new g.Matrix3,s={value:null,needsUpdate:!1};function u(e,t,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let n=r+4*i,a=t.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length0),n.numPlanes=r,n.numIntersection=0)}}function w(e){let n=new WeakMap;function t(e,n){return n===g.EquirectangularReflectionMapping?e.mapping=g.CubeReflectionMapping:n===g.EquirectangularRefractionMapping&&(e.mapping=g.CubeRefractionMapping),e}function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping;if(i===g.EquirectangularReflectionMapping||i===g.EquirectangularRefractionMapping)if(n.has(a))return t(n.get(a).texture,a.mapping);else{let i=a.image;if(!i||!(i.height>0))return null;{let o=new g.WebGLCubeRenderTarget(i.height);return o.fromEquirectangularTexture(e,a),n.set(a,o),a.addEventListener("dispose",r),t(o.texture,a.mapping)}}}return a},dispose:function(){n=new WeakMap}}}let L=[.125,.215,.35,.446,.526,.582],U=new g.OrthographicCamera,D=new g.Color,N=null,I=0,F=0,O=!1,B=new g.Vector3;class G{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,t=.1,r=100,a={}){let{size:i=256,position:o=B}=a;N=this._renderer.getRenderTarget(),I=this._renderer.getActiveCubeFace(),F=this._renderer.getActiveMipmapLevel(),O=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,t,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=z(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=V(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=L[o-e+4-1]:0===o&&(l=0),t.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let n=e%3*2/3-1,t=e>2?0:-1,r=[n,t,0,n+2/3,t,0,n+2/3,t+1,0,n,t,0,n+2/3,t+1,0,n,t+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new g.BufferGeometry;h.setAttribute("position",new g.BufferAttribute(f,3)),h.setAttribute("uv",new g.BufferAttribute(p,2)),h.setAttribute("faceIndex",new g.BufferAttribute(m,1)),r.push(new g.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:n,sigmas:t}}(d)),this._blurMaterial=(a=d,i=e,o=n,r=new Float32Array(20),c=new g.Vector3(0,1,0),new g.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:W(),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:g.NoBlending,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=d,s=e,u=n,new g.ShaderMaterial({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/s,CUBEUV_TEXEL_HEIGHT:1/u,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:W(),fragmentShader:` - - precision highp float; - precision highp int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform float roughness; - uniform float mipInt; - - #define ENVMAP_TYPE_CUBE_UV - #include - - #define PI 3.14159265359 - - // Van der Corput radical inverse - float radicalInverse_VdC(uint bits) { - bits = (bits << 16u) | (bits >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // / 0x100000000 - } - - // Hammersley sequence - vec2 hammersley(uint i, uint N) { - return vec2(float(i) / float(N), radicalInverse_VdC(i)); - } - - // GGX VNDF importance sampling (Eric Heitz 2018) - // "Sampling the GGX Distribution of Visible Normals" - // https://jcgt.org/published/0007/04/01/ - vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { - float alpha = roughness * roughness; - - // Section 3.2: Transform view direction to hemisphere configuration - vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); - - // Section 4.1: Orthonormal basis - float lensq = Vh.x * Vh.x + Vh.y * Vh.y; - vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); - vec3 T2 = cross(Vh, T1); - - // Section 4.2: Parameterization of projected area - float r = sqrt(Xi.x); - float phi = 2.0 * PI * Xi.y; - float t1 = r * cos(phi); - float t2 = r * sin(phi); - float s = 0.5 * (1.0 + Vh.z); - t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; - - // Section 4.3: Reprojection onto hemisphere - vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; - - // Section 3.4: Transform back to ellipsoid configuration - return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); - } - - void main() { - vec3 N = normalize(vOutputDirection); - vec3 V = N; // Assume view direction equals normal for pre-filtering - - vec3 prefilteredColor = vec3(0.0); - float totalWeight = 0.0; - - // For very low roughness, just sample the environment directly - if (roughness < 0.001) { - gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); - return; - } - - // Tangent space basis for VNDF sampling - vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangent = normalize(cross(up, N)); - vec3 bitangent = cross(N, tangent); - - for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { - vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); - - // For PMREM, V = N, so in tangent space V is always (0, 0, 1) - vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); - - // Transform H back to world space - vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); - vec3 L = normalize(2.0 * dot(V, H) * H - V); - - float NdotL = max(dot(N, L), 0.0); - - if(NdotL > 0.0) { - // Sample environment at fixed mip level - // VNDF importance sampling handles the distribution filtering - vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); - - // Weight by NdotL for the split-sum approximation - // VNDF PDF naturally accounts for the visible microfacet distribution - prefilteredColor += sampleColor * NdotL; - totalWeight += NdotL; - } - } - - if (totalWeight > 0.0) { - prefilteredColor = prefilteredColor / totalWeight; - } - - gl_FragColor = vec4(prefilteredColor, 1.0); - } - `,blending:g.NoBlending,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let n=new g.Mesh(new g.BufferGeometry,e);this._renderer.compile(n,U)}_sceneToCubeUV(e,n,t,r,a){let i=new g.PerspectiveCamera(90,1,n,t),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,c=s.toneMapping;s.getClearColor(D),s.toneMapping=g.NoToneMapping,s.autoClear=!1,s.state.buffers.depth.getReversed()&&(s.setRenderTarget(r),s.clearDepth(),s.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new g.Mesh(new g.BoxGeometry,new g.MeshBasicMaterial({name:"PMREM.Background",side:g.BackSide,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(D),p=!0);for(let n=0;n<6;n++){let t=n%3;0===t?(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x+l[n],a.y,a.z)):1===t?(i.up.set(0,0,o[n]),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y+l[n],a.z)):(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y,a.z+l[n]));let u=this._cubeSize;H(r,t*u,n>2?u:0,u,u),s.setRenderTarget(r),p&&s.render(d,i),s.render(e,i)}s.toneMapping=c,s.autoClear=u,e.background=m}_textureToCubeUV(e,n){let t=this._renderer,r=e.mapping===g.CubeReflectionMapping||e.mapping===g.CubeRefractionMapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=z()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=V());let a=r?this._cubemapMaterial:this._equirectMaterial,i=this._lodMeshes[0];i.material=a,a.uniforms.envMap.value=e;let o=this._cubeSize;H(n,0,0,3*o,2*o),t.setRenderTarget(n),t.render(i,U)}_applyPMREM(e){let n=this._renderer,t=n.autoClear;n.autoClear=!1;let r=this._lodMeshes.length;for(let n=1;nd-4?t-d+4:0),m=4*(this._cubeSize-f);l.envMap.value=e.texture,l.roughness.value=c*(0+1.25*s),l.mipInt.value=d-n,H(a,p,m,3*f,2*f),r.setRenderTarget(a),r.render(o,U),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=d-t,H(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,U)}_blur(e,n,t,r,a){let i=this._pingPongRenderTarget;this._halfBlur(e,i,n,t,r,"latitudinal",a),this._halfBlur(i,e,t,t,r,"longitudinal",a)}_halfBlur(e,n,t,r,a,i,o){let l=this._renderer,s=this._blurMaterial;"latitudinal"!==i&&"longitudinal"!==i&&(0,g.error)("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[r];u.material=s;let c=s.uniforms,d=this._sizeLods[t]-1,f=isFinite(a)?Math.PI/(2*d):2*Math.PI/39,p=a/f,m=isFinite(a)?1+Math.floor(3*p):20;m>20&&(0,g.warn)(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);let h=[],_=0;for(let e=0;e<20;++e){let n=e/p,t=Math.exp(-n*n/2);h.push(t),0===e?_+=t:ev-4?r-v+4:0),E,3*S,2*S),l.setRenderTarget(n),l.render(u,U)}}function k(e,n,t){let r=new g.WebGLRenderTarget(e,n,t);return r.texture.mapping=g.CubeUVReflectionMapping,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function H(e,n,t,r,a){e.viewport.set(n,t,r,a),e.scissor.set(n,t,r,a)}function V(){return new g.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:W(),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:g.NoBlending,depthTest:!1,depthWrite:!1})}function z(){return new g.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:W(),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:g.NoBlending,depthTest:!1,depthWrite:!1})}function W(){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 X(e){let n=new WeakMap,t=null;function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping,o=i===g.EquirectangularReflectionMapping||i===g.EquirectangularRefractionMapping,l=i===g.CubeReflectionMapping||i===g.CubeRefractionMapping;if(o||l){let i=n.get(a),s=void 0!==i?i.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==s)return null===t&&(t=new G(e)),(i=o?t.fromEquirectangular(a,i):t.fromCubemap(a,i)).texture.pmremVersion=a.pmremVersion,n.set(a,i),i.texture;{if(void 0!==i)return i.texture;let s=a.image;return o&&s&&s.height>0||l&&s&&function(e){let n=0;for(let t=0;t<6;t++)void 0!==e[t]&&n++;return 6===n}(s)?(null===t&&(t=new G(e)),(i=o?t.fromEquirectangular(a):t.fromCubemap(a)).texture.pmremVersion=a.pmremVersion,n.set(a,i),a.addEventListener("dispose",r),i.texture):null}}}return a},dispose:function(){n=new WeakMap,null!==t&&(t.dispose(),t=null)}}}function j(e){let n={};function t(t){if(void 0!==n[t])return n[t];let r=e.getExtension(t);return n[t]=r,r}return{has:function(e){return null!==t(e)},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(e){let n=t(e);return null===n&&(0,g.warnOnce)("WebGLRenderer: "+e+" extension not supported."),n}}}function q(e,n,t,r){let a={},i=new WeakMap;function o(e){let l=e.target;for(let e in null!==l.index&&n.remove(l.index),l.attributes)n.remove(l.attributes[e]);l.removeEventListener("dispose",o),delete a[l.id];let s=i.get(l);s&&(n.remove(s),i.delete(l)),r.releaseStatesOfGeometry(l),!0===l.isInstancedBufferGeometry&&delete l._maxInstanceCount,t.memory.geometries--}function l(e){let t=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){let e=r.array;o=r.version;for(let n=0,r=e.length;nn.maxTextureSize&&(m=Math.ceil(p/n.maxTextureSize),p=n.maxTextureSize);let h=new Float32Array(p*m*4*c),_=new g.DataArrayTexture(h,p,m,c);_.type=g.FloatType,_.needsUpdate=!0;let v=4*f;for(let n=0;n - #include - - void main() { - gl_FragColor = texture2D( tDiffuse, vUv ); - - #ifdef LINEAR_TONE_MAPPING - gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); - #elif defined( REINHARD_TONE_MAPPING ) - gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); - #elif defined( CINEON_TONE_MAPPING ) - gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); - #elif defined( ACES_FILMIC_TONE_MAPPING ) - gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); - #elif defined( AGX_TONE_MAPPING ) - gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); - #elif defined( NEUTRAL_TONE_MAPPING ) - gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); - #elif defined( CUSTOM_TONE_MAPPING ) - gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); - #endif - - #ifdef SRGB_TRANSFER - gl_FragColor = sRGBTransferOETF( gl_FragColor ); - #endif - }`,depthTest:!1,depthWrite:!1}),c=new g.Mesh(s,u),d=new g.OrthographicCamera(-1,1,1,-1,0,1),f=null,p=null,m=!1,h=null,_=[],v=!1;this.setSize=function(e,n){o.setSize(e,n),l.setSize(e,n);for(let t=0;t<_.length;t++){let r=_[t];r.setSize&&r.setSize(e,n)}},this.setEffects=function(e){v=(_=e).length>0&&!0===_[0].isRenderPass;let n=o.width,t=o.height;for(let e=0;e<_.length;e++){let r=_[e];r.setSize&&r.setSize(n,t)}},this.begin=function(e,n){if(m||e.toneMapping===g.NoToneMapping&&0===_.length)return!1;if(h=n,null!==n){let e=n.width,t=n.height;(o.width!==e||o.height!==t)&&this.setSize(e,t)}return!1===v&&e.setRenderTarget(o),i=e.toneMapping,e.toneMapping=g.NoToneMapping,!0},this.hasRenderPass=function(){return v},this.end=function(e,n){e.toneMapping=i,m=!0;let t=o,r=l;for(let a=0;a<_.length;a++){let i=_[a];if(!1!==i.enabled&&(i.render(e,r,t,n),!1!==i.needsSwap)){let e=t;t=r,r=e}}if(f!==e.outputColorSpace||p!==e.toneMapping){f=e.outputColorSpace,p=e.toneMapping,u.defines={},g.ColorManagement.getTransfer(f)===g.SRGBTransfer&&(u.defines.SRGB_TRANSFER="");let n=Z[p];n&&(u.defines[n]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=t.texture,e.setRenderTarget(h),e.render(c,d),h=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){o.dispose(),l.dispose(),s.dispose(),u.dispose()}}let ee=new g.Texture,en=new g.DepthTexture(1,1),et=new g.DataArrayTexture,er=new g.Data3DTexture,ea=new g.CubeTexture,ei=[],eo=[],el=new Float32Array(16),es=new Float32Array(9),eu=new Float32Array(4);function ec(e,n,t){let r=e[0];if(r<=0||r>0)return e;let a=n*t,i=ei[a];if(void 0===i&&(i=new Float32Array(a),ei[a]=i),0!==n){r.toArray(i,0);for(let r=1,a=0;r!==n;++r)a+=t,e[r].toArray(i,a)}return i}function ed(e,n){if(e.length!==n.length)return!1;for(let t=0,r=e.length;t0&&(this.seq=r.concat(a))}setValue(e,n,t,r){let a=this.map[n];void 0!==a&&a.setValue(e,t,r)}setOptional(e,n,t){let r=n[t];void 0!==r&&this.setValue(e,t,r)}static upload(e,n,t,r){for(let a=0,i=n.length;a!==i;++a){let i=n[a],o=t[i.id];!1!==o.needsUpdate&&i.setValue(e,o.value,r)}}static seqWithValue(e,n){let t=[];for(let r=0,a=e.length;r!==a;++r){let a=e[r];a.id in n&&t.push(a)}return t}}function e4(e,n,t){let r=e.createShader(n);return e.shaderSource(r,t),e.compileShader(r),r}let e5=0,e6=new g.Matrix3;function e8(e,n,t){let r=e.getShaderParameter(n,e.COMPILE_STATUS),a=(e.getShaderInfoLog(n)||"").trim();if(r&&""===a)return"";let i=/ERROR: 0:(\d+)/.exec(a);if(!i)return a;{let r=parseInt(i[1]);return t.toUpperCase()+"\n\n"+a+"\n\n"+function(e,n){let t=e.split("\n"),r=[],a=Math.max(n-6,0),i=Math.min(n+6,t.length);for(let e=a;e":" "} ${a}: ${t[e]}`)}return r.join("\n")}(e.getShaderSource(n),r)}}let e9={[g.LinearToneMapping]:"Linear",[g.ReinhardToneMapping]:"Reinhard",[g.CineonToneMapping]:"Cineon",[g.ACESFilmicToneMapping]:"ACESFilmic",[g.AgXToneMapping]:"AgX",[g.NeutralToneMapping]:"Neutral",[g.CustomToneMapping]:"Custom"},e7=new g.Vector3;function ne(e){return""!==e}function nn(e,n){let t=n.numSpotLightShadows+n.numSpotLightMaps-n.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,n.numDirLights).replace(/NUM_SPOT_LIGHTS/g,n.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,n.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,n.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,n.numPointLights).replace(/NUM_HEMI_LIGHTS/g,n.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,n.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,n.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,n.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,n.numPointLightShadows)}function nt(e,n){return e.replace(/NUM_CLIPPING_PLANES/g,n.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,n.numClippingPlanes-n.numClipIntersection)}let nr=/^[ \t]*#include +<([\w\d./]+)>/gm;function na(e){return e.replace(nr,no)}let ni=new Map;function no(e,n){let t=S[n];if(void 0===t){let e=ni.get(n);if(void 0!==e)t=S[e],(0,g.warn)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',n,e);else throw Error("Can not resolve #include <"+n+">")}return na(t)}let nl=/#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 ns(e){return e.replace(nl,nu)}function nu(e,n,t,r){let a="";for(let e=parseInt(n);e0&&(o+="\n"),(l=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b].filter(ne).join("\n")).length>0&&(l+="\n");else{let e,n,r,s,u;o=[nc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+_:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&!1===t.flatShading?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+m:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(ne).join("\n"),l=[nc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+_:"",t.envMap?"#define "+v:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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 "+m:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==g.NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==g.NoToneMapping?S.tonemapping_pars_fragment:"",t.toneMapping!==g.NoToneMapping?(a="toneMapping",void 0===(e=e9[i=t.toneMapping])?((0,g.warn)("WebGLProgram: Unsupported toneMapping:",i),"vec3 "+a+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+a+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",S.colorspace_pars_fragment,(n=function(e){g.ColorManagement._getMatrix(e6,g.ColorManagement.workingColorSpace,e);let n=`mat3( ${e6.elements.map(e=>e.toFixed(4))} )`;switch(g.ColorManagement.getTransfer(e)){case g.LinearTransfer:return[n,"LinearTransferOETF"];case g.SRGBTransfer:return[n,"sRGBTransferOETF"];default:return(0,g.warn)("WebGLProgram: Unsupported color space: ",e),[n,"LinearTransferOETF"]}}(t.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { - return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) ); -}`),(g.ColorManagement.getLuminanceCoefficients(e7),r=e7.x.toFixed(4),s=e7.y.toFixed(4),u=e7.z.toFixed(4),`float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( ${r}, ${s}, ${u} ); - return dot( weights, rgb ); -}`),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"","\n"].filter(ne).join("\n")}f=nt(f=nn(f=na(f),t),t),p=nt(p=nn(p=na(p),t),t),f=ns(f),p=ns(p),!0!==t.isRawShaderMaterial&&(x="#version 300 es\n",o=[T,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+o,l=["#define varying in",t.glslVersion===g.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===g.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+l);let R=x+o+f,C=x+l+p,y=e4(c,c.VERTEX_SHADER,R),A=e4(c,c.FRAGMENT_SHADER,C);function P(n){if(e.debug.checkShaderErrors){let t=c.getProgramInfoLog(M)||"",r=c.getShaderInfoLog(y)||"",a=c.getShaderInfoLog(A)||"",i=t.trim(),s=r.trim(),u=a.trim(),d=!0,f=!0;if(!1===c.getProgramParameter(M,c.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,M,y,A);else{let e=e8(c,y,"vertex"),t=e8(c,A,"fragment");(0,g.error)("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(M,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+n.name+"\nMaterial Type: "+n.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+t)}else""!==i?(0,g.warn)("WebGLProgram: Program Info Log:",i):(""===s||""===u)&&(f=!1);f&&(n.diagnostics={runnable:d,programLog:i,vertexShader:{log:s,prefix:o},fragmentShader:{log:u,prefix:l}})}c.deleteShader(y),c.deleteShader(A),s=new e2(c,M),u=function(e,n){let t={},r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let a=0;a0,Y=i.clearcoat>0,K=i.dispersion>0,$=i.iridescence>0,Q=i.sheen>0,Z=i.transmission>0,J=q&&!!i.anisotropyMap,ee=Y&&!!i.clearcoatMap,en=Y&&!!i.clearcoatNormalMap,et=Y&&!!i.clearcoatRoughnessMap,er=$&&!!i.iridescenceMap,ea=$&&!!i.iridescenceThicknessMap,ei=Q&&!!i.sheenColorMap,eo=Q&&!!i.sheenRoughnessMap,el=!!i.specularMap,es=!!i.specularColorMap,eu=!!i.specularIntensityMap,ec=Z&&!!i.transmissionMap,ed=Z&&!!i.thicknessMap,ef=!!i.gradientMap,ep=!!i.alphaMap,em=i.alphaTest>0,eh=!!i.alphaHash,eg=!!i.extensions,e_=g.NoToneMapping;i.toneMapped&&(null===U||!0===U.isXRRenderTarget)&&(e_=e.toneMapping);let ev={shaderID:A,shaderType:i.type,shaderName:i.name,vertexShader:v,fragmentShader:S,defines:i.defines,customVertexShaderID:E,customFragmentShaderID:b,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:p,batching:I,batchingColor:I&&null!==_._colorsTexture,instancing:N,instancingColor:N&&null!==_.instanceColor,instancingMorph:N&&null!==_.morphTexture,outputColorSpace:null===U?e.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:g.LinearSRGBColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:F,matcap:O,envMap:B,envMapMode:B&&C.mapping,envMapCubeUVHeight:y,aoMap:G,lightMap:k,bumpMap:H,normalMap:V,displacementMap:z,emissiveMap:W,normalMapObjectSpace:V&&i.normalMapType===g.ObjectSpaceNormalMap,normalMapTangentSpace:V&&i.normalMapType===g.TangentSpaceNormalMap,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:J,clearcoat:Y,clearcoatMap:ee,clearcoatNormalMap:en,clearcoatRoughnessMap:et,dispersion:K,iridescence:$,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:Q,sheenColorMap:ei,sheenRoughnessMap:eo,specularMap:el,specularColorMap:es,specularIntensityMap:eu,transmission:Z,transmissionMap:ec,thicknessMap:ed,gradientMap:ef,opaque:!1===i.transparent&&i.blending===g.NormalBlending&&!1===i.alphaToCoverage,alphaMap:ep,alphaTest:em,alphaHash:eh,combine:i.combine,mapUv:F&&h(i.map.channel),aoMapUv:G&&h(i.aoMap.channel),lightMapUv:k&&h(i.lightMap.channel),bumpMapUv:H&&h(i.bumpMap.channel),normalMapUv:V&&h(i.normalMap.channel),displacementMapUv:z&&h(i.displacementMap.channel),emissiveMapUv:W&&h(i.emissiveMap.channel),metalnessMapUv:X&&h(i.metalnessMap.channel),roughnessMapUv:j&&h(i.roughnessMap.channel),anisotropyMapUv:J&&h(i.anisotropyMap.channel),clearcoatMapUv:ee&&h(i.clearcoatMap.channel),clearcoatNormalMapUv:en&&h(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&h(i.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&h(i.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&h(i.iridescenceThicknessMap.channel),sheenColorMapUv:ei&&h(i.sheenColorMap.channel),sheenRoughnessMapUv:eo&&h(i.sheenRoughnessMap.channel),specularMapUv:el&&h(i.specularMap.channel),specularColorMapUv:es&&h(i.specularColorMap.channel),specularIntensityMapUv:eu&&h(i.specularIntensityMap.channel),transmissionMapUv:ec&&h(i.transmissionMap.channel),thicknessMapUv:ed&&h(i.thicknessMap.channel),alphaMapUv:ep&&h(i.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||q),vertexColors:i.vertexColors,vertexAlphas:!0===i.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===_.isPoints&&!!x.attributes.uv&&(F||ep),fog:!!M,useFog:!0===i.fog,fogExp2:!!M&&M.isFogExp2,flatShading:!0===i.flatShading&&!1===i.wireframe,sizeAttenuation:!0===i.sizeAttenuation,logarithmicDepthBuffer:f,reversedDepthBuffer:D,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:w,morphTextureStride:L,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,numLightProbes:l.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:e_,decodeVideoTexture:F&&!0===i.map.isVideoTexture&&g.ColorManagement.getTransfer(i.map.colorSpace)===g.SRGBTransfer,decodeVideoTextureEmissive:W&&!0===i.emissiveMap.isVideoTexture&&g.ColorManagement.getTransfer(i.emissiveMap.colorSpace)===g.SRGBTransfer,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===g.DoubleSide,flipSided:i.side===g.BackSide,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:eg&&!0===i.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eg&&!0===i.extensions.multiDraw||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:i.customProgramCacheKey()};return ev.vertexUv1s=u.has(1),ev.vertexUv2s=u.has(2),ev.vertexUv3s=u.has(3),u.clear(),ev},getProgramCacheKey:function(n){var t,r,a,i;let o=[];if(n.shaderID?o.push(n.shaderID):(o.push(n.customVertexShaderID),o.push(n.customFragmentShaderID)),void 0!==n.defines)for(let e in n.defines)o.push(e),o.push(n.defines[e]);return!1===n.isRawShaderMaterial&&(t=o,r=n,t.push(r.precision),t.push(r.outputColorSpace),t.push(r.envMapMode),t.push(r.envMapCubeUVHeight),t.push(r.mapUv),t.push(r.alphaMapUv),t.push(r.lightMapUv),t.push(r.aoMapUv),t.push(r.bumpMapUv),t.push(r.normalMapUv),t.push(r.displacementMapUv),t.push(r.emissiveMapUv),t.push(r.metalnessMapUv),t.push(r.roughnessMapUv),t.push(r.anisotropyMapUv),t.push(r.clearcoatMapUv),t.push(r.clearcoatNormalMapUv),t.push(r.clearcoatRoughnessMapUv),t.push(r.iridescenceMapUv),t.push(r.iridescenceThicknessMapUv),t.push(r.sheenColorMapUv),t.push(r.sheenRoughnessMapUv),t.push(r.specularMapUv),t.push(r.specularColorMapUv),t.push(r.specularIntensityMapUv),t.push(r.transmissionMapUv),t.push(r.thicknessMapUv),t.push(r.combine),t.push(r.fogExp2),t.push(r.sizeAttenuation),t.push(r.morphTargetsCount),t.push(r.morphAttributeCount),t.push(r.numDirLights),t.push(r.numPointLights),t.push(r.numSpotLights),t.push(r.numSpotLightMaps),t.push(r.numHemiLights),t.push(r.numRectAreaLights),t.push(r.numDirLightShadows),t.push(r.numPointLightShadows),t.push(r.numSpotLightShadows),t.push(r.numSpotLightShadowsWithMaps),t.push(r.numLightProbes),t.push(r.shadowMapType),t.push(r.toneMapping),t.push(r.numClippingPlanes),t.push(r.numClipIntersection),t.push(r.depthPacking),a=o,i=n,l.disableAll(),i.instancing&&l.enable(0),i.instancingColor&&l.enable(1),i.instancingMorph&&l.enable(2),i.matcap&&l.enable(3),i.envMap&&l.enable(4),i.normalMapObjectSpace&&l.enable(5),i.normalMapTangentSpace&&l.enable(6),i.clearcoat&&l.enable(7),i.iridescence&&l.enable(8),i.alphaTest&&l.enable(9),i.vertexColors&&l.enable(10),i.vertexAlphas&&l.enable(11),i.vertexUv1s&&l.enable(12),i.vertexUv2s&&l.enable(13),i.vertexUv3s&&l.enable(14),i.vertexTangents&&l.enable(15),i.anisotropy&&l.enable(16),i.alphaHash&&l.enable(17),i.batching&&l.enable(18),i.dispersion&&l.enable(19),i.batchingColor&&l.enable(20),i.gradientMap&&l.enable(21),a.push(l.mask),l.disableAll(),i.fog&&l.enable(0),i.useFog&&l.enable(1),i.flatShading&&l.enable(2),i.logarithmicDepthBuffer&&l.enable(3),i.reversedDepthBuffer&&l.enable(4),i.skinning&&l.enable(5),i.morphTargets&&l.enable(6),i.morphNormals&&l.enable(7),i.morphColors&&l.enable(8),i.premultipliedAlpha&&l.enable(9),i.shadowMapEnabled&&l.enable(10),i.doubleSided&&l.enable(11),i.flipSided&&l.enable(12),i.useDepthPacking&&l.enable(13),i.dithering&&l.enable(14),i.transmission&&l.enable(15),i.sheen&&l.enable(16),i.opaque&&l.enable(17),i.pointsUvs&&l.enable(18),i.decodeVideoTexture&&l.enable(19),i.decodeVideoTextureEmissive&&l.enable(20),i.alphaToCoverage&&l.enable(21),a.push(l.mask),o.push(e.outputColorSpace)),o.push(n.customProgramCacheKey),o.join()},getUniforms:function(e){let n,t=m[e.type];if(t){let e=T[t];n=g.UniformsUtils.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(n,t){let r=d.get(t);return void 0!==r?++r.usedTimes:(r=new nh(e,t,n,i),c.push(r),d.set(t,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let n=c.indexOf(e);c[n]=c[c.length-1],c.pop(),d.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){s.remove(e)},programs:c,dispose:function(){s.dispose()}}}function nE(){let e=new WeakMap;return{has:function(n){return e.has(n)},get:function(n){let t=e.get(n);return void 0===t&&(t={},e.set(n,t)),t},remove:function(n){e.delete(n)},update:function(n,t,r){e.get(n)[t]=r},dispose:function(){e=new WeakMap}}}function nT(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.material.id!==n.material.id?e.material.id-n.material.id:e.z!==n.z?e.z-n.z:e.id-n.id}function nb(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.z!==n.z?n.z-e.z:e.id-n.id}function nM(){let e=[],n=0,t=[],r=[],a=[];function i(t,r,a,i,o,l){let s=e[n];return void 0===s?(s={id:t.id,object:t,geometry:r,material:a,groupOrder:i,renderOrder:t.renderOrder,z:o,group:l},e[n]=s):(s.id=t.id,s.object=t,s.geometry=r,s.material=a,s.groupOrder=i,s.renderOrder=t.renderOrder,s.z=o,s.group=l),n++,s}return{opaque:t,transmissive:r,transparent:a,init:function(){n=0,t.length=0,r.length=0,a.length=0},push:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.push(c):!0===o.transparent?a.push(c):t.push(c)},unshift:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.unshift(c):!0===o.transparent?a.unshift(c):t.unshift(c)},finish:function(){for(let t=n,r=e.length;t1&&t.sort(e||nT),r.length>1&&r.sort(n||nb),a.length>1&&a.sort(n||nb)}}}function nx(){let e=new WeakMap;return{get:function(n,t){let r,a=e.get(n);return void 0===a?(r=new nM,e.set(n,[r])):t>=a.length?(r=new nM,a.push(r)):r=a[t],r},dispose:function(){e=new WeakMap}}}function nR(){let e={};return{get:function(n){let t;if(void 0!==e[n.id])return e[n.id];switch(n.type){case"DirectionalLight":t={direction:new g.Vector3,color:new g.Color};break;case"SpotLight":t={position:new g.Vector3,direction:new g.Vector3,color:new g.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new g.Vector3,color:new g.Color,distance:0,decay:0};break;case"HemisphereLight":t={direction:new g.Vector3,skyColor:new g.Color,groundColor:new g.Color};break;case"RectAreaLight":t={color:new g.Color,position:new g.Vector3,halfWidth:new g.Vector3,halfHeight:new g.Vector3}}return e[n.id]=t,t}}}let nC=0;function ny(e,n){return 2*!!n.castShadow-2*!!e.castShadow+ +!!n.map-!!e.map}function nA(e){let n,t=new nR,r=(n={},{get:function(e){let t;if(void 0!==n[e.id])return n[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g.Vector2};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g.Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)a.probe.push(new g.Vector3);let i=new g.Vector3,o=new g.Matrix4,l=new g.Matrix4;return{setup:function(n){let i=0,o=0,l=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let s=0,u=0,c=0,d=0,f=0,p=0,m=0,h=0,_=0,v=0,S=0;n.sort(ny);for(let e=0,E=n.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=E.LTC_FLOAT_1,a.rectAreaLTC2=E.LTC_FLOAT_2):(a.rectAreaLTC1=E.LTC_HALF_1,a.rectAreaLTC2=E.LTC_HALF_2)),a.ambient[0]=i,a.ambient[1]=o,a.ambient[2]=l;let T=a.hash;(T.directionalLength!==s||T.pointLength!==u||T.spotLength!==c||T.rectAreaLength!==d||T.hemiLength!==f||T.numDirectionalShadows!==p||T.numPointShadows!==m||T.numSpotShadows!==h||T.numSpotMaps!==_||T.numLightProbes!==S)&&(a.directional.length=s,a.spot.length=c,a.rectArea.length=d,a.point.length=u,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+_-v,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=v,a.numLightProbes=S,T.directionalLength=s,T.pointLength=u,T.spotLength=c,T.rectAreaLength=d,T.hemiLength=f,T.numDirectionalShadows=p,T.numPointShadows=m,T.numSpotShadows=h,T.numSpotMaps=_,T.numLightProbes=S,a.version=nC++)},setupView:function(e,n){let t=0,r=0,s=0,u=0,c=0,d=n.matrixWorldInverse;for(let n=0,f=e.length;n=i.length?(a=new nP(e),i.push(a)):a=i[r],a},dispose:function(){n=new WeakMap}}}let nL=[new g.Vector3(1,0,0),new g.Vector3(-1,0,0),new g.Vector3(0,1,0),new g.Vector3(0,-1,0),new g.Vector3(0,0,1),new g.Vector3(0,0,-1)],nU=[new g.Vector3(0,-1,0),new g.Vector3(0,-1,0),new g.Vector3(0,0,1),new g.Vector3(0,0,-1),new g.Vector3(0,-1,0),new g.Vector3(0,-1,0)],nD=new g.Matrix4,nN=new g.Vector3,nI=new g.Vector3;function nF(e,n,t){let r=new g.Frustum,a=new g.Vector2,i=new g.Vector2,o=new g.Vector4,l=new g.MeshDepthMaterial,s=new g.MeshDistanceMaterial,u={},c=t.maxTextureSize,d={[g.FrontSide]:g.BackSide,[g.BackSide]:g.FrontSide,[g.DoubleSide]:g.DoubleSide},f=new g.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new g.Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new g.BufferGeometry;m.setAttribute("position",new g.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new g.Mesh(m,f),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=g.PCFShadowMap;let v=this.type;function S(n,t,r,a){let i=null,o=!0===r.isPointLight?n.customDistanceMaterial:n.customDepthMaterial;if(void 0!==o)i=o;else if(i=!0===r.isPointLight?s:l,e.localClippingEnabled&&!0===t.clipShadows&&Array.isArray(t.clippingPlanes)&&0!==t.clippingPlanes.length||t.displacementMap&&0!==t.displacementScale||t.alphaMap&&t.alphaTest>0||t.map&&t.alphaTest>0||!0===t.alphaToCoverage){let e=i.uuid,n=t.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let a=r[n];void 0===a&&(a=i.clone(),r[n]=a,t.addEventListener("dispose",E)),i=a}return i.visible=t.visible,i.wireframe=t.wireframe,a===g.VSMShadowMap?i.side=null!==t.shadowSide?t.shadowSide:t.side:i.side=null!==t.shadowSide?t.shadowSide:d[t.side],i.alphaMap=t.alphaMap,i.alphaTest=!0===t.alphaToCoverage?.5:t.alphaTest,i.map=t.map,i.clipShadows=t.clipShadows,i.clippingPlanes=t.clippingPlanes,i.clipIntersection=t.clipIntersection,i.displacementMap=t.displacementMap,i.displacementScale=t.displacementScale,i.displacementBias=t.displacementBias,i.wireframeLinewidth=t.wireframeLinewidth,i.linewidth=t.linewidth,!0===r.isPointLight&&!0===i.isMeshDistanceMaterial&&(e.properties.get(i).light=r),i}function E(e){for(let n in e.target.removeEventListener("dispose",E),u){let t=u[n],r=e.target.uuid;r in t&&(t[r].dispose(),delete t[r])}}this.render=function(t,l,s){if(!1===_.enabled||!1===_.autoUpdate&&!1===_.needsUpdate||0===t.length)return;t.type===g.PCFSoftShadowMap&&((0,g.warn)("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),t.type=g.PCFShadowMap);let u=e.getRenderTarget(),d=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),E=e.state;E.setBlending(g.NoBlending),!0===E.buffers.depth.getReversed()?E.buffers.color.setClear(0,0,0,0):E.buffers.color.setClear(1,1,1,1),E.buffers.depth.setTest(!0),E.setScissorTest(!1);let T=v!==this.type;T&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,d=t.length;uc||a.y>c)&&(a.x>c&&(i.x=Math.floor(c/_.x),a.x=i.x*_.x,m.mapSize.x=i.x),a.y>c&&(i.y=Math.floor(c/_.y),a.y=i.y*_.y,m.mapSize.y=i.y)),null===m.map||!0===T){if(null!==m.map&&(null!==m.map.depthTexture&&(m.map.depthTexture.dispose(),m.map.depthTexture=null),m.map.dispose()),this.type===g.VSMShadowMap){if(d.isPointLight){(0,g.warn)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new g.WebGLRenderTarget(a.x,a.y,{format:g.RGFormat,type:g.HalfFloatType,minFilter:g.LinearFilter,magFilter:g.LinearFilter,generateMipmaps:!1}),m.map.texture.name=d.name+".shadowMap",m.map.depthTexture=new g.DepthTexture(a.x,a.y,g.FloatType),m.map.depthTexture.name=d.name+".shadowMapDepth",m.map.depthTexture.format=g.DepthFormat,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=g.NearestFilter,m.map.depthTexture.magFilter=g.NearestFilter}else{d.isPointLight?(m.map=new g.WebGLCubeRenderTarget(a.x),m.map.depthTexture=new g.CubeDepthTexture(a.x,g.UnsignedIntType)):(m.map=new g.WebGLRenderTarget(a.x,a.y),m.map.depthTexture=new g.DepthTexture(a.x,a.y,g.UnsignedIntType)),m.map.depthTexture.name=d.name+".shadowMap",m.map.depthTexture.format=g.DepthFormat;let n=e.state.buffers.depth.getReversed();this.type===g.PCFShadowMap?(m.map.depthTexture.compareFunction=n?g.GreaterEqualCompare:g.LessEqualCompare,m.map.depthTexture.minFilter=g.LinearFilter,m.map.depthTexture.magFilter=g.LinearFilter):(m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=g.NearestFilter,m.map.depthTexture.magFilter=g.NearestFilter)}m.camera.updateProjectionMatrix()}let v=m.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t=1:-1!==L.indexOf("OpenGL ES")&&(w=parseFloat(/^OpenGL ES (\d)/.exec(L)[1])>=2);let U=null,D={},N=e.getParameter(e.SCISSOR_BOX),I=e.getParameter(e.VIEWPORT),F=new g.Vector4().fromArray(N),O=new g.Vector4().fromArray(I);function B(n,t,r,a){let i=new Uint8Array(4),o=e.createTexture();e.bindTexture(n,o),e.texParameteri(n,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(n,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;ot||a.height>t)&&(r=t/Math.max(a.width,a.height)),r<1)if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let t=Math.floor(r*a.width),i=Math.floor(r*a.height);void 0===l&&(l=m(t,i));let o=n?m(t,i):l;return o.width=t,o.height=i,o.getContext("2d").drawImage(e,0,0,t,i),(0,g.warn)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+t+"x"+i+")."),o}else"data"in e&&(0,g.warn)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function _(e){return e.generateMipmaps}function v(n){e.generateMipmap(n)}function S(t,r,a,i,o=!1){if(null!==t){if(void 0!==e[t])return e[t];(0,g.warn)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let l=r;if(r===e.RED&&(a===e.FLOAT&&(l=e.R32F),a===e.HALF_FLOAT&&(l=e.R16F),a===e.UNSIGNED_BYTE&&(l=e.R8)),r===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.R8UI),a===e.UNSIGNED_SHORT&&(l=e.R16UI),a===e.UNSIGNED_INT&&(l=e.R32UI),a===e.BYTE&&(l=e.R8I),a===e.SHORT&&(l=e.R16I),a===e.INT&&(l=e.R32I)),r===e.RG&&(a===e.FLOAT&&(l=e.RG32F),a===e.HALF_FLOAT&&(l=e.RG16F),a===e.UNSIGNED_BYTE&&(l=e.RG8)),r===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RG8UI),a===e.UNSIGNED_SHORT&&(l=e.RG16UI),a===e.UNSIGNED_INT&&(l=e.RG32UI),a===e.BYTE&&(l=e.RG8I),a===e.SHORT&&(l=e.RG16I),a===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGB8UI),a===e.UNSIGNED_SHORT&&(l=e.RGB16UI),a===e.UNSIGNED_INT&&(l=e.RGB32UI),a===e.BYTE&&(l=e.RGB8I),a===e.SHORT&&(l=e.RGB16I),a===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),a===e.UNSIGNED_INT&&(l=e.RGBA32UI),a===e.BYTE&&(l=e.RGBA8I),a===e.SHORT&&(l=e.RGBA16I),a===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(a===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let n=o?g.LinearTransfer:g.ColorManagement.getTransfer(i);a===e.FLOAT&&(l=e.RGBA32F),a===e.HALF_FLOAT&&(l=e.RGBA16F),a===e.UNSIGNED_BYTE&&(l=n===g.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&n.get("EXT_color_buffer_float"),l}function E(n,t){let r;return n?null===t||t===g.UnsignedIntType||t===g.UnsignedInt248Type?r=e.DEPTH24_STENCIL8:t===g.FloatType?r=e.DEPTH32F_STENCIL8:t===g.UnsignedShortType&&(r=e.DEPTH24_STENCIL8,(0,g.warn)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===t||t===g.UnsignedIntType||t===g.UnsignedInt248Type?r=e.DEPTH_COMPONENT24:t===g.FloatType?r=e.DEPTH_COMPONENT32F:t===g.UnsignedShortType&&(r=e.DEPTH_COMPONENT16),r}function T(e,n){return!0===_(e)||e.isFramebufferTexture&&e.minFilter!==g.NearestFilter&&e.minFilter!==g.LinearFilter?Math.log2(Math.max(n.width,n.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?n.mipmaps.length:1}function b(e){let n=e.target;n.removeEventListener("dispose",b),function(e){let n=r.get(e);if(void 0===n.__webglInit)return;let t=e.source,a=f.get(t);if(a){let r=a[n.__cacheKey];r.usedTimes--,0===r.usedTimes&&x(e),0===Object.keys(a).length&&f.delete(t)}r.remove(e)}(n),n.isVideoTexture&&d.delete(n)}function M(n){let t=n.target;t.removeEventListener("dispose",M),function(n){let t=r.get(n);if(n.depthTexture&&(n.depthTexture.dispose(),r.remove(n.depthTexture)),n.isWebGLCubeRenderTarget)for(let n=0;n<6;n++){if(Array.isArray(t.__webglFramebuffer[n]))for(let r=0;r0&&s.__version!==n.version){let e=n.image;if(null===e)(0,g.warn)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void D(s,n,a);(0,g.warn)("WebGLRenderer: Texture marked for update but image is incomplete")}}else n.isExternalTexture&&(s.__webglTexture=n.sourceTexture?n.sourceTexture:null);t.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+a)}let y={[g.RepeatWrapping]:e.REPEAT,[g.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[g.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},A={[g.NearestFilter]:e.NEAREST,[g.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[g.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[g.LinearFilter]:e.LINEAR,[g.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[g.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},P={[g.NeverCompare]:e.NEVER,[g.AlwaysCompare]:e.ALWAYS,[g.LessCompare]:e.LESS,[g.LessEqualCompare]:e.LEQUAL,[g.EqualCompare]:e.EQUAL,[g.GreaterEqualCompare]:e.GEQUAL,[g.GreaterCompare]:e.GREATER,[g.NotEqualCompare]:e.NOTEQUAL};function w(t,i){if((i.type===g.FloatType&&!1===n.has("OES_texture_float_linear")&&(i.magFilter===g.LinearFilter||i.magFilter===g.LinearMipmapNearestFilter||i.magFilter===g.NearestMipmapLinearFilter||i.magFilter===g.LinearMipmapLinearFilter||i.minFilter===g.LinearFilter||i.minFilter===g.LinearMipmapNearestFilter||i.minFilter===g.NearestMipmapLinearFilter||i.minFilter===g.LinearMipmapLinearFilter)&&(0,g.warn)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,y[i.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,y[i.wrapT]),(t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY)&&e.texParameteri(t,e.TEXTURE_WRAP_R,y[i.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,A[i.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,A[i.minFilter]),i.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,P[i.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic"))&&i.magFilter!==g.NearestFilter&&(i.minFilter===g.NearestMipmapLinearFilter||i.minFilter===g.LinearMipmapLinearFilter)&&(i.type!==g.FloatType||!1!==n.has("OES_texture_float_linear"))&&(i.anisotropy>1||r.get(i).__currentAnisotropy)){let o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}function L(n,t){let r,a=!1;void 0===n.__webglInit&&(n.__webglInit=!0,t.addEventListener("dispose",b));let i=t.source,l=f.get(i);void 0===l&&(l={},f.set(i,l));let s=((r=[]).push(t.wrapS),r.push(t.wrapT),r.push(t.wrapR||0),r.push(t.magFilter),r.push(t.minFilter),r.push(t.anisotropy),r.push(t.internalFormat),r.push(t.format),r.push(t.type),r.push(t.generateMipmaps),r.push(t.premultiplyAlpha),r.push(t.flipY),r.push(t.unpackAlignment),r.push(t.colorSpace),r.join());if(s!==n.__cacheKey){void 0===l[s]&&(l[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,a=!0),l[s].usedTimes++;let r=l[n.__cacheKey];void 0!==r&&(l[n.__cacheKey].usedTimes--,0===r.usedTimes&&x(t)),n.__cacheKey=s,n.__webglTexture=l[s].texture}return a}function U(e,n,t){return Math.floor(Math.floor(e/t)/n)}function D(n,o,l){let s=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(s=e.TEXTURE_3D);let u=L(n,o),c=o.source;t.bindTexture(s,n.__webglTexture,e.TEXTURE0+l);let d=r.get(c);if(c.version!==d.__version||!0===u){let n;t.activeTexture(e.TEXTURE0+l);let r=g.ColorManagement.getPrimaries(g.ColorManagement.workingColorSpace),f=o.colorSpace===g.NoColorSpace?null:g.ColorManagement.getPrimaries(o.colorSpace),p=o.colorSpace===g.NoColorSpace||r===f?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let m=h(o.image,!1,a.maxTextureSize);m=V(o,m);let b=i.convert(o.format,o.colorSpace),M=i.convert(o.type),x=S(o.internalFormat,b,M,o.colorSpace,o.isVideoTexture);w(s,o);let R=o.mipmaps,C=!0!==o.isVideoTexture,y=void 0===d.__version||!0===u,A=c.dataReady,P=T(o,m);if(o.isDepthTexture)x=E(o.format===g.DepthStencilFormat,o.type),y&&(C?t.texStorage2D(e.TEXTURE_2D,1,x,m.width,m.height):t.texImage2D(e.TEXTURE_2D,0,x,m.width,m.height,0,b,M,null));else if(o.isDataTexture)if(R.length>0){C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;re.start-n.start);let l=0;for(let e=1;e0){let a=(0,g.getByteLength)(n.width,n.height,o.format,o.type);for(let i of o.layerUpdates){let o=n.data.subarray(i*a/n.data.BYTES_PER_ELEMENT,(i+1)*a/n.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,i,n.width,n.height,1,b,o)}o.clearLayerUpdates()}else t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,b,n.data)}else t.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,n.data,0,0);else(0,g.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?A&&t.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,b,M,n.data):t.texImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,b,M,n.data)}else{C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;r0){let n=(0,g.getByteLength)(m.width,m.height,o.format,o.type);for(let r of o.layerUpdates){let a=m.data.subarray(r*n/m.data.BYTES_PER_ELEMENT,(r+1)*n/m.data.BYTES_PER_ELEMENT);t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,m.width,m.height,1,b,M,a)}o.clearLayerUpdates()}else t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,b,M,m.data)}else t.texImage3D(e.TEXTURE_2D_ARRAY,0,x,m.width,m.height,m.depth,0,b,M,m.data);else if(o.isData3DTexture)C?(y&&t.texStorage3D(e.TEXTURE_3D,P,x,m.width,m.height,m.depth),A&&t.texSubImage3D(e.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,b,M,m.data)):t.texImage3D(e.TEXTURE_3D,0,x,m.width,m.height,m.depth,0,b,M,m.data);else if(o.isFramebufferTexture){if(y)if(C)t.texStorage2D(e.TEXTURE_2D,P,x,m.width,m.height);else{let n=m.width,r=m.height;for(let a=0;a>=1,r>>=1}}else if(R.length>0){if(C&&y){let n=z(R[0]);t.texStorage2D(e.TEXTURE_2D,P,x,n.width,n.height)}for(let r=0,a=R.length;r>c),r=Math.max(1,a.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?t.texImage3D(u,c,p,n,r,a.depth,0,d,f,null):t.texImage2D(u,c,p,n,r,0,d,f,null)}t.bindFramebuffer(e.FRAMEBUFFER,n),H(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,h.__webglTexture,0,k(a)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,h.__webglTexture,c),t.bindFramebuffer(e.FRAMEBUFFER,null)}function I(n,t,r){if(e.bindRenderbuffer(e.RENDERBUFFER,n),t.depthBuffer){let a=t.depthTexture,i=a&&a.isDepthTexture?a.type:null,o=E(t.stencilBuffer,i),l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;H(t)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,k(t),o,t.width,t.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,k(t),o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,n)}else{let n=t.textures;for(let a=0;a{delete a.__boundDepthTexture,delete a.__depthDisposeCallback,e.removeEventListener("dispose",n)};e.addEventListener("dispose",n),a.__depthDisposeCallback=n}a.__boundDepthTexture=e}if(n.depthTexture&&!a.__autoAllocateDepthBuffer)if(i)for(let e=0;e<6;e++)F(a.__webglFramebuffer[e],n,e);else{let e=n.texture.mipmaps;e&&e.length>0?F(a.__webglFramebuffer[0],n,0):F(a.__webglFramebuffer,n,0)}else if(i){a.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[r]),void 0===a.__webglDepthbuffer[r])a.__webglDepthbuffer[r]=e.createRenderbuffer(),I(a.__webglDepthbuffer[r],n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=a.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,i)}}else{let r=n.texture.mipmaps;if(r&&r.length>0?t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[0]):t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),void 0===a.__webglDepthbuffer)a.__webglDepthbuffer=e.createRenderbuffer(),I(a.__webglDepthbuffer,n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=a.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,r)}}t.bindFramebuffer(e.FRAMEBUFFER,null)}let B=[],G=[];function k(e){return Math.min(a.maxSamples,e.samples)}function H(e){let t=r.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function V(e,n){let t=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||t!==g.LinearSRGBColorSpace&&t!==g.NoColorSpace&&(g.ColorManagement.getTransfer(t)===g.SRGBTransfer?(r!==g.RGBAFormat||a!==g.UnsignedByteType)&&(0,g.warn)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,g.error)("WebGLTextures: Unsupported texture color space:",t)),n}function z(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=R;return e>=a.maxTextures&&(0,g.warn)("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),R+=1,e},this.resetTextureUnits=function(){R=0},this.setTexture2D=C,this.setTexture2DArray=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?D(i,n,a):(n.isExternalTexture&&(i.__webglTexture=n.sourceTexture?n.sourceTexture:null),t.bindTexture(e.TEXTURE_2D_ARRAY,i.__webglTexture,e.TEXTURE0+a))},this.setTexture3D=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?D(i,n,a):t.bindTexture(e.TEXTURE_3D,i.__webglTexture,e.TEXTURE0+a)},this.setTextureCube=function(n,o){let l=r.get(n);!0!==n.isCubeDepthTexture&&n.version>0&&l.__version!==n.version?function(n,o,l){if(6!==o.image.length)return;let s=L(n,o),u=o.source;t.bindTexture(e.TEXTURE_CUBE_MAP,n.__webglTexture,e.TEXTURE0+l);let c=r.get(u);if(u.version!==c.__version||!0===s){let n;t.activeTexture(e.TEXTURE0+l);let r=g.ColorManagement.getPrimaries(g.ColorManagement.workingColorSpace),d=o.colorSpace===g.NoColorSpace?null:g.ColorManagement.getPrimaries(o.colorSpace),f=o.colorSpace===g.NoColorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=o.isCompressedTexture||o.image[0].isCompressedTexture,m=o.image[0]&&o.image[0].isDataTexture,E=[];for(let e=0;e<6;e++)p||m?E[e]=m?o.image[e].image:o.image[e]:E[e]=h(o.image[e],!0,a.maxCubemapSize),E[e]=V(o,E[e]);let b=E[0],M=i.convert(o.format,o.colorSpace),x=i.convert(o.type),R=S(o.internalFormat,M,x,o.colorSpace),C=!0!==o.isVideoTexture,y=void 0===c.__version||!0===s,A=u.dataReady,P=T(o,b);if(w(e.TEXTURE_CUBE_MAP,o),p){C&&y&&t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,b.width,b.height);for(let r=0;r<6;r++){n=E[r].mipmaps;for(let a=0;a0&&P++;let r=z(E[0]);t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,r.width,r.height)}for(let r=0;r<6;r++)if(m){C?A&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,E[r].width,E[r].height,M,x,E[r].data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,R,E[r].width,E[r].height,0,M,x,E[r].data);for(let a=0;a1;if(!d&&(void 0===s.__webglTexture&&(s.__webglTexture=e.createTexture()),s.__version=a.version,o.memory.textures++),c){l.__webglFramebuffer=[];for(let n=0;n<6;n++)if(a.mipmaps&&a.mipmaps.length>0){l.__webglFramebuffer[n]=[];for(let t=0;t0){l.__webglFramebuffer=[];for(let n=0;n0&&!1===H(n)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],t.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let t=0;t0)for(let r=0;r0)for(let t=0;t0){if(!1===H(n)){let a=n.textures,i=n.width,o=n.height,l=e.COLOR_BUFFER_BIT,s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(n),d=a.length>1;if(d)for(let n=0;n0?t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let t=0;t= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`;class nz{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let t=new g.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=t}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,t=new g.ShaderMaterial({vertexShader:nH,fragmentShader:nV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new g.Mesh(new g.PlaneGeometry(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nW extends g.EventDispatcher{constructor(e,n){super();const t=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="undefined"!=typeof XRWebGLBinding,h=new nz,v={},S=n.getContextAttributes();let E=null,T=null;const b=[],M=[],x=new g.Vector2;let R=null;const C=new g.PerspectiveCamera;C.viewport=new g.Vector4;const y=new g.PerspectiveCamera;y.viewport=new g.Vector4;const A=[C,y],P=new g.ArrayCamera;let w=null,L=null;function U(e){let n=M.indexOf(e.inputSource);if(-1===n)return;let t=b[n];void 0!==t&&(t.update(e.inputSource,e.frame,s||i),t.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",N);for(let e=0;e=0&&(M[r]=null,b[r].disconnect(t))}for(let n=0;n=M.length){M.push(t),r=e;break}else if(null===M[e]){M[e]=t,r=e;break}if(-1===r)break}let a=b[r];a&&a.connect(t)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getGripSpace()},this.getHand=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,n)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(E=e.getRenderTarget(),r.addEventListener("select",U),r.addEventListener("selectstart",U),r.addEventListener("selectend",U),r.addEventListener("squeeze",U),r.addEventListener("squeezestart",U),r.addEventListener("squeezeend",U),r.addEventListener("end",D),r.addEventListener("inputsourceschange",N),!0!==S.xrCompatible&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(x),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,o=null;S.depth&&(o=S.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=S.stencil?g.DepthStencilFormat:g.DepthFormat,i=S.stencil?g.UnsignedInt248Type:g.UnsignedIntType);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new g.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,depthTexture:new g.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:4*!!S.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let t={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,n,t),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),T=new g.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new g.Vector3,F=new g.Vector3;function O(e,n){null===n?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(n.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,t,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),P.near=y.near=C.near=i,P.far=y.far=C.far=o,(w!==P.near||L!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),w=P.near,L=P.far),P.layers.mask=6|e.layers.mask,C.layers.mask=3&P.layers.mask,y.layers.mask=5&P.layers.mask;let l=e.parent,s=P.cameras;O(P,l);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let a=n.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,nX.copy(o),nX.x*=-1,nX.y*=-1,nX.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(nX.y*=-1,nX.z*=-1),e.envMapRotation.value.setFromMatrix4(nj.makeRotationFromEuler(nX)),e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,t(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,t(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,t){t.color.getRGB(n.fogColor.value,(0,g.getUnlitUniformColorSpace)(e)),t.isFog?(n.fogNear.value=t.near,n.fogFar.value=t.far):t.isFogExp2&&(n.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,_,v,S,E,T,b,M,x,R,C,y,A,P,w,L;let U;a.isMeshBasicMaterial||a.isMeshLambertMaterial?r(e,a):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,_=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===g.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),v=e,(S=a).matcap&&(v.matcap.value=S.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),E=e,T=a,U=n.get(T).light,E.referencePosition.value.setFromMatrixPosition(U.matrixWorld),E.nearDistance.value=U.shadow.camera.near,E.farDistance.value=U.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(b=e,M=a,b.diffuse.value.copy(M.color),b.opacity.value=M.opacity,M.map&&(b.map.value=M.map,t(M.map,b.mapTransform)),a.isLineDashedMaterial&&(x=e,R=a,x.dashSize.value=R.dashSize,x.totalSize.value=R.dashSize+R.gapSize,x.scale.value=R.scale)):a.isPointsMaterial?(C=e,y=a,A=i,P=o,C.diffuse.value.copy(y.color),C.opacity.value=y.opacity,C.size.value=y.size*A,C.scale.value=.5*P,y.map&&(C.map.value=y.map,t(y.map,C.uvTransform)),y.alphaMap&&(C.alphaMap.value=y.alphaMap,t(y.alphaMap,C.alphaMapTransform)),y.alphaTest>0&&(C.alphaTest.value=y.alphaTest)):a.isSpriteMaterial?(w=e,L=a,w.diffuse.value.copy(L.color),w.opacity.value=L.opacity,w.rotation.value=L.rotation,L.map&&(w.map.value=L.map,t(L.map,w.mapTransform)),L.alphaMap&&(w.alphaMap.value=L.alphaMap,t(L.alphaMap,w.alphaMapTransform)),L.alphaTest>0&&(w.alphaTest.value=L.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function nY(e,n,t,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,g.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,g.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function u(n){let t=n.target;t.removeEventListener("dispose",u);let r=o.indexOf(t.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[t.id]),delete a[t.id],delete i[t.id]}return{bind:function(e,n){let t=n.program;r.uniformBlockBinding(e,t)},update:function(t,c){var d;let f,p,m,h,_=a[t.id];void 0===_&&(function(e){let n=e.uniforms,t=0;for(let e=0,r=n.length;e0&&(t+=16-r),e.__size=t,e.__cache={}}(t),(d=t).__bindingPointIndex=f=function(){for(let e=0;ep.matrixWorld.determinant(),S=function(e,n,t,i,c){var d,f;!0!==n.isScene&&(n=eF),l.resetTextureUnits();let p=n.fog,h=i.isMeshStandardMaterial?n.environment:null,_=null===em?ec.outputColorSpace:!0===em.isXRRenderTarget?em.texture.colorSpace:g.LinearSRGBColorSpace,v=(i.isMeshStandardMaterial?u:s).get(i.envMap||h),S=!0===i.vertexColors&&!!t.attributes.color&&4===t.attributes.color.itemSize,T=!!t.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),b=!!t.morphAttributes.position,x=!!t.morphAttributes.normal,R=!!t.morphAttributes.color,C=g.NoToneMapping;i.toneMapped&&(null===em||!0===em.isXRRenderTarget)&&(C=ec.toneMapping);let y=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,A=void 0!==y?y.length:0,P=o.get(i),w=eo.state.lights;if(!0===eL&&(!0===eU||e!==eg)){let n=e===eg&&i.id===eh;E.setState(i,e,n)}let L=!1;i.version===P.__version?P.needsLights&&P.lightsStateVersion!==w.state.version||P.outputColorSpace!==_||c.isBatchedMesh&&!1===P.batching?L=!0:c.isBatchedMesh||!0!==P.batching?c.isBatchedMesh&&!0===P.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===P.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===P.instancing?L=!0:c.isInstancedMesh||!0!==P.instancing?c.isSkinnedMesh&&!1===P.skinning?L=!0:c.isSkinnedMesh||!0!==P.skinning?c.isInstancedMesh&&!0===P.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===P.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===P.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===P.instancingMorph&&null!==c.morphTexture||P.envMap!==v||!0===i.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==E.numPlanes||P.numIntersection!==E.numIntersection)||P.vertexAlphas!==S||P.vertexTangents!==T||P.morphTargets!==b||P.morphNormals!==x||P.morphColors!==R||P.toneMapping!==C?L=!0:P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=i.version);let U=P.currentProgram;!0===L&&(U=e4(i,n,c));let D=!1,I=!1,F=!1,O=U.getUniforms(),B=P.uniforms;if(a.useProgram(U.program)&&(D=!0,I=!0,F=!0),i.id!==eh&&(eh=i.id,I=!0),D||eg!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eG,"projectionMatrix",e.projectionMatrix),O.setValue(eG,"viewMatrix",e.matrixWorldInverse);let n=O.map.cameraPosition;void 0!==n&&n.setValue(eG,eN.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eG,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&O.setValue(eG,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,I=!0,F=!0)}if(P.needsLights&&(w.state.directionalShadowMap.length>0&&O.setValue(eG,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&O.setValue(eG,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&O.setValue(eG,"pointShadowMap",w.state.pointShadowMap,l)),c.isSkinnedMesh){O.setOptional(eG,c,"bindMatrix"),O.setOptional(eG,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eG,"boneTexture",e.boneTexture,l))}c.isBatchedMesh&&(O.setOptional(eG,c,"batchingTexture"),O.setValue(eG,"batchingTexture",c._matricesTexture,l),O.setOptional(eG,c,"batchingIdTexture"),O.setValue(eG,"batchingIdTexture",c._indirectTexture,l),O.setOptional(eG,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eG,"batchingColorTexture",c._colorsTexture,l));let G=t.morphAttributes;if((void 0!==G.position||void 0!==G.normal||void 0!==G.color)&&M.update(c,t,U),(I||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,O.setValue(eG,"receiveShadow",c.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=v,B.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==n.environment&&(B.envMapIntensity.value=n.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===n$&&((n$=new g.DataTexture(nK,16,16,g.RGFormat,g.HalfFloatType)).name="DFG_LUT",n$.minFilter=g.LinearFilter,n$.magFilter=g.LinearFilter,n$.wrapS=g.ClampToEdgeWrapping,n$.wrapT=g.ClampToEdgeWrapping,n$.generateMipmaps=!1,n$.needsUpdate=!0),n$)),I&&(O.setValue(eG,"toneMappingExposure",ec.toneMappingExposure),P.needsLights&&(d=B,f=F,d.ambientLightColor.needsUpdate=f,d.lightProbe.needsUpdate=f,d.directionalLights.needsUpdate=f,d.directionalLightShadows.needsUpdate=f,d.pointLights.needsUpdate=f,d.pointLightShadows.needsUpdate=f,d.spotLights.needsUpdate=f,d.spotLightShadows.needsUpdate=f,d.rectAreaLights.needsUpdate=f,d.hemisphereLights.needsUpdate=f),p&&!0===i.fog&&m.refreshFogUniforms(B,p),m.refreshMaterialUniforms(B,i,ex,eM,eo.state.transmissionRenderTarget[e.id]),e2.upload(eG,e5(P),B,l)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e2.upload(eG,e5(P),B,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(eG,"center",c.center),O.setValue(eG,"modelViewMatrix",c.modelViewMatrix),O.setValue(eG,"normalMatrix",c.normalMatrix),O.setValue(eG,"modelMatrix",c.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){let e=i.uniformsGroups;for(let n=0,t=e.length;n{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?n(e):setTimeout(r,10)}null!==t.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eK(){eQ.stop()}function e$(){eQ.start()}const eQ=new _;function eZ(e,n,t,r){if(!1===e.visible)return;if(e.layers.test(n.layers)){if(e.isGroup)t=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)eo.pushLight(e),e.castShadow&&eo.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ew.intersectsSprite(e)){r&&eI.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eD);let n=f.update(e),a=e.material;a.visible&&ei.push(e,n,a,t,eI.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ew.intersectsObject(e))){let n=f.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eI.copy(e.boundingSphere.center)):(null===n.boundingSphere&&n.computeBoundingSphere(),eI.copy(n.boundingSphere.center)),eI.applyMatrix4(e.matrixWorld).applyMatrix4(eD)),Array.isArray(a)){let r=n.groups;for(let i=0,o=r.length;i0&&e1(i,n,t),o.length>0&&e1(o,n,t),l.length>0&&e1(l,n,t),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e0(e,n,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===eo.state.transmissionRenderTarget[i.id]){let e=t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float");eo.state.transmissionRenderTarget[i.id]=new g.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?g.HalfFloatType:g.UnsignedByteType,minFilter:g.LinearMipmapLinearFilter,samples:r.samples,stencilBuffer:B,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:g.ColorManagement.workingColorSpace})}let o=eo.state.transmissionRenderTarget[i.id],s=i.viewport||e_;o.setSize(s.z*ec.transmissionResolutionScale,s.w*ec.transmissionResolutionScale);let u=ec.getRenderTarget(),c=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(eE),(eT=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eO&&b.render(a);let f=ec.toneMapping;ec.toneMapping=g.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),eo.setupLightsView(i),!0===eL&&E.setGlobalState(ec.clippingPlanes,i),e1(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===t.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let t=0,r=n.length;t0)for(let n=0,i=a.length;n0&&e0(t,r,e,n),eO&&b.render(e),eJ(ei,e,n)}null!==em&&0===ep&&(l.updateMultisampleRenderTarget(em),l.updateRenderTargetMipmap(em)),r&&eu.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,n),D.resetDefaultState(),eh=-1,eg=null,es.pop(),es.length>0?(eo=es[es.length-1],!0===eL&&E.setGlobalState(ec.clippingPlanes,eo.state.camera)):eo=null,el.pop(),ei=el.length>0?el[el.length-1]:null},this.getActiveCubeFace=function(){return ef},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return em},this.setRenderTargetTextures=function(e,n,t){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=n,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:t,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,n){let t=o.get(e);t.__webglFramebuffer=n,t.__useDefaultFramebuffer=void 0===n};const e8=eG.createFramebuffer();this.setRenderTarget=function(e,n=0,t=0){em=e,ef=n,ep=t;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eG.FRAMEBUFFER,u.__webglFramebuffer),e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest,a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),eh=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let n=e.depthTexture;if(u.__boundDepthTexture!==n){if(null!==n&&o.has(n)&&(e.width!==n.image.width||e.height!==n.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(d[n])?d[n][t]:d[n],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[t]:d,e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest}else e_.copy(ey).multiplyScalar(ex).floor(),ev.copy(eA).multiplyScalar(ex).floor(),eS=eP;if(0!==t&&(r=e8),a.bindFramebuffer(eG.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),i){let r=o.get(e.texture);eG.framebufferTexture2D(eG.FRAMEBUFFER,eG.COLOR_ATTACHMENT0,eG.TEXTURE_CUBE_MAP_POSITIVE_X+n,r.__webglTexture,t)}else if(s)for(let r=0;r=0&&n<=e.width-i&&t>=0&&t<=e.height-l&&(e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(o),U.convert(u),s))}finally{let e=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,t,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(n>=0&&n<=e.width-i&&t>=0&&t<=e.height-l){a.bindFramebuffer(eG.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eG.createBuffer();eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.bufferData(eG.PIXEL_PACK_BUFFER,s.byteLength,eG.STREAM_READ),e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(f),U.convert(p),0);let h=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,h);let _=eG.fenceSync(eG.SYNC_GPU_COMMANDS_COMPLETE,0);return eG.flush(),await (0,g.probeAsync)(eG,_,4),eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.getBufferSubData(eG.PIXEL_PACK_BUFFER,0,s),eG.deleteBuffer(m),eG.deleteSync(_),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,n=null,t=0){let r=Math.pow(2,-t),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==n?n.x:0,u=null!==n?n.y:0;l.setTexture2D(e,0),eG.copyTexSubImage2D(eG.TEXTURE_2D,t,0,0,s,u,i,o),a.unbindTexture()};const e9=eG.createFramebuffer(),e7=eG.createFramebuffer();this.copyTextureToTexture=function(e,n,t=null,r=null,i=0,s=null){let u,c,d,f,p,m,h,_,v,S;null===s&&(0!==i?((0,g.warnOnce)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);let E=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==t)u=t.max.x-t.min.x,c=t.max.y-t.min.y,d=t.isBox3?t.max.z-t.min.z:1,f=t.min.x,p=t.min.y,m=t.isBox3?t.min.z:0;else{let n=Math.pow(2,-i);u=Math.floor(E.width*n),c=Math.floor(E.height*n),d=e.isDataArrayTexture?E.depth:e.isData3DTexture?Math.floor(E.depth*n):1,f=0,p=0,m=0}null!==r?(h=r.x,_=r.y,v=r.z):(h=0,_=0,v=0);let T=U.convert(n.format),b=U.convert(n.type);n.isData3DTexture?(l.setTexture3D(n,0),S=eG.TEXTURE_3D):n.isDataArrayTexture||n.isCompressedArrayTexture?(l.setTexture2DArray(n,0),S=eG.TEXTURE_2D_ARRAY):(l.setTexture2D(n,0),S=eG.TEXTURE_2D),eG.pixelStorei(eG.UNPACK_FLIP_Y_WEBGL,n.flipY),eG.pixelStorei(eG.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eG.pixelStorei(eG.UNPACK_ALIGNMENT,n.unpackAlignment);let M=eG.getParameter(eG.UNPACK_ROW_LENGTH),x=eG.getParameter(eG.UNPACK_IMAGE_HEIGHT),R=eG.getParameter(eG.UNPACK_SKIP_PIXELS),C=eG.getParameter(eG.UNPACK_SKIP_ROWS),y=eG.getParameter(eG.UNPACK_SKIP_IMAGES);eG.pixelStorei(eG.UNPACK_ROW_LENGTH,E.width),eG.pixelStorei(eG.UNPACK_IMAGE_HEIGHT,E.height),eG.pixelStorei(eG.UNPACK_SKIP_PIXELS,f),eG.pixelStorei(eG.UNPACK_SKIP_ROWS,p),eG.pixelStorei(eG.UNPACK_SKIP_IMAGES,m);let A=e.isDataArrayTexture||e.isData3DTexture,P=n.isDataArrayTexture||n.isData3DTexture;if(e.isDepthTexture){let t=o.get(e),r=o.get(n),l=o.get(t.__renderTarget),g=o.get(r.__renderTarget);a.bindFramebuffer(eG.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eG.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let t=0;tG,"ShaderChunk",()=>S,"ShaderLib",()=>T,"UniformsLib",()=>E,"WebGLRenderer",()=>nQ,"WebGLUtils",()=>nk],8560);var nZ=e.i(30224);let nJ=e=>{let n,t=new Set,r=(e,r)=>{let a="function"==typeof e?e(n):e;if(!Object.is(a,n)){let e=n;n=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},n,a),t.forEach(t=>t(n,e))}},a=()=>n,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(t.add(e),()=>t.delete(e))},o=n=e(r,a,i);return i},n0=e=>e?nJ(e):nJ;e.s(["createStore",()=>n0],8155);let{useSyncExternalStoreWithSelector:n1}=nZ.default,n3=e=>e;function n2(e,n=n3,t){let r=n1(e.subscribe,e.getState,e.getInitialState,n,t);return p.default.useDebugValue(r),r}let n4=(e,n)=>{let t=n0(e),r=(e,r=n)=>n2(t,e,r);return Object.assign(r,t),r},n5=(e,n)=>e?n4(e,n):n4;e.s(["createWithEqualityFn",()=>n5,"useStoreWithEqualityFn",()=>n2],66748);let n6=[];function n8(e,n,t=(e,n)=>e===n){if(e===n)return!0;if(!e||!n)return!1;let r=e.length;if(n.length!==r)return!1;for(let a=0;a0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}let a={keys:n,equal:r.equal,remove:()=>{let e=n6.indexOf(a);-1!==e&&n6.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...n)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(n6.push(a),!t)throw a.promise}var n7=e.i(98133),te=e.i(95087),tn=e.i(43476),tt=p;function tr(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=tr(r,n,t);if(e)return e;r=n?null:r.sibling}}function ta(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(n){return e}}"undefined"!=typeof window&&((null==(c=window.document)?void 0:c.createElement)||(null==(d=window.navigator)?void 0:d.product)==="ReactNative")?tt.useLayoutEffect:tt.useEffect;let ti=ta(tt.createContext(null));class to extends tt.Component{render(){return tt.createElement(ti.Provider,{value:this._reactInternals},this.props.children)}}function tl(){let e=tt.useContext(ti);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=tt.useId();return tt.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=tr(t,!1,e=>{let t=e.memoizedState;for(;t;){if(t.memoizedState===n)return!0;t=t.next}});if(e)return e}},[e,n])}let ts=Symbol.for("react.context"),tu=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ts;function tc(){let e=function(){let e=tl(),[n]=tt.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;tu(e)&&e!==ti&&!n.has(e)&&n.set(e,tt.use(ta(e))),t=t.return}return n}();return tt.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>tt.createElement(n,null,tt.createElement(t.Provider,{...r,value:e.get(t)})),e=>tt.createElement(to,{...e})),[e])}function td(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>to,"traverseFiber",()=>tr,"useContextBridge",()=>tc,"useFiber",()=>tl],46791),p.act;let tf=e=>e&&e.hasOwnProperty("current"),tp=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),tm="undefined"!=typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?p.useLayoutEffect:p.useEffect;function th(e){let n=p.useRef(e);return tm(()=>void(n.current=e),[e]),n}function tg(){let e=tl(),n=tc();return p.useMemo(()=>({children:t})=>{let r=tr(e,!0,e=>e.type===p.StrictMode)?p.StrictMode:p.Fragment;return(0,tn.jsx)(r,{children:(0,tn.jsx)(n,{children:t})})},[e,n])}function t_({set:e}){return tm(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let tv=((s=class extends p.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function tS(e){var n;let t="undefined"!=typeof window?null!=(n=window.devicePixelRatio)?n:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function tE(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tT={obj:e=>e===Object(e)&&!tT.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,n,{arrays:t="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof n||!!e!=!!n)return!1;if(tT.str(e)||tT.num(e)||tT.boo(e))return e===n;let o=tT.obj(e);if(o&&"reference"===r)return e===n;let l=tT.arr(e);if(l&&"reference"===t)return e===n;if((l||o)&&e===n)return!0;for(i in e)if(!(i in n))return!1;if(o&&"shallow"===t&&"shallow"===r){for(i in a?n:e)if(!tT.equ(e[i],n[i],{strict:a,objects:"reference"}))return!1}else for(i in a?n:e)if(e[i]!==n[i])return!1;if(tT.und(i)){if(l&&0===e.length&&0===n.length||o&&0===Object.keys(e).length&&0===Object.keys(n).length)return!0;if(e!==n)return!1}return!0}},tb=["children","key","ref"];function tM(e,n,t,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:n,type:t,parent:null,children:[],props:function(e){let n={};for(let t in e)tb.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tx(e,n){if(!n.includes("-")||n in e)return{root:e,key:n,target:e[n]};let t=e,r=n.split("-");for(let a of r){if("object"!=typeof t||null===t){if(void 0!==t)return{root:t,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:n,target:void 0}}n=a,e=t,t=t[n]}return{root:e,key:n,target:t}}let tR=/-\d+$/;function tC(e,n){if(tT.str(n.props.attach)){if(tR.test(n.props.attach)){let t=n.props.attach.replace(tR,""),{root:r,key:a}=tx(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tx(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tT.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function ty(e,n){if(tT.str(n.props.attach)){let{root:t,key:r}=tx(e.object,n.props.attach),a=n.previousAttach;void 0===a?delete t[r]:t[r]=a}else null==n.previousAttach||n.previousAttach(e.object,n.object);delete n.previousAttach}let tA=[...tb,"args","dispose","attach","object","onUpdate","dispose"],tP=new Map,tw=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tL=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tU(e,n){var t,r;let a=e.__r3f,i=a&&td(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tA.includes(t))continue;if(a&&tL.test(t)){"function"==typeof o?a.handlers[t]=o:delete a.handlers[t],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;let{root:l,key:s,target:u}=tx(e,t);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${t}". Ensure it is an object before setting "${s}".`);u instanceof h.Layers&&o instanceof h.Layers?u.mask=o.mask:u instanceof h.Color&&tp(o)?u.set(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor?u.copy(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o)?"function"==typeof u.fromArray?u.fromArray(o):u.set(...o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o?"function"==typeof u.setScalar?u.setScalar(o):u.set(o):(l[s]=o,i&&!i.linear&&tw.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===h.RGBAFormat&&l[s].type===h.UnsignedByteType&&(l[s].colorSpace=h.SRGBColorSpace))}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(t=a.object)&&t.isObject3D&&o!==a.eventCount){let e=a.object,n=i.internal.interaction.indexOf(e);n>-1&&i.internal.interaction.splice(n,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&tD(a),e}function tD(e){var n;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let t=null==(n=e.root)||null==n.getState?void 0:n.getState();t&&0===t.internal.frames&&t.invalidate()}let tN=e=>null==e?void 0:e.isObject3D;function tI(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tF(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tO=e=>!!(null!=e&&e.render),tB=p.createContext(null);function tG(){let e=p.useContext(tB);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tk(e=e=>e,n){return tG()(e,n)}function tH(e,n=0){let t=tG(),r=t.getState().internal.subscribe,a=th(e);return tm(()=>r(a,n,t),[n,r,t]),null}let tV=new WeakMap;function tz(e,n){return function(t,...r){var a;let i;return"function"==typeof t&&(null==t||null==(a=t.prototype)?void 0:a.constructor)===t?(i=tV.get(t))||(i=new t,tV.set(t,i)):i=t,e&&e(i),Promise.all(r.map(e=>new Promise((t,r)=>i.load(e,e=>{var n;let r;tN(null==e?void 0:e.scene)&&Object.assign(e,(n=e.scene,r={nodes:{},materials:{},meshes:{}},n&&n.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),t(e)},n,n=>r(Error(`Could not load ${e}: ${null==n?void 0:n.message}`))))))}}function tW(e,n,t,r){let a=Array.isArray(n)?n:[n],i=n9(tz(t,r),[e,...a],!1,{equal:tT.equ});return Array.isArray(n)?i:i[0]}tW.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];n9(tz(t),[e,...a],!0,r)},tW.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n6.splice(0,n6.length);else{let e=n6.find(e=>n8(t,e.keys,e.equal));e&&e.remove()}};let tX={},tj=/^three(?=[A-Z])/,tq=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tY=0;function tK(e){if("function"==typeof e){let n=`${tY++}`;return tX[n]=e,n}Object.assign(tX,e)}function t$(e,n){let t=tq(e),r=tX[t];if("primitive"!==e&&!r)throw Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!n.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==n.args&&!Array.isArray(n.args))throw Error("R3F: The args prop must be an array!")}function tQ(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tC(e.parent,e):tN(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tD(e)}}function tZ(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=tX[tq(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tU(n.object,n.props),n.props.attach)tC(e,n);else if(tN(n.object)&&tN(e.object)){let r=e.object.children.indexOf(null==t?void 0:t.object);if(t&&-1!==r){let t=e.object.children.indexOf(n.object);-1!==t?(e.object.children.splice(t,1),e.object.children.splice(t{try{e.dispose()}catch{}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?n():(0,te.unstable_scheduleCallback)(te.unstable_IdlePriority,n)}}function t3(e,n,t){if(!n)return;n.parent=null;let r=e.children.indexOf(n);-1!==r&&e.children.splice(r,1),n.props.attach?ty(e,n):tN(n.object)&&tN(e.object)&&(e.object.remove(n.object),function(e,n){let{internal:t}=e.getState();t.interaction=t.interaction.filter(e=>e!==n),t.initialHits=t.initialHits.filter(e=>e!==n),t.hovered.forEach((e,r)=>{(e.eventObject===n||e.object===n)&&t.hovered.delete(r)}),t.capturedMap.forEach((e,r)=>{tF(t.capturedMap,n,e,r)})}(td(n),n.object));let a=null!==n.props.dispose&&!1!==t;for(let e=n.children.length-1;e>=0;e--){let t=n.children[e];t3(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&t1(n.object),void 0===t&&tD(n)}let t2=[],t4=()=>{},t5={},t6=0,t8=(f={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return t$(e=tq(e)in tX?e:e.replace(tj,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tM(n.object,t,e,n)},removeChild:t3,appendChild:tJ,appendInitialChild:tJ,insertBefore:t0,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&tJ(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t3(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&t0(r,n,t)},getRootHostContext:()=>t5,getChildHostContext:()=>t5,commitUpdate(e,n,t,r,a){var i,o,l;t$(n,r);let s=!1;if("primitive"===e.type&&t.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=t.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,n)=>{var r;return e!==(null==(r=t.args)?void 0:r[n])})&&(s=!0),s)t2.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tA.includes(r)&&!tT.equ(n[r],e.props[r]))for(let e in t[r]=n[r],n)e.startsWith(`${r}-`)&&(t[e]=n[e]);for(let r in e.props){if(tA.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tx(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tP.get(e.constructor);try{n||(n=new e.constructor,tP.set(e.constructor,n))}catch(e){}return n}(a);tT.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tU(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t2){let n=e.parent;if(n)for(let t of(e.props.attach?ty(n,e):tN(e.object)&&tN(n.object)&&n.object.remove(e.object),e.children))t.props.attach?ty(e,t):tN(t.object)&&tN(e.object)&&e.object.remove(t.object);e.isHidden&&tQ(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&t1(e.object)}for(let[r,a,i]of t2){r.props=a;let o=r.parent;if(o){let a=tX[tq(r.type)];r.object=null!=(e=r.props.object)?e:new a(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r;var e,n,t=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let n=e.ref(t);"function"==typeof n&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t);for(let e of(tU(r.object,r.props),r.props.attach?tC(o,r):tN(r.object)&&tN(o.object)&&o.object.add(r.object),r.children))e.props.attach?tC(r,e):tN(e.object)&&tN(r.object)&&r.object.add(e.object);tD(r)}}t2.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tM(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?ty(e.parent,e):tN(e.object)&&(e.object.visible=!1),e.isHidden=!0,tD(e)}},unhideInstance:tQ,createTextInstance:t4,hideTextInstance:t4,unhideTextInstance:t4,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:p.createContext(null),setCurrentUpdatePriority(e){t6=e},getCurrentUpdatePriority:()=>t6,resolveUpdatePriority(){var e;if(0!==t6)return t6;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return m.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return m.ContinuousEventPriority;default:return m.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.4.2"},(u=(0,n7.default)(f)).injectIntoDevTools(),u),t9=new Map,t7={objects:"shallow",strict:!1};function re(e){var n,t;let r,a,i,o,l,s,u,c=t9.get(e),d=null==c?void 0:c.fiber,f=null==c?void 0:c.store;c&&console.warn("R3F.createRoot should only be called once!");let g="function"==typeof reportError?reportError:console.error,_=f||(n=rh,t=rg,l=(o=(i=n5((e,r)=>{let a,i=new h.Vector3,o=new h.Vector3,l=new h.Vector3;function s(e=r().camera,n=o,t=r().size){let{width:a,height:u,top:c,left:d}=t,f=a/u;n.isVector3?l.copy(n):l.set(...n);let p=e.getWorldPosition(i).distanceTo(l);if(e&&e.isOrthographicCamera)return{width:a/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let n=2*Math.tan(e.fov*Math.PI/180/2)*p,t=a/u*n;return{width:t,height:n,top:c,left:d,factor:a/t,distance:p,aspect:f}}}let u=n=>e(e=>({performance:{...e.performance,current:n}})),c=new h.Vector2;return{set:e,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>n(r(),e),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new h.Clock,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();a&&clearTimeout(a),e.performance.current!==e.performance.min&&u(e.performance.min),a=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:n=>e(e=>({...e,events:{...e.events,...n}})),setSize:(n,t,a=0,i=0)=>{let l=r().camera,u={width:n,height:t,top:a,left:i};e(e=>({size:u,viewport:{...e.viewport,...s(l,o,u)}}))},setDpr:n=>e(e=>{let t=tS(n);return{viewport:{...e.viewport,dpr:t,initialDpr:e.viewport.initialDpr||t}}}),setFrameloop:(n="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==n&&(t.start(),t.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:p.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,t)=>{let a=r().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:t}),a.subscribers=a.subscribers.sort((e,n)=>e.priority-n.priority),()=>{let t=r().internal;null!=t&&t.subscribers&&(t.priority=t.priority-(n>0),t.subscribers=t.subscribers.filter(n=>n.ref!==e))}}}}})).getState()).size,s=o.viewport.dpr,u=o.camera,i.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=i.getState();if(n.width!==l.width||n.height!==l.height||t.dpr!==s){l=n,s=t.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(n.width/2),e.right=n.width/2,e.top=n.height/2,e.bottom=-(n.height/2)):e.aspect=n.width/n.height,e.updateProjectionMatrix());t.dpr>0&&r.setPixelRatio(t.dpr);let a="undefined"!=typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(n.width,n.height,a)}e!==u&&(u=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),i.subscribe(e=>n(e)),i),v=d||t8.createContainer(_,m.ConcurrentRoot,null,!1,null,"",g,g,g,null);c||t9.set(e,{fiber:v,store:_});let S=!1,E=null;return{async configure(n={}){var t,i;let o;E=new Promise(e=>o=e);let{gl:l,size:s,scene:u,events:c,onCreated:d,shadows:f=!1,linear:p=!1,flat:m=!1,legacy:g=!1,orthographic:v=!1,frameloop:T="always",dpr:b=[1,2],performance:M,raycaster:x,camera:R,onPointerMissed:C}=n,y=_.getState(),A=y.gl;if(!y.gl){let n={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},t="function"==typeof l?await l(n):l;A=tO(t)?t:new nQ({...n,...l}),y.set({gl:A})}let P=y.raycaster;P||y.set({raycaster:P=new h.Raycaster});let{params:w,...L}=x||{};if(tT.equ(L,P,t7)||tU(P,{...L}),tT.equ(w,P.params,t7)||tU(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tT.equ(a,R,t7)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:v?new h.OrthographicCamera(0,0,0,0,.1,1e3):new h.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tU(n,R),!n.manual&&("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(n.manual=!0,n.updateProjectionMatrix())),y.camera||null!=R&&R.rotation||n.lookAt(0,0,0)),y.set({camera:n}),P.camera=n}if(!y.scene){let e;null!=u&&u.isScene?tM(e=u,_,"",{}):(tM(e=new h.Scene,_,"",{}),u&&tU(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(_)});let U=function(e,n){if(!n&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:n,height:t,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:n,height:t,top:r,left:a}}return!n&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...n}}(e,s);if(tT.equ(U,y.size,t7)||y.setSize(U.width,U.height,U.top,U.left),b&&y.viewport.dpr!==tS(b)&&y.setDpr(b),y.frameloop!==T&&y.setFrameloop(T),y.onPointerMissed||y.set({onPointerMissed:C}),M&&!tT.equ(M,y.performance,t7)&&y.set(e=>({performance:{...e.performance,...M}})),!y.xr){let e=(e,n)=>{let t=_.getState();"never"!==t.frameloop&&rg(e,!0,t,n)},n=()=>{let n=_.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rh(n)},r={connect(){let e=_.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=_.getState().gl;e.xr.removeEventListener("sessionstart",n),e.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(t=A.xr)?void 0:t.addEventListener)&&r.connect(),y.set({xr:r})}if(A.shadowMap){let e=A.shadowMap.enabled,n=A.shadowMap.type;if(A.shadowMap.enabled=!!f,tT.boo(f))A.shadowMap.type=h.PCFSoftShadowMap;else if(tT.str(f)){let e={basic:h.BasicShadowMap,percentage:h.PCFShadowMap,soft:h.PCFSoftShadowMap,variance:h.VSMShadowMap};A.shadowMap.type=null!=(i=e[f])?i:h.PCFSoftShadowMap}else tT.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return h.ColorManagement.enabled=!g,S||(A.outputColorSpace=p?h.LinearSRGBColorSpace:h.SRGBColorSpace,A.toneMapping=m?h.NoToneMapping:h.ACESFilmicToneMapping),y.legacy!==g&&y.set(()=>({legacy:g})),y.linear!==p&&y.set(()=>({linear:p})),y.flat!==m&&y.set(()=>({flat:m})),!l||tT.fun(l)||tO(l)||tT.equ(l,A,t7)||tU(A,l),r=d,S=!0,o(),this},render(n){return S||E||this.configure(),E.then(()=>{t8.updateContainer((0,tn.jsx)(rn,{store:_,children:n,onCreated:r,rootElement:e}),v,null,()=>void 0)}),_},unmount(){rt(e)}}}function rn({store:e,children:n,onCreated:t,rootElement:r}){return tm(()=>{let n=e.getState();n.set(e=>({internal:{...e.internal,active:!0}})),t&&t(n),e.getState().events.connected||null==n.events.connect||n.events.connect(r)},[]),(0,tn.jsx)(tB.Provider,{value:e,children:n})}function rt(e,n){let t=t9.get(e),r=null==t?void 0:t.fiber;if(r){let a=null==t?void 0:t.store.getState();a&&(a.internal.active=!1),t8.updateContainer(null,r,null,()=>{a&&setTimeout(()=>{try{null==a.events.disconnect||a.events.disconnect(),null==(t=a.gl)||null==(r=t.renderLists)||null==r.dispose||r.dispose(),null==(i=a.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=a.gl)&&o.xr&&a.xr.disconnect();var t,r,i,o,l=a.scene;for(let e in"Scene"!==l.type&&(null==l.dispose||l.dispose()),l){let n=l[e];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}t9.delete(e),n&&n(e)}catch(e){}},500)})}}function rr(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let ra=new Set,ri=new Set,ro=new Set,rl=e=>rr(e,ra),rs=e=>rr(e,ri);function ru(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rc(e,n){switch(e){case"before":return ru(ra,n);case"after":return ru(ri,n);case"tail":return ru(ro,n)}}function rd(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),n=r.internal.subscribers;for(let e=0;e0)&&!(null!=(n=i.gl.xr)&&n.isPresenting)&&(r+=rd(e,i))}if(rp=!1,rc("after",e),0===r)return rc("tail",e),rf=!1,cancelAnimationFrame(a)}function rh(e,n=1){var t;if(!e)return t9.forEach(e=>rh(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):rp?e.internal.frames=2:e.internal.frames=1,rf||(rf=!0,requestAnimationFrame(rm)))}function rg(e,n=!0,t,r){if(n&&rc("before",e),t)rd(e,t,r);else for(let n of t9.values())rd(e,n.store.getState());n&&rc("after",e)}let r_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rv(e){let{handlePointer:n}=function(e){function n(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(n=>{var t;return null==(t=e.__r3f)?void 0:t.handlers["onPointer"+n]}))}function t(n){let{internal:t}=e.getState();for(let e of t.hovered.values())if(!n.length||!n.find(n=>n.object===e.object&&n.index===e.index&&n.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(t.hovered.delete(tI(e)),null!=r&&r.eventCount){let t=r.handlers,a={...e,intersections:n};null==t.onPointerOut||t.onPointerOut(a),null==t.onPointerLeave||t.onPointerLeave(a)}}}function r(e,n){for(let t=0;tt([]);case"onLostPointerCapture":return n=>{let{internal:r}=e.getState();"pointerId"in n&&r.capturedMap.has(n.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(n.pointerId)&&(r.capturedMap.delete(n.pointerId),t([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(n,t){let r=e.getState(),a=new Set,i=[],o=t?t(r.internal.interaction):r.internal.interaction;for(let e=0;e{let t=tE(e.object),r=tE(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tI(e);return!a.has(n)&&(a.add(n),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let n=e.object;for(;n;){var s;null!=(s=n.__r3f)&&s.eventCount&&i.push({...e,eventObject:n}),n=n.parent}}if("pointerId"in n&&r.internal.capturedMap.has(n.pointerId))for(let e of r.internal.capturedMap.get(n.pointerId).values())a.has(tI(e.intersection))||i.push(e.intersection);return i}(i,s?n:void 0),d=u?function(n){let{internal:t}=e.getState(),r=n.offsetX-t.initialClick[0],a=n.offsetY-t.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&t(c),!function(e,n,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=tE(o.object);if(l||o.object.traverseAncestors(e=>{let n=tE(e);if(n)return l=n,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new h.Vector3(u.x,u.y,0).unproject(c),p=e=>{var n,t;return null!=(n=null==(t=d.capturedMap.get(e))?void 0:t.has(o.eventObject))&&n},m=e=>{let t={intersection:o,target:n.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),n.target.setPointerCapture(e)},g=e=>{let n=d.capturedMap.get(e);n&&tF(d.capturedMap,o.eventObject,n,e)},_={};for(let e in n){let t=n[e];"function"!=typeof t&&(_[e]=t)}let v={...o,..._,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in n&&d.capturedMap.get(n.pointerId);(!r||r.has(o.eventObject))&&(v.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&t([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},nativeEvent:n};if(a(v),!0===i.stopped)break}}}}(c,i,d,function(e){let n=e.eventObject,t=n.__r3f;if(!(null!=t&&t.eventCount))return;let o=t.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let n=tI(e),t=l.hovered.get(n);t?t.stopped&&e.stopPropagation():(l.hovered.set(n,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let t=o[a];t?(!u||l.initialHits.includes(n))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),t(e)):u&&l.initialHits.includes(n)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,n,t){n.pointer.set(e.offsetX/n.size.width*2-1,-(2*(e.offsetY/n.size.height))+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(r_).reduce((e,t)=>({...e,[t]:n(t)}),{}),update:()=>{var n;let{events:t,internal:r}=e.getState();null!=(n=r.lastEvent)&&n.current&&t.handlers&&t.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{let{set:t,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),t(e=>({events:{...e.events,connected:n}})),r.handlers)for(let e in r.handlers){let t=r.handlers[e],[a,i]=r_[e];n.addEventListener(a,t,{passive:i})}},disconnect:()=>{let{set:n,events:t}=e.getState();if(t.connected){if(t.handlers)for(let e in t.handlers){let n=t.handlers[e],[r]=r_[e];t.connected.removeEventListener(r,n)}n(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>t_,"C",()=>tk,"D",()=>tH,"E",()=>tv,"G",()=>tW,"a",()=>th,"b",()=>tm,"c",()=>re,"d",()=>rt,"e",()=>tK,"f",()=>rv,"i",()=>tf,"j",()=>rl,"k",()=>rs,"u",()=>tg],91037)},49774,e=>{"use strict";var n=e.i(91037);e.s(["useFrame",()=>n.D])},73949,e=>{"use strict";var n=e.i(91037);e.s(["useThree",()=>n.C])},79123,e=>{"use strict";var n=e.i(43476),t=e.i(71645);let r=(0,t.createContext)(null),a=(0,t.createContext)(null),i=(0,t.createContext)(null);function o(){return(0,t.useContext)(r)}function l(){return(0,t.useContext)(a)}function s(){return(0,t.useContext)(i)}function u({children:e,fogEnabledOverride:o,onClearFogEnabledOverride:l}){let[s,u]=(0,t.useState)(!0),[c,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(1),[m,h]=(0,t.useState)(90),[g,_]=(0,t.useState)(!1),[v,S]=(0,t.useState)(!0),[E,T]=(0,t.useState)(!1),[b,M]=(0,t.useState)("moveLookStick"),x=(0,t.useCallback)(e=>{u(e),l()},[l]),R=(0,t.useMemo)(()=>({fogEnabled:o??s,setFogEnabled:x,highQualityFog:c,setHighQualityFog:d,fov:m,setFov:h,audioEnabled:g,setAudioEnabled:_,animationEnabled:v,setAnimationEnabled:S}),[s,o,x,c,m,g,v]),C=(0,t.useMemo)(()=>({debugMode:E,setDebugMode:T}),[E,T]),y=(0,t.useMemo)(()=>({speedMultiplier:f,setSpeedMultiplier:p,touchMode:b,setTouchMode:M}),[f,p,b,M]);(0,t.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&T(e.debugMode),null!=e.audioEnabled&&_(e.audioEnabled),null!=e.animationEnabled&&S(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&d(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&h(e.fov),null!=e.touchMode&&M(e.touchMode)},[]);let A=(0,t.useRef)(null);return(0,t.useEffect)(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:s,highQualityFog:c,speedMultiplier:f,fov:m,audioEnabled:g,animationEnabled:v,debugMode:E,touchMode:b}))}catch(e){}},500),()=>{A.current&&clearTimeout(A.current)}),[s,c,f,m,g,v,E,b]),(0,n.jsx)(r.Provider,{value:R,children:(0,n.jsx)(a.Provider,{value:C,children:(0,n.jsx)(i.Provider,{value:y,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>s,"useDebug",()=>l,"useSettings",()=>o])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/2f236954d6a65e12.js b/docs/_next/static/chunks/2f236954d6a65e12.js new file mode 100644 index 00000000..a6312360 --- /dev/null +++ b/docs/_next/static/chunks/2f236954d6a65e12.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},91915,(e,t,r)=>{"use strict";function n(e,t={}){if(t.onlyHashChange)return void e();let r=document.documentElement;if("smooth"!==r.dataset.scrollBehavior)return void e();let a=r.style.scrollBehavior;r.style.scrollBehavior="auto",t.dontForceLayout||r.getClientRects(),e(),r.style.scrollBehavior=a}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"disableSmoothScrollDuringRouteTransition",{enumerable:!0,get:function(){return n}}),e.r(33525)},68017,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HTTPAccessFallbackBoundary",{enumerable:!0,get:function(){return l}});let n=e.r(90809),a=e.r(43476),o=n._(e.r(71645)),i=e.r(90373),s=e.r(54394);e.r(33525);let c=e.r(8372);class u extends o.default.Component{constructor(e){super(e),this.state={triggeredStatus:void 0,previousPathname:e.pathname}}componentDidCatch(){}static getDerivedStateFromError(e){if((0,s.isHTTPAccessFallbackError)(e))return{triggeredStatus:(0,s.getAccessFallbackHTTPStatus)(e)};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.triggeredStatus?{triggeredStatus:void 0,previousPathname:e.pathname}:{triggeredStatus:t.triggeredStatus,previousPathname:e.pathname}}render(){let{notFound:e,forbidden:t,unauthorized:r,children:n}=this.props,{triggeredStatus:o}=this.state,i={[s.HTTPAccessErrorStatus.NOT_FOUND]:e,[s.HTTPAccessErrorStatus.FORBIDDEN]:t,[s.HTTPAccessErrorStatus.UNAUTHORIZED]:r};if(o){let c=o===s.HTTPAccessErrorStatus.NOT_FOUND&&e,u=o===s.HTTPAccessErrorStatus.FORBIDDEN&&t,l=o===s.HTTPAccessErrorStatus.UNAUTHORIZED&&r;return c||u||l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("meta",{name:"robots",content:"noindex"}),!1,i[o]]}):n}return n}}function l({notFound:e,forbidden:t,unauthorized:r,children:n}){let s=(0,i.useUntrackedPathname)(),l=(0,o.useContext)(c.MissingSlotContext);return e||t||r?(0,a.jsx)(u,{pathname:s,notFound:e,forbidden:t,unauthorized:r,missingSlots:l,children:n}):(0,a.jsx)(a.Fragment,{children:n})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},91798,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useRouterBFCache",{enumerable:!0,get:function(){return a}});let n=e.r(71645);function a(e,t){let[r,a]=(0,n.useState)(()=>({tree:e,stateKey:t,next:null}));if(r.tree===e)return r;let o={tree:e,stateKey:t,next:null},i=1,s=r,c=o;for(;null!==s&&i<1;){if(s.stateKey===t){c.next=s.next;break}{i++;let e={tree:s.tree,stateKey:s.stateKey,next:null};c.next=e,c=e}s=s.next}return a(o),o}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},39756,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return w}});let n=e.r(55682),a=e.r(90809),o=e.r(43476),i=a._(e.r(71645)),s=n._(e.r(74080)),c=e.r(8372),u=e.r(1244),l=e.r(72383),d=e.r(56019),f=e.r(91915),p=e.r(58442),h=e.r(68017),m=e.r(70725),g=e.r(91798);e.r(74180);let y=e.r(61994),b=e.r(33906),P=e.r(95871),_=s.default.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=["bottom","height","left","right","top","width","x","y"];function v(e,t){let r=e.getBoundingClientRect();return r.top>=0&&r.top<=t}class O extends i.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,r)=>(0,d.matchSegment)(t,e[r]))))return;let r=null,n=e.hashFragment;if(n&&(r="top"===n?document.body:document.getElementById(n)??document.getElementsByName(n)[0]),r||(r="u"0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,f.disableSmoothScrollDuringRouteTransition)(()=>{if(n)return void r.scrollIntoView();let e=document.documentElement,t=e.clientHeight;!v(r,t)&&(e.scrollTop=0,v(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function R({segmentPath:e,children:t}){let r=(0,i.useContext)(c.GlobalLayoutRouterContext);if(!r)throw Object.defineProperty(Error("invariant global layout router not mounted"),"__NEXT_ERROR_CODE",{value:"E473",enumerable:!1,configurable:!0});return(0,o.jsx)(O,{segmentPath:e,focusAndScrollRef:r.focusAndScrollRef,children:t})}function E({tree:e,segmentPath:t,debugNameContext:r,cacheNode:n,params:a,url:s,isActive:l}){let d,f=(0,i.useContext)(c.GlobalLayoutRouterContext);if((0,i.useContext)(y.NavigationPromisesContext),!f)throw Object.defineProperty(Error("invariant global layout router not mounted"),"__NEXT_ERROR_CODE",{value:"E473",enumerable:!1,configurable:!0});let p=null!==n?n:(0,i.use)(u.unresolvedThenable),h=null!==p.prefetchRsc?p.prefetchRsc:p.rsc,m=(0,i.useDeferredValue)(p.rsc,h);if((0,P.isDeferredRsc)(m)){let e=(0,i.use)(m);null===e&&(0,i.use)(u.unresolvedThenable),d=e}else null===m&&(0,i.use)(u.unresolvedThenable),d=m;let g=d;return(0,o.jsx)(c.LayoutRouterContext.Provider,{value:{parentTree:e,parentCacheNode:p,parentSegmentPath:t,parentParams:a,debugNameContext:r,url:s,isActive:l},children:g})}function j({name:e,loading:t,children:r}){let n;if(n="object"==typeof t&&null!==t&&"function"==typeof t.then?(0,i.use)(t):t){let t=n[0],a=n[1],s=n[2];return(0,o.jsx)(i.Suspense,{name:e,fallback:(0,o.jsxs)(o.Fragment,{children:[a,s,t]}),children:r})}return(0,o.jsx)(o.Fragment,{children:r})}function w({parallelRouterKey:e,error:t,errorStyles:r,errorScripts:n,templateStyles:a,templateScripts:s,template:d,notFound:f,forbidden:y,unauthorized:P,segmentViewBoundaries:_}){let S=(0,i.useContext)(c.LayoutRouterContext);if(!S)throw Object.defineProperty(Error("invariant expected layout router to be mounted"),"__NEXT_ERROR_CODE",{value:"E56",enumerable:!1,configurable:!0});let{parentTree:v,parentCacheNode:O,parentSegmentPath:w,parentParams:C,url:T,isActive:x,debugNameContext:A}=S,M=O.parallelRoutes,D=M.get(e);D||(D=new Map,M.set(e,D));let F=v[0],I=null===w?[e]:w.concat([F,e]),k=v[1][e];void 0===k&&(0,i.use)(u.unresolvedThenable);let N=k[0],U=(0,m.createRouterCacheKey)(N,!0),B=(0,g.useRouterBFCache)(k,U),L=[];do{let e=B.tree,i=B.stateKey,u=e[0],g=(0,m.createRouterCacheKey)(u),_=D.get(g)??null,S=C;if(Array.isArray(u)){let e=u[0],t=u[1],r=u[2],n=(0,b.getParamValueFromCacheKey)(t,r);null!==n&&(S={...C,[e]:n})}let v=function(e){if("/"===e)return"/";if("string"==typeof e)if("(slot)"===e)return;else return e+"/";return e[1]+"/"}(u),w=v??A,M=void 0===v?void 0:A,F=O.loading,k=(0,o.jsxs)(c.TemplateContext.Provider,{value:(0,o.jsxs)(R,{segmentPath:I,children:[(0,o.jsx)(l.ErrorBoundary,{errorComponent:t,errorStyles:r,errorScripts:n,children:(0,o.jsx)(j,{name:M,loading:F,children:(0,o.jsx)(h.HTTPAccessFallbackBoundary,{notFound:f,forbidden:y,unauthorized:P,children:(0,o.jsxs)(p.RedirectBoundary,{children:[(0,o.jsx)(E,{url:T,tree:e,params:S,cacheNode:_,segmentPath:I,debugNameContext:w,isActive:x&&i===U}),null]})})})}),null]}),children:[a,s,d]},i);L.push(k),B=B.next}while(null!==B)return L}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},37457,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let n=e.r(90809),a=e.r(43476),o=n._(e.r(71645)),i=e.r(8372);function s(){let e=(0,o.useContext)(i.TemplateContext);return(0,a.jsx)(a.Fragment,{children:e})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},93504,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createRenderSearchParamsFromClient",{enumerable:!0,get:function(){return a}});let n=new WeakMap;function a(e){let t=n.get(e);if(t)return t;let r=Promise.resolve(e);return n.set(e,r),r}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},66996,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createRenderSearchParamsFromClient",{enumerable:!0,get:function(){return n}});let n=e.r(93504).createRenderSearchParamsFromClient;("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},6831,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createRenderParamsFromClient",{enumerable:!0,get:function(){return a}});let n=new WeakMap;function a(e){let t=n.get(e);if(t)return t;let r=Promise.resolve(e);return n.set(e,r),r}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},97689,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createRenderParamsFromClient",{enumerable:!0,get:function(){return n}});let n=e.r(6831).createRenderParamsFromClient;("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},42715,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ReflectAdapter",{enumerable:!0,get:function(){return n}});class n{static get(e,t,r){let n=Reflect.get(e,t,r);return"function"==typeof n?n.bind(e):n}static set(e,t,r,n){return Reflect.set(e,t,r,n)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}},76361,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createDedupedByCallsiteServerErrorLoggerDev",{enumerable:!0,get:function(){return c}});let n=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=a(void 0);if(r&&r.has(e))return r.get(e);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}(e.r(71645));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}let o={current:null},i="function"==typeof n.cache?n.cache:e=>e,s=console.warn;function c(e){return function(...t){s(e(...t))}}i(e=>{try{s(o.current)}finally{o.current=null}})},65932,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={describeHasCheckingStringProperty:function(){return s},describeStringPropertyAccess:function(){return i},wellKnownProperties:function(){return c}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function i(e,t){return o.test(t)?`\`${e}.${t}\``:`\`${e}[${JSON.stringify(t)}]\``}function s(e,t){let r=JSON.stringify(t);return`\`Reflect.has(${e}, ${r})\`, \`${r} in ${e}\`, or similar`}let c=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","valueOf","toLocaleString","then","catch","finally","status","displayName","_debugInfo","toJSON","$$typeof","__esModule"])},83066,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"afterTaskAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},41643,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"afterTaskAsyncStorage",{enumerable:!0,get:function(){return n.afterTaskAsyncStorageInstance}});let n=e.r(83066)},50999,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={isRequestAPICallableInsideAfter:function(){return u},throwForSearchParamsAccessInUseCache:function(){return c},throwWithStaticGenerationBailoutErrorWithDynamicError:function(){return s}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=e.r(43248),i=e.r(41643);function s(e,t){throw Object.defineProperty(new o.StaticGenBailoutError(`Route ${e} with \`dynamic = "error"\` couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E543",enumerable:!1,configurable:!0})}function c(e,t){let r=Object.defineProperty(Error(`Route ${e.route} used \`searchParams\` inside "use cache". Accessing dynamic request data inside a cache scope is not supported. If you need some search params inside a cached function await \`searchParams\` outside of the cached function and pass only the required search params as arguments to the cached function. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`),"__NEXT_ERROR_CODE",{value:"E842",enumerable:!1,configurable:!0});throw Error.captureStackTrace(r,t),e.invalidDynamicUsageError??=r,r}function u(){let e=i.afterTaskAsyncStorage.getStore();return(null==e?void 0:e.rootTaskSpawnPhase)==="action"}},42852,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a={RenderStage:function(){return c},StagedRenderingController:function(){return u}};for(var o in a)Object.defineProperty(r,o,{enumerable:!0,get:a[o]});let i=e.r(12718),s=e.r(39470);var c=((n={})[n.Before=1]="Before",n[n.Static=2]="Static",n[n.Runtime=3]="Runtime",n[n.Dynamic=4]="Dynamic",n[n.Abandoned=5]="Abandoned",n);class u{constructor(e=null,t){this.abortSignal=e,this.hasRuntimePrefetch=t,this.currentStage=1,this.staticInterruptReason=null,this.runtimeInterruptReason=null,this.staticStageEndTime=1/0,this.runtimeStageEndTime=1/0,this.runtimeStageListeners=[],this.dynamicStageListeners=[],this.runtimeStagePromise=(0,s.createPromiseWithResolvers)(),this.dynamicStagePromise=(0,s.createPromiseWithResolvers)(),this.mayAbandon=!1,e&&(e.addEventListener("abort",()=>{let{reason:t}=e;this.currentStage<3&&(this.runtimeStagePromise.promise.catch(l),this.runtimeStagePromise.reject(t)),(this.currentStage<4||5===this.currentStage)&&(this.dynamicStagePromise.promise.catch(l),this.dynamicStagePromise.reject(t))},{once:!0}),this.mayAbandon=!0)}onStage(e,t){if(this.currentStage>=e)t();else if(3===e)this.runtimeStageListeners.push(t);else if(4===e)this.dynamicStageListeners.push(t);else throw Object.defineProperty(new i.InvariantError(`Invalid render stage: ${e}`),"__NEXT_ERROR_CODE",{value:"E881",enumerable:!1,configurable:!0})}canSyncInterrupt(){if(1===this.currentStage)return!1;let e=this.hasRuntimePrefetch?4:3;return this.currentStage=3&&(this.staticStageEndTime=performance.now()+performance.timeOrigin,this.resolveRuntimeStage()),t<4&&e>=4){this.runtimeStageEndTime=performance.now()+performance.timeOrigin,this.resolveDynamicStage();return}}resolveRuntimeStage(){let e=this.runtimeStageListeners;for(let t=0;t{n.then(e.bind(null,o),t)}),void 0!==a&&(i.displayName=a),i);return this.abortSignal&&s.catch(l),s}}function l(){}},69882,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={createPrerenderSearchParamsForClientPage:function(){return g},createSearchParamsFromClient:function(){return p},createServerSearchParamsForMetadata:function(){return h},createServerSearchParamsForServerPage:function(){return m},makeErroringSearchParamsForUseCache:function(){return S}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=e.r(42715),i=e.r(67673),s=e.r(62141),c=e.r(12718),u=e.r(63138),l=e.r(76361),d=e.r(65932),f=e.r(50999);function p(e,t){let r=s.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":return y(t,r);case"prerender-runtime":throw Object.defineProperty(new c.InvariantError("createSearchParamsFromClient should not be called in a runtime prerender."),"__NEXT_ERROR_CODE",{value:"E769",enumerable:!1,configurable:!0});case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new c.InvariantError("createSearchParamsFromClient should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E739",enumerable:!1,configurable:!0});case"request":return b(e,t,r)}(0,s.throwInvariantForMissingStore)()}e.r(42852);let h=m;function m(e,t){let r=s.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":return y(t,r);case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new c.InvariantError("createServerSearchParamsForServerPage should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E747",enumerable:!1,configurable:!0});case"prerender-runtime":var n,a;return n=e,a=r,(0,i.delayUntilRuntimeStage)(a,v(n));case"request":return b(e,t,r)}(0,s.throwInvariantForMissingStore)()}function g(e){if(e.forceStatic)return Promise.resolve({});let t=s.workUnitAsyncStorage.getStore();if(t)switch(t.type){case"prerender":case"prerender-client":return(0,u.makeHangingPromise)(t.renderSignal,e.route,"`searchParams`");case"prerender-runtime":throw Object.defineProperty(new c.InvariantError("createPrerenderSearchParamsForClientPage should not be called in a runtime prerender."),"__NEXT_ERROR_CODE",{value:"E768",enumerable:!1,configurable:!0});case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new c.InvariantError("createPrerenderSearchParamsForClientPage should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E746",enumerable:!1,configurable:!0});case"prerender-ppr":case"prerender-legacy":case"request":return Promise.resolve({})}(0,s.throwInvariantForMissingStore)()}function y(e,t){if(e.forceStatic)return Promise.resolve({});switch(t.type){case"prerender":case"prerender-client":var r=e,n=t;let a=P.get(n);if(a)return a;let s=(0,u.makeHangingPromise)(n.renderSignal,r.route,"`searchParams`"),c=new Proxy(s,{get(e,t,r){if(Object.hasOwn(s,t))return o.ReflectAdapter.get(e,t,r);switch(t){case"then":return(0,i.annotateDynamicAccess)("`await searchParams`, `searchParams.then`, or similar",n),o.ReflectAdapter.get(e,t,r);case"status":return(0,i.annotateDynamicAccess)("`use(searchParams)`, `searchParams.status`, or similar",n),o.ReflectAdapter.get(e,t,r);default:return o.ReflectAdapter.get(e,t,r)}}});return P.set(n,c),c;case"prerender-ppr":case"prerender-legacy":var l=e,d=t;let p=P.get(l);if(p)return p;let h=Promise.resolve({}),m=new Proxy(h,{get(e,t,r){if(Object.hasOwn(h,t))return o.ReflectAdapter.get(e,t,r);if("string"==typeof t&&"then"===t){let e="`await searchParams`, `searchParams.then`, or similar";l.dynamicShouldError?(0,f.throwWithStaticGenerationBailoutErrorWithDynamicError)(l.route,e):"prerender-ppr"===d.type?(0,i.postponeWithTracking)(l.route,e,d.dynamicTracking):(0,i.throwToInterruptStaticGeneration)(e,l,d)}return o.ReflectAdapter.get(e,t,r)}});return P.set(l,m),m;default:return t}}function b(e,t,r){return t.forceStatic?Promise.resolve({}):v(e)}let P=new WeakMap,_=new WeakMap;function S(e){let t=_.get(e);if(t)return t;let r=Promise.resolve({}),n=new Proxy(r,{get:function t(n,a,i){return Object.hasOwn(r,a)||"string"!=typeof a||"then"!==a&&d.wellKnownProperties.has(a)||(0,f.throwForSearchParamsAccessInUseCache)(e,t),o.ReflectAdapter.get(n,a,i)}});return _.set(e,n),n}function v(e){let t=P.get(e);if(t)return t;let r=Promise.resolve(e);return P.set(e,r),r}(0,l.createDedupedByCallsiteServerErrorLoggerDev)(function(e,t){let r=e?`Route "${e}" `:"This route ";return Object.defineProperty(Error(`${r}used ${t}. \`searchParams\` is a Promise and must be unwrapped with \`await\` or \`React.use()\` before accessing its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`),"__NEXT_ERROR_CODE",{value:"E848",enumerable:!1,configurable:!0})})},74804,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"dynamicAccessAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},88276,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"dynamicAccessAsyncStorage",{enumerable:!0,get:function(){return n.dynamicAccessAsyncStorageInstance}});let n=e.r(74804)},41489,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={createParamsFromClient:function(){return h},createPrerenderParamsForClientSegment:function(){return b},createServerParamsForMetadata:function(){return m},createServerParamsForRoute:function(){return g},createServerParamsForServerSegment:function(){return y}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=e.r(63599),i=e.r(42715),s=e.r(67673),c=e.r(62141),u=e.r(12718),l=e.r(65932),d=e.r(63138),f=e.r(76361),p=e.r(88276);function h(e,t){let r=c.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":return P(e,t,r);case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new u.InvariantError("createParamsFromClient should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E736",enumerable:!1,configurable:!0});case"prerender-runtime":throw Object.defineProperty(new u.InvariantError("createParamsFromClient should not be called in a runtime prerender."),"__NEXT_ERROR_CODE",{value:"E770",enumerable:!1,configurable:!0});case"request":return O(e)}(0,c.throwInvariantForMissingStore)()}e.r(42852);let m=y;function g(e,t){let r=c.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":return P(e,t,r);case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new u.InvariantError("createServerParamsForRoute should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E738",enumerable:!1,configurable:!0});case"prerender-runtime":return _(e,r);case"request":return O(e)}(0,c.throwInvariantForMissingStore)()}function y(e,t){let r=c.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":case"prerender-legacy":return P(e,t,r);case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new u.InvariantError("createServerParamsForServerSegment should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E743",enumerable:!1,configurable:!0});case"prerender-runtime":return _(e,r);case"request":return O(e)}(0,c.throwInvariantForMissingStore)()}function b(e){let t=o.workAsyncStorage.getStore();if(!t)throw Object.defineProperty(new u.InvariantError("Missing workStore in createPrerenderParamsForClientSegment"),"__NEXT_ERROR_CODE",{value:"E773",enumerable:!1,configurable:!0});let r=c.workUnitAsyncStorage.getStore();if(r)switch(r.type){case"prerender":case"prerender-client":let n=r.fallbackRouteParams;if(n){for(let a in e)if(n.has(a))return(0,d.makeHangingPromise)(r.renderSignal,t.route,"`params`")}break;case"cache":case"private-cache":case"unstable-cache":throw Object.defineProperty(new u.InvariantError("createPrerenderParamsForClientSegment should not be called in cache contexts."),"__NEXT_ERROR_CODE",{value:"E734",enumerable:!1,configurable:!0})}return Promise.resolve(e)}function P(e,t,r){switch(r.type){case"prerender":case"prerender-client":{let n=r.fallbackRouteParams;if(n){for(let a in e)if(n.has(a))return function(e,t,r){let n=S.get(e);if(n)return n;let a=new Proxy((0,d.makeHangingPromise)(r.renderSignal,t.route,"`params`"),v);return S.set(e,a),a}(e,t,r)}break}case"prerender-ppr":{let n=r.fallbackRouteParams;if(n){for(let a in e)if(n.has(a))return function(e,t,r,n){let a=S.get(e);if(a)return a;let o={...e},i=Promise.resolve(o);return S.set(e,i),Object.keys(e).forEach(e=>{l.wellKnownProperties.has(e)||t.has(e)&&Object.defineProperty(o,e,{get(){let t=(0,l.describeStringPropertyAccess)("params",e);"prerender-ppr"===n.type?(0,s.postponeWithTracking)(r.route,t,n.dynamicTracking):(0,s.throwToInterruptStaticGeneration)(t,r,n)},enumerable:!0})}),i}(e,n,t,r)}}}return O(e)}function _(e,t){return(0,s.delayUntilRuntimeStage)(t,O(e))}let S=new WeakMap,v={get:function(e,t,r){if("then"===t||"catch"===t||"finally"===t){let n=i.ReflectAdapter.get(e,t,r);return({[t]:(...t)=>{let r=p.dynamicAccessAsyncStorage.getStore();return r&&r.abortController.abort(Object.defineProperty(Error("Accessed fallback `params` during prerendering."),"__NEXT_ERROR_CODE",{value:"E691",enumerable:!1,configurable:!0})),new Proxy(n.apply(e,t),v)}})[t]}return i.ReflectAdapter.get(e,t,r)}};function O(e){let t=S.get(e);if(t)return t;let r=Promise.resolve(e);return S.set(e,r),r}(0,f.createDedupedByCallsiteServerErrorLoggerDev)(function(e,t){let r=e?`Route "${e}" `:"This route ";return Object.defineProperty(Error(`${r}used ${t}. \`params\` is a Promise and must be unwrapped with \`await\` or \`React.use()\` before accessing its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`),"__NEXT_ERROR_CODE",{value:"E834",enumerable:!1,configurable:!0})})},47257,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let n=e.r(43476),a=e.r(12718),o=e.r(8372),i=e.r(71645),s=e.r(33906),c=e.r(61994);function u({Component:t,serverProvidedParams:r}){let u,l;if(null!==r)u=r.searchParams,l=r.params;else{let e=(0,i.use)(o.LayoutRouterContext);l=null!==e?e.parentParams:{},u=(0,s.urlSearchParamsToParsedUrlQuery)((0,i.use)(c.SearchParamsContext))}if("u"{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ClientSegmentRoot",{enumerable:!0,get:function(){return s}});let n=e.r(43476),a=e.r(12718),o=e.r(8372),i=e.r(71645);function s({Component:t,slots:r,serverProvidedParams:s}){let c;if(null!==s)c=s.params;else{let e=(0,i.use)(o.LayoutRouterContext);c=null!==e?e.parentParams:{}}if("u"{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"IconMark",{enumerable:!0,get:function(){return a}});let n=e.r(43476),a=()=>"u">typeof window?null:(0,n.jsx)("meta",{name:"«nxt-icon»"})}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/39f1afbfab5559a9.js b/docs/_next/static/chunks/39f1afbfab5559a9.js deleted file mode 100644 index 7d4a905c..00000000 --- a/docs/_next/static/chunks/39f1afbfab5559a9.js +++ /dev/null @@ -1,52 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,79474,(t,e,i)=>{"use strict";var s=t.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;i.c=function(t){return s.H.useMemoCache(t)}},932,(t,e,i)=>{"use strict";e.exports=t.r(79474)},90072,t=>{"use strict";let e,i,s,r,n,a,o,h,l,u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p="attached",d="detached",m="srgb",f="srgb-linear",g="linear",y="srgb",x={COMPUTE:"compute",RENDER:"render"},b={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},v={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function w(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}let M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function S(t,e){return new M[t](e)}function A(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function C(){let t=_("canvas");return t.style.display="block",t}let T={},I=null;function z(t){I=t}function k(){return I}function B(...t){let e="THREE."+t.shift();I?I("log",e,...t):console.log(e,...t)}function R(...t){let e="THREE."+t.shift();I?I("warn",e,...t):console.warn(e,...t)}function O(...t){let e="THREE."+t.shift();I?I("error",e,...t):console.error(e,...t)}function E(...t){let e=t.join(" ");e in T||(T[e]=!0,R(...t))}function P(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}class L{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return void 0!==i&&void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){let i=this._listeners;if(void 0===i)return;let s=i[t];if(void 0!==s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){let e=this._listeners;if(void 0===e)return;let i=e[t.type];if(void 0!==i){t.target=this;let e=i.slice(0);for(let i=0,s=e.length;i>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&i|128]+N[i>>8&255]+"-"+N[i>>16&255]+N[i>>24&255]+N[255&s]+N[s>>8&255]+N[s>>16&255]+N[s>>24&255]).toLowerCase()}function j(t,e,i){return Math.max(e,Math.min(i,t))}function U(t,e){return(t%e+e)%e}function W(t,e,i){return(1-i)*t+i*e}function G(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/0xffffffff;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/0x7fffffff,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw Error("Invalid component type.")}}function q(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(0xffffffff*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(0x7fffffff*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw Error("Invalid component type.")}}let H={DEG2RAD:$,RAD2DEG:V,generateUUID:D,clamp:j,euclideanModulo:U,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:W,damp:function(t,e,i,s){return W(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(U(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(F=t);let e=F+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000},degToRad:function(t){return t*$},radToDeg:function(t){return t*V},isPowerOfTwo:function(t){return(t&t-1)==0&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){let n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),u=a((e+s)/2),c=n((e-s)/2),p=a((e-s)/2),d=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*u,h*c,h*p,o*l);break;case"YZY":t.set(h*p,o*u,h*c,o*l);break;case"ZXZ":t.set(h*c,h*p,o*u,o*l);break;case"XZX":t.set(o*u,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*u,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*u,o*l);break;default:R("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:q,denormalize:G};class J{constructor(t=0,e=0){J.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class X{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],u=i[s+3],c=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0){t[e+0]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u;return}if(a>=1){t[e+0]=c,t[e+1]=p,t[e+2]=d,t[e+3]=m;return}if(u!==m||o!==c||h!==p||l!==d){let t=o*c+h*p+l*d+u*m;t<0&&(c=-c,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){let i=Math.acos(t),s=Math.sin(i);o=o*(e=Math.sin(e*i)/s)+c*(a=Math.sin(a*i)/s),h=h*e+p*a,l=l*e+d*a,u=u*e+m*a}else{let t=1/Math.sqrt((o=o*e+c*a)*o+(h=h*e+p*a)*h+(l=l*e+d*a)*l+(u=u*e+m*a)*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){let a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],u=r[n],c=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*u+o*p-h*c,t[e+1]=o*d+l*c+h*u-a*p,t[e+2]=h*d+l*p+a*c-o*u,t[e+3]=l*d-a*u-o*c-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),u=a(r/2),c=o(i/2),p=o(s/2),d=o(r/2);switch(n){case"XYZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"YXZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"ZXY":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"ZYX":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"YZX":this._x=c*l*u+h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u-c*p*d;break;case"XZY":this._x=c*l*u-h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u+c*p*d;break;default:R("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){let t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>u){let t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>u){let t=2*Math.sqrt(1+a-i-u);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{let t=2*Math.sqrt(1+u-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=i,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(j(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(0===i)return this;let s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){let t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(t=0,e=0,i=0){Z.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Q.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Q.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),u=2*(r*i-n*e);return this.x=e+o*h+n*u-a*l,this.y=i+o*l+a*h-r*u,this.z=s+o*u+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Y.copy(this).projectOnVector(t),this.sub(Y)}reflect(t){return this.sub(Y.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let Y=new Z,Q=new X;class K{constructor(t,e,i,s,r,n,a,o,h){K.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){let l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],p=i[5],d=i[8],m=s[0],f=s[3],g=s[6],y=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*y+o*v,r[3]=n*f+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*y+u*v,r[4]=h*f+l*x+u*w,r[7]=h*g+l*b+u*M,r[2]=c*m+p*y+d*v,r[5]=c*f+p*x+d*w,r[8]=c*g+p*b+d*M,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*n-a*h,c=a*o-l*r,p=h*r-n*o,d=e*u+i*c+s*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return t[0]=u*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=c*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=p*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,a){let o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(tt.makeScale(t,e)),this}rotate(t){return this.premultiply(tt.makeRotation(-t)),this}translate(t,e){return this.premultiply(tt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}let tt=new K,te=new K().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ti=new K().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ts=(o=[.64,.33,.3,.6,.15,.06],h=[.2126,.7152,.0722],l=[.3127,.329],(a={enabled:!0,workingColorSpace:f,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i&&(this.spaces[e].transfer===y&&(t.r=tr(t.r),t.g=tr(t.g),t.b=tr(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===y&&(t.r=tn(t.r),t.g=tn(t.g),t.b=tn(t.b))),t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?g:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,e){return E("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(t,e)},toWorkingColorSpace:function(t,e){return E("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(t,e)}}).define({[f]:{primaries:o,whitePoint:l,transfer:g,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,workingColorSpaceConfig:{unpackColorSpace:m},outputColorSpaceConfig:{drawingBufferColorSpace:m}},[m]:{primaries:o,whitePoint:l,transfer:y,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,outputColorSpaceConfig:{drawingBufferColorSpace:m}}}),a);function tr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ta{static getDataURL(t,i="image/png"){let s;if(/^data:/i.test(t.src)||"undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)s=t;else{void 0===e&&(e=_("canvas")),e.width=t.width,e.height=t.height;let i=e.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),s=e}return s.toDataURL(i)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){let e=_("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;t1,this.pmremVersion=0}get width(){return this.source.getSize(tc).x}get height(){return this.source.getSize(tc).y}get depth(){return this.source.getSize(tc).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(void 0===i){R(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}tp.DEFAULT_IMAGE=null,tp.DEFAULT_MAPPING=300,tp.DEFAULT_ANISOTROPY=1;class td{constructor(t=0,e=0,i=0,s=1){td.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r,n=t.elements,a=n[0],o=n[4],h=n[8],l=n[1],u=n[5],c=n[9],p=n[2],d=n[6],m=n[10];if(.01>Math.abs(o-l)&&.01>Math.abs(h-p)&&.01>Math.abs(c-d)){if(.1>Math.abs(o+l)&&.1>Math.abs(h+p)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+m-3))return this.set(1,0,0,0),this;e=Math.PI;let t=(a+1)/2,n=(u+1)/2,f=(m+1)/2,g=(o+l)/4,y=(h+p)/4,x=(c+d)/4;return t>n&&t>f?t<.01?(i=0,s=.707106781,r=.707106781):(s=g/(i=Math.sqrt(t)),r=y/i):n>f?n<.01?(i=.707106781,s=0,r=.707106781):(i=g/(s=Math.sqrt(n)),r=x/s):f<.01?(i=.707106781,s=.707106781,r=0):(i=y/(r=Math.sqrt(f)),s=x/r),this.set(i,s,r,e),this}let f=Math.sqrt((d-c)*(d-c)+(h-p)*(h-p)+(l-o)*(l-o));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(h-p)/f,this.z=(l-o)/f,this.w=Math.acos((a+u+m-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this.w=j(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this.w=j(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 tm extends L{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new td(0,0,t,e),this.scissorTest=!1,this.viewport=new td(0,0,t,e);const s=new tp({width:t,height:e,depth:i.depth});this.textures=[];const r=i.count;for(let t=0;t1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tM),tM.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tk),tB.subVectors(this.max,tk),tA.subVectors(t.a,tk),t_.subVectors(t.b,tk),tC.subVectors(t.c,tk),tT.subVectors(t_,tA),tI.subVectors(tC,t_),tz.subVectors(tA,tC);let e=[0,-tT.z,tT.y,0,-tI.z,tI.y,0,-tz.z,tz.y,tT.z,0,-tT.x,tI.z,0,-tI.x,tz.z,0,-tz.x,-tT.y,tT.x,0,-tI.y,tI.x,0,-tz.y,tz.x,0];return!!tE(e,tA,t_,tC,tB)&&!!tE(e=[1,0,0,0,1,0,0,0,1],tA,t_,tC,tB)&&(tR.crossVectors(tT,tI),tE(e=[tR.x,tR.y,tR.z],tA,t_,tC,tB))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tM).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tM).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(tw[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),tw[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),tw[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),tw[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),tw[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),tw[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),tw[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),tw[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(tw)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}let tw=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tM=new Z,tS=new tv,tA=new Z,t_=new Z,tC=new Z,tT=new Z,tI=new Z,tz=new Z,tk=new Z,tB=new Z,tR=new Z,tO=new Z;function tE(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){tO.fromArray(t,n);let a=r.x*Math.abs(tO.x)+r.y*Math.abs(tO.y)+r.z*Math.abs(tO.z),o=e.dot(tO),h=i.dot(tO),l=s.dot(tO);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}let tP=new tv,tL=new Z,tN=new Z;class tF{constructor(t=new Z,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;void 0!==e?i.copy(e):tP.setFromPoints(t).getCenter(i);let s=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;tL.subVectors(t,this.center);let e=tL.lengthSq();if(e>this.radius*this.radius){let t=Math.sqrt(e),i=(t-this.radius)*.5;this.center.addScaledVector(tL,i/t),this.radius+=i}return this}union(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(tN.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(tL.copy(t.center).add(tN)),this.expandByPoint(tL.copy(t.center).sub(tN)))),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let t$=new Z,tV=new Z,tD=new Z,tj=new Z,tU=new Z,tW=new Z,tG=new Z;class tq{constructor(t=new Z,e=new Z(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,t$)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=t$.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(t$.copy(this.origin).addScaledVector(this.direction,e),t$.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){let r,n,a,o;tV.copy(t).add(e).multiplyScalar(.5),tD.copy(e).sub(t).normalize(),tj.copy(this.origin).sub(tV);let h=.5*t.distanceTo(e),l=-this.direction.dot(tD),u=tj.dot(this.direction),c=-tj.dot(tD),p=tj.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(r=l*c-u,n=l*u-c,o=h*d,r>=0)if(n>=-o)if(n<=o){let t=1/d;r*=t,n*=t,a=r*(r+l*n+2*u)+n*(l*r+n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=h)+u)))*r+n*(n+2*c)+p;else a=-(r=Math.max(0,-(l*(n=-h)+u)))*r+n*(n+2*c)+p;else n<=-o?(n=(r=Math.max(0,-(-l*h+u)))>0?-h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p):n<=o?(r=0,a=(n=Math.min(Math.max(-h,-c),h))*(n+2*c)+p):(n=(r=Math.max(0,-(l*h+u)))>0?h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p);else n=l>0?-h:h,a=-(r=Math.max(0,-(l*n+u)))*r+n*(n+2*c)+p;return i&&i.copy(this.origin).addScaledVector(this.direction,r),s&&s.copy(tV).addScaledVector(tD,n),a}intersectSphere(t,e){t$.subVectors(t.center,this.origin);let i=t$.dot(this.direction),s=t$.dot(t$)-i*i,r=t.radius*t.radius;if(s>r)return null;let n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return!!(0===e||t.normal.dot(this.direction)*e<0)}intersectBox(t,e){let i,s,r,n,a,o,h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(h>=0?(i=(t.min.x-c.x)*h,s=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,s=(t.min.x-c.x)*h),l>=0?(r=(t.min.y-c.y)*l,n=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,n=(t.min.y-c.y)*l),i>n||r>s||((r>i||isNaN(i))&&(i=r),(n=0?(a=(t.min.z-c.z)*u,o=(t.max.z-c.z)*u):(a=(t.max.z-c.z)*u,o=(t.min.z-c.z)*u),i>o||a>s||((a>i||i!=i)&&(i=a),(o=0?i:s,e)}intersectsBox(t){return null!==this.intersectBox(t,t$)}intersectTriangle(t,e,i,s,r){let n;tU.subVectors(e,t),tW.subVectors(i,t),tG.crossVectors(tU,tW);let a=this.direction.dot(tG);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}tj.subVectors(this.origin,t);let o=n*this.direction.dot(tW.crossVectors(tj,tW));if(o<0)return null;let h=n*this.direction.dot(tU.cross(tj));if(h<0||o+h>a)return null;let l=-n*tj.dot(tG);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tH{constructor(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){tH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f)}set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=s,g[1]=r,g[5]=n,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=p,g[7]=d,g[11]=m,g[15]=f,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 tH().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1)):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();let e=this.elements,i=t.elements,s=1/tJ.setFromMatrixColumn(t,0).length(),r=1/tJ.setFromMatrixColumn(t,1).length(),n=1/tJ.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(s),h=Math.sin(s),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+s*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=s+i*h,e[10]=n*o}else if("YXZ"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t+r*a,e[4]=s*a-i,e[8]=n*h,e[1]=n*u,e[5]=n*l,e[9]=-a,e[2]=i*a-s,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t-r*a,e[4]=-n*u,e[8]=s+i*a,e[1]=i+s*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=s*h-i,e[8]=t*h+r,e[1]=o*u,e[5]=r*h+t,e[9]=i*h-s,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=r-t*u,e[8]=s*u+i,e[1]=u,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+s,e[10]=t-r*u}else if("XZY"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+r,e[5]=n*l,e[9]=i*u-s,e[2]=s*u-i,e[6]=a*l,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(tZ,t,tY)}lookAt(t,e,i){let s=this.elements;return t0.subVectors(t,e),0===t0.lengthSq()&&(t0.z=1),t0.normalize(),tQ.crossVectors(i,t0),0===tQ.lengthSq()&&(1===Math.abs(i.z)?t0.x+=1e-4:t0.z+=1e-4,t0.normalize(),tQ.crossVectors(i,t0)),tQ.normalize(),tK.crossVectors(t0,tQ),s[0]=tQ.x,s[4]=tK.x,s[8]=t0.x,s[1]=tQ.y,s[5]=tK.y,s[9]=t0.y,s[2]=tQ.z,s[6]=tK.z,s[10]=t0.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],b=i[11],v=i[15],w=s[0],M=s[4],S=s[8],A=s[12],_=s[1],C=s[5],T=s[9],I=s[13],z=s[2],k=s[6],B=s[10],R=s[14],O=s[3],E=s[7],P=s[11],L=s[15];return r[0]=n*w+a*_+o*z+h*O,r[4]=n*M+a*C+o*k+h*E,r[8]=n*S+a*T+o*B+h*P,r[12]=n*A+a*I+o*R+h*L,r[1]=l*w+u*_+c*z+p*O,r[5]=l*M+u*C+c*k+p*E,r[9]=l*S+u*T+c*B+p*P,r[13]=l*A+u*I+c*R+p*L,r[2]=d*w+m*_+f*z+g*O,r[6]=d*M+m*C+f*k+g*E,r[10]=d*S+m*T+f*B+g*P,r[14]=d*A+m*I+f*R+g*L,r[3]=y*w+x*_+b*z+v*O,r[7]=y*M+x*C+b*k+v*E,r[11]=y*S+x*T+b*B+v*P,r[15]=y*A+x*I+b*R+v*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],p=t[14],d=t[3],m=t[7],f=t[11],g=t[15],y=o*p-h*c,x=a*p-h*u,b=a*c-o*u,v=n*p-h*l,w=n*c-o*l,M=n*u-a*l;return e*(m*y-f*x+g*b)-i*(d*y-f*v+g*w)+s*(d*x-m*v+g*M)-r*(d*b-m*w+f*M)}transpose(){let t,e=this.elements;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(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=u*f*h-m*c*h+m*o*p-a*f*p-u*o*g+a*c*g,x=d*c*h-l*f*h-d*o*p+n*f*p+l*o*g-n*c*g,b=l*m*h-d*u*h+d*a*p-n*m*p-l*a*g+n*u*g,v=d*u*o-l*m*o-d*a*c+n*m*c+l*a*f-n*u*f,w=e*y+i*x+s*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let M=1/w;return t[0]=y*M,t[1]=(m*c*r-u*f*r-m*s*p+i*f*p+u*s*g-i*c*g)*M,t[2]=(a*f*r-m*o*r+m*s*h-i*f*h-a*s*g+i*o*g)*M,t[3]=(u*o*r-a*c*r-u*s*h+i*c*h+a*s*p-i*o*p)*M,t[4]=x*M,t[5]=(l*f*r-d*c*r+d*s*p-e*f*p-l*s*g+e*c*g)*M,t[6]=(d*o*r-n*f*r-d*s*h+e*f*h+n*s*g-e*o*g)*M,t[7]=(n*c*r-l*o*r+l*s*h-e*c*h-n*s*p+e*o*p)*M,t[8]=b*M,t[9]=(d*u*r-l*m*r-d*i*p+e*m*p+l*i*g-e*u*g)*M,t[10]=(n*m*r-d*a*r+d*i*h-e*m*h-n*i*g+e*a*g)*M,t[11]=(l*a*r-n*u*r-l*i*h+e*u*h+n*i*p-e*a*p)*M,t[12]=v*M,t[13]=(l*m*s-d*u*s+d*i*c-e*m*c-l*i*f+e*u*f)*M,t[14]=(d*a*s-n*m*s-d*i*o+e*m*o+n*i*f-e*a*f)*M,t[15]=(n*u*s-l*a*s+l*i*o-e*u*o-n*i*c+e*a*c)*M,this}scale(t){let e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+i,h*a-s*o,h*o+s*a,0,h*a+s*o,l*a+i,l*o-s*n,0,h*o-s*a,l*o+s*n,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,u=a+a,c=r*h,p=r*l,d=r*u,m=n*l,f=n*u,g=a*u,y=o*h,x=o*l,b=o*u,v=i.x,w=i.y,M=i.z;return s[0]=(1-(m+g))*v,s[1]=(p+b)*v,s[2]=(d-x)*v,s[3]=0,s[4]=(p-b)*w,s[5]=(1-(c+g))*w,s[6]=(f+y)*w,s[7]=0,s[8]=(d+x)*M,s[9]=(f-y)*M,s[10]=(1-(c+m))*M,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],0===this.determinant())return i.set(1,1,1),e.identity(),this;let r=tJ.set(s[0],s[1],s[2]).length(),n=tJ.set(s[4],s[5],s[6]).length(),a=tJ.set(s[8],s[9],s[10]).length();0>this.determinant()&&(r=-r),tX.copy(this);let o=1/r,h=1/n,l=1/a;return tX.elements[0]*=o,tX.elements[1]*=o,tX.elements[2]*=o,tX.elements[4]*=h,tX.elements[5]*=h,tX.elements[6]*=h,tX.elements[8]*=l,tX.elements[9]*=l,tX.elements[10]*=l,e.setFromRotationMatrix(tX),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=r/(n-r),l=n*r/(n-r);else if(2e3===a)h=-(n+r)/(n-r),l=-2*n*r/(n-r);else if(2001===a)h=-n/(n-r),l=-n*r/(n-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=2*r/(e-t),u[4]=0,u[8]=(e+t)/(e-t),u[12]=0,u[1]=0,u[5]=2*r/(i-s),u[9]=(i+s)/(i-s),u[13]=0,u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=1/(n-r),l=n/(n-r);else if(2e3===a)h=-2/(n-r),l=-(n+r)/(n-r);else if(2001===a)h=-1/(n-r),l=-r/(n-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=2/(e-t),u[4]=0,u[8]=0,u[12]=-(e+t)/(e-t),u[1]=0,u[5]=2/(i-s),u[9]=0,u[13]=-(i+s)/(i-s),u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let tJ=new Z,tX=new tH,tZ=new Z(0,0,0),tY=new Z(1,1,1),tQ=new Z,tK=new Z,t0=new Z,t1=new tH,t2=new X;class t3{constructor(t=0,e=0,i=0,s=t3.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,r=s[0],n=s[4],a=s[8],o=s[1],h=s[5],l=s[9],u=s[2],c=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(j(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-j(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-j(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(j(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-j(n,-1,1)),.9999999>Math.abs(n)?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:R("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return t1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(t1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return t2.setFromEuler(this),this.setFromQuaternion(t2,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}t3.DEFAULT_ORDER="XYZ";class t5{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){let i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e0){s.children=[];for(let e=0;e0){s.animations=[];for(let e=0;e0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=s,i;function n(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){ec.subVectors(s,e),ep.subVectors(i,e),ed.subVectors(t,e);let n=ec.dot(ec),a=ec.dot(ep),o=ec.dot(ed),h=ep.dot(ep),l=ep.dot(ed),u=n*h-a*a;if(0===u)return r.set(0,0,0),null;let c=1/u,p=(h*o-a*l)*c,d=(n*l-a*o)*c;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,em)&&em.x>=0&&em.y>=0&&em.x+em.y<=1}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,em)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,em.x),o.addScaledVector(n,em.y),o.addScaledVector(a,em.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return ew.setScalar(0),eM.setScalar(0),eS.setScalar(0),ew.fromBufferAttribute(t,e),eM.fromBufferAttribute(t,i),eS.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(ew,r.x),n.addScaledVector(eM,r.y),n.addScaledVector(eS,r.z),n}static isFrontFacing(t,e,i,s){return ec.subVectors(i,e),ep.subVectors(t,e),0>ec.cross(ep).dot(s)}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ec.subVectors(this.c,this.b),ep.subVectors(this.a,this.b),.5*ec.cross(ep).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return eA.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return eA.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return eA.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return eA.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return eA.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,s,r=this.a,n=this.b,a=this.c;ef.subVectors(n,r),eg.subVectors(a,r),ex.subVectors(t,r);let o=ef.dot(ex),h=eg.dot(ex);if(o<=0&&h<=0)return e.copy(r);eb.subVectors(t,n);let l=ef.dot(eb),u=eg.dot(eb);if(l>=0&&u<=l)return e.copy(n);let c=o*u-l*h;if(c<=0&&o>=0&&l<=0)return i=o/(o-l),e.copy(r).addScaledVector(ef,i);ev.subVectors(t,a);let p=ef.dot(ev),d=eg.dot(ev);if(d>=0&&p<=d)return e.copy(a);let m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return s=h/(h-d),e.copy(r).addScaledVector(eg,s);let f=l*d-p*u;if(f<=0&&u-l>=0&&p-d>=0)return ey.subVectors(a,n),s=(u-l)/(u-l+(p-d)),e.copy(n).addScaledVector(ey,s);let g=1/(f+m+c);return i=m*g,s=c*g,e.copy(r).addScaledVector(ef,i).addScaledVector(eg,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let e_={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},eC={h:0,s:0,l:0},eT={h:0,s:0,l:0};function eI(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*6*(2/3-i):t}class ez{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){return void 0===e&&void 0===i?t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t):this.setRGB(t,e,i),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=m){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ts.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=ts.workingColorSpace){return this.r=t,this.g=e,this.b=i,ts.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=ts.workingColorSpace){if(t=U(t,1),e=j(e,0,1),i=j(i,0,1),0===e)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=eI(r,s,t+1/3),this.g=eI(r,s,t),this.b=eI(r,s,t-1/3)}return ts.colorSpaceToWorking(this,s),this}setStyle(t,e=m){let i;function s(e){void 0!==e&&1>parseFloat(e)&&R("Color: Alpha component of "+t+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:R("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);R("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=m){let i=e_[t.toLowerCase()];return void 0!==i?this.setHex(i,e):R("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=tr(t.r),this.g=tr(t.g),this.b=tr(t.b),this}copyLinearToSRGB(t){return this.r=tn(t.r),this.g=tn(t.g),this.b=tn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=m){return ts.workingToColorSpace(ek.copy(this),t),65536*Math.round(j(255*ek.r,0,255))+256*Math.round(j(255*ek.g,0,255))+Math.round(j(255*ek.b,0,255))}getHexString(t=m){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ts.workingColorSpace){let i,s;ts.workingToColorSpace(ek.copy(this),e);let r=ek.r,n=ek.g,a=ek.b,o=Math.max(r,n,a),h=Math.min(r,n,a),l=(h+o)/2;if(h===o)i=0,s=0;else{let t=o-h;switch(s=l<=.5?t/(o+h):t/(2-o-h),o){case r:i=(n-a)/t+6*(n0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i){R(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(null!==e){let t=e.length;i=Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class eO extends eR{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}let eE=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){let e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}let n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;(8388608&e)==0;)e<<=1,i-=8388608;e&=-8388609,i+=0x38800000,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=0x38000000+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=0x47800000,a[32]=0x80000000;for(let t=33;t<63;++t)a[t]=0x80000000+(t-32<<23);a[63]=0xc7800000;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}();function eP(t){Math.abs(t)>65504&&R("DataUtils.toHalfFloat(): Value out of range."),t=j(t,-65504,65504),eE.floatView[0]=t;let e=eE.uint32View[0],i=e>>23&511;return eE.baseTable[i]+((8388607&e)>>eE.shiftTable[i])}function eL(t){let e=t>>10;return eE.uint32View[0]=eE.mantissaTable[eE.offsetTable[e]+(1023&t)]+eE.exponentTable[e],eE.floatView[0]}class eN{static toHalfFloat(t){return eP(t)}static fromHalfFloat(t){return eL(t)}}let eF=new Z,e$=new J,eV=0;class eD{constructor(t,e,i=!1){if(Array.isArray(t))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:eV++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;se.count&&R("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){O("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(Infinity,Infinity,Infinity));return}if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let e in i){let s=i[e];t.data.attributes[e]=s.toJSON(t.data)}let s={},r=!1;for(let e in this.morphAttributes){let i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone());let s=t.attributes;for(let t in s){let i=s[t];this.setAttribute(t,i.clone(e))}let r=t.morphAttributes;for(let t in r){let i=[],s=r[t];for(let t=0,r=s.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t(t.far-t.near)**2)||(e4.copy(r).invert(),e6.copy(t.ray).applyMatrix4(e4),(null===i.boundingBox||!1!==e6.intersectsBox(i.boundingBox))&&this._computeIntersections(t,e,e6)))}_computeIntersections(t,e,i){let s,r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,c=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=c.length;ri.far?null:{distance:h,point:ia.clone(),object:t}}(t,e,i,s,e7,it,ie,ir);if(u){let t=new Z;eA.getBarycoord(ir,e7,it,ie,t),r&&(u.uv=eA.getInterpolatedAttribute(r,o,h,l,t,new J)),n&&(u.uv1=eA.getInterpolatedAttribute(n,o,h,l,t,new J)),a&&(u.normal=eA.getInterpolatedAttribute(a,o,h,l,t,new Z),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));let e={a:o,b:h,c:l,normal:new Z,materialIndex:0};eA.getNormal(e7,it,ie,e.normal),u.face=e,u.barycoord=t}return u}class il extends e5{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r);const o=[],h=[],l=[],u=[];let c=0,p=0;function d(t,e,i,s,r,n,d,m,f,g,y){let x=n/f,b=d/g,v=n/2,w=d/2,M=m/2,S=f+1,A=g+1,_=0,C=0,T=new Z;for(let n=0;n0?1:-1,l.push(T.x,T.y,T.z),u.push(o/f),u.push(1-n/g),_+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ig extends eu{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tH,this.projectionMatrix=new tH,this.projectionMatrixInverse=new tH,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let iy=new Z,ix=new J,ib=new J;class iv extends ig{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*V*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*$*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*$*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){iy.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(iy.x,iy.y).multiplyScalar(-t/iy.z),iy.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(iy.x,iy.y).multiplyScalar(-t/iy.z)}getViewSize(t,e){return this.getViewBounds(t,ix,ib),e.subVectors(ib,ix)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*$*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s,n=this.view;if(null!==this.view&&this.view.enabled){let t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*s/t,e-=n.offsetY*i/a,s*=n.width/t,i*=n.height/a}let a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class iw extends eu{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new iv(-90,1,t,e);s.layers=this.layers,this.add(s);const r=new iv(-90,1,t,e);r.layers=this.layers,this.add(r);const n=new iv(-90,1,t,e);n.layers=this.layers,this.add(n);const a=new iv(-90,1,t,e);a.layers=this.layers,this.add(a);const o=new iv(-90,1,t,e);o.layers=this.layers,this.add(o);const h=new iv(-90,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(let t of e)this.remove(t);if(2e3===t)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===t)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,n,a,o,h,l]=this.children,u=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,o),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,c,p),t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class iM extends tp{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class iS extends tf{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1};this.texture=new iM([i,i,i,i,i,i]),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let 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 ); - - } - `},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(he.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i0)for(let r=e;r=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x=s.x&&s.x>=h&&r!==s.x&&rW(ni.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;ne&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;rr3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t0)&&p.push(e,r,h),(t!==i-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t=r)){let a=e[1];t=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;let i=nq[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n,o=0;return new Response(new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,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(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(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(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[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 t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s1){let t=!1,e=0;for(let t=0,e=c.length;tNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"undefined"!=typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"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_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},53487,(t,e,i)=>{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}let m=new Map(Object.keys(r.missions).map(t=>[t.toLowerCase(),t]));function f(t){let e=t.replace(/-/g,"_").toLowerCase();return m.get(e)??null}t.s(["findMissionByDemoName",()=>f,"getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};ieS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew{"use strict";var e=t.i(90072);t.s(["parse",()=>E,"runServer",()=>N],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)} -${r} -${this.line("});")}`}{let e=t.name.name;this.currentFunction=e.toLowerCase();let i=this.functionBody(t.body,t.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(e)}, function() {`)} -${i} -${this.line("});")}`}}functionBody(t,e){this.indentLevel++;let i=[];i.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let t=0;tthis.statement(t)).join("\n\n");return this.indentLevel--,`${this.line(`${this.runtime}.package(${e}, function() {`)} -${i} -${this.line("});")}`}datablockDeclaration(t){let e=JSON.stringify(t.className.name),i=t.instanceName?JSON.stringify(t.instanceName.name):"null",s=t.parent?JSON.stringify(t.parent.name):"null",r=this.objectBody(t.body);return this.line(`${this.runtime}.datablock(${e}, ${i}, ${s}, ${r});`)}objectDeclaration(t){let e="Identifier"===t.className.type?JSON.stringify(t.className.name):this.expression(t.className),i=null===t.instanceName?"null":"Identifier"===t.instanceName.type?JSON.stringify(t.instanceName.name):this.expression(t.instanceName),s=[],r=[];for(let e of t.body)"Assignment"===e.type?s.push(e):r.push(e);let n=this.objectBody(s);if(r.length>0){let t=r.map(t=>this.objectDeclaration(t)).join(",\n");return`${this.runtime}.create(${e}, ${i}, ${n}, [ -${t} -])`}return`${this.runtime}.create(${e}, ${i}, ${n})`}objectBody(t){if(0===t.length)return"{}";let e=[];for(let i of t)if("Assignment"===i.type){let t=this.expression(i.value);if("Identifier"===i.target.type){let s=i.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?e.push(`${s}: ${t}`):e.push(`[${JSON.stringify(s)}]: ${t}`)}else if("IndexExpression"===i.target.type){let s=this.objectPropertyKey(i.target);e.push(`[${s}]: ${t}`)}else{let s=this.expression(i.target);e.push(`[${s}]: ${t}`)}}if(e.length<=1)return`{ ${e.join(", ")} }`;let i=this.indent.repeat(this.indentLevel+1),s=this.indent.repeat(this.indentLevel);return`{ -${i}${e.join(",\n"+i)} -${s}}`}objectPropertyKey(t){let e="Identifier"===t.object.type?JSON.stringify(t.object.name):this.expression(t.object),i=Array.isArray(t.index)?t.index.map(t=>this.expression(t)).join(", "):this.expression(t.index);return`${this.runtime}.key(${e}, ${i})`}ifStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.consequent);if(t.alternate)if("IfStatement"===t.alternate.type){let s=this.ifStatement(t.alternate).replace(/^\s*/,"");return this.line(`if (${e}) ${i} else ${s}`)}else{let s=this.statementAsBlock(t.alternate);return this.line(`if (${e}) ${i} else ${s}`)}return this.line(`if (${e}) ${i}`)}forStatement(t){let e=t.init?this.expression(t.init):"",i=t.test?this.expression(t.test):"",s=t.update?this.expression(t.update):"",r=this.statementAsBlock(t.body);return this.line(`for (${e}; ${i}; ${s}) ${r}`)}whileStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.body);return this.line(`while (${e}) ${i}`)}doWhileStatement(t){let e=this.statementAsBlock(t.body),i=this.expression(t.test);return this.line(`do ${e} while (${i});`)}switchStatement(t){if(t.stringMode)return this.switchStringStatement(t);let e=this.expression(t.discriminant);this.indentLevel++;let i=[];for(let e of t.cases)i.push(this.switchCase(e));return this.indentLevel--,`${this.line(`switch (${e}) {`)} -${i.join("\n")} -${this.line("}")}`}switchCase(t){let e=[];if(null===t.test)e.push(this.line("default:"));else if(Array.isArray(t.test))for(let i of t.test)e.push(this.line(`case ${this.expression(i)}:`));else e.push(this.line(`case ${this.expression(t.test)}:`));for(let i of(this.indentLevel++,t.consequent))e.push(this.statement(i));return e.push(this.line("break;")),this.indentLevel--,e.join("\n")}switchStringStatement(t){let e=this.expression(t.discriminant),i=[];for(let e of t.cases)if(null===e.test)i.push(`default: () => { ${this.blockContent(e.consequent)} }`);else if(Array.isArray(e.test))for(let t of e.test)i.push(`${this.expression(t)}: () => { ${this.blockContent(e.consequent)} }`);else i.push(`${this.expression(e.test)}: () => { ${this.blockContent(e.consequent)} }`);return this.line(`${this.runtime}.switchStr(${e}, { ${i.join(", ")} });`)}returnStatement(t){return t.value?this.line(`return ${this.expression(t.value)};`):this.line("return;")}blockStatement(t){this.indentLevel++;let e=t.body.map(t=>this.statement(t)).join("\n");return this.indentLevel--,`{ -${e} -${this.line("}")}`}statementAsBlock(t){if("BlockStatement"===t.type)return this.blockStatement(t);this.indentLevel++;let e=this.statement(t);return this.indentLevel--,`{ -${e} -${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>R,"createScriptCache",()=>I],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;se&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;ne().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return is)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return is)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(t){return t.toLowerCase()}function w(t){let e=t.trim();return v(e.startsWith("$")?e.slice(1):e)}function M(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function S(t,e){for(let i of e)t.add(v(i))}function A(t,e,i){if(t.anyClassValues.has("*")||t.anyClassValues.has(i))return!0;for(let s of e){let e=t.valuesByClass.get(v(s));if(e&&(e.has("*")||e.has(i)))return!0}return!1}let _=[{classNames:["SceneObject","GameBase","ShapeBase","Item","Player"],fields:["position","rotation","scale","transform","hidden","renderingdistance","datablock","shapename","shapefile","initialbarrel","skin","team","health","energy","energylevel","damagelevel","damageflash","damagepercent","damagestate","mountobject","mountedimage","targetposition","targetrotation","targetscale","missiontypeslist","renderenabled","vis","velocity","name"]},{classNames:["*"],fields:["position","rotation","scale","hidden","shapefile","datablock"]}],C=[{classNames:["SceneObject","GameBase","ShapeBase","SimObject"],methods:["settransform","setposition","setrotation","setscale","sethidden","setdatablock","setshapename","mountimage","unmountimage","mountobject","unmountobject","setdamagelevel","setenergylevel","schedule","delete","deleteallobjects","add","remove"]},{classNames:["*"],methods:["settransform","setscale","delete","add","remove"]}],T=["missionrunning","loadingmission"];function I(){return{scripts:new Map,generatedCode:new WeakMap}}function z(t){return t.toLowerCase()}function k(t){return Number(t)>>>0}function B(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function R(t={}){let e,i,s,r=t.reactiveFieldRules??_,u=t.reactiveMethodRules??C,c=t.reactiveGlobalNames??T,p=(e=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.fields);continue}S(M(i,r),s.fields)}return{anyClassValues:e,valuesByClass:i}}(r),(t,i)=>A(e,t,v(i))),d=(i=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.methods);continue}S(M(i,r),s.methods)}return{anyClassValues:e,valuesByClass:i}}(u),(t,e)=>A(i,t,v(e))),m=(s=function(t){let e=new Set;for(let i of t)e.add(w(i));return e}(c),t=>{let e=w(t);return s.has("*")||s.has(e)}),f=new o,g=new o,y=new o,x=[],O=new h,P=3,L=1027,N=new Map,F=new o,$=new o,V=new o,D=new o,j=new o,U=new Set,W=[],G=!1,q=0;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);V.set(e.slice(1),i)}let H=new Set,J=new Set,X=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,Z=t.cache??I(),Y=Z.scripts,Q=Z.generatedCode,K=new Map;function tt(t){let e=K.get(t);return e&&e.length>0?e[e.length-1]:void 0}function te(t,e,i){let s;(s=K.get(t))||(s=[],K.set(t,s)),s.push(e);try{return i()}finally{let e;(e=K.get(t))&&e.pop()}}function ti(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function ts(t,e){return f.get(t)?.get(e)??null}function tr(t){if(!t)return[];let e=[],i=new Set,s=t.class||t._className||t._class,r=s?z(String(s)):"";for(;r&&!i.has(r);)e.push(r),i.add(r),r=j.get(r)??"";return t._superClass&&!i.has(t._superClass)&&e.push(t._superClass),e}function tn(){if(G=!1,0===W.length)return;let t=W.splice(0,W.length);for(let e of(q+=1,U))e({type:"batch.flushed",tick:q,events:t})}function ta(t){for(let e of(W.push(t),U))e(t);G||(G=!0,queueMicrotask(tn))}function to(t){ta({type:"object.created",objectId:t._id,object:t})}function th(t,e,i,s){let r=z(e);Object.is(i,s)||p(tr(t),r)&&ta({type:"field.changed",objectId:t._id,field:r,value:i,previousValue:s,object:t})}let tl=new Set,tu=null,tc=null,tp=(t.builtins??b)({runtime:()=>tc,fileSystem:t.fileSystem??null});function td(t){let e=y.get(t);if(!e)return void O.add(t);if(!e.active){for(let[t,i]of(e.active=!0,x.push(e.name),e.methods)){f.has(t)||f.set(t,new o);let e=f.get(t);for(let[t,s]of i)e.has(t)||e.set(t,[]),e.get(t).push(s)}for(let[t,i]of e.functions)g.has(t)||g.set(t,[]),g.get(t).push(i)}}function tm(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?F.get(t)??null:"number"==typeof t?N.get(t)??null:null}function tf(t,e,i){let s=tm(t);if(null==s)return 0;let r=tb(s[e]);return s[e]=r+i,th(s,e,s[e],r),r}function tg(t,e){let i=ts(t,e);return i&&i.length>0?i[i.length-1]:null}function ty(t,e,i,s){let r=ts(t,e);return r&&0!==r.length?{found:!0,result:te(ti(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function tx(t,e,i,s){let r;d((r=tr(i)).length?r:[t],e)&&ta({type:"method.called",className:z(t),methodName:z(e),objectId:i._id,args:[...s]});let n=D.get(t);if(n){let t=n.get(e);if(t)for(let e of t)e(i,...s)}}function tb(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function tv(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;te._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function tw(t){return null==t||""===t?null:tv(String(t))}function tM(t,e){function i(t,e){return t+e.join("_")}return{get:(e,...s)=>t.get(i(e,s))??"",set(s,...r){if(0===r.length)throw Error("set() requires at least a value argument");if(1===r.length){let i=t.get(s);return t.set(s,r[0]),e?.onSet?.(s,r[0],i),r[0]}let n=r[r.length-1],a=i(s,r.slice(0,-1)),o=t.get(a);return t.set(a,n),e?.onSet?.(a,n,o),n},postInc(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a+1;return t.set(n,o),e?.onSet?.(n,o,a),a},postDec(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a-1;return t.set(n,o),e?.onSet?.(n,o,a),a}}}function tS(){return tM(new o)}let tA={registerMethod:function(t,e,i){if(tu)tu.methods.has(t)||tu.methods.set(t,new o),tu.methods.get(t).set(e,i);else{f.has(t)||f.set(t,new o);let s=f.get(t);s.has(e)||s.set(e,[]),s.get(e).push(i)}},registerFunction:function(t,e){tu?tu.functions.set(t,e):(g.has(t)||g.set(t,[]),g.get(t).push(e))},package:function(t,e){let i=y.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},y.set(t,i));let s=tu;tu=i,e(),tu=s,O.has(t)&&(O.delete(t),td(t))},activatePackage:td,deactivatePackage:function(t){let e=y.get(t);if(!e||!e.active)return;e.active=!1;let i=x.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,s]of(-1!==i&&x.splice(i,1),e.methods)){let e=f.get(t);if(e)for(let[t,i]of s){let s=e.get(t);if(s){let t=s.indexOf(i);-1!==t&&s.splice(t,1)}}}for(let[t,i]of e.functions){let e=g.get(t);if(e){let t=e.indexOf(i);-1!==t&&e.splice(t,1)}}},create:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(L);)L+=1;let t=L;return L+=1,t}(),a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[z(t)]=e;a.superclass&&(a._superClass=z(String(a.superclass)),a.class&&j.set(z(String(a.class)),a._superClass)),N.set(n,a);let o=B(e);if(o&&(a._name=o,F.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=tg(t,"onAdd");return h&&h(a),to(a),a},datablock:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(P);)P+=1;let t=P;return P+=1,t}(),a={_class:r,_className:t,_id:n,_isDatablock:!0},o=B(i);if(o){let t=$.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[z(t)]=e;N.set(n,a);let h=B(e);return h&&(a._name=h,F.set(h,a),$.set(h,a)),to(a),a},deleteObject:function t(e){var i;let s;if(null==e||("number"==typeof e?s=N.get(e):"string"==typeof e?s=F.get(e):"object"==typeof e&&e._id&&(s=e),!s))return!1;let r=tg(s._className,"onRemove");if(r&&r(s),N.delete(s._id),s._name&&F.delete(s._name),s._isDatablock&&s._name&&$.delete(s._name),s._parent&&s._parent._children){let t=s._parent._children.indexOf(s);-1!==t&&s._parent._children.splice(t,1)}if(s._children)for(let e of[...s._children])t(e);return ta({type:"object.deleted",objectId:(i=s)._id,object:i}),!0},prop:function(t,e){let i=tm(t);return null==i?"":i[z(e)]??""},setProp:function(t,e,i){let s=tm(t);if(null==s)return i;let r=z(e),n=s[r];return s[r]=i,th(s,r,i,n),i},getIndex:function(t,e){let i=tm(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=tm(t);if(null==s)return i;let r=String(e),n=s[r];return s[r]=i,th(s,r,i,n),i},propPostInc:function(t,e){return tf(t,z(e),1)},propPostDec:function(t,e){return tf(t,z(e),-1)},indexPostInc:function(t,e){return tf(t,String(e),1)},indexPostDec:function(t,e){return tf(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=tw(t)))return"";let s=t.class||t._className||t._class;if(s){let r=ty(s,e,t,i);if(r.found)return tx(s,e,t,i),r.result}let r=t._superClass||j.get(s);for(;r;){let s=ty(r,e,t,i);if(s.found)return tx(r,e,t,i),s.result;r=j.get(r)}return""},nsCall:function(t,e,...i){let s=ts(t,e);if(!s||0===s.length)return"";let r=ti(t,e),n=s[s.length-1],a=te(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&tx(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=ts(t,e);if(!i||0===i.length)return null;let s=ti(t,e),r=i[i.length-1];return(...t)=>te(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=ts(t,e),n=ti(t,e),a=tt(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=te(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&tx(t,e,i,s),h}let o=j.get(t);for(;o;){let t=ts(o,e);if(t&&t.length>0){let r=te(ti(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&tx(o,e,i,s),r}o=j.get(o)}return""},parentFunc:function(t,...e){let i=g.get(t);if(!i)return"";let s=t.toLowerCase(),r=tt(s);if(void 0===r||r<1)return"";let n=r-1;return te(s,n,()=>i[n](...e))},add:function(t,e){return tb(t)+tb(e)},sub:function(t,e){return tb(t)-tb(e)},mul:function(t,e){return tb(t)*tb(e)},div:function(t,e){return tb(t)/tb(e)},neg:function(t){return-tb(t)},lt:function(t,e){return tb(t)tb(e)},ge:function(t,e){return tb(t)>=tb(e)},eq:function(t,e){return tb(t)===tb(e)},ne:function(t,e){return tb(t)!==tb(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return k(t)&k(e)},bitor:function(t,e){return k(t)|k(e)},bitxor:function(t,e){return k(t)^k(e)},shl:function(t,e){return k(k(t)<<(31&k(e)))},shr:function(t,e){return k(t)>>>(31&k(e))},bitnot:function(t){return~k(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&z(t)===i)return void s();e.default&&e.default()},deref:tw,nameToId:function(t){let e=tv(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?N.has(t):"string"==typeof t&&F.has(t)))},isFunction:function(t){return g.has(t)||t.toLowerCase()in tp},isPackage:function(t){return y.has(t)},isActivePackage:function(t){let e=y.get(t);return e?.active??!1},getPackageList:function(){return x.join(" ")},locals:tS,onMethodCalled(t,e,i){let s=D.get(t);s||(s=new o,D.set(t,s));let r=s.get(e);r||(r=[],s.set(e,r)),r.push(i)}},t_={call(t,...e){let i=g.get(t);if(i&&i.length>0)return te(t.toLowerCase(),i.length-1,()=>i[i.length-1](...e));let s=tp[t.toLowerCase()];return s?s(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tC=tM(V,{onSet:function(t,e,i){let s=z(t.startsWith("$")?t.slice(1):t);Object.is(e,i)||m(s)&&ta({type:"global.changed",name:s,value:e,previousValue:i})}}),tT={methods:f,functions:g,packages:y,activePackages:x,objectsById:N,objectsByName:F,datablocks:$,globals:V,executedScripts:H,failedScripts:J,scripts:Y,generatedCode:Q,pendingTimeouts:tl,startTime:Date.now()};function tI(t){let e=function(t){let e=Q.get(t);null==e&&(e=new n(void 0).generate(t),Q.set(t,e));return e}(t),i=tS();Function("$","$f","$g","$l",e)(tA,t_,tC,i)}function tz(t,e){return{execute(){if(e){let t=l(e);tT.executedScripts.add(t)}tI(t)}}}async function tk(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(tT.scripts.has(n)||tT.failedScripts.has(n))return;if(X&&X(n)){console.warn(`Ignoring script: ${e}`),tT.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),tT.failedScripts.add(n),t.progress?.completeItem();return}try{a=E(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),tT.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tk(a.execScriptPaths,i,h),tT.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tB(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(tT.scripts.has(s))return tz(tT.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await tR(r,{path:e});return t.progress?.completeItem(),n}async function tR(t,e){if(e?.path){let t=l(e.path);if(tT.scripts.has(t))return tz(tT.scripts.get(t),e.path)}return tO(E(t,{filename:e?.path}),e)}async function tO(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);tT.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tk(n,s,r),tz(e,i?.path)}return tc={$:tA,$f:t_,$g:tC,state:tT,destroy:function(){for(let t of(W.length>0&&tn(),tT.pendingTimeouts))clearTimeout(t);tT.pendingTimeouts.clear(),U.clear()},executeAST:tI,loadFromPath:tB,loadFromSource:tR,loadFromAST:tO,call:(t,...e)=>t_.call(t,...e),getObjectByName:t=>F.get(t),subscribeRuntimeEvents:t=>(U.add(t),()=>{U.delete(t)})}}function O(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function E(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function P(t){if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if("string"==typeof t){let e=t.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e}return!!t}function L(){let t=Error("Operation aborted");return t.name="AbortError",t}function N(t){let{missionName:e,missionType:i,runtimeOptions:s,onMissionLoadDone:r}=t,{signal:n,fileSystem:a,globals:o={},preloadScripts:h=[],reactiveGlobalNames:l}=s??{},u=a?.findFiles("scripts/*Game.cs")??[],c=l?Array.from(new Set([...l,"missionRunning"])):void 0,p=R({...s,reactiveGlobalNames:c,globals:{...o,"$Host::Map":e,"$Host::MissionType":i},preloadScripts:[...h,...u]}),d=async function(){try{let t=await p.loadFromPath("scripts/server.cs");n?.throwIfAborted(),await p.loadFromPath(`missions/${e}.mis`),n?.throwIfAborted(),t.execute();let i=function(t,e){let{signal:i,onMissionLoadDone:s}=e;return new Promise((e,r)=>{let n=!1,a=!1,o=()=>P(t.$g.get("missionRunning")),h=()=>{n||(n=!0,d(),e())},l=t=>{n||(n=!0,d(),r(t))},u=e=>{if(!s||a)return;let i=e??t.getObjectByName("Game");i&&(a=!0,s(i))},c=()=>l(L()),p=t.subscribeRuntimeEvents(t=>{if("global.changed"===t.type&&"missionrunning"===t.name){P(t.value)&&(u(),h());return}"batch.flushed"===t.type&&o()&&(u(),h())});function d(){p(),i?.removeEventListener("abort",c)}if(i){if(i.aborted)return void l(L());i.addEventListener("abort",c,{once:!0})}o()&&(u(),h())})}(p,{signal:n,onMissionLoadDone:r}),s=await p.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");n?.throwIfAborted(),s.execute(),await i}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:p,ready:d}}t.s(["createProgressTracker",()=>O],38433);let F=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,$=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,V=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,D={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function j(t){let e=E(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match($))?{type:"sectionBegin",name:e[1]}:(e=t.match(V))?{type:"sectionEnd",name:e[1]}:(e=t.match(F))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>D[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function U(t,e){if(t)return t[e.toLowerCase()]}function W(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function G(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function q(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function H(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function J(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>W,"getInt",()=>G,"getPosition",()=>q,"getProperty",()=>U,"getRotation",()=>J,"getScale",()=>H,"parseMissionScript",()=>j],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("�","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/3a7943ba4f8effca.css b/docs/_next/static/chunks/3a7943ba4f8effca.css new file mode 100644 index 00000000..129fdf58 --- /dev/null +++ b/docs/_next/static/chunks/3a7943ba4f8effca.css @@ -0,0 +1 @@ +.TouchControls-module__AkxfgW__Joystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchControls-module__AkxfgW__Left{left:20px;transform:none;}.TouchControls-module__AkxfgW__Right{left:auto;right:20px;transform:none;} diff --git a/docs/_next/static/chunks/3adaddad39f53f70.js b/docs/_next/static/chunks/3adaddad39f53f70.js new file mode 100644 index 00000000..59036cdf --- /dev/null +++ b/docs/_next/static/chunks/3adaddad39f53f70.js @@ -0,0 +1,566 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13070,e=>{e.v({Arrow:"KeyboardOverlay-module__HsRBsa__Arrow",Column:"KeyboardOverlay-module__HsRBsa__Column",Key:"KeyboardOverlay-module__HsRBsa__Key",Root:"KeyboardOverlay-module__HsRBsa__Root",Row:"KeyboardOverlay-module__HsRBsa__Row",Spacer:"KeyboardOverlay-module__HsRBsa__Spacer"})},78295,e=>{e.v({Joystick:"TouchControls-module__AkxfgW__Joystick",Left:"TouchControls-module__AkxfgW__Left TouchControls-module__AkxfgW__Joystick",Right:"TouchControls-module__AkxfgW__Right TouchControls-module__AkxfgW__Joystick"})},65883,e=>{e.v({ButtonLabel:"InspectorControls-module__gNRB6W__ButtonLabel",CheckboxField:"InspectorControls-module__gNRB6W__CheckboxField",Controls:"InspectorControls-module__gNRB6W__Controls",Dropdown:"InspectorControls-module__gNRB6W__Dropdown",Field:"InspectorControls-module__gNRB6W__Field",Group:"InspectorControls-module__gNRB6W__Group",IconButton:"InspectorControls-module__gNRB6W__IconButton",LabelledButton:"InspectorControls-module__gNRB6W__LabelledButton",MapInfoButton:"InspectorControls-module__gNRB6W__MapInfoButton InspectorControls-module__gNRB6W__IconButton InspectorControls-module__gNRB6W__LabelledButton",MissionSelectWrapper:"InspectorControls-module__gNRB6W__MissionSelectWrapper",Toggle:"InspectorControls-module__gNRB6W__Toggle InspectorControls-module__gNRB6W__IconButton"})},36679,e=>{e.v({ButtonLabel:"CopyCoordinatesButton-module__BxovtG__ButtonLabel "+e.i(65883).ButtonLabel,ClipboardCheck:"CopyCoordinatesButton-module__BxovtG__ClipboardCheck",MapPin:"CopyCoordinatesButton-module__BxovtG__MapPin",Root:"CopyCoordinatesButton-module__BxovtG__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,showClipboardCheck:"CopyCoordinatesButton-module__BxovtG__showClipboardCheck"})},76775,(e,t,a)=>{function r(e,t,a,r){return Math.round(e/a)+" "+r+(t>=1.5*a?"s":"")}t.exports=function(e,t){t=t||{};var a,n,i,o,s=typeof e;if("string"===s&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(c){var d=parseFloat(c[1]);switch((c[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*d;case"weeks":case"week":case"w":return 6048e5*d;case"days":case"day":case"d":return 864e5*d;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*d;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*d;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:break}}}return}if("number"===s&&isFinite(e)){return t.long?(n=Math.abs(a=e))>=864e5?r(a,n,864e5,"day"):n>=36e5?r(a,n,36e5,"hour"):n>=6e4?r(a,n,6e4,"minute"):n>=1e3?r(a,n,1e3,"second"):a+" ms":(o=Math.abs(i=e))>=864e5?Math.round(i/864e5)+"d":o>=36e5?Math.round(i/36e5)+"h":o>=6e4?Math.round(i/6e4)+"m":o>=1e3?Math.round(i/1e3)+"s":i+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7003,(e,t,a)=>{t.exports=function(t){function a(e){let t,n,i,o=null;function s(...e){if(!s.enabled)return;let r=Number(new Date);s.diff=r-(t||r),s.prev=t,s.curr=r,t=r,e[0]=a.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let n=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";n++;let i=a.formatters[r];if("function"==typeof i){let a=e[n];t=i.call(s,a),e.splice(n,1),n--}return t}),a.formatArgs.call(s,e),(s.log||a.log).apply(s,e)}return s.namespace=e,s.useColors=a.useColors(),s.color=a.selectColor(e),s.extend=r,s.destroy=a.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==a.namespaces&&(n=a.namespaces,i=a.enabled(e)),i),set:e=>{o=e}}),"function"==typeof a.init&&a.init(s),s}function r(e,t){let r=a(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function n(e,t){let a=0,r=0,n=-1,i=0;for(;a"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){for(let t of(a.save(e),a.namespaces=e,a.names=[],a.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===t[0]?a.skips.push(t.slice(1)):a.names.push(t)},a.enabled=function(e){for(let t of a.skips)if(n(e,t))return!1;for(let t of a.names)if(n(e,t))return!0;return!1},a.humanize=e.r(76775),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(e){let t=0;for(let a=0;a{let r;var n=e.i(47167);a.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(n=r))}),e.splice(n,0,a)},a.save=function(e){try{e?a.storage.setItem("debug",e):a.storage.removeItem("debug")}catch(e){}},a.load=function(){let e;try{e=a.storage.getItem("debug")||a.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==n.default&&"env"in n.default&&(e=n.default.env.DEBUG),e},a.useColors=function(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch(e){}}(),r=!1,a.destroy=()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))},a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),t.exports=e.r(7003)(a);let{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},28903,e=>{e.v({ButtonLabel:"LoadDemoButton-module__kGZaoW__ButtonLabel "+e.i(65883).ButtonLabel,DemoIcon:"LoadDemoButton-module__kGZaoW__DemoIcon",Root:"LoadDemoButton-module__kGZaoW__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton})},29418,e=>{e.v({Bottom:"PlayerNameplate-module__zYDm0a__Bottom PlayerNameplate-module__zYDm0a__Root",HealthBar:"PlayerNameplate-module__zYDm0a__HealthBar",HealthFill:"PlayerNameplate-module__zYDm0a__HealthFill",IffArrow:"PlayerNameplate-module__zYDm0a__IffArrow",Name:"PlayerNameplate-module__zYDm0a__Name",Root:"PlayerNameplate-module__zYDm0a__Root",Top:"PlayerNameplate-module__zYDm0a__Top PlayerNameplate-module__zYDm0a__Root"})},21629,e=>{e.v({DiagnosticsFooter:"DemoControls-module__PjV4fq__DiagnosticsFooter",DiagnosticsMetrics:"DemoControls-module__PjV4fq__DiagnosticsMetrics",DiagnosticsPanel:"DemoControls-module__PjV4fq__DiagnosticsPanel",DiagnosticsStatus:"DemoControls-module__PjV4fq__DiagnosticsStatus",PlayPause:"DemoControls-module__PjV4fq__PlayPause",Root:"DemoControls-module__PjV4fq__Root",Seek:"DemoControls-module__PjV4fq__Seek",Speed:"DemoControls-module__PjV4fq__Speed",Time:"DemoControls-module__PjV4fq__Time"})},75840,e=>{e.v({Bar:"PlayerHUD-module__-E1Scq__Bar",BarFill:"PlayerHUD-module__-E1Scq__BarFill",ChatWindow:"PlayerHUD-module__-E1Scq__ChatWindow",EnergyBar:"PlayerHUD-module__-E1Scq__EnergyBar PlayerHUD-module__-E1Scq__Bar",HealthBar:"PlayerHUD-module__-E1Scq__HealthBar PlayerHUD-module__-E1Scq__Bar",PlayerHUD:"PlayerHUD-module__-E1Scq__PlayerHUD"})},3011,e=>{e.v({CanvasContainer:"page-module__E0kJGG__CanvasContainer",LoadingIndicator:"page-module__E0kJGG__LoadingIndicator",Progress:"page-module__E0kJGG__Progress",ProgressBar:"page-module__E0kJGG__ProgressBar",ProgressText:"page-module__E0kJGG__ProgressText",Spinner:"page-module__E0kJGG__Spinner",loadingComplete:"page-module__E0kJGG__loadingComplete",spin:"page-module__E0kJGG__spin"})},31713,e=>{"use strict";var t,a=e.i(43476),r=e.i(932),n=e.i(71645),i=e.i(75056),o=e.i(90072),s=e.i(66027),l=e.i(54970),c=e.i(12979),d=e.i(32424),u=e.i(71753),h=e.i(15080),m=e.i(62395),g=e.i(75567),f=e.i(47071);let p={value:!0},y=` +vec3 terrainLinearToSRGB(vec3 linear) { + vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; + vec3 lower = linear * 12.92; + return mix(lower, higher, step(vec3(0.0031308), linear)); +} + +vec3 terrainSRGBToLinear(vec3 srgb) { + vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); + vec3 lower = srgb / 12.92; + return mix(lower, higher, step(vec3(0.04045), srgb)); +} + +// Debug grid overlay using screen-space derivatives for sharp, anti-aliased lines +// Returns 1.0 on grid lines, 0.0 elsewhere +float terrainDebugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); +} +`;var v=e.i(79123),F=e.i(47021),b=e.i(48066);let x={0:32,1:32,2:32,3:32,4:32,5:32};function S({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:i,detailTextureName:s,lightmap:l}){let{debugMode:d}=(0,v.useDebug)(),u=(0,f.useTexture)(r.map(e=>(0,c.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,g.setupTexture)(e))}),h=s?(0,c.textureToUrl)(s):null,m=(0,f.useTexture)(h??c.FALLBACK_TEXTURE_URL,e=>{(0,g.setupTexture)(e)}),S=(0,n.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:a,visibilityMask:r,tiling:n,detailTexture:i=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=p;let s=t.length;if(t.forEach((t,a)=>{e.uniforms[`albedo${a}`]={value:t}}),a.forEach((t,a)=>{e.uniforms[`mask${a}`]={value:t}}),r&&(e.uniforms.visibilityMask={value:r}),t.forEach((t,a)=>{e.uniforms[`tiling${a}`]={value:n[a]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),i&&(e.uniforms.detailTexture={value:i},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include ",`#include +varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include ",`#include +vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`)),e.fragmentShader=` +uniform sampler2D albedo0; +uniform sampler2D albedo1; +uniform sampler2D albedo2; +uniform sampler2D albedo3; +uniform sampler2D albedo4; +uniform sampler2D albedo5; +uniform sampler2D mask0; +uniform sampler2D mask1; +uniform sampler2D mask2; +uniform sampler2D mask3; +uniform sampler2D mask4; +uniform sampler2D mask5; +uniform float tiling0; +uniform float tiling1; +uniform float tiling2; +uniform float tiling3; +uniform float tiling4; +uniform float tiling5; +${r?"uniform sampler2D visibilityMask;":""} +${o?"uniform sampler2D terrainLightmap;":""} +uniform bool sunLightPointsDown; +${i?`uniform sampler2D detailTexture; +uniform float detailTiling; +uniform float detailFadeDistance; +varying vec3 vTerrainWorldPos;`:""} + +${y} + +// Global variable to store shadow factor from RE_Direct for use in output calculation +float terrainShadowFactor = 1.0; +`+e.fragmentShader,r){let t="#include ";e.fragmentShader=e.fragmentShader.replace(t,`${t} + // Early discard for invisible areas (before fog/lighting) + float visibility = texture2D(visibilityMask, vMapUv).r; + if (visibility < 0.5) { + discard; + } + `)}e.fragmentShader=e.fragmentShader.replace("#include ",` + // Sample base albedo layers (sRGB textures auto-decoded to linear by Three.js) + vec2 baseUv = vMapUv; + vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb; + ${s>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""} + ${s>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""} + ${s>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""} + ${s>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""} + ${s>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":""} + + // Sample alpha masks for all layers (use R channel) + // Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices), + // but GPU linear filtering samples at texel centers. This offset aligns them. + vec2 alphaUv = baseUv + vec2(0.5 / 256.0); + float a0 = texture2D(mask0, alphaUv).r; + ${s>1?"float a1 = texture2D(mask1, alphaUv).r;":""} + ${s>2?"float a2 = texture2D(mask2, alphaUv).r;":""} + ${s>3?"float a3 = texture2D(mask3, alphaUv).r;":""} + ${s>4?"float a4 = texture2D(mask4, alphaUv).r;":""} + ${s>5?"float a5 = texture2D(mask5, alphaUv).r;":""} + + // Torque-style additive weighted blending (blender.cc): + // result = tex0 * alpha0 + tex1 * alpha1 + tex2 * alpha2 + ... + // Each layer's alpha map defines its contribution weight. + vec3 blended = c0 * a0; + ${s>1?"blended += c1 * a1;":""} + ${s>2?"blended += c2 * a2;":""} + ${s>3?"blended += c3 * a3;":""} + ${s>4?"blended += c4 * a4;":""} + ${s>5?"blended += c5 * a5;":""} + + // Assign to diffuseColor before lighting + vec3 textureColor = blended; + + ${i?`// Detail texture blending (Torque-style multiplicative blend) + // Sample detail texture at high frequency tiling + vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb; + + // Calculate distance-based fade factor using world positions + // Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance + float distToCamera = distance(vTerrainWorldPos, cameraPosition); + float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0); + + // Torque blending: dst * lerp(1.0, detailTexel, fadeFactor) + // Detail textures are authored with bright values (~0.8 mean), not 0.5 gray + // Direct multiplication adds subtle darkening for surface detail + textureColor *= mix(vec3(1.0), detailColor, detailFade);`:""} + + // Store blended texture in diffuseColor (still in linear space here) + // We'll convert to sRGB in the output calculation + diffuseColor.rgb = textureColor; +`),o&&(e.fragmentShader=e.fragmentShader.replace("#include ",`#include + +// Override RE_Direct to extract shadow factor for Torque-style gamma-space lighting +#undef RE_Direct +void RE_Direct_TerrainShadow( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + // Torque lighting (terrLighting.cc): if light points up, terrain gets only ambient + // This prevents shadow acne from light hitting terrain backfaces + if (!sunLightPointsDown) { + terrainShadowFactor = 0.0; + return; + } + // directLight.color = sunColor * shadowFactor (shadow already applied by Three.js) + // Extract shadow factor by comparing to original sun color + #if ( NUM_DIR_LIGHTS > 0 ) + vec3 originalSunColor = directionalLights[0].color; + float sunMax = max(max(originalSunColor.r, originalSunColor.g), originalSunColor.b); + float shadowedMax = max(max(directLight.color.r, directLight.color.g), directLight.color.b); + terrainShadowFactor = clamp(shadowedMax / max(sunMax, 0.001), 0.0, 1.0); + #endif + // Don't add to reflectedLight - we'll compute lighting in gamma space at output +} +#define RE_Direct RE_Direct_TerrainShadow + +`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include +// Clear indirect diffuse - we'll compute ambient in gamma space +#if defined( RE_IndirectDiffuse ) + irradiance = vec3(0.0); +#endif +`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include + // Clear Three.js lighting - we compute everything in gamma space + reflectedLight.directDiffuse = vec3(0.0); + reflectedLight.indirectDiffuse = vec3(0.0); +`)),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style terrain lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space +{ + // Get texture in sRGB space (undo Three.js linear decode) + vec3 textureSRGB = terrainLinearToSRGB(diffuseColor.rgb); + + ${o?` + // Sample terrain lightmap for smooth NdotL + vec2 lightmapUv = vMapUv + vec2(0.5 / 512.0); + float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r; + + // Get sun and ambient colors from Three.js lights (these ARE sRGB values from mission file) + // Three.js interprets them as linear, but the numerical values are preserved + #if ( NUM_DIR_LIGHTS > 0 ) + vec3 sunColorSRGB = directionalLights[0].color; + #else + vec3 sunColorSRGB = vec3(0.7); + #endif + vec3 ambientColorSRGB = ambientLightColor; + + // Torque formula (terrLighting.cc:471-483): + // lighting = ambient + NdotL * shadowFactor * sunColor + // Clamp lighting to [0,1] before multiplying by texture + vec3 lightingSRGB = clamp(ambientColorSRGB + lightmapNdotL * terrainShadowFactor * sunColorSRGB, 0.0, 1.0); + `:` + // No lightmap - use simple ambient lighting + vec3 lightingSRGB = ambientLightColor; + `} + + // Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space + vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); + + // Convert back to linear for Three.js output pipeline + outgoingLight = terrainSRGBToLinear(resultSRGB) + totalEmissiveRadiance; +} +#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`#if DEBUG_MODE + // Debug mode: overlay green grid matching terrain grid squares (256x256) + float gridIntensity = terrainDebugGrid(vMapUv, 256.0, 1.5); + vec3 gridColor = vec3(0.0, 0.8, 0.4); // Green + gl_FragColor.rgb = mix(gl_FragColor.rgb, gridColor, gridIntensity * 0.1); +#endif + +#include `)}({shader:e,baseTextures:u,alphaTextures:i,visibilityMask:t,tiling:x,detailTexture:h?m:null,lightmap:l}),(0,F.injectCustomFog)(e,b.globalFogUniforms)},[u,i,t,m,h,l]),k=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=k.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!d,e.needsUpdate=!0)},[d]);let D=`${h?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,a.jsx)("meshLambertMaterial",{ref:k,map:e,depthWrite:!0,side:o.FrontSide,defines:{DEBUG_MODE:+!!d},onBeforeCompile:S},D)}function k(e){let t,i,o=(0,r.c)(8),{displacementMap:s,visibilityMask:l,textureNames:c,alphaTextures:d,detailTextureName:u,lightmap:h}=e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),o[0]=t):t=o[0],o[1]!==d||o[2]!==u||o[3]!==s||o[4]!==h||o[5]!==c||o[6]!==l?(i=(0,a.jsx)(n.Suspense,{fallback:t,children:(0,a.jsx)(S,{displacementMap:s,visibilityMask:l,textureNames:c,alphaTextures:d,detailTextureName:u,lightmap:h})}),o[1]=d,o[2]=u,o[3]=s,o[4]=h,o[5]=c,o[6]=l,o[7]=i):i=o[7],i}let D=(0,n.memo)(function(e){let t,n,i,o=(0,r.c)(15),{tileX:s,tileZ:l,blockSize:c,basePosition:d,textureNames:u,geometry:h,displacementMap:m,visibilityMask:g,alphaTextures:f,detailTextureName:p,lightmap:y,visible:v}=e,F=void 0===v||v,b=c/2,x=d.x+s*c+b,S=d.z+l*c+b;o[0]!==x||o[1]!==S?(t=[x,0,S],o[0]=x,o[1]=S,o[2]=t):t=o[2];let D=t;return o[3]!==f||o[4]!==p||o[5]!==m||o[6]!==y||o[7]!==u||o[8]!==g?(n=(0,a.jsx)(k,{displacementMap:m,visibilityMask:g,textureNames:u,alphaTextures:f,detailTextureName:p,lightmap:y}),o[3]=f,o[4]=p,o[5]=m,o[6]=y,o[7]=u,o[8]=g,o[9]=n):n=o[9],o[10]!==h||o[11]!==D||o[12]!==n||o[13]!==F?(i=(0,a.jsx)("mesh",{position:D,geometry:h,castShadow:!0,receiveShadow:!0,visible:F,children:n}),o[10]=h,o[11]=D,o[12]=n,o[13]=F,o[14]=i):i=o[14],i});e.i(13876);var P=e.i(58647);function w(e){return(0,P.useRuntimeObjectByName)(e)}let C=null;function I(e){let t=new Uint8Array(65536);for(let a of(t.fill(255),e)){let e=255&a,r=a>>8&255,n=a>>16,i=256*r;for(let a=0;a0?n:(t[0]!==a?(e=(0,m.getFloat)(a,"visibleDistance")??600,t[0]=a,t[1]=e):e=t[1],e)}(),Y=(0,h.useThree)(E),Z=-(128*W);V[6]!==Z?(d={x:Z,z:Z},V[6]=Z,V[7]=d):d=V[7];let J=d;if(V[8]!==q){let e=(0,m.getProperty)(q,"emptySquares");g=e?e.split(" ").map(T):[],V[8]=q,V[9]=g}else g=V[9];let Q=g,{data:ee}=((O=(0,r.c)(2))[0]!==H?(U={queryKey:["terrain",H],queryFn:()=>(0,c.loadTerrain)(H)},O[0]=H,O[1]=U):U=O[1],(0,s.useQuery)(U));e:{let e;if(!ee){f=null;break e}let t=256*W;V[10]!==t||V[11]!==W||V[12]!==ee.heightMap?(!function(e,t,a){let r=e.attributes.position,n=e.attributes.uv,i=e.attributes.normal,o=r.array,s=n.array,l=i.array,c=r.count,d=(e,a)=>(e=Math.max(0,Math.min(255,e)),t[256*(a=Math.max(0,Math.min(255,a)))+e]/65535*2048),u=(e,a)=>{let r=Math.floor(e=Math.max(0,Math.min(255,e))),n=Math.floor(a=Math.max(0,Math.min(255,a))),i=Math.min(r+1,255),o=Math.min(n+1,255),s=e-r,l=a-n;return(t[256*n+r]/65535*2048*(1-s)+t[256*n+i]/65535*2048*s)*(1-l)+(t[256*o+r]/65535*2048*(1-s)+t[256*o+i]/65535*2048*s)*l};for(let e=0;e0?(g/=y,f/=y,p/=y):(g=0,f=1,p=0),l[3*e]=g,l[3*e+1]=f,l[3*e+2]=p}r.needsUpdate=!0,i.needsUpdate=!0}(e=function(e,t){let a=new o.BufferGeometry,r=new Float32Array(198147),n=new Float32Array(198147),i=new Float32Array(132098),s=new Uint32Array(393216),l=0,c=e/256;for(let t=0;t<=256;t++)for(let a=0;a<=256;a++){let o=257*t+a;r[3*o]=a*c-e/2,r[3*o+1]=e/2-t*c,r[3*o+2]=0,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=1,i[2*o]=a/256,i[2*o+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let a=257*e+t,r=a+1,n=(e+1)*257+t,i=n+1;((t^e)&1)==0?(s[l++]=a,s[l++]=n,s[l++]=i,s[l++]=a,s[l++]=i,s[l++]=r):(s[l++]=a,s[l++]=n,s[l++]=r,s[l++]=r,s[l++]=n,s[l++]=i)}return a.setIndex(new o.BufferAttribute(s,1)),a.setAttribute("position",new o.Float32BufferAttribute(r,3)),a.setAttribute("normal",new o.Float32BufferAttribute(n,3)),a.setAttribute("uv",new o.Float32BufferAttribute(i,2)),a.rotateX(-Math.PI/2),a.rotateY(-Math.PI/2),a}(t,0),ee.heightMap,W),V[10]=t,V[11]=W,V[12]=ee.heightMap,V[13]=e):e=V[13],f=e}let et=f;V[14]!==W||V[15]!==ee?(p=()=>{if(ee){var e;return e=ee.heightMap,C=(t,a)=>{let r=Math.max(0,Math.min(255,a/W+128)),n=Math.max(0,Math.min(255,t/W+128)),i=Math.floor(r),o=Math.floor(n),s=Math.min(i+1,255),l=Math.min(o+1,255),c=r-i,d=n-o;return((e[256*o+i]*(1-c)+e[256*o+s]*c)*(1-d)+(e[256*l+i]*(1-c)+e[256*l+s]*c)*d)/65535*2048},B}},y=[ee,W],V[14]=W,V[15]=ee,V[16]=p,V[17]=y):(p=V[16],y=V[17]),(0,n.useEffect)(p,y);let ea=w("Sun");t:{let e,t;if(!ea){let e;V[18]===Symbol.for("react.memo_cache_sentinel")?(e=new o.Vector3(.57735,-.57735,.57735),V[18]=e):e=V[18],v=e;break t}V[19]!==ea?(e=((0,m.getProperty)(ea,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(j),V[19]=ea,V[20]=e):e=V[20];let[a,r,n]=e,i=Math.sqrt(a*a+n*n+r*r),s=a/i,l=n/i,c=r/i;V[21]!==s||V[22]!==l||V[23]!==c?(t=new o.Vector3(s,l,c),V[21]=s,V[22]=l,V[23]=c,V[24]=t):t=V[24],v=t}let er=v;a:{let e;if(!ee){F=null;break a}V[25]!==W||V[26]!==er||V[27]!==ee.heightMap?(e=function(e,t,a){let r=(t,a)=>{let r=Math.max(0,Math.min(255,t)),n=Math.max(0,Math.min(255,a)),i=Math.floor(r),o=Math.floor(n),s=Math.min(i+1,255),l=Math.min(o+1,255),c=r-i,d=n-o;return((e[256*o+i]/65535*(1-c)+e[256*o+s]/65535*c)*(1-d)+(e[256*l+i]/65535*(1-c)+e[256*l+s]/65535*c)*d)*2048},n=new o.Vector3(-t.x,-t.y,-t.z).normalize(),i=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,s=e/2+.25,l=r(o,s),c=r(o-.5,s),d=r(o+.5,s),u=r(o,s-.5),h=-((r(o,s+.5)-u)/1),m=-((d-c)/1),g=Math.sqrt(h*h+a*a+m*m),f=Math.max(0,h/g*n.x+a/g*n.y+m/g*n.z),p=1;f>0&&(p=function(e,t,a,r,n,i){let o=r.z/n,s=r.x/n,l=r.y,c=Math.sqrt(o*o+s*s);if(c<1e-4)return 1;let d=.5/c,u=o*d,h=s*d,m=l*d,g=e,f=t,p=a+.1;for(let e=0;e<768&&(g+=u,f+=h,p+=m,!(g<0)&&!(g>=256)&&!(f<0)&&!(f>=256)&&!(p>2048));e++)if(pArray(ed).fill(null),V[38]=ed,V[39]=M):M=V[39];let[eh,em]=(0,n.useState)(M);V[40]===Symbol.for("react.memo_cache_sentinel")?(N={xStart:0,xEnd:0,zStart:0,zEnd:0},V[40]=N):N=V[40];let eg=(0,n.useRef)(N);return(V[41]!==J.x||V[42]!==J.z||V[43]!==K||V[44]!==Y.position.x||V[45]!==Y.position.z||V[46]!==ed||V[47]!==X?(A=()=>{let e=Y.position.x-J.x,t=Y.position.z-J.z,a=Math.floor((e-X)/K),r=Math.ceil((e+X)/K),n=Math.floor((t-X)/K),i=Math.ceil((t+X)/K),o=eg.current;if(a===o.xStart&&r===o.xEnd&&n===o.zStart&&i===o.zEnd)return;o.xStart=a,o.xEnd=r,o.zStart=n,o.zEnd=i;let s=[];for(let e=a;e{let t=eh[e];return(0,a.jsx)(D,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:K,basePosition:J,textureNames:ee.textureNames,geometry:et,displacementMap:ei,visibilityMask:es,alphaTextures:el,detailTextureName:$,lightmap:en,visible:null!==t},e)}),V[59]=J,V[60]=K,V[61]=$,V[62]=eu,V[63]=el,V[64]=ei,V[65]=et,V[66]=ee.textureNames,V[67]=en,V[68]=eh,V[69]=L):L=V[69],V[70]!==G||V[71]!==L?(z=(0,a.jsxs)(a.Fragment,{children:[G,L]}),V[70]=G,V[71]=L,V[72]=z):z=V[72],z):null});function E(e){return e.camera}function T(e){return parseInt(e,10)}function B(){C=null}function j(e){return parseFloat(e)}function _(e){return(0,g.setupMask)(e)}function R(e,t){return t}let N=(0,n.createContext)(null);function A(){return(0,n.useContext)(N)}function G(e){return(0,a.jsx)(eE,{objectId:e},e)}var L=e.i(8597),z=e.i(78140),U=e.i(89887);let O=` +vec3 interiorLinearToSRGB(vec3 linear) { + vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; + vec3 lower = linear * 12.92; + return mix(lower, higher, step(vec3(0.0031308), linear)); +} + +vec3 interiorSRGBToLinear(vec3 srgb) { + vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); + vec3 lower = srgb / 12.92; + return mix(lower, higher, step(vec3(0.04045), srgb)); +} + +// Debug grid overlay function using screen-space derivatives for sharp, anti-aliased lines +// Returns 1.0 on grid lines, 0.0 elsewhere +float debugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); +} +`;function V({materialName:e,material:t,lightMap:r}){let i=(0,v.useDebug)(),s=i?.debugMode??!1,l=(0,c.textureToUrl)(e),d=(0,f.useTexture)(l,e=>(0,g.setupTexture)(e)),u=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),h=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),m=(0,n.useCallback)(e=>{let t;(0,F.injectCustomFog)(e,b.globalFogUniforms),t=h??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new o.Vector3(0,.4,1):new o.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include +${O} +uniform bool useSceneLighting; +uniform vec3 interiorDebugColor; +`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Lightmap handled in custom output calculation +#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space +// Get texture in sRGB space (undo Three.js linear decode) +vec3 textureSRGB = interiorLinearToSRGB(diffuseColor.rgb); + +// Compute lighting in sRGB space +vec3 lightingSRGB = vec3(0.0); + +if (useSceneLighting) { + // Three.js computed: reflectedLight = lighting \xd7 texture_linear / PI + // Extract pure lighting: lighting = reflectedLight \xd7 PI / texture_linear + vec3 totalLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 safeTexLinear = max(diffuseColor.rgb, vec3(0.001)); + vec3 extractedLighting = totalLight * PI / safeTexLinear; + // NOTE: extractedLighting is ALREADY sRGB values because mission sun/ambient colors + // are sRGB values (Torque used them directly in gamma space). Three.js treats them + // as linear but the numerical values are the same. DO NOT convert to sRGB here! + // IMPORTANT: Torque clamps scene lighting to [0,1] BEFORE adding to lightmap + // (sceneLighting.cc line 1785: tmp.clamp()) + lightingSRGB = clamp(extractedLighting, 0.0, 1.0); +} + +// Add lightmap contribution (for BOTH outside and inside surfaces) +// In Torque, scene lighting is ADDED to lightmaps for outside surfaces at mission load +// (stored in .ml files). Inside surfaces only have base lightmap. Both need lightmap here. +#ifdef USE_LIGHTMAP + // Lightmap is stored as linear in Three.js (decoded from sRGB texture), convert back + lightingSRGB += interiorLinearToSRGB(lightMapTexel.rgb); +#endif +// Torque clamps the sum to [0,1] per channel (sceneLighting.cc lines 1817-1827) +lightingSRGB = clamp(lightingSRGB, 0.0, 1.0); + +// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space +vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); + +// Convert back to linear for Three.js output pipeline +vec3 resultLinear = interiorSRGBToLinear(resultSRGB); + +// Reassign outgoingLight before opaque_fragment consumes it +outgoingLight = resultLinear + totalEmissiveRadiance; + +#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`// Debug mode: overlay colored grid on top of normal rendering +// Blue grid = SurfaceOutsideVisible (receives scene ambient light) +// Red grid = inside surface (no scene ambient light) +#if DEBUG_MODE && defined(USE_MAP) + // gridSize=4 creates 4x4 grid per UV tile, lineWidth=1.5 is ~1.5 pixels wide + float gridIntensity = debugGrid(vMapUv, 4.0, 1.5); + gl_FragColor.rgb = mix(gl_FragColor.rgb, interiorDebugColor, gridIntensity * 0.1); +#endif + +#include `)},[h]),p=(0,n.useRef)(null),y=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=p.current??y.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let x={DEBUG_MODE:+!!s},S=`${h}`;return u?(0,a.jsx)("meshBasicMaterial",{ref:p,map:d,toneMapped:!1,defines:x,onBeforeCompile:m},S):(0,a.jsx)("meshLambertMaterial",{ref:y,map:d,lightMap:r,toneMapped:!1,defines:x,onBeforeCompile:m},S)}function q(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=o.SRGBColorSpace),t??null}function H(e){let t,i,o,s=(0,r.c)(13),{node:l}=e;e:{let e,a;if(!l.material){let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],s[0]=e):e=s[0],t=e;break e}if(Array.isArray(l.material)){let e;s[1]!==l.material?(e=l.material.map(W),s[1]=l.material,s[2]=e):e=s[2],t=e;break e}s[3]!==l.material?(e=q(l.material),s[3]=l.material,s[4]=e):e=s[4],s[5]!==e?(a=[e],s[5]=e,s[6]=a):a=s[6],t=a}let c=t;return s[7]!==c||s[8]!==l.material?(i=l.material?(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,t)=>(0,a.jsx)(V,{materialName:e.userData.resource_path,material:e,lightMap:c[t]},t)):(0,a.jsx)(V,{materialName:l.material.userData.resource_path,material:l.material,lightMap:c[0]})}):null,s[7]=c,s[8]=l.material,s[9]=i):i=s[9],s[10]!==l.geometry||s[11]!==i?(o=(0,a.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:i}),s[10]=l.geometry,s[11]=i,s[12]=o):o=s[12],o}function W(e){return q(e)}let $=(0,n.memo)(function(e){let t,n,i,o,s,l,d,u=(0,r.c)(10),{object:h,interiorFile:m}=e,{nodes:g}=((l=(0,r.c)(2))[0]!==m?(s=(0,c.interiorToUrl)(m),l[0]=m,l[1]=s):s=l[1],d=s,(0,z.useGLTF)(d)),f=(0,v.useDebug)(),p=f?.debugMode??!1;return u[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],u[0]=t):t=u[0],u[1]!==g?(n=Object.entries(g).filter(Z).map(J),u[1]=g,u[2]=n):n=u[2],u[3]!==p||u[4]!==m||u[5]!==h?(i=p?(0,a.jsxs)(U.FloatingLabel,{children:[h._id,": ",m]}):null,u[3]=p,u[4]=m,u[5]=h,u[6]=i):i=u[6],u[7]!==n||u[8]!==i?(o=(0,a.jsxs)("group",{rotation:t,children:[n,i]}),u[7]=n,u[8]=i,u[9]=o):o=u[9],o});function K(e){let t,n,i,o,s=(0,r.c)(9),{color:l,label:c}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)("boxGeometry",{args:[10,10,10]}),s[0]=t):t=s[0],s[1]!==l?(n=(0,a.jsx)("meshStandardMaterial",{color:l,wireframe:!0}),s[1]=l,s[2]=n):n=s[2],s[3]!==l||s[4]!==c?(i=c?(0,a.jsx)(U.FloatingLabel,{color:l,children:c}):null,s[3]=l,s[4]=c,s[5]=i):i=s[5],s[6]!==n||s[7]!==i?(o=(0,a.jsxs)("mesh",{children:[t,n,i]}),s[6]=n,s[7]=i,s[8]=o):o=s[8],o}function X(e){let t,n=(0,r.c)(3),{label:i}=e,o=(0,v.useDebug)(),s=o?.debugMode??!1;return n[0]!==s||n[1]!==i?(t=s?(0,a.jsx)(K,{color:"red",label:i}):null,n[0]=s,n[1]=i,n[2]=t):t=n[2],t}let Y=(0,n.memo)(function(e){let t,i,o,s,l,c,d,u,h,g=(0,r.c)(22),{object:f}=e;g[0]!==f?(t=(0,m.getProperty)(f,"interiorFile"),g[0]=f,g[1]=t):t=g[1];let p=t;g[2]!==f?(i=(0,m.getPosition)(f),g[2]=f,g[3]=i):i=g[3];let y=i;g[4]!==f?(o=(0,m.getScale)(f),g[4]=f,g[5]=o):o=g[5];let v=o;g[6]!==f?(s=(0,m.getRotation)(f),g[6]=f,g[7]=s):s=g[7];let F=s,b=`${f._id}: ${p}`;return g[8]!==b?(l=(0,a.jsx)(X,{label:b}),g[8]=b,g[9]=l):l=g[9],g[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(K,{color:"orange"}),g[10]=c):c=g[10],g[11]!==p||g[12]!==f?(d=(0,a.jsx)(n.Suspense,{fallback:c,children:(0,a.jsx)($,{object:f,interiorFile:p})}),g[11]=p,g[12]=f,g[13]=d):d=g[13],g[14]!==l||g[15]!==d?(u=(0,a.jsx)(L.ErrorBoundary,{fallback:l,children:d}),g[14]=l,g[15]=d,g[16]=u):u=g[16],g[17]!==y||g[18]!==F||g[19]!==v||g[20]!==u?(h=(0,a.jsx)("group",{position:y,quaternion:F,scale:v,children:u}),g[17]=y,g[18]=F,g[19]=v,g[20]=u,g[21]=h):h=g[21],h});function Z(e){let[,t]=e;return t.isMesh}function J(e){let[t,r]=e;return(0,a.jsx)(H,{node:r},t)}var Q=e.i(99143);function ee(e,{path:t}){let[a]=(0,Q.useLoader)(o.CubeTextureLoader,[e],e=>e.setPath(t));return a}ee.preload=(e,{path:t})=>Q.useLoader.preload(o.CubeTextureLoader,[e],e=>e.setPath(t));let et=()=>{};function ea(e){return e.wrapS=o.RepeatWrapping,e.wrapT=o.RepeatWrapping,e.minFilter=o.LinearFilter,e.magFilter=o.LinearFilter,e.colorSpace=o.NoColorSpace,e.needsUpdate=!0,e}let er=` + attribute float alpha; + + uniform vec2 uvOffset; + + varying vec2 vUv; + varying float vAlpha; + + void main() { + // Apply UV offset for scrolling + vUv = uv + uvOffset; + vAlpha = alpha; + + vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + // Set depth to far plane so clouds are always visible and behind other geometry + gl_Position = pos.xyww; + } +`,en=` + uniform sampler2D cloudTexture; + uniform float debugMode; + uniform int layerIndex; + + varying vec2 vUv; + varying float vAlpha; + + // Debug grid using screen-space derivatives for sharp, anti-aliased lines + float debugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); + } + + void main() { + vec4 texColor = texture2D(cloudTexture, vUv); + + // Tribes 2 uses GL_MODULATE: final = texture \xd7 vertex color + // Vertex color is white with varying alpha, so: + // Final RGB = Texture RGB \xd7 1.0 = Texture RGB + // Final Alpha = Texture Alpha \xd7 Vertex Alpha + float finalAlpha = texColor.a * vAlpha; + vec3 color = texColor.rgb; + + // Debug mode: overlay R/G/B grid for layers 0/1/2 + if (debugMode > 0.5) { + float gridIntensity = debugGrid(vUv, 4.0, 1.5); + vec3 gridColor; + if (layerIndex == 0) { + gridColor = vec3(1.0, 0.0, 0.0); // Red + } else if (layerIndex == 1) { + gridColor = vec3(0.0, 1.0, 0.0); // Green + } else { + gridColor = vec3(0.0, 0.0, 1.0); // Blue + } + color = mix(color, gridColor, gridIntensity * 0.5); + } + + // Output clouds with texture color and combined alpha + gl_FragColor = vec4(color, finalAlpha); + } +`;function ei({textureUrl:e,radius:t,heightPercent:r,speed:i,windDirection:s,layerIndex:l}){let{debugMode:c}=(0,v.useDebug)(),{animationEnabled:d}=(0,v.useSettings)(),h=(0,n.useRef)(null),m=(0,f.useTexture)(e,ea),g=(0,n.useMemo)(()=>{let e=r-.05;return function(e,t,a,r){var n;let i,s,l,c,d,u,h,m,g,f,p,y,v,F,b,x,S,k=new o.BufferGeometry,D=new Float32Array(75),P=new Float32Array(50),w=[.05,.05,.05,.05,.05,.05,a,a,a,.05,.05,a,t,a,.05,.05,a,a,a,.05,.05,.05,.05,.05,.05],C=2*e/4;for(let t=0;t<5;t++)for(let a=0;a<5;a++){let r=5*t+a,n=-e+a*C,i=e-t*C,o=e*w[r];D[3*r]=n,D[3*r+1]=o,D[3*r+2]=i,P[2*r]=a,P[2*r+1]=t}n=D,i=e=>({x:n[3*e],y:n[3*e+1],z:n[3*e+2]}),s=(e,t,a,r)=>{n[3*e]=t,n[3*e+1]=a,n[3*e+2]=r},l=i(1),c=i(3),d=i(5),u=i(6),h=i(8),m=i(9),g=i(15),f=i(16),p=i(18),y=i(19),v=i(21),F=i(23),b=d.x+(l.x-d.x)*.5,x=d.y+(l.y-d.y)*.5,S=d.z+(l.z-d.z)*.5,s(0,u.x+(b-u.x)*2,u.y+(x-u.y)*2,u.z+(S-u.z)*2),b=m.x+(c.x-m.x)*.5,x=m.y+(c.y-m.y)*.5,S=m.z+(c.z-m.z)*.5,s(4,h.x+(b-h.x)*2,h.y+(x-h.y)*2,h.z+(S-h.z)*2),b=v.x+(g.x-v.x)*.5,x=v.y+(g.y-v.y)*.5,S=v.z+(g.z-v.z)*.5,s(20,f.x+(b-f.x)*2,f.y+(x-f.y)*2,f.z+(S-f.z)*2),b=F.x+(y.x-F.x)*.5,x=F.y+(y.y-F.y)*.5,S=F.z+(y.z-F.z)*.5,s(24,p.x+(b-p.x)*2,p.y+(x-p.y)*2,p.z+(S-p.z)*2);let I=function(e,t){let a=new Float32Array(25);for(let r=0;r<25;r++){let n=e[3*r],i=e[3*r+2],o=1.3-Math.sqrt(n*n+i*i)/t;o<.4?o=0:o>.8&&(o=1),a[r]=o}return a}(D,e),M=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let a=5*e+t,r=a+1,n=a+5,i=n+1;M.push(a,n,i),M.push(a,i,r)}return k.setIndex(M),k.setAttribute("position",new o.Float32BufferAttribute(D,3)),k.setAttribute("uv",new o.Float32BufferAttribute(P,2)),k.setAttribute("alpha",new o.Float32BufferAttribute(I,1)),k.computeBoundingSphere(),k}(t,r,e,0)},[t,r]);(0,n.useEffect)(()=>()=>{g.dispose()},[g]);let p=(0,n.useMemo)(()=>new o.ShaderMaterial({uniforms:{cloudTexture:{value:m},uvOffset:{value:new o.Vector2(0,0)},debugMode:{value:+!!c},layerIndex:{value:l}},vertexShader:er,fragmentShader:en,transparent:!0,depthWrite:!1,side:o.DoubleSide}),[m,c,l]);return(0,n.useEffect)(()=>()=>{p.dispose()},[p]),(0,u.useFrame)(d?(e,t)=>{let a=1e3*t/32;h.current??=new o.Vector2(0,0),h.current.x+=s.x*i*a,h.current.y+=s.y*i*a,h.current.x-=Math.floor(h.current.x),h.current.y-=Math.floor(h.current.y),p.uniforms.uvOffset.value.copy(h.current)}:et),(0,a.jsx)("mesh",{geometry:g,frustumCulled:!1,renderOrder:10,children:(0,a.jsx)("primitive",{object:p,attach:"material"})})}function eo(e){var t;let i,l,d,h,g,f,p,y,v,F,b,x,S,k,D,P,w,C,I,M=(0,r.c)(37),{object:E}=e;M[0]!==E?(i=(0,m.getProperty)(E,"materialList"),M[0]=E,M[1]=i):i=M[1];let{data:T}=(t=i,(C=(0,r.c)(7))[0]!==t?(D=["detailMapList",t],P=()=>(0,c.loadDetailMapList)(t),C[0]=t,C[1]=D,C[2]=P):(D=C[1],P=C[2]),I=!!t,C[3]!==D||C[4]!==P||C[5]!==I?(w={queryKey:D,queryFn:P,enabled:I},C[3]=D,C[4]=P,C[5]=I,C[6]=w):w=C[6],(0,s.useQuery)(w));M[2]!==E?(l=(0,m.getFloat)(E,"visibleDistance")??500,M[2]=E,M[3]=l):l=M[3];let B=.95*l;M[4]!==E?(d=(0,m.getFloat)(E,"cloudSpeed1")??1e-4,M[4]=E,M[5]=d):d=M[5],M[6]!==E?(h=(0,m.getFloat)(E,"cloudSpeed2")??2e-4,M[6]=E,M[7]=h):h=M[7],M[8]!==E?(g=(0,m.getFloat)(E,"cloudSpeed3")??3e-4,M[8]=E,M[9]=g):g=M[9],M[10]!==d||M[11]!==h||M[12]!==g?(f=[d,h,g],M[10]=d,M[11]=h,M[12]=g,M[13]=f):f=M[13];let j=f;M[14]!==E?(p=(0,m.getFloat)(E,"cloudHeightPer1")??.35,M[14]=E,M[15]=p):p=M[15],M[16]!==E?(y=(0,m.getFloat)(E,"cloudHeightPer2")??.25,M[16]=E,M[17]=y):y=M[17],M[18]!==E?(v=(0,m.getFloat)(E,"cloudHeightPer3")??.2,M[18]=E,M[19]=v):v=M[19],M[20]!==p||M[21]!==y||M[22]!==v?(F=[p,y,v],M[20]=p,M[21]=y,M[22]=v,M[23]=F):F=M[23];let _=F;if(M[24]!==E){e:{let e,t=(0,m.getProperty)(E,"windVelocity");if(t){let[e,a]=t.split(" ").map(es);if(0!==e||0!==a){b=new o.Vector2(a,-e).normalize();break e}}M[26]===Symbol.for("react.memo_cache_sentinel")?(e=new o.Vector2(1,0),M[26]=e):e=M[26],b=e}M[24]=E,M[25]=b}else b=M[25];let R=b;t:{let e;if(!T){let e;M[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],M[27]=e):e=M[27],x=e;break t}if(M[28]!==_||M[29]!==j||M[30]!==T){e=[];for(let t=0;t<3;t++){let a=T[7+t];a&&e.push({texture:a,height:_[t],speed:j[t]})}M[28]=_,M[29]=j,M[30]=T,M[31]=e}else e=M[31];x=e}let N=x,A=(0,n.useRef)(null);return(M[32]===Symbol.for("react.memo_cache_sentinel")?(S=e=>{let{camera:t}=e;A.current&&A.current.position.copy(t.position)},M[32]=S):S=M[32],(0,u.useFrame)(S),N&&0!==N.length)?(M[33]!==N||M[34]!==B||M[35]!==R?(k=(0,a.jsx)("group",{ref:A,children:N.map((e,t)=>{let r=(0,c.textureToUrl)(e.texture);return(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(ei,{textureUrl:r,radius:B,heightPercent:e.height,speed:e.speed,windDirection:R,layerIndex:t})},t)})}),M[33]=N,M[34]=B,M[35]=R,M[36]=k):k=M[36],k):null}function es(e){return parseFloat(e)}let el=!1;function ec(e){if(!e)return;let[t,a,r]=e.split(" ").map(e=>parseFloat(e));return[new o.Color().setRGB(t,a,r),new o.Color().setRGB(t,a,r).convertSRGBToLinear()]}function ed({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:i}=(0,h.useThree)(),s=ee(e,{path:""}),l=!!t,c=(0,n.useMemo)(()=>i.projectionMatrixInverse,[i]),d=(0,n.useMemo)(()=>r?(0,b.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),u=(0,n.useRef)({skybox:{value:s},fogColor:{value:t??new o.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:c},cameraMatrixWorld:{value:i.matrixWorld},cameraHeight:b.globalFogUniforms.cameraHeight,fogVolumeData:{value:d},horizonFogHeight:{value:.18}}),m=(0,n.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,n.useEffect)(()=>{u.current.skybox.value=s,u.current.fogColor.value=t??new o.Color(0,0,0),u.current.enableFog.value=l,u.current.fogVolumeData.value=d,u.current.horizonFogHeight.value=m},[s,t,l,d,m]),(0,a.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,a.jsxs)("bufferGeometry",{children:[(0,a.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,a.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,a.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` + varying vec2 vUv; + + void main() { + vUv = uv; + gl_Position = vec4(position.xy, 0.9999, 1.0); + } + `,fragmentShader:` + uniform samplerCube skybox; + uniform vec3 fogColor; + uniform bool enableFog; + uniform mat4 inverseProjectionMatrix; + uniform mat4 cameraMatrixWorld; + uniform float cameraHeight; + uniform float fogVolumeData[12]; + uniform float horizonFogHeight; + + varying vec2 vUv; + + // Convert linear to sRGB for display + // shaderMaterial does NOT get automatic linear->sRGB output conversion + // Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js + vec3 linearToSRGB(vec3 linear) { + vec3 low = linear * 12.92; + vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; + return mix(low, high, step(vec3(0.0031308), linear)); + } + + void main() { + vec2 ndc = vUv * 2.0 - 1.0; + vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); + viewPos.xyz /= viewPos.w; + vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); + direction = vec3(direction.z, direction.y, -direction.x); + // Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear + vec4 skyColor = textureCube(skybox, direction); + vec3 finalColor; + + if (enableFog) { + vec3 effectiveFogColor = fogColor; + + // Calculate how much fog volume the ray passes through + // For skybox at "infinite" distance, the relevant height is how much + // of the volume is above/below camera depending on view direction + float volumeFogInfluence = 0.0; + + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // Check if camera is inside this volume + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + // Camera is inside the fog volume + // Looking horizontally or up at shallow angles means ray travels + // through more fog before exiting the volume + float heightAboveCamera = volMaxH - cameraHeight; + float heightBelowCamera = cameraHeight - volMinH; + float volumeHeight = volMaxH - volMinH; + + // For horizontal rays (direction.y ≈ 0), maximum fog influence + // For rays going up steeply, less fog (exits volume quickly) + // For rays going down, more fog (travels through volume below) + float rayInfluence; + if (direction.y >= 0.0) { + // Looking up: influence based on how steep we're looking + // Shallow angles = long path through fog = high influence + rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); + } else { + // Looking down: always high fog (into the volume) + rayInfluence = 1.0; + } + + // Scale by percentage and volume depth factor + volumeFogInfluence += rayInfluence * volPct; + } + } + + // Base fog factor from view direction (for haze at horizon) + // In Torque, the fog "bans" (bands) are rendered as geometry from + // height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox. + // The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3). + // + // horizonFogHeight is the direction.y value where the fog band ends: + // horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2) + // + // For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18 + // + // Torque renders the fog bands as geometry with linear vertex alpha + // interpolation. We use a squared curve (t^2) to create a gentler + // falloff at the top of the gradient, matching Tribes 2's appearance. + float baseFogFactor; + if (direction.y <= 0.0) { + // Looking at or below horizon: full fog + baseFogFactor = 1.0; + } else if (direction.y >= horizonFogHeight) { + // Above fog band: no fog + baseFogFactor = 0.0; + } else { + // Within fog band: squared curve for gentler falloff at top + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); + } + + // Combine base fog with volume fog influence + // When inside a volume, increase fog intensity + float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); + + finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor); + } else { + finalColor = skyColor.rgb; + } + // Convert linear result to sRGB for display + gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); + } + `,depthWrite:!1,depthTest:!1})]})}function eu(e){let t,n,i,o,l=(0,r.c)(6),{materialList:d,fogColor:u,fogState:h}=e,{data:m}=((o=(0,r.c)(2))[0]!==d?(i={queryKey:["detailMapList",d],queryFn:()=>(0,c.loadDetailMapList)(d)},o[0]=d,o[1]=i):i=o[1],(0,s.useQuery)(i));l[0]!==m?(t=m?[(0,c.textureToUrl)(m[1]),(0,c.textureToUrl)(m[3]),(0,c.textureToUrl)(m[4]),(0,c.textureToUrl)(m[5]),(0,c.textureToUrl)(m[0]),(0,c.textureToUrl)(m[2])]:null,l[0]=m,l[1]=t):t=l[1];let g=t;return g?(l[2]!==u||l[3]!==h||l[4]!==g?(n=(0,a.jsx)(ed,{skyBoxFiles:g,fogColor:u,fogState:h}),l[2]=u,l[3]=h,l[4]=g,l[5]=n):n=l[5],n):null}function eh({skyColor:e,fogColor:t,fogState:r}){let{camera:i}=(0,h.useThree)(),s=!!t,l=(0,n.useMemo)(()=>i.projectionMatrixInverse,[i]),c=(0,n.useMemo)(()=>r?(0,b.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),d=(0,n.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),u=(0,n.useRef)({skyColor:{value:e},fogColor:{value:t??new o.Color(0,0,0)},enableFog:{value:s},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:i.matrixWorld},cameraHeight:b.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:d}});return(0,n.useEffect)(()=>{u.current.skyColor.value=e,u.current.fogColor.value=t??new o.Color(0,0,0),u.current.enableFog.value=s,u.current.fogVolumeData.value=c,u.current.horizonFogHeight.value=d},[e,t,s,c,d]),(0,a.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,a.jsxs)("bufferGeometry",{children:[(0,a.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,a.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,a.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` + varying vec2 vUv; + + void main() { + vUv = uv; + gl_Position = vec4(position.xy, 0.9999, 1.0); + } + `,fragmentShader:` + uniform vec3 skyColor; + uniform vec3 fogColor; + uniform bool enableFog; + uniform mat4 inverseProjectionMatrix; + uniform mat4 cameraMatrixWorld; + uniform float cameraHeight; + uniform float fogVolumeData[12]; + uniform float horizonFogHeight; + + varying vec2 vUv; + + // Convert linear to sRGB for display + vec3 linearToSRGB(vec3 linear) { + vec3 low = linear * 12.92; + vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; + return mix(low, high, step(vec3(0.0031308), linear)); + } + + void main() { + vec2 ndc = vUv * 2.0 - 1.0; + vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); + viewPos.xyz /= viewPos.w; + vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); + direction = vec3(direction.z, direction.y, -direction.x); + + vec3 finalColor; + + if (enableFog) { + // Calculate volume fog influence (same logic as SkyBoxTexture) + float volumeFogInfluence = 0.0; + + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float rayInfluence; + if (direction.y >= 0.0) { + rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); + } else { + rayInfluence = 1.0; + } + volumeFogInfluence += rayInfluence * volPct; + } + } + + // Base fog factor from view direction + float baseFogFactor; + if (direction.y <= 0.0) { + baseFogFactor = 1.0; + } else if (direction.y >= horizonFogHeight) { + baseFogFactor = 0.0; + } else { + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); + } + + // Combine base fog with volume fog influence + float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); + + finalColor = mix(skyColor, fogColor, finalFogFactor); + } else { + finalColor = skyColor; + } + + gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); + } + `,depthWrite:!1,depthTest:!1})]})}function em(e,t){let{fogDistance:a,visibleDistance:r}=e;return[a,r]}function eg({fogState:e,enabled:t}){let{scene:a,camera:r}=(0,h.useThree)(),i=(0,n.useRef)(null),s=(0,n.useMemo)(()=>(0,b.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,n.useEffect)(()=>{el||((0,F.installCustomFogShader)(),el=!0)},[]),(0,n.useEffect)(()=>{(0,b.resetGlobalFogUniforms)();let[t,n]=em(e,r.position.y),l=new o.Fog(e.fogColor,t,n);return a.fog=l,i.current=l,(0,b.updateGlobalFogUniforms)(r.position.y,s),()=>{a.fog=null,i.current=null,(0,b.resetGlobalFogUniforms)()}},[a,r,e,s]),(0,n.useEffect)(()=>{let a=i.current;if(a)if(t){let[t,n]=em(e,r.position.y);a.near=t,a.far=n}else a.near=1e10,a.far=1e10},[t,e,r.position.y]),(0,u.useFrame)(()=>{let a=i.current;if(!a)return;let n=r.position.y;if((0,b.updateGlobalFogUniforms)(n,s,t),t){let[t,r]=em(e,n);a.near=t,a.far=r,a.color.copy(e.fogColor)}}),null}function ef(e){return parseFloat(e)}function ep(e){return parseFloat(e)}function ey(e){return parseFloat(e)}var ev=e.i(91907),eF=e.i(25947),eb=e.i(6112);let ex={1:"Storm",2:"Inferno"},eS=(0,n.createContext)(null);function ek(){let e=(0,n.useContext)(eS);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function eD({children:e}){let{camera:t}=(0,h.useThree)(),[r,i]=(0,n.useState)(-1),[s,l]=(0,n.useState)({}),[c,d]=(0,n.useState)(()=>({initialized:!1,position:null,quarternion:null})),u=(0,n.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),m=(0,n.useCallback)(e=>{l(t=>{let{[e.id]:a,...r}=t;return r})},[]),g=Object.keys(s).length,f=(0,n.useCallback)(e=>{if(e>=0&&e{f(g?(r+1)%g:-1)},[g,r,f]);(0,n.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,a]=e.slice(2).split("~"),r=t.split(",").map(e=>parseFloat(e)),n=a.split(",").map(e=>parseFloat(e));d({initialized:!0,position:new o.Vector3(...r),quarternion:new o.Quaternion(...n)})}else d({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,n.useEffect)(()=>{c.initialized&&c.position&&(t.position.copy(c.position),c.quarternion&&t.quaternion.copy(c.quarternion))},[t,c]),(0,n.useEffect)(()=>{c.initialized&&!c.position&&g>0&&-1===r&&f(0)},[g,f,r,c]);let y=(0,n.useMemo)(()=>({registerCamera:u,unregisterCamera:m,nextCamera:p,setCameraIndex:f,cameraCount:g}),[u,m,p,f,g]);return 0===g&&-1!==r&&i(-1),(0,a.jsx)(eS.Provider,{value:y,children:e})}let eP=(0,n.createContext)(null),ew=eP.Provider,eC=(0,n.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),eI={AudioEmitter:function(e){let t,n=(0,r.c)(3),{audioEnabled:i}=(0,v.useSettings)();return n[0]!==i||n[1]!==e?(t=i?(0,a.jsx)(eC,{...e}):null,n[0]=i,n[1]=e,n[2]=t):t=n[2],t},Camera:function(e){let t,a,i,s,l,c=(0,r.c)(14),{object:d}=e,{registerCamera:u,unregisterCamera:h}=ek(),g=(0,n.useId)();c[0]!==d?(t=(0,m.getProperty)(d,"dataBlock"),c[0]=d,c[1]=t):t=c[1];let f=t;c[2]!==d?(a=(0,m.getPosition)(d),c[2]=d,c[3]=a):a=c[3];let p=a;c[4]!==d?(i=(0,m.getRotation)(d),c[4]=d,c[5]=i):i=c[5];let y=i;return c[6]!==f||c[7]!==g||c[8]!==p||c[9]!==y||c[10]!==u||c[11]!==h?(s=()=>{if("Observer"===f){let e={id:g,position:new o.Vector3(...p),rotation:y};return u(e),()=>{h(e)}}},l=[g,f,u,h,p,y],c[6]=f,c[7]=g,c[8]=p,c[9]=y,c[10]=u,c[11]=h,c[12]=s,c[13]=l):(s=c[12],l=c[13]),(0,n.useEffect)(s,l),null},ForceFieldBare:(0,n.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:Y,Item:function(e){let t,i,o,s,l,c,d,h,g,f,p,y,F=(0,r.c)(32),{object:b}=e,x=A();F[0]!==b?(t=(0,m.getProperty)(b,"dataBlock")??"",F[0]=b,F[1]=t):t=F[1];let S=t,k=(0,eb.useDatablock)(S);F[2]!==k||F[3]!==b?(i=function(e){if("string"==typeof e){let t=e.toLowerCase();return"0"!==t&&"false"!==t&&""!==t}return!!e}((0,m.getProperty)(b,"rotate")??(0,m.getProperty)(k,"rotate")),F[2]=k,F[3]=b,F[4]=i):i=F[4];let D=i;F[5]!==b?(o=(0,m.getPosition)(b),F[5]=b,F[6]=o):o=F[6];let P=o;F[7]!==b?(s=(0,m.getScale)(b),F[7]=b,F[8]=s):s=F[8];let w=s;F[9]!==b?(l=(0,m.getRotation)(b),F[9]=b,F[10]=l):l=F[10];let C=l,{animationEnabled:I}=(0,v.useSettings)(),M=(0,n.useRef)(null);F[11]!==I||F[12]!==D?(c=()=>{if(!M.current||!D||!I)return;let e=performance.now()/1e3;M.current.rotation.y=e/3*Math.PI*2},F[11]=I,F[12]=D,F[13]=c):c=F[13],(0,u.useFrame)(c),F[14]!==k?(d=(0,m.getProperty)(k,"shapeFile"),F[14]=k,F[15]=d):d=F[15];let E=d;E||console.error(` missing shape for datablock: ${S}`);let T=S?.toLowerCase()==="flag",B=x?.team??null,j=B&&B>0?ex[B]:null,_=T&&j?`${j} Flag`:null;return F[16]!==C||F[17]!==D?(h=!D&&{quaternion:C},F[16]=C,F[17]=D,F[18]=h):h=F[18],F[19]!==_?(g=_?(0,a.jsx)(U.FloatingLabel,{opacity:.6,children:_}):null,F[19]=_,F[20]=g):g=F[20],F[21]!==g?(f=(0,a.jsx)(ev.ShapeRenderer,{loadingColor:"pink",children:g}),F[21]=g,F[22]=f):f=F[22],F[23]!==P||F[24]!==w||F[25]!==f||F[26]!==h?(p=(0,a.jsx)("group",{ref:M,position:P,...h,scale:w,children:f}),F[23]=P,F[24]=w,F[25]=f,F[26]=h,F[27]=p):p=F[27],F[28]!==b||F[29]!==E||F[30]!==p?(y=(0,a.jsx)(eF.ShapeInfoProvider,{type:"Item",object:b,shapeName:E,children:p}),F[28]=b,F[29]=E,F[30]=p,F[31]=y):y=F[31],y},SimGroup:function(e){let t,n,i,o,s=(0,r.c)(17),{object:l}=e,c=(0,P.useRuntimeObjectById)(l._id)??l,d=A();s[0]!==c._children?(t=c._children??[],s[0]=c._children,s[1]=t):t=s[1];let u=(0,P.useRuntimeChildIds)(c._id,t),h=null,m=!1;if(d&&d.hasTeams){if(m=!0,null!=d.team)h=d.team;else if(c._name){let e;if(s[2]!==c._name){let t;s[4]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,s[4]=t):t=s[4],e=c._name.match(t),s[2]=c._name,s[3]=e}else e=s[3];let t=e;t&&(h=parseInt(t[1],10))}}else if(c._name){let e;s[5]!==c._name?(e=c._name.toLowerCase(),s[5]=c._name,s[6]=e):e=s[6],m="teams"===e}s[7]!==m||s[8]!==c||s[9]!==d||s[10]!==h?(n={object:c,parent:d,hasTeams:m,team:h},s[7]=m,s[8]=c,s[9]=d,s[10]=h,s[11]=n):n=s[11];let g=n;return s[12]!==u?(i=u.map(G),s[12]=u,s[13]=i):i=s[13],s[14]!==g||s[15]!==i?(o=(0,a.jsx)(N.Provider,{value:g,children:i}),s[14]=g,s[15]=i,s[16]=o):o=s[16],o},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,v.useSettings)(),i=(0,m.getProperty)(e,"materialList"),s=(0,n.useMemo)(()=>ec((0,m.getProperty)(e,"SkySolidColor")),[e]),l=(0,m.getInt)(e,"useSkyTextures")??1,c=(0,n.useMemo)(()=>(function(e,t=!0){let a=(0,m.getFloat)(e,"fogDistance")??0,r=(0,m.getFloat)(e,"visibleDistance")??1e3,n=(0,m.getFloat)(e,"high_fogDistance"),i=(0,m.getFloat)(e,"high_visibleDistance"),s=t&&null!=n&&n>0?n:a,l=t&&null!=i&&i>0?i:r,c=function(e){if(!e)return new o.Color(.5,.5,.5);let[t,a,r]=e.split(" ").map(e=>parseFloat(e));return new o.Color().setRGB(t,a,r).convertSRGBToLinear()}((0,m.getProperty)(e,"fogColor")),d=[];for(let t=1;t<=3;t++){let a=function(e,t=1){if(!e)return null;let a=e.split(" ").map(e=>parseFloat(e));if(a.length<3)return null;let[r,n,i]=a;return r<=0||i<=n?null:{visibleDistance:r,minHeight:n,maxHeight:i,percentage:Math.max(0,Math.min(1,t))}}((0,m.getProperty)(e,`fogVolume${t}`),1);a&&d.push(a)}let u=d.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:s,visibleDistance:l,fogColor:c,fogVolumes:d,fogLine:u,enabled:l>s}})(e,r),[e,r]),d=(0,n.useMemo)(()=>ec((0,m.getProperty)(e,"fogColor")),[e]),u=s||d,g=c.enabled&&t,f=c.fogColor,{scene:p,gl:y}=(0,h.useThree)();(0,n.useEffect)(()=>{if(g){let e=f.clone();p.background=e,y.setClearColor(e)}else if(u){let e=u[0].clone();p.background=e,y.setClearColor(e)}else p.background=null;return()=>{p.background=null}},[p,y,g,f,u]);let F=s?.[1];return(0,a.jsxs)(a.Fragment,{children:[i&&l?(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(eu,{materialList:i,fogColor:g?f:void 0,fogState:g?c:void 0},i)}):F?(0,a.jsx)(eh,{skyColor:F,fogColor:g?f:void 0,fogState:g?c:void 0}):null,(0,a.jsx)(n.Suspense,{children:(0,a.jsx)(eo,{object:e})}),c.enabled?(0,a.jsx)(eg,{fogState:c,enabled:t}):null]})},StaticShape:function(e){let t,n,i,o,s,l,c,d,u=(0,r.c)(19),{object:h}=e;u[0]!==h?(t=(0,m.getProperty)(h,"dataBlock")??"",u[0]=h,u[1]=t):t=u[1];let g=t,f=(0,eb.useDatablock)(g);u[2]!==h?(n=(0,m.getPosition)(h),u[2]=h,u[3]=n):n=u[3];let p=n;u[4]!==h?(i=(0,m.getRotation)(h),u[4]=h,u[5]=i):i=u[5];let y=i;u[6]!==h?(o=(0,m.getScale)(h),u[6]=h,u[7]=o):o=u[7];let v=o;u[8]!==f?(s=(0,m.getProperty)(f,"shapeFile"),u[8]=f,u[9]=s):s=u[9];let F=s;return F||console.error(` missing shape for datablock: ${g}`),u[10]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(ev.ShapeRenderer,{}),u[10]=l):l=u[10],u[11]!==p||u[12]!==y||u[13]!==v?(c=(0,a.jsx)("group",{position:p,quaternion:y,scale:v,children:l}),u[11]=p,u[12]=y,u[13]=v,u[14]=c):c=u[14],u[15]!==h||u[16]!==F||u[17]!==c?(d=(0,a.jsx)(eF.ShapeInfoProvider,{type:"StaticShape",object:h,shapeName:F,children:c}),u[15]=h,u[16]=F,u[17]=c,u[18]=d):d=u[18],d},Sun:function(e){let t,i,s,l,c,d,u,h,g,f,y=(0,r.c)(25),{object:v}=e;y[0]!==v?(t=((0,m.getProperty)(v,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(ey),y[0]=v,y[1]=t):t=y[1];let[F,b,x]=t,S=Math.sqrt(F*F+x*x+b*b),k=F/S,D=x/S,P=b/S;y[2]!==k||y[3]!==D||y[4]!==P?(i=new o.Vector3(k,D,P),y[2]=k,y[3]=D,y[4]=P,y[5]=i):i=y[5];let w=i,C=-(5e3*w.x),I=-(5e3*w.y),M=-(5e3*w.z);y[6]!==C||y[7]!==I||y[8]!==M?(s=new o.Vector3(C,I,M),y[6]=C,y[7]=I,y[8]=M,y[9]=s):s=y[9];let E=s;if(y[10]!==v){let[e,t,a]=((0,m.getProperty)(v,"color")??"0.7 0.7 0.7 1").split(" ").map(ep);l=new o.Color(e,t,a),y[10]=v,y[11]=l}else l=y[11];let T=l;if(y[12]!==v){let[e,t,a]=((0,m.getProperty)(v,"ambient")??"0.5 0.5 0.5 1").split(" ").map(ef);c=new o.Color(e,t,a),y[12]=v,y[13]=c}else c=y[13];let B=c,j=w.y<0;return y[14]!==j?(d=()=>{p.value=j},u=[j],y[14]=j,y[15]=d,y[16]=u):(d=y[15],u=y[16]),(0,n.useEffect)(d,u),y[17]!==T||y[18]!==E?(h=(0,a.jsx)("directionalLight",{position:E,color:T,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),y[17]=T,y[18]=E,y[19]=h):h=y[19],y[20]!==B?(g=(0,a.jsx)("ambientLight",{color:B,intensity:1}),y[20]=B,y[21]=g):g=y[21],y[22]!==h||y[23]!==g?(f=(0,a.jsxs)(a.Fragment,{children:[h,g]}),y[22]=h,y[23]=g,y[24]=f):f=y[24],f},TerrainBlock:M,TSStatic:function(e){let t,n,i,o,s,l,c,d=(0,r.c)(17),{object:u}=e;d[0]!==u?(t=(0,m.getProperty)(u,"shapeName"),d[0]=u,d[1]=t):t=d[1];let h=t;d[2]!==u?(n=(0,m.getPosition)(u),d[2]=u,d[3]=n):n=d[3];let g=n;d[4]!==u?(i=(0,m.getRotation)(u),d[4]=u,d[5]=i):i=d[5];let f=i;d[6]!==u?(o=(0,m.getScale)(u),d[6]=u,d[7]=o):o=d[7];let p=o;return h||console.error(" missing shapeName for object",u),d[8]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(ev.ShapeRenderer,{}),d[8]=s):s=d[8],d[9]!==g||d[10]!==f||d[11]!==p?(l=(0,a.jsx)("group",{position:g,quaternion:f,scale:p,children:s}),d[9]=g,d[10]=f,d[11]=p,d[12]=l):l=d[12],d[13]!==u||d[14]!==h||d[15]!==l?(c=(0,a.jsx)(eF.ShapeInfoProvider,{type:"TSStatic",object:u,shapeName:h,children:l}),d[13]=u,d[14]=h,d[15]=l,d[16]=c):c=d[16],c},Turret:function(e){let t,n,i,o,s,l,c,d,u,h,g,f=(0,r.c)(27),{object:p}=e;f[0]!==p?(t=(0,m.getProperty)(p,"dataBlock")??"",f[0]=p,f[1]=t):t=f[1];let y=t;f[2]!==p?(n=(0,m.getProperty)(p,"initialBarrel"),f[2]=p,f[3]=n):n=f[3];let v=n,F=(0,eb.useDatablock)(y),b=(0,eb.useDatablock)(v);f[4]!==p?(i=(0,m.getPosition)(p),f[4]=p,f[5]=i):i=f[5];let x=i;f[6]!==p?(o=(0,m.getRotation)(p),f[6]=p,f[7]=o):o=f[7];let S=o;f[8]!==p?(s=(0,m.getScale)(p),f[8]=p,f[9]=s):s=f[9];let k=s;f[10]!==F?(l=(0,m.getProperty)(F,"shapeFile"),f[10]=F,f[11]=l):l=f[11];let D=l;f[12]!==b?(c=(0,m.getProperty)(b,"shapeFile"),f[12]=b,f[13]=c):c=f[13];let P=c;return D||console.error(` missing shape for datablock: ${y}`),v&&!P&&console.error(` missing shape for barrel datablock: ${v}`),f[14]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(ev.ShapeRenderer,{}),f[14]=d):d=f[14],f[15]!==P||f[16]!==p?(u=P?(0,a.jsx)(eF.ShapeInfoProvider,{type:"Turret",object:p,shapeName:P,children:(0,a.jsx)("group",{position:[0,1.5,0],children:(0,a.jsx)(ev.ShapeRenderer,{})})}):null,f[15]=P,f[16]=p,f[17]=u):u=f[17],f[18]!==x||f[19]!==S||f[20]!==k||f[21]!==u?(h=(0,a.jsxs)("group",{position:x,quaternion:S,scale:k,children:[d,u]}),f[18]=x,f[19]=S,f[20]=k,f[21]=u,f[22]=h):h=f[22],f[23]!==p||f[24]!==D||f[25]!==h?(g=(0,a.jsx)(eF.ShapeInfoProvider,{type:"Turret",object:p,shapeName:D,children:h}),f[23]=p,f[24]=D,f[25]=h,f[26]=g):g=f[26],g},WaterBlock:(0,n.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,n,i,o=(0,r.c)(7),{object:s}=e;o[0]!==s?(t=(0,m.getPosition)(s),o[0]=s,o[1]=t):t=o[1];let l=t;o[2]!==s?(n=(0,m.getProperty)(s,"name"),o[2]=s,o[3]=n):n=o[3];let c=n;return o[4]!==c||o[5]!==l?(i=c?(0,a.jsx)(U.FloatingLabel,{position:l,opacity:.6,children:c}):null,o[4]=c,o[5]=l,o[6]=i):i=o[6],i}},eM=new Set(["ForceFieldBare","Item","StaticShape","Turret"]);function eE(e){let t,i,o,s=(0,r.c)(13),{object:l,objectId:c}=e,d=(0,P.useRuntimeObjectById)(c??l?._id)??l,{missionType:u}=(0,n.useContext)(eP),h=(0,P.useEngineSelector)(eT);e:{let e,a;if(!d){t=!1;break e}s[0]!==d?(e=new Set(((0,m.getProperty)(d,"missionTypesList")??"").toLowerCase().split(/\s+/).filter(Boolean)),s[0]=d,s[1]=e):e=s[1];let r=e;s[2]!==u||s[3]!==r?(a=!r.size||r.has(u.toLowerCase()),s[2]=u,s[3]=r,s[4]=a):a=s[4],t=a}let g=t;if(!d)return null;let f=eI[d._className];s[5]!==h||s[6]!==d._className?(i=h&&eM.has(d._className),s[5]=h,s[6]=d._className,s[7]=i):i=s[7];let p=i;return s[8]!==f||s[9]!==p||s[10]!==d||s[11]!==g?(o=g&&f?(0,a.jsx)(n.Suspense,{children:!p&&(0,a.jsx)(f,{object:d})}):null,s[8]=f,s[9]=p,s[10]=d,s[11]=g,s[12]=o):o=s[12],o}function eT(e){return null!=e.playback.recording}var eB=e.i(51475);let ej=(0,n.createContext)(null);function e_(e){let t,n,i=(0,r.c)(5),{runtime:o,children:s}=e;return i[0]!==s?(t=(0,a.jsx)(eB.TickProvider,{children:s}),i[0]=s,i[1]=t):t=i[1],i[2]!==o||i[3]!==t?(n=(0,a.jsx)(ej.Provider,{value:o,children:t}),i[2]=o,i[3]=t,i[4]=n):n=i[4],n}var eR=e.i(86608),eN=e.i(38433),eA=e.i(33870),eG=e.i(91996),eL=e.i(7368);let ez=(0,d.createScriptLoader)(),eU=(0,eA.createScriptCache)(),eO={findFiles:e=>{let t=(0,l.default)(e,{nocase:!0});return(0,eG.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,eG.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,eG.getResourceMap)()[(0,eG.getResourceKey)(e)]};function eV(e){"batch.flushed"===e.type&&P.engineStore.getState().applyRuntimeBatch(e.events,{tick:e.tick})}function eq(e){e instanceof Error&&"AbortError"===e.name||console.error("Mission runtime failed to become ready:",e)}let eH=(0,n.memo)(function(e){let t,i,o,l,d,u,h,m,g=(0,r.c)(17),{name:f,missionType:p,onLoadingChange:y}=e,{data:v}=((m=(0,r.c)(2))[0]!==f?(h={queryKey:["parsedMission",f],queryFn:()=>(0,c.loadMission)(f)},m[0]=f,m[1]=h):h=m[1],(0,s.useQuery)(h)),{missionGroup:F,runtime:b,progress:x}=function(e,t,a){let i,o,s,l=(0,r.c)(6);l[0]===Symbol.for("react.memo_cache_sentinel")?(i={missionGroup:void 0,runtime:void 0,progress:0},l[0]=i):i=l[0];let[c,d]=(0,n.useState)(i);return l[1]!==e||l[2]!==t||l[3]!==a?(o=()=>{if(!a)return;let r=new AbortController,n=!1,i=null,o=(0,eN.createProgressTracker)(),s=()=>{d(e=>({...e,progress:o.progress}))};o.on("update",s);let{runtime:l,ready:c}=(0,eR.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:ez,fileSystem:eO,cache:eU,signal:r.signal,progress:o,ignoreScripts:eL.ignoreScripts}});return c.then(()=>{n||r.signal.aborted||(P.engineStore.getState().setRuntime(l),d({missionGroup:l.getObjectByName("MissionGroup"),runtime:l,progress:1}))}).catch(eq),i=l.subscribeRuntimeEvents(eV),P.engineStore.getState().setRuntime(l),()=>{n=!0,o.off("update",s),r.abort(),i?.(),P.engineStore.getState().clearRuntime(),l.destroy()}},s=[e,t,a],l[1]=e,l[2]=t,l[3]=a,l[4]=o,l[5]=s):(o=l[4],s=l[5]),(0,n.useEffect)(o,s),c}(f,p,v),S=!v||!F||!b;g[0]!==F||g[1]!==p||g[2]!==v?(t={metadata:v,missionType:p,missionGroup:F},g[0]=F,g[1]=p,g[2]=v,g[3]=t):t=g[3];let k=t;return(g[4]!==S||g[5]!==y||g[6]!==x?(i=()=>{y?.(S,x)},o=[S,x,y],g[4]=S,g[5]=y,g[6]=x,g[7]=i,g[8]=o):(i=g[7],o=g[8]),(0,n.useEffect)(i,o),S)?null:(g[9]!==F?(l=(0,a.jsx)(eE,{object:F}),g[9]=F,g[10]=l):l=g[10],g[11]!==b||g[12]!==l?(d=(0,a.jsx)(e_,{runtime:b,children:l}),g[11]=b,g[12]=l,g[13]=d):d=g[13],g[14]!==k||g[15]!==d?(u=(0,a.jsx)(ew,{value:k,children:d}),g[14]=k,g[15]=d,g[16]=u):u=g[16],u)});var eW=e.i(17751),e$=e.i(12598),eK=e.i(8155);let eX=e=>{let t=(0,eK.createStore)(e),a=e=>(function(e,t=e=>e){let a=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),n.default.useCallback(()=>t(e.getInitialState()),[e,t]));return n.default.useDebugValue(a),a})(t,e);return Object.assign(a,t),a};var eY=e.i(79473);let eZ=n.createContext(null);function eJ({map:e,children:t,onChange:a,domElement:r}){let i=e.map(e=>e.name+e.keys).join("-"),o=n.useMemo(()=>{let t;return(t=(0,eY.subscribeWithSelector)(()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{})))?eX(t):eX},[i]),s=n.useMemo(()=>[o.subscribe,o.getState,o],[i]),l=o.setState;return n.useEffect(()=>{let t=e.map(({name:e,keys:t,up:r})=>({keys:t,up:r,fn:t=>{l({[e]:t}),a&&a(e,t,s[1]())}})).reduce((e,{keys:t,fn:a,up:r=!0})=>(t.forEach(t=>e[t]={fn:a,pressed:!1,up:r}),e),{}),n=({key:e,code:a})=>{let r=t[e]||t[a];if(!r)return;let{fn:n,pressed:i,up:o}=r;r.pressed=!0,(o||!i)&&n(!0)},i=({key:e,code:a})=>{let r=t[e]||t[a];if(!r)return;let{fn:n,up:i}=r;r.pressed=!1,i&&n(!1)},o=r||window;return o.addEventListener("keydown",n,{passive:!0}),o.addEventListener("keyup",i,{passive:!0}),()=>{o.removeEventListener("keydown",n),o.removeEventListener("keyup",i)}},[r,i]),n.createElement(eZ.Provider,{value:s,children:t})}function eQ(e){let[t,a,r]=n.useContext(eZ);return e?r(e):[t,a]}var e0=e.i(85413),e2=Object.defineProperty,e1=(e,t,a)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?e2(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,a};let e3=new o.Euler(0,0,0,"YXZ"),e5=new o.Vector3,e4={type:"change"},e6={type:"lock"},e8={type:"unlock"},e7=Math.PI/2;class e9 extends e0.EventDispatcher{constructor(e,t){super(),e1(this,"camera"),e1(this,"domElement"),e1(this,"isLocked"),e1(this,"minPolarAngle"),e1(this,"maxPolarAngle"),e1(this,"pointerSpeed"),e1(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(e3.setFromQuaternion(this.camera.quaternion),e3.y-=.002*e.movementX*this.pointerSpeed,e3.x-=.002*e.movementY*this.pointerSpeed,e3.x=Math.max(e7-this.maxPolarAngle,Math.min(e7-this.minPolarAngle,e3.x)),this.camera.quaternion.setFromEuler(e3),this.dispatchEvent(e4))}),e1(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(e6),this.isLocked=!0):(this.dispatchEvent(e8),this.isLocked=!1))}),e1(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),e1(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),e1(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),e1(this,"dispose",()=>{this.disconnect()}),e1(this,"getObject",()=>this.camera),e1(this,"direction",new o.Vector3(0,0,-1)),e1(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),e1(this,"moveForward",e=>{e5.setFromMatrixColumn(this.camera.matrix,0),e5.crossVectors(this.camera.up,e5),this.camera.position.addScaledVector(e5,e)}),e1(this,"moveRight",e=>{e5.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(e5,e)}),e1(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),e1(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}(t={}).forward="forward",t.backward="backward",t.left="left",t.right="right",t.up="up",t.down="down",t.lookUp="lookUp",t.lookDown="lookDown",t.lookLeft="lookLeft",t.lookRight="lookRight",t.camera1="camera1",t.camera2="camera2",t.camera3="camera3",t.camera4="camera4",t.camera5="camera5",t.camera6="camera6",t.camera7="camera7",t.camera8="camera8",t.camera9="camera9";let te=Math.PI/2-.01;function tt(){let e,t,a,i,s,l,c,d,m,g,f,p,y,F=(0,r.c)(26),{speedMultiplier:b,setSpeedMultiplier:x}=(0,v.useControls)(),[S,k]=eQ(),{camera:D,gl:P}=(0,h.useThree)(),{nextCamera:w,setCameraIndex:C,cameraCount:I}=ek(),M=(0,n.useRef)(null);F[0]===Symbol.for("react.memo_cache_sentinel")?(e=new o.Vector3,F[0]=e):e=F[0];let E=(0,n.useRef)(e);F[1]===Symbol.for("react.memo_cache_sentinel")?(t=new o.Vector3,F[1]=t):t=F[1];let T=(0,n.useRef)(t);F[2]===Symbol.for("react.memo_cache_sentinel")?(a=new o.Vector3,F[2]=a):a=F[2];let B=(0,n.useRef)(a);F[3]===Symbol.for("react.memo_cache_sentinel")?(i=new o.Euler(0,0,0,"YXZ"),F[3]=i):i=F[3];let j=(0,n.useRef)(i);return F[4]!==D||F[5]!==P.domElement?(s=()=>{let e=new e9(D,P.domElement);return M.current=e,()=>{e.dispose()}},l=[D,P.domElement],F[4]=D,F[5]=P.domElement,F[6]=s,F[7]=l):(s=F[6],l=F[7]),(0,n.useEffect)(s,l),F[8]!==D||F[9]!==P.domElement||F[10]!==w?(c=()=>{let e=P.domElement,t=new o.Euler(0,0,0,"YXZ"),a=!1,r=!1,n=0,i=0,s=t=>{M.current?.isLocked||t.target===e&&(a=!0,r=!1,n=t.clientX,i=t.clientY)},l=e=>{!a||!r&&3>Math.abs(e.clientX-n)&&3>Math.abs(e.clientY-i)||(r=!0,t.setFromQuaternion(D.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-te,Math.min(te,t.x)),D.quaternion.setFromEuler(t))},c=()=>{a=!1},d=t=>{let a=M.current;!a||a.isLocked?w():t.target!==e||r||a.lock()};return e.addEventListener("mousedown",s),document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),document.addEventListener("click",d),()=>{e.removeEventListener("mousedown",s),document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c),document.removeEventListener("click",d)}},d=[D,P.domElement,w],F[8]=D,F[9]=P.domElement,F[10]=w,F[11]=c,F[12]=d):(c=F[11],d=F[12]),(0,n.useEffect)(c,d),F[13]!==I||F[14]!==C||F[15]!==S?(m=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return S(t=>{for(let a=0;a{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,a=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;x(e=>Math.max(.1,Math.min(5,Math.round((e+a)*20)/20)))},t=P.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},p=[P.domElement,x],F[18]=P.domElement,F[19]=x,F[20]=f,F[21]=p):(f=F[20],p=F[21]),(0,n.useEffect)(f,p),F[22]!==D||F[23]!==k||F[24]!==b?(y=(e,t)=>{let{forward:a,backward:r,left:n,right:i,up:o,down:s,lookUp:l,lookDown:c,lookLeft:d,lookRight:u}=k();if((l||c||d||u)&&(j.current.setFromQuaternion(D.quaternion,"YXZ"),d&&(j.current.y=j.current.y+ +t),u&&(j.current.y=j.current.y-t),l&&(j.current.x=j.current.x+ +t),c&&(j.current.x=j.current.x-t),j.current.x=Math.max(-te,Math.min(te,j.current.x)),D.quaternion.setFromEuler(j.current)),!a&&!r&&!n&&!i&&!o&&!s)return;let h=80*b;D.getWorldDirection(E.current),E.current.normalize(),T.current.crossVectors(D.up,E.current).normalize(),B.current.set(0,0,0),a&&B.current.add(E.current),r&&B.current.sub(E.current),n&&B.current.add(T.current),i&&B.current.sub(T.current),o&&(B.current.y=B.current.y+1),s&&(B.current.y=B.current.y-1),B.current.lengthSq()>0&&(B.current.normalize().multiplyScalar(h*t),D.position.add(B.current))},F[22]=D,F[23]=k,F[24]=b,F[25]=y):y=F[25],(0,u.useFrame)(y),null}let ta=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"lookUp",keys:["ArrowUp"]},{name:"lookDown",keys:["ArrowDown"]},{name:"lookLeft",keys:["ArrowLeft"]},{name:"lookRight",keys:["ArrowRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function tr(){let e,t,i=(0,r.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],(0,n.useEffect)(tn,e),i[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(tt,{}),i[1]=t):t=i[1],t}function tn(){return window.addEventListener("keydown",ti,{capture:!0}),window.addEventListener("keyup",ti,{capture:!0}),()=>{window.removeEventListener("keydown",ti,{capture:!0}),window.removeEventListener("keyup",ti,{capture:!0})}}function ti(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}function to(e){let t,n=(0,r.c)(2),{children:i}=e;return n[0]!==i?(t=(0,a.jsx)(a.Fragment,{children:i}),n[0]=i,n[1]=t):t=n[1],t}function ts(){return(0,P.useEngineSelector)(tl)}function tl(e){return e.playback.recording}function tc(){return(0,P.useEngineSelector)(td)}function td(e){return"playing"===e.playback.status}function tu(e){return e.playback.timeMs/1e3}function th(e){return e.playback.durationMs/1e3}function tm(e){return e.playback.rate}function tg(){let e,t,a,n,i,o,s=(0,r.c)(17),l=ts(),c=(0,P.useEngineSelector)(tv),d=(0,P.useEngineSelector)(ty),u=(0,P.useEngineSelector)(tp),h=(0,P.useEngineSelector)(tf);s[0]!==c?(e=e=>{c(e)},s[0]=c,s[1]=e):e=s[1];let m=e;s[2]!==l||s[3]!==d?(t=()=>{l&&d("playing")},s[2]=l,s[3]=d,s[4]=t):t=s[4];let g=t;s[5]!==d?(a=()=>{d("paused")},s[5]=d,s[6]=a):a=s[6];let f=a;s[7]!==u?(n=e=>{u(1e3*e)},s[7]=u,s[8]=n):n=s[8];let p=n;s[9]!==h?(i=e=>{h(e)},s[9]=h,s[10]=i):i=s[10];let y=i;return s[11]!==f||s[12]!==g||s[13]!==p||s[14]!==m||s[15]!==y?(o={setRecording:m,play:g,pause:f,seek:p,setSpeed:y},s[11]=f,s[12]=g,s[13]=p,s[14]=m,s[15]=y,s[16]=o):o=s[16],o}function tf(e){return e.setPlaybackRate}function tp(e){return e.setPlaybackTime}function ty(e){return e.setPlaybackStatus}function tv(e){return e.setDemoRecording}var tF=e.i(13070);function tb(){let e,t,n,i,o,s,l,c,d,u,h,m,g,f,p,y,v,F,b,x,S,k,D,P,w=(0,r.c)(51),C=ts(),I=eQ(tE),M=eQ(tM),E=eQ(tI),T=eQ(tC),B=eQ(tw),j=eQ(tP),_=eQ(tD),R=eQ(tk),N=eQ(tS),A=eQ(tx);return C?null:(w[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:tF.default.Spacer}),w[0]=e):e=w[0],w[1]!==I?(t=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":I,children:"W"}),w[1]=I,w[2]=t):t=w[2],w[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)("div",{className:tF.default.Spacer}),w[3]=n):n=w[3],w[4]!==t?(i=(0,a.jsxs)("div",{className:tF.default.Row,children:[e,t,n]}),w[4]=t,w[5]=i):i=w[5],w[6]!==E?(o=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":E,children:"A"}),w[6]=E,w[7]=o):o=w[7],w[8]!==M?(s=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":M,children:"S"}),w[8]=M,w[9]=s):s=w[9],w[10]!==T?(l=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":T,children:"D"}),w[10]=T,w[11]=l):l=w[11],w[12]!==o||w[13]!==s||w[14]!==l?(c=(0,a.jsxs)("div",{className:tF.default.Row,children:[o,s,l]}),w[12]=o,w[13]=s,w[14]=l,w[15]=c):c=w[15],w[16]!==i||w[17]!==c?(d=(0,a.jsxs)("div",{className:tF.default.Column,children:[i,c]}),w[16]=i,w[17]=c,w[18]=d):d=w[18],w[19]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("span",{className:tF.default.Arrow,children:"↑"}),w[19]=u):u=w[19],w[20]!==B?(h=(0,a.jsx)("div",{className:tF.default.Row,children:(0,a.jsxs)("div",{className:tF.default.Key,"data-pressed":B,children:[u," Space"]})}),w[20]=B,w[21]=h):h=w[21],w[22]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)("span",{className:tF.default.Arrow,children:"↓"}),w[22]=m):m=w[22],w[23]!==j?(g=(0,a.jsx)("div",{className:tF.default.Row,children:(0,a.jsxs)("div",{className:tF.default.Key,"data-pressed":j,children:[m," Shift"]})}),w[23]=j,w[24]=g):g=w[24],w[25]!==h||w[26]!==g?(f=(0,a.jsxs)("div",{className:tF.default.Column,children:[h,g]}),w[25]=h,w[26]=g,w[27]=f):f=w[27],w[28]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)("div",{className:tF.default.Spacer}),w[28]=p):p=w[28],w[29]!==_?(y=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":_,children:"↑"}),w[29]=_,w[30]=y):y=w[30],w[31]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)("div",{className:tF.default.Spacer}),w[31]=v):v=w[31],w[32]!==y?(F=(0,a.jsxs)("div",{className:tF.default.Row,children:[p,y,v]}),w[32]=y,w[33]=F):F=w[33],w[34]!==N?(b=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":N,children:"←"}),w[34]=N,w[35]=b):b=w[35],w[36]!==R?(x=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":R,children:"↓"}),w[36]=R,w[37]=x):x=w[37],w[38]!==A?(S=(0,a.jsx)("div",{className:tF.default.Key,"data-pressed":A,children:"→"}),w[38]=A,w[39]=S):S=w[39],w[40]!==b||w[41]!==x||w[42]!==S?(k=(0,a.jsxs)("div",{className:tF.default.Row,children:[b,x,S]}),w[40]=b,w[41]=x,w[42]=S,w[43]=k):k=w[43],w[44]!==F||w[45]!==k?(D=(0,a.jsxs)("div",{className:tF.default.Column,children:[F,k]}),w[44]=F,w[45]=k,w[46]=D):D=w[46],w[47]!==f||w[48]!==D||w[49]!==d?(P=(0,a.jsxs)("div",{className:tF.default.Root,children:[d,f,D]}),w[47]=f,w[48]=D,w[49]=d,w[50]=P):P=w[50],P)}function tx(e){return e.lookRight}function tS(e){return e.lookLeft}function tk(e){return e.lookDown}function tD(e){return e.lookUp}function tP(e){return e.down}function tw(e){return e.up}function tC(e){return e.right}function tI(e){return e.left}function tM(e){return e.backward}function tE(e){return e.forward}var tT=e.i(78295);function tB(e){let t=e.querySelector(".back");t&&(t.style.background="rgba(3, 79, 76, 0.6)",t.style.border="1px solid rgba(0, 219, 223, 0.5)",t.style.boxShadow="inset 0 0 10px rgba(0, 0, 0, 0.7)");let a=e.querySelector(".front");a&&(a.style.background="radial-gradient(circle at 50% 50%, rgba(23, 247, 198, 0.9) 0%, rgba(9, 184, 170, 0.95) 100%)",a.style.border="2px solid rgba(255, 255, 255, 0.4)",a.style.boxShadow="0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 2px rgba(0, 0, 0, 0.3)")}let tj=Math.PI/2-.01;function t_({joystickState:t,joystickZone:r,lookJoystickState:i,lookJoystickZone:o}){let{touchMode:s}=(0,v.useControls)();(0,n.useEffect)(()=>{let a=r.current;if(!a)return;let n=null,i=!1;return e.A(84968).then(e=>{i||(n=e.default.create({zone:a,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9}),tB(a),n.on("move",(e,a)=>{t.current.angle=a.angle.radian,t.current.force=Math.min(1,a.force)}),n.on("end",()=>{t.current.force=0}))}),()=>{i=!0,n?.destroy()}},[t,r,s]),(0,n.useEffect)(()=>{if("dualStick"!==s)return;let t=o.current;if(!t)return;let a=null,r=!1;return e.A(84968).then(e=>{r||(a=e.default.create({zone:t,mode:"static",position:{right:"70px",bottom:"70px"},size:120,restOpacity:.9}),tB(t),a.on("move",(e,t)=>{i.current.angle=t.angle.radian,i.current.force=Math.min(1,t.force)}),a.on("end",()=>{i.current.force=0}))}),()=>{r=!0,a?.destroy()}},[s,i,o]);let l=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return"dualStick"===s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{ref:r,className:tT.default.Left,onContextMenu:e=>e.preventDefault(),onTouchStart:l}),(0,a.jsx)("div",{ref:o,className:tT.default.Right,onContextMenu:e=>e.preventDefault(),onTouchStart:l})]}):(0,a.jsx)("div",{ref:r,className:tT.default.Joystick,onContextMenu:e=>e.preventDefault(),onTouchStart:l})}function tR(e){let t,a,i,s,l,c,d,m,g,f,p=(0,r.c)(25),{joystickState:y,joystickZone:F,lookJoystickState:b}=e,{speedMultiplier:x,touchMode:S}=(0,v.useControls)(),{camera:k,gl:D}=(0,h.useThree)();p[0]===Symbol.for("react.memo_cache_sentinel")?(t=new o.Euler(0,0,0,"YXZ"),p[0]=t):t=p[0];let P=(0,n.useRef)(t),w=(0,n.useRef)(null);p[1]===Symbol.for("react.memo_cache_sentinel")?(a={x:0,y:0},p[1]=a):a=p[1];let C=(0,n.useRef)(a);p[2]===Symbol.for("react.memo_cache_sentinel")?(i=new o.Vector3,p[2]=i):i=p[2];let I=(0,n.useRef)(i);p[3]===Symbol.for("react.memo_cache_sentinel")?(s=new o.Vector3,p[3]=s):s=p[3];let M=(0,n.useRef)(s);p[4]===Symbol.for("react.memo_cache_sentinel")?(l=new o.Vector3,p[4]=l):l=p[4];let E=(0,n.useRef)(l);return p[5]!==k.quaternion?(c=()=>{P.current.setFromQuaternion(k.quaternion,"YXZ")},p[5]=k.quaternion,p[6]=c):c=p[6],p[7]!==k?(d=[k],p[7]=k,p[8]=d):d=p[8],(0,n.useEffect)(c,d),p[9]!==k.quaternion||p[10]!==D.domElement||p[11]!==F||p[12]!==S?(m=()=>{if("moveLookStick"!==S)return;let e=D.domElement,t=e=>{let t=F.current;if(!t)return!1;let a=t.getBoundingClientRect();return e.clientX>=a.left&&e.clientX<=a.right&&e.clientY>=a.top&&e.clientY<=a.bottom},a=e=>{if(null===w.current)for(let a=0;a{if(null!==w.current)for(let t=0;t{for(let t=0;t{e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",r),e.removeEventListener("touchend",n),e.removeEventListener("touchcancel",n),w.current=null}},p[9]=k.quaternion,p[10]=D.domElement,p[11]=F,p[12]=S,p[13]=m):m=p[13],p[14]!==k||p[15]!==D.domElement||p[16]!==F||p[17]!==S?(g=[k,D.domElement,F,S],p[14]=k,p[15]=D.domElement,p[16]=F,p[17]=S,p[18]=g):g=p[18],(0,n.useEffect)(m,g),p[19]!==k||p[20]!==y.current||p[21]!==b||p[22]!==x||p[23]!==S?(f=(e,t)=>{let{force:a,angle:r}=y.current;if("dualStick"===S){let e=b.current;if(e.force>.15){let a=(e.force-.15)/.85,r=Math.cos(e.angle),n=Math.sin(e.angle);P.current.setFromQuaternion(k.quaternion,"YXZ"),P.current.y=P.current.y-r*a*2.5*t,P.current.x=P.current.x+n*a*2.5*t,P.current.x=Math.max(-tj,Math.min(tj,P.current.x)),k.quaternion.setFromEuler(P.current)}if(a>.08){let e=80*x*((a-.08)/.92),n=Math.cos(r),i=Math.sin(r);k.getWorldDirection(I.current),I.current.normalize(),M.current.crossVectors(k.up,I.current).normalize(),E.current.set(0,0,0).addScaledVector(I.current,i).addScaledVector(M.current,-n),E.current.lengthSq()>0&&(E.current.normalize().multiplyScalar(e*t),k.position.add(E.current))}}else if("moveLookStick"===S&&a>0){let e=80*x*.5;if(k.getWorldDirection(I.current),I.current.normalize(),E.current.copy(I.current).multiplyScalar(e*t),k.position.add(E.current),a>=.15){let e=Math.cos(r),n=Math.sin(r),i=(a-.15)/.85;P.current.setFromQuaternion(k.quaternion,"YXZ"),P.current.y=P.current.y-e*i*1.25*t,P.current.x=P.current.x+n*i*1.25*t,P.current.x=Math.max(-tj,Math.min(tj,P.current.x)),k.quaternion.setFromEuler(P.current)}}},p[19]=k,p[20]=y.current,p[21]=b,p[22]=x,p[23]=S,p[24]=f):f=p[24],(0,u.useFrame)(f),null}var tN=e.i(11889),tA=e.i(56373),tG=e.i(86447),tL=e.i(1559),tz=e.i(78440),tU=e.i(59129),tO=e.i(25998),tV=e.i(18364),tq=e.i(70238),tH=e.i(29402),tW=e.i(97442);let t$=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),tK={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/xPack2.vl2":"xPack2","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2":"DMP (Discord Map Pack)"},tX={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},tY=(0,eG.getMissionList)().filter(e=>!t$.has(e)).map(e=>{let t,a=(0,eG.getMissionInfo)(e),[r]=(0,eG.getSourceAndPath)(a.resourcePath),n=(t=r.match(/^(.*)(\/[^/]+)$/))?t[1]:"",i=tK[r]??tX[n]??null;return{resourcePath:a.resourcePath,missionName:e,displayName:a.displayName,sourcePath:r,groupName:i,missionTypes:a.missionTypes}}),tZ=new Map(tY.map(e=>[e.missionName,e])),tJ=function(e){let t=new Map;for(let a of e){let e=t.get(a.groupName)??[];e.push(a),t.set(a.groupName,e)}return t.forEach((e,a)=>{t.set(a,(0,tH.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,tH.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(tY),tQ="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function t0(e){let t,n,i,o,s,l=(0,r.c)(12),{mission:c}=e,d=c.displayName||c.missionName;return l[0]!==d?(t=(0,a.jsx)("span",{className:tW.default.ItemName,children:d}),l[0]=d,l[1]=t):t=l[1],l[2]!==c.missionTypes?(n=c.missionTypes.length>0&&(0,a.jsx)("span",{className:tW.default.ItemTypes,children:c.missionTypes.map(t2)}),l[2]=c.missionTypes,l[3]=n):n=l[3],l[4]!==t||l[5]!==n?(i=(0,a.jsxs)("span",{className:tW.default.ItemHeader,children:[t,n]}),l[4]=t,l[5]=n,l[6]=i):i=l[6],l[7]!==c.missionName?(o=(0,a.jsx)("span",{className:tW.default.ItemMissionName,children:c.missionName}),l[7]=c.missionName,l[8]=o):o=l[8],l[9]!==i||l[10]!==o?(s=(0,a.jsxs)(a.Fragment,{children:[i,o]}),l[9]=i,l[10]=o,l[11]=s):s=l[11],s}function t2(e){return(0,a.jsx)("span",{className:tW.default.ItemType,"data-mission-type":e,children:e},e)}function t1(e){let t,i,o,s,l,c,d,u,h,m,g,f,p,y,v,F,b,x=(0,r.c)(46),{value:S,missionType:k,onChange:D,disabled:P}=e,[w,C]=(0,n.useState)(""),I=(0,n.useRef)(null),M=(0,n.useRef)(k);x[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,n.startTransition)(()=>C(e))},x[0]=t):t=x[0];let E=(0,tV.useComboboxStore)({resetValueOnHide:!0,selectedValue:S,setSelectedValue:e=>{if(e){let t=M.current,a=(0,eG.getMissionInfo)(e).missionTypes;t&&a.includes(t)||(t=a[0]),D({missionName:e,missionType:t}),I.current?.blur()}},setValue:t});x[1]!==E?(i=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),I.current?.focus(),E.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},o=[E],x[1]=E,x[2]=i,x[3]=o):(i=x[2],o=x[3]),(0,n.useEffect)(i,o),x[4]!==S?(s=tZ.get(S),x[4]=S,x[5]=s):s=x[5];let T=s;e:{let e,t;if(!w){let e;x[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:tJ},x[6]=e):e=x[6],l=e;break e}x[7]!==w?(e=(0,tq.matchSorter)(tY,w,{keys:["displayName","missionName","missionTypes","groupName"]}),x[7]=w,x[8]=e):e=x[8];let a=e;x[9]!==a?(t={type:"flat",missions:a},x[9]=a,x[10]=t):t=x[10],l=t}let B=l,j=T?T.displayName||T.missionName:S,_="flat"===B.type?0===B.missions.length:0===B.groups.length,R=e=>(0,a.jsx)(tA.ComboboxItem,{value:e.missionName,className:tW.default.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let a=t.target.dataset.missionType;a?(M.current=a,e.missionName===S&&D({missionName:e.missionName,missionType:a})):M.current=null}else M.current=null},children:(0,a.jsx)(t0,{mission:e})},e.missionName),N=tz.ComboboxProvider;x[11]!==E?(c=()=>{try{document.exitPointerLock()}catch{}E.show()},d=e=>{"Escape"!==e.key||E.getState().open||I.current?.blur()},x[11]=E,x[12]=c,x[13]=d):(c=x[12],d=x[13]),x[14]!==P||x[15]!==j||x[16]!==c||x[17]!==d?(u=(0,a.jsx)(tN.Combobox,{ref:I,autoSelect:!0,disabled:P,placeholder:j,className:tW.default.Input,onFocus:c,onKeyDown:d}),x[14]=P,x[15]=j,x[16]=c,x[17]=d,x[18]=u):u=x[18],x[19]!==j?(h=(0,a.jsx)("span",{className:tW.default.SelectedName,children:j}),x[19]=j,x[20]=h):h=x[20],x[21]!==k?(m=k&&(0,a.jsx)("span",{className:tW.default.ItemType,"data-mission-type":k,children:k}),x[21]=k,x[22]=m):m=x[22],x[23]!==m||x[24]!==h?(g=(0,a.jsxs)("div",{className:tW.default.SelectedValue,children:[h,m]}),x[23]=m,x[24]=h,x[25]=g):g=x[25],x[26]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("kbd",{className:tW.default.Shortcut,children:tQ?"⌘K":"^K"}),x[26]=f):f=x[26],x[27]!==g||x[28]!==u?(p=(0,a.jsxs)("div",{className:tW.default.InputWrapper,children:[u,g,f]}),x[27]=g,x[28]=u,x[29]=p):p=x[29];let A=tL.ComboboxPopover,G=tW.default,L=tG.ComboboxList,z=tW.default,U="flat"===B.type?B.missions.map(R):B.groups.map(e=>{let[t,r]=e;return t?(0,a.jsxs)(tU.ComboboxGroup,{className:tW.default.Group,children:[(0,a.jsx)(tO.ComboboxGroupLabel,{className:tW.default.GroupLabel,children:t}),r.map(R)]},t):(0,a.jsx)(n.Fragment,{children:r.map(R)},"ungrouped")});return x[30]!==_?(y=_&&(0,a.jsx)("div",{className:tW.default.NoResults,children:"No missions found"}),x[30]=_,x[31]=y):y=x[31],x[32]!==L||x[33]!==z.List||x[34]!==U||x[35]!==y?(v=(0,a.jsxs)(L,{className:z.List,children:[U,y]}),x[32]=L,x[33]=z.List,x[34]=U,x[35]=y,x[36]=v):v=x[36],x[37]!==A||x[38]!==G.Popover||x[39]!==v?(F=(0,a.jsx)(A,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:G.Popover,children:v}),x[37]=A,x[38]=G.Popover,x[39]=v,x[40]=F):F=x[40],x[41]!==N||x[42]!==E||x[43]!==p||x[44]!==F?(b=(0,a.jsxs)(N,{store:E,children:[p,F]}),x[41]=N,x[42]=E,x[43]=p,x[44]=F,x[45]=b):b=x[45],b}var t3=e.i(11152),t5=e.i(40141);function t4(e){return(0,t5.GenIcon)({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0c-41.8 0-77.4 26.7-90.5 64L64 64C28.7 64 0 92.7 0 128L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64l-37.5 0C269.4 26.7 233.8 0 192 0zm0 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM305 273L177 401c-9.4 9.4-24.6 9.4-33.9 0L79 337c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L271 239c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(e)}var t6=e.i(36679);function t8(e){let t,i,o,s,l,c=(0,r.c)(11),{cameraRef:d,missionName:u,missionType:h}=e,{fogEnabled:m}=(0,v.useSettings)(),[g,f]=(0,n.useState)(!1),p=(0,n.useRef)(null);c[0]!==d||c[1]!==m||c[2]!==u||c[3]!==h?(t=async()=>{clearTimeout(p.current);let e=d.current;if(!e)return;let t=function({position:e,quaternion:t}){let a=e=>parseFloat(e.toFixed(3)),r=`${a(e.x)},${a(e.y)},${a(e.z)}`,n=`${a(t.x)},${a(t.y)},${a(t.z)},${a(t.w)}`;return`#c${r}~${n}`}(e),a=new URLSearchParams;a.set("mission",`${u}~${h}`),a.set("fog",m.toString());let r=`${window.location.pathname}?${a}${t}`,n=`${window.location.origin}${r}`;window.history.replaceState(null,"",r);try{await navigator.clipboard.writeText(n),f(!0),p.current=setTimeout(()=>{f(!1)},1100)}catch(e){console.error(e)}},c[0]=d,c[1]=m,c[2]=u,c[3]=h,c[4]=t):t=c[4];let y=t,F=g?"true":"false";return c[5]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(t3.FaMapPin,{className:t6.default.MapPin}),o=(0,a.jsx)(t4,{className:t6.default.ClipboardCheck}),s=(0,a.jsx)("span",{className:t6.default.ButtonLabel,children:" Copy coordinates URL"}),c[5]=i,c[6]=o,c[7]=s):(i=c[5],o=c[6],s=c[7]),c[8]!==y||c[9]!==F?(l=(0,a.jsxs)("button",{type:"button",className:t6.default.Root,"aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:y,"data-copied":F,id:"copyCoordinatesButton",children:[i,o,s]}),c[8]=y,c[9]=F,c[10]=l):l=c[10],l}function t7(e){return(0,t5.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 0 0-2-2zm0 14H3V5h18v12zm-5-6-7 4V7z"},child:[]}]})(e)}var t9={},ae=function(e,t,a,r,n){var i=new Worker(t9[t]||(t9[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(e){var t=e.data,a=t.$e$;if(a){var r=Error(a[0]);r.code=a[1],r.stack=a[2],n(r,null)}else n(null,t)},i.postMessage(a,r),i},at=Uint8Array,aa=Uint16Array,ar=Int32Array,an=new at([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ai=new at([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ao=new at([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),as=function(e,t){for(var a=new aa(31),r=0;r<31;++r)a[r]=t+=1<>1|(21845&af)<<1;ap=(61680&(ap=(52428&ap)>>2|(13107&ap)<<2))>>4|(3855&ap)<<4,ag[af]=((65280&ap)>>8|(255&ap)<<8)>>1}for(var ay=function(e,t,a){for(var r,n=e.length,i=0,o=new aa(t);i>l]=c}else for(i=0,r=new aa(n);i>15-e[i]);return r},av=new at(288),af=0;af<144;++af)av[af]=8;for(var af=144;af<256;++af)av[af]=9;for(var af=256;af<280;++af)av[af]=7;for(var af=280;af<288;++af)av[af]=8;for(var aF=new at(32),af=0;af<32;++af)aF[af]=5;var ab=ay(av,9,0),ax=ay(av,9,1),aS=ay(aF,5,0),ak=ay(aF,5,1),aD=function(e){for(var t=e[0],a=1;at&&(t=e[a]);return t},aP=function(e,t,a){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&a},aw=function(e,t){var a=t/8|0;return(e[a]|e[a+1]<<8|e[a+2]<<16)>>(7&t)},aC=function(e){return(e+7)/8|0},aI=function(e,t,a){return(null==t||t<0)&&(t=0),(null==a||a>e.length)&&(a=e.length),new at(e.subarray(t,a))},aM=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],aE=function(e,t,a){var r=Error(t||aM[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,aE),!a)throw r;return r},aT=function(e,t,a,r){var n=e.length,i=r?r.length:0;if(!n||t.f&&!t.l)return a||new at(0);var o=!a,s=o||2!=t.i,l=t.i;o&&(a=new at(3*n));var c=function(e){var t=a.length;if(e>t){var r=new at(Math.max(2*t,e));r.set(a),a=r}},d=t.f||0,u=t.p||0,h=t.b||0,m=t.l,g=t.d,f=t.m,p=t.n,y=8*n;do{if(!m){d=aP(e,u,1);var v=aP(e,u+1,3);if(u+=3,v)if(1==v)m=ax,g=ak,f=9,p=5;else if(2==v){var F=aP(e,u,31)+257,b=aP(e,u+10,15)+4,x=F+aP(e,u+5,31)+1;u+=14;for(var S=new at(x),k=new at(19),D=0;D>4;if(M<16)S[D++]=M;else{var E=0,T=0;for(16==M?(T=3+aP(e,u,3),u+=2,E=S[D-1]):17==M?(T=3+aP(e,u,7),u+=3):18==M&&(T=11+aP(e,u,127),u+=7);T--;)S[D++]=E}}var B=S.subarray(0,F),j=S.subarray(F);f=aD(B),p=aD(j),m=ay(B,f,1),g=ay(j,p,1)}else aE(1);else{var M=aC(u)+4,_=e[M-4]|e[M-3]<<8,R=M+_;if(R>n){l&&aE(0);break}s&&c(h+_),a.set(e.subarray(M,R),h),t.b=h+=_,t.p=u=8*R,t.f=d;continue}if(u>y){l&&aE(0);break}}s&&c(h+131072);for(var N=(1<>4;if((u+=15&E)>y){l&&aE(0);break}if(E||aE(2),L<256)a[h++]=L;else if(256==L){G=u,m=null;break}else{var z=L-254;if(L>264){var D=L-257,U=an[D];z=aP(e,u,(1<>4;O||aE(3),u+=15&O;var j=ah[V];if(V>3){var U=ai[V];j+=aw(e,u)&(1<y){l&&aE(0);break}s&&c(h+131072);var q=h+z;if(h>8},aj=function(e,t,a){a<<=7&t;var r=t/8|0;e[r]|=a,e[r+1]|=a>>8,e[r+2]|=a>>16},a_=function(e,t){for(var a=[],r=0;rh&&(h=i[r].s);var m=new aa(h+1),g=aR(a[d-1],m,0);if(g>t){var r=0,f=0,p=g-t,y=1<t)f+=y-(1<>=p;f>0;){var F=i[r].s;m[F]=0&&f;--r){var b=i[r].s;m[b]==t&&(--m[b],++f)}g=t}return{t:new at(m),l:g}},aR=function(e,t,a){return -1==e.s?Math.max(aR(e.l,t,a+1),aR(e.r,t,a+1)):t[e.s]=a},aN=function(e){for(var t=e.length;t&&!e[--t];);for(var a=new aa(++t),r=0,n=e[0],i=1,o=function(e){a[r++]=e},s=1;s<=t;++s)if(e[s]==n&&s!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=e[s]}return{c:a.subarray(0,r),n:t}},aA=function(e,t){for(var a=0,r=0;r>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var i=0;i4&&!E[ao[B-1]];--B);var j=c+5<<3,_=aA(n,av)+aA(i,aF)+o,R=aA(n,p)+aA(i,F)+o+14+3*B+aA(C,E)+2*C[16]+3*C[17]+7*C[18];if(l>=0&&j<=_&&j<=R)return aG(t,d,e.subarray(l,l+c));if(aB(t,d,1+(R<_)),d+=2,R<_){u=ay(p,y,0),h=p,m=ay(F,b,0),g=F;var N=ay(E,T,0);aB(t,d,k-257),aB(t,d+5,w-1),aB(t,d+10,B-4),d+=14;for(var I=0;I15&&(aB(t,d,L[I]>>5&127),d+=L[I]>>12)}}else u=ab,h=av,m=aS,g=aF;for(var I=0;I255){var z=U>>18&31;aj(t,d,u[z+257]),d+=h[z+257],z>7&&(aB(t,d,U>>23&31),d+=an[z]);var O=31&U;aj(t,d,m[O]),d+=g[O],O>3&&(aj(t,d,U>>5&8191),d+=ai[O])}else aj(t,d,u[U]),d+=h[U]}return aj(t,d,u[256]),d+h[256]},az=new ar([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aU=new at(0),aO=function(e,t,a,r,n,i){var o=i.z||e.length,s=new at(r+o+5*(1+Math.ceil(o/7e3))+n),l=s.subarray(r,s.length-n),c=i.l,d=7&(i.r||0);if(t){d&&(l[0]=i.r>>3);for(var u=az[t-1],h=u>>13,m=8191&u,g=(1<7e3||w>24576)&&(B>423||!c)){d=aL(e,l,0,b,x,S,D,w,I,P-I,d),w=k=D=0,I=P;for(var j=0;j<286;++j)x[j]=0;for(var j=0;j<30;++j)S[j]=0}var _=2,R=0,N=m,A=E-T&32767;if(B>2&&M==F(P-A))for(var G=Math.min(h,B)-1,L=Math.min(32767,P),z=Math.min(258,B);A<=L&&--N&&E!=T;){if(e[P+_]==e[P+_-A]){for(var U=0;U_){if(_=U,R=A,U>G)break;for(var O=Math.min(A,U-2),V=0,j=0;jV&&(V=W,T=q)}}}T=f[E=T],A+=E-T&32767}if(R){b[w++]=0x10000000|ad[_]<<18|am[R];var $=31&ad[_],K=31&am[R];D+=an[$]+ai[K],++x[257+$],++S[K],C=P+_,++k}else b[w++]=e[P],++x[e[P]]}}for(P=Math.max(P,C);P=o&&(l[d/8|0]=c,X=o),d=aG(l,d+1,e.subarray(P,X))}i.i=o}return aI(s,0,r+aC(d)+n)},aV=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var a=t,r=9;--r;)a=(1&a&&-0x12477ce0)^a>>>1;e[t]=a}return e}(),aq=function(){var e=-1;return{p:function(t){for(var a=e,r=0;r>>8;e=a},d:function(){return~e}}},aH=function(){var e=1,t=0;return{p:function(a){for(var r=e,n=t,i=0|a.length,o=0;o!=i;){for(var s=Math.min(o+2655,i);o>16),n=(65535&n)+15*(n>>16)}e=r,t=n},d:function(){return e%=65521,t%=65521,(255&e)<<24|(65280&e)<<8|(255&t)<<8|t>>8}}},aW=function(e,t,a,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new at(i.length+e.length);o.set(i),o.set(e,i.length),e=o,n.w=i.length}return aO(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,a,r,n)},a$=function(e,t){var a={};for(var r in e)a[r]=e[r];for(var r in t)a[r]=t[r];return a},aK=function(e,t,a){for(var r=e(),n=e.toString(),i=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>0},a9=function(e,t){return a7(e,t)+0x100000000*a7(e,t+4)},re=function(e,t,a){for(;a;++t)e[t]=a,a>>>=8},rt=function(e,t){var a=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&re(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),a){e[3]=8;for(var r=0;r<=a.length;++r)e[r+10]=a.charCodeAt(r)}},ra=function(e){(31!=e[0]||139!=e[1]||8!=e[2])&&aE(6,"invalid gzip data");var t=e[3],a=10;4&t&&(a+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[a++]);return a+(2&t)},rr=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},rn=function(e){return 10+(e.filename?e.filename.length+1:0)},ri=function(e,t){var a=t.level;if(e[0]=120,e[1]=(0==a?0:a<6?1:9==a?3:2)<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var r=aH();r.p(t.dictionary),re(e,2,r.d())}},ro=function(e,t){return((15&e[0])!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&aE(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&aE(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function rs(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var rl=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new at(98304),this.o.dictionary){var a=this.o.dictionary.subarray(-32768);this.b.set(a,32768-a.length),this.s.i=32768-a.length}}return e.prototype.p=function(e,t){this.ondata(aW(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||aE(5),this.s.l&&aE(4);var a=e.length+this.s.z;if(a>this.b.length){if(a>2*this.b.length-32768){var r=new at(-32768&a);r.set(this.b.subarray(0,this.s.z)),this.b=r}var n=this.b.length-this.s.z;this.b.set(e.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(n),32768),this.s.z=e.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||aE(5),this.s.l&&aE(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),rc=function(e,t){a6([aQ,function(){return[a4,rl]}],this,rs.call(this,e,t),function(e){onmessage=a4(new rl(e.data))},6,1)};function rd(e,t){return aW(e,t||{},0,0)}var ru=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var a=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:a?a.length:0},this.o=new at(32768),this.p=new at(0),a&&this.o.set(a)}return e.prototype.e=function(e){if(this.ondata||aE(5),this.d&&aE(4),this.p.length){if(e.length){var t=new at(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,a=aT(this.p,this.s,this.o);this.ondata(aI(a,t,this.s.b),this.d),this.o=aI(a,this.s.b-32768),this.s.b=this.o.length,this.p=aI(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),rh=function(e,t){a6([aJ,function(){return[a4,ru]}],this,rs.call(this,e,t),function(e){onmessage=a4(new ru(e.data))},7,0)};function rm(e,t){return aT(e,{i:2},t&&t.out,t&&t.dictionary)}(function(){function e(e,t){this.c=aq(),this.l=0,this.v=1,rl.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,rl.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=aW(e,this.o,this.v&&rn(this.o),t&&8,this.s);this.v&&(rt(a,this.o),this.v=0),t&&(re(a,a.length-8,this.c.d()),re(a,a.length-4,this.l)),this.ondata(a,t)},e.prototype.flush=function(){rl.prototype.flush.call(this)}})();var rg=function(){function e(e,t){this.v=1,this.r=0,ru.call(this,e,t)}return e.prototype.push=function(e,t){if(ru.prototype.e.call(this,e),this.r+=e.length,this.v){var a=this.p.subarray(this.v-1),r=a.length>3?ra(a):4;if(r>a.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-a.length);this.p=a.subarray(r),this.v=0}ru.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=aC(this.s.p)+9,this.s={i:0},this.o=new at(0),this.push(new at(0),t))},e}(),rf=function(e,t){var a=this;a6([aJ,a0,function(){return[a4,ru,rg]}],this,rs.call(this,e,t),function(e){var t=new rg(e.data);t.onmember=function(e){return postMessage(e)},onmessage=a4(t)},9,0,function(e){return a.onmember&&a.onmember(e)})},rp=(function(){function e(e,t){this.c=aH(),this.v=1,rl.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),rl.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=aW(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(ri(a,this.o),this.v=0),t&&re(a,a.length-4,this.c.d()),this.ondata(a,t)},e.prototype.flush=function(){rl.prototype.flush.call(this)}}(),function(){function e(e,t){ru.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(ru.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ro(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&aE(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),ru.prototype.c.call(this,t)},e}()),ry=function(e,t){a6([aJ,a2,function(){return[a4,ru,rp]}],this,rs.call(this,e,t),function(e){onmessage=a4(new rp(e.data))},11,0)},rv=function(){function e(e,t){this.o=rs.call(this,e,t)||{},this.G=rg,this.I=ru,this.Z=rp}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,a){e.ondata(t,a)}},e.prototype.push=function(e,t){if(this.ondata||aE(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var a=new at(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();function rF(e,t){rv.call(this,e,t),this.queuedSize=0,this.G=rf,this.I=rh,this.Z=ry}rF.prototype.i=function(){var e=this;this.s.ondata=function(t,a,r){e.ondata(t,a,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},rF.prototype.push=function(e,t){this.queuedSize+=e.length,rv.prototype.push.call(this,e,t)};var rb="u">typeof TextEncoder&&new TextEncoder,rx="u">typeof TextDecoder&&new TextDecoder,rS=0;try{rx.decode(aU,{stream:!0}),rS=1}catch(e){}var rk=function(e){for(var t="",a=0;;){var r=e[a++],n=(r>127)+(r>223)+(r>239);if(a+n>e.length)return{s:t,r:aI(e,a-1)};n?3==n?t+=String.fromCharCode(55296|(r=((15&r)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++])-65536)>>10,56320|1023&r):1&n?t+=String.fromCharCode((31&r)<<6|63&e[a++]):t+=String.fromCharCode((15&r)<<12|(63&e[a++])<<6|63&e[a++]):t+=String.fromCharCode(r)}};function rD(e,t){if(t){for(var a=new at(e.length),r=0;r>1)),o=0,s=function(e){i[o++]=e},r=0;ri.length){var l=new at(o+8+(n-r<<1));l.set(i),i=l}var c=e.charCodeAt(r);c<128||t?s(c):(c<2048?s(192|c>>6):(c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),s(128|c>>12&63)):s(224|c>>12),s(128|c>>6&63)),s(128|63&c))}return aI(i,0,o)}(function(e){this.ondata=e,rS?this.t=new TextDecoder:this.p=aU}).prototype.push=function(e,t){if(this.ondata||aE(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&aE(8),this.t=null);return}this.p||aE(4);var a=new at(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length);var r=rk(a),n=r.s,i=r.r;t?(i.length&&aE(8),this.p=null):this.p=i,this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){this.ondata||aE(5),this.d&&aE(4),this.ondata(rD(e),this.d=t||!1)};var rP=function(e){return 1==e?3:e<6?2:+(9==e)},rw=function(e,t){for(;1!=a8(e,t);t+=4+a8(e,t+2));return[a9(e,t+12),a9(e,t+4),a9(e,t+20)]},rC=function(e){var t=0;if(e)for(var a in e){var r=e[a].length;r>65535&&aE(9),t+=r+4}return t},rI=function(e,t,a,r,n,i,o,s){var l=r.length,c=a.extra,d=s&&s.length,u=rC(c);re(e,t,null!=o?0x2014b50:0x4034b50),t+=4,null!=o&&(e[t++]=20,e[t++]=a.os),e[t]=20,t+=2,e[t++]=a.flag<<1|(i<0&&8),e[t++]=n&&8,e[t++]=255&a.compression,e[t++]=a.compression>>8;var h=new Date(null==a.mtime?Date.now():a.mtime),m=h.getFullYear()-1980;if((m<0||m>119)&&aE(10),re(e,t,m<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,-1!=i&&(re(e,t,a.crc),re(e,t+4,i<0?-i-2:i),re(e,t+8,a.size)),re(e,t+12,l),re(e,t+14,u),t+=16,null!=o&&(re(e,t,d),re(e,t+6,a.attrs),re(e,t+10,o),t+=14),e.set(r,t),t+=l,u)for(var g in c){var f=c[g],p=f.length;re(e,t,+g),re(e,t+2,p),e.set(f,t+4),t+=4+p}return d&&(e.set(s,t),t+=d),t},rM=function(e,t,a,r,n){re(e,t,0x6054b50),re(e,t+8,a),re(e,t+10,a),re(e,t+12,r),re(e,t+16,n)},rE=function(){function e(e){this.filename=e,this.c=aq(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||aE(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function rT(e,t){var a=this;t||(t={}),rE.call(this,e),this.d=new rl(t,function(e,t){a.ondata(null,e,t)}),this.compression=8,this.flag=rP(t.level)}function rB(e,t){var a=this;t||(t={}),rE.call(this,e),this.d=new rc(t,function(e,t,r){a.ondata(e,t,r)}),this.compression=8,this.flag=rP(t.level),this.terminate=this.d.terminate}function rj(e){this.ondata=e,this.u=[],this.d=1}rT.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},rT.prototype.push=function(e,t){rE.prototype.push.call(this,e,t)},rB.prototype.process=function(e,t){this.d.push(e,t)},rB.prototype.push=function(e,t){rE.prototype.push.call(this,e,t)},rj.prototype.add=function(e){var t=this;if(this.ondata||aE(5),2&this.d)this.ondata(aE(4+(1&this.d)*8,0,1),null,!1);else{var a=rD(e.filename),r=a.length,n=e.comment,i=n&&rD(n),o=r!=e.filename.length||i&&n.length!=i.length,s=r+rC(e.extra)+30;r>65535&&this.ondata(aE(11,0,1),null,!1);var l=new at(s);rI(l,0,e,a,o,-1);var c=[l],d=function(){for(var e=0,a=c;e0){var r=Math.min(this.c,e.length),n=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(r)).length)return this.push(e,t)}else{var i=0,o=0,s=void 0,l=void 0;this.p.length?e.length?((l=new at(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var c=l.length,d=this.c,u=d&&this.d,h=this;oo+30+u+m){var g,f,p=[];h.k.unshift(p),i=2;var y=a7(l,o+18),v=a7(l,o+22),F=function(e,t){if(t){for(var a="",r=0;r=0&&(b.size=y,b.originalSize=v),h.onfile(b)}return"break"}if(d){if(0x8074b50==e)return s=o+=12+(-2==d&&8),i=3,h.c=0,"break";else if(0x2014b50==e)return s=o-=4,i=3,h.c=0,"break"}}();++o);if(this.p=aU,d<0){var m=i?l.subarray(0,s-12-(-2==d&&8)-(0x8074b50==a7(l,s-16)&&4)):l.subarray(0,o);u?u.push(m,!!i):this.k[+(2==i)].push(m)}if(2&i)return this.push(l.subarray(o),t);this.p=l.subarray(o)}t&&(this.c&&aE(13),this.p=null)},rA.prototype.register=function(e){this.o[e.compression]=e},"function"==typeof queueMicrotask&&queueMicrotask;var rG=e.i(48450);let rL=[0,0,0,0,0,0,0,0,0,329,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2809,68,0,27,0,58,3,62,4,7,0,0,15,65,554,3,394,404,189,117,30,51,27,15,34,32,80,1,142,3,142,39,0,144,125,44,122,275,70,135,61,127,8,12,113,246,122,36,185,1,149,309,335,12,11,14,54,151,0,0,2,0,0,211,0,2090,344,736,993,2872,701,605,646,1552,328,305,1240,735,1533,1713,562,3,1775,1149,1469,979,407,553,59,279,31,0,0,0,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function rz(e){return e.node?e.node.pop:e.leaf.pop}let rU=new class{nodes=[];leaves=[];tablesBuilt=!1;buildTables(){if(this.tablesBuilt)return;this.tablesBuilt=!0,this.leaves=[];for(let t=0;t<256;t++){var e;this.leaves.push({pop:rL[t]+ +((e=t)>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)+1,symbol:t,numBits:0,code:0})}this.nodes=[{pop:0,index0:0,index1:0}];let t=256,a=[];for(let e=0;e<256;e++)a.push({node:null,leaf:this.leaves[e]});for(;1!==t;){let e=0xfffffffe,r=0xffffffff,n=-1,i=-1;for(let o=0;oi?n:i;a[s]={node:o,leaf:null},l!==t-1&&(a[l]=a[t-1]),t--}this.nodes[0]=a[0].node,this.generateCodes(0,0,0)}determineIndex(e){return null!==e.leaf?-(this.leaves.indexOf(e.leaf)+1):this.nodes.indexOf(e.node)}generateCodes(e,t,a){if(t<0){let r=this.leaves[-(t+1)];r.code=e,r.numBits=a}else{let r=this.nodes[t];this.generateCodes(e,r.index0,a+1),this.generateCodes(e|1<=0)t=e.readFlag()?this.nodes[t].index1:this.nodes[t].index0;else{a.push(this.leaves[-(t+1)].symbol);break}}return String.fromCharCode(...a)}{let t=e.readInt(8);return String.fromCharCode(...e.readBytes(t))}}};class rO{data;bitNum;maxReadBitNum;error;stringBuffer=null;constructor(e,t=0){this.data=e,this.bitNum=t,this.maxReadBitNum=e.length<<3,this.error=!1}getCurPos(){return this.bitNum}setCurPos(e){this.bitNum=e}getBytePosition(){return this.bitNum+7>>3}isError(){return this.error}isFull(){return this.bitNum>this.maxReadBitNum}getRemainingBits(){return this.maxReadBitNum-this.bitNum}getMaxPos(){return this.maxReadBitNum}readFlag(){if(this.bitNum>=this.maxReadBitNum)return this.error=!0,!1;let e=1<<(7&this.bitNum),t=(this.data[this.bitNum>>3]&e)!=0;return this.bitNum++,t}readInt(e){if(0===e)return 0;if(this.bitNum+e>this.maxReadBitNum)return this.error=!0,0;let t=this.bitNum>>3,a=7&this.bitNum;if(this.bitNum+=e,e+a<=32){let r=0,n=e+a+7>>3;for(let e=0;e>>=a,32===e)?r>>>0:r&(1<>3;for(let e=0;e>>0:r&(1<>3,a=new Uint8Array(t),r=this.bitNum>>3,n=7&this.bitNum,i=8-n;if(0===n)a.set(this.data.subarray(r,r+t));else{let e=this.data[r];for(let o=0;o>n|t<this.maxReadBitNum)return this.error=!0,0;let e=this.bitNum>>3,t=7&this.bitNum,a=rO.f32U8;if(0===t)a[0]=this.data[e],a[1]=this.data[e+1],a[2]=this.data[e+2],a[3]=this.data[e+3];else{let r=8-t;for(let n=0;n<4;n++){let i=this.data[e+n],o=e+n+1>t|o<>>0)}getCompressionPoint(){return this.compressionPoint}getConnectionContext(){let e=this.dataBlockDataMap;return{compressionPoint:this.compressionPoint,ghostTracker:this.ghostTracker,getDataBlockParser:e=>this.registry.getDataBlockParser(e),getDataBlockData:e?t=>e.get(t):void 0,getGhostParser:e=>this.registry.getGhostParser(e)}}setNextRecvEventSeq(e){this.nextRecvEventSeq=e>>>0}setConnectionProtocolState(e){for(this.lastSeqRecvdAtSend=e.lastSeqRecvdAtSend.slice(0,32);this.lastSeqRecvdAtSend.length<32;)this.lastSeqRecvdAtSend.push(0);this.lastSeqRecvd=e.lastSeqRecvd>>>0,this.highestAckedSeq=e.highestAckedSeq>>>0,this.lastSendSeq=e.lastSendSeq>>>0,this.recvAckMask=e.ackMask>>>0,this.connectSequence=e.connectSequence>>>0,this.lastRecvAckAck=e.lastRecvAckAck>>>0,this.connectionEstablished=e.connectionEstablished}onSendPacketTrigger(){this.lastSendSeq=this.lastSendSeq+1>>>0,this.lastSeqRecvdAtSend[31&this.lastSendSeq]=this.lastSeqRecvd>>>0}applyProtocolHeader(e){if(e.connectSeqBit!==(1&this.connectSequence)||e.ackByteCount>4||e.packetType>2)return{accepted:!1,dispatchData:!1};let t=(e.seqNumber|0xfffffe00&this.lastSeqRecvd)>>>0;if(t>>0),this.lastSeqRecvd+31>>0;if(a>>0),this.lastSendSeq>>0,0===e.packetType&&(this.recvAckMask=(1|this.recvAckMask)>>>0);for(let t=this.highestAckedSeq+1;t<=a;t++)(e.ackMask&1<<(a-t&31))!=0&&(this.lastRecvAckAck=this.lastSeqRecvdAtSend[31&t]>>>0);t-this.lastRecvAckAck>32&&(this.lastRecvAckAck=t-32),this.highestAckedSeq=a;let n=this.lastSeqRecvd!==t&&0===e.packetType;return this.lastSeqRecvd=t,{accepted:!0,dispatchData:n}}parsePacket(e){let t=new rO(e),a=this.readDnetHeader(t),r=this.applyProtocolHeader(a);if(this.packetsParsed++,!r.accepted)return this.protocolRejected++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};if(!r.dispatchData)return this.protocolNoDispatch++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};let n=this.readRateInfo(t);t.setStringBuffer(!0);let i=this.readGameState(t),o=void 0===i.controlObjectDataStart||void 0!==i.controlObjectData,s=o?this.readEvents(t):[],l=s[s.length-1],c=!l||l.dataBitsEnd!==l.dataBitsStart,d=o&&c?t.getCurPos():void 0,u=o&&c?this.readGhosts(t,a.seqNumber):[];return t.setStringBuffer(!1),{dnetHeader:a,rateInfo:n,gameState:i,events:s,ghosts:u,ghostSectionStart:d}}readDnetHeader(e){let t=e.readFlag(),a=e.readInt(1),r=e.readInt(9),n=e.readInt(9),i=e.readInt(2),o=e.readInt(3),s=o>0?e.readInt(8*o):0;return{gameFlag:t,connectSeqBit:a,seqNumber:r,highestAck:n,packetType:i,ackByteCount:o,ackMask:s}}readRateInfo(e){let t={};return e.readFlag()&&(t.updateDelay=e.readInt(10),t.packetSize=e.readInt(10)),e.readFlag()&&(t.maxUpdateDelay=e.readInt(10),t.maxPacketSize=e.readInt(10)),t}readGameState(e){let t,a,r,n,i,o,s,l,c,d,u,h,m,g,f,p=e.readInt(32);e.readFlag()&&(e.readFlag()&&(t=e.readFloat(7)),e.readFlag()&&(a=1.5*e.readFloat(7))),e.readFlag()&&(r=e.readFlag(),n=e.readFlag()),e.readFlag()&&((i=e.readFlag())&&(o={x:e.readF32(),y:e.readF32(),z:e.readF32()}),1===(s=e.readRangedU32(0,2))?e.readFlag()&&(l=e.readRangedU32(0,1023)):2===s&&(c={x:e.readF32(),y:e.readF32(),z:e.readF32()}));let y=e.readFlag(),v=e.readFlag();if(e.readFlag())if(e.readFlag()){let f=e.readInt(10);d=f,u=e.getCurPos();let F=e.savePos(),b=this.ghostTracker.getGhost(f),x=b?this.registry.getGhostParser(b.classId):void 0,S=this.controlParserByGhostIndex.get(f),k=this.registry.getGhostParser(25),D=this.registry.getGhostParser(4),P=[],w=new Set,C=e=>{!e?.readPacketData||w.has(e.name)||(w.add(e.name),P.push(e))};C(x),C(S),C(k),C(D);let I=!1;for(let t of P){e.restorePos(F);try{let a=this.getConnectionContext(),r=t.readPacketData(e,a);if(e.getCurPos()-u<=0||e.isError())continue;m=r,h=e.getCurPos(),this.controlParserByGhostIndex.set(f,t),a.compressionPoint!==this.compressionPoint&&(this.compressionPoint=a.compressionPoint,g=this.compressionPoint),this.controlObjectParsed++,I=!0;break}catch{}}if(!I)return e.restorePos(F),h=u,this.controlObjectFailed++,{lastMoveAck:p,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:n,seekerTracking:i,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:c,pinged:y,jammed:v,controlObjectGhostIndex:d,controlObjectDataStart:u,controlObjectDataEnd:h,controlObjectData:m,targetVisibility:[]}}else g={x:e.readF32(),y:e.readF32(),z:e.readF32()},this.compressionPoint=g;let F=[];for(;e.readFlag();)F.push({index:e.readInt(4),mask:e.readInt(32)});return e.readFlag()&&(f=e.readInt(8)),{lastMoveAck:p,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:n,seekerTracking:i,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:c,pinged:y,jammed:v,controlObjectGhostIndex:d,controlObjectDataStart:u,controlObjectDataEnd:h,controlObjectData:m,compressionPoint:g,targetVisibility:F.length>0?F:void 0,cameraFov:f}}readEvents(e){let t=[],a=!0,r=-2;for(;;){let n,i,o,s=e.readFlag();if(a&&!s){if(a=!1,!e.readFlag()){this.dispatchGuaranteedEvents(t);break}}else if(a||s){if(!s)break}else{this.dispatchGuaranteedEvents(t);break}!a&&(r=n=e.readFlag()?r+1&127:e.readInt(7),(i=n|0xffffff80&this.nextRecvEventSeq)0&&this.pendingGuaranteedEvents[0].absoluteSequenceNumber===this.nextRecvEventSeq;){let t=this.pendingGuaranteedEvents.shift();if(!t)break;this.nextRecvEventSeq=this.nextRecvEventSeq+1>>>0,e.push(t.event),t.event.parsedData&&this.applyEventSideEffects(t.event.parsedData)}}applyEventSideEffects(e){let t=e.type;if("GhostingMessageEvent"===t){let t=e.message;"number"==typeof t&&2===t&&this.ghostTracker.clear();return}if("GhostAlwaysObjectEvent"===t){let t=e.ghostIndex,a=e.classId;if("number"==typeof t&&"number"==typeof a){let e=this.registry.getGhostParser(a);this.ghostTracker.createGhost(t,a,e?.name??`unknown_${a}`)}}"SimDataBlockEvent"===t&&this.dataBlockDataMap&&e.dataBlockData&&"number"==typeof e.objectId&&this.dataBlockDataMap.set(e.objectId,e.dataBlockData)}readGhosts(e,t){let a=[];if(!e.readFlag())return a;let r=e.readInt(3)+3;for(;e.readFlag();){let n;if(e.isError())break;let i=e.readInt(r);if(e.isError())break;if(e.readFlag()){this.ghostTracker.deleteGhost(i),this.ghostDeletes++,a.push({index:i,type:"delete",updateBitsStart:e.getCurPos(),updateBitsEnd:e.getCurPos()});continue}let o=!this.ghostTracker.hasGhost(i);n=o?e.readInt(7)+0:this.ghostTracker.getGhost(i)?.classId;let s=e.getCurPos(),l=void 0!==n?this.registry.getGhostParser(n):void 0;if(o&&!l){this.ghostsTrackerDiverged++,rW("DIVERGED pkt=%d seq=%d idx=%d classId=%d bit=%d/%d trackerSize=%d (server sent UPDATE for ghost not in our tracker; 7-bit classId is actually update data)",this.packetsParsed,t,i,n,s,e.getMaxPos(),this.ghostTracker.size()),a.push({index:i,type:"create",classId:n,updateBitsStart:s,updateBitsEnd:s});break}let c=!1;if(l)try{let t=this.getConnectionContext();t.currentGhostIndex=i;let r=l.unpackUpdate(e,o,t),d=e.getCurPos();o&&void 0!==n?(this.ghostTracker.createGhost(i,n,l.name),this.ghostCreatesParsed++):this.ghostUpdatesParsed++,a.push({index:i,type:o?"create":"update",classId:n,updateBitsStart:s,updateBitsEnd:d,parsedData:r}),c=!0}catch(d){this.ghostsFailed++;let r=o?"create":"update",c=d instanceof Error?d.message:String(d);rW("FAIL pkt=%d seq=%d #%d idx=%d op=%s classId=%d parser=%s bit=%d/%d trackerSize=%d err=%s",this.packetsParsed,t,a.length,i,r,n,l.name,s,e.getMaxPos(),this.ghostTracker.size(),c)}if(!c){rW("STOP pkt=%d seq=%d idx=%d op=%s classId=%d parser=%s bit=%d/%d",this.packetsParsed,t,i,o?"create":"update",n,l?.name??"NONE",s,e.getMaxPos()),a.push({index:i,type:o?"create":"update",classId:n,updateBitsStart:s,updateBitsEnd:s});break}}return a}emptyGameState(){return{lastMoveAck:0,pinged:!1,jammed:!1}}}class rK{eventParsers=new Map;ghostParsers=new Map;dataBlockParsers=new Map;eventCatalog=new Map;ghostCatalog=new Map;dataBlockCatalog=new Map;catalogEvent(e){this.eventCatalog.set(e.name,e)}catalogGhost(e){this.ghostCatalog.set(e.name,e)}catalogDataBlock(e){this.dataBlockCatalog.set(e.name,e)}bindDeterministicDataBlocks(e,t){let a=0,r=[];for(let n=0;n0&&(r.sounds=t)}if(e.readFlag()){let t=[];for(let a=0;a<4;a++)e.readFlag()&&t.push({index:a,sequence:e.readInt(5),state:e.readInt(2),forward:e.readFlag(),atEnd:e.readFlag()});t.length>0&&(r.threads=t)}let n=!1;if(e.readFlag()){let a=[];for(let r=0;r<8;r++)if(e.readFlag()){let i={index:r};e.readFlag()?i.dataBlockId=rZ(e):i.dataBlockId=0,e.readFlag()&&(e.readFlag()?i.skinTagIndex=e.readInt(10):i.skinName=e.readString(),n=!0),i.wet=e.readFlag(),i.ammo=e.readFlag(),i.loaded=e.readFlag(),i.target=e.readFlag(),i.triggerDown=e.readFlag(),i.fireCount=e.readInt(3),t&&(i.imageExtraFlag=e.readFlag()),a.push(i)}a.length>0&&(r.images=a)}if(e.readFlag()){if(e.readFlag()){r.stateAEnabled=e.readFlag(),r.stateB=e.readFlag();let t=e.readFlag();r.hasInvulnerability=t,t?(r.invulnerabilityVisual=e.readFlag(),r.invulnerabilityTicks=e.readU32()):r.binaryCloak=e.readFlag()}if(e.readFlag())if(e.readFlag()){let t=e.readFlag();r.stateBMode=t,t?r.energyPackOn=!0:r.energyPackOn=!1}else r.shieldNormal=e.readNormalVector(8),r.energyPercent=e.readFloat(5);e.readFlag()&&(r.stateValue1=e.readU32(),r.stateValue2=e.readU32())}return n&&(r.imageSkinDirty=!0),e.readFlag()&&(e.readFlag()?(r.mountObject=e.readInt(10),r.mountNode=e.readInt(5)):r.mountObject=-1),r}function r0(e,t,a){let r=rQ(e,t,a);if(e.readFlag()&&(r.impactSound=e.readInt(3)),e.readFlag()&&(r.action=e.readInt(8),r.actionHoldAtEnd=e.readFlag(),r.actionAtEnd=e.readFlag(),r.actionFirstPerson=e.readFlag(),!r.actionAtEnd&&e.readFlag()&&(r.actionAnimPos=e.readSignedFloat(6))),e.readFlag()&&(r.armAction=e.readInt(8)),e.readFlag())return r;if(e.readFlag()){if(r.actionState=e.readInt(3),e.readFlag()&&(r.recoverTicks=e.readInt(7)),r.moveFlag0=e.readFlag(),r.moveFlag1=e.readFlag(),r.position=e.readCompressedPoint(a.compressionPoint),e.readFlag()){let t=e.readInt(13)/32,a=e.readNormalVector(10);r.velocity={x:a.x*t,y:a.y*t,z:a.z*t}}else r.velocity={x:0,y:0,z:0};r.headX=e.readSignedFloat(6),r.headZ=e.readSignedFloat(6),r.rotationZ=2*e.readFloat(7)*Math.PI,r.move=rY(e),r.allowWarp=e.readFlag()}return r.energy=e.readFloat(5),r}function r2(e,t){let a={};if(a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.actionState=e.readInt(3),e.readFlag()&&(a.recoverTicks=e.readInt(7)),e.readFlag()&&(a.jumpDelay=e.readInt(7)),e.readFlag()){let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};a.position=r,t.compressionPoint=r,a.velocity={x:e.readF32(),y:e.readF32(),z:e.readF32()},a.jumpSurfaceLastContact=e.readInt(4)}if(a.headX=e.readF32(),a.headZ=e.readF32(),a.rotationZ=e.readF32(),e.readFlag()){let r=e.readInt(10);a.controlObjectGhost=r;let n=t.ghostTracker.getGhost(r),i=n?t.getGhostParser?.(n.classId):void 0;if(i?.readPacketData){let n=t.currentGhostIndex;t.currentGhostIndex=r,a.controlObjectData=i.readPacketData(e,t),t.currentGhostIndex=n}}return a.disableMove=e.readFlag(),a.pilot=e.readFlag(),a}function r1(e,t,a){let r=rQ(e,t,a);return(r.jetting=e.readFlag(),e.readFlag())?r._controlledEarlyReturn=!0:(r.steeringYaw=e.readFloat(9),r.steeringPitch=e.readFloat(9),r.move=rY(e),r.frozen=e.readFlag(),e.readFlag()&&(r.position=e.readCompressedPoint(a.compressionPoint),r.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},r.linMomentum=e.readPoint3F(),r.angMomentum=e.readPoint3F()),e.readFlag()&&(r.energy=e.readFloat(8))),r}function r3(e,t){let a={};a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.steering={x:e.readF32(),y:e.readF32()};let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};return a.linPosition=r,a.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},a.linMomentum=e.readPoint3F(),a.angMomentum=e.readPoint3F(),a.disableMove=e.readFlag(),a.frozen=e.readFlag(),t.compressionPoint=r,a}function r5(e,t){let a=r3(e,t);a.braking=e.readFlag();let r=4,n=t.currentGhostIndex;if(void 0!==n){let e=nN.get(n);void 0!==e&&(r=e)}let i=[];for(let t=0;t64)throw Error(`Invalid Sky fogVolumeCount: ${t}`);r.fogVolumeCount=t,r.useSkyTextures=e.readBool(),r.renderBottomTexture=e.readBool(),r.skySolidColor={r:e.readF32(),g:e.readF32(),b:e.readF32()},r.windEffectPrecipitation=e.readBool();let a=[];for(let r=0;r3)throw Error(`Invalid precipitation colorCount: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/96))throw Error(`Invalid physicalZone point count: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone plane count: ${n}`);let i=[];for(let t=0;tMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone edge count: ${o}`);let s=[];for(let t=0;t0&&(a.audioData=e.readBitsBuffer(8*r)),a}function n6(e,t){return{type:"GhostingMessageEvent",sequence:e.readU32(),message:e.readInt(3),ghostCount:e.readInt(11)}}function n8(e,t){let a={type:"GhostAlwaysObjectEvent"};a.ghostIndex=e.readInt(10);let r=e.readFlag();if(a._hasObjectData=r,r){let r=e.readInt(7);a.classId=r;let n=t.getGhostParser?.(r);if(!n)throw Error(`No ghost parser for GhostAlwaysObjectEvent classId=${r}`);a.objectData=n.unpackUpdate(e,!0,t)}return a}function n7(e,t){let a={type:"PathManagerEvent"};if(e.readFlag()){a.messageType="NewPaths";let t=e.readU32(),r=[];for(let a=0;a0&&(t.hudImages=a),t}function ip(e){let t={};e.readFlag()&&(t.crc=e.readU32()),t.shapeName=e.readString(),t.mountPoint=e.readU32(),e.readFlag()||(t.offset=e.readAffineTransform()),t.firstPerson=e.readFlag(),t.mass=e.readF32(),t.usesEnergy=e.readFlag(),t.minEnergy=e.readF32(),t.hasFlash=e.readFlag(),t.projectile=ic(e),t.muzzleFlash=ic(e),t.isSeeker=e.readFlag(),t.isSeeker&&(t.seekerRadius=e.readF32(),t.maxSeekAngle=e.readF32(),t.seekerLockTime=e.readF32(),t.seekerFreeTime=e.readF32(),t.isTargetLockRequired=e.readFlag(),t.maxLockRange=e.readF32()),t.cloakable=e.readFlag(),t.lightType=e.readRangedU32(0,3),0!==t.lightType&&(t.lightRadius=e.readF32(),t.lightTime=e.readS32(),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)}),t.shellExitDir={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.shellExitVariance=e.readF32(),t.shellVelocity=e.readF32(),t.casing=ic(e),t.accuFire=e.readFlag();let a=[];for(let t=0;t<31;t++){if(!e.readFlag())continue;let t={};t.name=e.readString(),t.transitionOnAmmo=e.readInt(5),t.transitionOnNoAmmo=e.readInt(5),t.transitionOnTarget=e.readInt(5),t.transitionOnNoTarget=e.readInt(5),t.transitionOnWet=e.readInt(5),t.transitionOnNotWet=e.readInt(5),t.transitionOnTriggerUp=e.readInt(5),t.transitionOnTriggerDown=e.readInt(5),t.transitionOnTimeout=e.readInt(5),t.transitionGeneric0In=e.readInt(5),t.transitionGeneric0Out=e.readInt(5),e.readFlag()&&(t.timeoutValue=e.readF32()),t.waitForTimeout=e.readFlag(),t.fire=e.readFlag(),t.ejectShell=e.readFlag(),t.scaleAnimation=e.readFlag(),t.direction=e.readFlag(),t.reload=e.readFlag(),e.readFlag()&&(t.energyDrain=e.readF32()),t.loaded=e.readInt(3),t.spin=e.readInt(3),t.recoil=e.readInt(3),e.readFlag()&&(t.sequence=e.readSignedInt(16)),e.readFlag()&&(t.sequenceVis=e.readSignedInt(16)),t.flashSequence=e.readFlag(),t.ignoreLoadedForReady=e.readFlag(),t.emitter=ic(e),null!==t.emitter&&(t.emitterTime=e.readF32(),t.emitterNode=e.readS32()),t.sound=ic(e),a.push(t)}return t.states=a,t}function iy(e){let t=ig(e);t.renderFirstPerson=e.readFlag(),t.minLookAngle=e.readF32(),t.maxLookAngle=e.readF32(),t.maxFreelookAngle=e.readF32(),t.maxTimeScale=e.readF32(),t.maxStepHeight=e.readF32(),t.runForce=e.readF32(),t.runEnergyDrain=e.readF32(),t.minRunEnergy=e.readF32(),t.maxForwardSpeed=e.readF32(),t.maxBackwardSpeed=e.readF32(),t.maxSideSpeed=e.readF32(),t.maxUnderwaterForwardSpeed=e.readF32(),t.maxUnderwaterBackwardSpeed=e.readF32(),t.maxUnderwaterSideSpeedRef=ic(e),e.readFlag()&&(t.runSurfaceAngleRef=e.readInt(11)),t.runSurfaceAngle=e.readF32(),t.recoverDelay=e.readF32(),t.recoverRunForceScale=e.readF32(),t.jumpForce=e.readF32(),t.jumpEnergyDrain=e.readF32(),t.minJumpEnergy=e.readF32(),t.minJumpSpeed=e.readF32(),t.maxJumpSpeed=e.readF32(),t.jumpSurfaceAngle=e.readF32(),t.minJetEnergy=e.readF32(),t.splashVelocity=e.readF32(),t.splashAngle=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.bubbleEmitTime=e.readF32(),t.medSplashSoundVel=e.readF32(),t.hardSplashSoundVel=e.readF32(),t.exitSplashSoundVel=e.readF32(),t.jumpDelay=e.readInt(7),t.horizMaxSpeed=e.readF32(),t.horizResistSpeed=e.readF32(),t.horizResistFactor=e.readF32(),t.upMaxSpeed=e.readF32(),t.upResistSpeed=e.readF32(),t.upResistFactor=e.readF32(),t.jetEnergyDrain=e.readF32(),t.canJet=e.readF32(),t.maxJetHorizontalPercentage=e.readF32(),t.maxJetForwardSpeed=e.readF32(),t.jetForce=e.readF32(),t.minJetSpeed=e.readF32(),t.maxDamage=e.readF32(),t.minImpactDamageSpeed=e.readF32(),t.impactDamageScale=e.readF32(),t.footSplashHeight=e.readF32();let a=[];for(let t=0;t<32;t++)e.readFlag()?a.push(e.readInt(11)):a.push(null);t.sounds=a,t.boxSize={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.footPuffEmitter=ic(e),t.footPuffNumParts=e.readF32(),t.footPuffRadius=e.readF32(),t.decalData=ic(e),t.decalOffset=e.readF32(),t.dustEmitter=ic(e),t.splash=ic(e);let r=[];for(let t=0;t<3;t++)r.push(ic(e));return t.splashEmitters=r,t.groundImpactMinSpeed=e.readF32(),t.groundImpactShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeDuration=e.readF32(),t.groundImpactShakeFalloff=e.readF32(),t.boundingRadius=e.readF32(),t.moveBubbleSize=e.readF32(),t}function iv(e){let t=ig(e);t.bodyRestitution=e.readF32(),t.bodyFriction=e.readF32();let a=[];for(let t=0;t<2;t++)a.push(ic(e));t.impactSounds=a,t.minImpactSpeed=e.readF32(),t.softImpactSpeed=e.readF32(),t.hardImpactSpeed=e.readF32(),t.minRollSpeed=e.readF32(),t.maxSteeringAngle=e.readF32(),t.maxDrag=e.readF32(),t.minDrag=e.readF32(),t.cameraOffset=e.readF32(),t.cameraLag=e.readF32(),t.jetForce=e.readF32(),t.jetEnergyDrain=e.readF32(),t.minJetEnergy=e.readF32(),t.integration=e.readF32(),t.collisionTol=e.readF32(),t.massCenter=e.readF32(),t.exitSplashSoundVelocity=e.readF32(),t.softSplashSoundVelocity=e.readF32(),t.mediumSplashSoundVelocity=e.readF32(),t.hardSplashSoundVelocity=e.readF32();let r=[];for(let t=0;t<5;t++)r.push(ic(e));t.waterSounds=r,t.dustEmitter=ic(e);let n=[];for(let t=0;t<3;t++)n.push(ic(e));t.damageEmitters=n;let i=[];for(let t=0;t<2;t++)i.push(ic(e));return t.splashEmitters=i,t.damageEmitterOffset0={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageEmitterOffset1={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageLevelTolerance0=e.readF32(),t.damageLevelTolerance1=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.collDamageThresholdVel=e.readF32(),t.collDamageMultiplier=e.readF32(),t}function iF(e){let t=iv(e);t.jetActivateSound=ic(e),t.jetDeactivateSound=ic(e);let a=[];for(let t=0;t<4;t++)a.push(ic(e));return t.jetEmitters=a,t.maneuveringForce=e.readF32(),t.horizontalSurfaceForce=e.readF32(),t.verticalSurfaceForce=e.readF32(),t.autoInputDamping=e.readF32(),t.steeringForce=e.readF32(),t.steeringRollForce=e.readF32(),t.rollForce=e.readF32(),t.autoAngularForce=e.readF32(),t.rotationalDrag=e.readF32(),t.maxAutoSpeed=e.readF32(),t.autoLinearForce=e.readF32(),t.hoverHeight=e.readF32(),t.createHoverHeight=e.readF32(),t.minTrailSpeed=e.readF32(),t.vertThrustMultiple=e.readF32(),t.maxForwardSpeed=e.readF32(),t}function ib(e){let t=iv(e);t.dragForce=e.readF32(),t.mainThrustForce=e.readF32(),t.reverseThrustForce=e.readF32(),t.strafeThrustForce=e.readF32(),t.turboFactor=e.readF32(),t.stabLenMin=e.readF32(),t.stabLenMax=e.readF32(),t.stabSpringConstant=e.readF32(),t.stabDampingConstant=e.readF32(),t.gyroDrag=e.readF32(),t.normalForce=e.readF32(),t.restorativeForce=e.readF32(),t.steeringForce=e.readF32(),t.rollForce=e.readF32(),t.pitchForce=e.readF32(),t.floatingThrustFactor=e.readF32(),t.brakingForce=e.readF32(),t.dustTrailOffset={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.dustTrailFreqMod=e.readF32(),t.triggerTrailHeight=e.readF32(),t.floatSound=ic(e),t.thrustSound=ic(e),t.turboSound=ic(e);let a=[];for(let t=0;t<3;t++)a.push(ic(e));return t.jetEmitters=a,t.dustTrailEmitter=ic(e),t.mainThrustEmitterFactor=e.readF32(),t.strafeThrustEmitterFactor=e.readF32(),t.reverseThrustEmitterFactor=e.readF32(),t}function ix(e){let t=iv(e);return t.tireRadius=e.readF32(),t.tireStaticFriction=e.readF32(),t.tireKineticFriction=e.readF32(),t.tireRestitution=e.readF32(),t.tireLateralForce=e.readF32(),t.tireLateralDamping=e.readF32(),t.tireLateralRelaxation=e.readF32(),t.tireLongitudinalForce=e.readF32(),t.tireLongitudinalDamping=e.readF32(),t.tireEmitter=ic(e),t.jetSound=ic(e),t.engineSound=ic(e),t.squealSound=ic(e),t.wadeSound=ic(e),t.spring=e.readF32(),t.springDamping=e.readF32(),t.springLength=e.readF32(),t.brakeTorque=e.readF32(),t.engineTorque=e.readF32(),t.engineBrake=e.readF32(),t.maxWheelSpeed=e.readF32(),t.steeringAngle=e.readF32(),t.steeringReturn=e.readF32(),t.steeringDamping=e.readF32(),t.powerSteeringFactor=e.readF32(),t}function iS(e){let t=ig(e);return t.noIndividualDamage=e.readFlag(),t.dynamicTypeField=e.readS32(),t}function ik(e){let t=iS(e);return t.thetaMin=e.readF32(),t.thetaMax=e.readF32(),t.thetaNull=e.readF32(),t.neverUpdateControl=e.readFlag(),t.primaryAxis=e.readRangedU32(0,3),t.maxCapacitorEnergy=e.readF32(),t.capacitorRechargeRate=e.readF32(),t}function iD(e){let t=ip(e);return t.activationMS=e.readInt(8),t.deactivateDelayMS=e.readInt(8),t.degPerSecTheta=e.readRangedU32(0,1080),t.degPerSecPhi=e.readRangedU32(0,1080),t.dontFireInsideDamageRadius=e.readFlag(),t.damageRadius=e.readF32(),t.useCapacitor=e.readFlag(),t}function iP(e){let t=ig(e);return t.friction=e.readFloat(10),t.elasticity=e.readFloat(10),t.sticky=e.readFlag(),e.readFlag()&&(t.gravityMod=e.readFloat(10)),e.readFlag()&&(t.maxVelocity=e.readF32()),e.readFlag()&&(t.lightType=e.readInt(2),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)},t.lightTime=e.readS32(),t.lightRadius=e.readF32(),t.lightOnlyStatic=e.readFlag()),t}function iw(e){let t={};t.projectileShapeName=e.readString(),t.faceViewerLinkTime=e.readS32(),t.lifetime=e.readS32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.scale={x:e.readF32(),y:e.readF32(),z:e.readF32()}),t.activateEmitter=ic(e),t.maintainEmitter=ic(e),t.activateSound=ic(e),t.maintainSound=ic(e),t.explosion=ic(e),t.splash=ic(e),t.bounceExplosion=ic(e),t.bounceSound=ic(e),t.underwaterExplosion=ic(e);let a=[];for(let t=0;t<6;t++)a.push(ic(e));return t.decals=a,e.readFlag()&&(t.lightRadius=e.readFloat(8),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),e.readFlag()&&(t.underwaterLightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),t.explodeOnWaterImpact=ih(e),t.depthTolerance=e.readF32(),t}function iC(e){let t=iw(e);return t.dryVelocity=e.readF32(),t.wetVelocity=e.readF32(),t.fizzleTime=e.readU32(),t.fizzleType=e.readU32(),t.hardRetarget=e.readFlag(),t.inheritedVelocityScale=e.readRangedU32(0,90),t.lifetimeMS=e.readRangedU32(0,90),t.collideWithOwnerTimeMS=e.readU32(),t.proximityRadius=e.readU32(),t.tracerProjectile=e.readFlag(),t}function iI(e){let t=iw(e);return t.grenadeElasticity=e.readS32(),t.grenadeFriction=e.readF32(),t.dragCoefficient=e.readF32(),t.windCoefficient=e.readF32(),t.gravityMod=e.readF32(),t.muzzleVelocity=e.readF32(),t.drag=e.readF32(),t.lifetimeMS=e.readS32(),t}function iM(e){let t=iw(e);return t.lifetimeMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.turningSpeed=e.readF32(),t.proximityRadius=e.readF32(),t.terrainAvoidanceSpeed=e.readF32(),t.terrainScanAhead=e.readF32(),t.terrainHeightFail=e.readF32(),t.terrainAvoidanceRadius=e.readF32(),t.flareDistance=e.readF32(),t.flareAngle=e.readF32(),t.useFlechette=ih(e),t.maxVelocity=e.readF32(),t.acceleration=e.readF32(),t.flechetteDelayMs=e.readS32(),t.exhaustTimeMs=e.readS32(),t.exhaustNodeName=e.readString(),t.casingShapeName=e.readString(),t.casingDebris=ic(e),t.puffEmitter=ic(e),t.exhaustEmitter=ic(e),t}function iE(e){let t=iw(e);t.maxRifleRange=e.readF32(),t.rifleHeadMultiplier=e.readF32(),t.beamColor=iu(e),t.fadeTime=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32(),t.lightColor=iu(e),t.lightRadius=e.readF32();let a=[];for(let t=0;t<12;t++)a.push(e.readString());return t.textures=a,t}function iT(e){let t=iw(e);t.zapDuration=e.readF32(),t.boltLength=e.readF32(),t.numParts=e.readF32(),t.lightningFreq=e.readF32(),t.lightningDensity=e.readF32(),t.lightningAmp=e.readF32(),t.lightningWidth=e.readF32(),t.shockwave=ic(e);let a=[],r=[],n=[],i=[];for(let t=0;t<2;t++)a.push(e.readF32()),r.push(e.readF32()),n.push(e.readF32()),i.push(e.readF32());t.startWidth=a,t.endWidth=r,t.boltSpeed=n,t.texWrap=i;let o=[];for(let t=0;t<4;t++)o.push(e.readString());return t.textures=o,t.emitter=ic(e),t}function iB(e){let t=iw(e);return t.beamRange=e.readF32(),t.beamDrainRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t.flareTexture=e.readString(),t.hitEmitter=ic(e),t}function ij(e){let t=iw(e);return t.beamRange=e.readF32(),t.beamRepairRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t}function i_(e){let t=iw(e);t.maxRifleRange=e.readF32(),t.beamColor=iu(e),t.startBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32();let a=[];for(let t=0;t<4;t++)a.push(e.readString());return t.textures=a,t}function iR(e){let t=iC(e);return t.tracerLength=e.readF32(),t.tracerAlpha=e.readF32(),t.tracerMinPixels=e.readF32(),t.crossViewFraction=ih(e),t.tracerColor=iu(e),t.tracerWidth=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=ih(e),t.textureName0=e.readString(),t.textureName1=e.readString(),t}function iN(e){let t=iI(e);return t.energyDrainPerSecond=e.readF32(),t.energyMinDrain=e.readF32(),t.beamWidth=e.readF32(),t.beamRange=e.readF32(),t.numSegments=e.readF32(),t.texRepeat=e.readF32(),t.beamFlareAngle=e.readF32(),t.beamTexture=e.readString(),t.flareTexture=e.readString(),t}function iA(e){let t=iC(e);return t.numFlares=e.readF32(),t.flareColor=iu(e),t.flareTexture=e.readString(),t.smokeTexture=e.readString(),t.size=e.readF32(),t.flareModTexture=e.readF32(),t.smokeSize=e.readF32(),t}function iG(e){let t=iI(e);return t.smokeDist=e.readF32(),t.noSmoke=e.readF32(),t.boomTime=e.readF32(),t.casingDist=e.readF32(),t.smokeCushion=e.readF32(),t.noSmokeCounter=e.readF32(),t.smokeTexture=e.readString(),t.bombTexture=e.readString(),t}function iL(e){let t=iI(e);return t.size=e.readF32(),t.useLensFlare=ih(e),t.flareTexture=e.readString(),t.lensFlareTexture=e.readString(),t}function iz(e){let t={};t.dtsFileName=e.readString(),t.soundProfile=ic(e),t.particleEmitter=ic(e),t.particleDensity=e.readInt(14),t.particleRadius=e.readF32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.explosionScale={x:e.readInt(16),y:e.readInt(16),z:e.readInt(16)}),t.playSpeed=e.readInt(14),t.debrisThetaMin=e.readRangedU32(0,180),t.debrisThetaMax=e.readRangedU32(0,180),t.debrisPhiMin=e.readRangedU32(0,360),t.debrisPhiMax=e.readRangedU32(0,360),t.debrisMinVelocity=e.readRangedU32(0,1e3),t.debrisMaxVelocity=e.readRangedU32(0,1e3),t.debrisNum=e.readInt(14),t.debrisVariance=e.readRangedU32(0,1e4),t.delayMS=e.readInt(16),t.delayVariance=e.readInt(16),t.lifetimeMS=e.readInt(16),t.lifetimeVariance=e.readInt(16),t.offset=e.readF32(),t.shakeCamera=e.readFlag(),t.hasLight=e.readFlag(),t.camShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeDuration=e.readF32(),t.camShakeRadius=e.readF32(),t.camShakeFalloff=e.readF32(),t.shockwave=ic(e),t.debris=ic(e);let a=[];for(let t=0;t<4;t++)a.push(ic(e));t.emitters=a;let r=[];for(let t=0;t<5;t++)r.push(ic(e));t.subExplosions=r;let n=e.readRangedU32(0,4),i=[];for(let t=0;t0&&oo("DataBlock binding: %d/%d bound, missing parsers: %s",t,rV.length,a.join(", "));const{bound:r,missing:n}=this.registry.bindDeterministicGhosts(rq,0);n.length>0&&oo("Ghost binding: %d/%d bound, missing parsers: %s",r,rq.length,n.join(", "));const{bound:i,missing:o}=this.registry.bindDeterministicEvents(rH,255);o.length>0&&oo("Event binding: %d/%d bound, missing parsers: %s",i,rH.length,o.join(", ")),this.packetParser=new r$(this.registry,this.ghostTracker)}getRegistry(){return this.registry}getGhostTracker(){return this.ghostTracker}getPacketParser(){return this.packetParser}get loaded(){return this._loaded}get header(){if(!this._loaded)throw Error("must call load() first");return this._header}get initialBlock(){if(!this._loaded)throw Error("must call load() first");return this._initialBlock}get blockCount(){if(!this._loaded)throw Error("must call load() first");if(void 0===this._blockCount){let e=this._decompressedData,t=this._decompressedView,a=0,r=0;for(;r+2<=e.length;){let n=4095&t.getUint16(r,!0);if((r+=2+n)>e.length)break;a++}this._blockCount=a}return this._blockCount}get blockCursor(){if(!this._loaded)throw Error("must call load() first");return this._blockCursor}async load(){if(this._loaded)return{header:this._header,initialBlock:this._initialBlock};let e=this.readHeader();oo('header: "%s" version=0x%s length=%dms (%smin) initialBlockSize=%d',e.identString,e.protocolVersion.toString(16),e.demoLengthMs,(e.demoLengthMs/1e3/60).toFixed(1),e.initialBlockSize);let t=this.buffer.subarray(this.offset,this.offset+e.initialBlockSize),a=this.readInitialBlock(t);this.offset+=e.initialBlockSize;let r=this.buffer.subarray(this.offset);oo("compressed block stream: %d bytes",r.length);let n=await new Promise((e,t)=>{var a,n;a=(a,r)=>{a?t(a):e(r)},n||(n=a,a={}),"function"!=typeof n&&aE(7),a5(r,a,[aJ],function(e){return a1(rm(e.data[0],a3(e.data[1])))},1,n)});return oo("decompressed block stream: %d bytes",n.length),this._decompressedData=n,this._decompressedView=new DataView(n.buffer,n.byteOffset,n.byteLength),this.setupPacketParser(a),this._header=e,this._initialBlock=a,this._blockStreamOffset=0,this._blockCursor=0,this._loaded=!0,{header:e,initialBlock:a}}nextBlock(){if(!this._loaded)throw Error("must call load() first");let e=this._decompressedData,t=this._decompressedView,a=this._blockStreamOffset;if(a+2>e.length)return;let r=t.getUint16(a,!0),n=r>>12,i=4095&r;if(a+2+i>e.length)return void ol("block %d: size %d would exceed decompressed data (offset=%d remaining=%d), stopping",this._blockCursor,i,a+2,e.length-a-2);let o=e.subarray(a+2,a+2+i);this._blockStreamOffset=a+2+i;let s={index:this._blockCursor,type:n,size:i,data:o};if(this._blockCursor++,0===n)try{s.parsed=this.packetParser.parsePacket(o)}catch{}else if(1===n)this.packetParser.onSendPacketTrigger();else if(2===n&&64===i)try{s.parsed=this.readRawMove(o)}catch{}else if(3===n&&8===i)try{s.parsed=this.readInfoBlock(o)}catch{}return s}reset(){if(!this._loaded)throw Error("must call load() first");this._blockStreamOffset=0,this._blockCursor=0,this._blockCount=void 0,this.setupPacketParser(this._initialBlock)}processBlocks(e){if(!this._loaded)throw Error("must call load() first");let t=0;for(let a=0;a=128&&t<128+rV.length?rV[t-128]:`unknown(${t})`;throw Error(`No parser for DataBlock classId ${t} (${e}) at bit ${i}`)}}oo("all %d/%d DataBlocks parsed (%d payloads), bit position after DataBlocks: %d",l,i,s.size,r.getCurPos());let c=r.readU8(),d=[];for(let e=0;e<6;e++)d.push(r.readU32());let u=[];for(let e=0;e<16;e++)u.push(r.readU32());let h=r.readU32(),m=[];for(let e=0;e>3<<3),this.readSimpleTargetManager(r),this.readSimpleTargetManager(r),os('after sequential tail bit=%d mission="%s" CRC=0x%s',r.getCurPos(),E,T.toString(16))}catch(e){a=e instanceof Error?e.message:String(e)}finally{this.ghostTracker=D}let B=S-r.getCurPos(),j=E.length>0?E.split("").filter(e=>{let t=e.charCodeAt(0);return t>=32&&t<=126}).length/E.length:1,_=E.length>0&&j>=.8&&void 0===a;return oo('initial block: events=%d ghosts=%d ghostingSeq=%d controlObj=%d mission="%s" CRC=0x%s valid=%s%s',P.length,I.length,C,M,E,T.toString(16),_,a?` error=${a}`:""),{taggedStrings:n,dataBlockHeaders:o,dataBlockCount:l,dataBlocks:s,demoSetting:c,connectionFields:d,stateArray:u,scoreEntries:m,demoValues:g,sensorGroupColors:f,targetEntries:p,connectionState:y,roundTripTime:v,packetLoss:F,pathManager:b,notifyCount:x,nextRecvEventSeq:w,ghostingSequence:C,initialGhosts:I,initialEvents:P,controlObjectGhostIndex:M,controlObjectData:t,missionName:E,missionCRC:T,phase2TrailingBits:B,phase2Valid:_,phase2Error:a}}readScoreEntry(e){let t=e.readFlag()?e.readInt(16):0,a=e.readFlag()?e.readInt(16):0,r=e.readFlag()?e.readInt(16):0,n=e.readInt(6),i=e.readInt(6),o=e.readInt(6),s=e.readFlag(),l=[];for(let t=0;t<6;t++)l.push(e.readFlag());return{clientId:t,teamId:a,score:r,field0:n,field1:i,field2:o,isBot:s,triggerFlags:l}}readDemoValues(e){let t=[];for(;e.readFlag();)t.push(e.readString());return t}readComplexTargetManager(e){e.readU8(),e.readU8(),e.readU8(),e.readU8();let t=[];for(let a=0;a<32;a++)for(let r=0;r<32;r++)e.readFlag()&&t.push({group:a,targetGroup:r,r:e.readU8(),g:e.readU8(),b:e.readU8(),a:e.readU8()});let a=[];for(let t=0;t<512;t++){if(!e.readFlag())continue;let r={targetId:t,sensorGroup:0,targetData:0,damageLevel:0};e.readFlag()&&(r.sensorData=e.readU32()),e.readFlag()&&(r.voiceMapData=e.readU32()),e.readFlag()&&(r.name=e.readString()),e.readFlag()&&(r.skin=e.readString()),e.readFlag()&&(r.skinPref=e.readString()),e.readFlag()&&(r.voice=e.readString()),e.readFlag()&&(r.typeDescription=e.readString()),r.sensorGroup=e.readInt(5),r.targetData=e.readInt(9),t>=32&&e.readFlag()&&(r.dataBlockRef=e.readInt(11)),r.damageLevel=e.readFloat(7),a.push(r)}return{sensorGroupColors:t,targets:a}}readPathManager(e){let t=[],a=e.readU32();for(let r=0;rthis.registry.getDataBlockParser(e)};t=i.unpack(e,a)}catch{a.push({classId:r,guaranteed:!0,dataBitsStart:n,dataBitsEnd:n});break}else{a.push({classId:r,guaranteed:!0,dataBitsStart:n,dataBitsEnd:n});break}a.push({classId:r,guaranteed:!0,dataBitsStart:n,dataBitsEnd:e.getCurPos(),parsedData:t}),os(" event classId=%d bits=%d",r,e.getCurPos()-n)}return{nextRecvEventSeq:t,events:a}}readGhostStartBlock(e,t){let a=e.readU32(),r=[];os("ghost block: seq=%d bit=%d",a,e.getCurPos());let n=this.registry.getGhostCatalog(),i=8*e.getBuffer().length,o=new Map;for(let[e,a]of t)o.set(e,a.data);for(;e.readFlag()&&!e.isError();){let a=e.readInt(10),s=e.readInt(7)+0,l=e.getCurPos(),c=[],d=new Set,{entry:u}=this.identifyGhostViaDataBlock(e,t,n),h=this.registry.getGhostParser(s);h&&(c.push({entry:h,method:"registry"}),d.add(h)),u&&!d.has(u)&&(c.push({entry:u,method:"datablock"}),d.add(u));let m={getDataBlockData:e=>o.get(e),getDataBlockParser:e=>this.registry.getDataBlockParser(e)},g=!1;for(let{entry:t,method:n}of c){let o="registry"===n,c=this.tryGhostParser(e,t,l,i,!1,m,o);if(!1!==c){this.ghostTracker.createGhost(a,s,t.name),os(" ghost idx=%d classId=%d parser=%s bits=%d via=%s",a,s,t.name,e.getCurPos()-l,n),r.push({index:a,type:"create",classId:s,updateBitsStart:l,updateBitsEnd:e.getCurPos(),parsedData:c}),g=!0;break}}if(!g){os(" ghost idx=%d classId=%d NO PARSER (stopping at bit=%d, remaining=%d)",a,s,l,i-l);break}}return os("ghost loop ended at bit=%d remaining=%d count=%d",e.getCurPos(),i-e.getCurPos(),r.length),{ghostingSequence:a,ghosts:r}}tryGhostParser(e,t,a,r,n=!1,i,o=!1){let s=e.savePos();n||os(" try %s: startBit=%d",t.name,a);try{let l=t.unpackUpdate(e,!0,{compressionPoint:{x:0,y:0,z:0},ghostTracker:this.ghostTracker,...i}),c=e.getCurPos()-a,d=r-e.getCurPos();if(e.isError()||!o&&c<3)return n||os(" reject %s: bits=%d isError=%s",t.name,c,e.isError()),e.restorePos(s),!1;if(d>1e3){let a=e.getCurPos(),r=e.readFlag();if(e.setCurPos(a),!r)return n||os(" reject %s: bits=%d misaligned (remaining=%d)",t.name,c,d),e.restorePos(s),!1}return l??{}}catch(a){return n||os(" reject %s: error at bit=%d: %s",t.name,e.getCurPos(),a instanceof Error?a.message:String(a)),e.restorePos(s),!1}}identifyGhostViaDataBlock(e,t,a){let r;if(!t)return{entry:void 0,dbFlag:!1};let n=e.savePos(),i=!1;try{if(i=e.readFlag()){let n=e.readInt(11),i=t.get(n);if(i){let e=i.className.replace(/Data$/,"");(r=a.get(e))||os(" identifyGhostViaDataBlock: dbId=%d className=%s ghostName=%s (no ghost parser)",n,i.className,e)}else os(" identifyGhostViaDataBlock: dbId=%d (no DataBlock found)",n)}else os(" identifyGhostViaDataBlock: DataBlock flag=0")}catch{}return e.restorePos(n),{entry:r,dbFlag:i}}readRawMove(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getInt32(0,!0),r=t.getInt32(4,!0),n=t.getInt32(8,!0),i=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getFloat32(24,!0),c=t.getFloat32(28,!0),d=t.getFloat32(32,!0),u=t.getFloat32(36,!0),h=t.getFloat32(40,!0),m=t.getFloat32(44,!0),g=t.getUint32(48,!0),f=t.getUint32(52,!0),p=0!==e[56],y=[];for(let t=0;t<6;t++)y.push(0!==e[57+t]);return{px:a,py:r,pz:n,pyaw:i,ppitch:o,proll:s,x:l,y:c,z:d,yaw:u,pitch:h,roll:m,id:g,sendCount:f,freeLook:p,trigger:y}}readInfoBlock(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{value1:t.getUint32(0,!0),value2:t.getFloat32(4,!0)}}}let od=Object.freeze({r:0,g:255,b:0}),ou=Object.freeze({r:255,g:0,b:0}),oh=new Set(["FlyingVehicle","HoverVehicle","WheeledVehicle"]),om=new Set(["BombProjectile","EnergyProjectile","FlareProjectile","GrenadeProjectile","LinearFlareProjectile","LinearProjectile","Projectile","SeekerProjectile","TracerProjectile"]),og=new Set(["LinearProjectile","TracerProjectile","LinearFlareProjectile","Projectile"]),of=new Set(["GrenadeProjectile","EnergyProjectile","FlareProjectile","BombProjectile"]),op=new Set(["SeekerProjectile"]),oy=new Set(["StaticShape","ScopeAlwaysShape","Turret","BeaconObject","ForceFieldBare"]),ov=new Set(["TSStatic","InteriorInstance","TerrainBlock","Sky","Sun","MissionArea","PhysicalZone","MissionMarker","SpawnSphere","VehicleBlocker","Camera"]),oF=.494*Math.PI,ob=new o.Matrix4,ox=new o.Quaternion;function oS(e){return null!=e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function ok(e,t,a){return ea?a:e}function oD(e){let t=-e/2;return[0,Math.sin(t),0,Math.cos(t)]}function oP(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(e.z)||!Number.isFinite(e.w))return null;let t=-e.y,a=-e.z,r=-e.x,n=e.w,i=t*t+a*a+r*r+n*n;if(i<=1e-12)return null;let o=1/Math.sqrt(i);return[t*o,a*o,r*o,n*o]}function ow(e){let t="";for(let a=0;a=32&&(t+=e[a]);return t}function oC(e){return"Player"===e?"Player":oh.has(e)?"Vehicle":"Item"===e?"Item":om.has(e)?"Projectile":oy.has(e)?"Deployable":"Ghost"}function oI(e,t){return"Player"===e?`player_${t}`:oh.has(e)?`vehicle_${t}`:"Item"===e?`item_${t}`:om.has(e)?`projectile_${t}`:oy.has(e)?`deployable_${t}`:`ghost_${t}`}function oM(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w}function oE(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z}function oT(e){if(e){for(let t of[e.shapeName,e.projectileShapeName,e.shapeFileName,e.shapeFile,e.model])if("string"==typeof t&&t.length>0)return t}}function oB(e,t){if(e)for(let a of t){let t=e[a];if("number"==typeof t&&Number.isFinite(t))return t}}function oj(e,t){if(e)for(let a of t){let t=e[a];if("string"==typeof t&&t.length>0)return t}}function o_(e){return e?"number"==typeof e.cameraMode?"camera":"number"==typeof e.rotationZ?"player":null:null}class oR{parser;initialBlock;registry;netStrings=new Map;targetNames=new Map;targetTeams=new Map;sensorGroupColors=new Map;state;constructor(e){this.parser=e,this.registry=e.getRegistry();const t=e.initialBlock;this.initialBlock={dataBlocks:t.dataBlocks,initialGhosts:t.initialGhosts,controlObjectGhostIndex:t.controlObjectGhostIndex,controlObjectData:t.controlObjectData,targetEntries:t.targetEntries,sensorGroupColors:t.sensorGroupColors,taggedStrings:t.taggedStrings},this.state={moveTicks:0,moveYawAccum:0,movePitchAccum:0,yawOffset:0,pitchOffset:0,lastAbsYaw:0,lastAbsPitch:0,lastControlType:"player",isPiloting:!1,lastOrbitDistance:void 0,exhausted:!1,latestFov:100,latestControl:{ghostIndex:t.controlObjectGhostIndex,data:t.controlObjectData,position:oS(t.controlObjectData?.position)?t.controlObjectData?.position:void 0},camera:null,entitiesById:new Map,entityIdByGhostIndex:new Map,lastStatus:{health:1,energy:1},nextExplosionId:0,playerSensorGroup:0},this.reset()}reset(){for(let[e,t]of(this.parser.reset(),this.netStrings.clear(),this.targetNames.clear(),this.targetTeams.clear(),this.sensorGroupColors.clear(),this.state.entitiesById.clear(),this.state.entityIdByGhostIndex.clear(),this.initialBlock.taggedStrings))this.netStrings.set(e,t);for(let e of this.initialBlock.targetEntries)e.name&&this.targetNames.set(e.targetId,ow(e.name)),this.targetTeams.set(e.targetId,e.sensorGroup);for(let e of this.initialBlock.sensorGroupColors){let t=this.sensorGroupColors.get(e.group);t||(t=new Map,this.sensorGroupColors.set(e.group,t)),t.set(e.targetGroup,{r:e.r,g:e.g,b:e.b})}if(this.state.playerSensorGroup=0,this.state.moveTicks=0,this.state.moveYawAccum=0,this.state.movePitchAccum=0,this.state.yawOffset=0,this.state.pitchOffset=0,this.state.lastAbsYaw=0,this.state.lastAbsPitch=0,this.state.lastControlType=o_(this.initialBlock.controlObjectData)??"player",this.state.isPiloting="player"===this.state.lastControlType&&!!(this.initialBlock.controlObjectData?.pilot||this.initialBlock.controlObjectData?.controlObjectGhost!=null),this.state.lastCameraMode="camera"===this.state.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.cameraMode?this.initialBlock.controlObjectData.cameraMode:void 0,this.state.lastOrbitGhostIndex="camera"===this.state.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.orbitObjectGhostIndex?this.initialBlock.controlObjectData.orbitObjectGhostIndex:void 0,"camera"===this.state.lastControlType){let e=this.initialBlock.controlObjectData?.minOrbitDist,t=this.initialBlock.controlObjectData?.maxOrbitDist,a=this.initialBlock.controlObjectData?.curOrbitDist;"number"==typeof e&&"number"==typeof t&&Number.isFinite(e)&&Number.isFinite(t)?this.state.lastOrbitDistance=Math.max(0,t-e):"number"==typeof a&&Number.isFinite(a)?this.state.lastOrbitDistance=Math.max(0,a):this.state.lastOrbitDistance=void 0}else this.state.lastOrbitDistance=void 0;let e=this.getAbsoluteRotation(this.initialBlock.controlObjectData);for(let t of(e&&(this.state.lastAbsYaw=e.yaw,this.state.lastAbsPitch=e.pitch,this.state.yawOffset=e.yaw,this.state.pitchOffset=e.pitch),this.state.exhausted=!1,this.state.latestFov=100,this.state.latestControl={ghostIndex:this.initialBlock.controlObjectGhostIndex,data:this.initialBlock.controlObjectData,position:oS(this.initialBlock.controlObjectData?.position)?this.initialBlock.controlObjectData?.position:void 0},this.state.controlPlayerGhostId="player"===this.state.lastControlType&&this.initialBlock.controlObjectGhostIndex>=0?`player_${this.initialBlock.controlObjectGhostIndex}`:void 0,this.state.camera=null,this.state.lastStatus={health:1,energy:1},this.state.nextExplosionId=0,this.initialBlock.initialGhosts)){if("create"!==t.type||null==t.classId)continue;let e=this.registry.getGhostParser(t.classId)?.name??`ghost_${t.classId}`,a=oI(e,t.index),r={id:a,ghostIndex:t.index,className:e,spawnTick:0,type:oC(e),rotation:[0,0,0,1]};this.applyGhostData(r,t.parsedData),this.state.entitiesById.set(a,r),this.state.entityIdByGhostIndex.set(t.index,a)}if(0===this.state.playerSensorGroup&&"player"===this.state.lastControlType&&this.state.latestControl.ghostIndex>=0){let e=this.state.entityIdByGhostIndex.get(this.state.latestControl.ghostIndex),t=e?this.state.entitiesById.get(e):void 0;t?.sensorGroup!=null&&t.sensorGroup>0&&(this.state.playerSensorGroup=t.sensorGroup)}this.updateCameraAndHud()}getSnapshot(){return this.buildSnapshot()}getEffectShapes(){let e=new Set;for(let[,t]of this.initialBlock.dataBlocks){let a=t.data?.explosion;if(null==a)continue;let r=this.getDataBlockData(a),n=r?.dtsFileName;n&&e.add(n)}return[...e]}stepToTime(e,t=1/0){let a=Math.floor(1e3*(Number.isFinite(e)?Math.max(0,e):0)/32);a0&&(this.state.playerSensorGroup=t.sensorGroup)}if(a){let e=o_(a);if(e&&(this.state.lastControlType=e),"player"===this.state.lastControlType)this.state.isPiloting=!!(a.pilot||null!=a.controlObjectGhost);else if(this.state.isPiloting=!1,"number"==typeof a.cameraMode)if(this.state.lastCameraMode=a.cameraMode,3===a.cameraMode){"number"==typeof a.orbitObjectGhostIndex&&(this.state.lastOrbitGhostIndex=a.orbitObjectGhostIndex);let e=a.minOrbitDist,t=a.maxOrbitDist,r=a.curOrbitDist;"number"==typeof e&&"number"==typeof t&&Number.isFinite(e)&&Number.isFinite(t)?this.state.lastOrbitDistance=Math.max(0,t-e):"number"==typeof r&&Number.isFinite(r)&&(this.state.lastOrbitDistance=Math.max(0,r))}else this.state.lastOrbitGhostIndex=void 0,this.state.lastOrbitDistance=void 0}for(let e of t.events){let t=this.registry.getEventParser(e.classId)?.name;if("NetStringEvent"===t&&e.parsedData){let t=e.parsedData.id,a=e.parsedData.value;null!=t&&"string"==typeof a&&this.netStrings.set(t,a);continue}if("TargetInfoEvent"===t&&e.parsedData){let t=e.parsedData.targetId,a=e.parsedData.nameTag;if(null!=t&&null!=a){let e=this.netStrings.get(a);e&&this.targetNames.set(t,ow(e))}let r=e.parsedData.sensorGroup;null!=t&&null!=r&&this.targetTeams.set(t,r)}else if("SetSensorGroupEvent"===t&&e.parsedData){let t=e.parsedData.sensorGroup;null!=t&&(this.state.playerSensorGroup=t)}else if("SensorGroupColorEvent"===t&&e.parsedData){let t=e.parsedData.sensorGroup,a=e.parsedData.colors;if(a){let e=this.sensorGroupColors.get(t);for(let r of(e||(e=new Map,this.sensorGroupColors.set(t,e)),a))r.default?e.delete(r.index):e.set(r.index,{r:r.r??0,g:r.g??0,b:r.b??0})}}}for(let e of t.ghosts)this.applyPacketGhost(e);return}if(3===e.type&&this.isInfoData(e.parsed)){Number.isFinite(e.parsed.value2)&&(this.state.latestFov=e.parsed.value2);return}2===e.type&&this.isMoveData(e.parsed)&&(this.state.moveYawAccum+=e.parsed.yaw??0,this.state.movePitchAccum+=e.parsed.pitch??0)}applyPacketGhost(e){let t,a=e.index,r=this.state.entityIdByGhostIndex.get(a);if(r){let t=this.state.entitiesById.get(r);t&&"Projectile"===t.type&&!t.hasExploded&&t.explosionShape&&t.position&&("delete"===e.type||"create"===e.type)&&this.spawnExplosion(t,[...t.position])}if("delete"===e.type){r&&(this.state.entitiesById.delete(r),this.state.entityIdByGhostIndex.delete(a));return}let n=this.resolveGhostClassName(a,e.classId);if(!n)return;let i=oI(n,a);r&&r!==i&&this.state.entitiesById.delete(r);let o=this.state.entitiesById.get(i);o&&"create"===e.type?(o.spawnTick=this.state.moveTicks,o.rotation=[0,0,0,1],o.hasExploded=void 0,o.explosionShape=void 0,o.explosionLifetimeTicks=void 0,o.faceViewer=void 0,o.simulatedVelocity=void 0,o.projectilePhysics=void 0,o.gravityMod=void 0,o.direction=void 0,o.velocity=void 0,o.position=void 0,o.dataBlock=void 0,o.dataBlockId=void 0,o.shapeHint=void 0,o.visual=void 0,t=o):o?t=o:(t={id:i,ghostIndex:a,className:n,spawnTick:this.state.moveTicks,type:oC(n),rotation:[0,0,0,1]},this.state.entitiesById.set(i,t)),t.ghostIndex=a,t.className=n,t.type=oC(n),this.state.entityIdByGhostIndex.set(a,i),this.applyGhostData(t,e.parsedData)}resolveGhostClassName(e,t){if("number"==typeof t){let e=this.registry.getGhostParser(t)?.name;if(e)return e}let a=this.state.entityIdByGhostIndex.get(e);if(a){let e=this.state.entitiesById.get(a);if(e?.className)return e.className}let r=this.parser.getGhostTracker().getGhost(e);if(r?.className)return r.className}resolveEntityIdForGhostIndex(e){let t=this.state.entityIdByGhostIndex.get(e);if(t)return t;let a=this.parser.getGhostTracker().getGhost(e);if(a)return oI(a.className,e)}getDataBlockData(e){let t=this.initialBlock.dataBlocks.get(e);if(t?.data)return t.data;let a=this.parser.getPacketParser();return a.dataBlockDataMap?.get(e)}resolveExplosionInfo(e){let t=this.getDataBlockData(e),a=t?.maintainSound;if(null==a)return void console.log("[streaming] resolveExplosionInfo — no explosion field on projBlock id:",e);let r=this.getDataBlockData(a);if(!r)return void console.log("[streaming] resolveExplosionInfo — expBlock not found for explosionId:",a);let n=r.dtsFileName;if(!n)return void console.log("[streaming] resolveExplosionInfo — no dtsFileName on expBlock, explosionId:",a,"keys:",Object.keys(r));let i=r.lifetimeMS??31;return console.log("[streaming] resolveExplosionInfo OK — projDataBlockId:",e,"explosionId:",a,"shape:",n,"lifetimeTicks:",i),{shape:n,faceViewer:!1!==r.faceViewer&&0!==r.faceViewer,lifetimeTicks:i,explosionDataBlockId:a}}applyGhostData(e,t){if(!t)return;let a=t.dataBlockId;if(null!=a){e.dataBlockId=a;let t=this.getDataBlockData(a),r=oT(t);if(e.visual=function(e,t){if(!t)return;let a=oj(t,["tracerTex0","textureName0","texture0"])??"";if(!("TracerProjectile"===e||a.length>0&&null!=oB(t,["tracerLength"]))||!a)return;let r=oj(t,["tracerTex1","textureName1","texture1"]),n=oB(t,["tracerLength"])??10,i=oB(t,["tracerWidth"]),o=oB(t,["tracerAlpha"]),s=null!=i&&(null!=oB(t,["crossViewAng"])||i<=.7)?i:o??i??.5,l=oB(t,["crossViewAng","crossViewFraction"])??("number"==typeof t.tracerWidth&&t.tracerWidth>.7?t.tracerWidth:.98);return{kind:"tracer",texture:a,crossTexture:r,tracerLength:n,tracerWidth:s,crossViewAng:l,crossSize:oB(t,["crossSize","muzzleVelocity"])??.45,renderCross:function(e,t){if(e)for(let a of t){let t=e[a];if("boolean"==typeof t)return t}}(t,["renderCross","proximityRadius"])??!0}}(e.className,t)??function(e,t){if(t){if("LinearFlareProjectile"===e){let e=oj(t,["smokeTexture","flareTexture"]);if(!e)return;let a=t.flareColor,r=oB(t,["size"])??.5;return{kind:"sprite",texture:e,color:a?{r:a.r,g:a.g,b:a.b}:{r:1,g:1,b:1},size:r}}if("FlareProjectile"===e){let e=oj(t,["flareTexture"]);if(!e)return;return{kind:"sprite",texture:e,color:{r:1,g:.9,b:.5},size:oB(t,["size"])??4}}}}(e.className,t),"string"==typeof r&&(e.shapeHint=r,e.dataBlock=r),"Player"===e.type&&"number"==typeof t?.maxEnergy&&(e.maxEnergy=t.maxEnergy),"Projectile"===e.type&&(og.has(e.className)?e.projectilePhysics="linear":of.has(e.className)?(e.projectilePhysics="ballistic",e.gravityMod=oB(t,["gravityMod"])??1):op.has(e.className)&&(e.projectilePhysics="seeker")),"Projectile"===e.type&&!e.explosionShape){let t=this.resolveExplosionInfo(a);t&&(e.explosionShape=t.shape,e.faceViewer=t.faceViewer,e.explosionLifetimeTicks=t.lifetimeTicks,e.explosionDataBlockId=t.explosionDataBlockId)}if("Projectile"===e.type&&null==e.maintainEmitterId){let a=t?.activateEmitter;"number"==typeof a&&a>0?(e.maintainEmitterId=a,console.log("[streaming] baseEmitter resolved for",e.className,e.id,"— emitterId:",a)):e.maintainEmitterChecked||(console.log("[streaming] baseEmitter NOT found on",e.className,e.id,"— blockData keys:",t?Object.keys(t):"NO blockData","activateEmitter:",t?.activateEmitter),e.maintainEmitterChecked=!0)}}if("Player"===e.type){let a=t.images;if(Array.isArray(a)&&a.length>0){let t=a[0];if(t?.dataBlockId&&t.dataBlockId>0){let a=this.getDataBlockData(t.dataBlockId),r=oT(a);if(r){let t=a?.mountPoint;(null==t||t<=0)&&!/pack_/i.test(r)&&(e.weaponShape=r)}}else t&&!t.dataBlockId&&(e.weaponShape=void 0)}}let r=oS(t.position)?t.position:oS(t.initialPosition)?t.initialPosition:oS(t.explodePosition)?t.explodePosition:oS(t.endPoint)?t.endPoint:oS(t.transform?.position)?t.transform.position:void 0;r&&(e.position=[r.x,r.y,r.z]);let n=oE(t.direction)?t.direction:void 0;if(n&&(e.direction=[n.x,n.y,n.z]),"Player"===e.type&&"number"==typeof t.rotationZ)e.rotation=oD(t.rotationZ);else if(oM(t.angPosition)){let a=oP(t.angPosition);a&&(e.rotation=a)}else if(oM(t.transform?.rotation)){let a=oP(t.transform.rotation);a&&(e.rotation=a)}else if("Item"===e.type&&"number"==typeof t.rotation?.angle){let a=t.rotation;e.rotation=oD((a.zSign??1)*a.angle)}else if("Projectile"===e.type){let a=t.velocity??t.direction??(oS(t.initialPosition)&&oS(t.endPos)?{x:t.endPos.x-t.initialPosition.x,y:t.endPos.y-t.initialPosition.y,z:t.endPos.z-t.initialPosition.z}:void 0);oE(a)&&(0!==a.x||0!==a.y)&&(e.rotation=oD(Math.atan2(a.x,a.y)))}if(oE(t.velocity)&&(e.velocity=[t.velocity.x,t.velocity.y,t.velocity.z],e.direction||(e.direction=[t.velocity.x,t.velocity.y,t.velocity.z])),"Item"===e.type){let a=t.atRest;if(!0===a)e.itemPhysics=void 0;else if(!1===a&&oE(t.velocity)){let a=null!=e.dataBlockId?this.getDataBlockData(e.dataBlockId):void 0;e.itemPhysics={velocity:[t.velocity.x,t.velocity.y,t.velocity.z],atRest:!1,elasticity:oB(a,["elasticity"])??.2,friction:oB(a,["friction"])??.6,gravityMod:oB(a,["gravityMod"])??1}}else r&&!oE(t.velocity)&&(e.itemPhysics=void 0)}if(e.projectilePhysics){if("linear"===e.projectilePhysics){let a=oB(null!=e.dataBlockId?this.getDataBlockData(e.dataBlockId):void 0,["dryVelocity","muzzleVelocity","bulletVelocity"])??80,r=e.direction??[0,1,0],n=r[0]*a,i=r[1]*a,o=r[2]*a,s=t.excessVel,l=t.excessDir;"number"==typeof s&&s>0&&oE(l)&&(n+=l.x*s,i+=l.y*s,o+=l.z*s),e.simulatedVelocity=[n,i,o]}else e.velocity&&(e.simulatedVelocity=[e.velocity[0],e.velocity[1],e.velocity[2]]);let a=t.currTick;if("number"==typeof a&&a>0&&e.simulatedVelocity&&e.position){let t=.032*a,r=e.simulatedVelocity;if(e.position[0]+=r[0]*t,e.position[1]+=r[1]*t,e.position[2]+=r[2]*t,"ballistic"===e.projectilePhysics){let a=9.81*(e.gravityMod??1);e.position[2]-=.5*a*t*t,r[2]-=a*t}}}let i=oS(t.explodePosition)?t.explodePosition:oS(t.explodePoint)?t.explodePoint:void 0;if("Projectile"===e.type&&!e.hasExploded&&i&&e.explosionShape&&this.spawnExplosion(e,[i.x,i.y,i.z]),"number"==typeof t.damageLevel&&(e.health=ok(1-t.damageLevel,0,1)),"number"==typeof t.damageState&&(e.damageState=t.damageState),"number"==typeof t.action&&(e.actionAnim=t.action,e.actionAtEnd=!!t.actionAtEnd),Array.isArray(t.threads)&&(e.threads=t.threads),"number"==typeof t.energy&&(e.energy=ok(t.energy,0,1)),"number"==typeof t.targetId){e.targetId=t.targetId;let a=this.targetNames.get(t.targetId);a&&(e.playerName=a);let r=this.targetTeams.get(t.targetId);null!=r&&(e.sensorGroup=r,e.ghostIndex===this.state.latestControl.ghostIndex&&"player"===this.state.lastControlType&&(this.state.playerSensorGroup=r))}}advanceProjectiles(){for(let e of this.state.entitiesById.values()){if(!e.simulatedVelocity||!e.position)continue;let t=e.simulatedVelocity,a=e.position;if("ballistic"===e.projectilePhysics){let a=9.81*(e.gravityMod??1);t[2]-=.032*a}a[0]+=.032*t[0],a[1]+=.032*t[1],a[2]+=.032*t[2],(0!==t[0]||0!==t[1])&&(e.rotation=oD(Math.atan2(t[0],t[1])))}}advanceItems(){for(let a of this.state.entitiesById.values()){var e,t;let r=a.itemPhysics;if(!r||r.atRest||!a.position)continue;let n=r.velocity,i=a.position;n[2]+=-20*r.gravityMod*.032,i[0]+=.032*n[0],i[1]+=.032*n[1],i[2]+=.032*n[2];let o=(e=i[0],t=i[1],C?C(e,t):null);if(null!=o&&i[2]0){let e=Math.max(0,1-t/a);n[0]*=e,n[1]*=e}.15>Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2])&&(n[0]=n[1]=n[2]=0,r.atRest=!0)}}}spawnExplosion(e,t){e.hasExploded=!0;let a=`fx_${this.state.nextExplosionId++}`,r=e.explosionLifetimeTicks??31;console.log("[streaming] spawnExplosion — fxId:",a,"explosionDataBlockId:",e.explosionDataBlockId,"explosionShape:",e.explosionShape,"pos:",t,"lifetimeTicks:",r,"moveTicks:",this.state.moveTicks);let n={id:a,ghostIndex:-1,className:"Explosion",spawnTick:this.state.moveTicks,type:"Explosion",dataBlock:e.explosionShape,explosionDataBlockId:e.explosionDataBlockId,position:t,rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==e.faceViewer,expiryTick:this.state.moveTicks+r};this.state.entitiesById.set(a,n),e.position=void 0,e.simulatedVelocity=void 0}removeExpiredExplosions(){for(let[e,t]of this.state.entitiesById)t.isExplosion&&null!=t.expiryTick&&this.state.moveTicks>=t.expiryTick&&this.state.entitiesById.delete(e)}updateCameraAndHud(){let e=this.state.latestControl,t=.032*this.state.moveTicks,a=e.data,r=this.state.lastControlType;if(e.position){var n,i;let o,s,l,c,d=this.getAbsoluteRotation(a),u=!this.state.isPiloting&&"player"===r,h=u?this.state.moveYawAccum+this.state.yawOffset:this.state.lastAbsYaw,m=u?this.state.movePitchAccum+this.state.pitchOffset:this.state.lastAbsPitch,g=h,f=m;if(d?(g=d.yaw,f=d.pitch,this.state.lastAbsYaw=g,this.state.lastAbsPitch=f,this.state.yawOffset=g-this.state.moveYawAccum,this.state.pitchOffset=f-this.state.movePitchAccum):u?(this.state.lastAbsYaw=g,this.state.lastAbsPitch=f):(g=this.state.lastAbsYaw,f=this.state.lastAbsPitch),this.state.camera={time:t,position:[e.position.x,e.position.y,e.position.z],rotation:(n=g,o=Math.sin(i=ok(f,-oF,oF)),s=Math.cos(i),l=Math.sin(n),c=Math.cos(n),ob.set(-l,c*o,-c*s,0,0,s,o,0,c,l*o,-l*s,0,0,0,0,1),ox.setFromRotationMatrix(ob),[ox.x,ox.y,ox.z,ox.w]),fov:this.state.latestFov,mode:"observer",yaw:g,pitch:f},"camera"===r)if(("number"==typeof a?.cameraMode?a.cameraMode:this.state.lastCameraMode)===3){this.state.camera.mode="third-person","number"==typeof this.state.lastOrbitDistance&&(this.state.camera.orbitDistance=this.state.lastOrbitDistance);let e="number"==typeof a?.orbitObjectGhostIndex?a.orbitObjectGhostIndex:this.state.lastOrbitGhostIndex;"number"==typeof e&&e>=0&&(this.state.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(e))}else this.state.camera.mode="observer";else this.state.camera.mode="first-person",e.ghostIndex>=0&&(this.state.controlPlayerGhostId=`player_${e.ghostIndex}`),this.state.controlPlayerGhostId&&(this.state.camera.controlEntityId=this.state.controlPlayerGhostId);if("player"===r&&!this.state.isPiloting&&this.state.controlPlayerGhostId&&e.position){let t=this.state.entitiesById.get(this.state.controlPlayerGhostId);t&&(t.position=[e.position.x,e.position.y,e.position.z],t.rotation=oD(g))}}else this.state.camera&&(this.state.camera={...this.state.camera,time:t,fov:this.state.latestFov});let o={health:1,energy:1};if(this.state.camera?.mode==="first-person"){let e=this.state.controlPlayerGhostId,t=e?this.state.entitiesById.get(e):void 0;o.health=t?.health??1;let r=a?.energyLevel;if("number"==typeof r){let e=t?.maxEnergy??60;e>0&&(o.energy=ok(r/e,0,1))}else o.energy=t?.energy??1}else if(this.state.camera?.mode==="third-person"&&this.state.camera.orbitTargetId){let e=this.state.entitiesById.get(this.state.camera.orbitTargetId);o.health=e?.health??1,o.energy=e?.energy??1}this.state.lastStatus=o}buildSnapshot(){let e=[];for(let t of this.state.entitiesById.values())(t.spawnTick>0||!ov.has(t.className))&&e.push({id:t.id,type:t.type,visual:t.visual,direction:t.direction,ghostIndex:t.ghostIndex,className:t.className,dataBlockId:t.dataBlockId,shapeHint:t.shapeHint,dataBlock:t.dataBlock,weaponShape:t.weaponShape,playerName:t.playerName,iffColor:"Player"===t.type&&null!=t.sensorGroup?this.resolveIffColor(t.sensorGroup):void 0,position:t.position&&(t.simulatedVelocity||t.itemPhysics&&!t.itemPhysics.atRest)?[...t.position]:t.position,rotation:t.rotation,velocity:t.velocity,health:t.health,energy:t.energy,actionAnim:t.actionAnim,actionAtEnd:t.actionAtEnd,damageState:t.damageState,faceViewer:t.faceViewer,threads:t.threads,explosionDataBlockId:t.explosionDataBlockId,maintainEmitterId:t.maintainEmitterId});return{timeSec:.032*this.state.moveTicks,exhausted:this.state.exhausted,camera:this.state.camera,entities:e,controlPlayerGhostId:this.state.controlPlayerGhostId,status:this.state.lastStatus}}resolveIffColor(e){if(0===this.state.playerSensorGroup)return;let t=this.sensorGroupColors.get(this.state.playerSensorGroup);if(t){let a=t.get(e);if(a)return a}return e===this.state.playerSensorGroup?od:0!==e?ou:void 0}getAbsoluteRotation(e){return e?"number"==typeof e.rotationZ&&"number"==typeof e.headX?{yaw:e.rotationZ,pitch:e.headX}:"number"==typeof e.rotZ&&"number"==typeof e.rotX?{yaw:e.rotZ,pitch:e.rotX}:null:null}isPacketData(e){return!!e&&"object"==typeof e&&"gameState"in e&&"events"in e&&"ghosts"in e}isMoveData(e){return!!e&&"object"==typeof e&&"yaw"in e}isInfoData(e){return!!e&&"object"==typeof e&&"value2"in e&&"number"==typeof e.value2}}async function oN(e){let t=new oc(new Uint8Array(e)),{header:a,initialBlock:r}=await t.load(),{missionName:n,gameType:i}=function(e){let t=null,a=null;for(let r=0;r{if(h){f.current=f.current+1,m(null);return}g.current?.click()},u[0]=h,u[1]=m,u[2]=e):e=u[2];let p=e;u[3]!==m?(t=async e=>{let t=e.target.files?.[0];if(t){e.target.value="";try{let e=await t.arrayBuffer(),a=f.current+1;f.current=a;let r=await oN(e);if(f.current!==a)return;m(r)}catch(e){console.error("Failed to load demo:",e)}}},u[3]=m,u[4]=t):t=u[4];let y=t;u[5]===Symbol.for("react.memo_cache_sentinel")?(i={display:"none"},u[5]=i):i=u[5],u[6]!==y?(o=(0,a.jsx)("input",{ref:g,type:"file",accept:".rec",style:i,onChange:y}),u[6]=y,u[7]=o):o=u[7];let v=h?"Unload demo":"Load demo (.rec)",F=h?"Unload demo":"Load demo (.rec)",b=h?"true":void 0;u[8]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(t7,{className:oA.default.DemoIcon}),u[8]=s):s=u[8];let x=h?"Unload demo":"Demo";return u[9]!==x?(l=(0,a.jsx)("span",{className:oA.default.ButtonLabel,children:x}),u[9]=x,u[10]=l):l=u[10],u[11]!==p||u[12]!==v||u[13]!==F||u[14]!==b||u[15]!==l?(c=(0,a.jsxs)("button",{type:"button",className:oA.default.Root,"aria-label":v,title:F,onClick:p,"data-active":b,children:[s,l]}),u[11]=p,u[12]=v,u[13]=F,u[14]=b,u[15]=l,u[16]=c):c=u[16],u[17]!==c||u[18]!==o?(d=(0,a.jsxs)(a.Fragment,{children:[o,c]}),u[17]=c,u[18]=o,u[19]=d):d=u[19],d}function oL(e){return(0,t5.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}function oz(e){return(0,t5.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(e)}var oU=e.i(65883);function oO(e){let t,i,o,s,l,c,d,u,h,m,g,f,p,y,F,b,x,S,k,D,P,w,C,I,M,E,T,B,j,_,R,N,A,G,L,z,U,O,V,q,H,W,$,K,X,Y=(0,r.c)(103),{missionName:Z,missionType:J,onChangeMission:Q,onOpenMapInfo:ee,cameraRef:et,isTouch:ea}=e,{fogEnabled:er,setFogEnabled:en,fov:ei,setFov:eo,audioEnabled:es,setAudioEnabled:el,animationEnabled:ec,setAnimationEnabled:ed}=(0,v.useSettings)(),{speedMultiplier:eu,setSpeedMultiplier:eh,touchMode:em,setTouchMode:eg}=(0,v.useControls)(),{debugMode:ef,setDebugMode:ep}=(0,v.useDebug)(),ey=null!=ts(),[ev,eF]=(0,n.useState)(!1),eb=(0,n.useRef)(null),ex=(0,n.useRef)(null),eS=(0,n.useRef)(null);Y[0]!==ev?(t=()=>{ev&&eb.current?.focus()},i=[ev],Y[0]=ev,Y[1]=t,Y[2]=i):(t=Y[1],i=Y[2]),(0,n.useEffect)(t,i),Y[3]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{let t=e.relatedTarget;t&&eS.current?.contains(t)||eF(!1)},Y[3]=o):o=Y[3];let ek=o;Y[4]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(eF(!1),ex.current?.focus())},Y[4]=s):s=Y[4];let eD=s;return Y[5]!==ey||Y[6]!==Z||Y[7]!==J||Y[8]!==Q?(l=(0,a.jsx)("div",{className:oU.default.MissionSelectWrapper,children:(0,a.jsx)(t1,{value:Z,missionType:J,onChange:Q,disabled:ey})}),Y[5]=ey,Y[6]=Z,Y[7]=J,Y[8]=Q,Y[9]=l):l=Y[9],Y[10]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{eF(oV)},Y[10]=c):c=Y[10],Y[11]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(oz,{}),Y[11]=d):d=Y[11],Y[12]!==ev?(u=(0,a.jsx)("button",{ref:ex,className:oU.default.Toggle,onClick:c,"aria-expanded":ev,"aria-controls":"settingsPanel","aria-label":"Settings",children:d}),Y[12]=ev,Y[13]=u):u=Y[13],Y[14]!==et||Y[15]!==Z||Y[16]!==J?(h=(0,a.jsx)(t8,{cameraRef:et,missionName:Z,missionType:J}),Y[14]=et,Y[15]=Z,Y[16]=J,Y[17]=h):h=Y[17],Y[18]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(oG,{}),Y[18]=m):m=Y[18],Y[19]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(oL,{}),f=(0,a.jsx)("span",{className:oU.default.ButtonLabel,children:"Show map info"}),Y[19]=g,Y[20]=f):(g=Y[19],f=Y[20]),Y[21]!==ee?(p=(0,a.jsxs)("button",{type:"button",className:oU.default.MapInfoButton,"aria-label":"Show map info",onClick:ee,children:[g,f]}),Y[21]=ee,Y[22]=p):p=Y[22],Y[23]!==p||Y[24]!==h?(y=(0,a.jsxs)("div",{className:oU.default.Group,children:[h,m,p]}),Y[23]=p,Y[24]=h,Y[25]=y):y=Y[25],Y[26]!==en?(F=e=>{en(e.target.checked)},Y[26]=en,Y[27]=F):F=Y[27],Y[28]!==er||Y[29]!==F?(b=(0,a.jsx)("input",{id:"fogInput",type:"checkbox",checked:er,onChange:F}),Y[28]=er,Y[29]=F,Y[30]=b):b=Y[30],Y[31]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),Y[31]=x):x=Y[31],Y[32]!==b?(S=(0,a.jsxs)("div",{className:oU.default.CheckboxField,children:[b,x]}),Y[32]=b,Y[33]=S):S=Y[33],Y[34]!==el?(k=e=>{el(e.target.checked)},Y[34]=el,Y[35]=k):k=Y[35],Y[36]!==es||Y[37]!==k?(D=(0,a.jsx)("input",{id:"audioInput",type:"checkbox",checked:es,onChange:k}),Y[36]=es,Y[37]=k,Y[38]=D):D=Y[38],Y[39]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),Y[39]=P):P=Y[39],Y[40]!==D?(w=(0,a.jsxs)("div",{className:oU.default.CheckboxField,children:[D,P]}),Y[40]=D,Y[41]=w):w=Y[41],Y[42]!==S||Y[43]!==w?(C=(0,a.jsxs)("div",{className:oU.default.Group,children:[S,w]}),Y[42]=S,Y[43]=w,Y[44]=C):C=Y[44],Y[45]!==ed?(I=e=>{ed(e.target.checked)},Y[45]=ed,Y[46]=I):I=Y[46],Y[47]!==ec||Y[48]!==I?(M=(0,a.jsx)("input",{id:"animationInput",type:"checkbox",checked:ec,onChange:I}),Y[47]=ec,Y[48]=I,Y[49]=M):M=Y[49],Y[50]===Symbol.for("react.memo_cache_sentinel")?(E=(0,a.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),Y[50]=E):E=Y[50],Y[51]!==M?(T=(0,a.jsxs)("div",{className:oU.default.CheckboxField,children:[M,E]}),Y[51]=M,Y[52]=T):T=Y[52],Y[53]!==ep?(B=e=>{ep(e.target.checked)},Y[53]=ep,Y[54]=B):B=Y[54],Y[55]!==ef||Y[56]!==B?(j=(0,a.jsx)("input",{id:"debugInput",type:"checkbox",checked:ef,onChange:B}),Y[55]=ef,Y[56]=B,Y[57]=j):j=Y[57],Y[58]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),Y[58]=_):_=Y[58],Y[59]!==j?(R=(0,a.jsxs)("div",{className:oU.default.CheckboxField,children:[j,_]}),Y[59]=j,Y[60]=R):R=Y[60],Y[61]!==T||Y[62]!==R?(N=(0,a.jsxs)("div",{className:oU.default.Group,children:[T,R]}),Y[61]=T,Y[62]=R,Y[63]=N):N=Y[63],Y[64]===Symbol.for("react.memo_cache_sentinel")?(A=(0,a.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),Y[64]=A):A=Y[64],Y[65]!==eo?(G=e=>eo(parseInt(e.target.value)),Y[65]=eo,Y[66]=G):G=Y[66],Y[67]!==ei||Y[68]!==ey||Y[69]!==G?(L=(0,a.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:ei,disabled:ey,onChange:G}),Y[67]=ei,Y[68]=ey,Y[69]=G,Y[70]=L):L=Y[70],Y[71]!==ei?(z=(0,a.jsx)("output",{htmlFor:"fovInput",children:ei}),Y[71]=ei,Y[72]=z):z=Y[72],Y[73]!==L||Y[74]!==z?(U=(0,a.jsxs)("div",{className:oU.default.Field,children:[A,L,z]}),Y[73]=L,Y[74]=z,Y[75]=U):U=Y[75],Y[76]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),Y[76]=O):O=Y[76],Y[77]!==eh?(V=e=>eh(parseFloat(e.target.value)),Y[77]=eh,Y[78]=V):V=Y[78],Y[79]!==ey||Y[80]!==eu||Y[81]!==V?(q=(0,a.jsxs)("div",{className:oU.default.Field,children:[O,(0,a.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:eu,disabled:ey,onChange:V})]}),Y[79]=ey,Y[80]=eu,Y[81]=V,Y[82]=q):q=Y[82],Y[83]!==U||Y[84]!==q?(H=(0,a.jsxs)("div",{className:oU.default.Group,children:[U,q]}),Y[83]=U,Y[84]=q,Y[85]=H):H=Y[85],Y[86]!==ea||Y[87]!==eg||Y[88]!==em?(W=ea&&(0,a.jsx)("div",{className:oU.default.Group,children:(0,a.jsxs)("div",{className:oU.default.Field,children:[(0,a.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick:"})," ",(0,a.jsxs)("select",{id:"touchModeInput",value:em,onChange:e=>eg(e.target.value),children:[(0,a.jsx)("option",{value:"dualStick",children:"Dual Stick"}),(0,a.jsx)("option",{value:"moveLookStick",children:"Single Stick"})]})]})}),Y[86]=ea,Y[87]=eg,Y[88]=em,Y[89]=W):W=Y[89],Y[90]!==ev||Y[91]!==y||Y[92]!==C||Y[93]!==N||Y[94]!==H||Y[95]!==W?($=(0,a.jsxs)("div",{className:oU.default.Dropdown,ref:eb,id:"settingsPanel",tabIndex:-1,onKeyDown:eD,onBlur:ek,"data-open":ev,children:[y,C,N,H,W]}),Y[90]=ev,Y[91]=y,Y[92]=C,Y[93]=N,Y[94]=H,Y[95]=W,Y[96]=$):$=Y[96],Y[97]!==$||Y[98]!==u?(K=(0,a.jsxs)("div",{ref:eS,children:[u,$]}),Y[97]=$,Y[98]=u,Y[99]=K):K=Y[99],Y[100]!==K||Y[101]!==l?(X=(0,a.jsxs)("div",{id:"controls",className:oU.default.Controls,onKeyDown:oW,onPointerDown:oH,onClick:oq,children:[l,K]}),Y[100]=K,Y[101]=l,Y[102]=X):X=Y[102],X}function oV(e){return!e}function oq(e){return e.stopPropagation()}function oH(e){return e.stopPropagation()}function oW(e){return e.stopPropagation()}let o$=()=>null;var oK=e.i(31067);let oX=n.forwardRef(({envMap:e,resolution:t=256,frames:a=1/0,makeDefault:r,children:i,...s},l)=>{let c=(0,h.useThree)(({set:e})=>e),d=(0,h.useThree)(({camera:e})=>e),m=(0,h.useThree)(({size:e})=>e),g=n.useRef(null);n.useImperativeHandle(l,()=>g.current,[]);let f=n.useRef(null),p=function(e,t,a){let r=(0,h.useThree)(e=>e.size),i=(0,h.useThree)(e=>e.viewport),s="number"==typeof e?e:r.width*i.dpr,l=r.height*i.dpr,c=("number"==typeof e?void 0:e)||{},{samples:d=0,depth:u,...m}=c,g=null!=u?u:c.depthBuffer,f=n.useMemo(()=>{let e=new o.WebGLRenderTarget(s,l,{minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,...m});return g&&(e.depthTexture=new o.DepthTexture(s,l,o.FloatType)),e.samples=d,e},[]);return n.useLayoutEffect(()=>{f.setSize(s,l),d&&(f.samples=d)},[d,f,s,l]),n.useEffect(()=>()=>f.dispose(),[]),f}(t);n.useLayoutEffect(()=>{s.manual||(g.current.aspect=m.width/m.height)},[m,s]),n.useLayoutEffect(()=>{g.current.updateProjectionMatrix()});let y=0,v=null,F="function"==typeof i;return(0,u.useFrame)(t=>{F&&(a===1/0||y{if(r)return c(()=>({camera:g.current})),()=>c(()=>({camera:d}))},[g,r,c]),n.createElement(n.Fragment,null,n.createElement("perspectiveCamera",(0,oK.default)({ref:g},s),!F&&i),n.createElement("group",{ref:f},F&&i(p.texture)))});function oY(){let e,t,n=(0,r.c)(3),{fov:i}=(0,v.useSettings)();return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],n[0]=e):e=n[0],n[1]!==i?(t=(0,a.jsx)(oX,{makeDefault:!0,position:e,fov:i}),n[1]=i,n[2]=t):t=n[2],t}var oZ=e.i(51434),oJ=e.i(86855),oQ=e.i(71832),o0=n,o2=e.i(82816),o1=e.i(43595);function o3(e){let t,i,s,l,c,d,h,m,g,f,p,y,v,F,b=(0,r.c)(31),{entity:x,timeRef:S}=e,k=(0,P.useEngineStoreApi)(),D=(0,ev.useStaticShape)(x.dataBlock);b[0]!==x.dataBlock?(t=e=>{let t=x.dataBlock?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0},b[0]=x.dataBlock,b[1]=t):t=b[1];let w=(0,P.useEngineSelector)(t);b[2]!==D.scene?(l=o2.clone(D.scene),(0,oQ.processShapeScene)(l),s=new o.AnimationMixer(l),i=null,l.traverse(e=>{i||"Mount0"!==e.name||(i=e)}),b[2]=D.scene,b[3]=i,b[4]=s,b[5]=l):(i=b[3],s=b[4],l=b[5]),b[6]!==i||b[7]!==s||b[8]!==l?(c={clonedScene:l,mixer:s,mount0:i},b[6]=i,b[7]=s,b[8]=l,b[9]=c):c=b[9];let{clonedScene:C,mixer:I,mount0:M}=c;b[10]===Symbol.for("react.memo_cache_sentinel")?(d=new Map,b[10]=d):d=b[10];let E=(0,n.useRef)(d);b[11]===Symbol.for("react.memo_cache_sentinel")?(h={name:"root",timeScale:1},b[11]=h):h=b[11];let T=(0,n.useRef)(h),B=(0,n.useRef)(!1);return b[12]!==D.animations||b[13]!==I||b[14]!==w?(m=()=>{let e=(0,o1.getAliasedActions)(D.animations,I,w);E.current=e;let t=e.get("root");return t&&t.play(),T.current={name:"root",timeScale:1},I.update(0),()=>{I.stopAllAction(),E.current=new Map}},g=[I,D.animations,w],b[12]=D.animations,b[13]=I,b[14]=w,b[15]=m,b[16]=g):(m=b[15],g=b[16]),(0,n.useEffect)(m,g),b[17]!==k||b[18]!==x.keyframes||b[19]!==I||b[20]!==S?(f=(e,t)=>{let a=k.getState().playback,r="playing"===a.status,n=S.current,i=(0,oQ.getKeyframeAtTime)(x.keyframes,n),s=i?.damageState!=null&&i.damageState>=1,l=E.current;if(s&&!B.current){B.current=!0;let e=[...l.keys()].filter(o5);if(e.length>0){let t=e[Math.floor(Math.random()*e.length)],a=l.get(T.current.name.toLowerCase());a&&a.fadeOut(oQ.ANIM_TRANSITION_TIME);let r=l.get(t);r.setLoop(o.LoopOnce,1),r.clampWhenFinished=!0,r.reset().fadeIn(oQ.ANIM_TRANSITION_TIME).play(),T.current={name:t,timeScale:1}}}if(!s&&B.current){B.current=!1;let e=l.get(T.current.name.toLowerCase());e&&(e.stop(),e.setLoop(o.LoopRepeat,1/0),e.clampWhenFinished=!1),T.current={name:"root",timeScale:1};let t=l.get("root");t&&t.reset().play()}if(!B.current){let e=function(e,t){if(!e)return{animation:"root",timeScale:1};let[a,r,n]=e;if(n<-10)return{animation:"fall",timeScale:1};let i=-2*Math.atan2(t[1],t[3]),o=Math.cos(i),s=Math.sin(i),l=a*o+r*s,c=-a*s+r*o,d=-c,u=-l,h=Math.max(c,d,u,l);return h<.1?{animation:"root",timeScale:1}:h===c?{animation:"run",timeScale:1}:h===d?{animation:"back",timeScale:1}:h===u?{animation:"side",timeScale:1}:{animation:"side",timeScale:-1}}(i?.velocity,i?.rotation??[0,0,0,1]),t=T.current;if(e.animation!==t.name||e.timeScale!==t.timeScale){let a=l.get(t.name.toLowerCase()),n=l.get(e.animation.toLowerCase());n&&(r&&a&&a!==n?(a.fadeOut(oQ.ANIM_TRANSITION_TIME),n.reset().fadeIn(oQ.ANIM_TRANSITION_TIME).play()):(a&&a!==n&&a.stop(),n.reset().play()),n.timeScale=e.timeScale,T.current={name:e.animation,timeScale:e.timeScale})}}r?I.update(t*a.rate):I.update(0)},b[17]=k,b[18]=x.keyframes,b[19]=I,b[20]=S,b[21]=f):f=b[21],(0,u.useFrame)(f),b[22]===Symbol.for("react.memo_cache_sentinel")?(p=[0,Math.PI/2,0],b[22]=p):p=b[22],b[23]!==C?(y=(0,a.jsx)("group",{rotation:p,children:(0,a.jsx)("primitive",{object:C})}),b[23]=C,b[24]=y):y=b[24],b[25]!==x.weaponShape||b[26]!==M?(v=x.weaponShape&&M&&(0,a.jsx)(sb,{fallback:null,children:(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(o4,{weaponShape:x.weaponShape,mount0:M})})}),b[25]=x.weaponShape,b[26]=M,b[27]=v):v=b[27],b[28]!==v||b[29]!==y?(F=(0,a.jsxs)(a.Fragment,{children:[y,v]}),b[28]=v,b[29]=y,b[30]=F):F=b[30],F}function o5(e){return e.startsWith("death")}function o4(e){let t,a,i=(0,r.c)(7),{weaponShape:o,mount0:s}=e,l=(0,ev.useStaticShape)(o);return i[0]!==s||i[1]!==l.animations||i[2]!==l.scene?(t=()=>{let e=l.scene.clone(!0);(0,oQ.processShapeScene)(e);let t=(0,oQ.getPosedNodeTransform)(l.scene,l.animations,"Mountpoint");if(t){let a=t.quaternion.clone().invert(),r=t.position.clone().negate().applyQuaternion(a);e.position.copy(r),e.quaternion.copy(a)}return s.add(e),()=>{s.remove(e)}},i[0]=s,i[1]=l.animations,i[2]=l.scene,i[3]=t):t=i[3],i[4]!==s||i[5]!==l?(a=[l,s],i[4]=s,i[5]=l,i[6]=a):a=i[6],(0,n.useEffect)(t,a),null}function o6(e){let t,a,i=(0,r.c)(7),{shapeName:o,eyeOffsetRef:s}=e,l=(0,ev.useStaticShape)(o);return i[0]!==s||i[1]!==l.animations||i[2]!==l.scene?(t=()=>{let e=(0,oQ.getPosedNodeTransform)(l.scene,l.animations,"Eye");e?s.current.set(e.position.z,e.position.y,-e.position.x):s.current.set(0,oQ.DEFAULT_EYE_HEIGHT,0)},i[0]=s,i[1]=l.animations,i[2]=l.scene,i[3]=t):t=i[3],i[4]!==s||i[5]!==l?(a=[l,s],i[4]=s,i[5]=l,i[6]=a):a=i[6],(0,n.useEffect)(t,a),null}function o8(e){let t,n,i,o=(0,r.c)(8),{shapeName:s,entityId:l,threads:c}=e,d="number"==typeof l?l:0;o[0]!==d?(t={_class:"player",_className:"Player",_id:d},o[0]=d,o[1]=t):t=o[1];let u=t;return o[2]!==c?(n=(0,a.jsx)(ev.ShapeRenderer,{loadingColor:"#00ff88",demoThreads:c}),o[2]=c,o[3]=n):n=o[3],o[4]!==s||o[5]!==n||o[6]!==u?(i=(0,a.jsx)(eF.ShapeInfoProvider,{object:u,shapeName:s,type:"StaticShape",children:n}),o[4]=s,o[5]=n,o[6]=u,o[7]=i):i=o[7],i}function o7(e){let t,n,i,o,s,l=(0,r.c)(16),{shapeName:c,playerShapeName:d}=e,u=(0,ev.useStaticShape)(d),h=(0,ev.useStaticShape)(c);if(l[0]!==u.animations||l[1]!==u.scene||l[2]!==h){e:{let e,a,r,n=(0,oQ.getPosedNodeTransform)(u.scene,u.animations,"Mount0");if(!n){let e;l[4]===Symbol.for("react.memo_cache_sentinel")?(e={position:void 0,quaternion:void 0},l[4]=e):e=l[4],t=e;break e}let i=(0,oQ.getPosedNodeTransform)(h.scene,h.animations,"Mountpoint");if(i){let t=i.quaternion.clone().invert(),r=i.position.clone().negate().applyQuaternion(t);a=n.quaternion.clone().multiply(t),e=r.clone().applyQuaternion(n.quaternion).add(n.position)}else e=n.position.clone(),a=n.quaternion.clone();let o=e.applyQuaternion(oQ._r90),s=oQ._r90.clone().multiply(a).multiply(oQ._r90inv);l[5]!==o||l[6]!==s?(r={position:o,quaternion:s},l[5]=o,l[6]=s,l[7]=r):r=l[7],t=r}l[0]=u.animations,l[1]=u.scene,l[2]=h,l[3]=t}else t=l[3];let m=t;l[8]===Symbol.for("react.memo_cache_sentinel")?(n={_class:"weapon",_className:"Weapon",_id:0},l[8]=n):n=l[8];let g=n;return l[9]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(ev.ShapeRenderer,{loadingColor:"#4488ff"}),l[9]=i):i=l[9],l[10]!==m.position||l[11]!==m.quaternion?(o=(0,a.jsx)("group",{position:m.position,quaternion:m.quaternion,children:i}),l[10]=m.position,l[11]=m.quaternion,l[12]=o):o=l[12],l[13]!==c||l[14]!==o?(s=(0,a.jsx)(eF.ShapeInfoProvider,{object:g,shapeName:c,type:"Item",children:o}),l[13]=c,l[14]=o,l[15]=s):s=l[15],s}let o9=new o.Vector3,se=new o.Vector3,st=new o.Vector3,sa=new o.Vector3,sr=new o.Vector3,sn=new o.Vector3,si=new o.Vector3(0,1,0);function so(e){let t,n,i,s,l,d=(0,r.c)(14),{visual:u}=e;d[0]!==u.texture?(t=(0,c.textureToUrl)(u.texture),d[0]=u.texture,d[1]=t):t=d[1];let h=t,m=(0,f.useTexture)(h,ss),g=Array.isArray(m)?m[0]:m;d[2]!==u.color.b||d[3]!==u.color.g||d[4]!==u.color.r?(n=new o.Color().setRGB(u.color.r,u.color.g,u.color.b,o.SRGBColorSpace),d[2]=u.color.b,d[3]=u.color.g,d[4]=u.color.r,d[5]=n):n=d[5];let p=n;return d[6]!==u.size?(i=[u.size,u.size,1],d[6]=u.size,d[7]=i):i=d[7],d[8]!==p||d[9]!==g?(s=(0,a.jsx)("spriteMaterial",{map:g,color:p,transparent:!0,blending:o.AdditiveBlending,depthWrite:!1,toneMapped:!1}),d[8]=p,d[9]=g,d[10]=s):s=d[10],d[11]!==i||d[12]!==s?(l=(0,a.jsx)("sprite",{scale:i,children:s}),d[11]=i,d[12]=s,d[13]=l):l=d[13],l}function ss(e){let t=Array.isArray(e)?e[0]:e;(0,oQ.setupEffectTexture)(t)}function sl(e){let t,i,s,l,d,h,m,g,p,y,v,F,b=(0,r.c)(28),{entity:x,visual:S}=e,k=(0,n.useRef)(null),D=(0,n.useRef)(null),P=(0,n.useRef)(null);b[0]===Symbol.for("react.memo_cache_sentinel")?(t=new o.Quaternion,b[0]=t):t=b[0];let w=(0,n.useRef)(t);b[1]!==S.texture?(i=(0,c.textureToUrl)(S.texture),b[1]=S.texture,b[2]=i):i=b[2];let C=S.crossTexture??S.texture;b[3]!==C?(s=(0,c.textureToUrl)(C),b[3]=C,b[4]=s):s=b[4],b[5]!==i||b[6]!==s?(l=[i,s],b[5]=i,b[6]=s,b[7]=l):l=b[7];let I=l,M=(0,f.useTexture)(I,sc);b[8]!==M?(d=Array.isArray(M)?M:[M,M],b[8]=M,b[9]=d):d=b[9];let[E,T]=d;return b[10]!==x||b[11]!==S.crossSize||b[12]!==S.crossViewAng||b[13]!==S.renderCross||b[14]!==S.tracerLength||b[15]!==S.tracerWidth?(h=e=>{let{camera:t}=e,a=k.current,r=D.current;if(!a||!r)return;let n=x.keyframes[0],i=n?.position,o=x.direction??n?.velocity;if(!i||!o||((0,oQ.torqueVecToThree)(o,o9),1e-8>o9.lengthSq())){a.visible=!1,P.current&&(P.current.visible=!1);return}o9.normalize(),a.visible=!0,(0,oQ.torqueVecToThree)(i,sn),se.copy(sn).sub(t.position),st.crossVectors(se,o9),1e-8>st.lengthSq()&&(st.crossVectors(si,o9),1e-8>st.lengthSq()&&st.set(1,0,0)),st.normalize().multiplyScalar(S.tracerWidth);let s=.5*S.tracerLength;sa.copy(o9).multiplyScalar(-s),sr.copy(o9).multiplyScalar(s);let l=r.array;l[0]=sa.x+st.x,l[1]=sa.y+st.y,l[2]=sa.z+st.z,l[3]=sa.x-st.x,l[4]=sa.y-st.y,l[5]=sa.z-st.z,l[6]=sr.x-st.x,l[7]=sr.y-st.y,l[8]=sr.z-st.z,l[9]=sr.x+st.x,l[10]=sr.y+st.y,l[11]=sr.z+st.z,r.needsUpdate=!0;let c=P.current;if(!c)return;if(!S.renderCross){c.visible=!1;return}se.normalize();let d=o9.dot(se);if(d>-S.crossViewAng&&d{let e=v.current;if(!e)return;e.getWorldPosition(sg);let t=y.position.distanceTo(sg),a=y.matrixWorld.elements,r=!(-((sg.x-a[12])*a[8])+-((sg.y-a[13])*a[9])+-((sg.z-a[14])*a[10])<0)&&t<150;if(k!==r&&D(r),!r)return;let n=(0,oQ.getKeyframeAtTime)(g.keyframes,f.current),i=n?.health??1;if(n?.damageState!=null&&n.damageState>=1){F.current&&(F.current.style.opacity="0"),b.current&&(b.current.style.opacity="0");return}let o=Math.max(0,Math.min(1,1-t/150)).toString();if(F.current&&(F.current.style.opacity=o),b.current&&(b.current.style.opacity=o),S.current&&g.iffColor){let e=g.iffColor.r>g.iffColor.g?sm:sh;S.current.src!==e&&(S.current.src=e)}x.current&&C&&(x.current.style.width=`${Math.max(0,Math.min(100,100*i))}%`,x.current.style.background=g.iffColor?`rgb(${g.iffColor.r}, ${g.iffColor.g}, ${g.iffColor.b})`:"")},m[7]=y,m[8]=g.iffColor,m[9]=g.keyframes,m[10]=C,m[11]=k,m[12]=f,m[13]=l):l=m[13],(0,u.useFrame)(l);let I=g.iffColor&&g.iffColor.r>g.iffColor.g?sm:sh;return m[14]!==P||m[15]!==C||m[16]!==w||m[17]!==I||m[18]!==k?(c=k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(sd.Html,{position:[0,w,0],center:!0,children:(0,a.jsx)("div",{ref:F,className:su.default.Top,children:(0,a.jsx)("img",{ref:S,className:su.default.IffArrow,src:I,alt:""})})}),(0,a.jsx)(sd.Html,{position:[0,-.2,0],center:!0,children:(0,a.jsxs)("div",{ref:b,className:su.default.Bottom,children:[(0,a.jsx)("div",{className:su.default.Name,children:P}),C&&(0,a.jsx)("div",{className:su.default.HealthBar,children:(0,a.jsx)("div",{ref:x,className:su.default.HealthFill})})]})})]}),m[14]=P,m[15]=C,m[16]=w,m[17]=I,m[18]=k,m[19]=c):c=m[19],m[20]!==c?(d=(0,a.jsx)("group",{ref:v,children:c}),m[20]=c,m[21]=d):d=m[21],d}function sp(e){return null!=e.health}function sy(e){let t,n,i,o,s,l,c,d,u=(0,r.c)(79),{entity:h,timeRef:m}=e,g=(0,v.useDebug)(),f=g?.debugMode??!1,p=(0,P.useEngineSelector)(sv),y=String(h.id);if(h.visual?.kind==="tracer"){let e,t,r,n,i;return u[0]===Symbol.for("react.memo_cache_sentinel")?(e={demoVisualKind:"tracer"},u[0]=e):e=u[0],u[1]!==h?(t=(0,a.jsx)(o0.Suspense,{fallback:null,children:(0,a.jsx)(sl,{entity:h,visual:h.visual})}),u[1]=h,u[2]=t):t=u[2],u[3]!==f||u[4]!==h?(r=f?(0,a.jsx)(sF,{entity:h}):null,u[3]=f,u[4]=h,u[5]=r):r=u[5],u[6]!==t||u[7]!==r?(n=(0,a.jsxs)("group",{name:"model",userData:e,children:[t,r]}),u[6]=t,u[7]=r,u[8]=n):n=u[8],u[9]!==y||u[10]!==n?(i=(0,a.jsx)("group",{name:y,children:n}),u[9]=y,u[10]=n,u[11]=i):i=u[11],i}if(h.visual?.kind==="sprite"){let e,t,r,n,i;return u[12]===Symbol.for("react.memo_cache_sentinel")?(e={demoVisualKind:"sprite"},u[12]=e):e=u[12],u[13]!==h.visual?(t=(0,a.jsx)(o0.Suspense,{fallback:null,children:(0,a.jsx)(so,{visual:h.visual})}),u[13]=h.visual,u[14]=t):t=u[14],u[15]!==f||u[16]!==h?(r=f?(0,a.jsx)(sF,{entity:h}):null,u[15]=f,u[16]=h,u[17]=r):r=u[17],u[18]!==t||u[19]!==r?(n=(0,a.jsxs)("group",{name:"model",userData:e,children:[t,r]}),u[18]=t,u[19]=r,u[20]=n):n=u[20],u[21]!==y||u[22]!==n?(i=(0,a.jsx)("group",{name:y,children:n}),u[21]=y,u[22]=n,u[23]=i):i=u[23],i}if(!h.dataBlock){let e,t,r,n,i,o;return u[24]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("sphereGeometry",{args:[.3,6,4]}),u[24]=e):e=u[24],u[25]!==h.type?(t=(0,oQ.entityTypeColor)(h.type),u[25]=h.type,u[26]=t):t=u[26],u[27]!==t?(r=(0,a.jsxs)("mesh",{children:[e,(0,a.jsx)("meshBasicMaterial",{color:t,wireframe:!0})]}),u[27]=t,u[28]=r):r=u[28],u[29]!==f||u[30]!==h?(n=f?(0,a.jsx)(sF,{entity:h}):null,u[29]=f,u[30]=h,u[31]=n):n=u[31],u[32]!==r||u[33]!==n?(i=(0,a.jsxs)("group",{name:"model",children:[r,n]}),u[32]=r,u[33]=n,u[34]=i):i=u[34],u[35]!==y||u[36]!==i?(o=(0,a.jsx)("group",{name:y,children:i}),u[35]=y,u[36]=i,u[37]=o):o=u[37],o}u[38]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)("sphereGeometry",{args:[.5,8,6]}),u[38]=t):t=u[38],u[39]!==h.type?(n=(0,oQ.entityTypeColor)(h.type),u[39]=h.type,u[40]=n):n=u[40],u[41]!==n?(i=(0,a.jsxs)("mesh",{children:[t,(0,a.jsx)("meshBasicMaterial",{color:n,wireframe:!0})]}),u[41]=n,u[42]=i):i=u[42];let F=i;if("Player"===h.type){let e,t,r,n,i,o,s=h.id===p;return u[43]!==h||u[44]!==m?(e=(0,a.jsx)(o3,{entity:h,timeRef:m}),u[43]=h,u[44]=m,u[45]=e):e=u[45],u[46]!==F||u[47]!==e?(t=(0,a.jsx)(o0.Suspense,{fallback:F,children:e}),u[46]=F,u[47]=e,u[48]=t):t=u[48],u[49]!==F||u[50]!==t?(r=(0,a.jsx)(sb,{fallback:F,children:t}),u[49]=F,u[50]=t,u[51]=r):r=u[51],u[52]!==h||u[53]!==s||u[54]!==m?(n=!s&&(0,a.jsx)(o0.Suspense,{fallback:null,children:(0,a.jsx)(sf,{entity:h,timeRef:m})}),u[52]=h,u[53]=s,u[54]=m,u[55]=n):n=u[55],u[56]!==r||u[57]!==n?(i=(0,a.jsxs)("group",{name:"model",children:[r,n]}),u[56]=r,u[57]=n,u[58]=i):i=u[58],u[59]!==y||u[60]!==i?(o=(0,a.jsx)("group",{name:y,children:i}),u[59]=y,u[60]=i,u[61]=o):o=u[61],o}return u[62]!==h.dataBlock||u[63]!==h.id||u[64]!==h.threads?(o=(0,a.jsx)(o8,{shapeName:h.dataBlock,entityId:h.id,threads:h.threads}),u[62]=h.dataBlock,u[63]=h.id,u[64]=h.threads,u[65]=o):o=u[65],u[66]!==F||u[67]!==o?(s=(0,a.jsx)(o0.Suspense,{fallback:F,children:o}),u[66]=F,u[67]=o,u[68]=s):s=u[68],u[69]!==F||u[70]!==s?(l=(0,a.jsx)("group",{name:"model",children:(0,a.jsx)(sb,{fallback:F,children:s})}),u[69]=F,u[70]=s,u[71]=l):l=u[71],u[72]!==h.dataBlock||u[73]!==h.weaponShape?(c=h.weaponShape&&(0,a.jsx)("group",{name:"weapon",children:(0,a.jsx)(sb,{fallback:null,children:(0,a.jsx)(o0.Suspense,{fallback:null,children:(0,a.jsx)(o7,{shapeName:h.weaponShape,playerShapeName:h.dataBlock})})})}),u[72]=h.dataBlock,u[73]=h.weaponShape,u[74]=c):c=u[74],u[75]!==y||u[76]!==l||u[77]!==c?(d=(0,a.jsxs)("group",{name:y,children:[l,c]}),u[75]=y,u[76]=l,u[77]=c,u[78]=d):d=u[78],d}function sv(e){return e.playback.streamSnapshot?.controlPlayerGhostId}function sF(e){let t,n,i=(0,r.c)(9),{entity:o}=e,s=String(o.id);i[0]!==o.className||i[1]!==o.dataBlockId||i[2]!==o.ghostIndex||i[3]!==o.shapeHint||i[4]!==o.type||i[5]!==s?((t=[]).push(`${s} (${o.type})`),o.className&&t.push(`class ${o.className}`),"number"==typeof o.ghostIndex&&t.push(`ghost ${o.ghostIndex}`),"number"==typeof o.dataBlockId&&t.push(`db ${o.dataBlockId}`),t.push(o.shapeHint?`shapeHint ${o.shapeHint}`:"shapeHint "),i[0]=o.className,i[1]=o.dataBlockId,i[2]=o.ghostIndex,i[3]=o.shapeHint,i[4]=o.type,i[5]=s,i[6]=t):t=i[6];let l=t.join(" | ");return i[7]!==l?(n=(0,a.jsx)(U.FloatingLabel,{color:"#ff6688",children:l}),i[7]=l,i[8]=n):n=i[8],n}class sb extends o0.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.warn("[demo] Shape load failed:",e.message,t.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}let sx=Math.PI/180,sS=Math.PI/18e4;function sk(e,t,a){let r=e[t];return"number"==typeof r&&Number.isFinite(r)?r:a}function sD(e,t,a){let r=e[t];return"boolean"==typeof r?r:"number"==typeof r?0!==r:a}function sP(e,t){let a,r=e.particles;if(Array.isArray(r)){for(let e of r)if("number"==typeof e&&(a=t(e)))break}return a?{ejectionPeriodMS:sk(e,"ejectionPeriodMS",100),periodVarianceMS:sk(e,"periodVarianceMS",0),ejectionVelocity:.01*sk(e,"ejectionVelocity",200),velocityVariance:.01*sk(e,"velocityVariance",100),ejectionOffset:.01*sk(e,"ejectionOffset",0),thetaMin:sk(e,"thetaMin",0),thetaMax:sk(e,"thetaMax",90),phiReferenceVel:sk(e,"phiReferenceVel",0),phiVariance:sk(e,"phiVariance",360),overrideAdvances:sD(e,"overrideAdvances",!1),orientParticles:sD(e,"orientParticles",!1),orientOnVelocity:sD(e,"orientOnVelocity",!0),lifetimeMS:sk(e,"lifetimeMS",0)<<5,lifetimeVarianceMS:sk(e,"lifetimeVarianceMS",0)<<5,particles:function(e){let t=e.keys,a=[];if(Array.isArray(t)&&t.length>0)for(let e=0;e0&&t[0]&&(r=t[0])}return{dragCoefficient:5*sk(e,"dragCoefficient",0),windCoefficient:sk(e,"windCoefficient",1),gravityCoefficient:10*sk(e,"gravityCoefficient",0),inheritedVelFactor:sk(e,"inheritedVelFactor",0),constantAcceleration:sk(e,"constantAcceleration",0),lifetimeMS:sk(e,"lifetimeMS",31)<<5,lifetimeVarianceMS:sk(e,"lifetimeVarianceMS",0)<<5,spinSpeed:sk(e,"spinSpeed",0),spinRandomMin:sk(e,"spinRandomMin",1e3)+-1e3,spinRandomMax:sk(e,"spinRandomMax",1e3)+-1e3,useInvAlpha:sD(e,"useInvAlpha",!1),keys:a,textureName:r}}(a)}:null}function sw(e,t){return e+(2*Math.random()-1)*t}function sC(e,t,a,r,n,i,o){let s=Math.cos(o),l=Math.sin(o),c=e*r+t*n+a*i;return[e*s+(n*a-i*t)*l+r*c*(1-s),t*s+(i*e-r*a)*l+n*c*(1-s),a*s+(r*t-n*e)*l+i*c*(1-s)]}class sI{data;particles=[];maxParticles;internalClock=0;nextParticleTime=0;emitterAge=0;emitterLifetime;emitterDead=!1;constructor(e,t=256,a){this.data=e,this.maxParticles=t;let r=a??e.lifetimeMS;!a&&e.lifetimeVarianceMS>0&&(r+=Math.round(sw(0,e.lifetimeVarianceMS))),this.emitterLifetime=r}emitBurst(e,t,a=[0,0,1]){for(let r=0;r0;){if(this.nextParticleTime>0){let e=Math.min(r,this.nextParticleTime);this.nextParticleTime-=e,r-=e,this.internalClock+=e;continue}this.particles.length0&&(t+=Math.round(sw(0,this.data.periodVarianceMS))),this.nextParticleTime=Math.max(1,t)}}update(e){this.emitterAge+=e,this.emitterLifetime>0&&this.emitterAge>=this.emitterLifetime&&(this.emitterDead=!0);let t=e/1e3,a=this.data.particles;for(let r=this.particles.length-1;r>=0;r--){let n=this.particles[r];if(n.currentAge+=e,n.currentAge>=n.totalLifetime){this.particles[r]=this.particles[this.particles.length-1],this.particles.pop();continue}let i=a.dragCoefficient,o=a.gravityCoefficient,s=-n.vel[0]*i,l=-n.vel[1]*i,c=-n.vel[2]*i+-9.81*o;n.vel[0]+=s*t,n.vel[1]+=l*t,n.vel[2]+=c*t,n.pos[0]+=n.vel[0]*t,n.pos[1]+=n.vel[1]*t,n.pos[2]+=n.vel[2]*t;let d=n.currentAge/n.totalLifetime,u=function(e,t){for(let a=1;a=t){let r=e[a-1],n=e[a],i=n.time-r.time,o=i>0?(t-r.time)/i:0;return{r:r.r+(n.r-r.r)*o,g:r.g+(n.g-r.g)*o,b:r.b+(n.b-r.b)*o,a:r.a+(n.a-r.a)*o,size:r.size+(n.size-r.size)*o}}let a=e[e.length-1];return{r:a.r,g:a.g,b:a.b,a:a.a,size:a.size}}(a.keys,d);n.r=u.r,n.g=u.g,n.b=u.b,n.a=u.a,n.size=u.size,n.currentSpin=n.spinSpeed*n.currentAge*sS}}isDead(){return this.emitterDead&&0===this.particles.length}kill(){this.emitterDead=!0}addParticle(e,t){var a,r,n,i;let o,s,l,c,d=this.data,u=d.particles,h=t[0],m=t[1],g=t[2],f=(a=h,r=m,.9>Math.abs(n=g)?(o=r,s=-a,l=0):(o=-n,s=0,l=a),(c=Math.sqrt(o*o+s*s+l*l))<1e-8?[1,0,0]:[o/c,s/c,l/c]),p=(d.thetaMin+Math.random()*(d.thetaMax-d.thetaMin))*sx,y=(this.internalClock/1e3*d.phiReferenceVel+Math.random()*d.phiVariance)*sx;[h,m,g]=sC(h,m,g,f[0],f[1],f[2],p),[h,m,g]=sC(h,m,g,t[0],t[1],t[2],y);let v=Math.sqrt(h*h+m*m+g*g);v>1e-8&&(h/=v,m/=v,g/=v);let F=sw(d.ejectionVelocity,d.velocityVariance),b=[e[0]+h*d.ejectionOffset,e[1]+m*d.ejectionOffset,e[2]+g*d.ejectionOffset],x=[h*F,m*F,g*F],S=u.lifetimeMS;u.lifetimeVarianceMS>0&&(S+=Math.round(sw(0,u.lifetimeVarianceMS))),S=Math.max(1,S);let k=u.spinSpeed+((i=u.spinRandomMin)+Math.random()*(u.spinRandomMax-i)),D=u.keys[0];this.particles.push({pos:b,vel:x,orientDir:[h,m,g],currentAge:0,totalLifetime:S,dataIndex:0,spinSpeed:k,currentSpin:0,r:D.r,g:D.g,b:D.b,a:D.a,size:D.size})}}let sM=` +// 'position' is auto-declared by Three.js for ShaderMaterial. +attribute vec4 particleColor; +attribute float particleSize; +attribute float particleSpin; +attribute vec2 quadCorner; // (-0.5,-0.5) to (0.5,0.5) + +varying vec2 vUv; +varying vec4 vColor; + +void main() { + vUv = quadCorner + 0.5; // [0,1] range + vColor = particleColor; + + // Transform particle center to view space for billboarding. + vec3 viewPos = (modelViewMatrix * vec4(position, 1.0)).xyz; + + // Apply spin rotation to quad corner. + float c = cos(particleSpin); + float s = sin(particleSpin); + vec2 rotated = vec2( + c * quadCorner.x - s * quadCorner.y, + s * quadCorner.x + c * quadCorner.y + ); + + // Offset in view space (camera-facing billboard). + viewPos.xy += rotated * particleSize; + + gl_Position = projectionMatrix * vec4(viewPos, 1.0); +} +`,sE=` +uniform sampler2D particleTexture; +uniform bool hasTexture; + +varying vec2 vUv; +varying vec4 vColor; + +void main() { + if (hasTexture) { + vec4 texColor = texture2D(particleTexture, vUv); + gl_FragColor = texColor * vColor; + } else { + gl_FragColor = vColor; + } +} +`,sT=new Float32Array([-.5,-.5,.5,-.5,.5,.5,-.5,.5]),sB=new o.TextureLoader,sj=new Map,s_=new Set,sR=new o.DataTexture(new Uint8Array([255,255,255,255]),1,1,o.RGBAFormat,o.UnsignedByteType);function sN(e){if(!e)return sR;let t=sj.get(e);if(t)return t;try{let t=(0,c.textureToUrl)(e),a=sB.load(t,e=>{(0,oQ.setupEffectTexture)(e),s_.add(e)});return(0,oQ.setupEffectTexture)(a),sj.set(e,a),a}catch{return sR}}sR.needsUpdate=!0;let sA=new o.SphereGeometry(1,6,6),sG=new o.MeshBasicMaterial({color:0xff0000,wireframe:!0}),sL=new o.BoxGeometry(.3,.3,.3),sz=new o.MeshBasicMaterial({color:65280,wireframe:!0});function sU(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function sO(e){let t=new o.BufferGeometry,a=4*e,r=new Float32Array(2*a);for(let t=0;t{console.log("[ParticleFX] MOUNTED — playback:",!!y,"snapshotRef:",!!F)},c=[y,F],p[3]=y,p[4]=F,p[5]=l,p[6]=c):(l=p[5],c=p[6]),(0,n.useEffect)(l,c),p[7]!==b||p[8]!==x||p[9]!==y||p[10]!==F?(d=(e,t)=>{let a=S.current,r=F.current;if(!a||!r)return void console.log("[ParticleFX] early return — group:",!!a,"snapshot:",!!r);let n=1e3*t,i=y.getDataBlockData.bind(y),s=performance.now();if(s-w.current>2e3){w.current=s;let e={},t=0,a=0;for(let n of r.entities)e[n.type]=(e[n.type]||0)+1,n.maintainEmitterId&&t++,n.explosionDataBlockId&&a++;console.log("[ParticleFX] types:",e,"| active emitters:",k.current.length,"| processedExplosions:",D.current.size,"| trailEntities:",P.current.size,"| withExplosionDataBlockId:",a,"| withMaintainEmitter:",t)}for(let e of r.entities){if("Explosion"!==e.type||!e.explosionDataBlockId||!e.position){"Explosion"===e.type&&console.log("[ParticleFX] Explosion entity SKIPPED — id:",e.id,"explosionDataBlockId:",e.explosionDataBlockId,"position:",e.position);continue}if(D.current.has(e.id))continue;D.current.add(e.id),console.log("[ParticleFX] NEW explosion entity:",e.id,"dataBlockId:",e.explosionDataBlockId,"pos:",e.position);let t=function(e,t){let a=t(e);if(!a)return console.log("[resolveExplosion] getDataBlockData returned undefined for id:",e),null;console.log("[resolveExplosion] expBlock keys:",Object.keys(a),"particleEmitter:",a.particleEmitter,"emitters:",a.emitters,"particleDensity:",a.particleDensity);let r=[],n=[],i=a.particleEmitter;if("number"==typeof i){let e=t(i);if(console.log("[resolveExplosion] burst emitter lookup — particleEmitterId:",i,"found:",!!e),e){console.log("[resolveExplosion] burst emitter raw keys:",Object.keys(e),"particles:",e.particles);let n=sP(e,t);if(n){let e=a.particleDensity??10;console.log("[resolveExplosion] burst emitter RESOLVED — density:",e,"textureName:",n.particles.textureName,"particleLifetimeMS:",n.particles.lifetimeMS,"emitterLifetimeMS:",n.lifetimeMS),r.push({data:n,density:e})}else console.log("[resolveExplosion] resolveEmitterData returned null for burst emitter")}}else console.log("[resolveExplosion] no particleEmitter field (value:",a.particleEmitter,")");let o=a.emitters;if(Array.isArray(o))for(let e of(console.log("[resolveExplosion] emitters array:",o),o)){if("number"!=typeof e)continue;let a=t(e);if(!a){console.log("[resolveExplosion] streaming emitter ref",e,"not found");continue}console.log("[resolveExplosion] streaming emitter raw keys:",Object.keys(a),"particles:",a.particles);let r=sP(a,t);r?(console.log("[resolveExplosion] streaming emitter RESOLVED — textureName:",r.particles.textureName,"particleLifetimeMS:",r.particles.lifetimeMS,"emitterLifetimeMS:",r.lifetimeMS,"ejectionPeriodMS:",r.ejectionPeriodMS),n.push(r)):console.log("[resolveExplosion] resolveEmitterData returned null for streaming emitter ref:",e)}else console.log("[resolveExplosion] no emitters array on expBlock");return 0===r.length&&0===n.length?(console.log("[resolveExplosion] no emitters resolved at all, returning null"),null):{burstEmitters:r,streamingEmitters:n,lifetimeMS:32*(a.lifetimeMS??31)}}(e.explosionDataBlockId,i);if(!t){console.log("[ParticleFX] resolveExplosion returned null for dataBlockId:",e.explosionDataBlockId);continue}console.log("[ParticleFX] resolveExplosion OK — burstEmitters:",t.burstEmitters.length,"streamingEmitters:",t.streamingEmitters.length,"lifetimeMS:",t.lifetimeMS);let r=[...e.position];for(let e of t.burstEmitters){let t=new sI(e.data,256);t.emitBurst(r,e.density),console.log("[ParticleFX] Created BURST emitter — particles after burst:",t.particles.length,"origin:",r,"texture:",e.data.particles.textureName,"particleLifetimeMS:",e.data.particles.lifetimeMS,"keyframes:",e.data.particles.keys.length,"key0:",e.data.particles.keys[0]);let n=sN(e.data.particles.textureName);console.log("[ParticleFX] burst texture loaded:",!!n,"textureName:",e.data.particles.textureName);let i=sO(256),s=sV(n,e.data.particles.useInvAlpha),l=new o.Mesh(i,s);l.frustumCulled=!1,a.add(l),k.current.push({emitter:t,mesh:l,geometry:i,material:s,targetTexture:n,origin:r,isBurst:!0,hasBurst:!0})}for(let e of t.streamingEmitters){let n=new sI(e,256,t.lifetimeMS);console.log("[ParticleFX] Created STREAMING emitter — emitterLifetimeMS:",e.lifetimeMS,"ejectionPeriodMS:",e.ejectionPeriodMS,"origin:",r,"texture:",e.particles.textureName,"particleLifetimeMS:",e.particles.lifetimeMS);let i=sN(e.particles.textureName);console.log("[ParticleFX] streaming texture loaded:",!!i,"textureName:",e.particles.textureName);let s=sO(256),l=sV(i,e.particles.useInvAlpha),c=new o.Mesh(s,l);c.frustumCulled=!1,a.add(c),k.current.push({emitter:n,mesh:c,geometry:s,material:l,targetTexture:i,origin:r,isBurst:!1,hasBurst:!1})}}let l=new Set;for(let e of r.entities){if(l.add(e.id),!e.maintainEmitterId||P.current.has(e.id))continue;P.current.add(e.id);let t=i(e.maintainEmitterId);if(!t)continue;let r=sP(t,i);if(!r)continue;let n=e.position?[...e.position]:[0,0,0],s=new sI(r,256);console.log("[ParticleFX] Created TRAIL emitter for",e.type,e.id,"— maintainEmitterId:",e.maintainEmitterId,"texture:",r.particles.textureName);let c=sN(r.particles.textureName),d=sO(256),u=sV(c,r.particles.useInvAlpha),h=new o.Mesh(d,u);h.frustumCulled=!1,a.add(h),k.current.push({emitter:s,mesh:h,geometry:d,material:u,targetTexture:c,origin:n,isBurst:!1,hasBurst:!1,followEntityId:e.id})}for(let e of k.current)e.followEntityId&&!l.has(e.followEntityId)&&e.emitter.kill();for(let e of P.current)l.has(e)||P.current.delete(e);let c=k.current;for(let e=c.length-1;e>=0;e--){let t=c[e];if(!function(e,t,a){let r=e.properties.get(t).currentProgram;if(!r)return;let n=r.program,i=e.getContext();i.getProgramParameter(n,i.LINK_STATUS)||console.error(`[ParticleFX] Shader LINK ERROR (${a}):`,i.getProgramInfoLog(n))}(x,t.material,t.isBurst?"burst":"stream"),t.followEntityId){let e=r.entities.find(e=>e.id===t.followEntityId);e?.position&&(t.origin[0]=e.position[0],t.origin[1]=e.position[1],t.origin[2]=e.position[2])}if(t.isBurst||t.emitter.emitPeriodic(t.origin,n),t.emitter.update(n),t.emitter.particles.length>0&&.02>Math.random()){let e=t.emitter.particles[0];console.log("[ParticleFX] update — isBurst:",t.isBurst,"particleCount:",t.emitter.particles.length,"p0.pos:",e.pos,"p0.size:",e.size,"p0.a:",e.a,"p0.age/lifetime:",e.currentAge,"/",e.totalLifetime,"drawRange:",t.geometry.drawRange)}if(s_.has(t.targetTexture)&&t.material.uniforms.particleTexture.value!==t.targetTexture&&(t.material.uniforms.particleTexture.value=t.targetTexture),!function(e){let t=e.emitter.particles,a=e.geometry,r=a.getAttribute("position"),n=a.getAttribute("particleColor"),i=a.getAttribute("particleSize"),o=a.getAttribute("particleSpin"),s=r.array,l=n.array,c=i.array,d=o.array,u=Math.min(t.length,256);for(let e=0;e500){let e=new Set(r.entities.map(sH));for(let t of D.current)e.has(t)||D.current.delete(t)}},p[7]=b,p[8]=x,p[9]=y,p[10]=F,p[11]=d):d=p[11],(0,u.useFrame)(d),p[12]===Symbol.for("react.memo_cache_sentinel")?(m=()=>()=>{let e=S.current;for(let t of k.current){if(e&&(e.remove(t.mesh),t.debugOriginMesh&&e.remove(t.debugOriginMesh),t.debugParticleMeshes))for(let a of t.debugParticleMeshes)e.remove(a);t.geometry.dispose(),t.material.dispose()}k.current=[],D.current.clear(),P.current.clear()},g=[],p[12]=m,p[13]=g):(m=p[12],g=p[13]),(0,n.useEffect)(m,g),p[14]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("group",{ref:S}),p[14]=f):f=p[14],f}function sH(e){return e.id}function sW(e){return e.gl}let s$=new WeakMap;function sK(e){let t=s$.get(e);return t||(t=new Map(e.entities.map(e=>[e.id,e])),s$.set(e,t)),t}let sX=new o.Vector3,sY=new o.Quaternion,sZ=new o.Quaternion,sJ=new o.Quaternion(0,1,0,0),sQ=new o.Vector3,s0=new o.Vector3,s2=new o.Vector3,s1=0,s3=0;function s5({recording:e}){let t=(0,P.useEngineStoreApi)(),r=(0,n.useRef)(null);r.current||(r.current=(0,oQ.nextLifecycleInstanceId)("StreamingDemoPlayback"));let i=(0,n.useRef)(null),s=(0,n.useRef)(0),l=(0,n.useRef)(0),d=(0,n.useRef)(null),h=(0,n.useRef)(null),m=(0,n.useRef)(new o.Vector3(0,oQ.DEFAULT_EYE_HEIGHT,0)),g=(0,n.useRef)(e.streamingPlayback??null),f=(0,n.useRef)(null),p=(0,n.useRef)(new Map),y=(0,n.useRef)(null),v=(0,n.useRef)(0),F=(0,n.useRef)(!1),[b,x]=(0,n.useState)([]),[S,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{s1+=1;let a=Date.now();return t.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"StreamingDemoPlayback mounted",meta:{component:"StreamingDemoPlayback",phase:"mount",instanceId:r.current,mountCount:s1,unmountCount:s3,recordingMissionName:e.missionName??null,recordingDurationSec:Number(e.duration.toFixed(3)),ts:a}}),console.info("[demo diagnostics] StreamingDemoPlayback mounted",{instanceId:r.current,mountCount:s1,unmountCount:s3,recordingMissionName:e.missionName??null,mountedAt:a}),()=>{s3+=1;let a=Date.now();t.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"StreamingDemoPlayback unmounted",meta:{component:"StreamingDemoPlayback",phase:"unmount",instanceId:r.current,mountCount:s1,unmountCount:s3,recordingMissionName:e.missionName??null,ts:a}}),console.info("[demo diagnostics] StreamingDemoPlayback unmounted",{instanceId:r.current,mountCount:s1,unmountCount:s3,recordingMissionName:e.missionName??null,unmountedAt:a})}},[t]);let D=(0,n.useCallback)(e=>{if(e===y.current)return;y.current=e;let a=p.current,r=new Map,n=e.entities.length!==a.size;for(let t of e.entities){let i=a.get(t.id);i&&i.type===t.type&&i.dataBlock===t.dataBlock&&i.weaponShape===t.weaponShape&&i.className===t.className&&i.ghostIndex===t.ghostIndex&&i.dataBlockId===t.dataBlockId&&i.shapeHint===t.shapeHint||(i=(0,oQ.buildStreamDemoEntity)(t.id,t.type,t.dataBlock,t.visual,t.direction,t.weaponShape,t.playerName,t.className,t.ghostIndex,t.dataBlockId,t.shapeHint),n=!0),i.playerName=t.playerName,i.iffColor=t.iffColor,i.dataBlock=t.dataBlock,i.visual=t.visual,i.direction=t.direction,i.weaponShape=t.weaponShape,i.className=t.className,i.ghostIndex=t.ghostIndex,i.dataBlockId=t.dataBlockId,i.shapeHint=t.shapeHint,i.threads=t.threads,0===i.keyframes.length&&i.keyframes.push({time:e.timeSec,position:t.position??[0,0,0],rotation:t.rotation??[0,0,0,1]});let o=i.keyframes[0];o.time=e.timeSec,t.position&&(o.position=t.position),t.rotation&&(o.rotation=t.rotation),o.velocity=t.velocity,o.health=t.health,o.energy=t.energy,o.actionAnim=t.actionAnim,o.actionAtEnd=t.actionAtEnd,o.damageState=t.damageState,r.set(t.id,i)}if(p.current=r,n){x(Array.from(r.values()));let n=Date.now();n-v.current>=500&&(v.current=n,t.getState().recordPlaybackDiagnosticEvent({kind:"stream.entities.rebuild",message:"Renderable demo entity list was rebuilt",meta:{previousEntityCount:a.size,nextEntityCount:r.size,snapshotTimeSec:Number(e.timeSec.toFixed(3))}}))}let i=null;if(e.camera?.mode==="first-person"&&e.camera.controlEntityId){let t=r.get(e.camera.controlEntityId);t?.dataBlock&&(i=t.dataBlock)}k(e=>e===i?e:i)},[t]);return(0,n.useEffect)(()=>{g.current=e.streamingPlayback??null,p.current=new Map,y.current=null,f.current=null,s.current=0,l.current=0,d.current=null,h.current=null,F.current=!1;let a=g.current;if(!a)return void t.getState().setPlaybackStreamSnapshot(null);for(let e of(a.reset(),a.getEffectShapes()))z.useGLTF.preload((0,c.shapeToUrl)(e));let r=a.getSnapshot();return s.current=r.timeSec,l.current=r.timeSec,d.current=r,h.current=r,D(r),t.getState().setPlaybackStreamSnapshot(r),f.current=r,()=>{t.getState().setPlaybackStreamSnapshot(null)}},[e,t,D]),(0,u.useFrame)((e,a)=>{let r=g.current;if(!r)return;let n=t.getState(),o=n.playback,c="playing"===o.status,u=o.timeMs/1e3,p=!c&&Math.abs(u-l.current)>5e-4,y=c&&Math.abs(u-s.current)>.05,v=p||y;v&&(l.current=u),c&&(l.current+=a*o.rate);let b=Math.max(1,Math.ceil(1e3*a*Math.max(o.rate,.01)/32)+2),x=l.current+oQ.STREAM_TICK_SEC,S=r.stepToTime(x,c&&!v?b:1/0),k=h.current;!k||S.timeSec1.5*oQ.STREAM_TICK_SEC?(d.current=S,h.current=S):S.timeSec!==k.timeSec&&(d.current=k,h.current=S);let P=h.current??S,w=d.current??P,C=P.timeSec-oQ.STREAM_TICK_SEC,I=Math.max(0,Math.min(1,(l.current-C)/oQ.STREAM_TICK_SEC));s.current=l.current,S.exhausted&&c&&(l.current=Math.min(l.current,S.timeSec)),D(P);let M=f.current;M&&P.timeSec===M.timeSec&&P.exhausted===M.exhausted&&P.status.health===M.status.health&&P.status.energy===M.status.energy&&P.camera?.mode===M.camera?.mode&&P.camera?.controlEntityId===M.camera?.controlEntityId&&P.camera?.orbitTargetId===M.camera?.orbitTargetId||(f.current=P,n.setPlaybackStreamSnapshot(P));let E=P.camera,T=E&&w.camera&&w.camera.mode===E.mode&&w.camera.controlEntityId===E.controlEntityId&&w.camera.orbitTargetId===E.orbitTargetId?w.camera:null;if(E){if(T){let t=T.position[0],a=T.position[1],r=T.position[2],n=E.position[0],i=E.position[1],o=E.position[2];e.camera.position.set(a+(i-a)*I,r+(o-r)*I,t+(n-t)*I),sY.set(...T.rotation),sZ.set(...E.rotation),sY.slerp(sZ,I),e.camera.quaternion.copy(sY)}else e.camera.position.set(E.position[1],E.position[2],E.position[0]),e.camera.quaternion.set(...E.rotation);if(Number.isFinite(E.fov)&&"isPerspectiveCamera"in e.camera&&e.camera.isPerspectiveCamera){let t=e.camera,a=T&&Number.isFinite(T.fov)?T.fov+(E.fov-T.fov)*I:E.fov,r=(0,oQ.torqueHorizontalFovToThreeVerticalFov)(a,t.aspect);Math.abs(t.fov-r)>.01&&(t.fov=r,t.updateProjectionMatrix())}}let B=sK(P),j=sK(w),_=i.current;if(_)for(let t of _.children){let a=B.get(t.name);if(!a?.position){t.visible=!1;continue}t.visible=!0;let r=j.get(t.name);if(r?.position){let e=r.position[0],n=r.position[1],i=r.position[2],o=a.position[0],s=a.position[1],l=a.position[2],c=e+(o-e)*I,d=n+(s-n)*I,u=i+(l-i)*I;t.position.set(d,u,c)}else t.position.set(a.position[1],a.position[2],a.position[0]);a.faceViewer?t.quaternion.copy(e.camera.quaternion).multiply(sJ):a.visual?.kind==="tracer"?t.quaternion.identity():a.rotation&&(r?.rotation?(sY.set(...r.rotation),sZ.set(...a.rotation),sY.slerp(sZ,I),t.quaternion.copy(sY)):t.quaternion.set(...a.rotation))}let R=E?.mode;if("third-person"===R&&_&&E?.orbitTargetId){let t=_.children.find(e=>e.name===E.orbitTargetId);if(t){let a=B.get(E.orbitTargetId);s0.copy(t.position),a?.type==="Player"&&(s0.y+=1);let r=!1;if("number"==typeof E.yaw&&"number"==typeof E.pitch){let e=Math.sin(E.pitch),t=Math.cos(E.pitch),a=Math.sin(E.yaw),n=Math.cos(E.yaw);sQ.set(-t,-a*e,-n*e),r=sQ.lengthSq()>1e-8}if(r||(sQ.copy(e.camera.position).sub(s0),r=sQ.lengthSq()>1e-8),r){sQ.normalize();let t=Math.max(.1,E.orbitDistance??4);s2.copy(s0).addScaledVector(sQ,t),e.camera.position.copy(s2),e.camera.lookAt(s0)}}}if("first-person"===R&&_&&E?.controlEntityId){let t=_.children.find(e=>e.name===E.controlEntityId);t?(sX.copy(m.current).applyQuaternion(t.quaternion),e.camera.position.add(sX)):e.camera.position.y+=m.current.y}c&&S.exhausted?(F.current||(F.current=!0,n.recordPlaybackDiagnosticEvent({kind:"stream.exhausted",message:"Streaming playback reached end-of-stream while playing",meta:{streamTimeSec:Number(S.timeSec.toFixed(3)),requestedPlaybackSec:Number(l.current.toFixed(3))}})),n.setPlaybackStatus("paused")):S.exhausted||(F.current=!1);let N=1e3*l.current;Math.abs(N-o.timeMs)>.5&&n.setPlaybackTime(N)}),(0,a.jsxs)(eB.TickProvider,{children:[(0,a.jsx)("group",{ref:i,children:b.map(e=>(0,a.jsx)(sy,{entity:e,timeRef:s},e.id))}),(0,a.jsx)(sq,{playback:e.streamingPlayback,snapshotRef:h}),S&&(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(o6,{shapeName:S,eyeOffsetRef:m})})]})}let s4=0,s6=0;function s8({recording:e}){let{gl:t,scene:a}=(0,h.useThree)(),r=(0,P.useEngineStoreApi)(),i=(0,n.useRef)(null),o=(0,n.useRef)(0);return(0,n.useEffect)(()=>{r.getState().recordPlaybackDiagnosticEvent({kind:"recording.loaded",meta:{missionName:e.missionName??null,gameType:e.gameType??null,durationSec:Number(e.duration.toFixed(3))}})},[r]),(0,n.useEffect)(()=>{let e=t.domElement;if(!e)return;let a=()=>{try{let e=t.getContext();if(e&&"function"==typeof e.isContextLost)return!!e.isContextLost()}catch{}},n=e=>{e.preventDefault();let t=r.getState();t.setWebglContextLost(!0),t.recordPlaybackDiagnosticEvent({kind:"webgl.context.lost",message:"Renderer emitted webglcontextlost",meta:{contextLost:a()}}),console.error("[demo diagnostics] WebGL context lost")},i=()=>{let e=r.getState();e.setWebglContextLost(!1),e.recordPlaybackDiagnosticEvent({kind:"webgl.context.restored",message:"Renderer emitted webglcontextrestored",meta:{contextLost:a()}}),console.warn("[demo diagnostics] WebGL context restored")},o=e=>{r.getState().recordPlaybackDiagnosticEvent({kind:"webgl.context.creation_error",message:e.statusMessage??"Context creation error",meta:{contextLost:a()}}),console.error("[demo diagnostics] WebGL context creation error",e.statusMessage??"")};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",i,!1),e.addEventListener("webglcontextcreationerror",o,!1),()=>{e.removeEventListener("webglcontextlost",n,!1),e.removeEventListener("webglcontextrestored",i,!1),e.removeEventListener("webglcontextcreationerror",o,!1)}},[r,t]),(0,n.useEffect)(()=>{let e=()=>{let{sceneObjects:e,visibleSceneObjects:n}=(0,oQ.collectSceneObjectCounts)(a),s=Array.isArray(t.info.programs)?t.info.programs.length:0,l=performance.memory,c={t:Date.now(),geometries:t.info.memory.geometries,textures:t.info.memory.textures,programs:s,renderCalls:t.info.render.calls,renderTriangles:t.info.render.triangles,renderPoints:t.info.render.points,renderLines:t.info.render.lines,sceneObjects:e,visibleSceneObjects:n,jsHeapUsed:l?.usedJSHeapSize,jsHeapTotal:l?.totalJSHeapSize,jsHeapLimit:l?.jsHeapSizeLimit};r.getState().appendRendererSample(c);let d=i.current;if(i.current={geometries:c.geometries,textures:c.textures,programs:c.programs,sceneObjects:c.sceneObjects,visibleSceneObjects:c.visibleSceneObjects},!d)return;let u=c.t,h=c.geometries-d.geometries,m=c.textures-d.textures,g=c.programs-d.programs,f=c.sceneObjects-d.sceneObjects;u-o.current>=5e3&&(h>=200||m>=100||g>=20||f>=400)&&(o.current=u,r.getState().recordPlaybackDiagnosticEvent({kind:"renderer.resource.spike",message:"Detected large one-second renderer resource increase",meta:{geometryDelta:h,textureDelta:m,programDelta:g,sceneObjectDelta:f,geometries:c.geometries,textures:c.textures,programs:c.programs,sceneObjects:c.sceneObjects}}))};e();let n=window.setInterval(e,1e3);return()=>{window.clearInterval(n)}},[r,t,a]),null}function s7(){let e=(0,P.useEngineStoreApi)(),t=ts(),r=(0,n.useRef)(null);return(r.current||(r.current=(0,oQ.nextLifecycleInstanceId)("DemoPlayback")),(0,n.useEffect)(()=>{s4+=1;let a=Date.now();return e.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"DemoPlayback mounted",meta:{component:"DemoPlayback",phase:"mount",instanceId:r.current,mountCount:s4,unmountCount:s6,recordingMissionName:t?.missionName??null,recordingDurationSec:t?Number(t.duration.toFixed(3)):null,ts:a}}),console.info("[demo diagnostics] DemoPlayback mounted",{instanceId:r.current,mountCount:s4,unmountCount:s6,recordingMissionName:t?.missionName??null,mountedAt:a}),()=>{s6+=1;let a=Date.now();e.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"DemoPlayback unmounted",meta:{component:"DemoPlayback",phase:"unmount",instanceId:r.current,mountCount:s4,unmountCount:s6,recordingMissionName:t?.missionName??null,ts:a}}),console.info("[demo diagnostics] DemoPlayback unmounted",{instanceId:r.current,mountCount:s4,unmountCount:s6,recordingMissionName:t?.missionName??null,unmountedAt:a})}},[e]),t)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s8,{recording:t}),(0,a.jsx)(s5,{recording:t})]}):null}var s9=e.i(30064),le=e.i(21629);let lt=[.25,.5,1,2,4];function la(e){let t=Math.floor(e/60),a=Math.floor(e%60);return`${t}:${a.toString().padStart(2,"0")}`}function lr(){let e,t,n,i,o,s,l,c,d,u,h,m,g,f,p,y,v,F,b,x,S=(0,r.c)(55),k=ts(),D=tc(),w=(0,P.useEngineSelector)(tu),C=(0,P.useEngineSelector)(th),I=(0,P.useEngineSelector)(tm),{play:M,pause:E,seek:T,setSpeed:B}=tg(),j=(0,P.useEngineStoreApi)(),_=(0,P.useEngineSelector)(lh),R=(0,P.useEngineSelector)(lu),N=(0,P.useEngineSelector)(ld),A=(0,P.useEngineSelector)(lc),G=(0,P.useEngineSelector)(ll);S[0]!==T?(e=e=>{T(parseFloat(e.target.value))},S[0]=T,S[1]=e):e=S[1];let L=e;S[2]!==B?(t=e=>{B(parseFloat(e.target.value))},S[2]=B,S[3]=t):t=S[3];let z=t;S[4]!==j?(n=()=>{let e=j.getState(),t=(0,s9.buildSerializableDiagnosticsSnapshot)(e),a=(0,s9.buildSerializableDiagnosticsJson)(e);console.log("[demo diagnostics dump]",t),console.log("[demo diagnostics dump json]",a)},S[4]=j,S[5]=n):n=S[5];let U=n;S[6]!==j?(i=()=>{j.getState().clearPlaybackDiagnostics(),console.info("[demo diagnostics] Cleared playback diagnostics")},S[6]=j,S[7]=i):i=S[7];let O=i;if(!k)return null;let V=D?E:M,q=D?"Pause":"Play",H=D?"❚❚":"▶";S[8]!==V||S[9]!==q||S[10]!==H?(o=(0,a.jsx)("button",{className:le.default.PlayPause,onClick:V,"aria-label":q,children:H}),S[8]=V,S[9]=q,S[10]=H,S[11]=o):o=S[11],S[12]!==w?(s=la(w),S[12]=w,S[13]=s):s=S[13],S[14]!==C?(l=la(C),S[14]=C,S[15]=l):l=S[15];let W=`${s} / ${l}`;S[16]!==W?(c=(0,a.jsx)("span",{className:le.default.Time,children:W}),S[16]=W,S[17]=c):c=S[17],S[18]!==w||S[19]!==C||S[20]!==L?(d=(0,a.jsx)("input",{className:le.default.Seek,type:"range",min:0,max:C,step:.01,value:w,onChange:L}),S[18]=w,S[19]=C,S[20]=L,S[21]=d):d=S[21],S[22]===Symbol.for("react.memo_cache_sentinel")?(u=lt.map(ln),S[22]=u):u=S[22],S[23]!==z||S[24]!==I?(h=(0,a.jsx)("select",{className:le.default.Speed,value:I,onChange:z,children:u}),S[23]=z,S[24]=I,S[25]=h):h=S[25];let $=_?"true":void 0,K=_?"WebGL context: LOST":"WebGL context: ok";if(S[26]!==K?(m=(0,a.jsx)("div",{className:le.default.DiagnosticsStatus,children:K}),S[26]=K,S[27]=m):m=S[27],S[28]!==N){var X;g=(0,a.jsx)("div",{className:le.default.DiagnosticsMetrics,children:N?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{children:["geom ",N.geometries," tex"," ",N.textures," prog"," ",N.programs]}),(0,a.jsxs)("span",{children:["draw ",N.renderCalls," tri"," ",N.renderTriangles]}),(0,a.jsxs)("span",{children:["scene ",N.visibleSceneObjects,"/",N.sceneObjects]}),(0,a.jsxs)("span",{children:["heap ",Number.isFinite(X=N.jsHeapUsed)&&null!=X?X<1024?`${Math.round(X)} B`:X<1048576?`${(X/1024).toFixed(1)} KB`:X<0x40000000?`${(X/1048576).toFixed(1)} MB`:`${(X/0x40000000).toFixed(2)} GB`:"n/a"]})]}):(0,a.jsx)("span",{children:"No renderer samples yet"})}),S[28]=N,S[29]=g}else g=S[29];return S[30]!==A||S[31]!==R?(f=(0,a.jsxs)("span",{children:["samples ",R," events ",A]}),S[30]=A,S[31]=R,S[32]=f):f=S[32],S[33]!==G?(p=G?(0,a.jsxs)("span",{title:G.message,children:["last event: ",G.kind]}):(0,a.jsx)("span",{children:"last event: none"}),S[33]=G,S[34]=p):p=S[34],S[35]!==U?(y=(0,a.jsx)("button",{type:"button",onClick:U,children:"Dump"}),S[35]=U,S[36]=y):y=S[36],S[37]!==O?(v=(0,a.jsx)("button",{type:"button",onClick:O,children:"Clear"}),S[37]=O,S[38]=v):v=S[38],S[39]!==f||S[40]!==p||S[41]!==y||S[42]!==v?(F=(0,a.jsxs)("div",{className:le.default.DiagnosticsFooter,children:[f,p,y,v]}),S[39]=f,S[40]=p,S[41]=y,S[42]=v,S[43]=F):F=S[43],S[44]!==$||S[45]!==m||S[46]!==g||S[47]!==F?(b=(0,a.jsxs)("div",{className:le.default.DiagnosticsPanel,"data-context-lost":$,children:[m,g,F]}),S[44]=$,S[45]=m,S[46]=g,S[47]=F,S[48]=b):b=S[48],S[49]!==c||S[50]!==d||S[51]!==h||S[52]!==b||S[53]!==o?(x=(0,a.jsxs)("div",{className:le.default.Root,onKeyDown:ls,onPointerDown:lo,onClick:li,children:[o,c,d,h,b]}),S[49]=c,S[50]=d,S[51]=h,S[52]=b,S[53]=o,S[54]=x):x=S[54],x}function ln(e){return(0,a.jsxs)("option",{value:e,children:[e,"x"]},e)}function li(e){return e.stopPropagation()}function lo(e){return e.stopPropagation()}function ls(e){return e.stopPropagation()}function ll(e){let t=e.diagnostics.playbackEvents;return t.length>0?t[t.length-1]:null}function lc(e){return e.diagnostics.playbackEvents.length}function ld(e){let t=e.diagnostics.rendererSamples;return t.length>0?t[t.length-1]:null}function lu(e){return e.diagnostics.rendererSamples.length}function lh(e){return e.diagnostics.webglContextLost}var lm=e.i(75840);function lg(e){let t,n=(0,r.c)(2),{value:i}=e,o=Math.max(0,Math.min(100,100*i)),s=`${o}%`;return n[0]!==s?(t=(0,a.jsx)("div",{className:lm.default.HealthBar,children:(0,a.jsx)("div",{className:lm.default.BarFill,style:{width:s}})}),n[0]=s,n[1]=t):t=n[1],t}function lf(e){let t,n=(0,r.c)(2),{value:i}=e,o=Math.max(0,Math.min(100,100*i)),s=`${o}%`;return n[0]!==s?(t=(0,a.jsx)("div",{className:lm.default.EnergyBar,children:(0,a.jsx)("div",{className:lm.default.BarFill,style:{width:s}})}),n[0]=s,n[1]=t):t=n[1],t}function lp(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.ChatWindow}),t[0]=e):e=t[0],e}function ly(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.WeaponSlots}),t[0]=e):e=t[0],e}function lv(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.ToolBelt}),t[0]=e):e=t[0],e}function lF(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.Reticle}),t[0]=e):e=t[0],e}function lb(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.TeamStats}),t[0]=e):e=t[0],e}function lx(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("div",{className:lm.default.Compass}),t[0]=e):e=t[0],e}function lS(){let e,t,n,i,o,s,l,c,d,u=(0,r.c)(13),h=ts(),m=(0,P.useEngineSelector)(lk);if(!h)return null;let g=m?.status;return g?(u[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(lp,{}),t=(0,a.jsx)(lx,{}),u[0]=e,u[1]=t):(e=u[0],t=u[1]),u[2]!==g.health?(n=(0,a.jsx)(lg,{value:g.health}),u[2]=g.health,u[3]=n):n=u[3],u[4]!==g.energy?(i=(0,a.jsx)(lf,{value:g.energy}),u[4]=g.energy,u[5]=i):i=u[5],u[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(lb,{}),s=(0,a.jsx)(lF,{}),l=(0,a.jsx)(lv,{}),c=(0,a.jsx)(ly,{}),u[6]=o,u[7]=s,u[8]=l,u[9]=c):(o=u[6],s=u[7],l=u[8],c=u[9]),u[10]!==n||u[11]!==i?(d=(0,a.jsxs)("div",{className:lm.default.PlayerHUD,children:[e,t,n,i,o,s,l,c]}),u[10]=n,u[11]=i,u[12]=d):d=u[12],d):null}function lk(e){return e.playback.streamSnapshot}var lD=e.i(38847),lP=e.i(3011);let lw=(0,n.lazy)(()=>e.A(59197).then(e=>({default:e.MapInfoDialog}))),lC=new eW.QueryClient,lI={toneMapping:o.NoToneMapping,outputColorSpace:o.SRGBColorSpace},lM=(0,lD.createParser)({parse(e){let[t,a]=e.split("~"),r=a,n=(0,eG.getMissionInfo)(t).missionTypes;return a&&n.includes(a)||(r=n[0]),{missionName:t,missionType:r}},serialize:({missionName:e,missionType:t})=>1===(0,eG.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function lE(){let e,t,s,l,c,d,[u,h]=(0,lD.useQueryState)("mission",lM),m=(0,P.useEngineStoreApi)(),[g,f]=(0,lD.useQueryState)("fog",lD.parseAsBoolean),p=(0,n.useCallback)(()=>{f(null)},[f]),y=(0,n.useRef)(u);y.current=u;let F=(0,n.useCallback)(e=>{let t=y.current,a=function(e=0){let t=Error().stack;if(!t)return null;let a=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return a.length>0?a.join(" <= "):null}(1);m.getState().recordPlaybackDiagnosticEvent({kind:"mission.change.requested",message:"changeMission invoked",meta:{previousMissionName:t.missionName,previousMissionType:t.missionType??null,nextMissionName:e.missionName,nextMissionType:e.missionType??null,stack:a??"unavailable"}}),console.info("[mission trace] changeMission",{previousMission:t,nextMission:e,stack:a}),window.location.hash="",p(),h(e)},[m,h,p]),b=(s=(0,r.c)(2),l=(0,n.useRef)(null),s[0]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{let t=window.matchMedia("(pointer: coarse)");return t.addEventListener("change",e),l.current=t,()=>{t.removeEventListener("change",e)}},s[0]=e):e=s[0],c=e,s[1]===Symbol.for("react.memo_cache_sentinel")?(t=()=>l.current?.matches??null,s[1]=t):t=s[1],d=t,(0,n.useSyncExternalStore)(c,d,o$)),{missionName:x,missionType:S}=u,[k,D]=(0,n.useState)(!1),[w,C]=(0,n.useState)(0),[I,M]=(0,n.useState)(!0),E=w<1;(0,n.useEffect)(()=>{if(E)M(!0);else{let e=setTimeout(()=>M(!1),500);return()=>clearTimeout(e)}},[E]),(0,n.useEffect)(()=>(window.setMissionName=e=>{let t=(0,eG.getMissionInfo)(e).missionTypes;F({missionName:e,missionType:t[0]})},window.getMissionList=eG.getMissionList,window.getMissionInfo=eG.getMissionInfo,()=>{delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}),[F]),(0,n.useEffect)(()=>{let e=e=>{if("KeyI"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||D(!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let T=(0,n.useCallback)((e,t=0)=>{C(t)},[]),B=(0,n.useRef)(null),j=(0,n.useRef)({angle:0,force:0}),_=(0,n.useRef)(null),R=(0,n.useRef)({angle:0,force:0}),N=(0,n.useRef)(null);return(0,a.jsx)(e$.QueryClientProvider,{client:lC,children:(0,a.jsx)("main",{children:(0,a.jsx)(to,{children:(0,a.jsx)(v.SettingsProvider,{fogEnabledOverride:g,onClearFogEnabledOverride:p,children:(0,a.jsxs)(eJ,{map:ta,children:[(0,a.jsxs)("div",{id:"canvasContainer",className:lP.default.CanvasContainer,children:[I&&(0,a.jsxs)("div",{id:"loadingIndicator",className:lP.default.LoadingIndicator,"data-complete":!E,children:[(0,a.jsx)("div",{className:lP.default.Spinner}),(0,a.jsx)("div",{className:lP.default.Progress,children:(0,a.jsx)("div",{className:lP.default.ProgressBar,style:{width:`${100*w}%`}})}),(0,a.jsxs)("div",{className:lP.default.ProgressText,children:[Math.round(100*w),"%"]})]}),(0,a.jsx)(i.Canvas,{frameloop:"always",gl:lI,shadows:{type:o.PCFShadowMap},onCreated:e=>{B.current=e.camera},children:(0,a.jsx)(eD,{children:(0,a.jsxs)(oZ.AudioProvider,{children:[(0,a.jsx)(eH,{name:x,missionType:S,onLoadingChange:T},`${x}~${S}`),(0,a.jsx)(oY,{}),(0,a.jsx)(oJ.DebugElements,{}),(0,a.jsx)(s7,{}),(0,a.jsx)(lj,{isTouch:b,joystickStateRef:j,joystickZoneRef:_,lookJoystickStateRef:R,lookJoystickZoneRef:N})]})})})]}),(0,a.jsx)(lS,{}),b&&(0,a.jsx)(t_,{joystickState:j,joystickZone:_,lookJoystickState:R,lookJoystickZone:N}),!1===b&&(0,a.jsx)(tb,{}),(0,a.jsx)(oO,{missionName:x,missionType:S,onChangeMission:F,onOpenMapInfo:()=>D(!0),cameraRef:B,isTouch:b}),k&&(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)(lw,{open:k,onClose:()=>D(!1),missionName:x,missionType:S??""})}),(0,a.jsx)(lB,{changeMission:F,currentMission:u}),(0,a.jsx)(lr,{}),(0,a.jsx)(l_,{})]})})})})})}let lT={"Capture the Flag":"CTF","Capture and Hold":"CnH",Deathmatch:"DM","Team Deathmatch":"TDM",Siege:"Siege",Bounty:"Bounty",Rabbit:"Rabbit"};function lB(e){let t,a,i=(0,r.c)(5),{changeMission:o,currentMission:s}=e,l=ts();return i[0]!==o||i[1]!==s||i[2]!==l?(t=()=>{if(!l?.missionName)return;let e=(0,eG.findMissionByDemoName)(l.missionName);if(!e)return void console.warn(`Demo mission "${l.missionName}" not found in manifest`);let t=(0,eG.getMissionInfo)(e),a=l.gameType?lT[l.gameType]:void 0,r=a&&t.missionTypes.includes(a)?a:t.missionTypes[0];(s.missionName!==e||s.missionType!==r)&&o({missionName:e,missionType:r})},a=[l,o,s],i[0]=o,i[1]=s,i[2]=l,i[3]=t,i[4]=a):(t=i[3],a=i[4]),(0,n.useEffect)(t,a),null}function lj(e){let t,n=(0,r.c)(6),{isTouch:i,joystickStateRef:o,joystickZoneRef:s,lookJoystickStateRef:l,lookJoystickZoneRef:c}=e;if(tc()||null===i)return null;if(i){let e;return n[0]!==o||n[1]!==s||n[2]!==l||n[3]!==c?(e=(0,a.jsx)(tR,{joystickState:o,joystickZone:s,lookJoystickState:l,lookJoystickZone:c}),n[0]=o,n[1]=s,n[2]=l,n[3]=c,n[4]=e):e=n[4],e}return n[5]===Symbol.for("react.memo_cache_sentinel")?(t=(0,a.jsx)(tr,{}),n[5]=t):t=n[5],t}function l_(){let e,t,a=(0,r.c)(4),{setRecording:i}=tg(),o=(0,P.useEngineStoreApi)();return a[0]!==o||a[1]!==i?(e=()=>(window.loadDemoRecording=i,window.getDemoDiagnostics=()=>(0,s9.buildSerializableDiagnosticsSnapshot)(o.getState()),window.getDemoDiagnosticsJson=()=>(0,s9.buildSerializableDiagnosticsJson)(o.getState()),window.clearDemoDiagnostics=()=>{o.getState().clearPlaybackDiagnostics()},lR),t=[o,i],a[0]=o,a[1]=i,a[2]=e,a[3]=t):(e=a[2],t=a[3]),(0,n.useEffect)(e,t),null}function lR(){delete window.loadDemoRecording,delete window.getDemoDiagnostics,delete window.getDemoDiagnosticsJson,delete window.clearDemoDiagnostics}function lN(){let e,t=(0,r.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)(n.Suspense,{children:(0,a.jsx)(lE,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>lN],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/3ff360e595385fc4.js b/docs/_next/static/chunks/3ff360e595385fc4.js new file mode 100644 index 00000000..a2fb0444 --- /dev/null +++ b/docs/_next/static/chunks/3ff360e595385fc4.js @@ -0,0 +1,52 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,79474,(t,e,i)=>{"use strict";var s=t.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;i.c=function(t){return s.H.useMemoCache(t)}},932,(t,e,i)=>{"use strict";e.exports=t.r(79474)},90072,t=>{"use strict";let e,i,s,r,n,a,o,h,l,u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p="attached",d="detached",m="srgb",f="srgb-linear",g="linear",y="srgb",x={COMPUTE:"compute",RENDER:"render"},b={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},v={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function w(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}let M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function S(t,e){return new M[t](e)}function A(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function C(){let t=_("canvas");return t.style.display="block",t}let T={},I=null;function z(t){I=t}function k(){return I}function B(...t){let e="THREE."+t.shift();I?I("log",e,...t):console.log(e,...t)}function R(...t){let e="THREE."+t.shift();I?I("warn",e,...t):console.warn(e,...t)}function O(...t){let e="THREE."+t.shift();I?I("error",e,...t):console.error(e,...t)}function E(...t){let e=t.join(" ");e in T||(T[e]=!0,R(...t))}function P(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}class L{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return void 0!==i&&void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){let i=this._listeners;if(void 0===i)return;let s=i[t];if(void 0!==s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){let e=this._listeners;if(void 0===e)return;let i=e[t.type];if(void 0!==i){t.target=this;let e=i.slice(0);for(let i=0,s=e.length;i>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&i|128]+N[i>>8&255]+"-"+N[i>>16&255]+N[i>>24&255]+N[255&s]+N[s>>8&255]+N[s>>16&255]+N[s>>24&255]).toLowerCase()}function j(t,e,i){return Math.max(e,Math.min(i,t))}function U(t,e){return(t%e+e)%e}function W(t,e,i){return(1-i)*t+i*e}function G(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/0xffffffff;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/0x7fffffff,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw Error("Invalid component type.")}}function q(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(0xffffffff*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(0x7fffffff*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw Error("Invalid component type.")}}let H={DEG2RAD:$,RAD2DEG:V,generateUUID:D,clamp:j,euclideanModulo:U,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:W,damp:function(t,e,i,s){return W(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(U(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(F=t);let e=F+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000},degToRad:function(t){return t*$},radToDeg:function(t){return t*V},isPowerOfTwo:function(t){return(t&t-1)==0&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){let n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),u=a((e+s)/2),c=n((e-s)/2),p=a((e-s)/2),d=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*u,h*c,h*p,o*l);break;case"YZY":t.set(h*p,o*u,h*c,o*l);break;case"ZXZ":t.set(h*c,h*p,o*u,o*l);break;case"XZX":t.set(o*u,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*u,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*u,o*l);break;default:R("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:q,denormalize:G};class J{constructor(t=0,e=0){J.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class X{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],u=i[s+3],c=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0){t[e+0]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u;return}if(a>=1){t[e+0]=c,t[e+1]=p,t[e+2]=d,t[e+3]=m;return}if(u!==m||o!==c||h!==p||l!==d){let t=o*c+h*p+l*d+u*m;t<0&&(c=-c,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){let i=Math.acos(t),s=Math.sin(i);o=o*(e=Math.sin(e*i)/s)+c*(a=Math.sin(a*i)/s),h=h*e+p*a,l=l*e+d*a,u=u*e+m*a}else{let t=1/Math.sqrt((o=o*e+c*a)*o+(h=h*e+p*a)*h+(l=l*e+d*a)*l+(u=u*e+m*a)*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){let a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],u=r[n],c=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*u+o*p-h*c,t[e+1]=o*d+l*c+h*u-a*p,t[e+2]=h*d+l*p+a*c-o*u,t[e+3]=l*d-a*u-o*c-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),u=a(r/2),c=o(i/2),p=o(s/2),d=o(r/2);switch(n){case"XYZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"YXZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"ZXY":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"ZYX":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"YZX":this._x=c*l*u+h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u-c*p*d;break;case"XZY":this._x=c*l*u-h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u+c*p*d;break;default:R("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){let t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>u){let t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>u){let t=2*Math.sqrt(1+a-i-u);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{let t=2*Math.sqrt(1+u-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=i,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(j(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(0===i)return this;let s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){let t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(t=0,e=0,i=0){Z.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Q.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Q.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),u=2*(r*i-n*e);return this.x=e+o*h+n*u-a*l,this.y=i+o*l+a*h-r*u,this.z=s+o*u+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Y.copy(this).projectOnVector(t),this.sub(Y)}reflect(t){return this.sub(Y.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let Y=new Z,Q=new X;class K{constructor(t,e,i,s,r,n,a,o,h){K.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){let l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],p=i[5],d=i[8],m=s[0],f=s[3],g=s[6],y=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*y+o*v,r[3]=n*f+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*y+u*v,r[4]=h*f+l*x+u*w,r[7]=h*g+l*b+u*M,r[2]=c*m+p*y+d*v,r[5]=c*f+p*x+d*w,r[8]=c*g+p*b+d*M,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*n-a*h,c=a*o-l*r,p=h*r-n*o,d=e*u+i*c+s*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return t[0]=u*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=c*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=p*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,a){let o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(tt.makeScale(t,e)),this}rotate(t){return this.premultiply(tt.makeRotation(-t)),this}translate(t,e){return this.premultiply(tt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}let tt=new K,te=new K().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ti=new K().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ts=(o=[.64,.33,.3,.6,.15,.06],h=[.2126,.7152,.0722],l=[.3127,.329],(a={enabled:!0,workingColorSpace:f,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i&&(this.spaces[e].transfer===y&&(t.r=tr(t.r),t.g=tr(t.g),t.b=tr(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===y&&(t.r=tn(t.r),t.g=tn(t.g),t.b=tn(t.b))),t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?g:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,e){return E("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(t,e)},toWorkingColorSpace:function(t,e){return E("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(t,e)}}).define({[f]:{primaries:o,whitePoint:l,transfer:g,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,workingColorSpaceConfig:{unpackColorSpace:m},outputColorSpaceConfig:{drawingBufferColorSpace:m}},[m]:{primaries:o,whitePoint:l,transfer:y,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,outputColorSpaceConfig:{drawingBufferColorSpace:m}}}),a);function tr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ta{static getDataURL(t,i="image/png"){let s;if(/^data:/i.test(t.src)||"u"typeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap){let e=_("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;ttypeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"u">typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(null!==s){let t;if(Array.isArray(s)){t=[];for(let e=0,i=s.length;etypeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap?ta.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(R("Texture: Unable to serialize Texture."),{})}let tu=0,tc=new Z;class tp extends L{constructor(t=tp.DEFAULT_IMAGE,e=tp.DEFAULT_MAPPING,i=1001,s=1001,r=1006,n=1008,a=1023,o=1009,h=tp.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tu++}),this.uuid=D(),this.name="",this.source=new th(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new K,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!t&&!!t.depth&&t.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(tc).x}get height(){return this.source.getSize(tc).y}get depth(){return this.source.getSize(tc).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(void 0===i){R(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}tp.DEFAULT_IMAGE=null,tp.DEFAULT_MAPPING=300,tp.DEFAULT_ANISOTROPY=1;class td{constructor(t=0,e=0,i=0,s=1){td.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r,n=t.elements,a=n[0],o=n[4],h=n[8],l=n[1],u=n[5],c=n[9],p=n[2],d=n[6],m=n[10];if(.01>Math.abs(o-l)&&.01>Math.abs(h-p)&&.01>Math.abs(c-d)){if(.1>Math.abs(o+l)&&.1>Math.abs(h+p)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+m-3))return this.set(1,0,0,0),this;e=Math.PI;let t=(a+1)/2,n=(u+1)/2,f=(m+1)/2,g=(o+l)/4,y=(h+p)/4,x=(c+d)/4;return t>n&&t>f?t<.01?(i=0,s=.707106781,r=.707106781):(s=g/(i=Math.sqrt(t)),r=y/i):n>f?n<.01?(i=.707106781,s=0,r=.707106781):(i=g/(s=Math.sqrt(n)),r=x/s):f<.01?(i=.707106781,s=.707106781,r=0):(i=y/(r=Math.sqrt(f)),s=x/r),this.set(i,s,r,e),this}let f=Math.sqrt((d-c)*(d-c)+(h-p)*(h-p)+(l-o)*(l-o));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(h-p)/f,this.z=(l-o)/f,this.w=Math.acos((a+u+m-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this.w=j(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this.w=j(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 tm extends L{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new td(0,0,t,e),this.scissorTest=!1,this.viewport=new td(0,0,t,e);const s=new tp({width:t,height:e,depth:i.depth});this.textures=[];const r=i.count;for(let t=0;t1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tM),tM.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tk),tB.subVectors(this.max,tk),tA.subVectors(t.a,tk),t_.subVectors(t.b,tk),tC.subVectors(t.c,tk),tT.subVectors(t_,tA),tI.subVectors(tC,t_),tz.subVectors(tA,tC);let e=[0,-tT.z,tT.y,0,-tI.z,tI.y,0,-tz.z,tz.y,tT.z,0,-tT.x,tI.z,0,-tI.x,tz.z,0,-tz.x,-tT.y,tT.x,0,-tI.y,tI.x,0,-tz.y,tz.x,0];return!!tE(e,tA,t_,tC,tB)&&!!tE(e=[1,0,0,0,1,0,0,0,1],tA,t_,tC,tB)&&(tR.crossVectors(tT,tI),tE(e=[tR.x,tR.y,tR.z],tA,t_,tC,tB))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tM).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tM).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(tw[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),tw[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),tw[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),tw[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),tw[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),tw[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),tw[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),tw[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(tw)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}let tw=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tM=new Z,tS=new tv,tA=new Z,t_=new Z,tC=new Z,tT=new Z,tI=new Z,tz=new Z,tk=new Z,tB=new Z,tR=new Z,tO=new Z;function tE(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){tO.fromArray(t,n);let a=r.x*Math.abs(tO.x)+r.y*Math.abs(tO.y)+r.z*Math.abs(tO.z),o=e.dot(tO),h=i.dot(tO),l=s.dot(tO);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}let tP=new tv,tL=new Z,tN=new Z;class tF{constructor(t=new Z,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;void 0!==e?i.copy(e):tP.setFromPoints(t).getCenter(i);let s=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;tL.subVectors(t,this.center);let e=tL.lengthSq();if(e>this.radius*this.radius){let t=Math.sqrt(e),i=(t-this.radius)*.5;this.center.addScaledVector(tL,i/t),this.radius+=i}return this}union(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(tN.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(tL.copy(t.center).add(tN)),this.expandByPoint(tL.copy(t.center).sub(tN)))),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let t$=new Z,tV=new Z,tD=new Z,tj=new Z,tU=new Z,tW=new Z,tG=new Z;class tq{constructor(t=new Z,e=new Z(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,t$)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=t$.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(t$.copy(this.origin).addScaledVector(this.direction,e),t$.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){let r,n,a,o;tV.copy(t).add(e).multiplyScalar(.5),tD.copy(e).sub(t).normalize(),tj.copy(this.origin).sub(tV);let h=.5*t.distanceTo(e),l=-this.direction.dot(tD),u=tj.dot(this.direction),c=-tj.dot(tD),p=tj.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(r=l*c-u,n=l*u-c,o=h*d,r>=0)if(n>=-o)if(n<=o){let t=1/d;r*=t,n*=t,a=r*(r+l*n+2*u)+n*(l*r+n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=h)+u)))*r+n*(n+2*c)+p;else a=-(r=Math.max(0,-(l*(n=-h)+u)))*r+n*(n+2*c)+p;else n<=-o?(n=(r=Math.max(0,-(-l*h+u)))>0?-h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p):n<=o?(r=0,a=(n=Math.min(Math.max(-h,-c),h))*(n+2*c)+p):(n=(r=Math.max(0,-(l*h+u)))>0?h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p);else n=l>0?-h:h,a=-(r=Math.max(0,-(l*n+u)))*r+n*(n+2*c)+p;return i&&i.copy(this.origin).addScaledVector(this.direction,r),s&&s.copy(tV).addScaledVector(tD,n),a}intersectSphere(t,e){t$.subVectors(t.center,this.origin);let i=t$.dot(this.direction),s=t$.dot(t$)-i*i,r=t.radius*t.radius;if(s>r)return null;let n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return!!(0===e||t.normal.dot(this.direction)*e<0)}intersectBox(t,e){let i,s,r,n,a,o,h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(h>=0?(i=(t.min.x-c.x)*h,s=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,s=(t.min.x-c.x)*h),l>=0?(r=(t.min.y-c.y)*l,n=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,n=(t.min.y-c.y)*l),i>n||r>s||((r>i||isNaN(i))&&(i=r),(n=0?(a=(t.min.z-c.z)*u,o=(t.max.z-c.z)*u):(a=(t.max.z-c.z)*u,o=(t.min.z-c.z)*u),i>o||a>s||((a>i||i!=i)&&(i=a),(o=0?i:s,e)}intersectsBox(t){return null!==this.intersectBox(t,t$)}intersectTriangle(t,e,i,s,r){let n;tU.subVectors(e,t),tW.subVectors(i,t),tG.crossVectors(tU,tW);let a=this.direction.dot(tG);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}tj.subVectors(this.origin,t);let o=n*this.direction.dot(tW.crossVectors(tj,tW));if(o<0)return null;let h=n*this.direction.dot(tU.cross(tj));if(h<0||o+h>a)return null;let l=-n*tj.dot(tG);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tH{constructor(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){tH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f)}set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=s,g[1]=r,g[5]=n,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=p,g[7]=d,g[11]=m,g[15]=f,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 tH().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1)):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();let e=this.elements,i=t.elements,s=1/tJ.setFromMatrixColumn(t,0).length(),r=1/tJ.setFromMatrixColumn(t,1).length(),n=1/tJ.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(s),h=Math.sin(s),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+s*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=s+i*h,e[10]=n*o}else if("YXZ"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t+r*a,e[4]=s*a-i,e[8]=n*h,e[1]=n*u,e[5]=n*l,e[9]=-a,e[2]=i*a-s,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t-r*a,e[4]=-n*u,e[8]=s+i*a,e[1]=i+s*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=s*h-i,e[8]=t*h+r,e[1]=o*u,e[5]=r*h+t,e[9]=i*h-s,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=r-t*u,e[8]=s*u+i,e[1]=u,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+s,e[10]=t-r*u}else if("XZY"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+r,e[5]=n*l,e[9]=i*u-s,e[2]=s*u-i,e[6]=a*l,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(tZ,t,tY)}lookAt(t,e,i){let s=this.elements;return t0.subVectors(t,e),0===t0.lengthSq()&&(t0.z=1),t0.normalize(),tQ.crossVectors(i,t0),0===tQ.lengthSq()&&(1===Math.abs(i.z)?t0.x+=1e-4:t0.z+=1e-4,t0.normalize(),tQ.crossVectors(i,t0)),tQ.normalize(),tK.crossVectors(t0,tQ),s[0]=tQ.x,s[4]=tK.x,s[8]=t0.x,s[1]=tQ.y,s[5]=tK.y,s[9]=t0.y,s[2]=tQ.z,s[6]=tK.z,s[10]=t0.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],b=i[11],v=i[15],w=s[0],M=s[4],S=s[8],A=s[12],_=s[1],C=s[5],T=s[9],I=s[13],z=s[2],k=s[6],B=s[10],R=s[14],O=s[3],E=s[7],P=s[11],L=s[15];return r[0]=n*w+a*_+o*z+h*O,r[4]=n*M+a*C+o*k+h*E,r[8]=n*S+a*T+o*B+h*P,r[12]=n*A+a*I+o*R+h*L,r[1]=l*w+u*_+c*z+p*O,r[5]=l*M+u*C+c*k+p*E,r[9]=l*S+u*T+c*B+p*P,r[13]=l*A+u*I+c*R+p*L,r[2]=d*w+m*_+f*z+g*O,r[6]=d*M+m*C+f*k+g*E,r[10]=d*S+m*T+f*B+g*P,r[14]=d*A+m*I+f*R+g*L,r[3]=y*w+x*_+b*z+v*O,r[7]=y*M+x*C+b*k+v*E,r[11]=y*S+x*T+b*B+v*P,r[15]=y*A+x*I+b*R+v*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],p=t[14],d=t[3],m=t[7],f=t[11],g=t[15],y=o*p-h*c,x=a*p-h*u,b=a*c-o*u,v=n*p-h*l,w=n*c-o*l,M=n*u-a*l;return e*(m*y-f*x+g*b)-i*(d*y-f*v+g*w)+s*(d*x-m*v+g*M)-r*(d*b-m*w+f*M)}transpose(){let t,e=this.elements;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(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=u*f*h-m*c*h+m*o*p-a*f*p-u*o*g+a*c*g,x=d*c*h-l*f*h-d*o*p+n*f*p+l*o*g-n*c*g,b=l*m*h-d*u*h+d*a*p-n*m*p-l*a*g+n*u*g,v=d*u*o-l*m*o-d*a*c+n*m*c+l*a*f-n*u*f,w=e*y+i*x+s*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let M=1/w;return t[0]=y*M,t[1]=(m*c*r-u*f*r-m*s*p+i*f*p+u*s*g-i*c*g)*M,t[2]=(a*f*r-m*o*r+m*s*h-i*f*h-a*s*g+i*o*g)*M,t[3]=(u*o*r-a*c*r-u*s*h+i*c*h+a*s*p-i*o*p)*M,t[4]=x*M,t[5]=(l*f*r-d*c*r+d*s*p-e*f*p-l*s*g+e*c*g)*M,t[6]=(d*o*r-n*f*r-d*s*h+e*f*h+n*s*g-e*o*g)*M,t[7]=(n*c*r-l*o*r+l*s*h-e*c*h-n*s*p+e*o*p)*M,t[8]=b*M,t[9]=(d*u*r-l*m*r-d*i*p+e*m*p+l*i*g-e*u*g)*M,t[10]=(n*m*r-d*a*r+d*i*h-e*m*h-n*i*g+e*a*g)*M,t[11]=(l*a*r-n*u*r-l*i*h+e*u*h+n*i*p-e*a*p)*M,t[12]=v*M,t[13]=(l*m*s-d*u*s+d*i*c-e*m*c-l*i*f+e*u*f)*M,t[14]=(d*a*s-n*m*s-d*i*o+e*m*o+n*i*f-e*a*f)*M,t[15]=(n*u*s-l*a*s+l*i*o-e*u*o-n*i*c+e*a*c)*M,this}scale(t){let e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+i,h*a-s*o,h*o+s*a,0,h*a+s*o,l*a+i,l*o-s*n,0,h*o-s*a,l*o+s*n,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,u=a+a,c=r*h,p=r*l,d=r*u,m=n*l,f=n*u,g=a*u,y=o*h,x=o*l,b=o*u,v=i.x,w=i.y,M=i.z;return s[0]=(1-(m+g))*v,s[1]=(p+b)*v,s[2]=(d-x)*v,s[3]=0,s[4]=(p-b)*w,s[5]=(1-(c+g))*w,s[6]=(f+y)*w,s[7]=0,s[8]=(d+x)*M,s[9]=(f-y)*M,s[10]=(1-(c+m))*M,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],0===this.determinant())return i.set(1,1,1),e.identity(),this;let r=tJ.set(s[0],s[1],s[2]).length(),n=tJ.set(s[4],s[5],s[6]).length(),a=tJ.set(s[8],s[9],s[10]).length();0>this.determinant()&&(r=-r),tX.copy(this);let o=1/r,h=1/n,l=1/a;return tX.elements[0]*=o,tX.elements[1]*=o,tX.elements[2]*=o,tX.elements[4]*=h,tX.elements[5]*=h,tX.elements[6]*=h,tX.elements[8]*=l,tX.elements[9]*=l,tX.elements[10]*=l,e.setFromRotationMatrix(tX),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=r/(n-r),l=n*r/(n-r);else if(2e3===a)h=-(n+r)/(n-r),l=-2*n*r/(n-r);else if(2001===a)h=-n/(n-r),l=-n*r/(n-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=2*r/(e-t),u[4]=0,u[8]=(e+t)/(e-t),u[12]=0,u[1]=0,u[5]=2*r/(i-s),u[9]=(i+s)/(i-s),u[13]=0,u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=1/(n-r),l=n/(n-r);else if(2e3===a)h=-2/(n-r),l=-(n+r)/(n-r);else if(2001===a)h=-1/(n-r),l=-r/(n-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=2/(e-t),u[4]=0,u[8]=0,u[12]=-(e+t)/(e-t),u[1]=0,u[5]=2/(i-s),u[9]=0,u[13]=-(i+s)/(i-s),u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let tJ=new Z,tX=new tH,tZ=new Z(0,0,0),tY=new Z(1,1,1),tQ=new Z,tK=new Z,t0=new Z,t1=new tH,t2=new X;class t3{constructor(t=0,e=0,i=0,s=t3.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,r=s[0],n=s[4],a=s[8],o=s[1],h=s[5],l=s[9],u=s[2],c=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(j(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-j(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-j(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(j(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-j(n,-1,1)),.9999999>Math.abs(n)?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:R("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return t1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(t1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return t2.setFromEuler(this),this.setFromQuaternion(t2,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}t3.DEFAULT_ORDER="XYZ";class t5{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){let i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e0){s.children=[];for(let e=0;e0){s.animations=[];for(let e=0;e0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=s,i;function n(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){ec.subVectors(s,e),ep.subVectors(i,e),ed.subVectors(t,e);let n=ec.dot(ec),a=ec.dot(ep),o=ec.dot(ed),h=ep.dot(ep),l=ep.dot(ed),u=n*h-a*a;if(0===u)return r.set(0,0,0),null;let c=1/u,p=(h*o-a*l)*c,d=(n*l-a*o)*c;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,em)&&em.x>=0&&em.y>=0&&em.x+em.y<=1}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,em)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,em.x),o.addScaledVector(n,em.y),o.addScaledVector(a,em.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return ew.setScalar(0),eM.setScalar(0),eS.setScalar(0),ew.fromBufferAttribute(t,e),eM.fromBufferAttribute(t,i),eS.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(ew,r.x),n.addScaledVector(eM,r.y),n.addScaledVector(eS,r.z),n}static isFrontFacing(t,e,i,s){return ec.subVectors(i,e),ep.subVectors(t,e),0>ec.cross(ep).dot(s)}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ec.subVectors(this.c,this.b),ep.subVectors(this.a,this.b),.5*ec.cross(ep).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return eA.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return eA.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return eA.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return eA.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return eA.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,s,r=this.a,n=this.b,a=this.c;ef.subVectors(n,r),eg.subVectors(a,r),ex.subVectors(t,r);let o=ef.dot(ex),h=eg.dot(ex);if(o<=0&&h<=0)return e.copy(r);eb.subVectors(t,n);let l=ef.dot(eb),u=eg.dot(eb);if(l>=0&&u<=l)return e.copy(n);let c=o*u-l*h;if(c<=0&&o>=0&&l<=0)return i=o/(o-l),e.copy(r).addScaledVector(ef,i);ev.subVectors(t,a);let p=ef.dot(ev),d=eg.dot(ev);if(d>=0&&p<=d)return e.copy(a);let m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return s=h/(h-d),e.copy(r).addScaledVector(eg,s);let f=l*d-p*u;if(f<=0&&u-l>=0&&p-d>=0)return ey.subVectors(a,n),s=(u-l)/(u-l+(p-d)),e.copy(n).addScaledVector(ey,s);let g=1/(f+m+c);return i=m*g,s=c*g,e.copy(r).addScaledVector(ef,i).addScaledVector(eg,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let e_={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},eC={h:0,s:0,l:0},eT={h:0,s:0,l:0};function eI(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*6*(2/3-i):t}class ez{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){return void 0===e&&void 0===i?t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t):this.setRGB(t,e,i),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=m){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ts.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=ts.workingColorSpace){return this.r=t,this.g=e,this.b=i,ts.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=ts.workingColorSpace){if(t=U(t,1),e=j(e,0,1),i=j(i,0,1),0===e)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=eI(r,s,t+1/3),this.g=eI(r,s,t),this.b=eI(r,s,t-1/3)}return ts.colorSpaceToWorking(this,s),this}setStyle(t,e=m){let i;function s(e){void 0!==e&&1>parseFloat(e)&&R("Color: Alpha component of "+t+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:R("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);R("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=m){let i=e_[t.toLowerCase()];return void 0!==i?this.setHex(i,e):R("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=tr(t.r),this.g=tr(t.g),this.b=tr(t.b),this}copyLinearToSRGB(t){return this.r=tn(t.r),this.g=tn(t.g),this.b=tn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=m){return ts.workingToColorSpace(ek.copy(this),t),65536*Math.round(j(255*ek.r,0,255))+256*Math.round(j(255*ek.g,0,255))+Math.round(j(255*ek.b,0,255))}getHexString(t=m){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ts.workingColorSpace){let i,s;ts.workingToColorSpace(ek.copy(this),e);let r=ek.r,n=ek.g,a=ek.b,o=Math.max(r,n,a),h=Math.min(r,n,a),l=(h+o)/2;if(h===o)i=0,s=0;else{let t=o-h;switch(s=l<=.5?t/(o+h):t/(2-o-h),o){case r:i=(n-a)/t+6*(n0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i){R(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(null!==e){let t=e.length;i=Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class eO extends eR{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}let eE=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){let e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}let n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;(8388608&e)==0;)e<<=1,i-=8388608;e&=-8388609,i+=0x38800000,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=0x38000000+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=0x47800000,a[32]=0x80000000;for(let t=33;t<63;++t)a[t]=0x80000000+(t-32<<23);a[63]=0xc7800000;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}();function eP(t){Math.abs(t)>65504&&R("DataUtils.toHalfFloat(): Value out of range."),t=j(t,-65504,65504),eE.floatView[0]=t;let e=eE.uint32View[0],i=e>>23&511;return eE.baseTable[i]+((8388607&e)>>eE.shiftTable[i])}function eL(t){let e=t>>10;return eE.uint32View[0]=eE.mantissaTable[eE.offsetTable[e]+(1023&t)]+eE.exponentTable[e],eE.floatView[0]}class eN{static toHalfFloat(t){return eP(t)}static fromHalfFloat(t){return eL(t)}}let eF=new Z,e$=new J,eV=0;class eD{constructor(t,e,i=!1){if(Array.isArray(t))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:eV++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;se.count&&R("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){O("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(Infinity,Infinity,Infinity));return}if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let e in i){let s=i[e];t.data.attributes[e]=s.toJSON(t.data)}let s={},r=!1;for(let e in this.morphAttributes){let i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone());let s=t.attributes;for(let t in s){let i=s[t];this.setAttribute(t,i.clone(e))}let r=t.morphAttributes;for(let t in r){let i=[],s=r[t];for(let t=0,r=s.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t(t.far-t.near)**2)||(e4.copy(r).invert(),e6.copy(t.ray).applyMatrix4(e4),(null===i.boundingBox||!1!==e6.intersectsBox(i.boundingBox))&&this._computeIntersections(t,e,e6)))}_computeIntersections(t,e,i){let s,r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,c=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=c.length;ri.far?null:{distance:h,point:ia.clone(),object:t}}(t,e,i,s,e7,it,ie,ir);if(u){let t=new Z;eA.getBarycoord(ir,e7,it,ie,t),r&&(u.uv=eA.getInterpolatedAttribute(r,o,h,l,t,new J)),n&&(u.uv1=eA.getInterpolatedAttribute(n,o,h,l,t,new J)),a&&(u.normal=eA.getInterpolatedAttribute(a,o,h,l,t,new Z),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));let e={a:o,b:h,c:l,normal:new Z,materialIndex:0};eA.getNormal(e7,it,ie,e.normal),u.face=e,u.barycoord=t}return u}class il extends e5{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r);const o=[],h=[],l=[],u=[];let c=0,p=0;function d(t,e,i,s,r,n,d,m,f,g,y){let x=n/f,b=d/g,v=n/2,w=d/2,M=m/2,S=f+1,A=g+1,_=0,C=0,T=new Z;for(let n=0;n0?1:-1,l.push(T.x,T.y,T.z),u.push(o/f),u.push(1-n/g),_+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ig extends eu{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tH,this.projectionMatrix=new tH,this.projectionMatrixInverse=new tH,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let iy=new Z,ix=new J,ib=new J;class iv extends ig{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*V*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*$*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*$*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){iy.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(iy.x,iy.y).multiplyScalar(-t/iy.z),iy.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(iy.x,iy.y).multiplyScalar(-t/iy.z)}getViewSize(t,e){return this.getViewBounds(t,ix,ib),e.subVectors(ib,ix)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*$*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s,n=this.view;if(null!==this.view&&this.view.enabled){let t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*s/t,e-=n.offsetY*i/a,s*=n.width/t,i*=n.height/a}let a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class iw extends eu{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new iv(-90,1,t,e);s.layers=this.layers,this.add(s);const r=new iv(-90,1,t,e);r.layers=this.layers,this.add(r);const n=new iv(-90,1,t,e);n.layers=this.layers,this.add(n);const a=new iv(-90,1,t,e);a.layers=this.layers,this.add(a);const o=new iv(-90,1,t,e);o.layers=this.layers,this.add(o);const h=new iv(-90,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(let t of e)this.remove(t);if(2e3===t)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===t)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,n,a,o,h,l]=this.children,u=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,o),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,c,p),t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class iM extends tp{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class iS extends tf{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1};this.texture=new iM([i,i,i,i,i,i]),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let 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 ); + + } + `},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(he.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i0)for(let r=e;r=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x=s.x&&s.x>=h&&r!==s.x&&rW(ni.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;ne&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;rr3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t0)&&p.push(e,r,h),(t!==i-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t=r)){let a=e[1];t=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"u"{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,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(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(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(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[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 t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s1){let t=!1,e=0;for(let t=0,e=c.length;tNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"u">typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"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_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}let m=new Map(Object.keys(r.missions).map(t=>[t.toLowerCase(),t]));function f(t){let e=t.replace(/-/g,"_").toLowerCase();return m.get(e)??null}t.s(["findMissionByDemoName",()=>f,"getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};ieS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("u">typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},62395,33870,38433,86608,t=>{"use strict";var e=t.i(90072);t.s(["parse",()=>E,"runServer",()=>N],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)} +${r} +${this.line("});")}`}{let e=t.name.name;this.currentFunction=e.toLowerCase();let i=this.functionBody(t.body,t.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(e)}, function() {`)} +${i} +${this.line("});")}`}}functionBody(t,e){this.indentLevel++;let i=[];i.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let t=0;tthis.statement(t)).join("\n\n");return this.indentLevel--,`${this.line(`${this.runtime}.package(${e}, function() {`)} +${i} +${this.line("});")}`}datablockDeclaration(t){let e=JSON.stringify(t.className.name),i=t.instanceName?JSON.stringify(t.instanceName.name):"null",s=t.parent?JSON.stringify(t.parent.name):"null",r=this.objectBody(t.body);return this.line(`${this.runtime}.datablock(${e}, ${i}, ${s}, ${r});`)}objectDeclaration(t){let e="Identifier"===t.className.type?JSON.stringify(t.className.name):this.expression(t.className),i=null===t.instanceName?"null":"Identifier"===t.instanceName.type?JSON.stringify(t.instanceName.name):this.expression(t.instanceName),s=[],r=[];for(let e of t.body)"Assignment"===e.type?s.push(e):r.push(e);let n=this.objectBody(s);if(r.length>0){let t=r.map(t=>this.objectDeclaration(t)).join(",\n");return`${this.runtime}.create(${e}, ${i}, ${n}, [ +${t} +])`}return`${this.runtime}.create(${e}, ${i}, ${n})`}objectBody(t){if(0===t.length)return"{}";let e=[];for(let i of t)if("Assignment"===i.type){let t=this.expression(i.value);if("Identifier"===i.target.type){let s=i.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?e.push(`${s}: ${t}`):e.push(`[${JSON.stringify(s)}]: ${t}`)}else if("IndexExpression"===i.target.type){let s=this.objectPropertyKey(i.target);e.push(`[${s}]: ${t}`)}else{let s=this.expression(i.target);e.push(`[${s}]: ${t}`)}}if(e.length<=1)return`{ ${e.join(", ")} }`;let i=this.indent.repeat(this.indentLevel+1),s=this.indent.repeat(this.indentLevel);return`{ +${i}${e.join(",\n"+i)} +${s}}`}objectPropertyKey(t){let e="Identifier"===t.object.type?JSON.stringify(t.object.name):this.expression(t.object),i=Array.isArray(t.index)?t.index.map(t=>this.expression(t)).join(", "):this.expression(t.index);return`${this.runtime}.key(${e}, ${i})`}ifStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.consequent);if(t.alternate)if("IfStatement"===t.alternate.type){let s=this.ifStatement(t.alternate).replace(/^\s*/,"");return this.line(`if (${e}) ${i} else ${s}`)}else{let s=this.statementAsBlock(t.alternate);return this.line(`if (${e}) ${i} else ${s}`)}return this.line(`if (${e}) ${i}`)}forStatement(t){let e=t.init?this.expression(t.init):"",i=t.test?this.expression(t.test):"",s=t.update?this.expression(t.update):"",r=this.statementAsBlock(t.body);return this.line(`for (${e}; ${i}; ${s}) ${r}`)}whileStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.body);return this.line(`while (${e}) ${i}`)}doWhileStatement(t){let e=this.statementAsBlock(t.body),i=this.expression(t.test);return this.line(`do ${e} while (${i});`)}switchStatement(t){if(t.stringMode)return this.switchStringStatement(t);let e=this.expression(t.discriminant);this.indentLevel++;let i=[];for(let e of t.cases)i.push(this.switchCase(e));return this.indentLevel--,`${this.line(`switch (${e}) {`)} +${i.join("\n")} +${this.line("}")}`}switchCase(t){let e=[];if(null===t.test)e.push(this.line("default:"));else if(Array.isArray(t.test))for(let i of t.test)e.push(this.line(`case ${this.expression(i)}:`));else e.push(this.line(`case ${this.expression(t.test)}:`));for(let i of(this.indentLevel++,t.consequent))e.push(this.statement(i));return e.push(this.line("break;")),this.indentLevel--,e.join("\n")}switchStringStatement(t){let e=this.expression(t.discriminant),i=[];for(let e of t.cases)if(null===e.test)i.push(`default: () => { ${this.blockContent(e.consequent)} }`);else if(Array.isArray(e.test))for(let t of e.test)i.push(`${this.expression(t)}: () => { ${this.blockContent(e.consequent)} }`);else i.push(`${this.expression(e.test)}: () => { ${this.blockContent(e.consequent)} }`);return this.line(`${this.runtime}.switchStr(${e}, { ${i.join(", ")} });`)}returnStatement(t){return t.value?this.line(`return ${this.expression(t.value)};`):this.line("return;")}blockStatement(t){this.indentLevel++;let e=t.body.map(t=>this.statement(t)).join("\n");return this.indentLevel--,`{ +${e} +${this.line("}")}`}statementAsBlock(t){if("BlockStatement"===t.type)return this.blockStatement(t);this.indentLevel++;let e=this.statement(t);return this.indentLevel--,`{ +${e} +${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>R,"createScriptCache",()=>I],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;se&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;ne().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return is)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return is)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(t){return t.toLowerCase()}function w(t){let e=t.trim();return v(e.startsWith("$")?e.slice(1):e)}function M(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function S(t,e){for(let i of e)t.add(v(i))}function A(t,e,i){if(t.anyClassValues.has("*")||t.anyClassValues.has(i))return!0;for(let s of e){let e=t.valuesByClass.get(v(s));if(e&&(e.has("*")||e.has(i)))return!0}return!1}let _=[{classNames:["SceneObject","GameBase","ShapeBase","Item","Player"],fields:["position","rotation","scale","transform","hidden","renderingdistance","datablock","shapename","shapefile","initialbarrel","skin","team","health","energy","energylevel","damagelevel","damageflash","damagepercent","damagestate","mountobject","mountedimage","targetposition","targetrotation","targetscale","missiontypeslist","renderenabled","vis","velocity","name"]},{classNames:["*"],fields:["position","rotation","scale","hidden","shapefile","datablock"]}],C=[{classNames:["SceneObject","GameBase","ShapeBase","SimObject"],methods:["settransform","setposition","setrotation","setscale","sethidden","setdatablock","setshapename","mountimage","unmountimage","mountobject","unmountobject","setdamagelevel","setenergylevel","schedule","delete","deleteallobjects","add","remove","playthread","stopthread","setthreaddir","pausethread"]},{classNames:["*"],methods:["settransform","setscale","delete","add","remove"]}],T=["missionrunning","loadingmission"];function I(){return{scripts:new Map,generatedCode:new WeakMap}}function z(t){return t.toLowerCase()}function k(t){return Number(t)>>>0}function B(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function R(t={}){let e,i,s,r=t.reactiveFieldRules??_,u=t.reactiveMethodRules??C,c=t.reactiveGlobalNames??T,p=(e=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.fields);continue}S(M(i,r),s.fields)}return{anyClassValues:e,valuesByClass:i}}(r),(t,i)=>A(e,t,v(i))),d=(i=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.methods);continue}S(M(i,r),s.methods)}return{anyClassValues:e,valuesByClass:i}}(u),(t,e)=>A(i,t,v(e))),m=(s=function(t){let e=new Set;for(let i of t)e.add(w(i));return e}(c),t=>{let e=w(t);return s.has("*")||s.has(e)}),f=new o,g=new o,y=new o,x=[],O=new h,P=3,L=1027,N=new Map,F=new o,$=new o,V=new o,D=new o,j=new o,U=new Set,W=[],G=!1,q=0;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);V.set(e.slice(1),i)}let H=new Set,J=new Set,X=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,Z=t.cache??I(),Y=Z.scripts,Q=Z.generatedCode,K=new Map;function tt(t){let e=K.get(t);return e&&e.length>0?e[e.length-1]:void 0}function te(t,e,i){let s;(s=K.get(t))||(s=[],K.set(t,s)),s.push(e);try{return i()}finally{let e;(e=K.get(t))&&e.pop()}}function ti(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function ts(t,e){return f.get(t)?.get(e)??null}function tr(t){if(!t)return[];let e=[],i=new Set,s=t.class||t._className||t._class,r=s?z(String(s)):"";for(;r&&!i.has(r);)e.push(r),i.add(r),r=j.get(r)??"";return t._superClass&&!i.has(t._superClass)&&e.push(t._superClass),e}function tn(){if(G=!1,0===W.length)return;let t=W.splice(0,W.length);for(let e of(q+=1,U))e({type:"batch.flushed",tick:q,events:t})}function ta(t){for(let e of(W.push(t),U))e(t);G||(G=!0,queueMicrotask(tn))}function to(t){ta({type:"object.created",objectId:t._id,object:t})}function th(t,e,i,s){let r=z(e);Object.is(i,s)||p(tr(t),r)&&ta({type:"field.changed",objectId:t._id,field:r,value:i,previousValue:s,object:t})}let tl=new Set,tu=null,tc=null,tp=(t.builtins??b)({runtime:()=>tc,fileSystem:t.fileSystem??null});function td(t){let e=y.get(t);if(!e)return void O.add(t);if(!e.active){for(let[t,i]of(e.active=!0,x.push(e.name),e.methods)){f.has(t)||f.set(t,new o);let e=f.get(t);for(let[t,s]of i)e.has(t)||e.set(t,[]),e.get(t).push(s)}for(let[t,i]of e.functions)g.has(t)||g.set(t,[]),g.get(t).push(i)}}function tm(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?F.get(t)??null:"number"==typeof t?N.get(t)??null:null}function tf(t,e,i){let s=tm(t);if(null==s)return 0;let r=tb(s[e]);return s[e]=r+i,th(s,e,s[e],r),r}function tg(t,e){let i=ts(t,e);return i&&i.length>0?i[i.length-1]:null}function ty(t,e,i,s){let r=ts(t,e);return r&&0!==r.length?{found:!0,result:te(ti(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function tx(t,e,i,s){let r;d((r=tr(i)).length?r:[t],e)&&ta({type:"method.called",className:z(t),methodName:z(e),objectId:i._id,args:[...s]});let n=D.get(t);if(n){let t=n.get(e);if(t)for(let e of t)e(i,...s)}}function tb(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function tv(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;te._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function tw(t){return null==t||""===t?null:tv(String(t))}function tM(t,e){function i(t,e){return t+e.join("_")}return{get:(e,...s)=>t.get(i(e,s))??"",set(s,...r){if(0===r.length)throw Error("set() requires at least a value argument");if(1===r.length){let i=t.get(s);return t.set(s,r[0]),e?.onSet?.(s,r[0],i),r[0]}let n=r[r.length-1],a=i(s,r.slice(0,-1)),o=t.get(a);return t.set(a,n),e?.onSet?.(a,n,o),n},postInc(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a+1;return t.set(n,o),e?.onSet?.(n,o,a),a},postDec(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a-1;return t.set(n,o),e?.onSet?.(n,o,a),a}}}function tS(){return tM(new o)}let tA={registerMethod:function(t,e,i){if(tu)tu.methods.has(t)||tu.methods.set(t,new o),tu.methods.get(t).set(e,i);else{f.has(t)||f.set(t,new o);let s=f.get(t);s.has(e)||s.set(e,[]),s.get(e).push(i)}},registerFunction:function(t,e){tu?tu.functions.set(t,e):(g.has(t)||g.set(t,[]),g.get(t).push(e))},package:function(t,e){let i=y.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},y.set(t,i));let s=tu;tu=i,e(),tu=s,O.has(t)&&(O.delete(t),td(t))},activatePackage:td,deactivatePackage:function(t){let e=y.get(t);if(!e||!e.active)return;e.active=!1;let i=x.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,s]of(-1!==i&&x.splice(i,1),e.methods)){let e=f.get(t);if(e)for(let[t,i]of s){let s=e.get(t);if(s){let t=s.indexOf(i);-1!==t&&s.splice(t,1)}}}for(let[t,i]of e.functions){let e=g.get(t);if(e){let t=e.indexOf(i);-1!==t&&e.splice(t,1)}}},create:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(L);)L+=1;let t=L;return L+=1,t}(),a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[z(t)]=e;a.superclass&&(a._superClass=z(String(a.superclass)),a.class&&j.set(z(String(a.class)),a._superClass)),N.set(n,a);let o=B(e);if(o&&(a._name=o,F.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=tg(t,"onAdd");return h&&h(a),to(a),a},datablock:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(P);)P+=1;let t=P;return P+=1,t}(),a={_class:r,_className:t,_id:n,_isDatablock:!0},o=B(i);if(o){let t=$.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[z(t)]=e;N.set(n,a);let h=B(e);return h&&(a._name=h,F.set(h,a),$.set(h,a)),to(a),a},deleteObject:function t(e){var i;let s;if(null==e||("number"==typeof e?s=N.get(e):"string"==typeof e?s=F.get(e):"object"==typeof e&&e._id&&(s=e),!s))return!1;let r=tg(s._className,"onRemove");if(r&&r(s),N.delete(s._id),s._name&&F.delete(s._name),s._isDatablock&&s._name&&$.delete(s._name),s._parent&&s._parent._children){let t=s._parent._children.indexOf(s);-1!==t&&s._parent._children.splice(t,1)}if(s._children)for(let e of[...s._children])t(e);return ta({type:"object.deleted",objectId:(i=s)._id,object:i}),!0},prop:function(t,e){let i=tm(t);return null==i?"":i[z(e)]??""},setProp:function(t,e,i){let s=tm(t);if(null==s)return i;let r=z(e),n=s[r];return s[r]=i,th(s,r,i,n),i},getIndex:function(t,e){let i=tm(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=tm(t);if(null==s)return i;let r=String(e),n=s[r];return s[r]=i,th(s,r,i,n),i},propPostInc:function(t,e){return tf(t,z(e),1)},propPostDec:function(t,e){return tf(t,z(e),-1)},indexPostInc:function(t,e){return tf(t,String(e),1)},indexPostDec:function(t,e){return tf(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=tw(t)))return"";let s=t.class||t._className||t._class;if(s){let r=ty(s,e,t,i);if(r.found)return tx(s,e,t,i),r.result}let r=t._superClass||j.get(s);for(;r;){let s=ty(r,e,t,i);if(s.found)return tx(r,e,t,i),s.result;r=j.get(r)}return""},nsCall:function(t,e,...i){let s=ts(t,e);if(!s||0===s.length)return"";let r=ti(t,e),n=s[s.length-1],a=te(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&tx(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=ts(t,e);if(!i||0===i.length)return null;let s=ti(t,e),r=i[i.length-1];return(...t)=>te(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=ts(t,e),n=ti(t,e),a=tt(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=te(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&tx(t,e,i,s),h}let o=j.get(t);for(;o;){let t=ts(o,e);if(t&&t.length>0){let r=te(ti(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&tx(o,e,i,s),r}o=j.get(o)}return""},parentFunc:function(t,...e){let i=g.get(t);if(!i)return"";let s=t.toLowerCase(),r=tt(s);if(void 0===r||r<1)return"";let n=r-1;return te(s,n,()=>i[n](...e))},add:function(t,e){return tb(t)+tb(e)},sub:function(t,e){return tb(t)-tb(e)},mul:function(t,e){return tb(t)*tb(e)},div:function(t,e){return tb(t)/tb(e)},neg:function(t){return-tb(t)},lt:function(t,e){return tb(t)tb(e)},ge:function(t,e){return tb(t)>=tb(e)},eq:function(t,e){return tb(t)===tb(e)},ne:function(t,e){return tb(t)!==tb(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return k(t)&k(e)},bitor:function(t,e){return k(t)|k(e)},bitxor:function(t,e){return k(t)^k(e)},shl:function(t,e){return k(k(t)<<(31&k(e)))},shr:function(t,e){return k(t)>>>(31&k(e))},bitnot:function(t){return~k(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&z(t)===i)return void s();e.default&&e.default()},deref:tw,nameToId:function(t){let e=tv(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?N.has(t):"string"==typeof t&&F.has(t)))},isFunction:function(t){return g.has(t)||t.toLowerCase()in tp},isPackage:function(t){return y.has(t)},isActivePackage:function(t){let e=y.get(t);return e?.active??!1},getPackageList:function(){return x.join(" ")},locals:tS,onMethodCalled(t,e,i){let s=D.get(t);s||(s=new o,D.set(t,s));let r=s.get(e);return r||(r=[],s.set(e,r)),r.push(i),()=>{let t=r.indexOf(i);-1!==t&&r.splice(t,1)}}},t_={call(t,...e){let i=g.get(t);if(i&&i.length>0)return te(t.toLowerCase(),i.length-1,()=>i[i.length-1](...e));let s=tp[t.toLowerCase()];return s?s(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tC=tM(V,{onSet:function(t,e,i){let s=z(t.startsWith("$")?t.slice(1):t);Object.is(e,i)||m(s)&&ta({type:"global.changed",name:s,value:e,previousValue:i})}}),tT={methods:f,functions:g,packages:y,activePackages:x,objectsById:N,objectsByName:F,datablocks:$,globals:V,executedScripts:H,failedScripts:J,scripts:Y,generatedCode:Q,pendingTimeouts:tl,startTime:Date.now()};function tI(t){let e=function(t){let e=Q.get(t);null==e&&(e=new n(void 0).generate(t),Q.set(t,e));return e}(t),i=tS();Function("$","$f","$g","$l",e)(tA,t_,tC,i)}function tz(t,e){return{execute(){if(e){let t=l(e);tT.executedScripts.add(t)}tI(t)}}}async function tk(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(tT.scripts.has(n)||tT.failedScripts.has(n))return;if(X&&X(n)){console.warn(`Ignoring script: ${e}`),tT.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),tT.failedScripts.add(n),t.progress?.completeItem();return}try{a=E(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),tT.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tk(a.execScriptPaths,i,h),tT.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tB(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(tT.scripts.has(s))return tz(tT.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await tR(r,{path:e});return t.progress?.completeItem(),n}async function tR(t,e){if(e?.path){let t=l(e.path);if(tT.scripts.has(t))return tz(tT.scripts.get(t),e.path)}return tO(E(t,{filename:e?.path}),e)}async function tO(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);tT.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tk(n,s,r),tz(e,i?.path)}return tc={$:tA,$f:t_,$g:tC,state:tT,destroy:function(){for(let t of(W.length>0&&tn(),tT.pendingTimeouts))clearTimeout(t);tT.pendingTimeouts.clear(),U.clear()},executeAST:tI,loadFromPath:tB,loadFromSource:tR,loadFromAST:tO,call:(t,...e)=>t_.call(t,...e),getObjectByName:t=>F.get(t),subscribeRuntimeEvents:t=>(U.add(t),()=>{U.delete(t)})}}function O(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function E(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function P(t){if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if("string"==typeof t){let e=t.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e}return!!t}function L(){let t=Error("Operation aborted");return t.name="AbortError",t}function N(t){let e,{missionName:i,missionType:s,runtimeOptions:r,onMissionLoadDone:n}=t,{signal:a,fileSystem:o,globals:h={},preloadScripts:l=[],reactiveGlobalNames:u}=r??{},c=o?.findFiles("scripts/*Game.cs")??[],p=u?Array.from(new Set([...u,"missionRunning"])):void 0,d=R({...r,reactiveGlobalNames:p,globals:{...h,"$Host::Map":i,"$Host::MissionType":s},preloadScripts:[...l,...c]});(e=d.$.registerMethod.bind(d.$))("ShapeBase","playThread",(t,e,i)=>{t._threads||(t._threads={}),t._threads[Number(e)]={sequence:String(i),playing:!0,direction:!0}}),e("ShapeBase","stopThread",(t,e)=>{t._threads&&delete t._threads[Number(e)]}),e("ShapeBase","setThreadDir",(t,e,i)=>{t._threads||(t._threads={});let s=Number(e);t._threads[s]?t._threads[s].direction=!!Number(i):t._threads[s]={sequence:"",playing:!1,direction:!!Number(i)}}),e("ShapeBase","pauseThread",(t,e)=>{t._threads?.[Number(e)]&&(t._threads[Number(e)].playing=!1)}),e("ShapeBase","playAudio",()=>{}),e("ShapeBase","stopAudio",()=>{}),e("SimObject","getDatablock",t=>{let e=t.datablock;return e?d.getObjectByName(String(e))??"":""}),e("SimObject","getGroup",t=>t._parent??""),e("SimObject","getName",t=>t._name??""),e("SimObject","getType",()=>16384),e("SimGroup","getCount",t=>t._children?t._children.length:0),e("SimGroup","getObject",(t,e)=>{let i=t._children;return i?i[Number(e)]??"":""}),e("GameBase","isEnabled",()=>!0),e("GameBase","isDisabled",()=>!1),e("GameBase","setPoweredState",()=>{}),e("GameBase","setRechargeRate",()=>{}),e("GameBase","getRechargeRate",()=>0),e("GameBase","setEnergyLevel",()=>{}),e("GameBase","getEnergyLevel",()=>0),e("ShapeBase","getDamageLevel",()=>0),e("ShapeBase","setDamageLevel",()=>{}),e("ShapeBase","getRepairRate",()=>0),e("ShapeBase","setRepairRate",()=>{}),e("ShapeBase","getDamagePercent",()=>0),e("GameBase","getControllingClient",()=>0),e("SimObject","schedule",(t,e,i,...s)=>{let r=setTimeout(()=>{d.state.pendingTimeouts.delete(r);try{d.$.call(t,String(i),...s)}catch(e){console.error(`schedule: error calling ${i} on ${t._id}:`,e)}},Number(e)||0);return d.state.pendingTimeouts.add(r),r});let m=async function(){try{let t=await d.loadFromPath("scripts/server.cs");a?.throwIfAborted(),await d.loadFromPath(`missions/${i}.mis`),a?.throwIfAborted(),t.execute();let e=function(t,e){let{signal:i,onMissionLoadDone:s}=e;return new Promise((e,r)=>{let n=!1,a=!1,o=()=>P(t.$g.get("missionRunning")),h=()=>{n||(n=!0,d(),e())},l=t=>{n||(n=!0,d(),r(t))},u=e=>{if(!s||a)return;let i=e??t.getObjectByName("Game");i&&(a=!0,s(i))},c=()=>l(L()),p=t.subscribeRuntimeEvents(t=>{if("global.changed"===t.type&&"missionrunning"===t.name){P(t.value)&&(u(),h());return}"batch.flushed"===t.type&&o()&&(u(),h())});function d(){p(),i?.removeEventListener("abort",c)}if(i){if(i.aborted)return void l(L());i.addEventListener("abort",c,{once:!0})}o()&&(u(),h())})}(d,{signal:a,onMissionLoadDone:n}),s=await d.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");a?.throwIfAborted(),s.execute(),await e}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:d,ready:m}}t.s(["createProgressTracker",()=>O],38433);let F=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,$=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,V=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,D={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function j(t){let e=E(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match($))?{type:"sectionBegin",name:e[1]}:(e=t.match(V))?{type:"sectionEnd",name:e[1]}:(e=t.match(F))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>D[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function U(t,e){if(t)return t[e.toLowerCase()]}function W(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function G(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function q(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function H(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function J(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>W,"getInt",()=>G,"getPosition",()=>q,"getProperty",()=>U,"getRotation",()=>J,"getScale",()=>H,"parseMissionScript",()=>j],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("�","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/44bbdd420cb3ec27.js b/docs/_next/static/chunks/44bbdd420cb3ec27.js new file mode 100644 index 00000000..5c125a6c --- /dev/null +++ b/docs/_next/static/chunks/44bbdd420cb3ec27.js @@ -0,0 +1,362 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55838,(e,n,t)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!a(e,t)}catch(e){return!0}}var c="u"{"use strict";n.exports=e.r(55838)},52822,(e,n,t)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,n,t,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var n=f.value;if(a(n,e))return l=n}return l=e}if(n=l,i(o,e))return n;var t=r(e);return void 0!==a&&a(n,t)?(o=e,n):(o=e,l=t)}var o,l,s=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]},[n,t,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,n,t)=>{"use strict";n.exports=e.r(52822)},66936,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S=!1,E="function"==typeof setTimeout?setTimeout:null,T="function"==typeof clearTimeout?clearTimeout:null,M="u">typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function x(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,R||(R=!0,l());else{var n=a(f);null!==n&&U(x,n.startTime-e)}}var R=!1,C=-1,y=5,A=-1;function P(){return!!S||!(t.unstable_now()-Ae&&P());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&U(x,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():R=!1}}}if("function"==typeof M)l=function(){M(w)};else if("u">typeof MessageChannel){var L=new MessageChannel,N=L.port2;L.port1.onmessage=w,l=function(){N.postMessage(null)}}else l=function(){E(w,0)};function U(e,n){C=E(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(T(C),C=-1):v=!0,U(x,i-o))):(e.sortIndex=s,r(d,e),_||g||(_=!0,R||(R=!0,l()))),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},89499,(e,n,t)=>{"use strict";n.exports=e.r(66936)},40859,8560,8155,66748,46791,e=>{"use strict";let n,t,r,a,i,o,l,s,u;var c,d,f,p,m,h,g=e.i(47167),_=e.i(71645),v=e.i(90072),S=v;function E(){let e=null,n=!1,t=null,r=null;function a(n,i){t(n,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===n||null!==t&&(r=e.requestAnimationFrame(a),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(e){t=e},setContext:function(n){e=n}}}function T(e){let n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){let e=n.get(t);(!e||e.versiontypeof Float16Array&&a instanceof Float16Array)r=e.HALF_FLOAT;else if(a instanceof Uint16Array)r=n.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=e.SHORT;else if(a instanceof Uint32Array)r=e.UNSIGNED_INT;else if(a instanceof Int32Array)r=e.INT;else if(a instanceof Int8Array)r=e.BYTE;else if(a instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:l,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:n.version,size:o}}(t,r));else if(a.versione.start-n.start);let n=0;for(let e=1;e 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},b={common:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new S.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new S.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new S.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new S.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new S.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new S.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new S.Matrix3},normalScale:{value:new S.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new S.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new S.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new S.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new S.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new S.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0},uvTransform:{value:new S.Matrix3}},sprite:{diffuse:{value:new S.Color(0xffffff)},opacity:{value:1},center:{value:new S.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new S.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new S.Matrix3},alphaTest:{value:0}}},x={basic:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.fog]),vertexShader:M.meshbasic_vert,fragmentShader:M.meshbasic_frag},lambert:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.fog,b.lights,{emissive:{value:new S.Color(0)}}]),vertexShader:M.meshlambert_vert,fragmentShader:M.meshlambert_frag},phong:{uniforms:(0,S.mergeUniforms)([b.common,b.specularmap,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.fog,b.lights,{emissive:{value:new S.Color(0)},specular:{value:new S.Color(1118481)},shininess:{value:30}}]),vertexShader:M.meshphong_vert,fragmentShader:M.meshphong_frag},standard:{uniforms:(0,S.mergeUniforms)([b.common,b.envmap,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.roughnessmap,b.metalnessmap,b.fog,b.lights,{emissive:{value:new S.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag},toon:{uniforms:(0,S.mergeUniforms)([b.common,b.aomap,b.lightmap,b.emissivemap,b.bumpmap,b.normalmap,b.displacementmap,b.gradientmap,b.fog,b.lights,{emissive:{value:new S.Color(0)}}]),vertexShader:M.meshtoon_vert,fragmentShader:M.meshtoon_frag},matcap:{uniforms:(0,S.mergeUniforms)([b.common,b.bumpmap,b.normalmap,b.displacementmap,b.fog,{matcap:{value:null}}]),vertexShader:M.meshmatcap_vert,fragmentShader:M.meshmatcap_frag},points:{uniforms:(0,S.mergeUniforms)([b.points,b.fog]),vertexShader:M.points_vert,fragmentShader:M.points_frag},dashed:{uniforms:(0,S.mergeUniforms)([b.common,b.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:M.linedashed_vert,fragmentShader:M.linedashed_frag},depth:{uniforms:(0,S.mergeUniforms)([b.common,b.displacementmap]),vertexShader:M.depth_vert,fragmentShader:M.depth_frag},normal:{uniforms:(0,S.mergeUniforms)([b.common,b.bumpmap,b.normalmap,b.displacementmap,{opacity:{value:1}}]),vertexShader:M.meshnormal_vert,fragmentShader:M.meshnormal_frag},sprite:{uniforms:(0,S.mergeUniforms)([b.sprite,b.fog]),vertexShader:M.sprite_vert,fragmentShader:M.sprite_frag},background:{uniforms:{uvTransform:{value:new S.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:M.background_vert,fragmentShader:M.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new S.Matrix3}},vertexShader:M.backgroundCube_vert,fragmentShader:M.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:M.cube_vert,fragmentShader:M.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:M.equirect_vert,fragmentShader:M.equirect_frag},distance:{uniforms:(0,S.mergeUniforms)([b.common,b.displacementmap,{referencePosition:{value:new S.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:M.distance_vert,fragmentShader:M.distance_frag},shadow:{uniforms:(0,S.mergeUniforms)([b.lights,b.fog,{color:{value:new S.Color(0)},opacity:{value:1}}]),vertexShader:M.shadow_vert,fragmentShader:M.shadow_frag}};x.physical={uniforms:(0,S.mergeUniforms)([x.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new S.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new S.Matrix3},clearcoatNormalScale:{value:new S.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new S.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new S.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new S.Matrix3},sheen:{value:0},sheenColor:{value:new S.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new S.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new S.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new S.Matrix3},transmissionSamplerSize:{value:new S.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new S.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new S.Color(0)},specularColor:{value:new S.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new S.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new S.Matrix3},anisotropyVector:{value:new S.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new S.Matrix3}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag};let R={r:0,b:0,g:0},C=new S.Euler,y=new S.Matrix4;function A(e,n,t,r,a,i,o){let l,s,u=new S.Color(0),c=+(!0!==i),d=null,f=0,p=null;function m(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?t:n).get(r)),r}function h(n,t){n.getRGB(R,(0,S.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(R.r,R.g,R.b,t,o)}return{getClearColor:function(){return u},setClearColor:function(e,n=1){u.set(e),h(u,c=n)},getClearAlpha:function(){return c},setClearAlpha:function(e){h(u,c=e)},render:function(n){let t=!1,a=m(n);null===a?h(u,c):a&&a.isColor&&(h(a,1),t=!0);let i=e.xr.getEnvironmentBlendMode();"additive"===i?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===i&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||t)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,t){let r=m(t);r&&(r.isCubeTexture||r.mapping===S.CubeUVReflectionMapping)?(void 0===s&&((s=new S.Mesh(new S.BoxGeometry(1,1,1),new S.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,S.cloneUniforms)(x.backgroundCube.uniforms),vertexShader:x.backgroundCube.vertexShader,fragmentShader:x.backgroundCube.fragmentShader,side:S.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,n,t){this.matrixWorld.copyPosition(t.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(s)),C.copy(t.backgroundRotation),C.x*=-1,C.y*=-1,C.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(C.y*=-1,C.z*=-1),s.material.uniforms.envMap.value=r,s.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,s.material.uniforms.backgroundBlurriness.value=t.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(y.makeRotationFromEuler(C)),s.material.toneMapped=S.ColorManagement.getTransfer(r.colorSpace)!==S.SRGBTransfer,(d!==r||f!==r.version||p!==e.toneMapping)&&(s.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new S.Mesh(new S.PlaneGeometry(2,2),new S.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,S.cloneUniforms)(x.background.uniforms),vertexShader:x.background.vertexShader,fragmentShader:x.background.fragmentShader,side:S.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,l.material.toneMapped=S.ColorManagement.getTransfer(r.colorSpace)!==S.SRGBTransfer,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function P(e,n){let t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(n){return e.bindVertexArray(n)}function s(n){return e.deleteVertexArray(n)}function u(e){let n=[],r=[],a=[];for(let e=0;e=0){let t=a[n],r=o[n];if(void 0===r&&("instanceMatrix"===n&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(r=e.instanceColor)),void 0===t||t.attribute!==r||r&&t.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(t,h,s,g))&&function(e,n,t,r){let a={},o=n.attributes,l=0,s=t.getAttributes();for(let n in s)if(s[n].location>=0){let t=o[n];void 0===t&&("instanceMatrix"===n&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(t=e.instanceColor));let r={};r.attribute=t,t&&t.data&&(r.data=t.data),a[n]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(t,h,s,g),null!==g&&n.update(g,e.ELEMENT_ARRAY_BUFFER),(x||o)&&(o=!1,function(t,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&t.instanceMatrix&&(l=t.instanceMatrix),"instanceColor"===r&&t.instanceColor&&(l=t.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=n.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===S.IntType;if(l.isInterleavedBufferAttribute){let n=l.data,s=n.stride,g=l.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";n="mediump"}return"mediump"===n&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==t.precision?t.precision:"highp",l=i(o);return l!==o&&((0,S.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(n){return n===S.RGBAFormat||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(t){let a=t===S.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return t===S.UnsignedByteType||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||t===S.FloatType||!!a},precision:o,logarithmicDepthBuffer:!0===t.logarithmicDepthBuffer,reversedDepthBuffer:!0===t.reversedDepthBuffer&&n.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function N(e){let n=this,t=null,r=0,a=!1,i=!1,o=new S.Plane,l=new S.Matrix3,s={value:null,needsUpdate:!1};function u(e,t,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let n=r+4*i,a=t.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length0),n.numPlanes=r,n.numIntersection=0)}}function U(e){let n=new WeakMap;function t(e,n){return n===S.EquirectangularReflectionMapping?e.mapping=S.CubeReflectionMapping:n===S.EquirectangularRefractionMapping&&(e.mapping=S.CubeRefractionMapping),e}function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping;if(i===S.EquirectangularReflectionMapping||i===S.EquirectangularRefractionMapping)if(n.has(a))return t(n.get(a).texture,a.mapping);else{let i=a.image;if(!i||!(i.height>0))return null;{let o=new S.WebGLCubeRenderTarget(i.height);return o.fromEquirectangularTexture(e,a),n.set(a,o),a.addEventListener("dispose",r),t(o.texture,a.mapping)}}}return a},dispose:function(){n=new WeakMap}}}let D=[.125,.215,.35,.446,.526,.582],I=new S.OrthographicCamera,F=new S.Color,O=null,B=0,G=0,H=!1,k=new S.Vector3;class V{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,t=.1,r=100,a={}){let{size:i=256,position:o=k}=a;O=this._renderer.getRenderTarget(),B=this._renderer.getActiveCubeFace(),G=this._renderer.getActiveMipmapLevel(),H=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,t,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=j(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=X(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=D[o-e+4-1]:0===o&&(l=0),t.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let n=e%3*2/3-1,t=e>2?0:-1,r=[n,t,0,n+2/3,t,0,n+2/3,t+1,0,n,t,0,n+2/3,t+1,0,n,t+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new S.BufferGeometry;h.setAttribute("position",new S.BufferAttribute(f,3)),h.setAttribute("uv",new S.BufferAttribute(p,2)),h.setAttribute("faceIndex",new S.BufferAttribute(m,1)),r.push(new S.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:n,sigmas:t}}(d)),this._blurMaterial=(a=d,i=e,o=n,r=new Float32Array(20),c=new S.Vector3(0,1,0),new S.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=d,s=e,u=n,new S.ShaderMaterial({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/s,CUBEUV_TEXEL_HEIGHT:1/u,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:q(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 3.2: Transform view direction to hemisphere configuration + vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); + + // Section 4.1: Orthonormal basis + float lensq = Vh.x * Vh.x + Vh.y * Vh.y; + vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(Vh, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + Vh.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:S.NoBlending,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let n=new S.Mesh(new S.BufferGeometry,e);this._renderer.compile(n,I)}_sceneToCubeUV(e,n,t,r,a){let i=new S.PerspectiveCamera(90,1,n,t),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,c=s.toneMapping;s.getClearColor(F),s.toneMapping=S.NoToneMapping,s.autoClear=!1,s.state.buffers.depth.getReversed()&&(s.setRenderTarget(r),s.clearDepth(),s.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new S.Mesh(new S.BoxGeometry,new S.MeshBasicMaterial({name:"PMREM.Background",side:S.BackSide,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(F),p=!0);for(let n=0;n<6;n++){let t=n%3;0===t?(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x+l[n],a.y,a.z)):1===t?(i.up.set(0,0,o[n]),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y+l[n],a.z)):(i.up.set(0,o[n],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y,a.z+l[n]));let u=this._cubeSize;W(r,t*u,n>2?u:0,u,u),s.setRenderTarget(r),p&&s.render(d,i),s.render(e,i)}s.toneMapping=c,s.autoClear=u,e.background=m}_textureToCubeUV(e,n){let t=this._renderer,r=e.mapping===S.CubeReflectionMapping||e.mapping===S.CubeRefractionMapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=j()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=X());let a=r?this._cubemapMaterial:this._equirectMaterial,i=this._lodMeshes[0];i.material=a,a.uniforms.envMap.value=e;let o=this._cubeSize;W(n,0,0,3*o,2*o),t.setRenderTarget(n),t.render(i,I)}_applyPMREM(e){let n=this._renderer,t=n.autoClear;n.autoClear=!1;let r=this._lodMeshes.length;for(let n=1;nd-4?t-d+4:0),m=4*(this._cubeSize-f);l.envMap.value=e.texture,l.roughness.value=c*(0+1.25*s),l.mipInt.value=d-n,W(a,p,m,3*f,2*f),r.setRenderTarget(a),r.render(o,I),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=d-t,W(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,I)}_blur(e,n,t,r,a){let i=this._pingPongRenderTarget;this._halfBlur(e,i,n,t,r,"latitudinal",a),this._halfBlur(i,e,t,t,r,"longitudinal",a)}_halfBlur(e,n,t,r,a,i,o){let l=this._renderer,s=this._blurMaterial;"latitudinal"!==i&&"longitudinal"!==i&&(0,S.error)("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[r];u.material=s;let c=s.uniforms,d=this._sizeLods[t]-1,f=isFinite(a)?Math.PI/(2*d):2*Math.PI/39,p=a/f,m=isFinite(a)?1+Math.floor(3*p):20;m>20&&(0,S.warn)(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);let h=[],g=0;for(let e=0;e<20;++e){let n=e/p,t=Math.exp(-n*n/2);h.push(t),0===e?g+=t:e_-4?r-_+4:0),E,3*v,2*v),l.setRenderTarget(n),l.render(u,I)}}function z(e,n,t){let r=new S.WebGLRenderTarget(e,n,t);return r.texture.mapping=S.CubeUVReflectionMapping,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function W(e,n,t,r,a){e.viewport.set(n,t,r,a),e.scissor.set(n,t,r,a)}function X(){return new S.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})}function j(){return new S.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:q(),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:S.NoBlending,depthTest:!1,depthWrite:!1})}function q(){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 Y(e){let n=new WeakMap,t=null;function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping,o=i===S.EquirectangularReflectionMapping||i===S.EquirectangularRefractionMapping,l=i===S.CubeReflectionMapping||i===S.CubeRefractionMapping;if(o||l){let i=n.get(a),s=void 0!==i?i.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==s)return null===t&&(t=new V(e)),(i=o?t.fromEquirectangular(a,i):t.fromCubemap(a,i)).texture.pmremVersion=a.pmremVersion,n.set(a,i),i.texture;{if(void 0!==i)return i.texture;let s=a.image;return o&&s&&s.height>0||l&&s&&function(e){let n=0;for(let t=0;t<6;t++)void 0!==e[t]&&n++;return 6===n}(s)?(null===t&&(t=new V(e)),(i=o?t.fromEquirectangular(a):t.fromCubemap(a)).texture.pmremVersion=a.pmremVersion,n.set(a,i),a.addEventListener("dispose",r),i.texture):null}}}return a},dispose:function(){n=new WeakMap,null!==t&&(t.dispose(),t=null)}}}function K(e){let n={};function t(t){if(void 0!==n[t])return n[t];let r=e.getExtension(t);return n[t]=r,r}return{has:function(e){return null!==t(e)},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(e){let n=t(e);return null===n&&(0,S.warnOnce)("WebGLRenderer: "+e+" extension not supported."),n}}}function $(e,n,t,r){let a={},i=new WeakMap;function o(e){let l=e.target;for(let e in null!==l.index&&n.remove(l.index),l.attributes)n.remove(l.attributes[e]);l.removeEventListener("dispose",o),delete a[l.id];let s=i.get(l);s&&(n.remove(s),i.delete(l)),r.releaseStatesOfGeometry(l),!0===l.isInstancedBufferGeometry&&delete l._maxInstanceCount,t.memory.geometries--}function l(e){let t=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){let e=r.array;o=r.version;for(let n=0,r=e.length;nn.maxTextureSize&&(m=Math.ceil(p/n.maxTextureSize),p=n.maxTextureSize);let h=new Float32Array(p*m*4*c),g=new S.DataArrayTexture(h,p,m,c);g.type=S.FloatType,g.needsUpdate=!0;let _=4*f;for(let n=0;n + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),c=new S.Mesh(s,u),d=new S.OrthographicCamera(-1,1,1,-1,0,1),f=null,p=null,m=!1,h=null,g=[],_=!1;this.setSize=function(e,n){o.setSize(e,n),l.setSize(e,n);for(let t=0;t0&&!0===g[0].isRenderPass;let n=o.width,t=o.height;for(let e=0;e0)return e;let a=n*t,i=es[a];if(void 0===i&&(i=new Float32Array(a),es[a]=i),0!==n){r.toArray(i,0);for(let r=1,a=0;r!==n;++r)a+=t,e[r].toArray(i,a)}return i}function em(e,n){if(e.length!==n.length)return!1;for(let t=0,r=e.length;t0&&(this.seq=r.concat(a))}setValue(e,n,t,r){let a=this.map[n];void 0!==a&&a.setValue(e,t,r)}setOptional(e,n,t){let r=n[t];void 0!==r&&this.setValue(e,t,r)}static upload(e,n,t,r){for(let a=0,i=n.length;a!==i;++a){let i=n[a],o=t[i.id];!1!==o.needsUpdate&&i.setValue(e,o.value,r)}}static seqWithValue(e,n){let t=[];for(let r=0,a=e.length;r!==a;++r){let a=e[r];a.id in n&&t.push(a)}return t}}function e8(e,n,t){let r=e.createShader(n);return e.shaderSource(r,t),e.compileShader(r),r}let e9=0,e7=new S.Matrix3;function ne(e,n,t){let r=e.getShaderParameter(n,e.COMPILE_STATUS),a=(e.getShaderInfoLog(n)||"").trim();if(r&&""===a)return"";let i=/ERROR: 0:(\d+)/.exec(a);if(!i)return a;{let r=parseInt(i[1]);return t.toUpperCase()+"\n\n"+a+"\n\n"+function(e,n){let t=e.split("\n"),r=[],a=Math.max(n-6,0),i=Math.min(n+6,t.length);for(let e=a;e":" "} ${a}: ${t[e]}`)}return r.join("\n")}(e.getShaderSource(n),r)}}let nn={[S.LinearToneMapping]:"Linear",[S.ReinhardToneMapping]:"Reinhard",[S.CineonToneMapping]:"Cineon",[S.ACESFilmicToneMapping]:"ACESFilmic",[S.AgXToneMapping]:"AgX",[S.NeutralToneMapping]:"Neutral",[S.CustomToneMapping]:"Custom"},nt=new S.Vector3;function nr(e){return""!==e}function na(e,n){let t=n.numSpotLightShadows+n.numSpotLightMaps-n.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,n.numDirLights).replace(/NUM_SPOT_LIGHTS/g,n.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,n.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,n.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,n.numPointLights).replace(/NUM_HEMI_LIGHTS/g,n.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,n.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,n.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,n.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,n.numPointLightShadows)}function ni(e,n){return e.replace(/NUM_CLIPPING_PLANES/g,n.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,n.numClippingPlanes-n.numClipIntersection)}let no=/^[ \t]*#include +<([\w\d./]+)>/gm;function nl(e){return e.replace(no,nu)}let ns=new Map;function nu(e,n){let t=M[n];if(void 0===t){let e=ns.get(n);if(void 0!==e)t=M[e],(0,S.warn)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',n,e);else throw Error("Can not resolve #include <"+n+">")}return nl(t)}let nc=/#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 nd(e){return e.replace(nc,nf)}function nf(e,n,t,r){let a="";for(let e=parseInt(n);e0&&(o+="\n"),(l=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T].filter(nr).join("\n")).length>0&&(l+="\n");else{let e,n,r,s,u;o=[np(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+g:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&!1===t.flatShading?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+m:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(nr).join("\n"),l=[np(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,T,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+g:"",t.envMap?"#define "+_:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&!1===t.flatShading?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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 "+m:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==S.NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==S.NoToneMapping?M.tonemapping_pars_fragment:"",t.toneMapping!==S.NoToneMapping?(a="toneMapping",void 0===(e=nn[i=t.toneMapping])?((0,S.warn)("WebGLProgram: Unsupported toneMapping:",i),"vec3 "+a+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+a+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",M.colorspace_pars_fragment,(n=function(e){S.ColorManagement._getMatrix(e7,S.ColorManagement.workingColorSpace,e);let n=`mat3( ${e7.elements.map(e=>e.toFixed(4))} )`;switch(S.ColorManagement.getTransfer(e)){case S.LinearTransfer:return[n,"LinearTransferOETF"];case S.SRGBTransfer:return[n,"sRGBTransferOETF"];default:return(0,S.warn)("WebGLProgram: Unsupported color space: ",e),[n,"LinearTransferOETF"]}}(t.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { + return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) ); +}`),(S.ColorManagement.getLuminanceCoefficients(nt),r=nt.x.toFixed(4),s=nt.y.toFixed(4),u=nt.z.toFixed(4),`float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( ${r}, ${s}, ${u} ); + return dot( weights, rgb ); +}`),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"","\n"].filter(nr).join("\n")}f=ni(f=na(f=nl(f),t),t),p=ni(p=na(p=nl(p),t),t),f=nd(f),p=nd(p),!0!==t.isRawShaderMaterial&&(x="#version 300 es\n",o=[E,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+o,l=["#define varying in",t.glslVersion===S.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===S.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+l);let R=x+o+f,C=x+l+p,y=e8(c,c.VERTEX_SHADER,R),A=e8(c,c.FRAGMENT_SHADER,C);function P(n){if(e.debug.checkShaderErrors){let t=c.getProgramInfoLog(b)||"",r=c.getShaderInfoLog(y)||"",a=c.getShaderInfoLog(A)||"",i=t.trim(),s=r.trim(),u=a.trim(),d=!0,f=!0;if(!1===c.getProgramParameter(b,c.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,y,A);else{let e=ne(c,y,"vertex"),t=ne(c,A,"fragment");(0,S.error)("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+n.name+"\nMaterial Type: "+n.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+t)}else""!==i?(0,S.warn)("WebGLProgram: Program Info Log:",i):(""===s||""===u)&&(f=!1);f&&(n.diagnostics={runnable:d,programLog:i,vertexShader:{log:s,prefix:o},fragmentShader:{log:u,prefix:l}})}c.deleteShader(y),c.deleteShader(A),s=new e6(c,b),u=function(e,n){let t={},r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let a=0;a0,Y=i.clearcoat>0,K=i.dispersion>0,$=i.iridescence>0,Q=i.sheen>0,Z=i.transmission>0,J=q&&!!i.anisotropyMap,ee=Y&&!!i.clearcoatMap,en=Y&&!!i.clearcoatNormalMap,et=Y&&!!i.clearcoatRoughnessMap,er=$&&!!i.iridescenceMap,ea=$&&!!i.iridescenceThicknessMap,ei=Q&&!!i.sheenColorMap,eo=Q&&!!i.sheenRoughnessMap,el=!!i.specularMap,es=!!i.specularColorMap,eu=!!i.specularIntensityMap,ec=Z&&!!i.transmissionMap,ed=Z&&!!i.thicknessMap,ef=!!i.gradientMap,ep=!!i.alphaMap,em=i.alphaTest>0,eh=!!i.alphaHash,eg=!!i.extensions,e_=S.NoToneMapping;i.toneMapped&&(null===N||!0===N.isXRRenderTarget)&&(e_=e.toneMapping);let ev={shaderID:A,shaderType:i.type,shaderName:i.name,vertexShader:_,fragmentShader:v,defines:i.defines,customVertexShaderID:E,customFragmentShaderID:T,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:p,batching:I,batchingColor:I&&null!==g._colorsTexture,instancing:D,instancingColor:D&&null!==g.instanceColor,instancingMorph:D&&null!==g.morphTexture,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:S.LinearSRGBColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:F,matcap:O,envMap:B,envMapMode:B&&C.mapping,envMapCubeUVHeight:y,aoMap:G,lightMap:H,bumpMap:k,normalMap:V,displacementMap:z,emissiveMap:W,normalMapObjectSpace:V&&i.normalMapType===S.ObjectSpaceNormalMap,normalMapTangentSpace:V&&i.normalMapType===S.TangentSpaceNormalMap,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:J,clearcoat:Y,clearcoatMap:ee,clearcoatNormalMap:en,clearcoatRoughnessMap:et,dispersion:K,iridescence:$,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:Q,sheenColorMap:ei,sheenRoughnessMap:eo,specularMap:el,specularColorMap:es,specularIntensityMap:eu,transmission:Z,transmissionMap:ec,thicknessMap:ed,gradientMap:ef,opaque:!1===i.transparent&&i.blending===S.NormalBlending&&!1===i.alphaToCoverage,alphaMap:ep,alphaTest:em,alphaHash:eh,combine:i.combine,mapUv:F&&h(i.map.channel),aoMapUv:G&&h(i.aoMap.channel),lightMapUv:H&&h(i.lightMap.channel),bumpMapUv:k&&h(i.bumpMap.channel),normalMapUv:V&&h(i.normalMap.channel),displacementMapUv:z&&h(i.displacementMap.channel),emissiveMapUv:W&&h(i.emissiveMap.channel),metalnessMapUv:X&&h(i.metalnessMap.channel),roughnessMapUv:j&&h(i.roughnessMap.channel),anisotropyMapUv:J&&h(i.anisotropyMap.channel),clearcoatMapUv:ee&&h(i.clearcoatMap.channel),clearcoatNormalMapUv:en&&h(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&h(i.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&h(i.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&h(i.iridescenceThicknessMap.channel),sheenColorMapUv:ei&&h(i.sheenColorMap.channel),sheenRoughnessMapUv:eo&&h(i.sheenRoughnessMap.channel),specularMapUv:el&&h(i.specularMap.channel),specularColorMapUv:es&&h(i.specularColorMap.channel),specularIntensityMapUv:eu&&h(i.specularIntensityMap.channel),transmissionMapUv:ec&&h(i.transmissionMap.channel),thicknessMapUv:ed&&h(i.thicknessMap.channel),alphaMapUv:ep&&h(i.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(V||q),vertexColors:i.vertexColors,vertexAlphas:!0===i.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!b.attributes.uv&&(F||ep),fog:!!M,useFog:!0===i.fog,fogExp2:!!M&&M.isFogExp2,flatShading:!0===i.flatShading&&!1===i.wireframe,sizeAttenuation:!0===i.sizeAttenuation,logarithmicDepthBuffer:f,reversedDepthBuffer:U,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:w,morphTextureStride:L,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,numLightProbes:l.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:e_,decodeVideoTexture:F&&!0===i.map.isVideoTexture&&S.ColorManagement.getTransfer(i.map.colorSpace)===S.SRGBTransfer,decodeVideoTextureEmissive:W&&!0===i.emissiveMap.isVideoTexture&&S.ColorManagement.getTransfer(i.emissiveMap.colorSpace)===S.SRGBTransfer,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===S.DoubleSide,flipSided:i.side===S.BackSide,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:eg&&!0===i.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eg&&!0===i.extensions.multiDraw||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:i.customProgramCacheKey()};return ev.vertexUv1s=u.has(1),ev.vertexUv2s=u.has(2),ev.vertexUv3s=u.has(3),u.clear(),ev},getProgramCacheKey:function(n){var t,r,a,i;let o=[];if(n.shaderID?o.push(n.shaderID):(o.push(n.customVertexShaderID),o.push(n.customFragmentShaderID)),void 0!==n.defines)for(let e in n.defines)o.push(e),o.push(n.defines[e]);return!1===n.isRawShaderMaterial&&(t=o,r=n,t.push(r.precision),t.push(r.outputColorSpace),t.push(r.envMapMode),t.push(r.envMapCubeUVHeight),t.push(r.mapUv),t.push(r.alphaMapUv),t.push(r.lightMapUv),t.push(r.aoMapUv),t.push(r.bumpMapUv),t.push(r.normalMapUv),t.push(r.displacementMapUv),t.push(r.emissiveMapUv),t.push(r.metalnessMapUv),t.push(r.roughnessMapUv),t.push(r.anisotropyMapUv),t.push(r.clearcoatMapUv),t.push(r.clearcoatNormalMapUv),t.push(r.clearcoatRoughnessMapUv),t.push(r.iridescenceMapUv),t.push(r.iridescenceThicknessMapUv),t.push(r.sheenColorMapUv),t.push(r.sheenRoughnessMapUv),t.push(r.specularMapUv),t.push(r.specularColorMapUv),t.push(r.specularIntensityMapUv),t.push(r.transmissionMapUv),t.push(r.thicknessMapUv),t.push(r.combine),t.push(r.fogExp2),t.push(r.sizeAttenuation),t.push(r.morphTargetsCount),t.push(r.morphAttributeCount),t.push(r.numDirLights),t.push(r.numPointLights),t.push(r.numSpotLights),t.push(r.numSpotLightMaps),t.push(r.numHemiLights),t.push(r.numRectAreaLights),t.push(r.numDirLightShadows),t.push(r.numPointLightShadows),t.push(r.numSpotLightShadows),t.push(r.numSpotLightShadowsWithMaps),t.push(r.numLightProbes),t.push(r.shadowMapType),t.push(r.toneMapping),t.push(r.numClippingPlanes),t.push(r.numClipIntersection),t.push(r.depthPacking),a=o,i=n,l.disableAll(),i.instancing&&l.enable(0),i.instancingColor&&l.enable(1),i.instancingMorph&&l.enable(2),i.matcap&&l.enable(3),i.envMap&&l.enable(4),i.normalMapObjectSpace&&l.enable(5),i.normalMapTangentSpace&&l.enable(6),i.clearcoat&&l.enable(7),i.iridescence&&l.enable(8),i.alphaTest&&l.enable(9),i.vertexColors&&l.enable(10),i.vertexAlphas&&l.enable(11),i.vertexUv1s&&l.enable(12),i.vertexUv2s&&l.enable(13),i.vertexUv3s&&l.enable(14),i.vertexTangents&&l.enable(15),i.anisotropy&&l.enable(16),i.alphaHash&&l.enable(17),i.batching&&l.enable(18),i.dispersion&&l.enable(19),i.batchingColor&&l.enable(20),i.gradientMap&&l.enable(21),a.push(l.mask),l.disableAll(),i.fog&&l.enable(0),i.useFog&&l.enable(1),i.flatShading&&l.enable(2),i.logarithmicDepthBuffer&&l.enable(3),i.reversedDepthBuffer&&l.enable(4),i.skinning&&l.enable(5),i.morphTargets&&l.enable(6),i.morphNormals&&l.enable(7),i.morphColors&&l.enable(8),i.premultipliedAlpha&&l.enable(9),i.shadowMapEnabled&&l.enable(10),i.doubleSided&&l.enable(11),i.flipSided&&l.enable(12),i.useDepthPacking&&l.enable(13),i.dithering&&l.enable(14),i.transmission&&l.enable(15),i.sheen&&l.enable(16),i.opaque&&l.enable(17),i.pointsUvs&&l.enable(18),i.decodeVideoTexture&&l.enable(19),i.decodeVideoTextureEmissive&&l.enable(20),i.alphaToCoverage&&l.enable(21),a.push(l.mask),o.push(e.outputColorSpace)),o.push(n.customProgramCacheKey),o.join()},getUniforms:function(e){let n,t=m[e.type];if(t){let e=x[t];n=S.UniformsUtils.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(n,t){let r=d.get(t);return void 0!==r?++r.usedTimes:(r=new nv(e,t,n,i),c.push(r),d.set(t,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let n=c.indexOf(e);c[n]=c[c.length-1],c.pop(),d.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){s.remove(e)},programs:c,dispose:function(){s.dispose()}}}function nb(){let e=new WeakMap;return{has:function(n){return e.has(n)},get:function(n){let t=e.get(n);return void 0===t&&(t={},e.set(n,t)),t},remove:function(n){e.delete(n)},update:function(n,t,r){e.get(n)[t]=r},dispose:function(){e=new WeakMap}}}function nx(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.material.id!==n.material.id?e.material.id-n.material.id:e.z!==n.z?e.z-n.z:e.id-n.id}function nR(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.z!==n.z?n.z-e.z:e.id-n.id}function nC(){let e=[],n=0,t=[],r=[],a=[];function i(t,r,a,i,o,l){let s=e[n];return void 0===s?(s={id:t.id,object:t,geometry:r,material:a,groupOrder:i,renderOrder:t.renderOrder,z:o,group:l},e[n]=s):(s.id=t.id,s.object=t,s.geometry=r,s.material=a,s.groupOrder=i,s.renderOrder=t.renderOrder,s.z=o,s.group=l),n++,s}return{opaque:t,transmissive:r,transparent:a,init:function(){n=0,t.length=0,r.length=0,a.length=0},push:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.push(c):!0===o.transparent?a.push(c):t.push(c)},unshift:function(e,n,o,l,s,u){let c=i(e,n,o,l,s,u);o.transmission>0?r.unshift(c):!0===o.transparent?a.unshift(c):t.unshift(c)},finish:function(){for(let t=n,r=e.length;t1&&t.sort(e||nx),r.length>1&&r.sort(n||nR),a.length>1&&a.sort(n||nR)}}}function ny(){let e=new WeakMap;return{get:function(n,t){let r,a=e.get(n);return void 0===a?(r=new nC,e.set(n,[r])):t>=a.length?(r=new nC,a.push(r)):r=a[t],r},dispose:function(){e=new WeakMap}}}function nA(){let e={};return{get:function(n){let t;if(void 0!==e[n.id])return e[n.id];switch(n.type){case"DirectionalLight":t={direction:new S.Vector3,color:new S.Color};break;case"SpotLight":t={position:new S.Vector3,direction:new S.Vector3,color:new S.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new S.Vector3,color:new S.Color,distance:0,decay:0};break;case"HemisphereLight":t={direction:new S.Vector3,skyColor:new S.Color,groundColor:new S.Color};break;case"RectAreaLight":t={color:new S.Color,position:new S.Vector3,halfWidth:new S.Vector3,halfHeight:new S.Vector3}}return e[n.id]=t,t}}}let nP=0;function nw(e,n){return 2*!!n.castShadow-2*!!e.castShadow+ +!!n.map-!!e.map}function nL(e){let n,t=new nA,r=(n={},{get:function(e){let t;if(void 0!==n[e.id])return n[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new S.Vector2};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new S.Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)a.probe.push(new S.Vector3);let i=new S.Vector3,o=new S.Matrix4,l=new S.Matrix4;return{setup:function(n){let i=0,o=0,l=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let s=0,u=0,c=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;n.sort(nw);for(let e=0,E=n.length;e0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=b.LTC_FLOAT_1,a.rectAreaLTC2=b.LTC_FLOAT_2):(a.rectAreaLTC1=b.LTC_HALF_1,a.rectAreaLTC2=b.LTC_HALF_2)),a.ambient[0]=i,a.ambient[1]=o,a.ambient[2]=l;let E=a.hash;(E.directionalLength!==s||E.pointLength!==u||E.spotLength!==c||E.rectAreaLength!==d||E.hemiLength!==f||E.numDirectionalShadows!==p||E.numPointShadows!==m||E.numSpotShadows!==h||E.numSpotMaps!==g||E.numLightProbes!==v)&&(a.directional.length=s,a.spot.length=c,a.rectArea.length=d,a.point.length=u,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+g-_,a.spotLightMap.length=g,a.numSpotLightShadowsWithMaps=_,a.numLightProbes=v,E.directionalLength=s,E.pointLength=u,E.spotLength=c,E.rectAreaLength=d,E.hemiLength=f,E.numDirectionalShadows=p,E.numPointShadows=m,E.numSpotShadows=h,E.numSpotMaps=g,E.numLightProbes=v,a.version=nP++)},setupView:function(e,n){let t=0,r=0,s=0,u=0,c=0,d=n.matrixWorldInverse;for(let n=0,f=e.length;n=i.length?(a=new nN(e),i.push(a)):a=i[r],a},dispose:function(){n=new WeakMap}}}let nD=[new S.Vector3(1,0,0),new S.Vector3(-1,0,0),new S.Vector3(0,1,0),new S.Vector3(0,-1,0),new S.Vector3(0,0,1),new S.Vector3(0,0,-1)],nI=[new S.Vector3(0,-1,0),new S.Vector3(0,-1,0),new S.Vector3(0,0,1),new S.Vector3(0,0,-1),new S.Vector3(0,-1,0),new S.Vector3(0,-1,0)],nF=new S.Matrix4,nO=new S.Vector3,nB=new S.Vector3;function nG(e,n,t){let r=new S.Frustum,a=new S.Vector2,i=new S.Vector2,o=new S.Vector4,l=new S.MeshDepthMaterial,s=new S.MeshDistanceMaterial,u={},c=t.maxTextureSize,d={[S.FrontSide]:S.BackSide,[S.BackSide]:S.FrontSide,[S.DoubleSide]:S.DoubleSide},f=new S.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new S.Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new S.BufferGeometry;m.setAttribute("position",new S.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new S.Mesh(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=S.PCFShadowMap;let _=this.type;function v(n,t,r,a){let i=null,o=!0===r.isPointLight?n.customDistanceMaterial:n.customDepthMaterial;if(void 0!==o)i=o;else if(i=!0===r.isPointLight?s:l,e.localClippingEnabled&&!0===t.clipShadows&&Array.isArray(t.clippingPlanes)&&0!==t.clippingPlanes.length||t.displacementMap&&0!==t.displacementScale||t.alphaMap&&t.alphaTest>0||t.map&&t.alphaTest>0||!0===t.alphaToCoverage){let e=i.uuid,n=t.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let a=r[n];void 0===a&&(a=i.clone(),r[n]=a,t.addEventListener("dispose",E)),i=a}return i.visible=t.visible,i.wireframe=t.wireframe,a===S.VSMShadowMap?i.side=null!==t.shadowSide?t.shadowSide:t.side:i.side=null!==t.shadowSide?t.shadowSide:d[t.side],i.alphaMap=t.alphaMap,i.alphaTest=!0===t.alphaToCoverage?.5:t.alphaTest,i.map=t.map,i.clipShadows=t.clipShadows,i.clippingPlanes=t.clippingPlanes,i.clipIntersection=t.clipIntersection,i.displacementMap=t.displacementMap,i.displacementScale=t.displacementScale,i.displacementBias=t.displacementBias,i.wireframeLinewidth=t.wireframeLinewidth,i.linewidth=t.linewidth,!0===r.isPointLight&&!0===i.isMeshDistanceMaterial&&(e.properties.get(i).light=r),i}function E(e){for(let n in e.target.removeEventListener("dispose",E),u){let t=u[n],r=e.target.uuid;r in t&&(t[r].dispose(),delete t[r])}}this.render=function(t,l,s){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===t.length)return;t.type===S.PCFSoftShadowMap&&((0,S.warn)("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),t.type=S.PCFShadowMap);let u=e.getRenderTarget(),d=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),E=e.state;E.setBlending(S.NoBlending),!0===E.buffers.depth.getReversed()?E.buffers.color.setClear(0,0,0,0):E.buffers.color.setClear(1,1,1,1),E.buffers.depth.setTest(!0),E.setScissorTest(!1);let T=_!==this.type;T&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,d=t.length;uc||a.y>c)&&(a.x>c&&(i.x=Math.floor(c/g.x),a.x=i.x*g.x,m.mapSize.x=i.x),a.y>c&&(i.y=Math.floor(c/g.y),a.y=i.y*g.y,m.mapSize.y=i.y)),null===m.map||!0===T){if(null!==m.map&&(null!==m.map.depthTexture&&(m.map.depthTexture.dispose(),m.map.depthTexture=null),m.map.dispose()),this.type===S.VSMShadowMap){if(d.isPointLight){(0,S.warn)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new S.WebGLRenderTarget(a.x,a.y,{format:S.RGFormat,type:S.HalfFloatType,minFilter:S.LinearFilter,magFilter:S.LinearFilter,generateMipmaps:!1}),m.map.texture.name=d.name+".shadowMap",m.map.depthTexture=new S.DepthTexture(a.x,a.y,S.FloatType),m.map.depthTexture.name=d.name+".shadowMapDepth",m.map.depthTexture.format=S.DepthFormat,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=S.NearestFilter,m.map.depthTexture.magFilter=S.NearestFilter}else{d.isPointLight?(m.map=new S.WebGLCubeRenderTarget(a.x),m.map.depthTexture=new S.CubeDepthTexture(a.x,S.UnsignedIntType)):(m.map=new S.WebGLRenderTarget(a.x,a.y),m.map.depthTexture=new S.DepthTexture(a.x,a.y,S.UnsignedIntType)),m.map.depthTexture.name=d.name+".shadowMap",m.map.depthTexture.format=S.DepthFormat;let n=e.state.buffers.depth.getReversed();this.type===S.PCFShadowMap?(m.map.depthTexture.compareFunction=n?S.GreaterEqualCompare:S.LessEqualCompare,m.map.depthTexture.minFilter=S.LinearFilter,m.map.depthTexture.magFilter=S.LinearFilter):(m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=S.NearestFilter,m.map.depthTexture.magFilter=S.NearestFilter)}m.camera.updateProjectionMatrix()}let _=m.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<_;t++){if(m.map.isWebGLCubeRenderTarget)e.setRenderTarget(m.map,t),e.clear();else{0===t&&(e.setRenderTarget(m.map),e.clear());let n=m.getViewport(t);o.set(i.x*n.x,i.y*n.y,i.x*n.z,i.y*n.w),E.viewport(o)}if(d.isPointLight){let e=m.camera,n=m.matrix,r=d.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),nO.setFromMatrixPosition(d.matrixWorld),e.position.copy(nO),nB.copy(e.position),nB.add(nD[t]),e.up.copy(nI[t]),e.lookAt(nB),e.updateMatrixWorld(),n.makeTranslation(-nO.x,-nO.y,-nO.z),nF.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),m._frustum.setFromProjectionMatrix(nF,e.coordinateSystem,e.reversedDepth)}else m.updateMatrices(d);r=m.getFrustum(),function t(a,i,o,l,s){if(!1===a.visible)return;if(a.layers.test(i.layers)&&(a.isMesh||a.isLine||a.isPoints)&&(a.castShadow||a.receiveShadow&&s===S.VSMShadowMap)&&(!a.frustumCulled||r.intersectsObject(a))){a.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,a.matrixWorld);let t=n.update(a),r=a.material;if(Array.isArray(r)){let n=t.groups;for(let u=0,c=n.length;u=1:-1!==L.indexOf("OpenGL ES")&&(w=parseFloat(/^OpenGL ES (\d)/.exec(L)[1])>=2);let N=null,U={},D=e.getParameter(e.SCISSOR_BOX),I=e.getParameter(e.VIEWPORT),F=new S.Vector4().fromArray(D),O=new S.Vector4().fromArray(I);function B(n,t,r,a){let i=new Uint8Array(4),o=e.createTexture();e.bindTexture(n,o),e.texParameteri(n,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(n,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;otypeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new S.Vector2,d=new WeakMap,f=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,n){return p?new OffscreenCanvas(e,n):(0,S.createElementNS)("canvas")}function h(e,n,t){let r=1,a=z(e);if((a.width>t||a.height>t)&&(r=t/Math.max(a.width,a.height)),r<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let t=Math.floor(r*a.width),i=Math.floor(r*a.height);void 0===l&&(l=m(t,i));let o=n?m(t,i):l;return o.width=t,o.height=i,o.getContext("2d").drawImage(e,0,0,t,i),(0,S.warn)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+t+"x"+i+")."),o}else"data"in e&&(0,S.warn)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function g(e){return e.generateMipmaps}function _(n){e.generateMipmap(n)}function v(t,r,a,i,o=!1){if(null!==t){if(void 0!==e[t])return e[t];(0,S.warn)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+t+"'")}let l=r;if(r===e.RED&&(a===e.FLOAT&&(l=e.R32F),a===e.HALF_FLOAT&&(l=e.R16F),a===e.UNSIGNED_BYTE&&(l=e.R8)),r===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.R8UI),a===e.UNSIGNED_SHORT&&(l=e.R16UI),a===e.UNSIGNED_INT&&(l=e.R32UI),a===e.BYTE&&(l=e.R8I),a===e.SHORT&&(l=e.R16I),a===e.INT&&(l=e.R32I)),r===e.RG&&(a===e.FLOAT&&(l=e.RG32F),a===e.HALF_FLOAT&&(l=e.RG16F),a===e.UNSIGNED_BYTE&&(l=e.RG8)),r===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RG8UI),a===e.UNSIGNED_SHORT&&(l=e.RG16UI),a===e.UNSIGNED_INT&&(l=e.RG32UI),a===e.BYTE&&(l=e.RG8I),a===e.SHORT&&(l=e.RG16I),a===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGB8UI),a===e.UNSIGNED_SHORT&&(l=e.RGB16UI),a===e.UNSIGNED_INT&&(l=e.RGB32UI),a===e.BYTE&&(l=e.RGB8I),a===e.SHORT&&(l=e.RGB16I),a===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),a===e.UNSIGNED_INT&&(l=e.RGBA32UI),a===e.BYTE&&(l=e.RGBA8I),a===e.SHORT&&(l=e.RGBA16I),a===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(a===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let n=o?S.LinearTransfer:S.ColorManagement.getTransfer(i);a===e.FLOAT&&(l=e.RGBA32F),a===e.HALF_FLOAT&&(l=e.RGBA16F),a===e.UNSIGNED_BYTE&&(l=n===S.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&n.get("EXT_color_buffer_float"),l}function E(n,t){let r;return n?null===t||t===S.UnsignedIntType||t===S.UnsignedInt248Type?r=e.DEPTH24_STENCIL8:t===S.FloatType?r=e.DEPTH32F_STENCIL8:t===S.UnsignedShortType&&(r=e.DEPTH24_STENCIL8,(0,S.warn)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===t||t===S.UnsignedIntType||t===S.UnsignedInt248Type?r=e.DEPTH_COMPONENT24:t===S.FloatType?r=e.DEPTH_COMPONENT32F:t===S.UnsignedShortType&&(r=e.DEPTH_COMPONENT16),r}function T(e,n){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==S.NearestFilter&&e.minFilter!==S.LinearFilter?Math.log2(Math.max(n.width,n.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?n.mipmaps.length:1}function M(e){let n=e.target;n.removeEventListener("dispose",M),function(e){let n=r.get(e);if(void 0===n.__webglInit)return;let t=e.source,a=f.get(t);if(a){let r=a[n.__cacheKey];r.usedTimes--,0===r.usedTimes&&x(e),0===Object.keys(a).length&&f.delete(t)}r.remove(e)}(n),n.isVideoTexture&&d.delete(n)}function b(n){let t=n.target;t.removeEventListener("dispose",b),function(n){let t=r.get(n);if(n.depthTexture&&(n.depthTexture.dispose(),r.remove(n.depthTexture)),n.isWebGLCubeRenderTarget)for(let n=0;n<6;n++){if(Array.isArray(t.__webglFramebuffer[n]))for(let r=0;r0&&s.__version!==n.version){let e=n.image;if(null===e)(0,S.warn)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void U(s,n,a);(0,S.warn)("WebGLRenderer: Texture marked for update but image is incomplete")}}else n.isExternalTexture&&(s.__webglTexture=n.sourceTexture?n.sourceTexture:null);t.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+a)}let y={[S.RepeatWrapping]:e.REPEAT,[S.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[S.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},A={[S.NearestFilter]:e.NEAREST,[S.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[S.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[S.LinearFilter]:e.LINEAR,[S.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[S.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},P={[S.NeverCompare]:e.NEVER,[S.AlwaysCompare]:e.ALWAYS,[S.LessCompare]:e.LESS,[S.LessEqualCompare]:e.LEQUAL,[S.EqualCompare]:e.EQUAL,[S.GreaterEqualCompare]:e.GEQUAL,[S.GreaterCompare]:e.GREATER,[S.NotEqualCompare]:e.NOTEQUAL};function w(t,i){if((i.type===S.FloatType&&!1===n.has("OES_texture_float_linear")&&(i.magFilter===S.LinearFilter||i.magFilter===S.LinearMipmapNearestFilter||i.magFilter===S.NearestMipmapLinearFilter||i.magFilter===S.LinearMipmapLinearFilter||i.minFilter===S.LinearFilter||i.minFilter===S.LinearMipmapNearestFilter||i.minFilter===S.NearestMipmapLinearFilter||i.minFilter===S.LinearMipmapLinearFilter)&&(0,S.warn)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(t,e.TEXTURE_WRAP_S,y[i.wrapS]),e.texParameteri(t,e.TEXTURE_WRAP_T,y[i.wrapT]),(t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY)&&e.texParameteri(t,e.TEXTURE_WRAP_R,y[i.wrapR]),e.texParameteri(t,e.TEXTURE_MAG_FILTER,A[i.magFilter]),e.texParameteri(t,e.TEXTURE_MIN_FILTER,A[i.minFilter]),i.compareFunction&&(e.texParameteri(t,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(t,e.TEXTURE_COMPARE_FUNC,P[i.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic"))&&i.magFilter!==S.NearestFilter&&(i.minFilter===S.NearestMipmapLinearFilter||i.minFilter===S.LinearMipmapLinearFilter)&&(i.type!==S.FloatType||!1!==n.has("OES_texture_float_linear"))&&(i.anisotropy>1||r.get(i).__currentAnisotropy)){let o=n.get("EXT_texture_filter_anisotropic");e.texParameterf(t,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}function L(n,t){let r,a=!1;void 0===n.__webglInit&&(n.__webglInit=!0,t.addEventListener("dispose",M));let i=t.source,l=f.get(i);void 0===l&&(l={},f.set(i,l));let s=((r=[]).push(t.wrapS),r.push(t.wrapT),r.push(t.wrapR||0),r.push(t.magFilter),r.push(t.minFilter),r.push(t.anisotropy),r.push(t.internalFormat),r.push(t.format),r.push(t.type),r.push(t.generateMipmaps),r.push(t.premultiplyAlpha),r.push(t.flipY),r.push(t.unpackAlignment),r.push(t.colorSpace),r.join());if(s!==n.__cacheKey){void 0===l[s]&&(l[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,a=!0),l[s].usedTimes++;let r=l[n.__cacheKey];void 0!==r&&(l[n.__cacheKey].usedTimes--,0===r.usedTimes&&x(t)),n.__cacheKey=s,n.__webglTexture=l[s].texture}return a}function N(e,n,t){return Math.floor(Math.floor(e/t)/n)}function U(n,o,l){let s=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(s=e.TEXTURE_3D);let u=L(n,o),c=o.source;t.bindTexture(s,n.__webglTexture,e.TEXTURE0+l);let d=r.get(c);if(c.version!==d.__version||!0===u){let n;t.activeTexture(e.TEXTURE0+l);let r=S.ColorManagement.getPrimaries(S.ColorManagement.workingColorSpace),f=o.colorSpace===S.NoColorSpace?null:S.ColorManagement.getPrimaries(o.colorSpace),p=o.colorSpace===S.NoColorSpace||r===f?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let m=h(o.image,!1,a.maxTextureSize);m=V(o,m);let M=i.convert(o.format,o.colorSpace),b=i.convert(o.type),x=v(o.internalFormat,M,b,o.colorSpace,o.isVideoTexture);w(s,o);let R=o.mipmaps,C=!0!==o.isVideoTexture,y=void 0===d.__version||!0===u,A=c.dataReady,P=T(o,m);if(o.isDepthTexture)x=E(o.format===S.DepthStencilFormat,o.type),y&&(C?t.texStorage2D(e.TEXTURE_2D,1,x,m.width,m.height):t.texImage2D(e.TEXTURE_2D,0,x,m.width,m.height,0,M,b,null));else if(o.isDataTexture)if(R.length>0){C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;re.start-n.start);let l=0;for(let e=1;e0){let a=(0,S.getByteLength)(n.width,n.height,o.format,o.type);for(let i of o.layerUpdates){let o=n.data.subarray(i*a/n.data.BYTES_PER_ELEMENT,(i+1)*a/n.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,i,n.width,n.height,1,M,o)}o.clearLayerUpdates()}else t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,M,n.data)}else t.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,n.data,0,0);else(0,S.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?A&&t.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,n.width,n.height,m.depth,M,b,n.data):t.texImage3D(e.TEXTURE_2D_ARRAY,r,x,n.width,n.height,m.depth,0,M,b,n.data)}else{C&&y&&t.texStorage2D(e.TEXTURE_2D,P,x,R[0].width,R[0].height);for(let r=0,a=R.length;r0){let n=(0,S.getByteLength)(m.width,m.height,o.format,o.type);for(let r of o.layerUpdates){let a=m.data.subarray(r*n/m.data.BYTES_PER_ELEMENT,(r+1)*n/m.data.BYTES_PER_ELEMENT);t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,m.width,m.height,1,M,b,a)}o.clearLayerUpdates()}else t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,M,b,m.data)}else t.texImage3D(e.TEXTURE_2D_ARRAY,0,x,m.width,m.height,m.depth,0,M,b,m.data);else if(o.isData3DTexture)C?(y&&t.texStorage3D(e.TEXTURE_3D,P,x,m.width,m.height,m.depth),A&&t.texSubImage3D(e.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,M,b,m.data)):t.texImage3D(e.TEXTURE_3D,0,x,m.width,m.height,m.depth,0,M,b,m.data);else if(o.isFramebufferTexture){if(y)if(C)t.texStorage2D(e.TEXTURE_2D,P,x,m.width,m.height);else{let n=m.width,r=m.height;for(let a=0;a>=1,r>>=1}}else if(R.length>0){if(C&&y){let n=z(R[0]);t.texStorage2D(e.TEXTURE_2D,P,x,n.width,n.height)}for(let r=0,a=R.length;r>c),r=Math.max(1,a.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?t.texImage3D(u,c,p,n,r,a.depth,0,d,f,null):t.texImage2D(u,c,p,n,r,0,d,f,null)}t.bindFramebuffer(e.FRAMEBUFFER,n),k(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,h.__webglTexture,0,H(a)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,h.__webglTexture,c),t.bindFramebuffer(e.FRAMEBUFFER,null)}function I(n,t,r){if(e.bindRenderbuffer(e.RENDERBUFFER,n),t.depthBuffer){let a=t.depthTexture,i=a&&a.isDepthTexture?a.type:null,o=E(t.stencilBuffer,i),l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;k(t)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,H(t),o,t.width,t.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,H(t),o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,n)}else{let n=t.textures;for(let a=0;a{delete a.__boundDepthTexture,delete a.__depthDisposeCallback,e.removeEventListener("dispose",n)};e.addEventListener("dispose",n),a.__depthDisposeCallback=n}a.__boundDepthTexture=e}if(n.depthTexture&&!a.__autoAllocateDepthBuffer)if(i)for(let e=0;e<6;e++)F(a.__webglFramebuffer[e],n,e);else{let e=n.texture.mipmaps;e&&e.length>0?F(a.__webglFramebuffer[0],n,0):F(a.__webglFramebuffer,n,0)}else if(i){a.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[r]),void 0===a.__webglDepthbuffer[r])a.__webglDepthbuffer[r]=e.createRenderbuffer(),I(a.__webglDepthbuffer[r],n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=a.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,i)}}else{let r=n.texture.mipmaps;if(r&&r.length>0?t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[0]):t.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),void 0===a.__webglDepthbuffer)a.__webglDepthbuffer=e.createRenderbuffer(),I(a.__webglDepthbuffer,n,!1);else{let t=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=a.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,r)}}t.bindFramebuffer(e.FRAMEBUFFER,null)}let B=[],G=[];function H(e){return Math.min(a.maxSamples,e.samples)}function k(e){let t=r.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function V(e,n){let t=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||t!==S.LinearSRGBColorSpace&&t!==S.NoColorSpace&&(S.ColorManagement.getTransfer(t)===S.SRGBTransfer?(r!==S.RGBAFormat||a!==S.UnsignedByteType)&&(0,S.warn)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,S.error)("WebGLTextures: Unsupported texture color space:",t)),n}function z(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=R;return e>=a.maxTextures&&(0,S.warn)("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),R+=1,e},this.resetTextureUnits=function(){R=0},this.setTexture2D=C,this.setTexture2DArray=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?U(i,n,a):(n.isExternalTexture&&(i.__webglTexture=n.sourceTexture?n.sourceTexture:null),t.bindTexture(e.TEXTURE_2D_ARRAY,i.__webglTexture,e.TEXTURE0+a))},this.setTexture3D=function(n,a){let i=r.get(n);!1===n.isRenderTargetTexture&&n.version>0&&i.__version!==n.version?U(i,n,a):t.bindTexture(e.TEXTURE_3D,i.__webglTexture,e.TEXTURE0+a)},this.setTextureCube=function(n,o){let l=r.get(n);!0!==n.isCubeDepthTexture&&n.version>0&&l.__version!==n.version?function(n,o,l){if(6!==o.image.length)return;let s=L(n,o),u=o.source;t.bindTexture(e.TEXTURE_CUBE_MAP,n.__webglTexture,e.TEXTURE0+l);let c=r.get(u);if(u.version!==c.__version||!0===s){let n;t.activeTexture(e.TEXTURE0+l);let r=S.ColorManagement.getPrimaries(S.ColorManagement.workingColorSpace),d=o.colorSpace===S.NoColorSpace?null:S.ColorManagement.getPrimaries(o.colorSpace),f=o.colorSpace===S.NoColorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=o.isCompressedTexture||o.image[0].isCompressedTexture,m=o.image[0]&&o.image[0].isDataTexture,E=[];for(let e=0;e<6;e++)p||m?E[e]=m?o.image[e].image:o.image[e]:E[e]=h(o.image[e],!0,a.maxCubemapSize),E[e]=V(o,E[e]);let M=E[0],b=i.convert(o.format,o.colorSpace),x=i.convert(o.type),R=v(o.internalFormat,b,x,o.colorSpace),C=!0!==o.isVideoTexture,y=void 0===c.__version||!0===s,A=u.dataReady,P=T(o,M);if(w(e.TEXTURE_CUBE_MAP,o),p){C&&y&&t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,M.width,M.height);for(let r=0;r<6;r++){n=E[r].mipmaps;for(let a=0;a0&&P++;let r=z(E[0]);t.texStorage2D(e.TEXTURE_CUBE_MAP,P,R,r.width,r.height)}for(let r=0;r<6;r++)if(m){C?A&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,E[r].width,E[r].height,b,x,E[r].data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,R,E[r].width,E[r].height,0,b,x,E[r].data);for(let a=0;a1;if(!d&&(void 0===s.__webglTexture&&(s.__webglTexture=e.createTexture()),s.__version=a.version,o.memory.textures++),c){l.__webglFramebuffer=[];for(let n=0;n<6;n++)if(a.mipmaps&&a.mipmaps.length>0){l.__webglFramebuffer[n]=[];for(let t=0;t0){l.__webglFramebuffer=[];for(let n=0;n0&&!1===k(n)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],t.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let t=0;t0)for(let r=0;r0)for(let t=0;t0){if(!1===k(n)){let a=n.textures,i=n.width,o=n.height,l=e.COLOR_BUFFER_BIT,s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(n),d=a.length>1;if(d)for(let n=0;n0?t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):t.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let t=0;t= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class nj{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let t=new S.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=t}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,t=new S.ShaderMaterial({vertexShader:nW,fragmentShader:nX,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new S.Mesh(new S.PlaneGeometry(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nq extends S.EventDispatcher{constructor(e,n){super();const t=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="u">typeof XRWebGLBinding,h=new nj,g={},_=n.getContextAttributes();let v=null,T=null;const M=[],b=[],x=new S.Vector2;let R=null;const C=new S.PerspectiveCamera;C.viewport=new S.Vector4;const y=new S.PerspectiveCamera;y.viewport=new S.Vector4;const A=[C,y],P=new S.ArrayCamera;let w=null,L=null;function N(e){let n=b.indexOf(e.inputSource);if(-1===n)return;let t=M[n];void 0!==t&&(t.update(e.inputSource,e.frame,s||i),t.dispatchEvent({type:e.type,data:e.inputSource}))}function U(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",D);for(let e=0;e=0&&(b[r]=null,M[r].disconnect(t))}for(let n=0;n=b.length){b.push(t),r=e;break}else if(null===b[e]){b[e]=t,r=e;break}if(-1===r)break}let a=M[r];a&&a.connect(t)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getGripSpace()},this.getHand=function(e){let n=M[e];return void 0===n&&(n=new S.WebXRController,M[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&(0,S.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&(0,S.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,n)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(v=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",U),r.addEventListener("inputsourceschange",D),!0!==_.xrCompatible&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(x),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,o=null;_.depth&&(o=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=_.stencil?S.DepthStencilFormat:S.DepthFormat,i=_.stencil?S.UnsignedInt248Type:S.UnsignedIntType);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new S.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:S.RGBAFormat,type:S.UnsignedByteType,depthTexture:new S.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:4*!!_.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let t={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,n,t),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),T=new S.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:S.RGBAFormat,type:S.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new S.Vector3,F=new S.Vector3;function O(e,n){null===n?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(n.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,t,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),P.near=y.near=C.near=i,P.far=y.far=C.far=o,(w!==P.near||L!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),w=P.near,L=P.far),P.layers.mask=6|e.layers.mask,C.layers.mask=3&P.layers.mask,y.layers.mask=5&P.layers.mask;let l=e.parent,s=P.cameras;O(P,l);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let a=n.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,nY.copy(o),nY.x*=-1,nY.y*=-1,nY.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(nY.y*=-1,nY.z*=-1),e.envMapRotation.value.setFromMatrix4(nK.makeRotationFromEuler(nY)),e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,t(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,t(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,t){t.color.getRGB(n.fogColor.value,(0,S.getUnlitUniformColorSpace)(e)),t.isFog?(n.fogNear.value=t.near,n.fogFar.value=t.far):t.isFogExp2&&(n.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,g,_,v,E,T,M,b,x,R,C,y,A,P,w,L;let N;a.isMeshBasicMaterial||a.isMeshLambertMaterial?r(e,a):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,g=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===S.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),_=e,(v=a).matcap&&(_.matcap.value=v.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),E=e,T=a,N=n.get(T).light,E.referencePosition.value.setFromMatrixPosition(N.matrixWorld),E.nearDistance.value=N.shadow.camera.near,E.farDistance.value=N.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(M=e,b=a,M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,b.map&&(M.map.value=b.map,t(b.map,M.mapTransform)),a.isLineDashedMaterial&&(x=e,R=a,x.dashSize.value=R.dashSize,x.totalSize.value=R.dashSize+R.gapSize,x.scale.value=R.scale)):a.isPointsMaterial?(C=e,y=a,A=i,P=o,C.diffuse.value.copy(y.color),C.opacity.value=y.opacity,C.size.value=y.size*A,C.scale.value=.5*P,y.map&&(C.map.value=y.map,t(y.map,C.uvTransform)),y.alphaMap&&(C.alphaMap.value=y.alphaMap,t(y.alphaMap,C.alphaMapTransform)),y.alphaTest>0&&(C.alphaTest.value=y.alphaTest)):a.isSpriteMaterial?(w=e,L=a,w.diffuse.value.copy(L.color),w.opacity.value=L.opacity,w.rotation.value=L.rotation,L.map&&(w.map.value=L.map,t(L.map,w.mapTransform)),L.alphaMap&&(w.alphaMap.value=L.alphaMap,t(L.alphaMap,w.alphaMapTransform)),L.alphaTest>0&&(w.alphaTest.value=L.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function nQ(e,n,t,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,S.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,S.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function u(n){let t=n.target;t.removeEventListener("dispose",u);let r=o.indexOf(t.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[t.id]),delete a[t.id],delete i[t.id]}return{bind:function(e,n){let t=n.program;r.uniformBlockBinding(e,t)},update:function(t,c){var d;let f,p,m,h,g=a[t.id];void 0===g&&(function(e){let n=e.uniforms,t=0;for(let e=0,r=n.length;e0&&(t+=16-r),e.__size=t,e.__cache={}}(t),(d=t).__bindingPointIndex=f=function(){for(let e=0;etypeof WebGLRenderingContext&&F instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");n=F.getContextAttributes().alpha}else n=G;const q=new Set([S.RGBAIntegerFormat,S.RGIntegerFormat,S.RedIntegerFormat]),en=new Set([S.UnsignedByteType,S.UnsignedIntType,S.UnsignedShortType,S.UnsignedInt248Type,S.UnsignedShort4444Type,S.UnsignedShort5551Type]),er=new Uint32Array(4),ea=new Int32Array(4);let ei=null,eo=null;const el=[],es=[];let eu=null;this.domElement=I,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=S.NoToneMapping,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const ec=this;let ed=!1;this._outputColorSpace=S.SRGBColorSpace;let ef=0,ep=0,em=null,eh=-1,eg=null;const e_=new S.Vector4,ev=new S.Vector4;let eS=null;const eE=new S.Color(0);let eT=0,eM=I.width,eb=I.height,ex=1,eR=null,eC=null;const ey=new S.Vector4(0,0,eM,eb),eA=new S.Vector4(0,0,eM,eb);let eP=!1;const ew=new S.Frustum;let eL=!1,eN=!1;const eU=new S.Matrix4,eD=new S.Vector3,eI=new S.Vector4,eF={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eO=!1;function eB(){return null===em?ex:1}let eG=F;function eH(e,n){return I.getContext(e,n)}try{if("setAttribute"in I&&I.setAttribute("data-engine",`three.js r${S.REVISION}`),I.addEventListener("webglcontextlost",ez,!1),I.addEventListener("webglcontextrestored",eW,!1),I.addEventListener("webglcontextcreationerror",eX,!1),null===eG){const e="webgl2";if(eG=eH(e,{alpha:!0,depth:O,stencil:B,antialias:H,premultipliedAlpha:k,preserveDrawingBuffer:V,powerPreference:z,failIfMajorPerformanceCaveat:W}),null===eG)if(eH(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw(0,S.error)("WebGLRenderer: "+e.message),e}function ek(){(t=new K(eG)).init(),C=new nz(eG,t),r=new L(eG,t,e,C),a=new nk(eG,t),r.reversedDepthBuffer&&X&&a.buffers.depth.setReversed(!0),i=new Z(eG),o=new nb,l=new nV(eG,t,a,o,r,C,i),s=new U(ec),u=new Y(ec),c=new T(eG),y=new P(eG,c),d=new $(eG,c,i,y),f=new ee(eG,d,c,i),b=new J(eG,r,l),_=new N(o),p=new nM(ec,s,u,t,r,y,_),m=new n$(ec,o),h=new ny,g=new nU(t),M=new A(ec,s,u,a,f,n,k),v=new nG(ec,f,r),D=new nQ(eG,i,r,a),x=new w(eG,t,i),R=new Q(eG,t,i),i.programs=p.programs,ec.capabilities=r,ec.extensions=t,ec.properties=o,ec.renderLists=h,ec.shadowMap=v,ec.state=a,ec.info=i}ek(),j!==S.UnsignedByteType&&(eu=new et(j,I.width,I.height,O,B));const eV=new nq(ec,eG);function ez(e){e.preventDefault(),(0,S.log)("WebGLRenderer: Context Lost."),ed=!0}function eW(){(0,S.log)("WebGLRenderer: Context Restored."),ed=!1;let e=i.autoReset,n=v.enabled,t=v.autoUpdate,r=v.needsUpdate,a=v.type;ek(),i.autoReset=e,v.enabled=n,v.autoUpdate=t,v.needsUpdate=r,v.type=a}function eX(e){(0,S.error)("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ej(e){var n,t;let r,a=e.target;a.removeEventListener("dispose",ej),t=n=a,void 0!==(r=o.get(t).programs)&&(r.forEach(function(e){p.releaseProgram(e)}),t.isShaderMaterial&&p.releaseShaderCache(t)),o.remove(n)}function eq(e,n,t){!0===e.transparent&&e.side===S.DoubleSide&&!1===e.forceSinglePass?(e.side=S.BackSide,e.needsUpdate=!0,e2(e,n,t),e.side=S.FrontSide,e.needsUpdate=!0,e2(e,n,t),e.side=S.DoubleSide):e2(e,n,t)}this.xr=eV,this.getContext=function(){return eG},this.getContextAttributes=function(){return eG.getContextAttributes()},this.forceContextLoss=function(){let e=t.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=t.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ex},this.setPixelRatio=function(e){void 0!==e&&(ex=e,this.setSize(eM,eb,!1))},this.getSize=function(e){return e.set(eM,eb)},this.setSize=function(e,n,t=!0){eV.isPresenting?(0,S.warn)("WebGLRenderer: Can't change size while VR device is presenting."):(eM=e,eb=n,I.width=Math.floor(e*ex),I.height=Math.floor(n*ex),!0===t&&(I.style.width=e+"px",I.style.height=n+"px"),null!==eu&&eu.setSize(I.width,I.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(eM*ex,eb*ex).floor()},this.setDrawingBufferSize=function(e,n,t){eM=e,eb=n,ex=t,I.width=Math.floor(e*t),I.height=Math.floor(n*t),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(j===S.UnsignedByteType)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let n=0;np.matrixWorld.determinant(),E=function(e,n,t,i,c){var d,f;!0!==n.isScene&&(n=eF),l.resetTextureUnits();let p=n.fog,h=i.isMeshStandardMaterial?n.environment:null,g=null===em?ec.outputColorSpace:!0===em.isXRRenderTarget?em.texture.colorSpace:S.LinearSRGBColorSpace,v=(i.isMeshStandardMaterial?u:s).get(i.envMap||h),E=!0===i.vertexColors&&!!t.attributes.color&&4===t.attributes.color.itemSize,T=!!t.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),M=!!t.morphAttributes.position,x=!!t.morphAttributes.normal,R=!!t.morphAttributes.color,C=S.NoToneMapping;i.toneMapped&&(null===em||!0===em.isXRRenderTarget)&&(C=ec.toneMapping);let y=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,A=void 0!==y?y.length:0,P=o.get(i),w=eo.state.lights;if(!0===eL&&(!0===eN||e!==eg)){let n=e===eg&&i.id===eh;_.setState(i,e,n)}let L=!1;i.version===P.__version?P.needsLights&&P.lightsStateVersion!==w.state.version||P.outputColorSpace!==g||c.isBatchedMesh&&!1===P.batching?L=!0:c.isBatchedMesh||!0!==P.batching?c.isBatchedMesh&&!0===P.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===P.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===P.instancing?L=!0:c.isInstancedMesh||!0!==P.instancing?c.isSkinnedMesh&&!1===P.skinning?L=!0:c.isSkinnedMesh||!0!==P.skinning?c.isInstancedMesh&&!0===P.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===P.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===P.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===P.instancingMorph&&null!==c.morphTexture||P.envMap!==v||!0===i.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==_.numPlanes||P.numIntersection!==_.numIntersection)||P.vertexAlphas!==E||P.vertexTangents!==T||P.morphTargets!==M||P.morphNormals!==x||P.morphColors!==R||P.toneMapping!==C?L=!0:P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=i.version);let N=P.currentProgram;!0===L&&(N=e2(i,n,c));let U=!1,I=!1,F=!1,O=N.getUniforms(),B=P.uniforms;if(a.useProgram(N.program)&&(U=!0,I=!0,F=!0),i.id!==eh&&(eh=i.id,I=!0),U||eg!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eG,"projectionMatrix",e.projectionMatrix),O.setValue(eG,"viewMatrix",e.matrixWorldInverse);let n=O.map.cameraPosition;void 0!==n&&n.setValue(eG,eD.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eG,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&O.setValue(eG,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,I=!0,F=!0)}if(P.needsLights&&(w.state.directionalShadowMap.length>0&&O.setValue(eG,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&O.setValue(eG,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&O.setValue(eG,"pointShadowMap",w.state.pointShadowMap,l)),c.isSkinnedMesh){O.setOptional(eG,c,"bindMatrix"),O.setOptional(eG,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eG,"boneTexture",e.boneTexture,l))}c.isBatchedMesh&&(O.setOptional(eG,c,"batchingTexture"),O.setValue(eG,"batchingTexture",c._matricesTexture,l),O.setOptional(eG,c,"batchingIdTexture"),O.setValue(eG,"batchingIdTexture",c._indirectTexture,l),O.setOptional(eG,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eG,"batchingColorTexture",c._colorsTexture,l));let G=t.morphAttributes;if((void 0!==G.position||void 0!==G.normal||void 0!==G.color)&&b.update(c,t,N),(I||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,O.setValue(eG,"receiveShadow",c.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=v,B.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==n.environment&&(B.envMapIntensity.value=n.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===nJ&&((nJ=new S.DataTexture(nZ,16,16,S.RGFormat,S.HalfFloatType)).name="DFG_LUT",nJ.minFilter=S.LinearFilter,nJ.magFilter=S.LinearFilter,nJ.wrapS=S.ClampToEdgeWrapping,nJ.wrapT=S.ClampToEdgeWrapping,nJ.generateMipmaps=!1,nJ.needsUpdate=!0),nJ)),I&&(O.setValue(eG,"toneMappingExposure",ec.toneMappingExposure),P.needsLights&&(d=B,f=F,d.ambientLightColor.needsUpdate=f,d.lightProbe.needsUpdate=f,d.directionalLights.needsUpdate=f,d.directionalLightShadows.needsUpdate=f,d.pointLights.needsUpdate=f,d.pointLightShadows.needsUpdate=f,d.spotLights.needsUpdate=f,d.spotLightShadows.needsUpdate=f,d.rectAreaLights.needsUpdate=f,d.hemisphereLights.needsUpdate=f),p&&!0===i.fog&&m.refreshFogUniforms(B,p),m.refreshMaterialUniforms(B,i,ex,eb,eo.state.transmissionRenderTarget[e.id]),e6.upload(eG,e4(P),B,l)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e6.upload(eG,e4(P),B,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(eG,"center",c.center),O.setValue(eG,"modelViewMatrix",c.modelViewMatrix),O.setValue(eG,"normalMatrix",c.normalMatrix),O.setValue(eG,"modelMatrix",c.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){let e=i.uniformsGroups;for(let n=0,t=e.length;n{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?n(e):setTimeout(r,10)}null!==t.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eK(){eQ.stop()}function e$(){eQ.start()}const eQ=new E;function eZ(e,n,t,r){if(!1===e.visible)return;if(e.layers.test(n.layers)){if(e.isGroup)t=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)eo.pushLight(e),e.castShadow&&eo.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ew.intersectsSprite(e)){r&&eI.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eU);let n=f.update(e),a=e.material;a.visible&&ei.push(e,n,a,t,eI.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ew.intersectsObject(e))){let n=f.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eI.copy(e.boundingSphere.center)):(null===n.boundingSphere&&n.computeBoundingSphere(),eI.copy(n.boundingSphere.center)),eI.applyMatrix4(e.matrixWorld).applyMatrix4(eU)),Array.isArray(a)){let r=n.groups;for(let i=0,o=r.length;i0&&e1(i,n,t),o.length>0&&e1(o,n,t),l.length>0&&e1(l,n,t),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e0(e,n,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===eo.state.transmissionRenderTarget[i.id]){let e=t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float");eo.state.transmissionRenderTarget[i.id]=new S.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?S.HalfFloatType:S.UnsignedByteType,minFilter:S.LinearMipmapLinearFilter,samples:r.samples,stencilBuffer:B,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:S.ColorManagement.workingColorSpace})}let o=eo.state.transmissionRenderTarget[i.id],s=i.viewport||e_;o.setSize(s.z*ec.transmissionResolutionScale,s.w*ec.transmissionResolutionScale);let u=ec.getRenderTarget(),c=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(eE),(eT=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eO&&M.render(a);let f=ec.toneMapping;ec.toneMapping=S.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),eo.setupLightsView(i),!0===eL&&_.setGlobalState(ec.clippingPlanes,i),e1(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===t.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let t=0,r=n.length;ttypeof self&&eQ.setContext(self),this.setAnimationLoop=function(e){eY=e,eV.setAnimationLoop(e),null===e?eQ.stop():eQ.start()},eV.addEventListener("sessionstart",eK),eV.addEventListener("sessionend",e$),this.render=function(e,n){if(void 0!==n&&!0!==n.isCamera)return void(0,S.error)("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===ed)return;let t=!0===eV.enabled&&!0===eV.isPresenting,r=null!==eu&&(null===em||t)&&eu.begin(ec,em);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===n.parent&&!0===n.matrixWorldAutoUpdate&&n.updateMatrixWorld(),!0===eV.enabled&&!0===eV.isPresenting&&(null===eu||!1===eu.isCompositing())&&(!0===eV.cameraAutoUpdate&&eV.updateCamera(n),n=eV.getCamera()),!0===e.isScene&&e.onBeforeRender(ec,e,n,em),(eo=g.get(e,es.length)).init(n),es.push(eo),eU.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),ew.setFromProjectionMatrix(eU,S.WebGLCoordinateSystem,n.reversedDepth),eN=this.localClippingEnabled,eL=_.init(this.clippingPlanes,eN),(ei=h.get(e,el.length)).init(),el.push(ei),!0===eV.enabled&&!0===eV.isPresenting){let e=ec.xr.getDepthSensingMesh();null!==e&&eZ(e,n,-1/0,ec.sortObjects)}eZ(e,n,0,ec.sortObjects),ei.finish(),!0===ec.sortObjects&&ei.sort(eR,eC),(eO=!1===eV.enabled||!1===eV.isPresenting||!1===eV.hasDepthSensing())&&M.addToRenderList(ei,e),this.info.render.frame++,!0===eL&&_.beginShadows();let a=eo.state.shadowsArray;if(v.render(a,e,n),!0===eL&&_.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(r&&eu.hasRenderPass())){let t=ei.opaque,r=ei.transmissive;if(eo.setupLights(),n.isArrayCamera){let a=n.cameras;if(r.length>0)for(let n=0,i=a.length;n0&&e0(t,r,e,n),eO&&M.render(e),eJ(ei,e,n)}null!==em&&0===ep&&(l.updateMultisampleRenderTarget(em),l.updateRenderTargetMipmap(em)),r&&eu.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,n),y.resetDefaultState(),eh=-1,eg=null,es.pop(),es.length>0?(eo=es[es.length-1],!0===eL&&_.setGlobalState(ec.clippingPlanes,eo.state.camera)):eo=null,el.pop(),ei=el.length>0?el[el.length-1]:null},this.getActiveCubeFace=function(){return ef},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return em},this.setRenderTargetTextures=function(e,n,t){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=n,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:t,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,n){let t=o.get(e);t.__webglFramebuffer=n,t.__useDefaultFramebuffer=void 0===n};const e8=eG.createFramebuffer();this.setRenderTarget=function(e,n=0,t=0){em=e,ef=n,ep=t;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eG.FRAMEBUFFER,u.__webglFramebuffer),e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest,a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),eh=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let n=e.depthTexture;if(u.__boundDepthTexture!==n){if(null!==n&&o.has(n)&&(e.width!==n.image.width||e.height!==n.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(d[n])?d[n][t]:d[n],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[t]:d,e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest}else e_.copy(ey).multiplyScalar(ex).floor(),ev.copy(eA).multiplyScalar(ex).floor(),eS=eP;if(0!==t&&(r=e8),a.bindFramebuffer(eG.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),i){let r=o.get(e.texture);eG.framebufferTexture2D(eG.FRAMEBUFFER,eG.COLOR_ATTACHMENT0,eG.TEXTURE_CUBE_MAP_POSITIVE_X+n,r.__webglTexture,t)}else if(s)for(let r=0;r=0&&n<=e.width-i&&t>=0&&t<=e.height-l&&(e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,C.convert(o),C.convert(u),s))}finally{let e=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,t,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(n>=0&&n<=e.width-i&&t>=0&&t<=e.height-l){a.bindFramebuffer(eG.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eG.createBuffer();eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.bufferData(eG.PIXEL_PACK_BUFFER,s.byteLength,eG.STREAM_READ),e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,C.convert(f),C.convert(p),0);let h=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,h);let g=eG.fenceSync(eG.SYNC_GPU_COMMANDS_COMPLETE,0);return eG.flush(),await (0,S.probeAsync)(eG,g,4),eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.getBufferSubData(eG.PIXEL_PACK_BUFFER,0,s),eG.deleteBuffer(m),eG.deleteSync(g),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,n=null,t=0){let r=Math.pow(2,-t),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==n?n.x:0,u=null!==n?n.y:0;l.setTexture2D(e,0),eG.copyTexSubImage2D(eG.TEXTURE_2D,t,0,0,s,u,i,o),a.unbindTexture()};const e9=eG.createFramebuffer(),e7=eG.createFramebuffer();this.copyTextureToTexture=function(e,n,t=null,r=null,i=0,s=null){let u,c,d,f,p,m,h,g,_,v;null===s&&(0!==i?((0,S.warnOnce)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);let E=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==t)u=t.max.x-t.min.x,c=t.max.y-t.min.y,d=t.isBox3?t.max.z-t.min.z:1,f=t.min.x,p=t.min.y,m=t.isBox3?t.min.z:0;else{let n=Math.pow(2,-i);u=Math.floor(E.width*n),c=Math.floor(E.height*n),d=e.isDataArrayTexture?E.depth:e.isData3DTexture?Math.floor(E.depth*n):1,f=0,p=0,m=0}null!==r?(h=r.x,g=r.y,_=r.z):(h=0,g=0,_=0);let T=C.convert(n.format),M=C.convert(n.type);n.isData3DTexture?(l.setTexture3D(n,0),v=eG.TEXTURE_3D):n.isDataArrayTexture||n.isCompressedArrayTexture?(l.setTexture2DArray(n,0),v=eG.TEXTURE_2D_ARRAY):(l.setTexture2D(n,0),v=eG.TEXTURE_2D),eG.pixelStorei(eG.UNPACK_FLIP_Y_WEBGL,n.flipY),eG.pixelStorei(eG.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eG.pixelStorei(eG.UNPACK_ALIGNMENT,n.unpackAlignment);let b=eG.getParameter(eG.UNPACK_ROW_LENGTH),x=eG.getParameter(eG.UNPACK_IMAGE_HEIGHT),R=eG.getParameter(eG.UNPACK_SKIP_PIXELS),y=eG.getParameter(eG.UNPACK_SKIP_ROWS),A=eG.getParameter(eG.UNPACK_SKIP_IMAGES);eG.pixelStorei(eG.UNPACK_ROW_LENGTH,E.width),eG.pixelStorei(eG.UNPACK_IMAGE_HEIGHT,E.height),eG.pixelStorei(eG.UNPACK_SKIP_PIXELS,f),eG.pixelStorei(eG.UNPACK_SKIP_ROWS,p),eG.pixelStorei(eG.UNPACK_SKIP_IMAGES,m);let P=e.isDataArrayTexture||e.isData3DTexture,w=n.isDataArrayTexture||n.isData3DTexture;if(e.isDepthTexture){let t=o.get(e),r=o.get(n),l=o.get(t.__renderTarget),v=o.get(r.__renderTarget);a.bindFramebuffer(eG.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eG.DRAW_FRAMEBUFFER,v.__webglFramebuffer);for(let t=0;ttypeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return S.WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let n=this.getContext();n.drawingBufferColorSpace=S.ColorManagement._getDrawingBufferColorSpace(e),n.unpackColorSpace=S.ColorManagement._getUnpackColorSpace()}}e.s(["PMREMGenerator",()=>V,"ShaderChunk",()=>M,"ShaderLib",()=>x,"UniformsLib",()=>b,"WebGLRenderer",()=>n0,"WebGLUtils",()=>nz],8560);var n1=e.i(30224);let n3=e=>{let n,t=new Set,r=(e,r)=>{let a="function"==typeof e?e(n):e;if(!Object.is(a,n)){let e=n;n=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},n,a),t.forEach(t=>t(n,e))}},a=()=>n,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(t.add(e),()=>t.delete(e))},o=n=e(r,a,i);return i},n2=e=>e?n3(e):n3;e.s(["createStore",()=>n2],8155);let{useSyncExternalStoreWithSelector:n4}=n1.default,n5=e=>e;function n6(e,n=n5,t){let r=n4(e.subscribe,e.getState,e.getInitialState,n,t);return _.default.useDebugValue(r),r}let n8=(e,n)=>{let t=n2(e),r=(e,r=n)=>n6(t,e,r);return Object.assign(r,t),r},n9=(e,n)=>e?n8(e,n):n8;e.s(["createWithEqualityFn",()=>n9,"useStoreWithEqualityFn",()=>n6],66748);let n7=[];function te(e,n,t=(e,n)=>e===n){if(e===n)return!0;if(!e||!n)return!1;let r=e.length;if(n.length!==r)return!1;for(let a=0;a0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}let a={keys:n,equal:r.equal,remove:()=>{let e=n7.indexOf(a);-1!==e&&n7.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...n)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(n7.push(a),!t)throw a.promise}var tt=e.i(89499),tr=e.i(43476),ta=_;function ti(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=ti(r,n,t);if(e)return e;r=n?null:r.sibling}}function to(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(n){return e}}"u">typeof window&&((null==(c=window.document)?void 0:c.createElement)||(null==(d=window.navigator)?void 0:d.product)==="ReactNative")?ta.useLayoutEffect:ta.useEffect;let tl=to(ta.createContext(null));class ts extends ta.Component{render(){return ta.createElement(tl.Provider,{value:this._reactInternals},this.props.children)}}function tu(){let e=ta.useContext(tl);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=ta.useId();return ta.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=ti(t,!1,e=>{let t=e.memoizedState;for(;t;){if(t.memoizedState===n)return!0;t=t.next}});if(e)return e}},[e,n])}let tc=Symbol.for("react.context"),td=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===tc;function tf(){let e=function(){let e=tu(),[n]=ta.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;td(e)&&e!==tl&&!n.has(e)&&n.set(e,ta.use(to(e))),t=t.return}return n}();return ta.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>ta.createElement(n,null,ta.createElement(t.Provider,{...r,value:e.get(t)})),e=>ta.createElement(ts,{...e})),[e])}function tp(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>ts,"traverseFiber",()=>ti,"useContextBridge",()=>tf,"useFiber",()=>tu],46791),_.act;let tm=e=>e&&e.hasOwnProperty("current"),th=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),tg="u">typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?_.useLayoutEffect:_.useEffect;function t_(e){let n=_.useRef(e);return tg(()=>void(n.current=e),[e]),n}function tv(){let e=tu(),n=tf();return _.useMemo(()=>({children:t})=>{let r=ti(e,!0,e=>e.type===_.StrictMode)?_.StrictMode:_.Fragment;return(0,tr.jsx)(r,{children:(0,tr.jsx)(n,{children:t})})},[e,n])}function tS({set:e}){return tg(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let tE=((s=class extends _.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function tT(e){var n;let t="u">typeof window?null!=(n=window.devicePixelRatio)?n:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function tM(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tb={obj:e=>e===Object(e)&&!tb.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,n,{arrays:t="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof n||!!e!=!!n)return!1;if(tb.str(e)||tb.num(e)||tb.boo(e))return e===n;let o=tb.obj(e);if(o&&"reference"===r)return e===n;let l=tb.arr(e);if(l&&"reference"===t)return e===n;if((l||o)&&e===n)return!0;for(i in e)if(!(i in n))return!1;if(o&&"shallow"===t&&"shallow"===r){for(i in a?n:e)if(!tb.equ(e[i],n[i],{strict:a,objects:"reference"}))return!1}else for(i in a?n:e)if(e[i]!==n[i])return!1;if(tb.und(i)){if(l&&0===e.length&&0===n.length||o&&0===Object.keys(e).length&&0===Object.keys(n).length)return!0;if(e!==n)return!1}return!0}},tx=["children","key","ref"];function tR(e,n,t,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:n,type:t,parent:null,children:[],props:function(e){let n={};for(let t in e)tx.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tC(e,n){if(!n.includes("-")||n in e)return{root:e,key:n,target:e[n]};let t=e,r=n.split("-");for(let a of r){if("object"!=typeof t||null===t){if(void 0!==t)return{root:t,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:n,target:void 0}}n=a,e=t,t=t[n]}return{root:e,key:n,target:t}}let ty=/-\d+$/;function tA(e,n){if(tb.str(n.props.attach)){if(ty.test(n.props.attach)){let t=n.props.attach.replace(ty,""),{root:r,key:a}=tC(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tC(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tb.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function tP(e,n){if(tb.str(n.props.attach)){let{root:t,key:r}=tC(e.object,n.props.attach),a=n.previousAttach;void 0===a?delete t[r]:t[r]=a}else null==n.previousAttach||n.previousAttach(e.object,n.object);delete n.previousAttach}let tw=[...tx,"args","dispose","attach","object","onUpdate","dispose"],tL=new Map,tN=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tU=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tD(e,n){var t,r;let a=e.__r3f,i=a&&tp(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tw.includes(t))continue;if(a&&tU.test(t)){"function"==typeof o?a.handlers[t]=o:delete a.handlers[t],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;let{root:l,key:s,target:u}=tC(e,t);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${t}". Ensure it is an object before setting "${s}".`);u instanceof v.Layers&&o instanceof v.Layers?u.mask=o.mask:u instanceof v.Color&&th(o)?u.set(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor?u.copy(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o)?"function"==typeof u.fromArray?u.fromArray(o):u.set(...o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o?"function"==typeof u.setScalar?u.setScalar(o):u.set(o):(l[s]=o,i&&!i.linear&&tN.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===v.RGBAFormat&&l[s].type===v.UnsignedByteType&&(l[s].colorSpace=v.SRGBColorSpace))}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(t=a.object)&&t.isObject3D&&o!==a.eventCount){let e=a.object,n=i.internal.interaction.indexOf(e);n>-1&&i.internal.interaction.splice(n,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&tI(a),e}function tI(e){var n;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let t=null==(n=e.root)||null==n.getState?void 0:n.getState();t&&0===t.internal.frames&&t.invalidate()}let tF=e=>null==e?void 0:e.isObject3D;function tO(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tB(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tG=e=>!!(null!=e&&e.render),tH=_.createContext(null);function tk(){let e=_.useContext(tH);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tV(e=e=>e,n){return tk()(e,n)}function tz(e,n=0){let t=tk(),r=t.getState().internal.subscribe,a=t_(e);return tg(()=>r(a,n,t),[n,r,t]),null}let tW=new WeakMap;function tX(e,n){return function(t,...r){var a;let i;return"function"==typeof t&&(null==t||null==(a=t.prototype)?void 0:a.constructor)===t?(i=tW.get(t))||(i=new t,tW.set(t,i)):i=t,e&&e(i),Promise.all(r.map(e=>new Promise((t,r)=>i.load(e,e=>{var n;let r;tF(null==e?void 0:e.scene)&&Object.assign(e,(n=e.scene,r={nodes:{},materials:{},meshes:{}},n&&n.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),t(e)},n,n=>r(Error(`Could not load ${e}: ${null==n?void 0:n.message}`))))))}}function tj(e,n,t,r){let a=Array.isArray(n)?n:[n],i=tn(tX(t,r),[e,...a],!1,{equal:tb.equ});return Array.isArray(n)?i:i[0]}tj.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];tn(tX(t),[e,...a],!0,r)},tj.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n7.splice(0,n7.length);else{let e=n7.find(e=>te(t,e.keys,e.equal));e&&e.remove()}};var tq={exports:{}},tY={exports:{}};tY.exports;let tK=(h||(h=1,m||(m=1,tY.exports=function(e){function n(e,n,t,r){return new rK(e,n,t,r)}function t(){}function r(e){var n="https://react.dev/errors/"+e;if(1oR||(e.current=ox[oR],ox[oR]=null,oR--)}function d(e,n){ox[++oR]=e.current,e.current=n}function f(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function p(e,n,t){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=0x7ffffff&r;return 0!==l?0!=(r=l&~i)?a=f(r):0!=(o&=l)?a=f(o):t||0!=(t=l&~e)&&(a=f(t)):0!=(l=r&~i)?a=f(l):0!==o?a=f(o):t||0!=(t=r&~e)&&(a=f(t)),0===a?0:0!==n&&n!==a&&(n&i)==0&&((i=a&-a)>=(t=n&-n)||32===i&&(4194048&t)!=0)?n:a}function m(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)==0}function h(){var e=oN;return(0x3c00000&(oN<<=1))==0&&(oN=4194304),e}function v(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function S(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function E(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-oy(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|261930&t}function T(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-oy(t),a=1<)":-1a||s[r]!==u[a]){var c=` +`+s[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=a)break}}}finally{oK=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?C(t):""}function A(e){try{var n="",t=null;do n+=function(e,n){switch(e.tag){case 26:case 27:case 5:return C(e.type);case 16:return C("Lazy");case 13:return e.child!==n&&null!==n?C("Suspense Fallback"):C("Suspense");case 19:return C("SuspenseList");case 0:case 15:return y(e.type,!1);case 11:return y(e.type.render,!1);case 1:return y(e.type,!0);case 31:return C("Activity");default:return""}}(e,t),t=e,e=e.return;while(e)return n}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}function P(e,n){if("object"==typeof e&&null!==e){var t=o$.get(e);return void 0!==t?t:(n={value:e,source:n,stack:A(n)},o$.set(e,n),n)}return{value:e,source:n,stack:A(n)}}function w(e,n){oQ[oZ++]=o0,oQ[oZ++]=oJ,oJ=e,o0=n}function L(e,n,t){o1[o3++]=o4,o1[o3++]=o5,o1[o3++]=o2,o2=e;var r=o4;e=o5;var a=32-oy(r)-1;r&=~(1<>=o,a-=o,o4=1<<32-oy(n)+a|t<f?(p=d,d=null):p=d.sibling;var _=h(n,d,o[f],l);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&t(n,d),r=s(_,r,f),null===c?u=_:c.sibling=_,c=_,d=p}if(f===o.length)return a(n,d),lt&&w(n,f),u;if(null===d){for(;fp?(_=f,f=null):_=f.sibling;var S=h(n,f,v.value,u);if(null===S){null===f&&(f=_);break}e&&f&&null===S.alternate&&t(n,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=_}if(v.done)return a(n,f),lt&&w(n,p),c;if(null===f){for(;!v.done;p++,v=l.next())null!==(v=m(n,v.value,u))&&(o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return lt&&w(n,p),c}for(f=i(f);!v.done;p++,v=l.next())null!==(v=g(f,n,p,v.value,u))&&(e&&null!==v.alternate&&f.delete(null===v.key?p:v.key),o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return t(n,e)}),lt&&w(n,p),c}(c,d,f=_.call(f),p)}if("function"==typeof f.then)return n(c,d,eb(f),p);if(f.$$typeof===ad)return n(c,d,ee(c,f),p);eR(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(a(c,d.sibling),(p=o(d,f)).return=c):(a(c,d),(p=r1(f,c.mode,p)).return=c),u(c=p)):a(c,d)}(c,d,f,p);return lw=null,_}catch(e){if(e===lR||e===ly)throw e;var v=n(29,e,null,c.mode);return v.lanes=p,v.return=c,v}finally{}}}function ey(){for(var e=lI,n=lF=lI=0;ni?i:8);var o=aM.T,l={};aM.T=l,nZ(e,!1,n,t);try{var s=a(),u=aM.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;for(var e=0;e";case sc:return":has("+(rf(e)||"")+")";case sd:return'[role="'+e.value+'"]';case sp:return'"'+e.value+'"';case sf:return'[data-testname="'+e.value+'"]';default:throw Error(r(365))}}function rp(e,n){var t=[];e=[e,0];for(var r=0;rsO&&(n.flags|=128,i=!0,tO(a,!1),n.lanes=4194304)}else{if(!i)if(null!==(e=eQ(o))){if(n.flags|=128,i=!0,n.updateQueue=e=e.updateQueue,tF(n,e),tO(a,!0),null===a.tail&&"hidden"===a.tailMode&&!o.alternate&&!lt)return tB(n),null}else 2*oO()-a.renderingStartTime>sO&&0x20000000!==t&&(n.flags|=128,i=!0,tO(a,!1),n.lanes=4194304);a.isBackwards?(o.sibling=n.child,n.child=o):(null!==(e=a.last)?e.sibling=o:n.child=o,a.last=o)}return null!==a.tail?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=oO(),e.sibling=null,t=lz.current,d(lz,i?1&t|2:1&t),lt&&w(n,a.treeForkCount),e):(tB(n),null);case 22:case 23:return e$(n),eX(),a=null!==n.memoizedState,null!==e?null!==e.memoizedState!==a&&(n.flags|=8192):a&&(n.flags|=8192),a?(0x20000000&t)!=0&&(128&n.flags)==0&&(tB(n),6&n.subtreeFlags&&(n.flags|=8192)):tB(n),null!==(t=n.updateQueue)&&tF(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),a=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(a=n.memoizedState.cachePool.pool),a!==t&&(n.flags|=2048),null!==e&&c(lx),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),q(lf),tB(n),null;case 25:case 30:return null}throw Error(r(156,n.tag))}(n.alternate,n,sR);if(null!==t){sv=t;return}if(null!==(n=n.sibling)){sv=n;return}sv=n=e}while(null!==n)0===sC&&(sC=5)}function rD(e,n){do{var t=function(e,n){switch(U(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return q(lf),F(),(65536&(e=n.flags))!=0&&(128&e)==0?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return B(n),null;case 31:if(null!==n.memoizedState){if(e$(n),null===n.alternate)throw Error(r(340));z()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(e$(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(r(340));z()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return c(lz),null;case 4:return F(),null;case 10:return q(n.type),null;case 22:case 23:return e$(n),eX(),null!==e&&c(lx),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return q(lf),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,sv=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){sv=e;return}sv=e=t}while(null!==e)sC=6,sv=null}function rI(e,n,t,a,i,o,l,s,u){e.cancelPendingCommit=null;do rH();while(0!==sH)if((6&sg)!=0)throw Error(r(327));if(null!==n){if(n===e.current)throw Error(r(177));if(function(e,n,t,r,a,i){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(t=o&~t;0t?32:t;t=aM.T;var i=aj();try{aX(a),aM.T=null,a=sX,sX=null;var o=sk,l=sz;if(sH=0,sV=sk=null,sz=0,(6&sg)!=0)throw Error(r(331));var s=sg;if(sg|=4,rs(o.current),rt(o,o.current,l,a),sg=s,eo(0,!1),oX&&"function"==typeof oX.onPostCommitFiberRoot)try{oX.onPostCommitFiberRoot(oW,o)}catch{}return!0}finally{aX(i),aM.T=t,rG(e,n)}}function rV(e,n,t){n=P(t,n),n=n9(e.stateNode,n,2),null!==(e=eF(e,n,2))&&(S(e,2),ei(e))}function rz(e,n,t){if(3===e.tag)rV(e,e,t);else for(;null!==n;){if(3===n.tag){rV(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===sG||!sG.has(r))){e=P(t,e),null!==(r=eF(n,t=n7(2),2))&&(te(t,r,n,e),S(r,2),ei(r));break}}n=n.return}}function rW(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new sh;var a=new Set;r.set(n,a)}else void 0===(a=r.get(n))&&(a=new Set,r.set(n,a));a.has(t)||(sx=!0,a.add(t),e=rX.bind(null,e,n,t),n.then(e,e))}function rX(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,s_===e&&(sS&t)===t&&(4===sC||3===sC&&(0x3c00000&sS)===sS&&300>oO()-sI?(2&sg)==0&&rb(e,0):sP|=t,sL===sS&&(sL=0)),ei(e)}function rj(e,n){0===n&&(n=h()),null!==(e=ew(e,n))&&(S(e,n),ei(e))}function rq(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),rj(e,t)}function rY(e,n){var t=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;null!==i&&(t=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==a&&a.delete(n),rj(e,t)}function rK(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function r$(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rQ(e,t){var r=e.alternate;return null===r?((r=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x3e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rZ(e,n){e.flags&=0x3e00002;var t=e.alternate;return null===t?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,e.type=t.type,e.dependencies=null===(n=t.dependencies)?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function rJ(e,t,a,i,o,l){var s=0;if(i=e,"function"==typeof e)r$(e)&&(s=1);else if("string"==typeof e)s=oa&&ov?oi(e,a,o6.current)?26:oM(e)?27:5:oa?oi(e,a,o6.current)?26:5:ov&&oM(e)?27:5;else t:switch(e){case a_:return(e=n(31,a,t,o)).elementType=a_,e.lanes=l,e;case al:return r0(a.children,o,l,t);case as:s=8,o|=24;break;case au:return(e=n(12,a,t,2|o)).elementType=au,e.lanes=l,e;case ap:return(e=n(13,a,t,o)).elementType=ap,e.lanes=l,e;case am:return(e=n(19,a,t,o)).elementType=am,e.lanes=l,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ad:s=10;break t;case ac:s=9;break t;case af:s=11;break t;case ah:s=14;break t;case ag:s=16,i=null;break t}s=29,a=Error(r(130,null===e?"null":typeof e,"")),i=null}return(t=n(s,a,t,o)).elementType=e,t.type=i,t.lanes=l,t}function r0(e,t,r,a){return(e=n(7,e,a,t)).lanes=r,e}function r1(e,t,r){return(e=n(6,e,null,t)).lanes=r,e}function r3(e){var t=n(18,null,null,0);return t.stateNode=e,t}function r2(e,t,r){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function r4(e,n,t,r,a,i,o,l,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=aB,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=v(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v(0),this.hiddenUpdates=v(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=new Map}function r5(e,t,r,a,i,o,l,s,u,c,d,f){return e=new r4(e,t,r,l,u,c,d,f,s),t=1,!0===o&&(t|=24),o=n(3,null,null,t),e.current=o,o.stateNode=e,t=et(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:t},eU(o),e}function r6(e){var n=e._reactInternals;if(void 0===n)throw"function"==typeof e.render?Error(r(188)):Error(r(268,e=Object.keys(e).join(",")));return null===(e=null!==(e=o(n))?function e(n){var t=n.tag;if(5===t||26===t||27===t||6===t)return n;for(n=n.child;null!==n;){if(null!==(t=e(n)))return t;n=n.sibling}return null}(e):null)?null:aC(e.stateNode)}function r8(e,n,t,r,a,i){a=oC,null===r.context?r.context=a:r.pendingContext=a,(r=eI(n)).payload={element:t},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(t=eF(e,r,n))&&(r_(t,e,n),eO(t,e,n))}function r9(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t>>=0)?32:31-(oA(e)/oP|0)|0},oA=Math.log,oP=Math.LN2,ow=256,oL=262144,oN=4194304,oU=at.unstable_scheduleCallback,oD=at.unstable_cancelCallback,oI=at.unstable_shouldYield,oF=at.unstable_requestPaint,oO=at.unstable_now,oB=at.unstable_ImmediatePriority,oG=at.unstable_UserBlockingPriority,oH=at.unstable_NormalPriority,ok=at.unstable_IdlePriority,oV=at.log,oz=at.unstable_setDisableYieldValue,oW=null,oX=null,oj="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},oq="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof g.default&&"function"==typeof g.default.emit)return void g.default.emit("uncaughtException",e);console.error(e)},oY=Object.prototype.hasOwnProperty,oK=!1,o$=new WeakMap,oQ=[],oZ=0,oJ=null,o0=0,o1=[],o3=0,o2=null,o4=1,o5="",o6=u(null),o8=u(null),o9=u(null),o7=u(null),le=null,ln=null,lt=!1,lr=null,la=!1,li=Error(r(519)),lo=u(null),ll=null,ls=null,lu="u">typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},lc=at.unstable_scheduleCallback,ld=at.unstable_NormalPriority,lf={$$typeof:ad,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},lp=null,lm=null,lh=!1,lg=!1,l_=!1,lv=0,lS=null,lE=0,lT=0,lM=null,lb=aM.S;aM.S=function(e,n){sF=oO(),"object"==typeof n&&null!==n&&"function"==typeof n.then&&function(e,n){if(null===lS){var t=lS=[];lE=0,lT=ef(),lM={status:"pending",value:void 0,then:function(e){t.push(e)}}}lE++,n.then(ep,ep)}(0,n),null!==lb&&lb(e,n)};var lx=u(null),lR=Error(r(460)),lC=Error(r(474)),ly=Error(r(542)),lA={then:function(){}},lP=null,lw=null,lL=0,lN=eC(!0),lU=eC(!1),lD=[],lI=0,lF=0,lO=!1,lB=!1,lG=u(null),lH=u(0),lk=u(null),lV=null,lz=u(0),lW=0,lX=null,lj=null,lq=null,lY=!1,lK=!1,l$=!1,lQ=0,lZ=0,lJ=null,l0=0,l1={readContext:J,use:nn,useCallback:eZ,useContext:eZ,useEffect:eZ,useImperativeHandle:eZ,useLayoutEffect:eZ,useInsertionEffect:eZ,useMemo:eZ,useReducer:eZ,useRef:eZ,useState:eZ,useDebugValue:eZ,useDeferredValue:eZ,useTransition:eZ,useSyncExternalStore:eZ,useId:eZ,useHostTransitionStatus:eZ,useFormState:eZ,useActionState:eZ,useOptimistic:eZ,useMemoCache:eZ,useCacheRefresh:eZ};l1.useEffectEvent=eZ;var l3={readContext:J,use:nn,useCallback:function(e,n){return e8().memoizedState=[e,void 0===n?null:n],e},useContext:J,useEffect:nL,useImperativeHandle:function(e,n,t){t=null!=t?t.concat([e]):null,nP(4194308,4,nF.bind(null,n,e),t)},useLayoutEffect:function(e,n){return nP(4194308,4,e,n)},useInsertionEffect:function(e,n){nP(4,2,e,n)},useMemo:function(e,n){var t=e8();n=void 0===n?null:n;var r=e();return t.memoizedState=[r,n],r},useReducer:function(e,n,t){var r=e8();if(void 0!==t)var a=t(n);else a=n;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=nK.bind(null,lX,e),[r.memoizedState,e]},useRef:function(e){return e8().memoizedState={current:e}},useState:function(e){var n=(e=np(e)).queue,t=n$.bind(null,lX,n);return n.dispatch=t,[e.memoizedState,t]},useDebugValue:nB,useDeferredValue:function(e,n){return nk(e8(),e,n)},useTransition:function(){var e=np(!1);return e=nz.bind(null,lX,e.queue,!0,!1),e8().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,t){var a=lX,i=e8();if(lt){if(void 0===t)throw Error(r(407));t=t()}else{if(t=n(),null===s_)throw Error(r(349));(127&sS)!=0||ns(a,n,t)}i.memoizedState=t;var o={value:t,getSnapshot:n};return i.queue=o,nL(nc.bind(null,a,o,e),[e]),a.flags|=2048,ny(9,{destroy:void 0},nu.bind(null,a,o,t,n),null),t},useId:function(){var e=e8(),n=s_.identifierPrefix;if(lt){var t=o5,r=o4;n="_"+n+"R_"+(t=(r&~(1<<32-oy(r)-1)).toString(32)+t),0<(t=lQ++)&&(n+="H"+t.toString(32)),n+="_"}else n="_"+n+"r_"+(t=l0++).toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:nX,useFormState:nM,useActionState:nM,useOptimistic:function(e){var n=e8();n.memoizedState=n.baseState=e;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=t,n=nZ.bind(null,lX,!0,t),t.dispatch=n,[e,n]},useMemoCache:nt,useCacheRefresh:function(){return e8().memoizedState=nY.bind(null,lX)},useEffectEvent:function(e){var n=e8(),t={impl:e};return n.memoizedState=t,function(){if((2&sg)!=0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}},l2={readContext:J,use:nn,useCallback:nG,useContext:J,useEffect:nN,useImperativeHandle:nO,useInsertionEffect:nD,useLayoutEffect:nI,useMemo:nH,useReducer:na,useRef:nA,useState:function(){return na(nr)},useDebugValue:nB,useDeferredValue:function(e,n){return nV(e9(),lj.memoizedState,e,n)},useTransition:function(){var e=na(nr)[0],n=e9().memoizedState;return["boolean"==typeof e?e:ne(e),n]},useSyncExternalStore:nl,useId:nj,useHostTransitionStatus:nX,useFormState:nb,useActionState:nb,useOptimistic:function(e,n){return nm(e9(),lj,e,n)},useMemoCache:nt,useCacheRefresh:nq};l2.useEffectEvent=nU;var l4={readContext:J,use:nn,useCallback:nG,useContext:J,useEffect:nN,useImperativeHandle:nO,useInsertionEffect:nD,useLayoutEffect:nI,useMemo:nH,useReducer:no,useRef:nA,useState:function(){return no(nr)},useDebugValue:nB,useDeferredValue:function(e,n){var t=e9();return null===lj?nk(t,e,n):nV(t,lj.memoizedState,e,n)},useTransition:function(){var e=no(nr)[0],n=e9().memoizedState;return["boolean"==typeof e?e:ne(e),n]},useSyncExternalStore:nl,useId:nj,useHostTransitionStatus:nX,useFormState:nC,useActionState:nC,useOptimistic:function(e,n){var t=e9();return null!==lj?nm(t,lj,e,n):(t.baseState=e,[e,t.queue.dispatch])},useMemoCache:nt,useCacheRefresh:nq};l4.useEffectEvent=nU;var l5={enqueueSetState:function(e,n,t){e=e._reactInternals;var r=rh(),a=eI(r);a.payload=n,null!=t&&(a.callback=t),null!==(n=eF(e,a,r))&&(r_(n,e,r),eO(n,e,r))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=rh(),a=eI(r);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=eF(e,a,r))&&(r_(n,e,r),eO(n,e,r))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=rh(),r=eI(t);r.tag=2,null!=n&&(r.callback=n),null!==(n=eF(e,r,t))&&(r_(n,e,t),eO(n,e,t))}},l6=Error(r(461)),l8=!1,l9={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},l7=!1,se=!1,sn=!1,st="function"==typeof WeakSet?WeakSet:Set,sr=null,sa=null,si=!1,so=null,sl=8192,ss={getCacheForType:function(e){var n=J(lf),t=n.data.get(e);return void 0===t&&(t=e(),n.data.set(e,t)),t},cacheSignal:function(){return J(lf).controller.signal}},su=0,sc=1,sd=2,sf=3,sp=4;if("function"==typeof Symbol&&Symbol.for){var sm=Symbol.for;su=sm("selector.component"),sc=sm("selector.has_pseudo_class"),sd=sm("selector.role"),sf=sm("selector.test_id"),sp=sm("selector.text")}var sh="function"==typeof WeakMap?WeakMap:Map,sg=0,s_=null,sv=null,sS=0,sE=0,sT=null,sM=!1,sb=!1,sx=!1,sR=0,sC=0,sy=0,sA=0,sP=0,sw=0,sL=0,sN=null,sU=null,sD=!1,sI=0,sF=0,sO=1/0,sB=null,sG=null,sH=0,sk=null,sV=null,sz=0,sW=0,sX=null,sj=null,sq=0,sY=null;return ae.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var n=ew(e,0x4000000);null!==n&&r_(n,e,0x4000000),r7(e,0x4000000)}},ae.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var n=rh(),t=ew(e,n=b(n));null!==t&&r_(t,e,n),r7(e,n)}},ae.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var n=f(e.pendingLanes);if(0!==n){for(e.pendingLanes|=2,e.entangledLanes|=2;n;){var t=1<<31-oy(n);e.entanglements[1]|=t,n&=~t}ei(e),(6&sg)==0&&(sO=oO()+500,eo(0,!1))}}break;case 31:case 13:null!==(n=ew(e,2))&&r_(n,e,2),rT(),r7(e,2)}},ae.batchedUpdates=function(e,n){return e(n)},ae.createComponentSelector=function(e){return{$$typeof:su,value:e}},ae.createContainer=function(e,n,t,r,a,i,o,l,s,u){return r5(e,n,!1,null,t,r,i,null,o,l,s,u)},ae.createHasPseudoClassSelector=function(e){return{$$typeof:sc,value:e}},ae.createHydrationContainer=function(e,n,t,r,a,i,o,l,s,u,c,d,f,p){var m;return(e=r5(t,r,!0,e,a,i,l,p,s,u,c,d)).context=oC,t=e.current,(a=eI(r=b(r=rh()))).callback=null!=(m=n)?m:null,eF(t,a,r),n=r,e.current.lanes=n,S(e,n),ei(e),e},ae.createPortal=function(e,n,t){var r=3=c&&o>=f&&i<=d&&l<=p){e.splice(n,1);break}if(a!==c||t.width!==u.width||pl){if(!(o!==f||t.height!==u.height||di)){c>a&&(u.width+=c-a,u.x=a),do&&(u.height+=f-o,u.y=o),pt&&(t=s)),s ")+` + +No matching component was found for: + `+e.join(" > ")}return null},ae.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return aC(e.child.stateNode);default:return e.child.stateNode}},ae.injectIntoDevTools=function(){var e={bundleType:0,version:ab,rendererPackageName:ax,currentDispatcherRef:aM,reconcilerVersion:"19.2.0"};if(null!==aR&&(e.rendererConfig=aR),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{oW=n.inject(e),oX=n}catch{}e=!!n.checkDCE}}return e},ae.isAlreadyRendering=function(){return(6&sg)!=0},ae.observeVisibleRects=function(e,n,t,a){if(!a9)throw Error(r(363));var i=io(e=rm(e,n),t,a).disconnect;return{disconnect:function(){i()}}},ae.shouldError=function(){return null},ae.shouldSuspend=function(){return!1},ae.startHostTransition=function(e,n,a,i){if(5!==e.tag)throw Error(r(476));var o=nW(e).queue;nz(e,o,n,a2,null===a?t:function(){var n=nW(e);return null===n.next&&(n=e.alternate.memoizedState),nQ(e,n.next.queue,{},rh()),a(i)})},ae.updateContainer=function(e,n,t,r){var a=n.current,i=rh();return r8(a,i,e,n,t,r),i},ae.updateContainerSync=function(e,n,t,r){return r8(n.current,2,e,n,t,r),2},ae},tY.exports.default=tY.exports,Object.defineProperty(tY.exports,"__esModule",{value:!0})),tq.exports=tY.exports),(f=tq.exports)&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default"))?f.default:f,t$={},tQ=/^three(?=[A-Z])/,tZ=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tJ=0;function t0(e){if("function"==typeof e){let n=`${tJ++}`;return t$[n]=e,n}Object.assign(t$,e)}function t1(e,n){let t=tZ(e),r=t$[t];if("primitive"!==e&&!r)throw Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!n.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==n.args&&!Array.isArray(n.args))throw Error("R3F: The args prop must be an array!")}function t3(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tA(e.parent,e):tF(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tI(e)}}function t2(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=t$[tZ(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tD(n.object,n.props),n.props.attach)tA(e,n);else if(tF(n.object)&&tF(e.object)){let r=e.object.children.indexOf(null==t?void 0:t.object);if(t&&-1!==r){let t=e.object.children.indexOf(n.object);-1!==t?(e.object.children.splice(t,1),e.object.children.splice(t{try{e.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?n():(0,tt.unstable_scheduleCallback)(tt.unstable_IdlePriority,n)}}function t8(e,n,t){if(!n)return;n.parent=null;let r=e.children.indexOf(n);-1!==r&&e.children.splice(r,1),n.props.attach?tP(e,n):tF(n.object)&&tF(e.object)&&(e.object.remove(n.object),function(e,n){let{internal:t}=e.getState();t.interaction=t.interaction.filter(e=>e!==n),t.initialHits=t.initialHits.filter(e=>e!==n),t.hovered.forEach((e,r)=>{(e.eventObject===n||e.object===n)&&t.hovered.delete(r)}),t.capturedMap.forEach((e,r)=>{tB(t.capturedMap,n,e,r)})}(tp(n),n.object));let a=null!==n.props.dispose&&!1!==t;for(let e=n.children.length-1;e>=0;e--){let t=n.children[e];t8(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&t6(n.object),void 0===t&&tI(n)}let t9=[],t7=()=>{},re={},rn=0,rt=(p={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return t1(e=tZ(e)in t$?e:e.replace(tQ,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tR(n.object,t,e,n)},removeChild:t8,appendChild:t4,appendInitialChild:t4,insertBefore:t5,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t4(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t8(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&t5(r,n,t)},getRootHostContext:()=>re,getChildHostContext:()=>re,commitUpdate(e,n,t,r,a){var i,o,l;t1(n,r);let s=!1;if("primitive"===e.type&&t.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=t.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,n)=>{var r;return e!==(null==(r=t.args)?void 0:r[n])})&&(s=!0),s)t9.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tw.includes(r)&&!tb.equ(n[r],e.props[r]))for(let e in t[r]=n[r],n)e.startsWith(`${r}-`)&&(t[e]=n[e]);for(let r in e.props){if(tw.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tC(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tL.get(e.constructor);try{n||(n=new e.constructor,tL.set(e.constructor,n))}catch(e){}return n}(a);tb.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tD(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t9){let n=e.parent;if(n)for(let t of(e.props.attach?tP(n,e):tF(e.object)&&tF(n.object)&&n.object.remove(e.object),e.children))t.props.attach?tP(e,t):tF(t.object)&&tF(e.object)&&e.object.remove(t.object);e.isHidden&&t3(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&t6(e.object)}for(let[r,a,i]of t9){r.props=a;let o=r.parent;if(o){let a=t$[tZ(r.type)];r.object=null!=(e=r.props.object)?e:new a(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r;var e,n,t=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let n=e.ref(t);"function"==typeof n&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t);for(let e of(tD(r.object,r.props),r.props.attach?tA(o,r):tF(r.object)&&tF(o.object)&&o.object.add(r.object),r.children))e.props.attach?tA(r,e):tF(e.object)&&tF(r.object)&&r.object.add(e.object);tI(r)}}t9.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tR(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tP(e.parent,e):tF(e.object)&&(e.object.visible=!1),e.isHidden=!0,tI(e)}},unhideInstance:t3,createTextInstance:t7,hideTextInstance:t7,unhideTextInstance:t7,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:_.createContext(null),setCurrentUpdatePriority(e){rn=e},getCurrentUpdatePriority:()=>rn,resolveUpdatePriority(){var e;if(0!==rn)return rn;switch("u">typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.5.0",applyViewTransitionName(e,n,t){},restoreViewTransitionName(e,n){},cancelViewTransitionName(e,n,t){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,n)=>!1,hasInstanceAffectedParent:(e,n)=>!1,suspendOnActiveViewTransition(e,n){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(e){},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,n)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw Error("Not implemented.")},removeRootViewTransitionClone(e,n){throw Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,n){},commitNewChildToFragmentInstance(e,n){},deleteChildFromFragmentInstance(e,n){},measureClonedInstance:e=>null,maySuspendCommitOnUpdate:(e,n,t)=>!1,maySuspendCommitInSyncRender:(e,n)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,n)=>null},(u=tK(p)).injectIntoDevTools(),u),rr=new Map,ra={objects:"shallow",strict:!1};function ri(e){var n,t;let r,a,i,o,l,s,u,c=rr.get(e),d=null==c?void 0:c.fiber,f=null==c?void 0:c.store;c&&console.warn("R3F.createRoot should only be called once!");let p="function"==typeof reportError?reportError:console.error,m=f||(n=rE,t=rT,l=(o=(i=n9((e,r)=>{let a,i=new v.Vector3,o=new v.Vector3,l=new v.Vector3;function s(e=r().camera,n=o,t=r().size){let{width:a,height:u,top:c,left:d}=t,f=a/u;n.isVector3?l.copy(n):l.set(...n);let p=e.getWorldPosition(i).distanceTo(l);if(e&&e.isOrthographicCamera)return{width:a/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let n=2*Math.tan(e.fov*Math.PI/180/2)*p,t=a/u*n;return{width:t,height:n,top:c,left:d,factor:a/t,distance:p,aspect:f}}}let u=n=>e(e=>({performance:{...e.performance,current:n}})),c=new v.Vector2;return{set:e,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>n(r(),e),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new v.Clock,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();a&&clearTimeout(a),e.performance.current!==e.performance.min&&u(e.performance.min),a=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:n=>e(e=>({...e,events:{...e.events,...n}})),setSize:(n,t,a=0,i=0)=>{let l=r().camera,u={width:n,height:t,top:a,left:i};e(e=>({size:u,viewport:{...e.viewport,...s(l,o,u)}}))},setDpr:n=>e(e=>{let t=tT(n);return{viewport:{...e.viewport,dpr:t,initialDpr:e.viewport.initialDpr||t}}}),setFrameloop:(n="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==n&&(t.start(),t.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:_.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,t)=>{let a=r().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:t}),a.subscribers=a.subscribers.sort((e,n)=>e.priority-n.priority),()=>{let t=r().internal;null!=t&&t.subscribers&&(t.priority=t.priority-(n>0),t.subscribers=t.subscribers.filter(n=>n.ref!==e))}}}}})).getState()).size,s=o.viewport.dpr,u=o.camera,i.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=i.getState();if(n.width!==l.width||n.height!==l.height||t.dpr!==s){l=n,s=t.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(n.width/2),e.right=n.width/2,e.top=n.height/2,e.bottom=-(n.height/2)):e.aspect=n.width/n.height,e.updateProjectionMatrix());t.dpr>0&&r.setPixelRatio(t.dpr);let a="u">typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(n.width,n.height,a)}e!==u&&(u=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),i.subscribe(e=>n(e)),i),h=d||rt.createContainer(m,1,null,!1,null,"",p,p,p,null);c||rr.set(e,{fiber:h,store:m});let g=!1,S=null;return{async configure(n={}){var t,i;let o;S=new Promise(e=>o=e);let{gl:l,size:s,scene:u,events:c,onCreated:d,shadows:f=!1,linear:p=!1,flat:h=!1,legacy:_=!1,orthographic:E=!1,frameloop:T="always",dpr:M=[1,2],performance:b,raycaster:x,camera:R,onPointerMissed:C}=n,y=m.getState(),A=y.gl;if(!y.gl){let n={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},t="function"==typeof l?await l(n):l;A=tG(t)?t:new n0({...n,...l}),y.set({gl:A})}let P=y.raycaster;P||y.set({raycaster:P=new v.Raycaster});let{params:w,...L}=x||{};if(tb.equ(L,P,ra)||tD(P,{...L}),tb.equ(w,P.params,ra)||tD(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tb.equ(a,R,ra)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:E?new v.OrthographicCamera(0,0,0,0,.1,1e3):new v.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tD(n,R),!n.manual&&("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(n.manual=!0,n.updateProjectionMatrix())),y.camera||null!=R&&R.rotation||n.lookAt(0,0,0)),y.set({camera:n}),P.camera=n}if(!y.scene){let e;null!=u&&u.isScene?tR(e=u,m,"",{}):(tR(e=new v.Scene,m,"",{}),u&&tD(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(m)});let N=function(e,n){if(!n&&"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:n,height:t,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:n,height:t,top:r,left:a}}return!n&&"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...n}}(e,s);if(tb.equ(N,y.size,ra)||y.setSize(N.width,N.height,N.top,N.left),M&&y.viewport.dpr!==tT(M)&&y.setDpr(M),y.frameloop!==T&&y.setFrameloop(T),y.onPointerMissed||y.set({onPointerMissed:C}),b&&!tb.equ(b,y.performance,ra)&&y.set(e=>({performance:{...e.performance,...b}})),!y.xr){let e=(e,n)=>{let t=m.getState();"never"!==t.frameloop&&rT(e,!0,t,n)},n=()=>{let n=m.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rE(n)},r={connect(){let e=m.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=m.getState().gl;e.xr.removeEventListener("sessionstart",n),e.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(t=A.xr)?void 0:t.addEventListener)&&r.connect(),y.set({xr:r})}if(A.shadowMap){let e=A.shadowMap.enabled,n=A.shadowMap.type;if(A.shadowMap.enabled=!!f,tb.boo(f))A.shadowMap.type=v.PCFSoftShadowMap;else if(tb.str(f)){let e={basic:v.BasicShadowMap,percentage:v.PCFShadowMap,soft:v.PCFSoftShadowMap,variance:v.VSMShadowMap};A.shadowMap.type=null!=(i=e[f])?i:v.PCFSoftShadowMap}else tb.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return v.ColorManagement.enabled=!_,g||(A.outputColorSpace=p?v.LinearSRGBColorSpace:v.SRGBColorSpace,A.toneMapping=h?v.NoToneMapping:v.ACESFilmicToneMapping),y.legacy!==_&&y.set(()=>({legacy:_})),y.linear!==p&&y.set(()=>({linear:p})),y.flat!==h&&y.set(()=>({flat:h})),!l||tb.fun(l)||tG(l)||tb.equ(l,A,ra)||tD(A,l),r=d,g=!0,o(),this},render(n){return g||S||this.configure(),S.then(()=>{rt.updateContainer((0,tr.jsx)(ro,{store:m,children:n,onCreated:r,rootElement:e}),h,null,()=>void 0)}),m},unmount(){rl(e)}}}function ro({store:e,children:n,onCreated:t,rootElement:r}){return tg(()=>{let n=e.getState();n.set(e=>({internal:{...e.internal,active:!0}})),t&&t(n),e.getState().events.connected||null==n.events.connect||n.events.connect(r)},[]),(0,tr.jsx)(tH.Provider,{value:e,children:n})}function rl(e,n){let t=rr.get(e),r=null==t?void 0:t.fiber;if(r){let a=null==t?void 0:t.store.getState();a&&(a.internal.active=!1),rt.updateContainer(null,r,null,()=>{a&&setTimeout(()=>{try{null==a.events.disconnect||a.events.disconnect(),null==(t=a.gl)||null==(r=t.renderLists)||null==r.dispose||r.dispose(),null==(i=a.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=a.gl)&&o.xr&&a.xr.disconnect();var t,r,i,o,l=a.scene;for(let e in"Scene"!==l.type&&(null==l.dispose||l.dispose()),l){let n=l[e];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}rr.delete(e),n&&n(e)}catch(e){}},500)})}}function rs(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let ru=new Set,rc=new Set,rd=new Set,rf=e=>rs(e,ru),rp=e=>rs(e,rc);function rm(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rh(e,n){switch(e){case"before":return rm(ru,n);case"after":return rm(rc,n);case"tail":return rm(rd,n)}}function rg(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),n=r.internal.subscribers;for(let e=0;e0)&&!(null!=(n=i.gl.xr)&&n.isPresenting)&&(r+=rg(e,i))}if(rv=!1,rh("after",e),0===r)return rh("tail",e),r_=!1,cancelAnimationFrame(a)}function rE(e,n=1){var t;if(!e)return rr.forEach(e=>rE(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):rv?e.internal.frames=2:e.internal.frames=1,r_||(r_=!0,requestAnimationFrame(rS)))}function rT(e,n=!0,t,r){if(n&&rh("before",e),t)rg(e,t,r);else for(let n of rr.values())rg(e,n.store.getState());n&&rh("after",e)}let rM={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rb(e){let{handlePointer:n}=function(e){function n(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(n=>{var t;return null==(t=e.__r3f)?void 0:t.handlers["onPointer"+n]}))}function t(n){let{internal:t}=e.getState();for(let e of t.hovered.values())if(!n.length||!n.find(n=>n.object===e.object&&n.index===e.index&&n.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(t.hovered.delete(tO(e)),null!=r&&r.eventCount){let t=r.handlers,a={...e,intersections:n};null==t.onPointerOut||t.onPointerOut(a),null==t.onPointerLeave||t.onPointerLeave(a)}}}function r(e,n){for(let t=0;tt([]);case"onLostPointerCapture":return n=>{let{internal:r}=e.getState();"pointerId"in n&&r.capturedMap.has(n.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(n.pointerId)&&(r.capturedMap.delete(n.pointerId),t([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(n,t){let r=e.getState(),a=new Set,i=[],o=t?t(r.internal.interaction):r.internal.interaction;for(let e=0;e{let t=tM(e.object),r=tM(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tO(e);return!a.has(n)&&(a.add(n),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let n=e.object;for(;n;){var s;null!=(s=n.__r3f)&&s.eventCount&&i.push({...e,eventObject:n}),n=n.parent}}if("pointerId"in n&&r.internal.capturedMap.has(n.pointerId))for(let e of r.internal.capturedMap.get(n.pointerId).values())a.has(tO(e.intersection))||i.push(e.intersection);return i}(i,s?n:void 0),d=u?function(n){let{internal:t}=e.getState(),r=n.offsetX-t.initialClick[0],a=n.offsetY-t.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&t(c),!function(e,n,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=tM(o.object);if(l||o.object.traverseAncestors(e=>{let n=tM(e);if(n)return l=n,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new v.Vector3(u.x,u.y,0).unproject(c),p=e=>{var n,t;return null!=(n=null==(t=d.capturedMap.get(e))?void 0:t.has(o.eventObject))&&n},m=e=>{let t={intersection:o,target:n.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),n.target.setPointerCapture(e)},h=e=>{let n=d.capturedMap.get(e);n&&tB(d.capturedMap,o.eventObject,n,e)},g={};for(let e in n){let t=n[e];"function"!=typeof t&&(g[e]=t)}let _={...o,...g,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in n&&d.capturedMap.get(n.pointerId);(!r||r.has(o.eventObject))&&(_.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&t([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},nativeEvent:n};if(a(_),!0===i.stopped)break}}}}(c,i,d,function(e){let n=e.eventObject,t=n.__r3f;if(!(null!=t&&t.eventCount))return;let o=t.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let n=tO(e),t=l.hovered.get(n);t?t.stopped&&e.stopPropagation():(l.hovered.set(n,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let t=o[a];t?(!u||l.initialHits.includes(n))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),t(e)):u&&l.initialHits.includes(n)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,n,t){n.pointer.set(e.offsetX/n.size.width*2-1,-(2*(e.offsetY/n.size.height))+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(rM).reduce((e,t)=>({...e,[t]:n(t)}),{}),update:()=>{var n;let{events:t,internal:r}=e.getState();null!=(n=r.lastEvent)&&n.current&&t.handlers&&t.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{let{set:t,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),t(e=>({events:{...e.events,connected:n}})),r.handlers)for(let e in r.handlers){let t=r.handlers[e],[a,i]=rM[e];n.addEventListener(a,t,{passive:i})}},disconnect:()=>{let{set:n,events:t}=e.getState();if(t.connected){if(t.handlers)for(let e in t.handlers){let n=t.handlers[e],[r]=rM[e];t.connected.removeEventListener(r,n)}n(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>tS,"C",()=>tV,"D",()=>tz,"E",()=>tE,"G",()=>tj,"a",()=>t_,"b",()=>tg,"c",()=>ri,"d",()=>rl,"e",()=>t0,"f",()=>rb,"i",()=>tm,"j",()=>rf,"k",()=>rp,"u",()=>tv],40859)},71753,e=>{"use strict";var n=e.i(40859);e.s(["useFrame",()=>n.D])},15080,e=>{"use strict";var n=e.i(40859);e.s(["useThree",()=>n.C])},79123,e=>{"use strict";var n=e.i(43476),t=e.i(71645);let r=(0,t.createContext)(null),a=(0,t.createContext)(null),i=(0,t.createContext)(null);function o(){return(0,t.useContext)(r)}function l(){return(0,t.useContext)(a)}function s(){return(0,t.useContext)(i)}function u({children:e,fogEnabledOverride:o,onClearFogEnabledOverride:l}){let[s,u]=(0,t.useState)(!0),[c,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(1),[m,h]=(0,t.useState)(90),[g,_]=(0,t.useState)(!1),[v,S]=(0,t.useState)(!0),[E,T]=(0,t.useState)(!1),[M,b]=(0,t.useState)("moveLookStick"),x=(0,t.useCallback)(e=>{u(e),l()},[l]),R=(0,t.useMemo)(()=>({fogEnabled:o??s,setFogEnabled:x,highQualityFog:c,setHighQualityFog:d,fov:m,setFov:h,audioEnabled:g,setAudioEnabled:_,animationEnabled:v,setAnimationEnabled:S}),[s,o,x,c,m,g,v]),C=(0,t.useMemo)(()=>({debugMode:E,setDebugMode:T}),[E,T]),y=(0,t.useMemo)(()=>({speedMultiplier:f,setSpeedMultiplier:p,touchMode:M,setTouchMode:b}),[f,p,M,b]);(0,t.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&T(e.debugMode),null!=e.audioEnabled&&_(e.audioEnabled),null!=e.animationEnabled&&S(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&d(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&h(e.fov),null!=e.touchMode&&b(e.touchMode)},[]);let A=(0,t.useRef)(null);return(0,t.useEffect)(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:s,highQualityFog:c,speedMultiplier:f,fov:m,audioEnabled:g,animationEnabled:v,debugMode:E,touchMode:M}))}catch(e){}},500),()=>{A.current&&clearTimeout(A.current)}),[s,c,f,m,g,v,E,M]),(0,n.jsx)(r.Provider,{value:R,children:(0,n.jsx)(a.Provider,{value:C,children:(0,n.jsx)(i.Provider,{value:y,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>s,"useDebug",()=>l,"useSettings",()=>o])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/4ce2a2145f0c6cc2.js b/docs/_next/static/chunks/4ce2a2145f0c6cc2.js new file mode 100644 index 00000000..a36b069d --- /dev/null +++ b/docs/_next/static/chunks/4ce2a2145f0c6cc2.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,35451,(e,t,r)=>{var n={229:function(e){var t,r,n,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var l=[],s=!1,c=-1;function f(){s&&n&&(s=!1,n.length?l=n.concat(l):c=-1,l.length&&d())}function d(){if(!s){var e=a(f);s=!0;for(var t=l.length;t;){for(n=l,l=[];++c1)for(var r=1;r{"use strict";var n,o;t.exports=(null==(n=e.g.process)?void 0:n.env)&&"object"==typeof(null==(o=e.g.process)?void 0:o.env)?e.g.process:e.r(35451)},45689,(e,t,r)=>{"use strict";var n=Symbol.for("react.transitional.element");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}r.Fragment=Symbol.for("react.fragment"),r.jsx=o,r.jsxs=o},43476,(e,t,r)=>{"use strict";t.exports=e.r(45689)},50740,(e,t,r)=>{"use strict";var n=e.i(47167),o=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),_=Symbol.for("react.view_transition"),b=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function E(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||v}function S(){}function j(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||v}E.prototype.isReactComponent={},E.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},E.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=E.prototype;var O=j.prototype=new S;O.constructor=j,m(O,E.prototype),O.isPureReactComponent=!0;var w=Array.isArray;function P(){}var R={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function x(e,t,r){var n=r.ref;return{$$typeof:o,type:e,key:t,ref:void 0!==n?n:null,props:r}}function A(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var M=/\/+/g;function C(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function N(e,t,r){if(null==e)return e;var n=[],u=0;return!function e(t,r,n,u,a){var l,s,c,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case o:case i:d=!0;break;case y:return e((d=t._init)(t._payload),r,n,u,a)}}if(d)return a=a(t),d=""===u?"."+C(t,0):u,w(a)?(n="",null!=d&&(n=d.replace(M,"$&/")+"/"),e(a,r,n,"",function(e){return e})):null!=a&&(A(a)&&(l=a,s=n+(null==a.key||t&&t.key===a.key?"":(""+a.key).replace(M,"$&/")+"/")+d,a=x(l.type,s,l.props)),r.push(a)),1;d=0;var p=""===u?".":u+":";if(w(t))for(var h=0;h{"use strict";t.exports=e.r(50740)},18800,(e,t,r)=>{"use strict";var n=e.r(71645);function o(e){var t="https://react.dev/errors/"+e;if(1{"use strict";!function e(){if("u">typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),t.exports=e.r(18800)},90317,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={bindSnapshot:function(){return s},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return c}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class u{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let a="u">typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return a?new a:new u}function s(e){return a?a.bind(e):u.bind(e)}function c(){return a?a.snapshot():function(e,...t){return e(...t)}}},42344,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},63599,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=e.r(42344)},12354,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HandleISRError",{enumerable:!0,get:function(){return o}});let n="u"{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return a}});let n=e.r(43476),o=e.r(12354),i={fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},u={fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"},a=function({error:e}){let t=e?.digest;return(0,n.jsxs)("html",{id:"__next_error__",children:[(0,n.jsx)("head",{}),(0,n.jsxs)("body",{children:[(0,n.jsx)(o.HandleISRError,{error:e}),(0,n.jsx)("div",{style:i,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("h2",{style:u,children:["Application error: a ",t?"server":"client","-side exception has occurred while loading ",window.location.hostname," (see the"," ",t?"server logs":"browser console"," for more information)."]}),t?(0,n.jsx)("p",{style:u,children:`Digest: ${t}`}):null]})})]})]})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},74575,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAssetPrefix",{enumerable:!0,get:function(){return o}});let n=e.r(12718);function o(){let e=document.currentScript;if(!(e instanceof HTMLScriptElement))throw Object.defineProperty(new n.InvariantError(`Expected document.currentScript to be a ",a=a.removeChild(a.firstChild);break;case"select":a="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a="string"==typeof r.is?o.createElement(l,{is:r.is}):o.createElement(l)}}a[eW]=n,a[eq]=r;e:for(o=n.child;null!==o;){if(5===o.tag||6===o.tag)a.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===n)break;for(;null===o.sibling;){if(null===o.return||o.return===n)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(n.stateNode=a,cl(a,l,r),l){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break;case"img":r=!0;break;default:r=!1}r&&ii(n)}}return ip(n),n.subtreeFlags&=-0x2000001,iu(n,n.type,null===e?null:e.memoizedProps,n.pendingProps,t),null;case 6:if(e&&null!=n.stateNode)e.memoizedProps!==r&&ii(n);else{if("string"!=typeof r&&null===n.stateNode)throw Error(u(166));if(e=et.current,rX(n)){if(e=n.stateNode,t=n.memoizedProps,r=null,null!==(l=r$))switch(l.tag){case 27:case 5:r=l.memoizedProps}e[eW]=n,(e=!!(e.nodeValue===t||null!==r&&!0===r.suppressHydrationWarning||cn(e.nodeValue,t)))||rK(n,!0)}else(e=cu(e).createTextNode(r))[eW]=n,n.stateNode=e}return ip(n),null;case 31:if(t=n.memoizedState,null===e||null!==e.memoizedState){if(r=rX(n),null!==t){if(null===e){if(!r)throw Error(u(318));if(!(e=null!==(e=n.memoizedState)?e.dehydrated:null))throw Error(u(557));e[eW]=n}else rZ(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;ip(n),e=!1}else t=rJ(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=t),e=!0;if(!e){if(256&n.flags)return l7(n),n;return l7(n),null}if(0!=(128&n.flags))throw Error(u(558))}return ip(n),null;case 13:if(r=n.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(l=rX(n),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(u(318));if(!(l=null!==(l=n.memoizedState)?l.dehydrated:null))throw Error(u(317));l[eW]=n}else rZ(),0==(128&n.flags)&&(n.memoizedState=null),n.flags|=4;ip(n),l=!1}else l=rJ(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l){if(256&n.flags)return l7(n),n;return l7(n),null}}if(l7(n),0!=(128&n.flags))return n.lanes=t,n;return t=null!==r,e=null!==e&&null!==e.memoizedState,t&&(r=n.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),t!==e&&t&&(n.child.flags|=8192),ic(n,n.updateQueue),ip(n),null;case 4:return ea(),null===e&&s1(n.stateNode.containerInfo),n.flags|=0x4000000,ip(n),null;case 10:return r5(n.type),ip(n),null;case 19:if(at(n),null===(r=n.memoizedState))return ip(n),null;if(l=0!=(128&n.flags),null===(a=r.rendering))if(l)id(r,!1);else{if(0!==uO||null!==e&&0!=(128&e.flags))for(e=n.child;null!==e;){if(null!==(a=ar(e))){for(n.flags|=128,id(r,!1),n.updateQueue=e=a.updateQueue,ic(n,e),n.subtreeFlags=0,e=t,t=n.child;null!==t;)rk(t,e),t=t.sibling;return an(n,1&ae.current|2),rH&&rA(n,r.treeForkCount),n.child}e=e.sibling}null!==r.tail&&ev()>uj&&(n.flags|=128,l=!0,id(r,!1),n.lanes=4194304)}else{if(!l)if(null!==(e=ar(a))){if(n.flags|=128,l=!0,n.updateQueue=e=e.updateQueue,ic(n,e),id(r,!0),null===r.tail&&"collapsed"!==r.tailMode&&"visible"!==r.tailMode&&!a.alternate&&!rH)return ip(n),null}else 2*ev()-r.renderingStartTime>uj&&0x20000000!==t&&(n.flags|=128,l=!0,id(r,!1),n.lanes=4194304);r.isBackwards?(a.sibling=n.child,n.child=a):(null!==(e=r.last)?e.sibling=a:n.child=a,r.last=a)}if(null!==r.tail){e=r.tail;e:{for(t=e;null!==t;){if(null!==t.alternate){t=!1;break e}t=t.sibling}t=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ev(),e.sibling=null,a=ae.current,a=l?1&a|2:1&a,"visible"===r.tailMode||"collapsed"===r.tailMode||!t||rH?an(n,a):(t=a,J(l3,n),J(ae,t),null===l4&&(l4=n)),rH&&rA(n,r.treeForkCount),e}return ip(n),null;case 22:case 23:return l7(n),l2(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(ip(n),6&n.subtreeFlags&&(n.flags|=8192)):ip(n),null!==(t=n.updateQueue)&&ic(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&Z(ly),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),r5(li),ip(n),null;case 25:return null;case 30:return n.flags|=0x2000000,ip(n),null}throw Error(u(156,n.tag))}(n.alternate,n,uL);if(null!==t){ux=t;return}if(null!==(n=n.sibling)){ux=n;return}ux=n=e}while(null!==n)0===uO&&(uO=5)}function sm(e,n){do{var t=function(e,n){switch(rV(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return r5(li),ea(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return ei(n),null;case 31:if(null!==n.memoizedState){if(l7(n),null===n.alternate)throw Error(u(340));rZ()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(l7(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(u(340));rZ()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return at(n),65536&(e=n.flags)?(n.flags=-65537&e|128,null!==(e=n.memoizedState)&&(e.rendering=null,e.tail=null),n.flags|=4,n):null;case 4:return ea(),null;case 10:return r5(n.type),null;case 22:case 23:return l7(n),l2(),null!==e&&Z(ly),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return r5(li),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,ux=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){ux=e;return}ux=e=t}while(null!==e)uO=6,ux=null}function sh(e,n,t,r,l,a,o,i,s,c,f){e.cancelPendingCommit=null;do sS();while(0!==uW)if(0!=(6&uS))throw Error(u(327));if(null!==n){var d;if(n===e.current)throw Error(u(177));if(!function(e,n,t,r,l,a){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var i=e.entanglements,u=e.expirationTimes,s=e.hiddenUpdates;for(t=o&~t;0fc){i.length=o;break}d=new Promise(cC.bind(d)),i.push(d)}}}return 0g&&(o=g,g=h,h=o);var v=tB(i,h),y=tB(i,g);if(v&&y&&(1!==p.rangeCount||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var b=f.createRange();b.setStart(v.node,v.offset),p.removeAllRanges(),h>g?(p.addRange(b),p.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),p.addRange(b))}}}}for(f=[],p=i;p=p.parentNode;)1===p.nodeType&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;it?32:t,W.T=null,t=uX,uX=null;var a=uq,o=uY;if(uW=0,uK=uq=null,uY=0,0!=(6&uS))throw Error(u(331));var i=uS;if(uS|=4,uy(a.current),uf(a,a.current,o,t),uS=i,sR(0,!1),eN&&"function"==typeof eN.onPostCommitFiberRoot)try{eN.onPostCommitFiberRoot(ex,a)}catch(e){}return!0}finally{q.p=l,W.T=r,sw(e,n)}}function sx(e,n,t){n=rP(t,n),n=oM(e.stateNode,n,2),null!==(e=lH(e,n,2))&&(eA(e,2),sA(e))}function sN(e,n,t){if(3===e.tag)sx(e,e,t);else for(;null!==n;){if(3===n.tag){sx(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===uQ||!uQ.has(r))){e=rP(t,e),null!==(r=lH(n,t=oA(2),2))&&(oR(t,r,n,e),eA(r,2),sA(r));break}}n=n.return}}function sC(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new uw;var l=new Set;r.set(n,l)}else void 0===(l=r.get(n))&&(l=new Set,r.set(n,l));l.has(t)||(u_=!0,l.add(t),e=sP.bind(null,e,n,t),n.then(e,e))}function sP(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,uE===e&&(uN&t)===t&&(4===uO||3===uO&&(0x3c00000&uN)===uN&&300>ev()-uB?0==(2&uS)&&sr(e,0):uI|=t,uA===uN&&(uA=0)),sA(e)}function sz(e,n){0===n&&(n=eI()),null!==(e=rd(e,n))&&(eA(e,n),sA(e))}function sT(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),sz(e,t)}function s_(e,n){var t=0;switch(e.tag){case 31:case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(t=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(u(314))}null!==r&&r.delete(n),sz(e,t)}var sL=null,sO=null,sD=!1,sF=!1,sI=!1,sM=0;function sA(e){e!==sO&&null===e.next&&(null===sO?sL=sO=e:sO=sO.next=e),sF=!0,sD||(sD=!0,cg(function(){0!=(6&uS)?ep(eb,sU):sV()}))}function sR(e,n){if(!sI&&sF){sI=!0;do for(var t=!1,r=sL;null!==r;){if(!n)if(0!==e){var l=r.pendingLanes;if(0===l)var a=0;else{var o=r.suspendedLanes,i=r.pingedLanes;a=0xc000095&(a=(1<<31-eC(42|e)+1)-1&(l&~(o&~i)))?0xc000095&a|1:a?2|a:0}0!==a&&(t=!0,sj(r,a))}else a=uN,0==(3&(a=eD(r,r===uE?a:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||eF(r,a)||(t=!0,sj(r,a));r=r.next}while(t)sI=!1}}function sU(){sV()}function sV(){sF=sD=!1;var e,n=0;0===sM||((e=window.event)&&"popstate"===e.type?e===cd||(cd=e,0):(cd=null,1))||(n=sM);for(var t=ev(),r=null,l=sL;null!==l;){var a=l.next,o=sB(l,t);0===o?(l.next=null,null===r?sL=a:r.next=a,null===a&&(sO=r)):(r=l,(0!==n||0!=(3&o))&&(sF=!0)),l=a}0!==uW&&5!==uW||sR(n,!1),0!==sM&&(sM=0)}function sB(e,n){for(var t=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0 title"):null)}function fo(e,n){return"img"===e&&null!=n.src&&""!==n.src&&null==n.onLoad&&"lazy"!==n.loading}function fi(e){return"stylesheet"!==e.type||0!=(3&e.state.loading)}function fu(e){return(e.width||100)*(e.height||100)*("number"==typeof devicePixelRatio?devicePixelRatio:1)*.25}function fs(e,n){"function"==typeof n.decode&&(e.imgCount++,n.complete||(e.imgBytes+=fu(n),e.suspenseyImages.push(n)),e=fp.bind(e),n.decode().then(e,e))}var fc=0;function ff(e){if(0===e.count&&(0===e.imgCount||!e.waitingForImages)){if(e.stylesheets)fh(e,e.stylesheets);else if(e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}}}function fd(){this.count--,ff(this)}function fp(){this.imgCount--,ff(this)}var fm=null;function fh(e,n){e.stylesheets=null,null!==e.unsuspend&&(e.count++,fm=new Map,n.forEach(fg,e),fm=null,fd.call(e))}function fg(e,n){if(!(4&n.state.loading)){var t=fm.get(e);if(t)var r=t.get(null);else{t=new Map,fm.set(e,t);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),n.exports=e.r(46480)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/791b17fa51a62bf9.js b/docs/_next/static/chunks/791b17fa51a62bf9.js new file mode 100644 index 00000000..63f48002 --- /dev/null +++ b/docs/_next/static/chunks/791b17fa51a62bf9.js @@ -0,0 +1,52 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,79474,(t,e,i)=>{"use strict";var s=t.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;i.c=function(t){return s.H.useMemoCache(t)}},932,(t,e,i)=>{"use strict";e.exports=t.r(79474)},90072,t=>{"use strict";let e,i,s,r,n,a,o,h,l,u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p="attached",d="detached",m="srgb",f="srgb-linear",g="linear",y="srgb",x={COMPUTE:"compute",RENDER:"render"},b={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},v={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function w(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}let M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function S(t,e){return new M[t](e)}function A(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function C(){let t=_("canvas");return t.style.display="block",t}let T={},I=null;function z(t){I=t}function k(){return I}function B(...t){let e="THREE."+t.shift();I?I("log",e,...t):console.log(e,...t)}function R(...t){let e="THREE."+t.shift();I?I("warn",e,...t):console.warn(e,...t)}function O(...t){let e="THREE."+t.shift();I?I("error",e,...t):console.error(e,...t)}function E(...t){let e=t.join(" ");e in T||(T[e]=!0,R(...t))}function P(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}class L{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return void 0!==i&&void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){let i=this._listeners;if(void 0===i)return;let s=i[t];if(void 0!==s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){let e=this._listeners;if(void 0===e)return;let i=e[t.type];if(void 0!==i){t.target=this;let e=i.slice(0);for(let i=0,s=e.length;i>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&i|128]+N[i>>8&255]+"-"+N[i>>16&255]+N[i>>24&255]+N[255&s]+N[s>>8&255]+N[s>>16&255]+N[s>>24&255]).toLowerCase()}function j(t,e,i){return Math.max(e,Math.min(i,t))}function U(t,e){return(t%e+e)%e}function W(t,e,i){return(1-i)*t+i*e}function G(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/0xffffffff;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/0x7fffffff,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw Error("Invalid component type.")}}function q(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(0xffffffff*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(0x7fffffff*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw Error("Invalid component type.")}}let H={DEG2RAD:$,RAD2DEG:V,generateUUID:D,clamp:j,euclideanModulo:U,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:W,damp:function(t,e,i,s){return W(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(U(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(F=t);let e=F+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000},degToRad:function(t){return t*$},radToDeg:function(t){return t*V},isPowerOfTwo:function(t){return(t&t-1)==0&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){let n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),u=a((e+s)/2),c=n((e-s)/2),p=a((e-s)/2),d=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*u,h*c,h*p,o*l);break;case"YZY":t.set(h*p,o*u,h*c,o*l);break;case"ZXZ":t.set(h*c,h*p,o*u,o*l);break;case"XZX":t.set(o*u,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*u,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*u,o*l);break;default:R("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:q,denormalize:G};class J{constructor(t=0,e=0){J.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class X{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],u=i[s+3],c=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0){t[e+0]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u;return}if(a>=1){t[e+0]=c,t[e+1]=p,t[e+2]=d,t[e+3]=m;return}if(u!==m||o!==c||h!==p||l!==d){let t=o*c+h*p+l*d+u*m;t<0&&(c=-c,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){let i=Math.acos(t),s=Math.sin(i);o=o*(e=Math.sin(e*i)/s)+c*(a=Math.sin(a*i)/s),h=h*e+p*a,l=l*e+d*a,u=u*e+m*a}else{let t=1/Math.sqrt((o=o*e+c*a)*o+(h=h*e+p*a)*h+(l=l*e+d*a)*l+(u=u*e+m*a)*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){let a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],u=r[n],c=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*u+o*p-h*c,t[e+1]=o*d+l*c+h*u-a*p,t[e+2]=h*d+l*p+a*c-o*u,t[e+3]=l*d-a*u-o*c-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),u=a(r/2),c=o(i/2),p=o(s/2),d=o(r/2);switch(n){case"XYZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"YXZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"ZXY":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"ZYX":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"YZX":this._x=c*l*u+h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u-c*p*d;break;case"XZY":this._x=c*l*u-h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u+c*p*d;break;default:R("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){let t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>u){let t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>u){let t=2*Math.sqrt(1+a-i-u);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{let t=2*Math.sqrt(1+u-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=i,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(j(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(0===i)return this;let s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){let t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(t=0,e=0,i=0){Z.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Q.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Q.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),u=2*(r*i-n*e);return this.x=e+o*h+n*u-a*l,this.y=i+o*l+a*h-r*u,this.z=s+o*u+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Y.copy(this).projectOnVector(t),this.sub(Y)}reflect(t){return this.sub(Y.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let Y=new Z,Q=new X;class K{constructor(t,e,i,s,r,n,a,o,h){K.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){let l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],p=i[5],d=i[8],m=s[0],f=s[3],g=s[6],y=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*y+o*v,r[3]=n*f+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*y+u*v,r[4]=h*f+l*x+u*w,r[7]=h*g+l*b+u*M,r[2]=c*m+p*y+d*v,r[5]=c*f+p*x+d*w,r[8]=c*g+p*b+d*M,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*n-a*h,c=a*o-l*r,p=h*r-n*o,d=e*u+i*c+s*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return t[0]=u*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=c*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=p*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,a){let o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(tt.makeScale(t,e)),this}rotate(t){return this.premultiply(tt.makeRotation(-t)),this}translate(t,e){return this.premultiply(tt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}let tt=new K,te=new K().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ti=new K().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ts=(o=[.64,.33,.3,.6,.15,.06],h=[.2126,.7152,.0722],l=[.3127,.329],(a={enabled:!0,workingColorSpace:f,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i&&(this.spaces[e].transfer===y&&(t.r=tr(t.r),t.g=tr(t.g),t.b=tr(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===y&&(t.r=tn(t.r),t.g=tn(t.g),t.b=tn(t.b))),t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?g:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,e){return E("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(t,e)},toWorkingColorSpace:function(t,e){return E("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(t,e)}}).define({[f]:{primaries:o,whitePoint:l,transfer:g,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,workingColorSpaceConfig:{unpackColorSpace:m},outputColorSpaceConfig:{drawingBufferColorSpace:m}},[m]:{primaries:o,whitePoint:l,transfer:y,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,outputColorSpaceConfig:{drawingBufferColorSpace:m}}}),a);function tr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ta{static getDataURL(t,i="image/png"){let s;if(/^data:/i.test(t.src)||"u"typeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap){let e=_("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;ttypeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"u">typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(null!==s){let t;if(Array.isArray(s)){t=[];for(let e=0,i=s.length;etypeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap?ta.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(R("Texture: Unable to serialize Texture."),{})}let tu=0,tc=new Z;class tp extends L{constructor(t=tp.DEFAULT_IMAGE,e=tp.DEFAULT_MAPPING,i=1001,s=1001,r=1006,n=1008,a=1023,o=1009,h=tp.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tu++}),this.uuid=D(),this.name="",this.source=new th(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new K,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!t&&!!t.depth&&t.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(tc).x}get height(){return this.source.getSize(tc).y}get depth(){return this.source.getSize(tc).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(void 0===i){R(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}tp.DEFAULT_IMAGE=null,tp.DEFAULT_MAPPING=300,tp.DEFAULT_ANISOTROPY=1;class td{constructor(t=0,e=0,i=0,s=1){td.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r,n=t.elements,a=n[0],o=n[4],h=n[8],l=n[1],u=n[5],c=n[9],p=n[2],d=n[6],m=n[10];if(.01>Math.abs(o-l)&&.01>Math.abs(h-p)&&.01>Math.abs(c-d)){if(.1>Math.abs(o+l)&&.1>Math.abs(h+p)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+m-3))return this.set(1,0,0,0),this;e=Math.PI;let t=(a+1)/2,n=(u+1)/2,f=(m+1)/2,g=(o+l)/4,y=(h+p)/4,x=(c+d)/4;return t>n&&t>f?t<.01?(i=0,s=.707106781,r=.707106781):(s=g/(i=Math.sqrt(t)),r=y/i):n>f?n<.01?(i=.707106781,s=0,r=.707106781):(i=g/(s=Math.sqrt(n)),r=x/s):f<.01?(i=.707106781,s=.707106781,r=0):(i=y/(r=Math.sqrt(f)),s=x/r),this.set(i,s,r,e),this}let f=Math.sqrt((d-c)*(d-c)+(h-p)*(h-p)+(l-o)*(l-o));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(h-p)/f,this.z=(l-o)/f,this.w=Math.acos((a+u+m-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this.w=j(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this.w=j(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 tm extends L{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new td(0,0,t,e),this.scissorTest=!1,this.viewport=new td(0,0,t,e);const s=new tp({width:t,height:e,depth:i.depth});this.textures=[];const r=i.count;for(let t=0;t1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tM),tM.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tk),tB.subVectors(this.max,tk),tA.subVectors(t.a,tk),t_.subVectors(t.b,tk),tC.subVectors(t.c,tk),tT.subVectors(t_,tA),tI.subVectors(tC,t_),tz.subVectors(tA,tC);let e=[0,-tT.z,tT.y,0,-tI.z,tI.y,0,-tz.z,tz.y,tT.z,0,-tT.x,tI.z,0,-tI.x,tz.z,0,-tz.x,-tT.y,tT.x,0,-tI.y,tI.x,0,-tz.y,tz.x,0];return!!tE(e,tA,t_,tC,tB)&&!!tE(e=[1,0,0,0,1,0,0,0,1],tA,t_,tC,tB)&&(tR.crossVectors(tT,tI),tE(e=[tR.x,tR.y,tR.z],tA,t_,tC,tB))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tM).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tM).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(tw[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),tw[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),tw[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),tw[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),tw[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),tw[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),tw[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),tw[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(tw)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}let tw=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tM=new Z,tS=new tv,tA=new Z,t_=new Z,tC=new Z,tT=new Z,tI=new Z,tz=new Z,tk=new Z,tB=new Z,tR=new Z,tO=new Z;function tE(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){tO.fromArray(t,n);let a=r.x*Math.abs(tO.x)+r.y*Math.abs(tO.y)+r.z*Math.abs(tO.z),o=e.dot(tO),h=i.dot(tO),l=s.dot(tO);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}let tP=new tv,tL=new Z,tN=new Z;class tF{constructor(t=new Z,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;void 0!==e?i.copy(e):tP.setFromPoints(t).getCenter(i);let s=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;tL.subVectors(t,this.center);let e=tL.lengthSq();if(e>this.radius*this.radius){let t=Math.sqrt(e),i=(t-this.radius)*.5;this.center.addScaledVector(tL,i/t),this.radius+=i}return this}union(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(tN.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(tL.copy(t.center).add(tN)),this.expandByPoint(tL.copy(t.center).sub(tN)))),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let t$=new Z,tV=new Z,tD=new Z,tj=new Z,tU=new Z,tW=new Z,tG=new Z;class tq{constructor(t=new Z,e=new Z(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,t$)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=t$.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(t$.copy(this.origin).addScaledVector(this.direction,e),t$.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){let r,n,a,o;tV.copy(t).add(e).multiplyScalar(.5),tD.copy(e).sub(t).normalize(),tj.copy(this.origin).sub(tV);let h=.5*t.distanceTo(e),l=-this.direction.dot(tD),u=tj.dot(this.direction),c=-tj.dot(tD),p=tj.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(r=l*c-u,n=l*u-c,o=h*d,r>=0)if(n>=-o)if(n<=o){let t=1/d;r*=t,n*=t,a=r*(r+l*n+2*u)+n*(l*r+n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=h)+u)))*r+n*(n+2*c)+p;else a=-(r=Math.max(0,-(l*(n=-h)+u)))*r+n*(n+2*c)+p;else n<=-o?(n=(r=Math.max(0,-(-l*h+u)))>0?-h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p):n<=o?(r=0,a=(n=Math.min(Math.max(-h,-c),h))*(n+2*c)+p):(n=(r=Math.max(0,-(l*h+u)))>0?h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p);else n=l>0?-h:h,a=-(r=Math.max(0,-(l*n+u)))*r+n*(n+2*c)+p;return i&&i.copy(this.origin).addScaledVector(this.direction,r),s&&s.copy(tV).addScaledVector(tD,n),a}intersectSphere(t,e){t$.subVectors(t.center,this.origin);let i=t$.dot(this.direction),s=t$.dot(t$)-i*i,r=t.radius*t.radius;if(s>r)return null;let n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return!!(0===e||t.normal.dot(this.direction)*e<0)}intersectBox(t,e){let i,s,r,n,a,o,h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(h>=0?(i=(t.min.x-c.x)*h,s=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,s=(t.min.x-c.x)*h),l>=0?(r=(t.min.y-c.y)*l,n=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,n=(t.min.y-c.y)*l),i>n||r>s||((r>i||isNaN(i))&&(i=r),(n=0?(a=(t.min.z-c.z)*u,o=(t.max.z-c.z)*u):(a=(t.max.z-c.z)*u,o=(t.min.z-c.z)*u),i>o||a>s||((a>i||i!=i)&&(i=a),(o=0?i:s,e)}intersectsBox(t){return null!==this.intersectBox(t,t$)}intersectTriangle(t,e,i,s,r){let n;tU.subVectors(e,t),tW.subVectors(i,t),tG.crossVectors(tU,tW);let a=this.direction.dot(tG);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}tj.subVectors(this.origin,t);let o=n*this.direction.dot(tW.crossVectors(tj,tW));if(o<0)return null;let h=n*this.direction.dot(tU.cross(tj));if(h<0||o+h>a)return null;let l=-n*tj.dot(tG);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tH{constructor(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){tH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f)}set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=s,g[1]=r,g[5]=n,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=p,g[7]=d,g[11]=m,g[15]=f,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 tH().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1)):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();let e=this.elements,i=t.elements,s=1/tJ.setFromMatrixColumn(t,0).length(),r=1/tJ.setFromMatrixColumn(t,1).length(),n=1/tJ.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(s),h=Math.sin(s),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+s*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=s+i*h,e[10]=n*o}else if("YXZ"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t+r*a,e[4]=s*a-i,e[8]=n*h,e[1]=n*u,e[5]=n*l,e[9]=-a,e[2]=i*a-s,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t-r*a,e[4]=-n*u,e[8]=s+i*a,e[1]=i+s*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=s*h-i,e[8]=t*h+r,e[1]=o*u,e[5]=r*h+t,e[9]=i*h-s,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=r-t*u,e[8]=s*u+i,e[1]=u,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+s,e[10]=t-r*u}else if("XZY"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+r,e[5]=n*l,e[9]=i*u-s,e[2]=s*u-i,e[6]=a*l,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(tZ,t,tY)}lookAt(t,e,i){let s=this.elements;return t0.subVectors(t,e),0===t0.lengthSq()&&(t0.z=1),t0.normalize(),tQ.crossVectors(i,t0),0===tQ.lengthSq()&&(1===Math.abs(i.z)?t0.x+=1e-4:t0.z+=1e-4,t0.normalize(),tQ.crossVectors(i,t0)),tQ.normalize(),tK.crossVectors(t0,tQ),s[0]=tQ.x,s[4]=tK.x,s[8]=t0.x,s[1]=tQ.y,s[5]=tK.y,s[9]=t0.y,s[2]=tQ.z,s[6]=tK.z,s[10]=t0.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],b=i[11],v=i[15],w=s[0],M=s[4],S=s[8],A=s[12],_=s[1],C=s[5],T=s[9],I=s[13],z=s[2],k=s[6],B=s[10],R=s[14],O=s[3],E=s[7],P=s[11],L=s[15];return r[0]=n*w+a*_+o*z+h*O,r[4]=n*M+a*C+o*k+h*E,r[8]=n*S+a*T+o*B+h*P,r[12]=n*A+a*I+o*R+h*L,r[1]=l*w+u*_+c*z+p*O,r[5]=l*M+u*C+c*k+p*E,r[9]=l*S+u*T+c*B+p*P,r[13]=l*A+u*I+c*R+p*L,r[2]=d*w+m*_+f*z+g*O,r[6]=d*M+m*C+f*k+g*E,r[10]=d*S+m*T+f*B+g*P,r[14]=d*A+m*I+f*R+g*L,r[3]=y*w+x*_+b*z+v*O,r[7]=y*M+x*C+b*k+v*E,r[11]=y*S+x*T+b*B+v*P,r[15]=y*A+x*I+b*R+v*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],p=t[14],d=t[3],m=t[7],f=t[11],g=t[15],y=o*p-h*c,x=a*p-h*u,b=a*c-o*u,v=n*p-h*l,w=n*c-o*l,M=n*u-a*l;return e*(m*y-f*x+g*b)-i*(d*y-f*v+g*w)+s*(d*x-m*v+g*M)-r*(d*b-m*w+f*M)}transpose(){let t,e=this.elements;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(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=u*f*h-m*c*h+m*o*p-a*f*p-u*o*g+a*c*g,x=d*c*h-l*f*h-d*o*p+n*f*p+l*o*g-n*c*g,b=l*m*h-d*u*h+d*a*p-n*m*p-l*a*g+n*u*g,v=d*u*o-l*m*o-d*a*c+n*m*c+l*a*f-n*u*f,w=e*y+i*x+s*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let M=1/w;return t[0]=y*M,t[1]=(m*c*r-u*f*r-m*s*p+i*f*p+u*s*g-i*c*g)*M,t[2]=(a*f*r-m*o*r+m*s*h-i*f*h-a*s*g+i*o*g)*M,t[3]=(u*o*r-a*c*r-u*s*h+i*c*h+a*s*p-i*o*p)*M,t[4]=x*M,t[5]=(l*f*r-d*c*r+d*s*p-e*f*p-l*s*g+e*c*g)*M,t[6]=(d*o*r-n*f*r-d*s*h+e*f*h+n*s*g-e*o*g)*M,t[7]=(n*c*r-l*o*r+l*s*h-e*c*h-n*s*p+e*o*p)*M,t[8]=b*M,t[9]=(d*u*r-l*m*r-d*i*p+e*m*p+l*i*g-e*u*g)*M,t[10]=(n*m*r-d*a*r+d*i*h-e*m*h-n*i*g+e*a*g)*M,t[11]=(l*a*r-n*u*r-l*i*h+e*u*h+n*i*p-e*a*p)*M,t[12]=v*M,t[13]=(l*m*s-d*u*s+d*i*c-e*m*c-l*i*f+e*u*f)*M,t[14]=(d*a*s-n*m*s-d*i*o+e*m*o+n*i*f-e*a*f)*M,t[15]=(n*u*s-l*a*s+l*i*o-e*u*o-n*i*c+e*a*c)*M,this}scale(t){let e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+i,h*a-s*o,h*o+s*a,0,h*a+s*o,l*a+i,l*o-s*n,0,h*o-s*a,l*o+s*n,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,u=a+a,c=r*h,p=r*l,d=r*u,m=n*l,f=n*u,g=a*u,y=o*h,x=o*l,b=o*u,v=i.x,w=i.y,M=i.z;return s[0]=(1-(m+g))*v,s[1]=(p+b)*v,s[2]=(d-x)*v,s[3]=0,s[4]=(p-b)*w,s[5]=(1-(c+g))*w,s[6]=(f+y)*w,s[7]=0,s[8]=(d+x)*M,s[9]=(f-y)*M,s[10]=(1-(c+m))*M,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],0===this.determinant())return i.set(1,1,1),e.identity(),this;let r=tJ.set(s[0],s[1],s[2]).length(),n=tJ.set(s[4],s[5],s[6]).length(),a=tJ.set(s[8],s[9],s[10]).length();0>this.determinant()&&(r=-r),tX.copy(this);let o=1/r,h=1/n,l=1/a;return tX.elements[0]*=o,tX.elements[1]*=o,tX.elements[2]*=o,tX.elements[4]*=h,tX.elements[5]*=h,tX.elements[6]*=h,tX.elements[8]*=l,tX.elements[9]*=l,tX.elements[10]*=l,e.setFromRotationMatrix(tX),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=r/(n-r),l=n*r/(n-r);else if(2e3===a)h=-(n+r)/(n-r),l=-2*n*r/(n-r);else if(2001===a)h=-n/(n-r),l=-n*r/(n-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=2*r/(e-t),u[4]=0,u[8]=(e+t)/(e-t),u[12]=0,u[1]=0,u[5]=2*r/(i-s),u[9]=(i+s)/(i-s),u[13]=0,u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=1/(n-r),l=n/(n-r);else if(2e3===a)h=-2/(n-r),l=-(n+r)/(n-r);else if(2001===a)h=-1/(n-r),l=-r/(n-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=2/(e-t),u[4]=0,u[8]=0,u[12]=-(e+t)/(e-t),u[1]=0,u[5]=2/(i-s),u[9]=0,u[13]=-(i+s)/(i-s),u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let tJ=new Z,tX=new tH,tZ=new Z(0,0,0),tY=new Z(1,1,1),tQ=new Z,tK=new Z,t0=new Z,t1=new tH,t2=new X;class t3{constructor(t=0,e=0,i=0,s=t3.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,r=s[0],n=s[4],a=s[8],o=s[1],h=s[5],l=s[9],u=s[2],c=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(j(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-j(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-j(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(j(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-j(n,-1,1)),.9999999>Math.abs(n)?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:R("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return t1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(t1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return t2.setFromEuler(this),this.setFromQuaternion(t2,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}t3.DEFAULT_ORDER="XYZ";class t5{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){let i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e0){s.children=[];for(let e=0;e0){s.animations=[];for(let e=0;e0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=s,i;function n(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){ec.subVectors(s,e),ep.subVectors(i,e),ed.subVectors(t,e);let n=ec.dot(ec),a=ec.dot(ep),o=ec.dot(ed),h=ep.dot(ep),l=ep.dot(ed),u=n*h-a*a;if(0===u)return r.set(0,0,0),null;let c=1/u,p=(h*o-a*l)*c,d=(n*l-a*o)*c;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,em)&&em.x>=0&&em.y>=0&&em.x+em.y<=1}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,em)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,em.x),o.addScaledVector(n,em.y),o.addScaledVector(a,em.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return ew.setScalar(0),eM.setScalar(0),eS.setScalar(0),ew.fromBufferAttribute(t,e),eM.fromBufferAttribute(t,i),eS.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(ew,r.x),n.addScaledVector(eM,r.y),n.addScaledVector(eS,r.z),n}static isFrontFacing(t,e,i,s){return ec.subVectors(i,e),ep.subVectors(t,e),0>ec.cross(ep).dot(s)}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ec.subVectors(this.c,this.b),ep.subVectors(this.a,this.b),.5*ec.cross(ep).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return eA.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return eA.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return eA.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return eA.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return eA.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,s,r=this.a,n=this.b,a=this.c;ef.subVectors(n,r),eg.subVectors(a,r),ex.subVectors(t,r);let o=ef.dot(ex),h=eg.dot(ex);if(o<=0&&h<=0)return e.copy(r);eb.subVectors(t,n);let l=ef.dot(eb),u=eg.dot(eb);if(l>=0&&u<=l)return e.copy(n);let c=o*u-l*h;if(c<=0&&o>=0&&l<=0)return i=o/(o-l),e.copy(r).addScaledVector(ef,i);ev.subVectors(t,a);let p=ef.dot(ev),d=eg.dot(ev);if(d>=0&&p<=d)return e.copy(a);let m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return s=h/(h-d),e.copy(r).addScaledVector(eg,s);let f=l*d-p*u;if(f<=0&&u-l>=0&&p-d>=0)return ey.subVectors(a,n),s=(u-l)/(u-l+(p-d)),e.copy(n).addScaledVector(ey,s);let g=1/(f+m+c);return i=m*g,s=c*g,e.copy(r).addScaledVector(ef,i).addScaledVector(eg,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let e_={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},eC={h:0,s:0,l:0},eT={h:0,s:0,l:0};function eI(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*6*(2/3-i):t}class ez{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){return void 0===e&&void 0===i?t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t):this.setRGB(t,e,i),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=m){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ts.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=ts.workingColorSpace){return this.r=t,this.g=e,this.b=i,ts.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=ts.workingColorSpace){if(t=U(t,1),e=j(e,0,1),i=j(i,0,1),0===e)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=eI(r,s,t+1/3),this.g=eI(r,s,t),this.b=eI(r,s,t-1/3)}return ts.colorSpaceToWorking(this,s),this}setStyle(t,e=m){let i;function s(e){void 0!==e&&1>parseFloat(e)&&R("Color: Alpha component of "+t+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:R("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);R("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=m){let i=e_[t.toLowerCase()];return void 0!==i?this.setHex(i,e):R("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=tr(t.r),this.g=tr(t.g),this.b=tr(t.b),this}copyLinearToSRGB(t){return this.r=tn(t.r),this.g=tn(t.g),this.b=tn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=m){return ts.workingToColorSpace(ek.copy(this),t),65536*Math.round(j(255*ek.r,0,255))+256*Math.round(j(255*ek.g,0,255))+Math.round(j(255*ek.b,0,255))}getHexString(t=m){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ts.workingColorSpace){let i,s;ts.workingToColorSpace(ek.copy(this),e);let r=ek.r,n=ek.g,a=ek.b,o=Math.max(r,n,a),h=Math.min(r,n,a),l=(h+o)/2;if(h===o)i=0,s=0;else{let t=o-h;switch(s=l<=.5?t/(o+h):t/(2-o-h),o){case r:i=(n-a)/t+6*(n0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i){R(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(null!==e){let t=e.length;i=Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class eO extends eR{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}let eE=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){let e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}let n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;(8388608&e)==0;)e<<=1,i-=8388608;e&=-8388609,i+=0x38800000,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=0x38000000+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=0x47800000,a[32]=0x80000000;for(let t=33;t<63;++t)a[t]=0x80000000+(t-32<<23);a[63]=0xc7800000;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}();function eP(t){Math.abs(t)>65504&&R("DataUtils.toHalfFloat(): Value out of range."),t=j(t,-65504,65504),eE.floatView[0]=t;let e=eE.uint32View[0],i=e>>23&511;return eE.baseTable[i]+((8388607&e)>>eE.shiftTable[i])}function eL(t){let e=t>>10;return eE.uint32View[0]=eE.mantissaTable[eE.offsetTable[e]+(1023&t)]+eE.exponentTable[e],eE.floatView[0]}class eN{static toHalfFloat(t){return eP(t)}static fromHalfFloat(t){return eL(t)}}let eF=new Z,e$=new J,eV=0;class eD{constructor(t,e,i=!1){if(Array.isArray(t))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:eV++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;se.count&&R("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){O("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(Infinity,Infinity,Infinity));return}if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let e in i){let s=i[e];t.data.attributes[e]=s.toJSON(t.data)}let s={},r=!1;for(let e in this.morphAttributes){let i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone());let s=t.attributes;for(let t in s){let i=s[t];this.setAttribute(t,i.clone(e))}let r=t.morphAttributes;for(let t in r){let i=[],s=r[t];for(let t=0,r=s.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t(t.far-t.near)**2)||(e4.copy(r).invert(),e6.copy(t.ray).applyMatrix4(e4),(null===i.boundingBox||!1!==e6.intersectsBox(i.boundingBox))&&this._computeIntersections(t,e,e6)))}_computeIntersections(t,e,i){let s,r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,c=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=c.length;ri.far?null:{distance:h,point:ia.clone(),object:t}}(t,e,i,s,e7,it,ie,ir);if(u){let t=new Z;eA.getBarycoord(ir,e7,it,ie,t),r&&(u.uv=eA.getInterpolatedAttribute(r,o,h,l,t,new J)),n&&(u.uv1=eA.getInterpolatedAttribute(n,o,h,l,t,new J)),a&&(u.normal=eA.getInterpolatedAttribute(a,o,h,l,t,new Z),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));let e={a:o,b:h,c:l,normal:new Z,materialIndex:0};eA.getNormal(e7,it,ie,e.normal),u.face=e,u.barycoord=t}return u}class il extends e5{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r);const o=[],h=[],l=[],u=[];let c=0,p=0;function d(t,e,i,s,r,n,d,m,f,g,y){let x=n/f,b=d/g,v=n/2,w=d/2,M=m/2,S=f+1,A=g+1,_=0,C=0,T=new Z;for(let n=0;n0?1:-1,l.push(T.x,T.y,T.z),u.push(o/f),u.push(1-n/g),_+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ig extends eu{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tH,this.projectionMatrix=new tH,this.projectionMatrixInverse=new tH,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let iy=new Z,ix=new J,ib=new J;class iv extends ig{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*V*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*$*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*$*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){iy.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(iy.x,iy.y).multiplyScalar(-t/iy.z),iy.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(iy.x,iy.y).multiplyScalar(-t/iy.z)}getViewSize(t,e){return this.getViewBounds(t,ix,ib),e.subVectors(ib,ix)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*$*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s,n=this.view;if(null!==this.view&&this.view.enabled){let t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*s/t,e-=n.offsetY*i/a,s*=n.width/t,i*=n.height/a}let a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class iw extends eu{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new iv(-90,1,t,e);s.layers=this.layers,this.add(s);const r=new iv(-90,1,t,e);r.layers=this.layers,this.add(r);const n=new iv(-90,1,t,e);n.layers=this.layers,this.add(n);const a=new iv(-90,1,t,e);a.layers=this.layers,this.add(a);const o=new iv(-90,1,t,e);o.layers=this.layers,this.add(o);const h=new iv(-90,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(let t of e)this.remove(t);if(2e3===t)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===t)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,n,a,o,h,l]=this.children,u=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,o),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,c,p),t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class iM extends tp{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class iS extends tf{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1};this.texture=new iM([i,i,i,i,i,i]),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let 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 ); + + } + `},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(he.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i0)for(let r=e;r=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x=s.x&&s.x>=h&&r!==s.x&&rW(ni.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;ne&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;rr3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t0)&&p.push(e,r,h),(t!==i-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t=r)){let a=e[1];t=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"u"{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,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(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(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(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[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 t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s1){let t=!1,e=0;for(let t=0,e=c.length;tNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"u">typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"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_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},53487,(t,e,i)=>{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("u">typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}let m=new Map(Object.keys(r.missions).map(t=>[t.toLowerCase(),t]));function f(t){let e=t.replace(/-/g,"_").toLowerCase();return m.get(e)??null}t.s(["findMissionByDemoName",()=>f,"getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};ieS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew{"use strict";var e=t.i(90072);t.s(["parse",()=>E,"runServer",()=>N],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)} +${r} +${this.line("});")}`}{let e=t.name.name;this.currentFunction=e.toLowerCase();let i=this.functionBody(t.body,t.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(e)}, function() {`)} +${i} +${this.line("});")}`}}functionBody(t,e){this.indentLevel++;let i=[];i.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let t=0;tthis.statement(t)).join("\n\n");return this.indentLevel--,`${this.line(`${this.runtime}.package(${e}, function() {`)} +${i} +${this.line("});")}`}datablockDeclaration(t){let e=JSON.stringify(t.className.name),i=t.instanceName?JSON.stringify(t.instanceName.name):"null",s=t.parent?JSON.stringify(t.parent.name):"null",r=this.objectBody(t.body);return this.line(`${this.runtime}.datablock(${e}, ${i}, ${s}, ${r});`)}objectDeclaration(t){let e="Identifier"===t.className.type?JSON.stringify(t.className.name):this.expression(t.className),i=null===t.instanceName?"null":"Identifier"===t.instanceName.type?JSON.stringify(t.instanceName.name):this.expression(t.instanceName),s=[],r=[];for(let e of t.body)"Assignment"===e.type?s.push(e):r.push(e);let n=this.objectBody(s);if(r.length>0){let t=r.map(t=>this.objectDeclaration(t)).join(",\n");return`${this.runtime}.create(${e}, ${i}, ${n}, [ +${t} +])`}return`${this.runtime}.create(${e}, ${i}, ${n})`}objectBody(t){if(0===t.length)return"{}";let e=[];for(let i of t)if("Assignment"===i.type){let t=this.expression(i.value);if("Identifier"===i.target.type){let s=i.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?e.push(`${s}: ${t}`):e.push(`[${JSON.stringify(s)}]: ${t}`)}else if("IndexExpression"===i.target.type){let s=this.objectPropertyKey(i.target);e.push(`[${s}]: ${t}`)}else{let s=this.expression(i.target);e.push(`[${s}]: ${t}`)}}if(e.length<=1)return`{ ${e.join(", ")} }`;let i=this.indent.repeat(this.indentLevel+1),s=this.indent.repeat(this.indentLevel);return`{ +${i}${e.join(",\n"+i)} +${s}}`}objectPropertyKey(t){let e="Identifier"===t.object.type?JSON.stringify(t.object.name):this.expression(t.object),i=Array.isArray(t.index)?t.index.map(t=>this.expression(t)).join(", "):this.expression(t.index);return`${this.runtime}.key(${e}, ${i})`}ifStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.consequent);if(t.alternate)if("IfStatement"===t.alternate.type){let s=this.ifStatement(t.alternate).replace(/^\s*/,"");return this.line(`if (${e}) ${i} else ${s}`)}else{let s=this.statementAsBlock(t.alternate);return this.line(`if (${e}) ${i} else ${s}`)}return this.line(`if (${e}) ${i}`)}forStatement(t){let e=t.init?this.expression(t.init):"",i=t.test?this.expression(t.test):"",s=t.update?this.expression(t.update):"",r=this.statementAsBlock(t.body);return this.line(`for (${e}; ${i}; ${s}) ${r}`)}whileStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.body);return this.line(`while (${e}) ${i}`)}doWhileStatement(t){let e=this.statementAsBlock(t.body),i=this.expression(t.test);return this.line(`do ${e} while (${i});`)}switchStatement(t){if(t.stringMode)return this.switchStringStatement(t);let e=this.expression(t.discriminant);this.indentLevel++;let i=[];for(let e of t.cases)i.push(this.switchCase(e));return this.indentLevel--,`${this.line(`switch (${e}) {`)} +${i.join("\n")} +${this.line("}")}`}switchCase(t){let e=[];if(null===t.test)e.push(this.line("default:"));else if(Array.isArray(t.test))for(let i of t.test)e.push(this.line(`case ${this.expression(i)}:`));else e.push(this.line(`case ${this.expression(t.test)}:`));for(let i of(this.indentLevel++,t.consequent))e.push(this.statement(i));return e.push(this.line("break;")),this.indentLevel--,e.join("\n")}switchStringStatement(t){let e=this.expression(t.discriminant),i=[];for(let e of t.cases)if(null===e.test)i.push(`default: () => { ${this.blockContent(e.consequent)} }`);else if(Array.isArray(e.test))for(let t of e.test)i.push(`${this.expression(t)}: () => { ${this.blockContent(e.consequent)} }`);else i.push(`${this.expression(e.test)}: () => { ${this.blockContent(e.consequent)} }`);return this.line(`${this.runtime}.switchStr(${e}, { ${i.join(", ")} });`)}returnStatement(t){return t.value?this.line(`return ${this.expression(t.value)};`):this.line("return;")}blockStatement(t){this.indentLevel++;let e=t.body.map(t=>this.statement(t)).join("\n");return this.indentLevel--,`{ +${e} +${this.line("}")}`}statementAsBlock(t){if("BlockStatement"===t.type)return this.blockStatement(t);this.indentLevel++;let e=this.statement(t);return this.indentLevel--,`{ +${e} +${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>R,"createScriptCache",()=>I],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;se&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;ne().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return is)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return is)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(t){return t.toLowerCase()}function w(t){let e=t.trim();return v(e.startsWith("$")?e.slice(1):e)}function M(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function S(t,e){for(let i of e)t.add(v(i))}function A(t,e,i){if(t.anyClassValues.has("*")||t.anyClassValues.has(i))return!0;for(let s of e){let e=t.valuesByClass.get(v(s));if(e&&(e.has("*")||e.has(i)))return!0}return!1}let _=[{classNames:["SceneObject","GameBase","ShapeBase","Item","Player"],fields:["position","rotation","scale","transform","hidden","renderingdistance","datablock","shapename","shapefile","initialbarrel","skin","team","health","energy","energylevel","damagelevel","damageflash","damagepercent","damagestate","mountobject","mountedimage","targetposition","targetrotation","targetscale","missiontypeslist","renderenabled","vis","velocity","name"]},{classNames:["*"],fields:["position","rotation","scale","hidden","shapefile","datablock"]}],C=[{classNames:["SceneObject","GameBase","ShapeBase","SimObject"],methods:["settransform","setposition","setrotation","setscale","sethidden","setdatablock","setshapename","mountimage","unmountimage","mountobject","unmountobject","setdamagelevel","setenergylevel","schedule","delete","deleteallobjects","add","remove","playthread","stopthread","setthreaddir","pausethread"]},{classNames:["*"],methods:["settransform","setscale","delete","add","remove"]}],T=["missionrunning","loadingmission"];function I(){return{scripts:new Map,generatedCode:new WeakMap}}function z(t){return t.toLowerCase()}function k(t){return Number(t)>>>0}function B(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function R(t={}){let e,i,s,r=t.reactiveFieldRules??_,u=t.reactiveMethodRules??C,c=t.reactiveGlobalNames??T,p=(e=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.fields);continue}S(M(i,r),s.fields)}return{anyClassValues:e,valuesByClass:i}}(r),(t,i)=>A(e,t,v(i))),d=(i=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.methods);continue}S(M(i,r),s.methods)}return{anyClassValues:e,valuesByClass:i}}(u),(t,e)=>A(i,t,v(e))),m=(s=function(t){let e=new Set;for(let i of t)e.add(w(i));return e}(c),t=>{let e=w(t);return s.has("*")||s.has(e)}),f=new o,g=new o,y=new o,x=[],O=new h,P=3,L=1027,N=new Map,F=new o,$=new o,V=new o,D=new o,j=new o,U=new Set,W=[],G=!1,q=0;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);V.set(e.slice(1),i)}let H=new Set,J=new Set,X=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,Z=t.cache??I(),Y=Z.scripts,Q=Z.generatedCode,K=new Map;function tt(t){let e=K.get(t);return e&&e.length>0?e[e.length-1]:void 0}function te(t,e,i){let s;(s=K.get(t))||(s=[],K.set(t,s)),s.push(e);try{return i()}finally{let e;(e=K.get(t))&&e.pop()}}function ti(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function ts(t,e){return f.get(t)?.get(e)??null}function tr(t){if(!t)return[];let e=[],i=new Set,s=t.class||t._className||t._class,r=s?z(String(s)):"";for(;r&&!i.has(r);)e.push(r),i.add(r),r=j.get(r)??"";return t._superClass&&!i.has(t._superClass)&&e.push(t._superClass),e}function tn(){if(G=!1,0===W.length)return;let t=W.splice(0,W.length);for(let e of(q+=1,U))e({type:"batch.flushed",tick:q,events:t})}function ta(t){for(let e of(W.push(t),U))e(t);G||(G=!0,queueMicrotask(tn))}function to(t){ta({type:"object.created",objectId:t._id,object:t})}function th(t,e,i,s){let r=z(e);Object.is(i,s)||p(tr(t),r)&&ta({type:"field.changed",objectId:t._id,field:r,value:i,previousValue:s,object:t})}let tl=new Set,tu=null,tc=null,tp=(t.builtins??b)({runtime:()=>tc,fileSystem:t.fileSystem??null});function td(t){let e=y.get(t);if(!e)return void O.add(t);if(!e.active){for(let[t,i]of(e.active=!0,x.push(e.name),e.methods)){f.has(t)||f.set(t,new o);let e=f.get(t);for(let[t,s]of i)e.has(t)||e.set(t,[]),e.get(t).push(s)}for(let[t,i]of e.functions)g.has(t)||g.set(t,[]),g.get(t).push(i)}}function tm(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?F.get(t)??null:"number"==typeof t?N.get(t)??null:null}function tf(t,e,i){let s=tm(t);if(null==s)return 0;let r=tb(s[e]);return s[e]=r+i,th(s,e,s[e],r),r}function tg(t,e){let i=ts(t,e);return i&&i.length>0?i[i.length-1]:null}function ty(t,e,i,s){let r=ts(t,e);return r&&0!==r.length?{found:!0,result:te(ti(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function tx(t,e,i,s){let r;d((r=tr(i)).length?r:[t],e)&&ta({type:"method.called",className:z(t),methodName:z(e),objectId:i._id,args:[...s]});let n=D.get(t);if(n){let t=n.get(e);if(t)for(let e of t)e(i,...s)}}function tb(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function tv(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;te._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function tw(t){return null==t||""===t?null:tv(String(t))}function tM(t,e){function i(t,e){return t+e.join("_")}return{get:(e,...s)=>t.get(i(e,s))??"",set(s,...r){if(0===r.length)throw Error("set() requires at least a value argument");if(1===r.length){let i=t.get(s);return t.set(s,r[0]),e?.onSet?.(s,r[0],i),r[0]}let n=r[r.length-1],a=i(s,r.slice(0,-1)),o=t.get(a);return t.set(a,n),e?.onSet?.(a,n,o),n},postInc(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a+1;return t.set(n,o),e?.onSet?.(n,o,a),a},postDec(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a-1;return t.set(n,o),e?.onSet?.(n,o,a),a}}}function tS(){return tM(new o)}let tA={registerMethod:function(t,e,i){if(tu)tu.methods.has(t)||tu.methods.set(t,new o),tu.methods.get(t).set(e,i);else{f.has(t)||f.set(t,new o);let s=f.get(t);s.has(e)||s.set(e,[]),s.get(e).push(i)}},registerFunction:function(t,e){tu?tu.functions.set(t,e):(g.has(t)||g.set(t,[]),g.get(t).push(e))},package:function(t,e){let i=y.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},y.set(t,i));let s=tu;tu=i,e(),tu=s,O.has(t)&&(O.delete(t),td(t))},activatePackage:td,deactivatePackage:function(t){let e=y.get(t);if(!e||!e.active)return;e.active=!1;let i=x.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,s]of(-1!==i&&x.splice(i,1),e.methods)){let e=f.get(t);if(e)for(let[t,i]of s){let s=e.get(t);if(s){let t=s.indexOf(i);-1!==t&&s.splice(t,1)}}}for(let[t,i]of e.functions){let e=g.get(t);if(e){let t=e.indexOf(i);-1!==t&&e.splice(t,1)}}},create:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(L);)L+=1;let t=L;return L+=1,t}(),a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[z(t)]=e;a.superclass&&(a._superClass=z(String(a.superclass)),a.class&&j.set(z(String(a.class)),a._superClass)),N.set(n,a);let o=B(e);if(o&&(a._name=o,F.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=tg(t,"onAdd");return h&&h(a),to(a),a},datablock:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(P);)P+=1;let t=P;return P+=1,t}(),a={_class:r,_className:t,_id:n,_isDatablock:!0},o=B(i);if(o){let t=$.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[z(t)]=e;N.set(n,a);let h=B(e);return h&&(a._name=h,F.set(h,a),$.set(h,a)),to(a),a},deleteObject:function t(e){var i;let s;if(null==e||("number"==typeof e?s=N.get(e):"string"==typeof e?s=F.get(e):"object"==typeof e&&e._id&&(s=e),!s))return!1;let r=tg(s._className,"onRemove");if(r&&r(s),N.delete(s._id),s._name&&F.delete(s._name),s._isDatablock&&s._name&&$.delete(s._name),s._parent&&s._parent._children){let t=s._parent._children.indexOf(s);-1!==t&&s._parent._children.splice(t,1)}if(s._children)for(let e of[...s._children])t(e);return ta({type:"object.deleted",objectId:(i=s)._id,object:i}),!0},prop:function(t,e){let i=tm(t);return null==i?"":i[z(e)]??""},setProp:function(t,e,i){let s=tm(t);if(null==s)return i;let r=z(e),n=s[r];return s[r]=i,th(s,r,i,n),i},getIndex:function(t,e){let i=tm(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=tm(t);if(null==s)return i;let r=String(e),n=s[r];return s[r]=i,th(s,r,i,n),i},propPostInc:function(t,e){return tf(t,z(e),1)},propPostDec:function(t,e){return tf(t,z(e),-1)},indexPostInc:function(t,e){return tf(t,String(e),1)},indexPostDec:function(t,e){return tf(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=tw(t)))return"";let s=t.class||t._className||t._class;if(s){let r=ty(s,e,t,i);if(r.found)return tx(s,e,t,i),r.result}let r=t._superClass||j.get(s);for(;r;){let s=ty(r,e,t,i);if(s.found)return tx(r,e,t,i),s.result;r=j.get(r)}return""},nsCall:function(t,e,...i){let s=ts(t,e);if(!s||0===s.length)return"";let r=ti(t,e),n=s[s.length-1],a=te(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&tx(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=ts(t,e);if(!i||0===i.length)return null;let s=ti(t,e),r=i[i.length-1];return(...t)=>te(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=ts(t,e),n=ti(t,e),a=tt(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=te(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&tx(t,e,i,s),h}let o=j.get(t);for(;o;){let t=ts(o,e);if(t&&t.length>0){let r=te(ti(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&tx(o,e,i,s),r}o=j.get(o)}return""},parentFunc:function(t,...e){let i=g.get(t);if(!i)return"";let s=t.toLowerCase(),r=tt(s);if(void 0===r||r<1)return"";let n=r-1;return te(s,n,()=>i[n](...e))},add:function(t,e){return tb(t)+tb(e)},sub:function(t,e){return tb(t)-tb(e)},mul:function(t,e){return tb(t)*tb(e)},div:function(t,e){return tb(t)/tb(e)},neg:function(t){return-tb(t)},lt:function(t,e){return tb(t)tb(e)},ge:function(t,e){return tb(t)>=tb(e)},eq:function(t,e){return tb(t)===tb(e)},ne:function(t,e){return tb(t)!==tb(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return k(t)&k(e)},bitor:function(t,e){return k(t)|k(e)},bitxor:function(t,e){return k(t)^k(e)},shl:function(t,e){return k(k(t)<<(31&k(e)))},shr:function(t,e){return k(t)>>>(31&k(e))},bitnot:function(t){return~k(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&z(t)===i)return void s();e.default&&e.default()},deref:tw,nameToId:function(t){let e=tv(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?N.has(t):"string"==typeof t&&F.has(t)))},isFunction:function(t){return g.has(t)||t.toLowerCase()in tp},isPackage:function(t){return y.has(t)},isActivePackage:function(t){let e=y.get(t);return e?.active??!1},getPackageList:function(){return x.join(" ")},locals:tS,onMethodCalled(t,e,i){let s=D.get(t);s||(s=new o,D.set(t,s));let r=s.get(e);return r||(r=[],s.set(e,r)),r.push(i),()=>{let t=r.indexOf(i);-1!==t&&r.splice(t,1)}}},t_={call(t,...e){let i=g.get(t);if(i&&i.length>0)return te(t.toLowerCase(),i.length-1,()=>i[i.length-1](...e));let s=tp[t.toLowerCase()];return s?s(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tC=tM(V,{onSet:function(t,e,i){let s=z(t.startsWith("$")?t.slice(1):t);Object.is(e,i)||m(s)&&ta({type:"global.changed",name:s,value:e,previousValue:i})}}),tT={methods:f,functions:g,packages:y,activePackages:x,objectsById:N,objectsByName:F,datablocks:$,globals:V,executedScripts:H,failedScripts:J,scripts:Y,generatedCode:Q,pendingTimeouts:tl,startTime:Date.now()};function tI(t){let e=function(t){let e=Q.get(t);null==e&&(e=new n(void 0).generate(t),Q.set(t,e));return e}(t),i=tS();Function("$","$f","$g","$l",e)(tA,t_,tC,i)}function tz(t,e){return{execute(){if(e){let t=l(e);tT.executedScripts.add(t)}tI(t)}}}async function tk(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(tT.scripts.has(n)||tT.failedScripts.has(n))return;if(X&&X(n)){console.warn(`Ignoring script: ${e}`),tT.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),tT.failedScripts.add(n),t.progress?.completeItem();return}try{a=E(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),tT.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tk(a.execScriptPaths,i,h),tT.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tB(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(tT.scripts.has(s))return tz(tT.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await tR(r,{path:e});return t.progress?.completeItem(),n}async function tR(t,e){if(e?.path){let t=l(e.path);if(tT.scripts.has(t))return tz(tT.scripts.get(t),e.path)}return tO(E(t,{filename:e?.path}),e)}async function tO(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);tT.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tk(n,s,r),tz(e,i?.path)}return tc={$:tA,$f:t_,$g:tC,state:tT,destroy:function(){for(let t of(W.length>0&&tn(),tT.pendingTimeouts))clearTimeout(t);tT.pendingTimeouts.clear(),U.clear()},executeAST:tI,loadFromPath:tB,loadFromSource:tR,loadFromAST:tO,call:(t,...e)=>t_.call(t,...e),getObjectByName:t=>F.get(t),subscribeRuntimeEvents:t=>(U.add(t),()=>{U.delete(t)})}}function O(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function E(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function P(t){if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if("string"==typeof t){let e=t.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e}return!!t}function L(){let t=Error("Operation aborted");return t.name="AbortError",t}function N(t){let e,{missionName:i,missionType:s,runtimeOptions:r,onMissionLoadDone:n}=t,{signal:a,fileSystem:o,globals:h={},preloadScripts:l=[],reactiveGlobalNames:u}=r??{},c=o?.findFiles("scripts/*Game.cs")??[],p=u?Array.from(new Set([...u,"missionRunning"])):void 0,d=R({...r,reactiveGlobalNames:p,globals:{...h,"$Host::Map":i,"$Host::MissionType":s},preloadScripts:[...l,...c]});(e=d.$.registerMethod.bind(d.$))("ShapeBase","playThread",(t,e,i)=>{t._threads||(t._threads={}),t._threads[Number(e)]={sequence:String(i),playing:!0,direction:!0}}),e("ShapeBase","stopThread",(t,e)=>{t._threads&&delete t._threads[Number(e)]}),e("ShapeBase","setThreadDir",(t,e,i)=>{t._threads||(t._threads={});let s=Number(e);t._threads[s]?t._threads[s].direction=!!Number(i):t._threads[s]={sequence:"",playing:!1,direction:!!Number(i)}}),e("ShapeBase","pauseThread",(t,e)=>{t._threads?.[Number(e)]&&(t._threads[Number(e)].playing=!1)}),e("ShapeBase","playAudio",()=>{}),e("ShapeBase","stopAudio",()=>{}),e("SimObject","getDatablock",t=>{let e=t.datablock;return e?d.getObjectByName(String(e))??"":""}),e("SimObject","getGroup",t=>t._parent??""),e("SimObject","getName",t=>t._name??""),e("SimObject","getType",()=>16384),e("SimGroup","getCount",t=>t._children?t._children.length:0),e("SimGroup","getObject",(t,e)=>{let i=t._children;return i?i[Number(e)]??"":""}),e("GameBase","isEnabled",()=>!0),e("GameBase","isDisabled",()=>!1),e("GameBase","setPoweredState",()=>{}),e("GameBase","setRechargeRate",()=>{}),e("GameBase","getRechargeRate",()=>0),e("GameBase","setEnergyLevel",()=>{}),e("GameBase","getEnergyLevel",()=>0),e("ShapeBase","getDamageLevel",()=>0),e("ShapeBase","setDamageLevel",()=>{}),e("ShapeBase","getRepairRate",()=>0),e("ShapeBase","setRepairRate",()=>{}),e("ShapeBase","getDamagePercent",()=>0),e("GameBase","getControllingClient",()=>0),e("SimObject","schedule",(t,e,i,...s)=>{let r=setTimeout(()=>{d.state.pendingTimeouts.delete(r);try{d.$.call(t,String(i),...s)}catch(e){console.error(`schedule: error calling ${i} on ${t._id}:`,e)}},Number(e)||0);return d.state.pendingTimeouts.add(r),r});let m=async function(){try{let t=await d.loadFromPath("scripts/server.cs");a?.throwIfAborted(),await d.loadFromPath(`missions/${i}.mis`),a?.throwIfAborted(),t.execute();let e=function(t,e){let{signal:i,onMissionLoadDone:s}=e;return new Promise((e,r)=>{let n=!1,a=!1,o=()=>P(t.$g.get("missionRunning")),h=()=>{n||(n=!0,d(),e())},l=t=>{n||(n=!0,d(),r(t))},u=e=>{if(!s||a)return;let i=e??t.getObjectByName("Game");i&&(a=!0,s(i))},c=()=>l(L()),p=t.subscribeRuntimeEvents(t=>{if("global.changed"===t.type&&"missionrunning"===t.name){P(t.value)&&(u(),h());return}"batch.flushed"===t.type&&o()&&(u(),h())});function d(){p(),i?.removeEventListener("abort",c)}if(i){if(i.aborted)return void l(L());i.addEventListener("abort",c,{once:!0})}o()&&(u(),h())})}(d,{signal:a,onMissionLoadDone:n}),s=await d.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");a?.throwIfAborted(),s.execute(),await e}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:d,ready:m}}t.s(["createProgressTracker",()=>O],38433);let F=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,$=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,V=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,D={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function j(t){let e=E(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match($))?{type:"sectionBegin",name:e[1]}:(e=t.match(V))?{type:"sectionEnd",name:e[1]}:(e=t.match(F))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>D[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function U(t,e){if(t)return t[e.toLowerCase()]}function W(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function G(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function q(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function H(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function J(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>W,"getInt",()=>G,"getPosition",()=>q,"getProperty",()=>U,"getRotation",()=>J,"getScale",()=>H,"parseMissionScript",()=>j],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("�","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/8206544674c0f63e.js b/docs/_next/static/chunks/8206544674c0f63e.js new file mode 100644 index 00000000..119f6eac --- /dev/null +++ b/docs/_next/static/chunks/8206544674c0f63e.js @@ -0,0 +1,8 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,75056,e=>{"use strict";var t=e.i(40859),r=e.i(71645),n=e.i(8560),i=e.i(90072);e.s(["ACESFilmicToneMapping",()=>i.ACESFilmicToneMapping,"AddEquation",()=>i.AddEquation,"AddOperation",()=>i.AddOperation,"AdditiveAnimationBlendMode",()=>i.AdditiveAnimationBlendMode,"AdditiveBlending",()=>i.AdditiveBlending,"AgXToneMapping",()=>i.AgXToneMapping,"AlphaFormat",()=>i.AlphaFormat,"AlwaysCompare",()=>i.AlwaysCompare,"AlwaysDepth",()=>i.AlwaysDepth,"AlwaysStencilFunc",()=>i.AlwaysStencilFunc,"AmbientLight",()=>i.AmbientLight,"AnimationAction",()=>i.AnimationAction,"AnimationClip",()=>i.AnimationClip,"AnimationLoader",()=>i.AnimationLoader,"AnimationMixer",()=>i.AnimationMixer,"AnimationObjectGroup",()=>i.AnimationObjectGroup,"AnimationUtils",()=>i.AnimationUtils,"ArcCurve",()=>i.ArcCurve,"ArrayCamera",()=>i.ArrayCamera,"ArrowHelper",()=>i.ArrowHelper,"AttachedBindMode",()=>i.AttachedBindMode,"Audio",()=>i.Audio,"AudioAnalyser",()=>i.AudioAnalyser,"AudioContext",()=>i.AudioContext,"AudioListener",()=>i.AudioListener,"AudioLoader",()=>i.AudioLoader,"AxesHelper",()=>i.AxesHelper,"BackSide",()=>i.BackSide,"BasicDepthPacking",()=>i.BasicDepthPacking,"BasicShadowMap",()=>i.BasicShadowMap,"BatchedMesh",()=>i.BatchedMesh,"Bone",()=>i.Bone,"BooleanKeyframeTrack",()=>i.BooleanKeyframeTrack,"Box2",()=>i.Box2,"Box3",()=>i.Box3,"Box3Helper",()=>i.Box3Helper,"BoxGeometry",()=>i.BoxGeometry,"BoxHelper",()=>i.BoxHelper,"BufferAttribute",()=>i.BufferAttribute,"BufferGeometry",()=>i.BufferGeometry,"BufferGeometryLoader",()=>i.BufferGeometryLoader,"ByteType",()=>i.ByteType,"Cache",()=>i.Cache,"Camera",()=>i.Camera,"CameraHelper",()=>i.CameraHelper,"CanvasTexture",()=>i.CanvasTexture,"CapsuleGeometry",()=>i.CapsuleGeometry,"CatmullRomCurve3",()=>i.CatmullRomCurve3,"CineonToneMapping",()=>i.CineonToneMapping,"CircleGeometry",()=>i.CircleGeometry,"ClampToEdgeWrapping",()=>i.ClampToEdgeWrapping,"Clock",()=>i.Clock,"Color",()=>i.Color,"ColorKeyframeTrack",()=>i.ColorKeyframeTrack,"ColorManagement",()=>i.ColorManagement,"CompressedArrayTexture",()=>i.CompressedArrayTexture,"CompressedCubeTexture",()=>i.CompressedCubeTexture,"CompressedTexture",()=>i.CompressedTexture,"CompressedTextureLoader",()=>i.CompressedTextureLoader,"ConeGeometry",()=>i.ConeGeometry,"ConstantAlphaFactor",()=>i.ConstantAlphaFactor,"ConstantColorFactor",()=>i.ConstantColorFactor,"Controls",()=>i.Controls,"CubeCamera",()=>i.CubeCamera,"CubeDepthTexture",()=>i.CubeDepthTexture,"CubeReflectionMapping",()=>i.CubeReflectionMapping,"CubeRefractionMapping",()=>i.CubeRefractionMapping,"CubeTexture",()=>i.CubeTexture,"CubeTextureLoader",()=>i.CubeTextureLoader,"CubeUVReflectionMapping",()=>i.CubeUVReflectionMapping,"CubicBezierCurve",()=>i.CubicBezierCurve,"CubicBezierCurve3",()=>i.CubicBezierCurve3,"CubicInterpolant",()=>i.CubicInterpolant,"CullFaceBack",()=>i.CullFaceBack,"CullFaceFront",()=>i.CullFaceFront,"CullFaceFrontBack",()=>i.CullFaceFrontBack,"CullFaceNone",()=>i.CullFaceNone,"Curve",()=>i.Curve,"CurvePath",()=>i.CurvePath,"CustomBlending",()=>i.CustomBlending,"CustomToneMapping",()=>i.CustomToneMapping,"CylinderGeometry",()=>i.CylinderGeometry,"Cylindrical",()=>i.Cylindrical,"Data3DTexture",()=>i.Data3DTexture,"DataArrayTexture",()=>i.DataArrayTexture,"DataTexture",()=>i.DataTexture,"DataTextureLoader",()=>i.DataTextureLoader,"DataUtils",()=>i.DataUtils,"DecrementStencilOp",()=>i.DecrementStencilOp,"DecrementWrapStencilOp",()=>i.DecrementWrapStencilOp,"DefaultLoadingManager",()=>i.DefaultLoadingManager,"DepthFormat",()=>i.DepthFormat,"DepthStencilFormat",()=>i.DepthStencilFormat,"DepthTexture",()=>i.DepthTexture,"DetachedBindMode",()=>i.DetachedBindMode,"DirectionalLight",()=>i.DirectionalLight,"DirectionalLightHelper",()=>i.DirectionalLightHelper,"DiscreteInterpolant",()=>i.DiscreteInterpolant,"DodecahedronGeometry",()=>i.DodecahedronGeometry,"DoubleSide",()=>i.DoubleSide,"DstAlphaFactor",()=>i.DstAlphaFactor,"DstColorFactor",()=>i.DstColorFactor,"DynamicCopyUsage",()=>i.DynamicCopyUsage,"DynamicDrawUsage",()=>i.DynamicDrawUsage,"DynamicReadUsage",()=>i.DynamicReadUsage,"EdgesGeometry",()=>i.EdgesGeometry,"EllipseCurve",()=>i.EllipseCurve,"EqualCompare",()=>i.EqualCompare,"EqualDepth",()=>i.EqualDepth,"EqualStencilFunc",()=>i.EqualStencilFunc,"EquirectangularReflectionMapping",()=>i.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>i.EquirectangularRefractionMapping,"Euler",()=>i.Euler,"EventDispatcher",()=>i.EventDispatcher,"ExternalTexture",()=>i.ExternalTexture,"ExtrudeGeometry",()=>i.ExtrudeGeometry,"FileLoader",()=>i.FileLoader,"Float16BufferAttribute",()=>i.Float16BufferAttribute,"Float32BufferAttribute",()=>i.Float32BufferAttribute,"FloatType",()=>i.FloatType,"Fog",()=>i.Fog,"FogExp2",()=>i.FogExp2,"FramebufferTexture",()=>i.FramebufferTexture,"FrontSide",()=>i.FrontSide,"Frustum",()=>i.Frustum,"FrustumArray",()=>i.FrustumArray,"GLBufferAttribute",()=>i.GLBufferAttribute,"GLSL1",()=>i.GLSL1,"GLSL3",()=>i.GLSL3,"GreaterCompare",()=>i.GreaterCompare,"GreaterDepth",()=>i.GreaterDepth,"GreaterEqualCompare",()=>i.GreaterEqualCompare,"GreaterEqualDepth",()=>i.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>i.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>i.GreaterStencilFunc,"GridHelper",()=>i.GridHelper,"Group",()=>i.Group,"HalfFloatType",()=>i.HalfFloatType,"HemisphereLight",()=>i.HemisphereLight,"HemisphereLightHelper",()=>i.HemisphereLightHelper,"IcosahedronGeometry",()=>i.IcosahedronGeometry,"ImageBitmapLoader",()=>i.ImageBitmapLoader,"ImageLoader",()=>i.ImageLoader,"ImageUtils",()=>i.ImageUtils,"IncrementStencilOp",()=>i.IncrementStencilOp,"IncrementWrapStencilOp",()=>i.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>i.InstancedBufferAttribute,"InstancedBufferGeometry",()=>i.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>i.InstancedInterleavedBuffer,"InstancedMesh",()=>i.InstancedMesh,"Int16BufferAttribute",()=>i.Int16BufferAttribute,"Int32BufferAttribute",()=>i.Int32BufferAttribute,"Int8BufferAttribute",()=>i.Int8BufferAttribute,"IntType",()=>i.IntType,"InterleavedBuffer",()=>i.InterleavedBuffer,"InterleavedBufferAttribute",()=>i.InterleavedBufferAttribute,"Interpolant",()=>i.Interpolant,"InterpolateDiscrete",()=>i.InterpolateDiscrete,"InterpolateLinear",()=>i.InterpolateLinear,"InterpolateSmooth",()=>i.InterpolateSmooth,"InterpolationSamplingMode",()=>i.InterpolationSamplingMode,"InterpolationSamplingType",()=>i.InterpolationSamplingType,"InvertStencilOp",()=>i.InvertStencilOp,"KeepStencilOp",()=>i.KeepStencilOp,"KeyframeTrack",()=>i.KeyframeTrack,"LOD",()=>i.LOD,"LatheGeometry",()=>i.LatheGeometry,"Layers",()=>i.Layers,"LessCompare",()=>i.LessCompare,"LessDepth",()=>i.LessDepth,"LessEqualCompare",()=>i.LessEqualCompare,"LessEqualDepth",()=>i.LessEqualDepth,"LessEqualStencilFunc",()=>i.LessEqualStencilFunc,"LessStencilFunc",()=>i.LessStencilFunc,"Light",()=>i.Light,"LightProbe",()=>i.LightProbe,"Line",()=>i.Line,"Line3",()=>i.Line3,"LineBasicMaterial",()=>i.LineBasicMaterial,"LineCurve",()=>i.LineCurve,"LineCurve3",()=>i.LineCurve3,"LineDashedMaterial",()=>i.LineDashedMaterial,"LineLoop",()=>i.LineLoop,"LineSegments",()=>i.LineSegments,"LinearFilter",()=>i.LinearFilter,"LinearInterpolant",()=>i.LinearInterpolant,"LinearMipMapLinearFilter",()=>i.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>i.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>i.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>i.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>i.LinearSRGBColorSpace,"LinearToneMapping",()=>i.LinearToneMapping,"LinearTransfer",()=>i.LinearTransfer,"Loader",()=>i.Loader,"LoaderUtils",()=>i.LoaderUtils,"LoadingManager",()=>i.LoadingManager,"LoopOnce",()=>i.LoopOnce,"LoopPingPong",()=>i.LoopPingPong,"LoopRepeat",()=>i.LoopRepeat,"MOUSE",()=>i.MOUSE,"Material",()=>i.Material,"MaterialLoader",()=>i.MaterialLoader,"MathUtils",()=>i.MathUtils,"Matrix2",()=>i.Matrix2,"Matrix3",()=>i.Matrix3,"Matrix4",()=>i.Matrix4,"MaxEquation",()=>i.MaxEquation,"Mesh",()=>i.Mesh,"MeshBasicMaterial",()=>i.MeshBasicMaterial,"MeshDepthMaterial",()=>i.MeshDepthMaterial,"MeshDistanceMaterial",()=>i.MeshDistanceMaterial,"MeshLambertMaterial",()=>i.MeshLambertMaterial,"MeshMatcapMaterial",()=>i.MeshMatcapMaterial,"MeshNormalMaterial",()=>i.MeshNormalMaterial,"MeshPhongMaterial",()=>i.MeshPhongMaterial,"MeshPhysicalMaterial",()=>i.MeshPhysicalMaterial,"MeshStandardMaterial",()=>i.MeshStandardMaterial,"MeshToonMaterial",()=>i.MeshToonMaterial,"MinEquation",()=>i.MinEquation,"MirroredRepeatWrapping",()=>i.MirroredRepeatWrapping,"MixOperation",()=>i.MixOperation,"MultiplyBlending",()=>i.MultiplyBlending,"MultiplyOperation",()=>i.MultiplyOperation,"NearestFilter",()=>i.NearestFilter,"NearestMipMapLinearFilter",()=>i.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>i.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>i.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>i.NearestMipmapNearestFilter,"NeutralToneMapping",()=>i.NeutralToneMapping,"NeverCompare",()=>i.NeverCompare,"NeverDepth",()=>i.NeverDepth,"NeverStencilFunc",()=>i.NeverStencilFunc,"NoBlending",()=>i.NoBlending,"NoColorSpace",()=>i.NoColorSpace,"NoNormalPacking",()=>i.NoNormalPacking,"NoToneMapping",()=>i.NoToneMapping,"NormalAnimationBlendMode",()=>i.NormalAnimationBlendMode,"NormalBlending",()=>i.NormalBlending,"NormalGAPacking",()=>i.NormalGAPacking,"NormalRGPacking",()=>i.NormalRGPacking,"NotEqualCompare",()=>i.NotEqualCompare,"NotEqualDepth",()=>i.NotEqualDepth,"NotEqualStencilFunc",()=>i.NotEqualStencilFunc,"NumberKeyframeTrack",()=>i.NumberKeyframeTrack,"Object3D",()=>i.Object3D,"ObjectLoader",()=>i.ObjectLoader,"ObjectSpaceNormalMap",()=>i.ObjectSpaceNormalMap,"OctahedronGeometry",()=>i.OctahedronGeometry,"OneFactor",()=>i.OneFactor,"OneMinusConstantAlphaFactor",()=>i.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>i.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>i.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>i.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>i.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>i.OneMinusSrcColorFactor,"OrthographicCamera",()=>i.OrthographicCamera,"PCFShadowMap",()=>i.PCFShadowMap,"PCFSoftShadowMap",()=>i.PCFSoftShadowMap,"PMREMGenerator",()=>n.PMREMGenerator,"Path",()=>i.Path,"PerspectiveCamera",()=>i.PerspectiveCamera,"Plane",()=>i.Plane,"PlaneGeometry",()=>i.PlaneGeometry,"PlaneHelper",()=>i.PlaneHelper,"PointLight",()=>i.PointLight,"PointLightHelper",()=>i.PointLightHelper,"Points",()=>i.Points,"PointsMaterial",()=>i.PointsMaterial,"PolarGridHelper",()=>i.PolarGridHelper,"PolyhedronGeometry",()=>i.PolyhedronGeometry,"PositionalAudio",()=>i.PositionalAudio,"PropertyBinding",()=>i.PropertyBinding,"PropertyMixer",()=>i.PropertyMixer,"QuadraticBezierCurve",()=>i.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>i.QuadraticBezierCurve3,"Quaternion",()=>i.Quaternion,"QuaternionKeyframeTrack",()=>i.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>i.QuaternionLinearInterpolant,"R11_EAC_Format",()=>i.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>i.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>i.RED_RGTC1_Format,"REVISION",()=>i.REVISION,"RG11_EAC_Format",()=>i.RG11_EAC_Format,"RGBADepthPacking",()=>i.RGBADepthPacking,"RGBAFormat",()=>i.RGBAFormat,"RGBAIntegerFormat",()=>i.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>i.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>i.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>i.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>i.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>i.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>i.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>i.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>i.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>i.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>i.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>i.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>i.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>i.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>i.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>i.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>i.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>i.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>i.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>i.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>i.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>i.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>i.RGBDepthPacking,"RGBFormat",()=>i.RGBFormat,"RGBIntegerFormat",()=>i.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>i.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>i.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>i.RGB_ETC1_Format,"RGB_ETC2_Format",()=>i.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>i.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>i.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>i.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>i.RGDepthPacking,"RGFormat",()=>i.RGFormat,"RGIntegerFormat",()=>i.RGIntegerFormat,"RawShaderMaterial",()=>i.RawShaderMaterial,"Ray",()=>i.Ray,"Raycaster",()=>i.Raycaster,"RectAreaLight",()=>i.RectAreaLight,"RedFormat",()=>i.RedFormat,"RedIntegerFormat",()=>i.RedIntegerFormat,"ReinhardToneMapping",()=>i.ReinhardToneMapping,"RenderTarget",()=>i.RenderTarget,"RenderTarget3D",()=>i.RenderTarget3D,"RepeatWrapping",()=>i.RepeatWrapping,"ReplaceStencilOp",()=>i.ReplaceStencilOp,"ReverseSubtractEquation",()=>i.ReverseSubtractEquation,"RingGeometry",()=>i.RingGeometry,"SIGNED_R11_EAC_Format",()=>i.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>i.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>i.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>i.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>i.SRGBColorSpace,"SRGBTransfer",()=>i.SRGBTransfer,"Scene",()=>i.Scene,"ShaderChunk",()=>n.ShaderChunk,"ShaderLib",()=>n.ShaderLib,"ShaderMaterial",()=>i.ShaderMaterial,"ShadowMaterial",()=>i.ShadowMaterial,"Shape",()=>i.Shape,"ShapeGeometry",()=>i.ShapeGeometry,"ShapePath",()=>i.ShapePath,"ShapeUtils",()=>i.ShapeUtils,"ShortType",()=>i.ShortType,"Skeleton",()=>i.Skeleton,"SkeletonHelper",()=>i.SkeletonHelper,"SkinnedMesh",()=>i.SkinnedMesh,"Source",()=>i.Source,"Sphere",()=>i.Sphere,"SphereGeometry",()=>i.SphereGeometry,"Spherical",()=>i.Spherical,"SphericalHarmonics3",()=>i.SphericalHarmonics3,"SplineCurve",()=>i.SplineCurve,"SpotLight",()=>i.SpotLight,"SpotLightHelper",()=>i.SpotLightHelper,"Sprite",()=>i.Sprite,"SpriteMaterial",()=>i.SpriteMaterial,"SrcAlphaFactor",()=>i.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>i.SrcAlphaSaturateFactor,"SrcColorFactor",()=>i.SrcColorFactor,"StaticCopyUsage",()=>i.StaticCopyUsage,"StaticDrawUsage",()=>i.StaticDrawUsage,"StaticReadUsage",()=>i.StaticReadUsage,"StereoCamera",()=>i.StereoCamera,"StreamCopyUsage",()=>i.StreamCopyUsage,"StreamDrawUsage",()=>i.StreamDrawUsage,"StreamReadUsage",()=>i.StreamReadUsage,"StringKeyframeTrack",()=>i.StringKeyframeTrack,"SubtractEquation",()=>i.SubtractEquation,"SubtractiveBlending",()=>i.SubtractiveBlending,"TOUCH",()=>i.TOUCH,"TangentSpaceNormalMap",()=>i.TangentSpaceNormalMap,"TetrahedronGeometry",()=>i.TetrahedronGeometry,"Texture",()=>i.Texture,"TextureLoader",()=>i.TextureLoader,"TextureUtils",()=>i.TextureUtils,"Timer",()=>i.Timer,"TimestampQuery",()=>i.TimestampQuery,"TorusGeometry",()=>i.TorusGeometry,"TorusKnotGeometry",()=>i.TorusKnotGeometry,"Triangle",()=>i.Triangle,"TriangleFanDrawMode",()=>i.TriangleFanDrawMode,"TriangleStripDrawMode",()=>i.TriangleStripDrawMode,"TrianglesDrawMode",()=>i.TrianglesDrawMode,"TubeGeometry",()=>i.TubeGeometry,"UVMapping",()=>i.UVMapping,"Uint16BufferAttribute",()=>i.Uint16BufferAttribute,"Uint32BufferAttribute",()=>i.Uint32BufferAttribute,"Uint8BufferAttribute",()=>i.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>i.Uint8ClampedBufferAttribute,"Uniform",()=>i.Uniform,"UniformsGroup",()=>i.UniformsGroup,"UniformsLib",()=>n.UniformsLib,"UniformsUtils",()=>i.UniformsUtils,"UnsignedByteType",()=>i.UnsignedByteType,"UnsignedInt101111Type",()=>i.UnsignedInt101111Type,"UnsignedInt248Type",()=>i.UnsignedInt248Type,"UnsignedInt5999Type",()=>i.UnsignedInt5999Type,"UnsignedIntType",()=>i.UnsignedIntType,"UnsignedShort4444Type",()=>i.UnsignedShort4444Type,"UnsignedShort5551Type",()=>i.UnsignedShort5551Type,"UnsignedShortType",()=>i.UnsignedShortType,"VSMShadowMap",()=>i.VSMShadowMap,"Vector2",()=>i.Vector2,"Vector3",()=>i.Vector3,"Vector4",()=>i.Vector4,"VectorKeyframeTrack",()=>i.VectorKeyframeTrack,"VideoFrameTexture",()=>i.VideoFrameTexture,"VideoTexture",()=>i.VideoTexture,"WebGL3DRenderTarget",()=>i.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>i.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>i.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>i.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>i.WebGLRenderTarget,"WebGLRenderer",()=>n.WebGLRenderer,"WebGLUtils",()=>n.WebGLUtils,"WebGPUCoordinateSystem",()=>i.WebGPUCoordinateSystem,"WebXRController",()=>i.WebXRController,"WireframeGeometry",()=>i.WireframeGeometry,"WrapAroundEnding",()=>i.WrapAroundEnding,"ZeroCurvatureEnding",()=>i.ZeroCurvatureEnding,"ZeroFactor",()=>i.ZeroFactor,"ZeroSlopeEnding",()=>i.ZeroSlopeEnding,"ZeroStencilOp",()=>i.ZeroStencilOp,"createCanvasElement",()=>i.createCanvasElement,"error",()=>i.error,"getConsoleFunction",()=>i.getConsoleFunction,"log",()=>i.log,"setConsoleFunction",()=>i.setConsoleFunction,"warn",()=>i.warn,"warnOnce",()=>i.warnOnce],32009);var o=e.i(32009);function a(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let s=["x","y","top","bottom","left","right","width","height"];var l=e.i(46791),u=e.i(43476);function c({ref:e,children:n,fallback:i,resize:l,style:c,gl:d,events:f=t.f,eventSource:A,eventPrefix:h,shadows:m,linear:p,flat:B,legacy:C,orthographic:g,frameloop:v,dpr:y,performance:b,raycaster:E,camera:M,scene:F,onPointerMissed:S,onCreated:R,...I}){r.useMemo(()=>(0,t.e)(o),[]);let T=(0,t.u)(),[G,x]=function({debounce:e,scroll:t,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){var o,l,u;let c=n||("u"(p.current=!0,()=>void(p.current=!1)));let[B,C,g]=(0,r.useMemo)(()=>{let e=()=>{let e,t;if(!A.current.element)return;let{left:r,top:n,width:o,height:a,bottom:l,right:u,x:c,y:d}=A.current.element.getBoundingClientRect(),h={left:r,top:n,width:o,height:a,bottom:l,right:u,x:c,y:d};A.current.element instanceof HTMLElement&&i&&(h.height=A.current.element.offsetHeight,h.width=A.current.element.offsetWidth),Object.freeze(h),p.current&&(e=A.current.lastBounds,t=h,!s.every(r=>e[r]===t[r]))&&f(A.current.lastBounds=h)};return[e,m?a(e,m):e,h?a(e,h):e]},[f,i,h,m]);function v(){A.current.scrollContainers&&(A.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),A.current.scrollContainers=null),A.current.resizeObserver&&(A.current.resizeObserver.disconnect(),A.current.resizeObserver=null),A.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",A.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",A.current.orientationHandler))}function y(){A.current.element&&(A.current.resizeObserver=new c(g),A.current.resizeObserver.observe(A.current.element),t&&A.current.scrollContainers&&A.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),A.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",A.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",A.current.orientationHandler))}return o=g,l=!!t,(0,r.useEffect)(()=>{if(l)return window.addEventListener("scroll",o,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",o,!0)},[o,l]),u=C,(0,r.useEffect)(()=>(window.addEventListener("resize",u),()=>void window.removeEventListener("resize",u)),[u]),(0,r.useEffect)(()=>{v(),y()},[t,g,C]),(0,r.useEffect)(()=>v,[]),[e=>{e&&e!==A.current.element&&(v(),A.current.element=e,A.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:o}=window.getComputedStyle(t);return[n,i,o].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},d,B]}({scroll:!0,debounce:{scroll:50,resize:0},...l}),D=r.useRef(null),w=r.useRef(null);r.useImperativeHandle(e,()=>D.current);let L=(0,t.a)(S),[_,O]=r.useState(!1),[H,P]=r.useState(!1);if(_)throw _;if(H)throw H;let J=r.useRef(null);(0,t.b)(()=>{let e=D.current;x.width>0&&x.height>0&&e&&(J.current||(J.current=(0,t.c)(e)),async function(){await J.current.configure({gl:d,scene:F,events:f,shadows:m,linear:p,flat:B,legacy:C,orthographic:g,frameloop:v,dpr:y,performance:b,raycaster:E,camera:M,size:x,onPointerMissed:(...e)=>null==L.current?void 0:L.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(A?(0,t.i)(A)?A.current:A:w.current),h&&e.setEvents({compute:(e,t)=>{let r=e[h+"X"],n=e[h+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==R||R(e)}}),J.current.render((0,u.jsx)(T,{children:(0,u.jsx)(t.E,{set:P,children:(0,u.jsx)(r.Suspense,{fallback:(0,u.jsx)(t.B,{set:O}),children:null!=n?n:null})})}))}())}),r.useEffect(()=>{let e=D.current;if(e)return()=>(0,t.d)(e)},[]);let U=A?"none":"auto";return(0,u.jsx)("div",{ref:w,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:U,...c},...I,children:(0,u.jsx)("div",{ref:G,style:{width:"100%",height:"100%"},children:(0,u.jsx)("canvas",{ref:D,style:{display:"block"},children:i})})})}function d(e){return(0,u.jsx)(l.FiberProvider,{children:(0,u.jsx)(c,{...e})})}e.i(89499),e.s(["Canvas",()=>d],75056)},32424,e=>{"use strict";var t=e.i(12979);function r(){return async e=>{let r;try{r=(0,t.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let t=await fetch(r);if(!t.ok)return console.error(`Script fetch failed: ${e} (${t.status})`),null;return await t.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}}}e.s(["createScriptLoader",()=>r])},91907,8597,78140,82816,25947,51475,71832,e=>{"use strict";let t;e.s(["ShapeRenderer",()=>ts,"applyShapeShaderModifications",()=>te,"createMaterialFromFlags",()=>tt,"useStaticShape",()=>tr],91907);var r=e.i(43476),n=e.i(932),i=e.i(71645),o=i;let a=(0,o.createContext)(null),s={didCatch:!1,error:null};class l extends o.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=s}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(s))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;r&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(this.props.onReset?.({next:n,prev:e.resetKeys,reason:"keys"}),this.setState(s))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:s}=this.state,l=e;if(i){let e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)l=t(e);else if(r)l=(0,o.createElement)(r,e);else if(void 0!==n)l=n;else throw s}return(0,o.createElement)(a.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},l)}}e.s(["ErrorBoundary",()=>l],8597);var u=e.i(31067),c=e.i(90072);function d(e,t){if(t===c.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==c.TriangleFanDrawMode&&t!==c.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;etypeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r=2.0 are supported."));return}let s=new ei(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(o),s.setPlugins(a),s.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}}function B(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let C={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class g{constructor(e){this.parser=e,this.name=C.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,o)}}class w{constructor(e){this.parser=e,this.name=C.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let o=i.extensions[t],a=n.images[o.source],s=r.textureLoader;if(a.uri){let e=r.options.manager.getHandler(a.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,o.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class L{constructor(e){this.parser=e,this.name=C.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let o=i.extensions[t],a=n.images[o.source],s=r.textureLoader;if(a.uri){let e=r.options.manager.getHandler(a.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,o.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class _{constructor(e){this.name=C.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let r=e.byteOffset||0,n=e.byteLength||0,o=e.count,a=e.byteStride,s=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(o,a,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(o*a);return i.decodeGltfBuffer(new Uint8Array(t),o,a,s,e.mode,e.filter),t})})}}}class O{constructor(e){this.name=C.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==Q.TRIANGLES&&e.mode!==Q.TRIANGLE_STRIP&&e.mode!==Q.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],o={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(o[e]=t,o[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of r){let t=new c.Matrix4,r=new c.Vector3,a=new c.Quaternion,s=new c.Vector3(1,1,1),l=new c.InstancedMesh(e.geometry,e.material,n);for(let e=0;e=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Z={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},z={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete};function $(e,t,r){for(let n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ee(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function et(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;ntypeof navigator&&void 0!==navigator.userAgent&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=(n=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"u"{let r=this.associations.get(e);for(let[n,o]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(o,t.children[n])};return i(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&o.setY(t,f[e*s+1]),s>=3&&o.setZ(t,f[e*s+2]),s>=4&&o.setW(t,f[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],o=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(o=e)}return this.loadTextureImage(e,n,o)}loadTextureImage(e,t,r){let n=this,i=this.json,o=i.textures[e],a=i.images[t],s=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=o.name||a.name||"",""===t.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(t.name=a.uri);let r=(i.samplers||{})[o.sampler]||{};return t.magFilter=V[r.magFilter]||c.LinearFilter,t.minFilter=V[r.minFilter]||c.LinearMipmapLinearFilter,t.wrapS=W[r.wrapS]||c.RepeatWrapping,t.wrapT=W[r.wrapT]||c.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){let r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=r.images[e],o=self.URL||self.webkitURL,a=i.uri||"",s=!1;if(void 0!==i.bufferView)a=this.getDependency("bufferView",i.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:i.mimeType});return a=o.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(a).then(function(e){return new Promise(function(r,i){let o=r;!0===t.isImageBitmapLoader&&(o=function(e){let t=new c.Texture(e);t.needsUpdate=!0,r(t)}),t.load(c.LoaderUtils.resolveURL(e,n.path),o,void 0,i)})}).then(function(e){var t;return!0===s&&o.revokeObjectURL(a),ee(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((o=o.clone()).channel=r.texCoord),i.extensions[C.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[C.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(o);o=i.extensions[C.KHR_TEXTURE_TRANSFORM].extendTexture(o,e),i.associations.set(o,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?h:m),"colorSpace"in o?o.colorSpace=n:o.encoding=n===h?3001:3e3),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new c.PointsMaterial,c.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new c.LineBasicMaterial,c.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(n||i||o){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return c.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,o=n.materials[e],a={},s=o.extensions||{},l=[];if(s[C.KHR_MATERIALS_UNLIT]){let e=i[C.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(a,o,r))}else{let n=o.pbrMetallicRoughness||{};if(a.color=new c.Color(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],m),a.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(a,"map",n.baseColorTexture,h)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===o.doubleSided&&(a.side=c.DoubleSide);let u=o.alphaMode||"OPAQUE";if("BLEND"===u?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,"MASK"===u&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==c.MeshBasicMaterial&&(l.push(r.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new c.Vector2(1,1),void 0!==o.normalTexture.scale)){let e=o.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&t!==c.MeshBasicMaterial&&(l.push(r.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==c.MeshBasicMaterial){let e=o.emissiveFactor;a.emissive=new c.Color().setRGB(e[0],e[1],e[2],m)}return void 0!==o.emissiveTexture&&t!==c.MeshBasicMaterial&&l.push(r.assignTexture(a,"emissiveMap",o.emissiveTexture,h)),Promise.all(l).then(function(){let n=new t(a);return o.name&&(n.name=o.name),ee(n,o),r.associations.set(n,{materials:e}),o.extensions&&$(i,n,o),n})}createUniqueName(e){let t=c.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,n=this.primitiveCache,i=[];for(let o=0,a=e.length;o0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new c.Group:1===t.length?t[0]:new c.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof c.Material||e instanceof c.Texture)&&t.set(e,r);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,r,n,i){let o,a=[],s=e.name?e.name:e.uuid,l=[];switch(Z[i.path]===Z.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),Z[i.path]){case Z.weights:o=c.NumberKeyframeTrack;break;case Z.rotation:o=c.QuaternionKeyframeTrack;break;case Z.position:case Z.scale:o=c.VectorKeyframeTrack;break;default:o=1===r.itemSize?c.NumberKeyframeTrack:c.VectorKeyframeTrack}let u=void 0!==n.interpolation?z[n.interpolation]:c.InterpolateLinear,d=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let n=JSON.stringify(t);if(es.has(e)){let t=es.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(i,o).then(n=>(r=n,new Promise((n,o)=>{r._callbacks[i]={resolve:n,reject:o},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),es.set(e,{key:n,promise:a}),a}_createGeometry(e){let t=new ea.BufferGeometry;e.index&&t.setIndex(new ea.BufferAttribute(e.index.array,1));for(let r=0;r{r.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=eu.toString(),i=["/* draco decoder */",r,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let t=e.draco,r=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){var i,o,a;let s,l,u,c,d,f,A=n.attributeIDs,h=n.attributeTypes,m=t.GetEncodedGeometryType(r);if(m===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(m===e.POINT_CLOUD)d=new e.PointCloud,f=t.DecodeBufferToPointCloud(r,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let p={index:null,attributes:[]};for(let r in A){let i,o,a=self[h[r]];if(n.useUniqueIDs)o=A[r],i=t.GetAttributeByUniqueId(d,o);else{if(-1===(o=t.GetAttributeId(d,e[A[r]])))continue;i=t.GetAttribute(d,o)}p.attributes.push(function(e,t,r,n,i,o){let a=o.num_components(),s=r.num_points()*a,l=s*i.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,o,u,l,c);let d=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:n,array:d,itemSize:a}}(e,t,d,r,a,i))}return m===e.TRIANGULAR_MESH&&(i=e,o=t,a=d,s=3*a.num_faces(),l=4*s,u=i._malloc(l),o.GetTrianglesUInt32Array(a,l,u),c=new Uint32Array(i.HEAPF32.buffer,u,s).slice(),i._free(u),p.index={array:c,itemSize:1}),e.destroy(d),p}(t,r,a,o),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(a),t.destroy(r)}})}}}var ec=e.i(99143);let ed=function(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;i{let A={keys:l,deep:n,inject:s,castShadow:o,receiveShadow:a};if(Array.isArray(t=i.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return ed(t)}return t},[t,e])))return i.createElement("group",(0,u.default)({},d,{ref:f}),t.map(e=>i.createElement(ef,(0,u.default)({key:e.uuid,object:e},A))),r);let{children:h,...m}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:n,castShadow:o,receiveShadow:a}){let s={};for(let r of t)s[r]=e[r];return r&&(s.geometry&&"materialsOnly"!==r&&(s.geometry=s.geometry.clone()),s.material&&"geometriesOnly"!==r&&(s.material=s.material.clone())),n&&(s="function"==typeof n?{...s,children:n(e)}:i.isValidElement(n)?{...s,children:n}:{...s,...n}),e instanceof c.Mesh&&(o&&(s.castShadow=!0),a&&(s.receiveShadow=!0)),s}(t,A),p=t.type[0].toLowerCase()+t.type.slice(1);return i.createElement(p,(0,u.default)({},m,d,{ref:f}),t.children.map(e=>"Bone"===e.type?i.createElement("primitive",(0,u.default)({key:e.uuid,object:e},A)):i.createElement(ef,(0,u.default)({key:e.uuid,object:e},A,{isChild:!0}))),r,h)}),eA=null,eh="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function em(e=!0,r=!0,n){return i=>{n&&n(i),e&&(eA||(eA=new el),eA.setDecoderPath("string"==typeof e?e:eh),i.setDRACOLoader(eA)),r&&i.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(r)&&(i="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");let o=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i{(e=t.instance).exports.__wasm_call_ctors()});function a(t,r,n,i,o,a){let s=e.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(o.length),d=new Uint8Array(e.exports.memory.buffer);d.set(o,c);let f=t(u,n,i,c,o.length);if(0===f&&a&&a(u,l,i),r.set(d.subarray(u,u+n*i)),s(u-s(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:o,supported:!0,decodeVertexBuffer(t,r,n,i,o){a(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[s[o]])},decodeIndexBuffer(t,r,n,i){a(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){a(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,o,u){a(e.exports[l[o]],t,r,n,i,e.exports[s[u]])}}})())}}let ep=(e,t,r,n)=>(0,ec.useLoader)(p,e,em(t,r,n));ep.preload=(e,t,r,n)=>ec.useLoader.preload(p,e,em(t,r,n)),ep.clear=e=>ec.useLoader.clear(p,e),ep.setDecoderPath=e=>{eh=e},e.s(["useGLTF",()=>ep],78140),e.i(47071);var eB=e.i(71753),eC=e.i(12979);function eg(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;ieg],82816);var ev=e.i(75567),ey=e.i(79123);let eb=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function eE(e){return eb.test(e)}let eM=(0,i.createContext)(null);function eF(){let e=(0,i.useContext)(eM);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function eS(e){let t,i,o,a=(0,n.c)(10),{children:s,object:l,shapeName:u,type:c}=e;a[0]!==u?(t=eE(u),a[0]=u,a[1]=t):t=a[1];let d=t;a[2]!==d||a[3]!==l||a[4]!==u||a[5]!==c?(i={object:l,shapeName:u,type:c,isOrganic:d},a[2]=d,a[3]=l,a[4]=u,a[5]=c,a[6]=i):i=a[6];let f=i;return a[7]!==s||a[8]!==f?(o=(0,r.jsx)(eM.Provider,{value:f,children:s}),a[7]=s,a[8]=f,a[9]=o):o=a[9],o}e.s(["ShapeInfoProvider",()=>eS,"isOrganicShape",()=>eE,"useShapeInfo",()=>eF],25947),e.i(13876);var eR=e.i(58647),eI=e.i(89887);e.i(47167),e.i(69230),e.i(69637),e.i(54440);let eT=(0,i.createContext)(null);function eG({children:e}){let t=(0,i.useRef)(void 0),n=(0,i.useRef)(0),o=(0,i.useRef)(0);(0,eB.useFrame)((e,r)=>{for(n.current+=r;n.current>=.03125;)if(n.current-=.03125,o.current++,t.current)for(let e of t.current)e(o.current)});let a=(0,i.useCallback)(e=>(t.current??=new Set,t.current.add(e),()=>{t.current.delete(e)}),[]),s=(0,i.useCallback)(()=>o.current,[]),l=(0,i.useMemo)(()=>({subscribe:a,getTick:s}),[a,s]);return(0,r.jsx)(eT.Provider,{value:l,children:e})}function ex(e){let t=(0,i.useContext)(eT);if(!t)throw Error("useTick must be used within a TickProvider");let r=(0,i.useRef)(e);r.current=e,(0,i.useEffect)(()=>t.subscribe(e=>r.current(e)),[t])}e.s(["TICK_RATE",0,32,"TickProvider",()=>eG,"useTick",()=>ex],51475);let eD=1/30,ew=new Map,eL=new c.TextureLoader;function e_(e){return new Promise((t,r)=>{eL.load(e,t,void 0,r)})}function eO(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,n=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,n/e.rows)}function eH(e,t){let r=e.totalDurationSeconds;if(r<=0)return 0;let n=t;n>r&&(n-=r*Math.floor(n/r));for(let t=0;t(0,eC.iflTextureToUrl)(t.name,e)),B=(i=(n=(t=await Promise.all(p.map(e_)))[0].image).width,o=n.height,s=Math.ceil(Math.sqrt(a=t.length)),l=Math.ceil(a/s),(u=document.createElement("canvas")).width=i*s,u.height=o*l,d=u.getContext("2d"),t.forEach((e,t)=>{let r=Math.floor(t/s);d.drawImage(e.image,t%s*i,r*o)}),(f=new c.CanvasTexture(u)).colorSpace=c.SRGBColorSpace,f.generateMipmaps=!1,f.minFilter=c.NearestFilter,f.magFilter=c.NearestFilter,f.wrapS=c.ClampToEdgeWrapping,f.wrapT=c.ClampToEdgeWrapping,f.repeat.set(1/s,1/l),{texture:f,columns:s,rows:l,frameCount:a,frameOffsetSeconds:[],totalDurationSeconds:0,lastFrame:-1});return A=0,(r=B).frameOffsetSeconds=m.map(e=>A+=e.frameCount*eD),r.totalDurationSeconds=A,ew.set(e,B),B}var eJ=e.i(47021),eU=e.i(48066);e.s(["ANIM_TRANSITION_TIME",()=>ek,"DEFAULT_EYE_HEIGHT",()=>eN,"STREAM_TICK_SEC",()=>eK,"_r90",()=>eW,"_r90inv",()=>eq,"buildStreamDemoEntity",()=>e7,"collectSceneObjectCounts",()=>e4,"entityTypeColor",()=>e5,"getKeyframeAtTime",()=>e9,"getPosedNodeTransform",()=>e8,"nextLifecycleInstanceId",()=>eZ,"processShapeScene",()=>e6,"replaceWithShapeMaterial",()=>e3,"setQuaternionFromDir",()=>e1,"setupEffectTexture",()=>e$,"torqueHorizontalFovToThreeVerticalFov",()=>ez,"torqueVecToThree",()=>e0],71832);let eN=2.1,ek=.25,eK=.032,ej=new c.Vector3,eQ=new c.Vector3,eX=new c.Matrix4,eV=new c.Vector3(0,1,0),eW=new c.Quaternion().setFromAxisAngle(new c.Vector3(0,1,0),Math.PI/2),eq=eW.clone().invert(),eY=0;function eZ(e){return eY+=1,`${e}-${eY}`}function ez(e,t){return 180*(2*Math.atan(Math.tan(Math.max(.01,Math.min(179.99,e))*Math.PI/180/2)/(Number.isFinite(t)&&t>1e-6?t:4/3)))/Math.PI}function e$(e){e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.magFilter=c.LinearFilter,e.colorSpace=c.NoColorSpace,e.flipY=!1,e.needsUpdate=!0}function e0(e,t){return t.set(e[1],e[2],e[0])}function e1(e,t){ej.crossVectors(e,eV),1e-8>ej.lengthSq()&&ej.set(-1,0,0),ej.normalize(),eQ.crossVectors(ej,e).normalize(),eX.set(ej.x,e.x,eQ.x,0,ej.y,e.y,eQ.y,0,ej.z,e.z,eQ.z,0,0,0,0,1),t.setFromRotationMatrix(eX)}function e9(e,t){if(0===e.length)return null;if(t<=e[0].time)return e[0];if(t>=e[e.length-1].time)return e[e.length-1];let r=0,n=e.length-1;for(;n-r>1;){let i=r+n>>1;e[i].time<=t?r=i:n=i}return e[r]}function e8(e,t,r){let n=e.clone(!0),i=t.find(e=>"Root"===e.name);if(i){let e=new c.AnimationMixer(n);e.clipAction(i).play(),e.setTime(0)}n.updateMatrixWorld(!0);let o=null,a=null;return(n.traverse(e=>{o||e.name!==r||(o=new c.Vector3,a=new c.Quaternion,e.getWorldPosition(o),e.getWorldQuaternion(a))}),o&&a)?{position:o,quaternion:a}:null}let e2=new c.TextureLoader;function e3(e,t){let r=e.userData?.resource_path,n=new Set(e.userData?.flag_names??[]);if(!r){let t=new c.MeshLambertMaterial({color:e.color,side:2,reflectivity:0});return te(t),t}let i=(0,eC.textureToUrl)(r),o=e2.load(i);(0,ev.setupTexture)(o);let a=tt(e,o,n,!1,t);return Array.isArray(a)?a[1]:a}function e6(e){var t;let r,n=null;e.traverse(e=>{!n&&e.skeleton&&(n=e.skeleton)});let i=n?(t=n,r=new Set,t.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),r):new Set;e.traverse(e=>{if(!e.isMesh)return;if(e.name.match(/^Hulk/i)||e.material?.name==="Unassigned"||(e.userData?.vis??1)<.01){e.visible=!1;return}if(e.geometry){let t=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,o=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(a)){o[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let o of e)t+=i[3*o],r+=i[3*o+1],n+=i[3*o+2];let o=Math.sqrt(t*t+r*r+n*n);for(let a of(o>0&&(t/=o,r/=o,n/=o),e))i[3*a]=t,i[3*a+1]=r,i[3*a+2]=n}r.needsUpdate=!0}(t=t.clone()),e.geometry=t}let t=e.userData?.vis??1;Array.isArray(e.material)?e.material=e.material.map(e=>e3(e,t)):e.material&&(e.material=e3(e.material,t))})}function e4(e){let t=0,r=0;return e.traverse(e=>{t+=1,e.visible&&(r+=1)}),{sceneObjects:t,visibleSceneObjects:r}}function e7(e,t,r,n,i,o,a,s,l,u,c){return{id:e,type:t,dataBlock:r,visual:n,direction:i,weaponShape:o,playerName:a,className:s,ghostIndex:l,dataBlockId:u,shapeHint:c,keyframes:[{time:0,position:[0,0,0],rotation:[0,0,0,1]}]}}function e5(e){switch(e.toLowerCase()){case"player":return"#00ff88";case"vehicle":return"#ff8800";case"projectile":return"#ff0044";case"deployable":return"#ffcc00";default:return"#8888ff"}}function te(e){e.onBeforeCompile=t=>{(0,eJ.injectCustomFog)(t,eU.globalFogUniforms),e instanceof c.MeshLambertMaterial&&(t.uniforms.shapeDirectionalFactor={value:1},t.uniforms.shapeAmbientFactor={value:1.5},t.fragmentShader=t.fragmentShader.replace("#include ",`#include +uniform float shapeDirectionalFactor; +uniform float shapeAmbientFactor; +`),t.fragmentShader=t.fragmentShader.replace("#include ",`#include + // Apply shape-specific lighting multipliers + reflectedLight.directDiffuse *= shapeDirectionalFactor; + reflectedLight.indirectDiffuse *= shapeAmbientFactor; +`))}}function tt(e,t,r,n,i=1,o=!1){let a=r.has("Translucent"),s=r.has("Additive"),l=r.has("SelfIlluminating"),u=i<1||o;if(l||s){let e=s||a||u,r=new c.MeshBasicMaterial({map:t,side:2,transparent:e,depthWrite:!e,alphaTest:0,fog:!0,...u&&{opacity:i},...s&&{blending:c.AdditiveBlending}});return te(r),r}if(n||a){let e={map:t,transparent:u,alphaTest:.5*!u,...u&&{opacity:i,depthWrite:!1},reflectivity:0},r=new c.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new c.MeshLambertMaterial({...e,side:0});return te(r),te(n),[r,n]}let d=new c.MeshLambertMaterial({map:t,side:2,reflectivity:0,...u&&{transparent:!0,opacity:i,depthWrite:!1}});return te(d),d}function tr(e){let t,r=(0,n.c)(2);return r[0]!==e?(t=(0,eC.shapeToUrl)(e),r[0]=e,r[1]=t):t=r[1],ep(t)}function tn(e){let t,i,o,a,s=(0,n.c)(9),{color:l,label:u}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("boxGeometry",{args:[10,10,10]}),s[0]=t):t=s[0],s[1]!==l?(i=(0,r.jsx)("meshStandardMaterial",{color:l,wireframe:!0}),s[1]=l,s[2]=i):i=s[2],s[3]!==l||s[4]!==u?(o=u?(0,r.jsx)(eI.FloatingLabel,{color:l,children:u}):null,s[3]=l,s[4]=u,s[5]=o):o=s[5],s[6]!==i||s[7]!==o?(a=(0,r.jsxs)("mesh",{children:[t,i,o]}),s[6]=i,s[7]=o,s[8]=a):a=s[8],a}function ti(e){let t,i=(0,n.c)(4),{color:o,label:a}=e,{debugMode:s}=(0,ey.useDebug)();return i[0]!==o||i[1]!==s||i[2]!==a?(t=s?(0,r.jsx)(tn,{color:o,label:a}):null,i[0]=o,i[1]=s,i[2]=a,i[3]=t):t=i[3],t}let to=new Set(["octahedron.dts"]);function ta(e){let t,i,o,a,s=(0,n.c)(6),{label:l}=e,{debugMode:u}=(0,ey.useDebug)();return u?(s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("icosahedronGeometry",{args:[1,1]}),i=(0,r.jsx)("meshBasicMaterial",{color:"cyan",wireframe:!0}),s[0]=t,s[1]=i):(t=s[0],i=s[1]),s[2]!==l?(o=l?(0,r.jsx)(eI.FloatingLabel,{color:"cyan",children:l}):null,s[2]=l,s[3]=o):o=s[3],s[4]!==o?(a=(0,r.jsxs)("mesh",{children:[t,i,o]}),s[4]=o,s[5]=a):a=s[5],a):null}function ts(e){let t,o,a,s,u,c=(0,n.c)(17),{loadingColor:d,demoThreads:f,children:A}=e,h=void 0===d?"yellow":d,{object:m,shapeName:p}=eF();if(!p){let e,t=`${m._id}: `;return c[0]!==t?(e=(0,r.jsx)(ti,{color:"orange",label:t}),c[0]=t,c[1]=e):e=c[1],e}if(to.has(p.toLowerCase())){let e,t=`${m._id}: ${p}`;return c[2]!==t?(e=(0,r.jsx)(ta,{label:t}),c[2]=t,c[3]=e):e=c[3],e}let B=`${m._id}: ${p}`;return c[4]!==B?(t=(0,r.jsx)(ti,{color:"red",label:B}),c[4]=B,c[5]=t):t=c[5],c[6]!==h?(o=(0,r.jsx)(tn,{color:h}),c[6]=h,c[7]=o):o=c[7],c[8]!==f?(a=(0,r.jsx)(tu,{demoThreads:f}),c[8]=f,c[9]=a):a=c[9],c[10]!==A||c[11]!==o||c[12]!==a?(s=(0,r.jsxs)(i.Suspense,{fallback:o,children:[a,A]}),c[10]=A,c[11]=o,c[12]=a,c[13]=s):s=c[13],c[14]!==t||c[15]!==s?(u=(0,r.jsx)(l,{fallback:t,children:s}),c[14]=t,c[15]=s,c[16]=u):u=c[16],u}let tl=(0,i.memo)(function({gltf:e,demoThreads:t}){let{object:n,shapeName:o}=eF(),{debugMode:a}=(0,ey.useDebug)(),{animationEnabled:s}=(0,ey.useSettings)(),l=(0,eR.useEngineSelector)(e=>e.runtime.runtime),{clonedScene:u,mixer:d,clipsByName:f,visNodesBySequence:A,iflMeshes:h}=(0,i.useMemo)(()=>{let t=eg(e.scene),r=[];for(let{mesh:e,hasVisSequence:n}of(t.traverse(e=>{if(!e.isMesh||!e.material)return;let t=Array.isArray(e.material)?e.material[0]:e.material;if(!t?.userData)return;let n=new Set(t.userData.flag_names??[]),i=t.userData.resource_path;if(n.has("IflMaterial")&&i){let t=e.userData,n=t?.ifl_sequence?String(t.ifl_sequence).toLowerCase():void 0,o=t?.ifl_duration?Number(t.ifl_duration):void 0,a=t?.ifl_sequence?!!t.ifl_cyclic:void 0,s=t?.ifl_tool_begin!=null?Number(t.ifl_tool_begin):void 0;r.push({mesh:e,iflPath:`textures/${i}.ifl`,hasVisSequence:!!t?.vis_sequence,iflSequence:n,iflDuration:o,iflCyclic:a,iflToolBegin:s})}}),e6(t),r))n||(e.visible=!0);let n=new Map;t.traverse(e=>{if(!e.isMesh)return;let t=e.userData;if(!t)return;let r=t.vis_keyframes,i=t.vis_duration,o=(t.vis_sequence??"").toLowerCase();if(!o||!Array.isArray(r)||r.length<=1||!i||i<=0)return;let a=n.get(o);a||(a=[],n.set(o,a)),a.push({mesh:e,keyframes:r,duration:i,cyclic:!!t.vis_cyclic})});let i=new Map;for(let t of e.animations)i.set(t.name.toLowerCase(),t);let o=i.size>0?new c.AnimationMixer(t):null;return{clonedScene:t,mixer:o,clipsByName:i,visNodesBySequence:n,iflMeshes:r}},[e]),m=(0,i.useRef)(new Map),p=(0,i.useRef)(new Map),B=(0,i.useRef)([]),C=(0,i.useRef)(0),g=(0,i.useRef)(s);g.current=s;let v=(0,i.useRef)(null),y=(0,i.useRef)(t);y.current=t;let b=(0,i.useRef)(null),E=(0,i.useRef)(null),M=(0,i.useRef)(void 0);(0,i.useEffect)(()=>{for(let e of(B.current=[],p.current.clear(),h))eP(e.iflPath).then(t=>{let r=Array.isArray(e.mesh.material)?e.mesh.material[0]:e.mesh.material;r&&(r.map=t.texture,r.needsUpdate=!0),B.current.push({atlas:t,sequenceName:e.iflSequence,sequenceDuration:e.iflDuration,cyclic:e.iflCyclic,toolBegin:e.iflToolBegin}),p.current.set(e.mesh,t)}).catch(()=>{})},[h]),(0,i.useEffect)(()=>{let e=m.current;function t(e){if(e.mesh.visible=!0,e.mesh.material?.isMeshStandardMaterial){let t=e3(e.mesh.material,e.mesh.userData?.vis??0);e.mesh.material=Array.isArray(t)?t[1]:t}e.mesh.material&&!Array.isArray(e.mesh.material)&&(e.mesh.material.transparent=!0,e.mesh.material.depthWrite=!1);let t=p.current.get(e.mesh);t&&e.mesh.material&&!Array.isArray(e.mesh.material)&&(e.mesh.material.map=t.texture,e.mesh.material.needsUpdate=!0)}function r(r,n){let o=n.toLowerCase();i(r);let a=f.get(o),s=A.get(o),l={sequence:o,startTime:performance.now()/1e3};if(a&&d){let e=d.clipAction(a);"deploy"===o?(e.setLoop(c.LoopOnce,1),e.clampWhenFinished=!0):e.setLoop(c.LoopRepeat,1/0),e.reset().play(),l.action=e,!g.current&&"deploy"===o&&(e.time=a.duration,d.update(0),v.current&&queueMicrotask(()=>v.current?.(r)))}if(s){for(let e of s)t(e);l.visNodes=s}e.set(r,l)}function i(t){let r=e.get(t);if(r){if(r.action&&r.action.stop(),r.visNodes)for(let e of r.visNodes)e.mesh.visible=!1,e.mesh.material&&!Array.isArray(e.mesh.material)&&(e.mesh.material.opacity=e.keyframes[0]);e.delete(t)}}if(b.current=r,E.current=i,null!=y.current)return()=>{for(let t of(b.current=null,E.current=null,[...e.keys()]))i(t)};let o=f.has("deploy"),a=!!(l&&o&&n.datablock);function s(e){if(!l)return;let t=n.datablock;if(!t)return;let r=l.getObjectByName(String(t));r&&l.$.call(r,"onEndSequence",n,e)}function u(){for(let r of["ambient","power"]){let n=A.get(r);if(n){let i=performance.now()/1e3;for(let e of n)t(e);let o=+("power"!==r);e.set(o,{sequence:r,visNodes:n,startTime:i})}let i=f.get(r);if(i&&d){let t=d.clipAction(i);t.setLoop(c.LoopRepeat,1/0),t.reset().play();let n=+("power"!==r),o=e.get(n);o?o.action=t:e.set(n,{sequence:r,action:t,startTime:performance.now()/1e3})}}}v.current=a?s:()=>u();let h=[],B=d?t=>{for(let[r,n]of e)if(n.action===t.action){a?s(r):u();break}}:null;return B&&d&&d.addEventListener("finished",B),l&&(h.push(l.$.onMethodCalled("ShapeBase","playThread",(e,t,i)=>{e._id===n._id&&r(Number(t),String(i))})),h.push(l.$.onMethodCalled("ShapeBase","stopThread",(e,t)=>{e._id===n._id&&i(Number(t))})),h.push(l.$.onMethodCalled("ShapeBase","pauseThread",(t,r)=>{if(t._id!==n._id)return;let i=e.get(Number(r));i?.action&&(i.action.paused=!0)}))),a?l.$.call(n,"deploy"):o?r(3,"deploy"):u(),()=>{for(let t of(B&&d&&d.removeEventListener("finished",B),h.forEach(e=>e()),v.current=null,b.current=null,E.current=null,[...e.keys()]))i(t)}},[d,f,A,n,l]);let F=(0,i.useMemo)(()=>{let t=e.scene.userData?.dts_sequence_names;if("string"==typeof t)try{return JSON.parse(t).map(e=>e.toLowerCase())}catch{}return e.animations.map(e=>e.name.toLowerCase())},[e]);return(0,eB.useFrame)((e,t)=>{let r=m.current,n=y.current,i=M.current;if(n!==i){M.current=n;let e=b.current,t=E.current;if(e&&t){let r=[];if(n)for(let e of n)r[e.index]=e;let o=[];if(i)for(let e of i)o[e.index]=e;let a=Math.max(r.length,o.length);for(let n=0;n0)for(let e of(C.current+=t,o)){if(!s){eO(e.atlas,0);continue}if(e.sequenceName&&e.sequenceDuration){let t=0;for(let[,n]of r)if(n.sequence===e.sequenceName){let r=performance.now()/1e3-n.startTime,i=e.sequenceDuration;t=(e.cyclic?r/i%1:Math.min(r/i,1))*i+(e.toolBegin??0);break}eO(e.atlas,eH(e.atlas,t))}else eO(e.atlas,eH(e.atlas,C.current))}}),(0,r.jsxs)("group",{rotation:[0,Math.PI/2,0],children:[(0,r.jsx)("primitive",{object:u}),a?(0,r.jsxs)(eI.FloatingLabel,{children:[n._id,": ",o]}):null]})});function tu(e){let t,i=(0,n.c)(3),{demoThreads:o}=e,{shapeName:a}=eF(),s=tr(a);return i[0]!==o||i[1]!==s?(t=(0,r.jsx)(tl,{gltf:s,demoThreads:o}),i[0]=o,i[1]=s,i[2]=t):t=i[2],t}},7368,e=>{"use strict";e.s(["ignoreScripts",0,["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]])},17751,85413,e=>{"use strict";var t=e.i(19273),r=e.i(86491),n=e.i(40143),i=e.i(15823),o=class extends i.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,i){let o=n.queryKey,a=n.queryHash??(0,t.hashQueryKeyByOptions)(o,n),s=this.get(a);return s||(s=new r.Query({client:e,queryKey:o,queryHash:a,options:e.defaultQueryOptions(n),state:i,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchQuery)(r,e))}findAll(e={}){let r=this.getAll();return Object.keys(e).length>0?r.filter(r=>(0,t.matchQuery)(e,r)):r}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},a=e.i(88587),s=e.i(36553),l=class extends a.Removable{#t;#r;#n;#i;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#r=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#r=this.#r.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#r.length||("pending"===this.state.status?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#o({type:"continue"})},r={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,s.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#o({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#o({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let n="pending"===this.state.status,i=!this.#i.canStart();try{if(n)t();else{this.#o({type:"pending",variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#o({type:"pending",context:t,variables:e,isPaused:i})}let o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#o({type:"success",data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#o({type:"error",error:t}),t}finally{this.#n.runNext(this)}}#o(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.notifyManager.batch(()=>{this.#r.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}},u=i,c=class extends u.Subscribable{constructor(e={}){super(),this.config=e,this.#a=new Set,this.#s=new Map,this.#l=0}#a;#s;#l;build(e,t,r){let n=new l({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#a.add(e);let t=d(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#a.delete(e)){let t=d(e);if("string"==typeof t){let r=this.#s.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=d(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=d(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){n.notifyManager.batch(()=>{this.#a.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#a.clear(),this.#s.clear()})}getAll(){return Array.from(this.#a)}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchMutation)(r,e))}findAll(e={}){return this.getAll().filter(r=>(0,t.matchMutation)(e,r))}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(t.noop))))}};function d(e){return e.options.scope?.id}var f=e.i(75555),A=e.i(14448);function h(e){return{onFetch:(r,n)=>{let i=r.options,o=r.fetchOptions?.meta?.fetchMore?.direction,a=r.state.data?.pages||[],s=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},u=0,c=async()=>{let n=!1,c=(0,t.ensureQueryFn)(r.options,r.fetchOptions),d=async(e,i,o)=>{let a;if(n)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let s=(a={client:r.client,queryKey:r.queryKey,pageParam:i,direction:o?"backward":"forward",meta:r.options.meta},(0,t.addConsumeAwareSignal)(a,()=>r.signal,()=>n=!0),a),l=await c(s),{maxPages:u}=r.options,d=o?t.addToStart:t.addToEnd;return{pages:d(e.pages,l,u),pageParams:d(e.pageParams,i,u)}};if(o&&a.length){let e="backward"===o,t={pages:a,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(i,t);l=await d(t,r,e)}else{let t=e??a.length;do{let e=0===u?s[0]??i.initialPageParam:m(i,l);if(u>0&&null==e)break;l=await d(l,e),u++}while(ur.options.persister?.(c,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},n):r.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#u;#n;#c;#d;#f;#A;#h;#m;constructor(e={}){this.#u=e.queryCache||new o,this.#n=e.mutationCache||new c,this.#c=e.defaultOptions||{},this.#d=new Map,this.#f=new Map,this.#A=0}mount(){this.#A++,1===this.#A&&(this.#h=f.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#m=A.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#A--,0===this.#A&&(this.#h?.(),this.#h=void 0,this.#m?.(),this.#m=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#n.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),n=this.#u.build(this,r),i=n.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,n))&&this.prefetchQuery(r),Promise.resolve(i))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,r,n){let i=this.defaultQueryOptions({queryKey:e}),o=this.#u.get(i.queryHash),a=o?.state.data,s=(0,t.functionalUpdate)(r,a);if(void 0!==s)return this.#u.build(this,i).setData(s,{...n,manual:!0})}setQueriesData(e,t,r){return n.notifyManager.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;n.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return n.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,r={}){let i={revert:!0,...r};return Promise.all(n.notifyManager.batch(()=>this.#u.findAll(e).map(e=>e.cancel(i)))).then(t.noop).catch(t.noop)}invalidateQueries(e,t={}){return n.notifyManager.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,r={}){let i={...r,cancelRefetch:r.cancelRefetch??!0};return Promise.all(n.notifyManager.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let r=e.fetch(void 0,i);return i.throwOnError||(r=r.catch(t.noop)),"paused"===e.state.fetchStatus?Promise.resolve():r}))).then(t.noop)}fetchQuery(e){let r=this.defaultQueryOptions(e);void 0===r.retry&&(r.retry=!1);let n=this.#u.build(this,r);return n.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,n))?n.fetch(r):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t.noop).catch(t.noop)}fetchInfiniteQuery(e){return e.behavior=h(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t.noop).catch(t.noop)}ensureInfiniteQueryData(e){return e.behavior=h(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return A.onlineManager.isOnline()?this.#n.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#n}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,r){this.#d.set((0,t.hashKey)(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...this.#d.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,r){this.#f.set((0,t.hashKey)(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...this.#f.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let r={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=(0,t.hashQueryKeyByOptions)(r.queryKey,r)),void 0===r.refetchOnReconnect&&(r.refetchOnReconnect="always"!==r.networkMode),void 0===r.throwOnError&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===t.skipToken&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#n.clear()}};e.s(["QueryClient",()=>p],17751);var B=Object.defineProperty;class C{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?B(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,n=r.length;tC],85413)},38360,(e,t,r)=>{var n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},i=Object.keys(n).join("|"),o=RegExp(i,"g"),a=RegExp(i,"");function s(e){return n[e]}var l=function(e){return e.replace(o,s)};t.exports=l,t.exports.has=function(e){return!!e.match(a)},t.exports.remove=l},11889,56373,86447,1559,18364,78440,59129,25998,70238,e=>{"use strict";e.i(47167);var t,r="u">typeof window&&!!(null==(t=window.document)?void 0:t.createElement);function n(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function i(e){return e?"self"in e?e.self:n(e).defaultView||window:self}function o(e,t=!1){var r;let{activeElement:i}=n(e);if(!(null==i?void 0:i.nodeName))return null;if(s(i)&&(null==(r=i.contentDocument)?void 0:r.body))return o(i.contentDocument.body,t);if(t){let e=i.getAttribute("aria-activedescendant");if(e){let t=n(i).getElementById(e);if(t)return t}}return i}function a(e,t){return e===t||e.contains(t)}function s(e){return"IFRAME"===e.tagName}function l(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==u.indexOf(e.type)}var u=["button","color","file","image","reset","submit"];function c(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function d(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function f(e){return e.isContentEditable||d(e)}function A(e){let t=0,r=0;if(d(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let i=n(e).getSelection();if((null==i?void 0:i.rangeCount)&&i.anchorNode&&a(e,i.anchorNode)&&i.focusNode&&a(e,i.focusNode)){let n=i.getRangeAt(0),o=n.cloneRange();o.selectNodeContents(e),o.setEnd(n.startContainer,n.startOffset),t=o.toString().length,o.setEnd(n.endContainer,n.endOffset),r=o.toString().length}}return{start:t,end:r}}function h(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function m(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return m(e.parentElement)||document.scrollingElement||document.body}function p(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function B(e,t){return t&&e.item(t)||null}var C=Symbol("FOCUS_SILENTLY");function g(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function v(){}function y(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function b(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function E(e){return e}function M(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function F(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function S(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function R(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function I(...e){for(let t of e)if(void 0!==t)return t}var T=e.i(71645);function G(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function x(){return r&&!!navigator.maxTouchPoints}function D(){return!!r&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function w(){return r&&D()&&/apple/i.test(navigator.vendor)}function L(e){return!!(e.currentTarget&&!a(e.currentTarget,e.target))}function _(e){return e.target===e.currentTarget}function O(e,t){let r=new FocusEvent("blur",t),n=e.dispatchEvent(r),i={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",i)),n}function H(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function P(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!a(r,n)}function J(e,t,r,n){let i=(e=>{if(n){let t=setTimeout(e,n);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,o,!0),r()}),o=()=>{i(),r()};return e.addEventListener(t,o,{once:!0,capture:!0}),i}function U(e,t,r,n=window){let i=[];try{for(let o of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(U(e,t,r,o))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var N={...T},k=N.useId;N.useDeferredValue;var K=N.useInsertionEffect,j=r?T.useLayoutEffect:T.useEffect;function Q(e){let t=(0,T.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return K?K(()=>{t.current=e}):t.current=e,(0,T.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function X(...e){return(0,T.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)G(r,t)}},e)}function V(e){if(k){let t=k();return e||t}let[t,r]=(0,T.useState)(e);return j(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function W(e,t){let r=(0,T.useRef)(!1);(0,T.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,T.useEffect)(()=>()=>{r.current=!1},[])}function q(){return(0,T.useReducer)(()=>[],[])}function Y(e){return Q("function"==typeof e?e:()=>e)}function Z(e,t,r=[]){let n=(0,T.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function z(e=!1,t){let[r,n]=(0,T.useState)(null);return{portalRef:X(n,t),portalNode:r,domReady:!e||r}}var $=!1,ee=!1,et=0,er=0;function en(e){let t,r;t=e.movementX||e.screenX-et,r=e.movementY||e.screenY-er,et=e.screenX,er=e.screenY,(t||r||0)&&(ee=!0)}function ei(){ee=!1}var eo=e.i(43476);function ea(e){let t=T.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function es(e,t){return T.memo(e,t)}function el(e,t){let r,{wrapElement:n,render:i,...o}=t,a=X(t.ref,i&&(0,T.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(T.isValidElement(i)){let e={...i.props,ref:a};r=T.cloneElement(i,function(e,t){let r={...e};for(let n in t){if(!y(t,n))continue;if("className"===n){let n="className";r[n]=e[n]?`${e[n]} ${t[n]}`:t[n];continue}if("style"===n){let n="style";r[n]=e[n]?{...e[n],...t[n]}:t[n];continue}let i=t[n];if("function"==typeof i&&n.startsWith("on")){let t=e[n];if("function"==typeof t){r[n]=(...e)=>{i(...e),t(...e)};continue}}r[n]=i}return r}(o,e))}else r=i?i(o):(0,eo.jsx)(e,{...o});return n?n(r):r}function eu(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function ec(e=[],t=[]){let r=T.createContext(void 0),n=T.createContext(void 0),i=()=>T.useContext(r),o=t=>e.reduceRight((e,r)=>(0,eo.jsx)(r,{...t,children:e}),(0,eo.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:i,useScopedContext:(e=!1)=>{let t=T.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=T.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:o,ScopedContextProvider:e=>(0,eo.jsx)(o,{...e,children:t.reduceRight((t,r)=>(0,eo.jsx)(r,{...e,children:t}),(0,eo.jsx)(n.Provider,{...e}))})}}var ed=ec(),ef=ed.useContext;ed.useScopedContext,ed.useProviderContext;var eA=ec([ed.ContextProvider],[ed.ScopedContextProvider]),eh=eA.useContext;eA.useScopedContext;var em=eA.useProviderContext,ep=eA.ContextProvider,eB=eA.ScopedContextProvider,eC=(0,T.createContext)(void 0),eg=(0,T.createContext)(void 0),ev=(0,T.createContext)(!0),ey="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function eb(e){return!(!e.matches(ey)||!c(e)||e.closest("[inert]"))}function eE(e){if(!eb(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=o(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function eM(e,t){let r=Array.from(e.querySelectorAll(ey));t&&r.unshift(e);let n=r.filter(eb);return n.forEach((e,t)=>{var r;if(!s(e))return;let i=null==(r=e.contentDocument)?void 0:r.body;i&&n.splice(t,1,...eM(i))}),n}function eF(e,t,r){let n=Array.from(e.querySelectorAll(ey)),i=n.filter(eE);return(t&&eE(e)&&i.unshift(e),i.forEach((e,t)=>{var n;if(!s(e))return;let o=null==(n=e.contentDocument)?void 0:n.body;if(!o)return;let a=eF(o,!1,r);i.splice(t,1,...a)}),!i.length&&r)?n:i}function eS(e,t){var r;let n,i,a,s;return r=document.body,n=o(r),a=(i=eM(r,!1)).indexOf(n),(s=i.slice(a+1)).find(eE)||(e?i.find(eE):null)||(t?s[0]:null)||null}function eR(e,t){var r;let n,i,a,s;return r=document.body,n=o(r),a=(i=eM(r,!1).reverse()).indexOf(n),(s=i.slice(a+1)).find(eE)||(e?i.find(eE):null)||(t?s[0]:null)||null}function eI(e){let t=o(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function eT(e){let t=o(e);if(!t)return!1;if(a(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function eG(e){!eT(e)&&eb(e)&&e.focus()}var ex=w(),eD=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],ew=Symbol("safariFocusAncestor");function eL(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function e_(e,t){return Q(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var eO=!1,eH=!0;function eP(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(eH=!1)}function eJ(e){e.metaKey||e.ctrlKey||e.altKey||(eH=!0)}var eU=eu(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var o,a,s,u,c;let d=(0,T.useRef)(null);(0,T.useEffect)(()=>{!e||eO||(U("mousedown",eP,!0),U("keydown",eJ,!0),eO=!0)},[e]),ex&&(0,T.useEffect)(()=>{if(!e)return;let t=d.current;if(!t||!eL(t))return;let r="labels"in t?t.labels:null;if(!r)return;let n=()=>queueMicrotask(()=>t.focus());for(let e of r)e.addEventListener("mouseup",n);return()=>{for(let e of r)e.removeEventListener("mouseup",n)}},[e]);let f=e&&S(i),A=!!f&&!t,[h,m]=(0,T.useState)(!1);(0,T.useEffect)(()=>{e&&A&&h&&m(!1)},[e,A,h]),(0,T.useEffect)(()=>{if(!e||!h)return;let t=d.current;if(!t||"u"{eb(t)||m(!1)});return r.observe(t),()=>r.disconnect()},[e,h]);let p=e_(i.onKeyPressCapture,f),B=e_(i.onMouseDownCapture,f),C=e_(i.onClickCapture,f),g=i.onMouseDown,v=Q(t=>{if(null==g||g(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!ex||L(t)||!l(r)&&!eL(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let o=function(e){for(;e&&!eb(e);)e=e.closest(ey);return e||null}(r.parentElement);o&&(o[ew]=!0),J(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),o&&(o[ew]=!1),n||eG(r)})}),y=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&eI(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",m(!0)))},b=i.onKeyDownCapture,E=Q(t=>{if(null==b||b(t),t.defaultPrevented||!e||h||t.metaKey||t.altKey||t.ctrlKey||!_(t))return;let r=t.currentTarget;J(r,"focusout",()=>y(t,r))}),M=i.onFocusCapture,F=Q(t=>{if(null==M||M(t),t.defaultPrevented||!e)return;if(!_(t))return void m(!1);let r=t.currentTarget;eH||function(e){let{tagName:t,readOnly:r,type:n}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:eD.includes(n))}(t.target)?J(t.target,"focusout",()=>y(t,r)):m(!1)}),I=i.onBlur,G=Q(t=>{null==I||I(t),!e||P(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),m(!1))}),x=(0,T.useContext)(ev),D=Q(t=>{e&&r&&t&&x&&queueMicrotask(()=>{eI(t)||eb(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,T.useState)(()=>r(void 0));return j(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,void 0]),n}(d),O=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),H=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),N=i.style,k=(0,T.useMemo)(()=>A?{pointerEvents:"none",...N}:N,[A,N]);return i={"data-focus-visible":e&&h||void 0,"data-autofocus":r||void 0,"aria-disabled":f||void 0,...i,ref:X(d,D,i.ref),style:k,tabIndex:(o=e,a=A,s=O,u=H,c=i.tabIndex,o?a?s&&!u?-1:void 0:s?c:c||0:c),disabled:!!H&&!!A||void 0,contentEditable:f?void 0:i.contentEditable,onKeyPressCapture:p,onClickCapture:C,onMouseDownCapture:B,onMouseDown:v,onKeyDownCapture:E,onFocusCapture:F,onBlur:G},R(i)});function eN(e){let t=[];for(let r of e)t.push(...r);return t}function ek(e){return e.slice().reverse()}function eK(e,t,r){return Q(n=>{var i;let o,a;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!_(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(o=n.target)||d(o))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let s=e.getState(),l=null==(i=B(e,s.activeId))?void 0:i.element;if(!l)return;let{view:u,...c}=n;l!==(null==r?void 0:r.current)&&l.focus(),a=new KeyboardEvent(n.type,c),l.dispatchEvent(a)||n.preventDefault(),n.currentTarget.contains(l)&&n.stopPropagation()})}ea(function(e){return el("div",eU(e))});var ej=eu(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...i}){let a=em();M(e=e||a,!1);let s=(0,T.useRef)(null),l=(0,T.useRef)(null),u=function(e){let[t,r]=(0,T.useState)(!1),n=(0,T.useCallback)(()=>r(!0),[]),i=e.useState(t=>B(e,t.activeId));return(0,T.useEffect)(()=>{let e=null==i?void 0:i.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(e),c=e.useState("moves"),[,f]=function(e){let[t,r]=(0,T.useState)(null);return j(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(t?e.setBaseElement:null);(0,T.useEffect)(()=>{var n;if(!e||!c||!t||!r)return;let{activeId:i}=e.getState(),o=null==(n=B(e,i))?void 0:n.element;o&&("scrollIntoView"in o?(o.focus({preventScroll:!0}),o.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):o.focus())},[e,c,t,r]),j(()=>{if(!e||!c||!t)return;let{baseElement:r,activeId:n}=e.getState();if(null!==n||!r)return;let i=l.current;l.current=null,i&&O(i,{relatedTarget:r}),eI(r)||r.focus()},[e,c,t]);let A=e.useState("activeId"),h=e.useState("virtualFocus");j(()=>{var r;if(!e||!t||!h)return;let n=l.current;if(l.current=null,!n)return;let i=(null==(r=B(e,A))?void 0:r.element)||o(n);i!==n&&O(n,{relatedTarget:i})},[e,A,h,t]);let m=eK(e,i.onKeyDownCapture,l),p=eK(e,i.onKeyUpCapture,l),v=i.onFocusCapture,y=Q(t=>{var r;let n;if(null==v||v(t),t.defaultPrevented||!e)return;let{virtualFocus:i}=e.getState();if(!i)return;let o=t.relatedTarget,a=(n=(r=t.currentTarget)[C],delete r[C],n);_(t)&&a&&(t.stopPropagation(),l.current=o)}),b=i.onFocus,E=Q(r=>{if(null==b||b(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?_(r)&&!g(e,n)&&queueMicrotask(u):_(r)&&e.setActiveId(null)}),F=i.onBlurCapture,S=Q(t=>{var r;if(null==F||F(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:i}=e.getState();if(!n)return;let o=null==(r=B(e,i))?void 0:r.element,a=t.relatedTarget,s=g(e,a),u=l.current;l.current=null,_(t)&&s?(a===o?u&&u!==a&&O(u,t):o?O(o,t):u&&O(u,t),t.stopPropagation()):!g(e,t.target)&&o&&O(o,t)}),R=i.onKeyDown,I=Y(n),G=Q(t=>{var r;if(null==R||R(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!_(t))return;let{orientation:n,renderedItems:i,activeId:o}=e.getState(),a=B(e,o);if(null==(r=null==a?void 0:a.element)?void 0:r.isConnected)return;let s="horizontal"!==n,l="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&d(t.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=eN(ek(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(i))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==e?void 0:e.last()}),ArrowRight:(u||l)&&e.first,ArrowDown:(u||s)&&e.first,ArrowLeft:(u||l)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];if(c){let r=c();if(void 0!==r){if(!I(t))return;t.preventDefault(),e.move(r)}}});return i=Z(i,t=>(0,eo.jsx)(ep,{value:e,children:t}),[e]),i={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=B(e,r.activeId))?void 0:n.id}),...i,ref:X(s,f,i.ref),onKeyDownCapture:m,onKeyUpCapture:p,onFocusCapture:y,onFocus:E,onBlurCapture:S,onKeyDown:G},i=eU({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...i})});ea(function(e){return el("div",ej(e))});var eQ=ec();eQ.useContext,eQ.useScopedContext;var eX=eQ.useProviderContext,eV=ec([eQ.ContextProvider],[eQ.ScopedContextProvider]);eV.useContext,eV.useScopedContext;var eW=eV.useProviderContext,eq=eV.ContextProvider,eY=eV.ScopedContextProvider,eZ=(0,T.createContext)(void 0),ez=(0,T.createContext)(void 0),e$=ec([eq],[eY]);e$.useContext,e$.useScopedContext;var e0=e$.useProviderContext,e1=e$.ContextProvider,e9=e$.ScopedContextProvider,e8=eu(function({store:e,...t}){let r=e0();return e=e||r,t={...t,ref:X(null==e?void 0:e.setAnchorElement,t.ref)}});ea(function(e){return el("div",e8(e))});var e2=(0,T.createContext)(void 0),e3=ec([e1,ep],[e9,eB]),e6=e3.useContext,e4=e3.useScopedContext,e7=e3.useProviderContext,e5=e3.ContextProvider,te=e3.ScopedContextProvider,tt=(0,T.createContext)(void 0),tr=(0,T.createContext)(!1);function tn(e,t){let r=e.__unstableInternals;return M(r,"Invalid store"),r[t]}function ti(e,...t){let r=e,n=r,i=Symbol(),o=v,a=new Set,s=new Set,l=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,A=(e,t,r=u)=>(r.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),r.delete(t)}),h=(e,o,a=!1)=>{var l,A;if(!y(r,e))return;let h=(A=r[e],"function"==typeof o?o("function"==typeof A?A():A):o);if(h===r[e])return;if(!a)for(let r of t)null==(l=null==r?void 0:r.setState)||l.call(r,e,h);let m=r;r={...r,[e]:h};let p=Symbol();i=p,s.add(e);let B=(t,n,i)=>{var o;let a=f.get(t);(!a||a.some(t=>i?i.has(t):t===e))&&(null==(o=d.get(t))||o(),d.set(t,t(r,n)))};for(let e of u)B(e,m);queueMicrotask(()=>{if(i!==p)return;let e=r;for(let e of c)B(e,n,s);n=e,s.clear()})},m={getState:()=>r,setState:h,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{let e=a.size,n=Symbol();a.add(n);let i=()=>{a.delete(n),a.size||o()};if(e)return i;let s=Object.keys(r).map(e=>b(...t.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&y(n,e))return tl(t,[e],t=>{h(e,t[e],!0)})}))),u=[];for(let e of l)u.push(e());return o=b(...s,...u,...t.map(ta)),i},subscribe:(e,t)=>A(e,t),sync:(e,t)=>(d.set(t,t(r,r)),A(e,t)),batch:(e,t)=>(d.set(t,t(r,n)),A(e,t,c)),pick:e=>ti(function(e,t){let r={};for(let n of t)y(e,n)&&(r[n]=e[n]);return r}(r,e),m),omit:e=>ti(function(e,t){let r={...e};for(let e of t)y(r,e)&&delete r[e];return r}(r,e),m)}};return m}function to(e,...t){if(e)return tn(e,"setup")(...t)}function ta(e,...t){if(e)return tn(e,"init")(...t)}function ts(e,...t){if(e)return tn(e,"subscribe")(...t)}function tl(e,...t){if(e)return tn(e,"sync")(...t)}function tu(e,...t){if(e)return tn(e,"batch")(...t)}function tc(e,...t){if(e)return tn(e,"omit")(...t)}function td(...e){var t;let r={};for(let n of e){let e=null==(t=null==n?void 0:n.getState)?void 0:t.call(n);e&&Object.assign(r,e)}let n=ti(r,...e);return Object.assign({},...e,n)}function tf(e,t){}function tA(e,t,r){if(!r)return!1;let n=e.find(e=>!e.disabled&&e.value);return(null==n?void 0:n.value)===t}function th(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var tm=eu(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:n,setValueOnChange:i,showMinLength:o=0,showOnChange:a,showOnMouseDown:s,showOnClick:l=s,showOnKeyDown:u,showOnKeyPress:c=u,blurActiveItemOnClick:d,setValueOnClick:f=!0,moveOnKeyPress:B=!0,autoComplete:C="list",...g}){var y;let b,E=e7();M(e=e||E,!1);let S=(0,T.useRef)(null),[R,I]=q(),G=(0,T.useRef)(!1),x=(0,T.useRef)(!1),D=e.useState(e=>e.virtualFocus&&r),w="inline"===C||"both"===C,[L,_]=(0,T.useState)(w);y=[w],b=(0,T.useRef)(!1),j(()=>{if(b.current)return(()=>{w&&_(!0)})();b.current=!0},y),j(()=>()=>{b.current=!1},[]);let O=e.useState("value"),H=(0,T.useRef)(void 0);(0,T.useEffect)(()=>tl(e,["selectedValue","activeId"],(e,t)=>{H.current=t.selectedValue}),[]);let U=e.useState(e=>{var t;if(w&&L){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=H.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),N=e.useState("renderedItems"),k=e.useState("open"),K=e.useState("contentElement"),Z=(0,T.useMemo)(()=>{if(!w||!L)return O;if(tA(N,U,D)){if(th(O,U)){let e=(null==U?void 0:U.slice(O.length))||"";return O+e}return O}return U||O},[w,L,N,U,D,O]);(0,T.useEffect)(()=>{let e=S.current;if(!e)return;let t=()=>_(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,T.useEffect)(()=>{if(!w||!L||!U||!tA(N,U,D)||!th(O,U))return;let e=v;return queueMicrotask(()=>{let t=S.current;if(!t)return;let{start:r,end:n}=A(t),i=O.length,o=U.length;p(t,i,o),e=()=>{if(!eI(t))return;let{start:e,end:a}=A(t);e!==i||a===o&&p(t,r,n)}}),()=>e()},[R,w,L,U,N,D,O]);let z=(0,T.useRef)(null),$=Q(n),ee=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(!k||!K)return;let t=m(K);if(!t)return;z.current=t;let r=()=>{G.current=!1},n=()=>{if(!e||!G.current)return;let{activeId:t}=e.getState();null===t||t!==ee.current&&(G.current=!1)},i={passive:!0,capture:!0};return t.addEventListener("wheel",r,i),t.addEventListener("touchmove",r,i),t.addEventListener("scroll",n,i),()=>{t.removeEventListener("wheel",r,!0),t.removeEventListener("touchmove",r,!0),t.removeEventListener("scroll",n,!0)}},[k,K,e]),j(()=>{!O||x.current||(G.current=!0)},[O]),j(()=>{"always"!==D&&k||(G.current=k)},[D,k]);let et=e.useState("resetValueOnSelect");W(()=>{var t,r;let n=G.current;if(!e||!k||!n&&!et)return;let{baseElement:i,contentElement:o,activeId:a}=e.getState();if(!i||eI(i)){if(null==o?void 0:o.hasAttribute("data-placing")){let e=new MutationObserver(I);return e.observe(o,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(D&&n){let r,n=$(N),i=void 0!==n?n:null!=(t=null==(r=N.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();ee.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(a||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,k,R,O,D,et,$,N]),(0,T.useEffect)(()=>{if(!w)return;let t=S.current;if(!t)return;let r=[t,K].filter(e=>!!e),n=t=>{r.every(e=>P(t,e))&&(null==e||e.setValue(Z))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[w,K,e,Z]);let er=e=>e.currentTarget.value.length>=o,en=g.onChange,ei=Y(null!=a?a:er),eo=Y(null!=i?i:!e.tag),ea=Q(t=>{if(null==en||en(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:n,selectionStart:i,selectionEnd:o}=r,a=t.nativeEvent;if(G.current=!0,"input"===a.type&&(a.isComposing&&(G.current=!1,x.current=!0),w)){let e="insertText"===a.inputType||"insertCompositionText"===a.inputType,t=i===n.length;_(e&&t)}if(eo(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{p(r,i,o)}),w&&D&&t&&I()}ei(t)&&e.show(),D&&G.current||e.setActiveId(null)}),es=g.onCompositionEnd,el=Q(e=>{G.current=!0,x.current=!1,null==es||es(e),e.defaultPrevented||D&&I()}),eu=g.onMouseDown,ec=Y(null!=d?d:()=>!!(null==e?void 0:e.getState().includesBaseElement)),ed=Y(f),ef=Y(null!=l?l:er),eA=Q(t=>{null==eu||eu(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(ec(t)&&e.setActiveId(null),ed(t)&&e.setValue(Z),ef(t)&&J(t.currentTarget,"mouseup",e.show))}),eh=g.onKeyDown,em=Y(null!=c?c:er),ep=Q(t=>{if(null==eh||eh(t),t.repeat||(G.current=!1),t.defaultPrevented||t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||!e)return;let{open:r}=e.getState();!r&&("ArrowUp"===t.key||"ArrowDown"===t.key)&&em(t)&&(t.preventDefault(),e.show())}),eB=g.onBlur,eC=Q(e=>{if(G.current=!1,null==eB||eB(e),e.defaultPrevented)return}),eg=V(g.id),ev=e.useState(e=>null===e.activeId);return g={id:eg,role:"combobox","aria-autocomplete":"inline"===C||"list"===C||"both"===C||"none"===C?C:void 0,"aria-haspopup":h(K,"listbox"),"aria-expanded":k,"aria-controls":null==K?void 0:K.id,"data-active-item":ev||void 0,value:Z,...g,ref:X(S,g.ref),onChange:ea,onCompositionEnd:el,onMouseDown:eA,onKeyDown:ep,onBlur:eC},g=ej({store:e,focusable:t,...g,moveOnKeyPress:e=>!F(B,e)&&(w&&_(!0),!0)}),{autoComplete:"off",...g=e8({store:e,...g})}}),tp=ea(function(e){return el("input",tm(e))});function tB(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}e.s(["Combobox",()=>tp],11889);var tC=Symbol("composite-hover"),tg=eu(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=eh();M(e=e||i,!1);let o=((0,T.useEffect)(()=>{$||(U("mousemove",en,!0),U("mousedown",ei,!0),U("mouseup",ei,!0),U("keydown",ei,!0),U("scroll",ei,!0),$=!0)},[]),Q(()=>ee)),s=n.onMouseMove,l=Y(t),u=Q(t=>{if((null==s||s(t),!t.defaultPrevented&&o())&&l(t)){if(!eT(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!eI(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),c=n.onMouseLeave,d=Y(r),f=Q(t=>{var r;let n;null==c||c(t),!t.defaultPrevented&&o()&&((n=tB(t))&&a(t.currentTarget,n)||function(e){let t=tB(e);if(!t)return!1;do{if(y(t,tC)&&t[tC])return!0;t=t.parentElement}while(t)return!1}(t)||!l(t)||d(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),A=(0,T.useCallback)(e=>{e&&(e[tC]=!0)},[]);return R(n={...n,ref:X(A,n.ref),onMouseMove:u,onMouseLeave:f})});es(ea(function(e){return el("div",tg(e))}));var tv=eu(function({store:e,shouldRegisterItem:t=!0,getItem:r=E,element:n,...i}){let o=ef();e=e||o;let a=V(i.id),s=(0,T.useRef)(n);return(0,T.useEffect)(()=>{let n=s.current;if(!a||!n||!t)return;let i=r({id:a,element:n});return null==e?void 0:e.renderItem(i)},[a,t,r,e]),R(i={...i,ref:X(s,i.ref)})});function ty(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?l(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(l(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}ea(function(e){return el("div",tv(e))});var tb=Symbol("command"),tE=eu(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...n}){let i,o,a=(0,T.useRef)(null),[s,u]=(0,T.useState)(!1);(0,T.useEffect)(()=>{a.current&&u(l(a.current))},[]);let[c,f]=(0,T.useState)(!1),A=(0,T.useRef)(!1),h=S(n),[m,p]=(i=n.onLoadedMetadataCapture,o=(0,T.useMemo)(()=>Object.assign(()=>{},{...i,[tb]:!0}),[i,tb,!0]),[null==i?void 0:i[tb],{onLoadedMetadataCapture:o}]),B=n.onKeyDown,C=Q(n=>{null==B||B(n);let i=n.currentTarget;if(n.defaultPrevented||m||h||!_(n)||d(i)||i.isContentEditable)return;let o=e&&"Enter"===n.key,a=t&&" "===n.key,s="Enter"===n.key&&!e,l=" "===n.key&&!t;if(s||l)return void n.preventDefault();if(o||a){let e=ty(n);if(o){if(!e){n.preventDefault();let{view:e,...t}=n,o=()=>H(i,t);r&&/firefox\//i.test(navigator.userAgent)?J(i,"keyup",o):queueMicrotask(o)}}else a&&(A.current=!0,e||(n.preventDefault(),f(!0)))}}),g=n.onKeyUp,v=Q(e=>{if(null==g||g(e),e.defaultPrevented||m||h||e.metaKey)return;let r=t&&" "===e.key;if(A.current&&r&&(A.current=!1,!ty(e))){e.preventDefault(),f(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>H(t,n))}});return eU(n={"data-active":c||void 0,type:s?"button":void 0,...p,...n,ref:X(a,n.ref),onKeyDown:C,onKeyUp:v})});ea(function(e){return el("button",tE(e))});var{useSyncExternalStore:tM}=e.i(2239).default,tF=()=>()=>{};function tS(e,t=E){let r=T.useCallback(t=>e?ts(e,null,t):tF(),[e]),n=()=>{let r="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&r&&y(i,r)?i[r]:void 0};return tM(r,n,n)}function tR(e,t){let r=T.useRef({}),n=T.useCallback(t=>e?ts(e,null,t):tF(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,o=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==o[e]&&(o[e]=t,i=!0)}if("string"==typeof r){if(!n||!y(n,r))continue;let t=n[r];t!==o[e]&&(o[e]=t,i=!0)}}return i&&(r.current={...o}),r.current};return tM(n,i,i)}function tI(e,t,r,n){var i;let o,a=y(t,r)?t[r]:void 0,s=(i={value:a,setValue:n?t[n]:void 0},o=(0,T.useRef)(i),j(()=>{o.current=i}),o);j(()=>tl(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),j(()=>{if(void 0!==a)return e.setState(r,a),tu(e,[r],()=>{void 0!==a&&e.setState(r,a)})})}function tT(e,t){let[r,n]=T.useState(()=>e(t));j(()=>ta(r),[r]);let i=T.useCallback(e=>tS(r,e),[r]);return[T.useMemo(()=>({...r,useState:i}),[r,i]),Q(()=>{n(r=>e({...t,...r.getState()}))})]}function tG(e,t,r,n=!1){var i;let o,a;if(!t||!r)return;let{renderedItems:s}=t.getState(),l=m(e);if(!l)return;let u=function(e,t=!1){let r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),o=t?r-i+n:i+n;return"HTML"===e.tagName?o+e.scrollTop:o}(l,n);for(let e=0;e=0){void 0!==a&&at||(e&&(null==B?void 0:B.baseElement)&&B.baseElement===e.baseElement?B.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===m,ariaSetSize:e=>null!=s?s:e&&(null==B?void 0:B.ariaSetSize)&&B.baseElement===e.baseElement?B.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e||!(null==B?void 0:B.ariaPosInSet)||B.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===y);return B.ariaPosInSet+t.findIndex(e=>e.id===m)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(o)return!0;if(null===t.activeId)return!1;let r=null==e?void 0:e.item(t.activeId);return null!=r&&!!r.disabled||null==r||!r.element||t.activeId===m}}),G=(0,T.useCallback)(e=>{var t;let r={...e,id:m||e.id,rowId:y,disabled:!!v,children:null==(t=e.element)?void 0:t.textContent};return a?a(r):r},[m,y,v,a]),x=c.onFocus,D=(0,T.useRef)(!1),O=Q(t=>{var r,i;if(null==x||x(t),t.defaultPrevented||L(t)||!m||!e||(r=e,!_(t)&&g(r,t.target)))return;let{virtualFocus:o,baseElement:a}=e.getState();e.setActiveId(m),f(t.currentTarget)&&function(e,t=!1){if(d(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=n(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!o||!_(t)||!f(i=t.currentTarget)&&("INPUT"!==i.tagName||l(i))&&(null==a?void 0:a.isConnected)&&((w()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),D.current=!0,t.relatedTarget===a||g(e,t.relatedTarget))?(a[C]=!0,a.focus({preventScroll:!0})):a.focus())}),H=c.onBlurCapture,P=Q(t=>{if(null==H||H(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&D.current&&(D.current=!1,t.preventDefault(),t.stopPropagation())}),J=c.onKeyDown,U=Y(r),N=Y(i),k=Q(t=>{if(null==J||J(t),t.defaultPrevented||!_(t)||!e)return;let{currentTarget:r}=t,i=e.getState(),o=e.item(m),a=!!(null==o?void 0:o.rowId),s="horizontal"!==i.orientation,l="vertical"!==i.orientation,u=()=>!(!a&&!l&&i.baseElement&&d(i.baseElement)),c={ArrowUp:(a||s)&&e.up,ArrowRight:(a||l)&&e.next,ArrowDown:(a||s)&&e.down,ArrowLeft:(a||l)&&e.previous,Home:()=>{if(u())return!a||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(u())return!a||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>tG(r,e,null==e?void 0:e.up,!0),PageDown:()=>tG(r,e,null==e?void 0:e.down)}[t.key];if(c){if(f(r)){let e=A(r),i=l&&"ArrowLeft"===t.key,o=l&&"ArrowRight"===t.key,a=s&&"ArrowUp"===t.key,u=s&&"ArrowDown"===t.key;if(o||u){let{length:t}=function(e){if(d(e))return e.value;if(e.isContentEditable){let t=n(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((i||a)&&0!==e.start)return}let i=c();if(U(t)||void 0!==i){if(!N(t))return;t.preventDefault(),e.move(i)}}}),K=(0,T.useMemo)(()=>({id:m,baseElement:b}),[m,b]);return c={id:m,"data-active-item":E||void 0,...c=Z(c,e=>(0,eo.jsx)(eC.Provider,{value:K,children:e}),[K]),ref:X(p,c.ref),tabIndex:I?c.tabIndex:-1,onFocus:O,onBlurCapture:P,onKeyDown:k},c=tE(c),R({...c=tv({store:e,...c,getItem:G,shouldRegisterItem:!!m&&c.shouldRegisterItem}),"aria-setsize":M,"aria-posinset":F})});es(ea(function(e){return el("button",tx(e))}));var tD=eu(function({store:e,value:t,hideOnClick:r,setValueOnClick:n,selectValueOnClick:i=!0,resetValueOnSelect:o,focusOnHover:a=!1,moveOnKeyPress:s=!0,getItem:l,...u}){var c,f;let A=e4();M(e=e||A,!1);let{resetValueOnSelectState:h,multiSelectable:m,selected:p}=tR(e,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,t)}),B=(0,T.useCallback)(e=>{let r={...e,value:t};return l?l(r):r},[t,l]);n=null!=n?n:!m,r=null!=r?r:null!=t&&!m;let C=u.onClick,g=Y(n),v=Y(i),y=Y(null!=(c=null!=o?o:h)?c:m),b=Y(r),E=Q(r=>{null==C||C(r),r.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(r)||!function(e){let t=e.currentTarget;if(!t)return!1;let r=D();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(r)&&(null!=t&&(v(r)&&(y(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),g(r)&&(null==e||e.setValue(t))),b(r)&&(null==e||e.hide()))}),F=u.onKeyDown,S=Q(t=>{if(null==F||F(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||eI(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),d(r)&&(null==e||e.setValue(r.value)))});m&&null!=p&&(u={"aria-selected":p,...u}),u=Z(u,e=>(0,eo.jsx)(tt.Provider,{value:t,children:(0,eo.jsx)(tr.Provider,{value:null!=p&&p,children:e})}),[t,p]),u={role:null!=(f=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,T.useContext)(e2)])?f:"option",children:t,...u,onClick:E,onKeyDown:S};let R=Y(s);return u=tx({store:e,...u,getItem:B,moveOnKeyPress:t=>{if(!R(t))return!1;let r=new Event("combobox-item-move"),n=null==e?void 0:e.getState().baseElement;return null==n||n.dispatchEvent(r),!0}}),u=tg({store:e,focusOnHover:a,...u})}),tw=es(ea(function(e){return el("div",tD(e))}));e.s(["ComboboxItem",()=>tw],56373);var tL=e.i(74080);function t_(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function tO(...e){return e.join(", ").split(", ").reduce((e,t)=>{let r=t.endsWith("ms")?1:1e3,n=Number.parseFloat(t||"0s")*r;return n>e?n:e},0)}function tH(e,t,r){return!r&&!1!==t&&(!e||!!t)}var tP=eu(function({store:e,alwaysVisible:t,...r}){let n=eX();M(e=e||n,!1);let i=(0,T.useRef)(null),o=V(r.id),[a,s]=(0,T.useState)(null),l=e.useState("open"),u=e.useState("mounted"),c=e.useState("animated"),d=e.useState("contentElement"),f=tS(e.disclosure,"contentElement");j(()=>{i.current&&(null==e||e.setContentElement(i.current))},[e]),j(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),j(()=>{if(c){var e;let t;return(null==d?void 0:d.isConnected)?(e=()=>{s(l?"enter":u?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void s(null)}},[c,d,l,u]),j(()=>{if(!e||!c||!a||!d)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,tL.flushSync)(t);if("leave"===a&&l||"enter"===a&&!l)return;if("number"==typeof c)return t_(c,r);let{transitionDuration:n,animationDuration:i,transitionDelay:o,animationDelay:s}=getComputedStyle(d),{transitionDuration:u="0",animationDuration:A="0",transitionDelay:h="0",animationDelay:m="0"}=f?getComputedStyle(f):{},p=tO(o,s,h,m)+tO(n,i,u,A);if(!p){"enter"===a&&e.setState("animated",!1),t();return}return t_(Math.max(p-1e3/60,0),r)},[e,c,d,f,l,a]);let A=tH(u,(r=Z(r,t=>(0,eo.jsx)(eY,{value:e,children:t}),[e])).hidden,t),h=r.style,m=(0,T.useMemo)(()=>A?{...h,display:"none"}:h,[A,h]);return R(r={id:o,"data-open":l||void 0,"data-enter":"enter"===a||void 0,"data-leave":"leave"===a||void 0,hidden:A,...r,ref:X(o?e.setContentElement:null,i,r.ref),style:m})}),tJ=ea(function(e){return el("div",tP(e))});ea(function({unmountOnHide:e,...t}){let r=eX();return!1===tS(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,eo.jsx)(tJ,{...t})});var tU=eu(function({store:e,alwaysVisible:t,...r}){let n=e4(!0),i=e6(),o=!!(e=e||i)&&e===n;M(e,!1);let a=(0,T.useRef)(null),s=V(r.id),l=e.useState("mounted"),u=tH(l,r.hidden,t),c=u?{...r.style,display:"none"}:r.style,d=e.useState(e=>Array.isArray(e.selectedValue)),f=function(e,t,r){let n=function(e){let[t]=(0,T.useState)(e);return t}(r),[i,o]=(0,T.useState)(n);return(0,T.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);o(null==e?n:e)},a=new MutationObserver(i);return a.observe(r,{attributeFilter:[t]}),i(),()=>a.disconnect()},[e,t,n]),i}(a,"role",r.role),A="listbox"===f||"tree"===f||"grid"===f,[h,m]=(0,T.useState)(!1),p=e.useState("contentElement");j(()=>{if(!l)return;let e=a.current;if(!e||p!==e)return;let t=()=>{m(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[l,p]),h||(r={role:"listbox","aria-multiselectable":A&&d||void 0,...r}),r=Z(r,t=>(0,eo.jsx)(te,{value:e,children:(0,eo.jsx)(e2.Provider,{value:f,children:t})}),[e,f]);let B=!s||n&&o?null:e.setContentElement;return R(r={id:s,hidden:u,...r,ref:X(B,a,r.ref),style:c})}),tN=ea(function(e){return el("div",tU(e))});e.s(["ComboboxList",()=>tN,"useComboboxList",()=>tU],86447);var tk=(0,T.createContext)(null),tK=eu(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});ea(function(e){return el("span",tK(e))});var tj=eu(function(e){return tK(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),tQ=ea(function(e){return el("span",tj(e))});function tX(e){queueMicrotask(()=>{null==e||e.focus()})}var tV=eu(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:i,portal:o=!0,...a}){let s=(0,T.useRef)(null),l=X(s,a.ref),u=(0,T.useContext)(tk),[c,d]=(0,T.useState)(null),[f,A]=(0,T.useState)(null),h=(0,T.useRef)(null),m=(0,T.useRef)(null),p=(0,T.useRef)(null),B=(0,T.useRef)(null);return j(()=>{let e=s.current;if(!e||!o)return void d(null);let t=r?"function"==typeof r?r(e):r:n(e).createElement("div");if(!t)return void d(null);let a=t.isConnected;if(a||(u||n(e).body).appendChild(t),t.id||(t.id=e.id?`portal/${e.id}`:function(e="id"){return`${e?`${e}-`:""}${Math.random().toString(36).slice(2,8)}`}()),d(t),G(i,t),!a)return()=>{t.remove(),G(i,null)}},[o,r,u,i]),j(()=>{if(!o||!e||!t)return;let r=n(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),A(r),()=>{r.remove(),A(null)}},[o,e,t]),(0,T.useEffect)(()=>{if(!c||!e)return;let t=0,r=e=>{if(!P(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=c.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(c.hasAttribute("data-tabindex")&&t(c),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of eF(c,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return c.addEventListener("focusin",r,!0),c.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),c.removeEventListener("focusin",r,!0),c.removeEventListener("focusout",r,!0)}},[c,e]),a={...a=Z(a,t=>{if(t=(0,eo.jsx)(tk.Provider,{value:c||u,children:t}),!o)return t;if(!c)return(0,eo.jsx)("span",{ref:l,id:a.id,style:{position:"fixed"},hidden:!0});t=(0,eo.jsxs)(eo.Fragment,{children:[e&&c&&(0,eo.jsx)(tQ,{ref:m,"data-focus-trap":a.id,className:"__focus-trap-inner-before",onFocus:e=>{P(e,c)?tX(eS()):tX(h.current)}}),t,e&&c&&(0,eo.jsx)(tQ,{ref:p,"data-focus-trap":a.id,className:"__focus-trap-inner-after",onFocus:e=>{P(e,c)?tX(eR()):tX(B.current)}})]}),c&&(t=(0,tL.createPortal)(t,c));let r=(0,eo.jsxs)(eo.Fragment,{children:[e&&c&&(0,eo.jsx)(tQ,{ref:h,"data-focus-trap":a.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==B.current&&P(e,c)?tX(m.current):tX(eR())}}),e&&(0,eo.jsx)("span",{"aria-owns":null==c?void 0:c.id,style:{position:"fixed"}}),e&&c&&(0,eo.jsx)(tQ,{ref:B,"data-focus-trap":a.id,className:"__focus-trap-outer-after",onFocus:e=>{if(P(e,c))tX(p.current);else{let e=eS();if(e===m.current)return void requestAnimationFrame(()=>{var e;return null==(e=eS())?void 0:e.focus()});tX(e)}}})]});return f&&e&&(r=(0,tL.createPortal)(r,f)),(0,eo.jsxs)(eo.Fragment,{children:[r,t]})},[c,u,o,a.id,e,f]),ref:l}});ea(function(e){return el("div",tV(e))});var tW=(0,T.createContext)(0);function tq({level:e,children:t}){let r=(0,T.useContext)(tW),n=Math.max(Math.min(e||r+1,6),1);return(0,eo.jsx)(tW.Provider,{value:n,children:t})}var tY=eu(function({autoFocusOnShow:e=!0,...t}){return Z(t,t=>(0,eo.jsx)(ev.Provider,{value:e,children:t}),[e])});ea(function(e){return el("div",tY(e))});var tZ=new WeakMap;function tz(e,t,r){tZ.has(e)||tZ.set(e,new Map);let n=tZ.get(e),i=n.get(t);if(!i)return n.set(t,r()),()=>{var e;null==(e=n.get(t))||e(),n.delete(t)};let o=r(),a=()=>{o(),i(),n.delete(t)};return n.set(t,a),()=>{n.get(t)===a&&(o(),n.set(t,i))}}function t$(e,t,r){return tz(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function t0(e,t,r){return tz(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function t1(e,t){return e?tz(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var t9=["SCRIPT","STYLE"];function t8(e){return`__ariakit-dialog-snapshot-${e}`}function t2(e,t,r,i){for(let o of t){if(!(null==o?void 0:o.isConnected))continue;let s=t.some(e=>!!e&&e!==o&&e.contains(o)),l=n(o),u=o;for(;o.parentElement&&o!==l.body;){if(null==i||i(o.parentElement,u),!s)for(let i of o.parentElement.children)(function(e,t,r){return!t9.includes(t.tagName)&&!!function(e,t){let r=n(t),i=t8(e);if(!r.body[i])return!0;for(;;){if(t===r.body)return!1;if(t[i])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&a(t,e))})(e,i,t)&&r(i,u);o=o.parentElement}}}function t3(e,...t){if(!e)return!1;let r=e.getAttribute("data-backdrop");return null!=r&&(""===r||"true"===r||!t.length||t.some(e=>r===e))}function t6(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function t4(e,t=""){return b(t0(e,t6("",!0),!0),t0(e,t6(t,!0),!0))}function t7(e,t){if(e[t6(t,!0)])return!0;let r=t6(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function t5(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return t2(e,t,t=>{t3(t,...n)||r.unshift(function(e,t=""){return b(t0(e,t6(),!0),t0(e,t6(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(t4(t,e))}),()=>{for(let e of r)e()}}function re({store:e,type:t,listener:r,capture:i,domReady:o}){let s=Q(r),l=tS(e,"open"),u=(0,T.useRef)(!1);j(()=>{if(!l||!o)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{u.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,l,o]),(0,T.useEffect)(()=>{if(l)return U(t,t=>{let{contentElement:r,disclosureElement:i}=e.getState(),o=t.target;!r||!o||!(!("HTML"===o.tagName||a(n(o).body,o))||a(r,o)||function(e,t){if(!e)return!1;if(a(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=n(e).getElementById(r);if(t)return a(e,t)}return!1}(i,o)||o.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(t,r))&&(!u.current||t7(o,r.id))&&(o&&o[ew]||s(t))},i)},[l,i])}function rt(e,t){return"function"==typeof e?e(t):!!e}var rr=(0,T.createContext)({});function rn(){return"inert"in HTMLElement.prototype}function ri(e,t){if(!("style"in e))return v;if(rn())return t0(e,"inert",!0);let r=eF(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&a(t,e)))return v;let r=tz(e,"focus",()=>(e.focus=v,()=>{delete e.focus}));return b(t$(e,"tabindex","-1"),r)});return b(...r,t$(e,"aria-hidden","true"),t1(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function ro(e={}){let t=td(e.store,tc(e.disclosure,["contentElement","disclosureElement"]));tf(e,t);let r=null==t?void 0:t.getState(),n=I(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=I(e.animated,null==r?void 0:r.animated,!1),o=ti({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:I(null==r?void 0:r.contentElement,null),disclosureElement:I(null==r?void 0:r.disclosureElement,null)},t);return to(o,()=>tl(o,["animated","animating"],e=>{e.animated||o.setState("animating",!1)})),to(o,()=>ts(o,["open"],()=>{o.getState().animated&&o.setState("animating",!0)})),to(o,()=>tl(o,["open","animating"],e=>{o.setState("mounted",e.open||e.animating)})),{...o,disclosure:e.disclosure,setOpen:e=>o.setState("open",e),show:()=>o.setState("open",!0),hide:()=>o.setState("open",!1),toggle:()=>o.setState("open",e=>!e),stopAnimation:()=>o.setState("animating",!1),setContentElement:e=>o.setState("contentElement",e),setDisclosureElement:e=>o.setState("disclosureElement",e)}}function ra(e,t,r){return W(t,[r.store,r.disclosure]),tI(e,r,"open","setOpen"),tI(e,r,"mounted","setMounted"),tI(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}eu(function(e){return e});var rs=ea(function(e){return el("div",e)});function rl({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let i=(0,T.useRef)(null),o=function(e={}){let[t,r]=tT(ro,e);return ra(t,r,e)}({disclosure:e}),a=tS(e,"contentElement");(0,T.useEffect)(()=>{let e=i.current;!e||a&&(e.style.zIndex=getComputedStyle(a).zIndex)},[a]),j(()=>{let e=null==a?void 0:a.id;if(!e)return;let t=i.current;if(t)return t4(t,e)},[a]);let s=tP({ref:i,store:o,role:"presentation","data-backdrop":(null==a?void 0:a.id)||"",alwaysVisible:r,hidden:null!=n?n:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!t)return null;if((0,T.isValidElement)(t))return(0,eo.jsx)(rs,{...s,render:t});let l="boolean"!=typeof t?t:"div";return(0,eo.jsx)(rs,{...s,render:(0,eo.jsx)(l,{})})}function ru(e={}){return ro(e)}Object.assign(rs,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=ea(function(e){return el(t,e)}),e),{}));var rc=w();function rd(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?eb(r)?r:null:r:null}var rf=eu(function({store:e,open:t,onClose:s,focusable:u=!0,modal:d=!0,portal:f=!!d,backdrop:A=!!d,hideOnEscape:h=!0,hideOnInteractOutside:m=!0,getPersistentElements:p,preventBodyScroll:B=!!d,autoFocusOnShow:C=!0,autoFocusOnHide:g=!0,initialFocus:v,finalFocus:y,unmountOnHide:E,unstable_treeSnapshotKey:M,...F}){var S;let R,I,G,w=eW(),L=(0,T.useRef)(null),_=function(e={}){let[t,r]=tT(ru,e);return ra(t,r,e)}({store:e||w,open:t,setOpen(e){if(e)return;let t=L.current;if(!t)return;let r=new Event("close",{bubbles:!1,cancelable:!0});s&&t.addEventListener("close",s,{once:!0}),t.dispatchEvent(r),r.defaultPrevented&&_.setOpen(!0)}}),{portalRef:O,domReady:H}=z(f,F.portalRef),P=F.preserveTabOrder,N=tS(_,e=>P&&!d&&e.mounted),k=V(F.id),K=tS(_,"open"),W=tS(_,"mounted"),$=tS(_,"contentElement"),ee=tH(W,F.hidden,F.alwaysVisible);R=function({attribute:e,contentId:t,contentElement:r,enabled:i}){let[o,a]=q(),s=(0,T.useCallback)(()=>{if(!i||!r)return!1;let{body:o}=n(r),a=o.getAttribute(e);return!a||a===t},[o,i,r,e,t]);return(0,T.useEffect)(()=>{if(!i||!t||!r)return;let{body:o}=n(r);if(s())return o.setAttribute(e,t),()=>o.removeAttribute(e);let l=new MutationObserver(()=>(0,tL.flushSync)(a));return l.observe(o,{attributeFilter:[e]}),()=>l.disconnect()},[o,i,t,r,s,e]),s}({attribute:"data-dialog-prevent-body-scroll",contentElement:$,contentId:k,enabled:B&&!ee}),(0,T.useEffect)(()=>{var e,t;if(!R()||!$)return;let o=n($),a=i($),{documentElement:s,body:l}=o,u=s.style.getPropertyValue("--scrollbar-width"),c=u?Number.parseInt(u,10):a.innerWidth-s.clientWidth,d=Math.round(s.getBoundingClientRect().left)+s.scrollLeft?"paddingLeft":"paddingRight",f=D()&&!(r&&navigator.platform.startsWith("Mac")&&!x());return b((e="--scrollbar-width",t=`${c}px`,s?tz(s,e,()=>{let r=s.style.getPropertyValue(e);return s.style.setProperty(e,t),()=>{r?s.style.setProperty(e,r):s.style.removeProperty(e)}}):()=>{}),f?(()=>{var e,t;let{scrollX:r,scrollY:n,visualViewport:i}=a,o=null!=(e=null==i?void 0:i.offsetLeft)?e:0,s=null!=(t=null==i?void 0:i.offsetTop)?t:0,u=t1(l,{position:"fixed",overflow:"hidden",top:`${-(n-Math.floor(s))}px`,left:`${-(r-Math.floor(o))}px`,right:"0",[d]:`${c}px`});return()=>{u(),a.scrollTo({left:r,top:n,behavior:"instant"})}})():t1(l,{overflow:"hidden",[d]:`${c}px`}))},[R,$]),S=tS(_,"open"),I=(0,T.useRef)(null),(0,T.useEffect)(()=>{if(!S){I.current=null;return}return U("mousedown",e=>{I.current=e.target},!0)},[S]),re({...G={store:_,domReady:H,capture:!0},type:"click",listener:e=>{let{contentElement:t}=_.getState(),r=I.current;r&&c(r)&&t7(r,null==t?void 0:t.id)&&rt(m,e)&&_.hide()}}),re({...G,type:"focusin",listener:e=>{let{contentElement:t}=_.getState();!t||e.target===n(t)||rt(m,e)&&_.hide()}}),re({...G,type:"contextmenu",listener:e=>{rt(m,e)&&_.hide()}});let{wrapElement:et,nestedDialogs:er}=function(e){let t=(0,T.useContext)(rr),[r,n]=(0,T.useState)([]),i=(0,T.useCallback)(e=>{var r;return n(t=>[...t,e]),b(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);j(()=>tl(e,["open","contentElement"],r=>{var n;if(r.open&&r.contentElement)return null==(n=t.add)?void 0:n.call(t,e)}),[e,t]);let o=(0,T.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,T.useCallback)(e=>(0,eo.jsx)(rr.Provider,{value:o,children:e}),[o]),nestedDialogs:r}}(_);F=Z(F,et,[et]),j(()=>{if(!K)return;let e=L.current,t=o(e,!0);!t||"BODY"===t.tagName||e&&a(e,t)||_.setDisclosureElement(t)},[_,K]),rc&&(0,T.useEffect)(()=>{if(!W)return;let{disclosureElement:e}=_.getState();if(!e||!l(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),J(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||eG(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[_,W]),(0,T.useEffect)(()=>{if(!W||!H)return;let e=L.current;if(!e)return;let t=i(e),r=t.visualViewport||t,n=()=>{var r,n;let i=null!=(n=null==(r=t.visualViewport)?void 0:r.height)?n:t.innerHeight;e.style.setProperty("--dialog-viewport-height",`${i}px`)};return n(),r.addEventListener("resize",n),()=>{r.removeEventListener("resize",n)}},[W,H]),(0,T.useEffect)(()=>{if(!d||!W||!H)return;let e=L.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=_.hide,(r=n(e).createElement("button")).type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[_,d,W,H]),j(()=>{if(!rn()||K||!W||!H)return;let e=L.current;if(e)return ri(e)},[K,W,H]);let en=K&&H;j(()=>{if(k&&en)return function(e,t){let{body:r}=n(t[0]),i=[];return t2(e,t,t=>{i.push(t0(t,t8(e),!0))}),b(t0(r,t8(e),!0),()=>{for(let e of i)e()})}(k,[L.current])},[k,en,M]);let ei=Q(p);j(()=>{if(!k||!en)return;let{disclosureElement:e}=_.getState(),t=[L.current,...ei()||[],...er.map(e=>e.getState().contentElement)];if(d){let e,r;return b(t5(k,t),(e=[],r=t.map(e=>null==e?void 0:e.id),t2(k,t,n=>{t3(n,...r)||!function(e,...t){if(!e)return!1;let r=e.getAttribute("data-focus-trap");return null!=r&&(!t.length||""!==r&&t.some(e=>r===e))}(n,...r)&&e.unshift(ri(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&a(e,r))||e.unshift(t$(r,"role","none"))}),()=>{for(let t of e)t()}))}return t5(k,[e,...t])},[k,_,en,ei,er,d,M]);let ea=!!C,es=Y(C),[el,eu]=(0,T.useState)(!1);(0,T.useEffect)(()=>{if(!K||!ea||!H||!(null==$?void 0:$.isConnected))return;let e=rd(v,!0)||$.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=eF(e,t,r);return n||null}($,!0,f&&N)||$,t=eb(e);es(t?e:null)&&(eu(!0),queueMicrotask(()=>{e.focus(),!rc||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[K,ea,H,$,v,f,N,es]);let ec=!!g,ed=Y(g),[ef,eA]=(0,T.useState)(!1);(0,T.useEffect)(()=>{if(K)return eA(!0),()=>eA(!1)},[K]);let eh=(0,T.useCallback)((e,t=!0)=>{let r,{disclosureElement:i}=_.getState();if(!(!(r=o())||e&&a(e,r))&&eb(r))return;let s=rd(y)||i;if(null==s?void 0:s.id){let e=n(s),t=`[aria-activedescendant="${s.id}"]`,r=e.querySelector(t);r&&(s=r)}if(s&&!eb(s)){let e=s.closest("[data-dialog]");if(null==e?void 0:e.id){let t=n(e),r=`[aria-controls~="${e.id}"]`,i=t.querySelector(r);i&&(s=i)}}let l=s&&eb(s);!l&&t?requestAnimationFrame(()=>eh(e,!1)):!ed(l?s:null)||l&&(null==s||s.focus({preventScroll:!0}))},[_,y,ed]),em=(0,T.useRef)(!1);j(()=>{if(K||!ef||!ec)return;let e=L.current;em.current=!0,eh(e)},[K,ef,H,ec,eh]),(0,T.useEffect)(()=>{if(!ef||!ec)return;let e=L.current;return()=>{if(em.current){em.current=!1;return}eh(e)}},[ef,ec,eh]);let ep=Y(h);(0,T.useEffect)(()=>{if(H&&W)return U("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=L.current;if(!t||t7(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=_.getState();!("BODY"===r.tagName||a(t,r)||!n||a(n,r))||ep(e)&&_.hide()},!0)},[_,H,W,ep]);let eB=(F=Z(F,e=>(0,eo.jsx)(tq,{level:d?1:void 0,children:e}),[d])).hidden,eC=F.alwaysVisible;F=Z(F,e=>A?(0,eo.jsxs)(eo.Fragment,{children:[(0,eo.jsx)(rl,{store:_,backdrop:A,hidden:eB,alwaysVisible:eC}),e]}):e,[_,A,eB,eC]);let[eg,ev]=(0,T.useState)(),[ey,eE]=(0,T.useState)();return F=tY({...F={id:k,"data-dialog":"",role:"dialog",tabIndex:u?-1:void 0,"aria-labelledby":eg,"aria-describedby":ey,...F=Z(F,e=>(0,eo.jsx)(eY,{value:_,children:(0,eo.jsx)(eZ.Provider,{value:ev,children:(0,eo.jsx)(ez.Provider,{value:eE,children:e})})}),[_]),ref:X(L,F.ref)},autoFocusOnShow:el}),F=tV({portal:f,...F=eU({...F=tP({store:_,...F}),focusable:u}),portalRef:O,preserveTabOrder:N})});function rA(e,t=eW){return ea(function(r){let n=t();return tS(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,eo.jsx)(e,{...r}):null})}rA(ea(function(e){return el("div",rf(e))}),eW);let rh=Math.min,rm=Math.max,rp=Math.round,rB=Math.floor,rC=e=>({x:e,y:e}),rg={left:"right",right:"left",bottom:"top",top:"bottom"},rv={start:"end",end:"start"};function ry(e,t){return"function"==typeof e?e(t):e}function rb(e){return e.split("-")[0]}function rE(e){return e.split("-")[1]}function rM(e){return"x"===e?"y":"x"}function rF(e){return"y"===e?"height":"width"}let rS=new Set(["top","bottom"]);function rR(e){return rS.has(rb(e))?"y":"x"}function rI(e){return e.replace(/start|end/g,e=>rv[e])}let rT=["left","right"],rG=["right","left"],rx=["top","bottom"],rD=["bottom","top"];function rw(e){return e.replace(/left|right|bottom|top/g,e=>rg[e])}function rL(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function r_(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function rO(e,t,r){let n,{reference:i,floating:o}=e,a=rR(t),s=rM(rR(t)),l=rF(s),u=rb(t),c="y"===a,d=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,A=i[l]/2-o[l]/2;switch(u){case"top":n={x:d,y:i.y-o.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:f};break;case"left":n={x:i.x-o.width,y:f};break;default:n={x:i.x,y:i.y}}switch(rE(t)){case"start":n[s]-=A*(r&&c?-1:1);break;case"end":n[s]+=A*(r&&c?-1:1)}return n}async function rH(e,t){var r;void 0===t&&(t={});let{x:n,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:A=0}=ry(t,e),h=rL(A),m=s[f?"floating"===d?"reference":"floating":d],p=r_(await o.getClippingRect({element:null==(r=await (null==o.isElement?void 0:o.isElement(m)))||r?m:m.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),B="floating"===d?{x:n,y:i,width:a.floating.width,height:a.floating.height}:a.reference,C=await (null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),g=await (null==o.isElement?void 0:o.isElement(C))&&await (null==o.getScale?void 0:o.getScale(C))||{x:1,y:1},v=r_(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:B,offsetParent:C,strategy:l}):B);return{top:(p.top-v.top+h.top)/g.y,bottom:(v.bottom-p.bottom+h.bottom)/g.y,left:(p.left-v.left+h.left)/g.x,right:(v.right-p.right+h.right)/g.x}}let rP=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:a}=r,s=o.filter(Boolean),l=await (null==a.isRTL?void 0:a.isRTL(t)),u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=rO(u,n,l),f=n,A={},h=0;for(let r=0;rtypeof window}function rk(e){return rQ(e)?(e.nodeName||"").toLowerCase():"#document"}function rK(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rj(e){var t;return null==(t=(rQ(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function rQ(e){return!!rN()&&(e instanceof Node||e instanceof rK(e).Node)}function rX(e){return!!rN()&&(e instanceof Element||e instanceof rK(e).Element)}function rV(e){return!!rN()&&(e instanceof HTMLElement||e instanceof rK(e).HTMLElement)}function rW(e){return!(!rN()||"u"{try{return e.matches(t)}catch(e){return!1}})}let r0=["transform","translate","scale","rotate","perspective"],r1=["transform","translate","scale","rotate","perspective","filter"],r9=["paint","layout","strict","content"];function r8(e){let t=r2(),r=rX(e)?r4(e):e;return r0.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||r1.some(e=>(r.willChange||"").includes(e))||r9.some(e=>(r.contain||"").includes(e))}function r2(){return!("u"rX(e)&&"body"!==rk(e)),i=null,o="fixed"===r4(e).position,a=o?r5(e):e;for(;rX(a)&&!r6(a);){let t=r4(a),r=r8(a);r||"fixed"!==t.position||(i=null),(o?!r&&!i:!r&&"static"===t.position&&!!i&&nc.has(i.position)||rY(a)&&!r&&function e(t,r){let n=r5(t);return!(n===r||!rX(n)||r6(n))&&("fixed"===r4(n).position||e(n,r))}(e,a))?n=n.filter(e=>e!==a):i=t,a=r5(a)}return t.set(e,n),n}(t,this._c):[].concat(r),n],a=o[0],s=o.reduce((e,r)=>{let n=nd(t,r,i);return e.top=rm(n.top,e.top),e.right=rh(n.right,e.right),e.bottom=rh(n.bottom,e.bottom),e.left=rm(n.left,e.left),e},nd(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:nh,getElementRects:nm,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=nr(e);return{width:t,height:r}},getScale:ni,isElement:rX,isRTL:function(e){return"rtl"===r4(e).direction}};function nB(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nC(e=0,t=0,r=0,n=0){if("function"==typeof DOMRect)return new DOMRect(e,t,r,n);let i={x:e,y:t,width:r,height:n,top:t,right:e+r,bottom:t+n,left:e};return{...i,toJSON:()=>i}}function ng(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function nv(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var ny=eu(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:n=!0,autoFocusOnShow:i=!0,wrapperProps:o,fixed:a=!1,flip:s=!0,shift:l=0,slide:u=!0,overlap:c=!1,sameWidth:d=!1,fitViewport:f=!1,gutter:A,arrowPadding:h=4,overflowPadding:m=8,getAnchorRect:p,updatePosition:B,...C}){let g=e0();M(e=e||g,!1);let v=e.useState("arrowElement"),y=e.useState("anchorElement"),b=e.useState("disclosureElement"),E=e.useState("popoverElement"),F=e.useState("contentElement"),S=e.useState("placement"),R=e.useState("mounted"),I=e.useState("rendered"),G=(0,T.useRef)(null),[x,D]=(0,T.useState)(!1),{portalRef:w,domReady:L}=z(r,C.portalRef),_=Q(p),O=Q(B),H=!!B;j(()=>{if(!(null==E?void 0:E.isConnected))return;E.style.setProperty("--popover-overflow-padding",`${m}px`);let t={contextElement:y||void 0,getBoundingClientRect:()=>{let e=null==_?void 0:_(y);return e||!y?function(e){if(!e)return nC();let{x:t,y:r,width:n,height:i}=e;return nC(t,r,n,i)}(e):y.getBoundingClientRect()}},r=async()=>{var r,n,i,o,p;let B,C,g;if(!R)return;v||(G.current=G.current||document.createElement("div"));let y=v||G.current,b=[(r={gutter:A,shift:l},void 0===(n=({placement:e})=>{var t;let n=((null==y?void 0:y.clientHeight)||0)/2,i="number"==typeof r.gutter?r.gutter+n:null!=(t=r.gutter)?t:n;return{crossAxis:e.split("-")[1]?void 0:r.shift,mainAxis:i,alignmentAxis:r.shift}})&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:o,placement:a,middlewareData:s}=e,l=await rU(e,n);return a===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return M(!r||r.every(ng),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,o,a,s,l,u;let c,d,f,{placement:A,middlewareData:h,rects:m,initialPlacement:p,platform:B,elements:C}=e,{mainAxis:g=!0,crossAxis:v=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:M=!0,...F}=ry(t,e);if(null!=(r=h.arrow)&&r.alignmentOffset)return{};let S=rb(A),R=rR(p),I=rb(p)===p,T=await (null==B.isRTL?void 0:B.isRTL(C.floating)),G=y||(I||!M?[rw(p)]:(c=rw(p),[rI(p),c,rI(c)])),x="none"!==E;!y&&x&&G.push(...(d=rE(p),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?rG:rT;return t?rT:rG;case"left":case"right":return t?rx:rD;default:return[]}}(rb(p),"start"===E,T),d&&(f=f.map(e=>e+"-"+d),M&&(f=f.concat(f.map(rI)))),f));let D=[p,...G],w=await B.detectOverflow(e,F),L=[],_=(null==(n=h.flip)?void 0:n.overflows)||[];if(g&&L.push(w[S]),v){let e,t,r,n,i=(s=A,l=m,void 0===(u=T)&&(u=!1),e=rE(s),r=rF(t=rM(rR(s))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(n=rw(n)),[n,rw(n)]);L.push(w[i[0]],w[i[1]])}if(_=[..._,{placement:A,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=h.flip)?void 0:i.index)||0)+1,t=D[e];if(t&&("alignment"!==v||R===rR(t)||_.every(e=>rR(e.placement)!==R||e.overflows[0]>0)))return{data:{index:e,overflows:_},reset:{placement:t}};let r=null==(o=_.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!r)switch(b){case"bestFit":{let e=null==(a=_.filter(e=>{if(x){let t=rR(e.placement);return t===R||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:a[0];e&&(r=e);break}case"initialPlacement":r=p}if(A!==r)return{reset:{placement:r}}}return{}}}}({flip:s,overflowPadding:m}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:i,rects:o,middlewareData:a}=e,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=ry(t,e),c={x:r,y:n},d=rR(i),f=rM(d),A=c[f],h=c[d],m=ry(s,e),p="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){let e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+p.mainAxis,r=o.reference[f]+o.reference[e]-p.mainAxis;Ar&&(A=r)}if(u){var B,C;let e="y"===f?"width":"height",t=rJ.has(rb(i)),r=o.reference[d]-o.floating[e]+(t&&(null==(B=a.offset)?void 0:B[d])||0)+(t?0:p.crossAxis),n=o.reference[d]+o.reference[e]+(t?0:(null==(C=a.offset)?void 0:C[d])||0)-(t?p.crossAxis:0);hn&&(h=n)}return{[f]:A,[d]:h}}})},async fn(e){let{x:t,y:n,placement:i,platform:o}=e,{mainAxis:a=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...u}=ry(r,e),c={x:t,y:n},d=await o.detectOverflow(e,u),f=rR(rb(i)),A=rM(f),h=c[A],m=c[f];if(a){let e="y"===A?"top":"left",t="y"===A?"bottom":"right",r=h+d[e],n=h-d[t];h=rm(r,rh(h,n))}if(s){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+d[e],n=m-d[t];m=rm(r,rh(m,n))}let p=l.fn({...e,[A]:h,[f]:m});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[A]:a,[f]:s}}}}}}}({slide:u,shift:l,overlap:c,overflowPadding:m}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:n,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=ry(r,e)||{};if(null==u)return{};let d=rL(c),f={x:t,y:n},A=rM(rR(i)),h=rF(A),m=await a.getDimensions(u),p="y"===A,B=p?"clientHeight":"clientWidth",C=o.reference[h]+o.reference[A]-f[A]-o.floating[h],g=f[A]-o.reference[A],v=await (null==a.getOffsetParent?void 0:a.getOffsetParent(u)),y=v?v[B]:0;y&&await (null==a.isElement?void 0:a.isElement(v))||(y=s.floating[B]||o.floating[h]);let b=y/2-m[h]/2-1,E=rh(d[p?"top":"left"],b),M=rh(d[p?"bottom":"right"],b),F=y-m[h]-M,S=y/2-m[h]/2+(C/2-g/2),R=rm(E,rh(S,F)),I=!l.arrow&&null!=rE(i)&&S!==R&&o.reference[h]/2-(S{},...d}=ry(o,e),f=await l.detectOverflow(e,d),A=rb(a),h=rE(a),m="y"===rR(a),{width:p,height:B}=s.floating;"top"===A||"bottom"===A?(n=A,i=h===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(i=A,n="end"===h?"top":"bottom");let C=B-f.top-f.bottom,g=p-f.left-f.right,v=rh(B-f[n],C),y=rh(p-f[i],g),b=!e.middlewareData.shift,E=v,M=y;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(M=g),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(E=C),b&&!h){let e=rm(f.left,0),t=rm(f.right,0),r=rm(f.top,0),n=rm(f.bottom,0);m?M=p-2*(0!==e||0!==t?e+t:rm(f.left,f.right)):E=B-2*(0!==r||0!==n?r+n:rm(f.top,f.bottom))}await c({...e,availableWidth:M,availableHeight:E});let F=await l.getDimensions(u.floating);return p!==F.width||B!==F.height?{reset:{rects:!0}}:{}}}],F=await (p={placement:S,strategy:a?"fixed":"absolute",middleware:b},B=new Map,g={...(C={platform:np,...p}).platform,_c:B},rP(t,E,{...C,platform:g}));null==e||e.setState("currentPlacement",F.placement),D(!0);let I=nv(F.x),T=nv(F.y);if(Object.assign(E.style,{top:"0",left:"0",transform:`translate3d(${I}px,${T}px,0)`}),y&&F.middlewareData.arrow){let{x:e,y:t}=F.middlewareData.arrow,r=F.placement.split("-")[0],n=y.clientWidth/2,i=y.clientHeight/2,o=null!=e?e+n:-n,a=null!=t?t+i:-i;E.style.setProperty("--popover-transform-origin",{top:`${o}px calc(100% + ${i}px)`,bottom:`${o}px ${-i}px`,left:`calc(100% + ${n}px) ${a}px`,right:`${-n}px ${a}px`}[r]),Object.assign(y.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[r]:"100%"})}},n=function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=nn(e),d=o||a?[...c?ne(c):[],...ne(t)]:[];d.forEach(e=>{o&&e.addEventListener("scroll",r,{passive:!0}),a&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,n=null,i=rj(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:A}=u;if(s||t(),!f||!A)return;let h={rootMargin:-rB(d)+"px "+-rB(i.clientWidth-(c+f))+"px "+-rB(i.clientHeight-(d+A))+"px "+-rB(c)+"px",threshold:rm(0,rh(1,l))||1},m=!0;function p(t){let n=t[0].intersectionRatio;if(n!==l){if(!m)return a();n?a(!1,n):r=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==n||nB(u,e.getBoundingClientRect())||a(),m=!1}try{n=new IntersectionObserver(p,{...h,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(p,h)}n.observe(e)}(!0),o}(c,r):null,A=-1,h=null;s&&(h=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(A),A=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),r()}),c&&!u&&h.observe(c),h.observe(t));let m=u?ns(e):null;return u&&function t(){let n=ns(e);m&&!nB(m,n)&&r(),m=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",r),a&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,u&&cancelAnimationFrame(i)}}(t,E,async()=>{H?(await O({updatePosition:r}),D(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{D(!1),n()}},[e,I,E,v,y,E,S,R,L,a,s,l,u,c,d,f,A,h,m,_,H,O]),j(()=>{if(!R||!L||!(null==E?void 0:E.isConnected)||!(null==F?void 0:F.isConnected))return;let e=()=>{E.style.zIndex=getComputedStyle(F).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[R,L,E,F]);let P=a?"fixed":"absolute";return C=Z(C,t=>(0,eo.jsx)("div",{...o,style:{position:P,top:0,left:0,width:"max-content",...null==o?void 0:o.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,P,o]),C={"data-placing":!x||void 0,...C=Z(C,t=>(0,eo.jsx)(e9,{value:e,children:t}),[e]),style:{position:"relative",...C.style}},C=rf({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:b||y,autoFocusOnShow:x&&i,...C,portalRef:w})});rA(ea(function(e){return el("div",ny(e))}),e0);var nb=eu(function({store:e,modal:t,tabIndex:r,alwaysVisible:i,autoFocusOnHide:o=!0,hideOnInteractOutside:a=!0,...s}){let l=e7();M(e=e||l,!1);let u=e.useState("baseElement"),c=(0,T.useRef)(!1),d=tS(e.tag,e=>null==e?void 0:e.renderedItems.length);return s=tU({store:e,alwaysVisible:i,...s}),s=ny({store:e,modal:t,alwaysVisible:i,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...s,getPersistentElements(){var r;let i=(null==(r=s.getPersistentElements)?void 0:r.call(s))||[];if(!t||!e)return i;let{contentElement:o,baseElement:a}=e.getState();if(!a)return i;let l=n(a),u=[];if((null==o?void 0:o.id)&&u.push(`[aria-controls~="${o.id}"]`),(null==a?void 0:a.id)&&u.push(`[aria-controls~="${a.id}"]`),!u.length)return[...i,a];let c=u.join(",");return[...i,...l.querySelectorAll(c)]},autoFocusOnHide:e=>!F(o,e)&&(!c.current||(c.current=!1,!1)),hideOnInteractOutside(t){var r,n;let i=null==e?void 0:e.getState(),o=null==(r=null==i?void 0:i.contentElement)?void 0:r.id,s=null==(n=null==i?void 0:i.baseElement)?void 0:n.id;if(function(e,...t){if(!e)return!1;if("id"in e){let r=t.filter(Boolean).map(e=>`[aria-controls~="${e}"]`).join(", ");return!!r&&e.matches(r)}return!1}(t.target,o,s))return!1;let l="function"==typeof a?a(t):a;return l&&(c.current="click"===t.type),l}})}),nE=rA(ea(function(e){return el("div",nb(e))}),e7);e.s(["ComboboxPopover",()=>nE],1559),(0,T.createContext)(null),(0,T.createContext)(null);var nM=ec([ep],[eB]),nF=nM.useContext;nM.useScopedContext,nM.useProviderContext,nM.ContextProvider,nM.ScopedContextProvider;var nS={id:null};function nR(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function nI(e,t){return e.filter(e=>e.rowId===t)}function nT(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function nG(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var nx=w()&&x();function nD({tag:e,...t}={}){let r=td(t.store,function(e,...t){if(e)return tn(e,"pick")(...t)}(e,["value","rtl"]));tf(t,r);let i=null==e?void 0:e.getState(),o=null==r?void 0:r.getState(),a=I(t.activeId,null==o?void 0:o.activeId,t.defaultActiveId,null),s=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),i=function(e={}){var t,r;tf(e,e.store);let i=null==(t=e.store)?void 0:t.getState(),o=I(e.items,null==i?void 0:i.items,e.defaultItems,[]),a=new Map(o.map(e=>[e.id,e])),s={items:o,renderedItems:I(null==i?void 0:i.renderedItems,[])},l=null==(r=e.store)?void 0:r.__unstablePrivateStore,u=ti({items:o,renderedItems:s.renderedItems},l),c=ti(s,e.store),d=e=>{var t;let r,n,i=(t=e=>e.element,r=e.map((e,t)=>[t,e]),n=!1,(r.sort(([e,r],[i,o])=>{var a;let s=t(r),l=t(o);return s!==l&&s&&l?(a=s,l.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING)?(e>i&&(n=!0),-1):(et):e);u.setState("renderedItems",i),c.setState("renderedItems",i)};to(c,()=>ta(u)),to(u,()=>tu(u,["items"],e=>{c.setState("items",e.items)})),to(u,()=>tu(u,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=c.getState();e.renderedItems!==t&&d(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let i=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>d(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),i=[...e].reverse().find(e=>!!e.element),o=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;o&&(null==i?void 0:i.element);){let e=o;if(i&&e.contains(i.element))return o;o=o.parentElement}return n(o).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(r),i.disconnect()}}));let f=(e,t,r=!1)=>{let n;return t(t=>{let r=t.findIndex(({id:t})=>t===e.id),i=t.slice();if(-1!==r){let o={...n=t[r],...e};i[r]=o,a.set(e.id,o)}else i.push(e),a.set(e.id,e);return i}),()=>{t(t=>{if(!n)return r&&a.delete(e.id),t.filter(({id:t})=>t!==e.id);let i=t.findIndex(({id:t})=>t===e.id);if(-1===i)return t;let o=t.slice();return o[i]=n,a.set(e.id,n),o})}},A=e=>f(e,e=>u.setState("items",e),!0);return{...c,registerItem:A,renderItem:e=>b(A(e),f(e,e=>u.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=u.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:u}}(e),o=I(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=ti({...i.getState(),id:I(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:o,baseElement:I(null==r?void 0:r.baseElement,null),includesBaseElement:I(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===o),moves:I(null==r?void 0:r.moves,0),orientation:I(e.orientation,null==r?void 0:r.orientation,"both"),rtl:I(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:I(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:I(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:I(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:I(e.focusShift,null==r?void 0:r.focusShift,!1)},i,e.store);to(a,()=>tl(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=nR(e.renderedItems))?void 0:r.id})}));let s=(e="next",t={})=>{var r,n;let i=a.getState(),{skip:o=0,activeId:s=i.activeId,focusShift:l=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:A=i.rtl}=t,h="up"===e||"down"===e,m="next"===e||"down"===e,p=h?eN(function(e,t,r){let n=nG(e);for(let i of e)for(let e=0;ee.id===s);if(!B)return null==(n=nR(p))?void 0:n.id;let C=p.some(e=>e.rowId),g=p.indexOf(B),v=p.slice(g+1),y=nI(v,B.rowId);if(o){let e=y.filter(e=>s?!e.disabled&&e.id!==s:!e.disabled),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}let b=u&&(h?"horizontal"!==u:"vertical"!==u),E=C&&c&&(h?"horizontal"!==c:"vertical"!==c),M=m?(!C||h)&&b&&d:!!h&&d;if(b){let e=nR(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[nS]:[],...e.slice(0,n)]}(E&&!M?p:nI(p,B.rowId),s,M),s);return null==e?void 0:e.id}if(E){let e=nR(M?y:v,s);return M?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let F=nR(y,s);return!F&&M?null:null==F?void 0:F.id};return{...i,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=nR(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=nR(ek(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("up",e))}}({...t,activeId:a,includesBaseElement:I(t.includesBaseElement,null==o?void 0:o.includesBaseElement,!0),orientation:I(t.orientation,null==o?void 0:o.orientation,"vertical"),focusLoop:I(t.focusLoop,null==o?void 0:o.focusLoop,!0),focusWrap:I(t.focusWrap,null==o?void 0:o.focusWrap,!0),virtualFocus:I(t.virtualFocus,null==o?void 0:o.virtualFocus,!0)}),l=function({popover:e,...t}={}){let r=td(t.store,tc(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));tf(t,r);let n=null==r?void 0:r.getState(),i=ru({...t,store:r}),o=I(t.placement,null==n?void 0:n.placement,"bottom"),a=ti({...i.getState(),placement:o,currentPlacement:o,anchorElement:I(null==n?void 0:n.anchorElement,null),popoverElement:I(null==n?void 0:n.popoverElement,null),arrowElement:I(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...a,setAnchorElement:e=>a.setState("anchorElement",e),setPopoverElement:e=>a.setState("popoverElement",e),setArrowElement:e=>a.setState("arrowElement",e),render:()=>a.setState("rendered",Symbol("rendered"))}}({...t,placement:I(t.placement,null==o?void 0:o.placement,"bottom-start")}),u=I(t.value,null==o?void 0:o.value,t.defaultValue,""),c=I(t.selectedValue,null==o?void 0:o.selectedValue,null==i?void 0:i.values,t.defaultSelectedValue,""),d=Array.isArray(c),f={...s.getState(),...l.getState(),value:u,selectedValue:c,resetValueOnSelect:I(t.resetValueOnSelect,null==o?void 0:o.resetValueOnSelect,d),resetValueOnHide:I(t.resetValueOnHide,null==o?void 0:o.resetValueOnHide,d&&!e),activeValue:null==o?void 0:o.activeValue},A=ti(f,s,l,r);return nx&&to(A,()=>tl(A,["virtualFocus"],()=>{A.setState("virtualFocus",!1)})),to(A,()=>{if(e)return b(tl(A,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),tl(e,["values"],e=>{A.setState("selectedValue",e.values)}))}),to(A,()=>tl(A,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||A.setState("value",u)})),to(A,()=>tl(A,["open"],e=>{e.open||(A.setState("activeId",a),A.setState("moves",0))})),to(A,()=>tl(A,["moves","activeId"],(e,t)=>{e.moves===t.moves&&A.setState("activeValue",void 0)})),to(A,()=>tu(A,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=A.getState(),n=s.item(r);A.setState("activeValue",null==n?void 0:n.value)})),{...l,...s,...A,tag:e,setValue:e=>A.setState("value",e),resetValue:()=>A.setState("value",f.value),setSelectedValue:e=>A.setState("selectedValue",e)}}function nw(e={}){var t,r,n,i,o,a,s,l;let u;t=e,u=nF();let[c,d]=tT(nD,e={id:V((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return W(d,[(n=e).tag]),tI(c,n,"value","setValue"),tI(c,n,"selectedValue","setSelectedValue"),tI(c,n,"resetValueOnHide"),tI(c,n,"resetValueOnSelect"),Object.assign((a=c,W(s=d,[(l=n).popover]),tI(a,l,"placement"),i=ra(a,s,l),o=i,W(d,[n.store]),tI(o,n,"items","setItems"),tI(i=o,n,"activeId","setActiveId"),tI(i,n,"includesBaseElement"),tI(i,n,"virtualFocus"),tI(i,n,"orientation"),tI(i,n,"rtl"),tI(i,n,"focusLoop"),tI(i,n,"focusWrap"),tI(i,n,"focusShift"),i),{tag:n.tag})}function nL(e={}){let t=nw(e);return(0,eo.jsx)(e5,{value:t,children:e.children})}e.s(["useComboboxStore",()=>nw],18364),e.s(["ComboboxProvider",()=>nL],78440);var n_=(0,T.createContext)(void 0),nO=eu(function(e){let[t,r]=(0,T.useState)();return R(e={role:"group","aria-labelledby":t,...e=Z(e,e=>(0,eo.jsx)(n_.Provider,{value:r,children:e}),[])})});ea(function(e){return el("div",nO(e))});var nH=eu(function({store:e,...t}){return nO(t)});ea(function(e){return el("div",nH(e))});var nP=eu(function({store:e,...t}){let r=e4();return M(e=e||r,!1),"grid"===h(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=nH({store:e,...t})}),nJ=ea(function(e){return el("div",nP(e))});e.s(["ComboboxGroup",()=>nJ],59129);var nU=eu(function(e){let t=(0,T.useContext)(n_),r=V(e.id);return j(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),R(e={id:r,"aria-hidden":!0,...e})});ea(function(e){return el("div",nU(e))});var nN=eu(function({store:e,...t}){return nU(t)});ea(function(e){return el("div",nN(e))});var nk=eu(function(e){return nN(e)}),nK=ea(function(e){return el("div",nk(e))});e.s(["ComboboxGroupLabel",()=>nK],25998);var nj=e.i(38360);let nQ={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},nX=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function nV(e,t,r={}){let{keys:n,threshold:i=nQ.MATCHES,baseSort:o=nX,sorter:a=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:o,keyIndex:a}=t;return n!==o?n>o?-1:1:i===a?r(e,t):i{let s=nW(i,u,c),l=t,{minRanking:d,maxRanking:f,threshold:A}=o;return s=nQ.MATCHES?s=d:s>f&&(s=f),s>e&&(e=s,r=a,n=A,l=i),{rankedValue:l,rank:e,keyIndex:r,keyThreshold:n}},{rankedValue:s,rank:nQ.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:nW(s,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:A=i}=d;return f>=A&&e.push({...d,item:o,index:a}),e},[])).map(({item:e})=>e)}function nW(e,t,r){if(e=nq(e,r),(t=nq(t,r)).length>e.length)return nQ.NO_MATCH;if(e===t)return nQ.CASE_SENSITIVE_EQUAL;let n=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),i=n.next(),o=i.value;if(e.length===t.length&&0===o)return nQ.EQUAL;if(0===o)return nQ.STARTS_WITH;let a=i;for(;!a.done;){if(a.value>0&&" "===e[a.value-1])return nQ.WORD_STARTS_WITH;a=n.next()}return o>0?nQ.CONTAINS:1===t.length?nQ.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return nQ.NO_MATCH;return r=o-s,n=i/t.length,nQ.MATCHES+1/r*n}(e,t)}function nq(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,nj.default)(e)),e}nV.rankings=nQ;let nY={maxRanking:1/0,minRanking:-1/0};e.s(["matchSorter",()=>nV],70238)},29402,(e,t,r)=>{var n,i,o,a,s="__lodash_hash_undefined__",l=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",A="[object Error]",h="[object Function]",m="[object Map]",p="[object Number]",B="[object Object]",C="[object Promise]",g="[object RegExp]",v="[object Set]",y="[object String]",b="[object Symbol]",E="[object WeakMap]",M="[object ArrayBuffer]",F="[object DataView]",S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,R=/^\w*$/,I=/^\./,T=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/\\(\\)?/g,x=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,w={};w["[object Float32Array]"]=w["[object Float64Array]"]=w["[object Int8Array]"]=w["[object Int16Array]"]=w["[object Int32Array]"]=w["[object Uint8Array]"]=w["[object Uint8ClampedArray]"]=w["[object Uint16Array]"]=w["[object Uint32Array]"]=!0,w[u]=w[c]=w[M]=w[d]=w[F]=w[f]=w[A]=w[h]=w[m]=w[p]=w[B]=w[g]=w[v]=w[y]=w[E]=!1;var L=e.g&&e.g.Object===Object&&e.g,_="object"==typeof self&&self&&self.Object===Object&&self,O=L||_||Function("return this")(),H=r&&!r.nodeType&&r,P=H&&t&&!t.nodeType&&t,J=P&&P.exports===H&&L.process,U=function(){try{return J&&J.binding("util")}catch(e){}}(),N=U&&U.isTypedArray;function k(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eS(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},eE.prototype.clear=function(){this.__data__={hash:new ey,map:new(el||eb),string:new ey}},eE.prototype.delete=function(e){return eL(this,e).delete(e)},eE.prototype.get=function(e){return eL(this,e).get(e)},eE.prototype.has=function(e){return eL(this,e).has(e)},eE.prototype.set=function(e,t){return eL(this,e).set(e,t),this},eM.prototype.add=eM.prototype.push=function(e){return this.__data__.set(e,s),this},eM.prototype.has=function(e){return this.__data__.has(e)},eF.prototype.clear=function(){this.__data__=new eb},eF.prototype.delete=function(e){return this.__data__.delete(e)},eF.prototype.get=function(e){return this.__data__.get(e)},eF.prototype.has=function(e){return this.__data__.has(e)},eF.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!el||n.length<199)return n.push([e,t]),this;r=this.__data__=new eE(n)}return r.set(e,t),this};var eR=(n=function(e,t){return e&&eI(e,t,e0)},function(e,t){if(null==e)return e;if(!eV(e))return n(e,t);for(var r=e.length,i=-1,o=Object(e);++is))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var c=-1,d=!0,f=1&i?new eM:void 0;for(o.set(e,t),o.set(t,e);++c-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eY(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eZ(e){return!!e&&"object"==typeof e}function ez(e){return"symbol"==typeof e||eZ(e)&&ee.call(e)==b}var e$=N?K(N):function(e){return eZ(e)&&eq(e.length)&&!!w[ee.call(e)]};function e0(e){return eV(e)?function(e,t){var r=eX(e)||eQ(e)?function(e,t){for(var r=-1,n=Array(e);++rt||o&&a&&l&&!s&&!u||n&&a&&l||!r&&l||!i)return 1;if(!n&&!o&&!u&&e=s)return l;return l*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});l--;)s[l]=s[l].value;return s}(e,t,r))}},97442,e=>{e.v({Group:"MissionSelect-module__N_AIjG__Group",GroupLabel:"MissionSelect-module__N_AIjG__GroupLabel",Input:"MissionSelect-module__N_AIjG__Input",InputWrapper:"MissionSelect-module__N_AIjG__InputWrapper",Item:"MissionSelect-module__N_AIjG__Item",ItemHeader:"MissionSelect-module__N_AIjG__ItemHeader",ItemMissionName:"MissionSelect-module__N_AIjG__ItemMissionName",ItemName:"MissionSelect-module__N_AIjG__ItemName",ItemType:"MissionSelect-module__N_AIjG__ItemType",ItemTypes:"MissionSelect-module__N_AIjG__ItemTypes",List:"MissionSelect-module__N_AIjG__List",NoResults:"MissionSelect-module__N_AIjG__NoResults",Popover:"MissionSelect-module__N_AIjG__Popover",SelectedName:"MissionSelect-module__N_AIjG__SelectedName",SelectedValue:"MissionSelect-module__N_AIjG__SelectedValue",Shortcut:"MissionSelect-module__N_AIjG__Shortcut"})},81405,(e,t,r)=>{var n;e.e,(n=function(){function e(e){return i.appendChild(e.dom),e}function t(e){for(var t=0;ta+1e3&&(l.update(1e3*s/(e-a),100),a=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){o=this.end()},domElement:i,setMode:t}}).Panel=function(e,t,r){var n=1/0,i=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,l=48*a,u=3*a,c=2*a,d=3*a,f=15*a,A=74*a,h=30*a,m=document.createElement("canvas");m.width=s,m.height=l,m.style.cssText="width:80px;height:48px";var p=m.getContext("2d");return p.font="bold "+9*a+"px Helvetica,Arial,sans-serif",p.textBaseline="top",p.fillStyle=r,p.fillRect(0,0,s,l),p.fillStyle=t,p.fillText(e,u,c),p.fillRect(d,f,A,h),p.fillStyle=r,p.globalAlpha=.9,p.fillRect(d,f,A,h),{dom:m,update:function(l,B){n=Math.min(n,l),i=Math.max(i,l),p.fillStyle=r,p.globalAlpha=1,p.fillRect(0,0,s,f),p.fillStyle=t,p.fillText(o(l)+" "+e+" ("+o(n)+"-"+o(i)+")",u,c),p.drawImage(m,d+a,f,A-a,h,d,f,A-a,h),p.fillRect(d+A-a,f,a,h),p.fillStyle=r,p.globalAlpha=.9,p.fillRect(d+A-a,f,a,o((1-l/B)*h))}}},t.exports=n},55141,e=>{e.v({AxisLabel:"DebugElements-module__Cmeo9W__AxisLabel",StatsPanel:"DebugElements-module__Cmeo9W__StatsPanel"})},86855,e=>{"use strict";var t=e.i(43476),r=e.i(932),n=e.i(71645),i=e.i(40859),i=i,o=i,a=e.i(81405);function s(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function l({showPanel:e=0,className:t,parent:r}){let l=function(e,t=[],r){let[i,o]=n.useState();return n.useLayoutEffect(()=>{let t=e();return o(t),s(void 0,t),()=>s(void 0,null)},t),i}(()=>new a.default,[]);return n.useEffect(()=>{if(l){let n=r&&r.current||document.body;l.showPanel(e),null==n||n.appendChild(l.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&l.dom.classList.add(...a);let s=(0,i.j)(()=>l.begin()),u=(0,o.k)(()=>l.end());return()=>{a.length&&l.dom.classList.remove(...a),null==n||n.removeChild(l.dom),s(),u()}}},[r,l,t,e]),null}var u=e.i(60099),c=e.i(79123),d=e.i(55141);function f(){let e,i,o=(0,r.c)(3),{debugMode:a}=(0,c.useDebug)(),s=(0,n.useRef)(null);return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=s.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},o[0]=e):e=o[0],(0,n.useEffect)(e),o[1]!==a?(i=a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l,{className:d.default.StatsPanel}),(0,t.jsx)("axesHelper",{ref:s,args:[70],renderOrder:999,children:(0,t.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,t.jsx)(u.Html,{position:[80,0,0],center:!0,children:(0,t.jsx)("span",{className:d.default.AxisLabel,"data-axis":"y",children:"Y"})}),(0,t.jsx)(u.Html,{position:[0,80,0],center:!0,children:(0,t.jsx)("span",{className:d.default.AxisLabel,"data-axis":"z",children:"Z"})}),(0,t.jsx)(u.Html,{position:[0,0,80],center:!0,children:(0,t.jsx)("span",{className:d.default.AxisLabel,"data-axis":"x",children:"X"})})]}):null,o[1]=a,o[2]=i):i=o[2],i}e.s(["DebugElements",()=>f],86855)},38847,e=>{"use strict";var t=e.i(80902),r=e.i(22289),n=e.i(71645);function i(e,t,n){try{return e(t)}catch(e){return(0,r.l)("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":""),t,e,n),null}}function o(e){function t(t){if(void 0===t)return null;let r="";if(Array.isArray(t)){if(void 0===t[0])return null;r=t[0]}return"string"==typeof t&&(r=t),i(e.parse,r)}return{type:"single",eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:r=>t(r)??e}},withOptions(e){return{...this,...e}}}}o({parse:e=>e,serialize:String}),o({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),o({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),o({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(1&t.length?"0":"")+t}}),o({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let a=o({parse:e=>"true"===e.toLowerCase(),serialize:String});function s(e,t){return e.valueOf()===t.valueOf()}o({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:s}),o({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:s}),o({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:s});let l=(0,t.r)(),u={};function c(e,r,n,o,a,s){let l=!1,u=Object.entries(e).reduce((e,[u,c])=>{var d;let f=r?.[u]??u,A=o[f],h="multi"===c.type?[]:null,m=void 0===A?("multi"===c.type?n?.getAll(f):n?.get(f))??h:A;return a&&s&&((d=a[f]??h)===m||null!==d&&null!==m&&"string"!=typeof d&&"string"!=typeof m&&d.length===m.length&&d.every((e,t)=>e===m[t]))?e[u]=s[u]??null:(l=!0,e[u]=((0,t.i)(m)?null:i(c.parse,m,f))??null,a&&(a[f]=m)),e},{});if(!l){let t=Object.keys(e),r=Object.keys(s??{});l=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:u,hasChanged:l}}function d(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function f(e,i={}){let{parse:o,type:a,serialize:s,eq:A,defaultValue:h,...m}=i,[{[e]:p},B]=function(e,i={}){let o=(0,n.useId)(),a=(0,r.i)(),s=(0,r.a)(),{history:f="replace",scroll:A=a?.scroll??!1,shallow:h=a?.shallow??!0,throttleMs:m=t.s.timeMs,limitUrlUpdates:p=a?.limitUrlUpdates,clearOnDefault:B=a?.clearOnDefault??!0,startTransition:C,urlKeys:g=u}=i,v=Object.keys(e).join(","),y=(0,n.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,g[e]??e])),[v,JSON.stringify(g)]),b=(0,r.r)(Object.values(y)),E=b.searchParams,M=(0,n.useRef)({}),F=(0,n.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),S=t.t.useQueuedQueries(Object.values(y)),[R,I]=(0,n.useState)(()=>c(e,g,E??new URLSearchParams,S).state),T=(0,n.useRef)(R);if((0,r.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",o,v,R,E),Object.keys(M.current).join("&")!==Object.values(y).join("&")){let{state:t,hasChanged:n}=c(e,g,E,S,M.current,T.current);n&&((0,r.c)("[nuq+ %s `%s`] State changed: %O",o,v,{state:t,initialSearchParams:E,queuedQueries:S,queryRef:M.current,stateRef:T.current}),T.current=t,I(t)),M.current=Object.fromEntries(Object.entries(y).map(([t,r])=>[r,e[t]?.type==="multi"?E?.getAll(r):E?.get(r)??null]))}(0,n.useEffect)(()=>{let{state:t,hasChanged:n}=c(e,g,E,S,M.current,T.current);n&&((0,r.c)("[nuq+ %s `%s`] State changed: %O",o,v,{state:t,initialSearchParams:E,queuedQueries:S,queryRef:M.current,stateRef:T.current}),T.current=t,I(t))},[Object.values(y).map(e=>`${e}=${E?.getAll(e)}`).join("&"),JSON.stringify(S)]),(0,n.useEffect)(()=>{let t=Object.keys(e).reduce((t,n)=>(t[n]=({state:t,query:i})=>{I(a=>{let{defaultValue:s}=e[n],l=y[n],u=t??s??null;return Object.is(a[n]??s??null,u)?((0,r.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",o,v,l,t,s,T.current),a):(T.current={...T.current,[n]:u},M.current[l]=i,(0,r.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",o,v,l,t,s,T.current),T.current)})},t),{});for(let n of Object.keys(e)){let e=y[n];(0,r.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",o,e,v),l.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=y[n];(0,r.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",o,e,v),l.off(e,t[n])}}},[v,y]);let G=(0,n.useCallback)((n,i={})=>{let a,u=Object.fromEntries(Object.keys(e).map(e=>[e,null])),c="function"==typeof n?n(d(T.current,F))??u:n??u;(0,r.c)("[nuq+ %s `%s`] setState: %O",o,v,c);let g=0,E=!1,M=[];for(let[n,o]of Object.entries(c)){let u=e[n],c=y[n];if(!u||void 0===o)continue;(i.clearOnDefault??u.clearOnDefault??B)&&null!==o&&void 0!==u.defaultValue&&(u.eq??((e,t)=>e===t))(o,u.defaultValue)&&(o=null);let d=null===o?null:(u.serialize??String)(o);l.emit(c,{state:o,query:d});let v={key:c,query:d,options:{history:i.history??u.history??f,shallow:i.shallow??u.shallow??h,scroll:i.scroll??u.scroll??A,startTransition:i.startTransition??u.startTransition??C}};if(i?.limitUrlUpdates?.method==="debounce"||p?.method==="debounce"||u.limitUrlUpdates?.method==="debounce"){!0===v.options.shallow&&console.warn((0,r.s)(422));let e=i?.limitUrlUpdates?.timeMs??p?.timeMs??u.limitUrlUpdates?.timeMs??t.s.timeMs,n=t.t.push(v,e,b,s);gt(e),E?t.n.flush(b,s):t.n.getPendingPromise(b));return a??S},[v,f,h,A,m,p?.method,p?.timeMs,C,y,b.updateUrl,b.getSearchParamsSnapshot,b.rateLimitFactor,s,F]);return[(0,n.useMemo)(()=>d(R,F),[R,F]),G]}({[e]:{parse:o??(e=>e),type:a,serialize:s,eq:A,defaultValue:h}},m);return[p,(0,n.useCallback)((t,r={})=>B(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,B])]}e.s(["createParser",()=>o,"parseAsBoolean",()=>a,"useQueryState",()=>f],38847)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/89fcb9c19e93d0ef.js b/docs/_next/static/chunks/89fcb9c19e93d0ef.js new file mode 100644 index 00000000..48874b8c --- /dev/null +++ b/docs/_next/static/chunks/89fcb9c19e93d0ef.js @@ -0,0 +1,2 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,80902,22289,e=>{"use strict";var t=e.i(47167),r=e.i(71645);let s=function(){if("u"{let r=t.shift();return"%O"===e&&r?JSON.stringify(r).replace(/"([^"]+)":/g,"$1:"):String(r)})}(e,...t);performance.mark(r);try{console.log(e,...t)}catch{console.log(r)}}function u(e,...t){s&&console.warn(e,...t)}let o={303:"Multiple adapter contexts detected. This might happen in monorepos.",404:"nuqs requires an adapter to work with your framework.",409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",422:"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:"Empty search params cache. Search params can't be accessed in Layouts.",501:"Search params cache already populated. Have you called `parse` twice?"};function i(e){return`[nuqs] ${o[e]} + See https://nuqs.dev/NUQS-${e}`}function l(e){if(0===e.size)return"";let t=[];for(let[r,s]of e.entries()){let e=r.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${e}=${s.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(//g,"%3E").replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}`)}return"?"+t.join("&")}let a=(0,r.createContext)({useAdapter(){throw Error(i(404))}});function c(e){return({children:t,defaultOptions:s,processUrlSearchParams:n,...u})=>(0,r.createElement)(a.Provider,{...u,value:{useAdapter:e,defaultOptions:s,processUrlSearchParams:n}},t)}function h(e){let t=(0,r.useContext)(a);if(!("useAdapter"in t))throw Error(i(404));return t.useAdapter(e)}a.displayName="NuqsAdapterContext",s&&"u">typeof window&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==a&&console.error(i(303)),window.__NuqsAdapterContext=a);let p=()=>(0,r.useContext)(a).defaultOptions,d=()=>(0,r.useContext)(a).processUrlSearchParams;function f(e){return{method:"throttle",timeMs:e}}function m(e){return{method:"debounce",timeMs:e}}e.s(["a",()=>d,"c",()=>n,"i",()=>p,"l",()=>u,"n",()=>c,"o",()=>l,"r",()=>h,"s",()=>i],22289);let q=f(function(){if("u"=17?120:320}catch{return 320}}());function y(e){return null===e||Array.isArray(e)&&0===e.length}function g(e,t,r){if("string"==typeof e)r.set(t,e);else{for(let s of(r.delete(t),e))r.append(t,s);r.has(t)||r.set(t,"")}return r}function v(){let e=new Map;return{on(t,r){let s=e.get(t)||[];return s.push(r),e.set(t,s),()=>this.off(t,r)},off(t,r){let s=e.get(t);s&&e.set(t,s.filter(e=>e!==r))},emit(t,r){e.get(t)?.forEach(e=>e(r))}}}function w(e,t,r){let s=setTimeout(function(){e(),r.removeEventListener("abort",n)},t);function n(){clearTimeout(s),r.removeEventListener("abort",n)}r.addEventListener("abort",n)}function b(){let e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},r=()=>{};return{promise:new e((e,s)=>{t=e,r=s}),resolve:t,reject:r}}function S(){return new URLSearchParams(location.search)}var Q=class{updateMap=new Map;options={history:"replace",scroll:!1,shallow:!0};timeMs=q.timeMs;transitions=new Set;resolvers=null;controller=null;lastFlushedAt=0;resetQueueOnNextPush=!1;push({key:e,query:t,options:r},s=q.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),n("[nuqs gtq] Enqueueing %s=%s %O",e,t,r),this.updateMap.set(e,t),"push"===r.history&&(this.options.history="push"),r.scroll&&(this.options.scroll=!0),!1===r.shallow&&(this.options.shallow=!1),r.startTransition&&this.transitions.add(r.startTransition),(!Number.isFinite(this.timeMs)||s>this.timeMs)&&(this.timeMs=s)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=S}){return this.resolvers?.promise??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=S,rateLimitFactor:t=1,...r},s){if(this.controller??=new AbortController,!Number.isFinite(this.timeMs))return n("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=b();let u=()=>{this.lastFlushedAt=performance.now();let[t,n]=this.applyPendingUpdates({...r,autoResetQueueOnUpdate:r.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},s);null===n?(this.resolvers.resolve(t),this.resetQueueOnNextPush=!0):this.resolvers.reject(t),this.resolvers=null},o=()=>{let e=performance.now()-this.lastFlushedAt,r=this.timeMs,s=t*Math.max(0,r-e);n("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",s,r,t),0===s?u():w(u,s,this.controller.signal)};return w(o,0,this.controller.signal),this.resolvers.promise}abort(){return this.controller?.abort(),this.controller=new AbortController,this.resolvers?.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){let e=Array.from(this.updateMap.keys());return n("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=q.timeMs,e}applyPendingUpdates(e,t){let{updateUrl:r,getSearchParamsSnapshot:s}=e,u=s();if(n("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,u.toString()),0===this.updateMap.size)return[u,null];let o=Array.from(this.updateMap.entries()),l={...this.options},a=Array.from(this.transitions);for(let[t,r]of(e.autoResetQueueOnUpdate&&this.reset(),n("[nuqs gtq] Flushing queue %O with options %O",o,l),o))null===r?u.delete(t):u=g(r,t,u);t&&(u=t(u));try{return!function(e,t){let r=t;for(let t=e.length-1;t>=0;t--){let s=e[t];if(!s)continue;let n=r;r=()=>s(n)}r()}(a,()=>{r(u,l)}),[u,null]}catch(e){return console.error(i(429),o.map(([e])=>e).join(),e),[u,e]}}};let M=new Q;var A=class{callback;resolvers=b();controller=new AbortController;queuedValue=void 0;constructor(e){this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,w(()=>{let t=this.resolvers;try{n("[nuqs dq] Flushing debounce queue",e);let r=this.callback(e);n("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=b(),r.then(e=>t.resolve(e)).catch(e=>t.reject(e))}catch(e){this.queuedValue=void 0,t.reject(e)}},t,this.controller.signal),this.resolvers.promise}};let x=new class{throttleQueue;queues=new Map;queuedQuerySync=v();constructor(e=new Q){this.throttleQueue=e}useQueuedQueries(e){var t,s;let n,u;return t=(e,t)=>this.queuedQuerySync.on(e,t),s=e=>this.getQueuedQuery(e),n=(0,r.useCallback)(()=>{let t=Object.fromEntries(e.map(e=>[e,s(e)]));return[JSON.stringify(t),t]},[e.join(","),s]),null===(u=(0,r.useRef)(null)).current&&(u.current=n()),(0,r.useSyncExternalStore)((0,r.useCallback)(r=>{let s=e.map(e=>t(e,r));return()=>s.forEach(e=>e())},[e.join(","),t]),()=>{let[e,t]=n();return u.current[0]===e?u.current[1]:(u.current=[e,t],t)},()=>u.current[1])}push(e,t,r,s){if(!Number.isFinite(t))return Promise.resolve((r.getSearchParamsSnapshot??S)());let u=e.key;if(!this.queues.has(u)){n("[nuqs dqc] Creating debounce queue for `%s`",u);let e=new A(e=>(this.throttleQueue.push(e),this.throttleQueue.flush(r,s).finally(()=>{this.queues.get(e.key)?.queuedValue===void 0&&(n("[nuqs dqc] Cleaning up empty queue for `%s`",e.key),this.queues.delete(e.key)),this.queuedQuerySync.emit(e.key)})));this.queues.set(u,e)}n("[nuqs dqc] Enqueueing debounce update %O",e);let o=this.queues.get(u).push(e,t);return this.queuedQuerySync.emit(u),o}abort(e){let t=this.queues.get(e);return t?(n("[nuqs dqc] Aborting debounce queue %s=%s",e,t.queuedValue?.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),e=>(e.then(t.resolvers.resolve,t.resolvers.reject),e)):e=>e}abortAll(){for(let[e,t]of this.queues.entries())n("[nuqs dqc] Aborting debounce queue %s=%s",e,t.queuedValue?.query),t.abort(),t.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(e);this.queues.clear()}getQueuedQuery(e){let t=this.queues.get(e)?.queuedValue?.query;return void 0!==t?t:this.throttleQueue.getQueuedQuery(e)}}(M);e.s(["a",()=>g,"c",()=>f,"i",()=>y,"n",()=>M,"o",()=>m,"r",()=>v,"s",()=>q,"t",()=>x],80902)},18566,(e,t,r)=>{t.exports=e.r(76562)},12985,e=>{"use strict";var t=e.i(22289),r=e.i(80902);let s=0;function n(e=1){s=e}function u(){(0,t.c)("[nuqs] Aborting queues"),r.t.abortAll(),r.n.abort().forEach(e=>r.t.queuedQuerySync.emit(e))}var o=e.i(71645),i=e.i(18566);function l(){n(0),u()}function a(){!function(e=u){(s=Math.max(0,s-1))>0||e()}(()=>{queueMicrotask(u)})}function c(){return(0,o.useEffect)(()=>(!function(){var e;if(e="next/app","u"window.removeEventListener("popstate",l)),[]),null}let h=(0,t.n)(function(){let e=(0,i.useRouter)(),[r,s]=(0,o.useOptimistic)((0,i.useSearchParams)());return{searchParams:r,updateUrl:(0,o.useCallback)((r,u)=>{(0,o.startTransition)(()=>{u.shallow||s(r);let o=function(e){let{origin:r,pathname:s,hash:n}=location;return r+s+(0,t.o)(e)+n}(r);(0,t.c)("[nuqs next/app] Updating url: %s",o);let i="push"===u.history?history.pushState:history.replaceState;n(3),i.call(history,null,"",o),u.scroll&&window.scrollTo(0,0),u.shallow||e.replace(o,{scroll:!1})})},[]),rateLimitFactor:3,autoResetQueueOnUpdate:!0}});function p({children:e,...t}){return(0,o.createElement)(h,{...t,children:[(0,o.createElement)(o.Suspense,{key:"nuqs-adapter-suspense-navspy",children:(0,o.createElement)(c)}),e]})}e.s(["NuqsAdapter",()=>p],12985)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/b9c295cb642f6712.js b/docs/_next/static/chunks/8c435435e00c1d09.js similarity index 99% rename from docs/_next/static/chunks/b9c295cb642f6712.js rename to docs/_next/static/chunks/8c435435e00c1d09.js index 21454bcc..ece1b98a 100644 --- a/docs/_next/static/chunks/b9c295cb642f6712.js +++ b/docs/_next/static/chunks/8c435435e00c1d09.js @@ -1,4 +1,4 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),t=e.i(932),o=e.i(71645),a=e.i(47071),l=e.i(49774),i=e.i(90072),n=e.i(62395),s=e.i(12979),c=e.i(79123),u=e.i(6112);let f=` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),t=e.i(932),o=e.i(71645),a=e.i(47071),l=e.i(71753),i=e.i(90072),n=e.i(62395),s=e.i(12979),c=e.i(79123),u=e.i(6112);let f=` #include varying vec2 vUv; diff --git a/docs/_next/static/chunks/f6c55b3b7050a508.css b/docs/_next/static/chunks/97a75e62963e0840.css similarity index 83% rename from docs/_next/static/chunks/f6c55b3b7050a508.css rename to docs/_next/static/chunks/97a75e62963e0840.css index 23e08bcb..c460e887 100644 --- a/docs/_next/static/chunks/f6c55b3b7050a508.css +++ b/docs/_next/static/chunks/97a75e62963e0840.css @@ -1,12 +1,12 @@ .FloatingLabel-module__8y09Ka__Label{color:#fff;white-space:nowrap;text-align:center;background:#00000080;border-radius:1px;padding:1px 3px;font-size:11px} +.DebugElements-module__Cmeo9W__StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.DebugElements-module__Cmeo9W__AxisLabel{pointer-events:none;font-size:12px}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=x]{color:#f90}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=y]{color:#9f0}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=z]{color:#09f} .KeyboardOverlay-module__HsRBsa__Root{pointer-events:none;z-index:1;align-items:flex-end;gap:10px;display:flex;position:fixed;bottom:16px;left:50%;transform:translate(-50%)}.KeyboardOverlay-module__HsRBsa__Column{flex-direction:column;justify-content:center;gap:4px;display:flex}.KeyboardOverlay-module__HsRBsa__Row{justify-content:stretch;gap:4px;display:flex}.KeyboardOverlay-module__HsRBsa__Spacer{width:32px}.KeyboardOverlay-module__HsRBsa__Key{color:#ffffff80;white-space:nowrap;background:#0006;border:1px solid #fff3;border-radius:4px;flex:1 0 0;justify-content:center;align-items:center;min-width:32px;height:32px;padding:0 8px;font-size:11px;font-weight:600;display:flex}.KeyboardOverlay-module__HsRBsa__Key[data-pressed=true]{color:#fff;background:#34bbab99;border-color:#23fddc80}.KeyboardOverlay-module__HsRBsa__Arrow{margin-right:3px} -.TouchControls-module__AkxfgW__Joystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchControls-module__AkxfgW__Left{left:20px;transform:none;}.TouchControls-module__AkxfgW__Right{left:auto;right:20px;transform:none;} .MissionSelect-module__N_AIjG__InputWrapper{align-items:center;display:flex;position:relative}.MissionSelect-module__N_AIjG__Shortcut{color:#fff9;pointer-events:none;background:#ffffff26;border-radius:3px;padding:1px 4px;font-family:system-ui,sans-serif;font-size:11px;position:absolute;right:7px}.MissionSelect-module__N_AIjG__Input[aria-expanded=true]~.MissionSelect-module__N_AIjG__Shortcut{display:none}.MissionSelect-module__N_AIjG__Input{color:#fff;-webkit-user-select:text;user-select:text;background:#0009;border:1px solid #ffffff4d;border-radius:3px;outline:none;width:280px;padding:6px 36px 6px 8px;font-size:14px}.MissionSelect-module__N_AIjG__Input[aria-expanded=true]{padding-right:8px}.MissionSelect-module__N_AIjG__Input:focus{border-color:#fff9}.MissionSelect-module__N_AIjG__Input::placeholder{color:#0000}.MissionSelect-module__N_AIjG__SelectedValue{pointer-events:none;align-items:center;gap:6px;display:flex;position:absolute;left:8px;right:36px;overflow:hidden}.MissionSelect-module__N_AIjG__Input[aria-expanded=true]~.MissionSelect-module__N_AIjG__SelectedValue{display:none}.MissionSelect-module__N_AIjG__SelectedName{color:#fff;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.MissionSelect-module__N_AIjG__SelectedValue>.MissionSelect-module__N_AIjG__ItemType{flex-shrink:0}.MissionSelect-module__N_AIjG__Popover{z-index:100;min-width:320px;max-height:var(--popover-available-height,90vh);overscroll-behavior:contain;background:#141414f2;border:1px solid #ffffff80;border-radius:3px;overflow-y:auto;box-shadow:0 8px 24px #0009}.MissionSelect-module__N_AIjG__List{padding:4px 0}.MissionSelect-module__N_AIjG__List:has(>.MissionSelect-module__N_AIjG__Group:first-child){padding-top:0}.MissionSelect-module__N_AIjG__Group{padding-bottom:4px}.MissionSelect-module__N_AIjG__GroupLabel{color:#c6caca;z-index:1;background:#3a4548f2;border-bottom:1px solid #ffffff4d;padding:6px 8px 6px 12px;font-size:13px;font-weight:600;position:sticky;top:0}.MissionSelect-module__N_AIjG__Group:not(:last-child){border-bottom:1px solid #ffffff4d}.MissionSelect-module__N_AIjG__Item{cursor:pointer;border-radius:4px;outline:none;flex-direction:column;gap:1px;margin:4px 4px 0;padding:6px 8px;scroll-margin-top:32px;display:flex}.MissionSelect-module__N_AIjG__List>.MissionSelect-module__N_AIjG__Item:first-child{margin-top:0}.MissionSelect-module__N_AIjG__Item[data-active-item]{background:#ffffff26}.MissionSelect-module__N_AIjG__Item[aria-selected=true]{background:#6496ff4d}.MissionSelect-module__N_AIjG__ItemHeader{align-items:center;gap:6px;display:flex}.MissionSelect-module__N_AIjG__ItemName{color:#fff;font-size:14px;font-weight:600}.MissionSelect-module__N_AIjG__ItemTypes{gap:3px;display:flex}.MissionSelect-module__N_AIjG__ItemType{color:#fff;background:#ff9d0066;border-radius:3px;padding:2px 5px;font-size:10px;font-weight:600}.MissionSelect-module__N_AIjG__ItemType:hover{background:#ff9d00b3}.MissionSelect-module__N_AIjG__ItemMissionName{color:#ffffff80;font-size:12px}.MissionSelect-module__N_AIjG__NoResults{color:#ffffff80;text-align:center;padding:12px 8px;font-size:13px} .InspectorControls-module__gNRB6W__Controls{color:#fff;z-index:2;background:#00000080;border-radius:0 0 4px;justify-content:center;align-items:center;gap:20px;padding:8px 12px 8px 8px;font-size:13px;display:flex;position:fixed;top:0;left:0}.InspectorControls-module__gNRB6W__Dropdown,.InspectorControls-module__gNRB6W__Group{justify-content:center;align-items:center;gap:20px;display:flex}.InspectorControls-module__gNRB6W__CheckboxField,.InspectorControls-module__gNRB6W__LabelledButton,.InspectorControls-module__gNRB6W__Field{align-items:center;gap:6px;display:flex}.InspectorControls-module__gNRB6W__IconButton{color:#fff;cursor:pointer;background:#03529399;border:1px solid #c8c8c84d;border-color:#ffffff4d #c8c8c84d #c8c8c84d #ffffff4d;border-radius:4px;justify-content:center;align-items:center;width:28px;height:28px;margin:0 0 0 -12px;padding:0;font-size:15px;transition:background .2s,border-color .2s;display:flex;position:relative;transform:translate(0);box-shadow:0 1px 2px #0006}.InspectorControls-module__gNRB6W__IconButton svg{pointer-events:none}@media (hover:hover){.InspectorControls-module__gNRB6W__IconButton:hover{background:#0062b3cc;border-color:#fff6}}.InspectorControls-module__gNRB6W__IconButton:active,.InspectorControls-module__gNRB6W__IconButton[aria-expanded=true]{background:#0062b3b3;border-color:#ffffff4d;transform:translateY(1px)}.InspectorControls-module__gNRB6W__IconButton[data-active=true]{background:#0075d5e6;border-color:#fff6}.InspectorControls-module__gNRB6W__ButtonLabel{font-size:12px}.InspectorControls-module__gNRB6W__Toggle{margin:0;}.InspectorControls-module__gNRB6W__MapInfoButton{}@media (max-width:1279px){.InspectorControls-module__gNRB6W__Dropdown[data-open=false]{display:none}.InspectorControls-module__gNRB6W__Dropdown{background:#000c;border:1px solid #fff3;border-radius:4px;flex-direction:column;align-items:center;gap:12px;max-height:calc(100dvh - 56px);padding:12px;display:flex;position:absolute;top:calc(100% + 2px);left:2px;right:2px;overflow:auto;box-shadow:0 0 12px #0006}.InspectorControls-module__gNRB6W__Group{flex-wrap:wrap;gap:12px 20px}.InspectorControls-module__gNRB6W__LabelledButton{width:auto;padding:0 10px}}@media (max-width:639px){.InspectorControls-module__gNRB6W__Controls{border-radius:0;right:0}.InspectorControls-module__gNRB6W__MissionSelectWrapper{flex:1 1 0;min-width:0}.InspectorControls-module__gNRB6W__MissionSelectWrapper input{width:100%}.InspectorControls-module__gNRB6W__Toggle{flex:none}}@media (min-width:1280px){.InspectorControls-module__gNRB6W__Toggle,.InspectorControls-module__gNRB6W__LabelledButton .InspectorControls-module__gNRB6W__ButtonLabel,.InspectorControls-module__gNRB6W__MapInfoButton{display:none}} .CopyCoordinatesButton-module__BxovtG__Root{}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton-module__BxovtG__ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true] .CopyCoordinatesButton-module__BxovtG__ClipboardCheck{animation:.22s linear infinite CopyCoordinatesButton-module__BxovtG__showClipboardCheck;display:block}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true] .CopyCoordinatesButton-module__BxovtG__MapPin{display:none}.CopyCoordinatesButton-module__BxovtG__ButtonLabel{}@keyframes CopyCoordinatesButton-module__BxovtG__showClipboardCheck{0%{opacity:1}to{opacity:.2}} .LoadDemoButton-module__kGZaoW__Root{}.LoadDemoButton-module__kGZaoW__ButtonLabel{}.LoadDemoButton-module__kGZaoW__DemoIcon{font-size:19px} -.DebugElements-module__Cmeo9W__StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.DebugElements-module__Cmeo9W__AxisLabel{pointer-events:none;font-size:12px}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=x]{color:#f90}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=y]{color:#9f0}.DebugElements-module__Cmeo9W__AxisLabel[data-axis=z]{color:#09f} .PlayerNameplate-module__zYDm0a__Root{pointer-events:none;white-space:nowrap;flex-direction:column;align-items:center;display:inline-flex}.PlayerNameplate-module__zYDm0a__Top{padding-bottom:20px;}.PlayerNameplate-module__zYDm0a__Bottom{padding-top:20px;}.PlayerNameplate-module__zYDm0a__IffArrow{width:12px;height:12px;image-rendering:pixelated;filter:drop-shadow(0 1px 2px #000000b3)}.PlayerNameplate-module__zYDm0a__Name{color:#fff;text-shadow:0 1px 3px #000000e6,0 0 1px #000000b3;font-size:11px}.PlayerNameplate-module__zYDm0a__HealthBar{background:#00000080;border:1px solid #fff3;width:60px;height:4px;margin:2px auto 0;overflow:hidden}.PlayerNameplate-module__zYDm0a__HealthFill{background:#2ecc40;height:100%} .DemoControls-module__PjV4fq__Root{color:#fff;z-index:2;background:#000000b3;align-items:center;gap:10px;padding:8px 12px;font-size:13px;display:flex;position:fixed;bottom:0;left:0;right:0}.DemoControls-module__PjV4fq__PlayPause{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;padding:0;font-size:14px;display:flex}@media (hover:hover){.DemoControls-module__PjV4fq__PlayPause:hover{background:#0062b3cc}}.DemoControls-module__PjV4fq__Time{font-variant-numeric:tabular-nums;white-space:nowrap;flex-shrink:0}.DemoControls-module__PjV4fq__Seek[type=range]{flex:1 1 0;min-width:0;max-width:none}.DemoControls-module__PjV4fq__Speed{color:#fff;background:#0009;border:1px solid #ffffff4d;border-radius:3px;flex-shrink:0;padding:2px 4px;font-size:12px}.DemoControls-module__PjV4fq__DiagnosticsPanel{background:#0000008c;border:1px solid #fff3;border-radius:4px;flex-direction:column;gap:3px;min-width:320px;margin-left:8px;padding:4px 8px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsPanel[data-context-lost=true]{background:#46000073;border-color:#ff5a5acc}.DemoControls-module__PjV4fq__DiagnosticsStatus{letter-spacing:.02em;font-size:11px;font-weight:700}.DemoControls-module__PjV4fq__DiagnosticsMetrics{opacity:.92;flex-wrap:wrap;gap:4px 10px;font-size:11px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsFooter{flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:11px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsFooter button{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:3px;padding:1px 6px;font-size:11px}.DemoControls-module__PjV4fq__DiagnosticsFooter button:hover{background:#0062b3cc} .PlayerHUD-module__-E1Scq__PlayerHUD{z-index:1;pointer-events:none;padding-bottom:48px;position:absolute;inset:0}.PlayerHUD-module__-E1Scq__ChatWindow{position:absolute;top:60px;left:4px}.PlayerHUD-module__-E1Scq__Bar{background:#00000080;border:1px solid #fff3;width:160px;height:14px;position:absolute;overflow:hidden}.PlayerHUD-module__-E1Scq__HealthBar{top:60px;right:32px;}.PlayerHUD-module__-E1Scq__EnergyBar{top:80px;right:32px;}.PlayerHUD-module__-E1Scq__BarFill{height:100%;transition:width .15s ease-out;position:absolute;top:0;left:0}.PlayerHUD-module__-E1Scq__HealthBar .PlayerHUD-module__-E1Scq__BarFill{background:#2ecc40}.PlayerHUD-module__-E1Scq__EnergyBar .PlayerHUD-module__-E1Scq__BarFill{background:#0af} .page-module__E0kJGG__CanvasContainer{z-index:0;position:absolute;inset:0}.page-module__E0kJGG__LoadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.page-module__E0kJGG__LoadingIndicator[data-complete=true]{animation:.3s ease-out forwards page-module__E0kJGG__loadingComplete}.page-module__E0kJGG__Spinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite page-module__E0kJGG__spin}.page-module__E0kJGG__Progress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.page-module__E0kJGG__ProgressBar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.page-module__E0kJGG__ProgressText{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes page-module__E0kJGG__spin{to{transform:rotate(360deg)}}@keyframes page-module__E0kJGG__loadingComplete{0%{opacity:1}to{opacity:0}} +.page-module__v6zvCa__CanvasContainer{z-index:0;position:absolute;inset:0}.page-module__v6zvCa__LoadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.page-module__v6zvCa__LoadingIndicator[data-complete=true]{animation:.3s ease-out forwards page-module__v6zvCa__loadingComplete}.page-module__v6zvCa__Spinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite page-module__v6zvCa__spin}@keyframes page-module__v6zvCa__spin{to{transform:rotate(360deg)}}@keyframes page-module__v6zvCa__loadingComplete{0%{opacity:1}to{opacity:0}}.page-module__v6zvCa__Sidebar{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#fff;z-index:2;background:#000000b3;flex-direction:column;width:260px;font-size:13px;display:flex;position:fixed;top:0;bottom:0;left:0;overflow:hidden}.page-module__v6zvCa__SidebarSection{border-bottom:1px solid #ffffff1a;padding:10px 12px}.page-module__v6zvCa__SidebarSection:last-child{border-bottom:none}.page-module__v6zvCa__SectionLabel{text-transform:uppercase;letter-spacing:.05em;color:#fff6;margin-bottom:6px;font-size:10px}.page-module__v6zvCa__AnimationList{flex:1;padding:0 12px 12px;overflow-y:auto}.page-module__v6zvCa__AnimationItem{cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:4px;align-items:center;gap:6px;padding:4px 6px;display:flex}.page-module__v6zvCa__AnimationItem:hover{background:#ffffff14}.page-module__v6zvCa__AnimationItem[data-active=true]{background:#ffffff26}.page-module__v6zvCa__PlayButton{color:#fff9;cursor:pointer;background:#ffffff1a;border:none;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:22px;height:22px;padding:0;font-size:11px;display:flex}.page-module__v6zvCa__PlayButton:hover{color:#fff;background:#fff3}.page-module__v6zvCa__AnimationItem[data-active=true] .page-module__v6zvCa__PlayButton{color:#fff;background:#64b4ff4d}.page-module__v6zvCa__AnimationName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.page-module__v6zvCa__ClipName{color:#ffffff4d;white-space:nowrap;flex-shrink:0;font-size:10px}.page-module__v6zvCa__CyclicIcon{color:#ffffff4d;title:"Cyclic (looping)";flex-shrink:0;font-size:13px}.page-module__v6zvCa__CheckboxField{align-items:center;gap:6px;display:flex} diff --git a/docs/_next/static/chunks/a39cd4cde6ac97c6.js b/docs/_next/static/chunks/a39cd4cde6ac97c6.js deleted file mode 100644 index 7e4e9a58..00000000 --- a/docs/_next/static/chunks/a39cd4cde6ac97c6.js +++ /dev/null @@ -1,2 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,64893,(e,t,r)=>{"use strict";var n=e.r(74080),a={stream:!0},l=Object.prototype.hasOwnProperty;function u(t){var r=e.r(t);return"function"!=typeof r.then||"fulfilled"===r.status?null:(r.then(function(e){r.status="fulfilled",r.value=e},function(e){r.status="rejected",r.reason=e}),r)}var o=new WeakSet,i=new WeakSet;function s(){}function c(t){for(var r=t[1],n=[],a=0;af||35===f||114===f||120===f?(h=f,f=3,s++):(h=0,f=3);continue;case 2:44===(v=i[s++])?f=4:p=p<<4|(96i.length&&(v=-1)}var _=i.byteOffset+s;if(-1{"use strict";t.exports=e.r(64893)},35326,(e,t,r)=>{"use strict";t.exports=e.r(21413)},90373,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useUntrackedPathname",{enumerable:!0,get:function(){return l}});let n=e.r(71645),a=e.r(61994);function l(){return!function(){if("undefined"==typeof window){let{workUnitAsyncStorage:t}=e.r(62141),r=t.getStore();if(!r)return!1;switch(r.type){case"prerender":case"prerender-client":case"prerender-ppr":let n=r.fallbackRouteParams;return!!n&&n.size>0}}return!1}()?(0,n.useContext)(a.PathnameContext):null}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},51191,(e,t,r)=>{"use strict";function n(e,t=!0){return e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createHrefFromUrl",{enumerable:!0,get:function(){return n}}),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},78377,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={handleHardNavError:function(){return u},useNavFailureHandler:function(){return o}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});e.r(71645);let l=e.r(51191);function u(e){return!!e&&"undefined"!=typeof window&&!!window.next.__pendingUrl&&(0,l.createHrefFromUrl)(new URL(window.location.href))!==(0,l.createHrefFromUrl)(window.next.__pendingUrl)&&(console.error("Error occurred during navigation, falling back to hard navigation",e),window.location.href=window.next.__pendingUrl.toString(),!0)}function o(){}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},26935,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HTML_LIMITED_BOT_UA_RE",{enumerable:!0,get:function(){return n}});let n=/[\w-]+-Google|Google-[\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight/i},82604,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={HTML_LIMITED_BOT_UA_RE:function(){return l.HTML_LIMITED_BOT_UA_RE},HTML_LIMITED_BOT_UA_RE_STRING:function(){return o},getBotType:function(){return c},isBot:function(){return s}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(26935),u=/Googlebot(?!-)|Googlebot$/i,o=l.HTML_LIMITED_BOT_UA_RE.source;function i(e){return l.HTML_LIMITED_BOT_UA_RE.test(e)}function s(e){return u.test(e)||i(e)}function c(e){return u.test(e)?"dom":i(e)?"html":void 0}},72383,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ErrorBoundary:function(){return p},ErrorBoundaryHandler:function(){return h}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(55682),u=e.r(43476),o=l._(e.r(71645)),i=e.r(90373),s=e.r(65713);e.r(78377);let c=e.r(12354),f=e.r(82604),d="undefined"!=typeof window&&(0,f.isBot)(window.navigator.userAgent);class h extends o.default.Component{constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}static getDerivedStateFromError(e){if((0,s.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){let{error:r}=t;return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error&&!d?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.HandleISRError,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,u.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}}function p({errorComponent:e,errorStyles:t,errorScripts:r,children:n}){let a=(0,i.useUntrackedPathname)();return e?(0,u.jsx)(h,{pathname:a,errorComponent:e,errorStyles:t,errorScripts:r,children:n}):(0,u.jsx)(u.Fragment,{children:n})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},88540,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a={ACTION_HMR_REFRESH:function(){return c},ACTION_NAVIGATE:function(){return o},ACTION_REFRESH:function(){return u},ACTION_RESTORE:function(){return i},ACTION_SERVER_ACTION:function(){return f},ACTION_SERVER_PATCH:function(){return s},PrefetchKind:function(){return d}};for(var l in a)Object.defineProperty(r,l,{enumerable:!0,get:a[l]});let u="refresh",o="navigate",i="restore",s="server-patch",c="hmr-refresh",f="server-action";var d=((n={}).AUTO="auto",n.FULL="full",n);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},64245,(e,t,r)=>{"use strict";function n(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isThenable",{enumerable:!0,get:function(){return n}})},41538,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={dispatchAppRouterAction:function(){return i},useActionQueue:function(){return s}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(90809)._(e.r(71645)),u=e.r(64245),o=null;function i(e){if(null===o)throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0});o(e)}function s(e){let[t,r]=l.default.useState(e.state);o=t=>e.dispatch(t,r);let n=(0,l.useMemo)(()=>t,[t]);return(0,u.isThenable)(n)?(0,l.use)(n):n}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},32120,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"callServer",{enumerable:!0,get:function(){return u}});let n=e.r(71645),a=e.r(88540),l=e.r(41538);async function u(e,t){return new Promise((r,u)=>{(0,n.startTransition)(()=>{(0,l.dispatchAppRouterAction)({type:a.ACTION_SERVER_ACTION,actionId:e,actionArgs:t,resolve:r,reject:u})})})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},92245,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"findSourceMapURL",{enumerable:!0,get:function(){return n}});("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},3372,(e,t,r)=>{"use strict";function n(e){return e.startsWith("/")?e:`/${e}`}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ensureLeadingSlash",{enumerable:!0,get:function(){return n}})},74180,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={normalizeAppPath:function(){return o},normalizeRscURL:function(){return i}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(3372),u=e.r(13258);function o(e){return(0,l.ensureLeadingSlash)(e.split("/").reduce((e,t,r,n)=>!t||(0,u.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&r===n.length-1?e:`${e}/${t}`,""))}function i(e){return e.replace(/\.rsc($|\?)/,"$1")}},91463,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={INTERCEPTION_ROUTE_MARKERS:function(){return u},extractInterceptionRouteInformation:function(){return i},isInterceptionRouteAppPath:function(){return o}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(74180),u=["(..)(..)","(.)","(..)","(...)"];function o(e){return void 0!==e.split("/").find(e=>u.find(t=>e.startsWith(t)))}function i(e){let t,r,n;for(let a of e.split("/"))if(r=u.find(e=>a.startsWith(e))){[t,n]=e.split(r,2);break}if(!t||!r||!n)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Must be in the format //(..|...|..)(..)/`),"__NEXT_ERROR_CODE",{value:"E269",enumerable:!1,configurable:!0});switch(t=(0,l.normalizeAppPath)(t),r){case"(.)":n="/"===t?`/${n}`:t+"/"+n;break;case"(..)":if("/"===t)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`),"__NEXT_ERROR_CODE",{value:"E207",enumerable:!1,configurable:!0});n=t.split("/").slice(0,-1).concat(n).join("/");break;case"(...)":n="/"+n;break;case"(..)(..)":let a=t.split("/");if(a.length<=2)throw Object.defineProperty(Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`),"__NEXT_ERROR_CODE",{value:"E486",enumerable:!1,configurable:!0});n=a.slice(0,-2).concat(n).join("/");break;default:throw Object.defineProperty(Error("Invariant: unexpected marker"),"__NEXT_ERROR_CODE",{value:"E112",enumerable:!1,configurable:!0})}return{interceptingRoute:t,interceptedRoute:n}}},56019,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"matchSegment",{enumerable:!0,get:function(){return n}});let n=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1];("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},34727,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={computeChangedPath:function(){return f},extractPathFromFlightRouterState:function(){return c},getSelectedParams:function(){return function e(t,r={}){for(let n of Object.values(t[1])){let t=n[0],a=Array.isArray(t),l=a?t[1]:t;!l||l.startsWith(u.PAGE_SEGMENT_KEY)||(a&&("c"===t[2]||"oc"===t[2])?r[t[0]]=t[1].split("/"):a&&(r[t[0]]=t[1]),r=e(n,r))}return r}}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(91463),u=e.r(13258),o=e.r(56019),i=e=>"string"==typeof e?"children"===e?"":e:e[1];function s(e){return e.reduce((e,t)=>{let r;return""===(t="/"===(r=t)[0]?r.slice(1):r)||(0,u.isGroupSegment)(t)?e:`${e}/${t}`},"")||"/"}function c(e){let t=Array.isArray(e[0])?e[0][1]:e[0];if(t===u.DEFAULT_SEGMENT_KEY||l.INTERCEPTION_ROUTE_MARKERS.some(e=>t.startsWith(e)))return;if(t.startsWith(u.PAGE_SEGMENT_KEY))return"";let r=[i(t)],n=e[1]??{},a=n.children?c(n.children):void 0;if(void 0!==a)r.push(a);else for(let[e,t]of Object.entries(n)){if("children"===e)continue;let n=c(t);void 0!==n&&r.push(n)}return s(r)}function f(e,t){let r=function e(t,r){let[n,a]=t,[u,s]=r,f=i(n),d=i(u);if(l.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,o.matchSegment)(n,u))return c(r)??"";for(let t in a)if(s[t]){let r=e(a[t],s[t]);if(null!==r)return`${i(u)}/${r}`}return null}(e,t);return null==r||"/"===r?r:s(r.split("/"))}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},47442,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"handleMutable",{enumerable:!0,get:function(){return l}});let n=e.r(34727);function a(e){return void 0!==e}function l(e,t){let r=t.shouldScroll??!0,l=e.previousNextUrl,u=e.nextUrl;if(a(t.patchedTree)){let r=(0,n.computeChangedPath)(e.tree,t.patchedTree);r?(l=u,u=r):u||(u=e.canonicalUrl)}return{canonicalUrl:t.canonicalUrl??e.canonicalUrl,renderedSearch:t.renderedSearch??e.renderedSearch,pushRef:{pendingPush:a(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:a(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:a(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!r&&(!!a(t?.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:t.onlyHashChange||!1,hashFragment:r?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:r?t?.scrollableSegments??e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,tree:a(t.patchedTree)?t.patchedTree:e.tree,nextUrl:u,previousNextUrl:l,debugInfo:t.collectedDebugInfo??null}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},67764,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={HEAD_REQUEST_KEY:function(){return o},ROOT_SEGMENT_REQUEST_KEY:function(){return u},appendSegmentRequestKeyPart:function(){return s},convertSegmentPathToStaticExportFilename:function(){return d},createSegmentRequestKeyPart:function(){return i}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(13258),u="",o="/_head";function i(e){if("string"==typeof e)return e.startsWith(l.PAGE_SEGMENT_KEY)?l.PAGE_SEGMENT_KEY:"/_not-found"===e?"_not-found":f(e);let t=e[0];return"$"+e[2]+"$"+f(t)}function s(e,t,r){return e+"/"+("children"===t?r:`@${f(t)}/${r}`)}let c=/^[a-zA-Z0-9\-_@]+$/;function f(e){return c.test(e)?e:"!"+btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function d(e){return`__next${e.replace(/\//g,".")}.txt`}},33906,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={doesStaticSegmentAppearInURL:function(){return f},getCacheKeyForDynamicParam:function(){return d},getParamValueFromCacheKey:function(){return p},getRenderedPathname:function(){return s},getRenderedSearch:function(){return i},parseDynamicParamFromURLPart:function(){return c},urlSearchParamsToParsedUrlQuery:function(){return y},urlToUrlWithoutFlightMarker:function(){return h}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(13258),u=e.r(67764),o=e.r(21768);function i(e){let t=e.headers.get(o.NEXT_REWRITTEN_QUERY_HEADER);return null!==t?""===t?"":"?"+t:h(new URL(e.url)).search}function s(e){return e.headers.get(o.NEXT_REWRITTEN_PATH_HEADER)??h(new URL(e.url)).pathname}function c(e,t,r){switch(e){case"c":return rencodeURIComponent(e)):[];case"ci(..)(..)":case"ci(.)":case"ci(..)":case"ci(...)":{let n=e.length-2;return r0===t?encodeURIComponent(e.slice(n)):encodeURIComponent(e)):[]}case"oc":return rencodeURIComponent(e)):null;case"d":if(r>=t.length)return"";return encodeURIComponent(t[r]);case"di(..)(..)":case"di(.)":case"di(..)":case"di(...)":{let n=e.length-2;if(r>=t.length)return"";return encodeURIComponent(t[r].slice(n))}default:return""}}function f(e){return!(e===u.ROOT_SEGMENT_REQUEST_KEY||e.startsWith(l.PAGE_SEGMENT_KEY)||"("===e[0]&&e.endsWith(")"))&&e!==l.DEFAULT_SEGMENT_KEY&&"/_not-found"!==e}function d(e,t){return"string"==typeof e?(0,l.addSearchParamsIfPageSegment)(e,Object.fromEntries(new URLSearchParams(t))):null===e?"":e.join("/")}function h(e){let t=new URL(e);if(t.searchParams.delete(o.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,r=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-r)}return t}function p(e,t){return"c"===t||"oc"===t?e.split("/"):e}function y(e){let t={};for(let[r,n]of e.entries())void 0===t[r]?t[r]=n:Array.isArray(t[r])?t[r].push(n):t[r]=[t[r],n];return t}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},50590,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={createInitialRSCPayloadFromFallbackPrerender:function(){return s},getFlightDataPartsFromPath:function(){return i},getNextFlightSegmentPath:function(){return c},normalizeFlightData:function(){return f},prepareFlightRouterStateForRequest:function(){return d}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(13258),u=e.r(33906),o=e.r(51191);function i(e){let[t,r,n,a]=e.slice(-4),l=e.slice(0,-4);return{pathToSegment:l.slice(0,-1),segmentPath:l,segment:l[l.length-1]??"",tree:t,seedData:r,head:n,isHeadPartial:a,isRootRender:4===e.length}}function s(e,t){let r=(0,u.getRenderedPathname)(e),n=(0,u.getRenderedSearch)(e),a=(0,o.createHrefFromUrl)(new URL(location.href)),l=t.f[0],i=l[0];return{b:t.b,c:a.split("/"),q:n,i:t.i,f:[[function e(t,r,n,a){let l,o,i=t[0];if("string"==typeof i)l=i,o=(0,u.doesStaticSegmentAppearInURL)(i);else{let e=i[0],t=i[2],s=(0,u.parseDynamicParamFromURLPart)(t,n,a);l=[e,(0,u.getCacheKeyForDynamicParam)(s,r),t],o=!0}let s=o?a+1:a,c=t[1],f={};for(let t in c){let a=c[t];f[t]=e(a,r,n,s)}return[l,f,null,t[3],t[4]]}(i,n,r.split("/").filter(e=>""!==e),0),l[1],l[2],l[2]]],m:t.m,G:t.G,S:t.S}}function c(e){return e.slice(2)}function f(e){return"string"==typeof e?e:e.map(e=>i(e))}function d(e,t){return t?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(JSON.stringify(function e(t){var r,n;let[a,u,o,i,s,c]=t,f="string"==typeof(r=a)&&r.startsWith(l.PAGE_SEGMENT_KEY+"?")?l.PAGE_SEGMENT_KEY:r,d={};for(let[t,r]of Object.entries(u))d[t]=e(r);let h=[f,d,null,(n=i)&&"refresh"!==n?i:null];return void 0!==s&&(h[4]=s),void 0!==c&&(h[5]=c),h}(e)))}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},14297,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getAppBuildId:function(){return o},setAppBuildId:function(){return u}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l="";function u(e){l=e}function o(){return l}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},19921,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={djb2Hash:function(){return l},hexHash:function(){return u}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});function l(e){let t=5381;for(let r=0;r>>0}function u(e){return l(e).toString(36).slice(0,5)}},86051,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"computeCacheBustingSearchParam",{enumerable:!0,get:function(){return a}});let n=e.r(19921);function a(e,t,r,a){return(void 0===e||"0"===e)&&void 0===t&&void 0===r&&void 0===a?"":(0,n.hexHash)([e||"0",t||"0",r||"0",a||"0"].join(","))}},88093,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={setCacheBustingSearchParam:function(){return o},setCacheBustingSearchParamWithHash:function(){return i}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(86051),u=e.r(21768),o=(e,t)=>{i(e,(0,l.computeCacheBustingSearchParam)(t[u.NEXT_ROUTER_PREFETCH_HEADER],t[u.NEXT_ROUTER_SEGMENT_PREFETCH_HEADER],t[u.NEXT_ROUTER_STATE_TREE_HEADER],t[u.NEXT_URL]))},i=(e,t)=>{let r=e.search,n=(r.startsWith("?")?r.slice(1):r).split("&").filter(e=>e&&!e.startsWith(`${u.NEXT_RSC_UNION_QUERY}=`));t.length>0?n.push(`${u.NEXT_RSC_UNION_QUERY}=${t}`):n.push(`${u.NEXT_RSC_UNION_QUERY}`),e.search=n.length?`?${n.join("&")}`:""};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},43369,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={getDeploymentId:function(){return l},getDeploymentIdQueryOrEmptyString:function(){return u}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});function l(){return!1}function u(){return""}},87288,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0});var a={createFetch:function(){return m},createFromNextReadableStream:function(){return R},fetchServerResponse:function(){return b}};for(var l in a)Object.defineProperty(r,l,{enumerable:!0,get:a[l]});let u=e.r(35326),o=e.r(21768),i=e.r(32120),s=e.r(92245),c=e.r(50590),f=e.r(14297),d=e.r(88093),h=e.r(33906),p=e.r(43369),y=u.createFromReadableStream,g=u.createFromFetch;function v(e){return(0,h.urlToUrlWithoutFlightMarker)(new URL(e,location.origin)).toString()}let _=!1;async function b(e,t){let{flightRouterState:r,nextUrl:n}=t,a={[o.RSC_HEADER]:"1",[o.NEXT_ROUTER_STATE_TREE_HEADER]:(0,c.prepareFlightRouterStateForRequest)(r,t.isHmrRefresh)};n&&(a[o.NEXT_URL]=n);let l=e;try{(e=new URL(e)).pathname.endsWith("/")?e.pathname+="index.txt":e.pathname+=".txt";let t=await m(e,a,"auto",!0),r=(0,h.urlToUrlWithoutFlightMarker)(new URL(t.url)),n=t.redirected?r:l,u=t.headers.get("content-type")||"",i=!!t.headers.get("vary")?.includes(o.NEXT_URL),s=!!t.headers.get(o.NEXT_DID_POSTPONE_HEADER),d=t.headers.get(o.NEXT_ROUTER_STALE_TIME_HEADER),p=null!==d?1e3*parseInt(d,10):-1,y=u.startsWith(o.RSC_CONTENT_TYPE_HEADER);if(y||(y=u.startsWith("text/plain")),!y||!t.ok||!t.body)return e.hash&&(r.hash=e.hash),v(r.toString());let g=t.flightResponse;if(null===g){let e,r=s?(e=t.body.getReader(),new ReadableStream({async pull(t){for(;;){let{done:r,value:n}=await e.read();if(!r){t.enqueue(n);continue}return}}})):t.body;g=R(r,a)}let _=await g;if((0,f.getAppBuildId)()!==_.b)return v(t.url);let b=(0,c.normalizeFlightData)(_.f);if("string"==typeof b)return v(b);return{flightData:b,canonicalUrl:n,renderedSearch:(0,h.getRenderedSearch)(t),couldBeIntercepted:i,prerendered:_.S,postponed:s,staleTime:p,debugInfo:g._debugInfo??null}}catch(e){return _||console.error(`Failed to fetch RSC payload for ${l}. Falling back to browser navigation.`,e),l.toString()}}async function m(e,t,r,a,l){var u,c;let f=(0,p.getDeploymentId)();f&&(t["x-deployment-id"]=f);let h=new URL(e);(0,d.setCacheBustingSearchParam)(h,t);let y=fetch(h,{credentials:"same-origin",headers:t,priority:r||void 0,signal:l}),v=a?(u=y,c=t,g(u,{callServer:i.callServer,findSourceMapURL:s.findSourceMapURL,debugChannel:n&&n(c)})):null,_=await y,b=_.redirected,m=new URL(_.url,h);return m.searchParams.delete(o.NEXT_RSC_UNION_QUERY),{url:m.href,redirected:b,ok:_.ok,headers:_.headers,body:_.body,status:_.status,flightResponse:v}}function R(e,t){return y(e,{callServer:i.callServer,findSourceMapURL:s.findSourceMapURL,debugChannel:n&&n(t)})}"undefined"!=typeof window&&(window.addEventListener("pagehide",()=>{_=!0}),window.addEventListener("pageshow",()=>{_=!1})),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},70725,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createRouterCacheKey",{enumerable:!0,get:function(){return a}});let n=e.r(13258);function a(e,t=!1){return Array.isArray(e)?`${e[0]}|${e[1]}|${e[2]}`:t&&e.startsWith(n.PAGE_SEGMENT_KEY)?n.PAGE_SEGMENT_KEY:e}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},48919,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,r){let n=t[0],a=r[0];if(Array.isArray(n)&&Array.isArray(a)){if(n[0]!==a[0]||n[2]!==a[2])return!0}else if(n!==a)return!0;if(t[4])return!r[4];if(r[4])return!0;let l=Object.values(t[1])[0],u=Object.values(r[1])[0];return!l||!u||e(l,u)}}}),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},95871,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a={FreshnessPolicy:function(){return g},createInitialCacheNodeForHydration:function(){return _},isDeferredRsc:function(){return N},spawnDynamicRequests:function(){return j},startPPRNavigation:function(){return b}};for(var l in a)Object.defineProperty(r,l,{enumerable:!0,get:a[l]});let u=e.r(13258),o=e.r(56019),i=e.r(51191),s=e.r(70725),c=e.r(87288),f=e.r(41538),d=e.r(88540),h=e.r(48919),p=e.r(54069),y=e.r(60355);var g=((n={})[n.Default=0]="Default",n[n.Hydration=1]="Hydration",n[n.HistoryTraversal=2]="HistoryTraversal",n[n.RefreshAll=3]="RefreshAll",n[n.HMRRefresh=4]="HMRRefresh",n);let v=()=>{};function _(e,t,r,n){return m(e,t,void 0,1,r,n,null,null,!1,null,null,!1,{scrollableSegments:null,separateRefreshUrls:null}).node}function b(e,t,r,n,a,l,c,f,d,p,y,g,v){return function e(t,r,n,a,l,c,f,d,p,y,g,v,_,b,T,j,w,M){var A,U;let N,C,F,k=a[0],I=l[0];if(!(0,o.matchSegment)(I,k))return!f&&(0,h.isNavigatingToNewRootLayout)(a,l)||I===u.NOT_FOUND_SEGMENT_KEY||null===b||null===T?null:m(t,l,n,c,d,p,y,g,v,b,T,j,M);let D=null!==T&&null!==b?b.concat([T,I]):[],x=l[1],L=a[1],H=null!==d?d[1]:null,B=null!==y?y[1]:null,$=!0===l[4],K=f||$,V=void 0!==n?n.parallelRoutes:void 0,q=!1,W=!1;switch(c){case 0:case 2:case 1:q=!1,W=!1;break;case 3:case 4:q=!0,W=!0}let G=new Map(q?void 0:V),X=0===Object.keys(x).length;if(void 0===n||W||X&&_)if(null!==d&&null!==d[0]){let e=d[0],r=d[2],n=null===p;C=S(e,r,!1,p,n,X,G,t),F=X&&n}else if(null!==y){let e=y[0],r=y[2],n=y[3];C=S(e,r,n,g,v,X,G,t),F=n||X&&v}else C=O(G,X,t,c),F=!0;else C=E(!1,n,G),F=!1;let Y=l[2],z="string"==typeof Y&&"refresh"===l[3]?Y:w;F&&null!==z&&(A=M,U=z,null===(N=A.separateRefreshUrls)?A.separateRefreshUrls=new Set([U]):N.add(U));let Q={},J=null,Z=!1,ee={};for(let n in x){let a=x[n],l=L[n];if(void 0===l)return null;let o=void 0!==V?V.get(n):void 0,f=null!==H?H[n]:null,d=null!==B?B[n]:null,h=a[0],y=p,b=g,m=v;2!==c&&h===u.DEFAULT_SEGMENT_KEY&&(h=(a=function(e,t){let r;return"refresh"===t[3]?r=t:((r=R(t,t[1]))[2]=(0,i.createHrefFromUrl)(e),r[3]="refresh"),r}(r,l))[0],f=null,y=null,d=null,b=null,m=!1);let P=(0,s.createRouterCacheKey)(h),E=e(t,r,void 0!==o?o.get(P):void 0,l,a,c,K,f??null,y,d??null,b,m,_,D,n,j||F,z,M);if(null===E)return null;null===J&&(J=new Map),J.set(n,E);let S=E.node;if(null!==S){let e=new Map(q?void 0:o);e.set(P,S),G.set(n,e)}let O=E.route;Q[n]=O;let T=E.dynamicRequestTree;null!==T?(Z=!0,ee[n]=T):ee[n]=O}return{status:+!F,route:R(l,Q),node:C,dynamicRequestTree:P(l,ee,F,Z,j),refreshUrl:z,children:J}}(e,t,null!==r?r:void 0,n,a,l,!1,c,f,d,p,y,g,null,null,!1,null,v)}function m(e,t,r,n,a,l,u,o,i,c,f,d,h){let y,g,v=t[0],_=null!==f&&null!==c?c.concat([f,v]):[],b=t[1],T=null!==u?u[1]:null,j=null!==a?a[1]:null,w=void 0!==r?r.parallelRoutes:void 0,M=!1,A=!1,U=!1;switch(n){case 0:M=!1,A=void 0===r||e-r.navigatedAt>=p.DYNAMIC_STALETIME_MS,U=!1;break;case 1:A=!1,M=!1,U=!1;break;case 2:if(A=!1,A=!1,void 0!==r){let e=r.rsc;U=!N(e)||"pending"!==e.status}else U=!1;break;case 3:case 4:A=!0,M=!0,U=!1}let C=new Map(M?void 0:w),F=0===Object.keys(b).length;if(F&&(null===h.scrollableSegments&&(h.scrollableSegments=[]),h.scrollableSegments.push(_)),A||void 0===r)if(null!==a&&null!==a[0]){let t=a[0],r=a[2],u=null===l&&1!==n;y=S(t,r,!1,l,u,F,C,e),g=F&&u}else if(1===n&&F&&null!==l)y=S(null,null,!1,l,!1,F,C,e),g=!1;else if(1!==n&&null!==u){let t=u[0],r=u[2],n=u[3];y=S(t,r,n,o,i,F,C,e),g=n||F&&i}else y=O(C,F,e,n),g=!0;else y=E(U,r,C),g=!1;let k={},I=null,D=!1,x={};for(let t in b){let r=b[t],a=void 0!==w?w.get(t):void 0,u=null!==j?j[t]:null,c=null!==T?T[t]:null,f=r[0],p=(0,s.createRouterCacheKey)(f),y=m(e,r,void 0!==a?a.get(p):void 0,n,u??null,l,c??null,o,i,_,t,d||g,h);null===I&&(I=new Map),I.set(t,y);let v=y.node;if(null!==v){let e=new Map(M?void 0:a);e.set(p,v),C.set(t,e)}let R=y.route;k[t]=R;let P=y.dynamicRequestTree;null!==P?(D=!0,x[t]=P):x[t]=R}return{status:+!g,route:R(t,k),node:y,dynamicRequestTree:P(t,x,g,D,d),refreshUrl:null,children:I}}function R(e,t){let r=[e[0],t];return 2 in e&&(r[2]=e[2]),3 in e&&(r[3]=e[3]),4 in e&&(r[4]=e[4]),r}function P(e,t,r,n,a){let l=null;return r?(l=R(e,t),a||(l[3]="refetch")):l=n?R(e,t):null,l}function E(e,t,r){return{rsc:t.rsc,prefetchRsc:e?null:t.prefetchRsc,head:t.head,prefetchHead:e?null:t.prefetchHead,loading:t.loading,parallelRoutes:r,navigatedAt:t.navigatedAt}}function S(e,t,r,n,a,l,u,o){let i,s,c,f;return r?(s=e,i=C()):(s=null,i=e),l?a?(c=n,f=C()):(c=null,f=n):(c=null,f=null),{rsc:i,prefetchRsc:s,head:f,prefetchHead:c,loading:t,parallelRoutes:u,navigatedAt:o}}function O(e,t,r,n){let a=1===n;return{rsc:a?null:C(),prefetchRsc:null,head:!a&&t?C():null,prefetchHead:null,loading:a?null:C(),parallelRoutes:e,navigatedAt:r}}let T=!1;function j(e,t,r,n,a){let l=e.dynamicRequestTree;if(null===l){T=!1;return}let u=A(e,l,t,r,n),o=a.separateRefreshUrls,s=null;if(null!==o){s=[];let a=(0,i.createHrefFromUrl)(t);for(let t of o)t!==a&&null!==l&&s.push(A(e,l,new URL(t,location.origin),r,n))}w(e,r,u,s).then(v,v)}async function w(e,t,r,n){var a,l;let u=await (a=r,l=n,new Promise(e=>{let t=t=>{0===t.exitStatus?0==--n&&e(0):e(t.exitStatus)},r=()=>e(2),n=1;a.then(t,r),null!==l&&(n+=l.length,l.forEach(e=>e.then(t,r)))}));switch(0===u&&(u=function e(t,r,n){var a,l,u;let o,i,s,c;0===t.status?(t.status=2,a=t.node,l=r,u=n,N(i=a.rsc)&&(null===l?i.resolve(null,u):i.reject(l,u)),N(s=a.loading)&&s.resolve(null,u),N(c=a.head)&&c.resolve(null,u),o=null===t.refreshUrl?1:2):o=0;let f=t.children;if(null!==f)for(let[,t]of f){let a=e(t,r,n);a>o&&(o=a)}return o}(e,null,null)),u){case 0:T=!1;return;case 1:{let n=await r;M(!1,n.url,t,n.seed,e.route);return}case 2:{let n=await r;M(!0,n.url,t,n.seed,e.route);return}default:return u}}function M(e,t,r,n,a){e=e||T,T=!0;let l={type:d.ACTION_SERVER_PATCH,previousTree:a,url:t,nextUrl:r,seed:n,mpa:e};(0,f.dispatchAppRouterAction)(l)}async function A(e,t,r,n,a){try{let l=await (0,c.fetchServerResponse)(r,{flightRouterState:t,nextUrl:n,isHmrRefresh:4===a});if("string"==typeof l)return{exitStatus:2,url:new URL(l,location.origin),seed:null};let u=(0,y.convertServerPatchToFullTree)(e.route,l.flightData,l.renderedSearch);return{exitStatus:+!!function e(t,r,n,a,l){0===t.status&&null!==n&&(t.status=1,function(e,t,r,n){let a=e.rsc,l=t[0];if(null===l)return;null===a?e.rsc=l:N(a)&&a.resolve(l,n);let u=e.loading;if(N(u)){let e=t[2];u.resolve(e,n)}let o=e.head;N(o)&&o.resolve(r,n)}(t.node,n,a,l));let u=t.children,i=r[1],s=null!==n?n[1]:null,c=!1;if(null!==u)for(let t in i){let r=i[t],n=null!==s?s[t]:null,f=u.get(t);if(void 0===f)c=!0;else{let t=f.route[0];(0,o.matchSegment)(r[0],t)&&null!=n&&e(f,r,n,a,l)&&(c=!0)}}return c}(e,u.tree,u.data,u.head,l.debugInfo),url:new URL(l.canonicalUrl,location.origin),seed:u}}catch{return{exitStatus:2,url:r,seed:null}}}let U=Symbol();function N(e){return e&&"object"==typeof e&&e.tag===U}function C(){let e,t,r=[],n=new Promise((r,n)=>{e=r,t=n});return n.status="pending",n.resolve=(t,a)=>{"pending"===n.status&&(n.status="fulfilled",n.value=t,null!==a&&r.push.apply(r,a),e(t))},n.reject=(e,a)=>{"pending"===n.status&&(n.status="rejected",n.reason=e,null!==a&&r.push.apply(r,a),t(e))},n.tag=U,n._debugInfo=r,n}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},22744,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HasLoadingBoundary",{enumerable:!0,get:function(){return a}});var n,a=((n={})[n.SegmentHasLoadingBoundary=1]="SegmentHasLoadingBoundary",n[n.SubtreeHasLoadingBoundary=2]="SubtreeHasLoadingBoundary",n[n.SubtreeHasNoLoadingBoundary=3]="SubtreeHasNoLoadingBoundary",n)},9396,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a,l,u={FetchStrategy:function(){return c},NavigationResultTag:function(){return i},PrefetchPriority:function(){return s}};for(var o in u)Object.defineProperty(r,o,{enumerable:!0,get:u[o]});var i=((n={})[n.MPA=0]="MPA",n[n.Success=1]="Success",n[n.NoOp=2]="NoOp",n[n.Async=3]="Async",n),s=((a={})[a.Intent=2]="Intent",a[a.Default=1]="Default",a[a.Background=0]="Background",a),c=((l={})[l.LoadingBoundary=0]="LoadingBoundary",l[l.PPR=1]="PPR",l[l.PPRRuntime=2]="PPRRuntime",l[l.Full=3]="Full",l);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},73861,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={deleteFromLru:function(){return f},lruPut:function(){return s},updateLruSize:function(){return c}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(511),u=null,o=!1,i=0;function s(e){if(u===e)return;let t=e.prev,r=e.next;if(null===r||null===t?(i+=e.size,d()):(t.next=r,r.prev=t),null===u)e.prev=e,e.next=e;else{let t=u.prev;e.prev=t,null!==t&&(t.next=e),e.next=u,u.prev=e}u=e}function c(e,t){let r=e.size;e.size=t,null!==e.next&&(i=i-r+t,d())}function f(e){let t=e.next,r=e.prev;null!==t&&null!==r&&(i-=e.size,e.next=null,e.prev=null,u===e?u=t===u?null:t:(r.next=t,t.prev=r))}function d(){o||i<=0x3200000||(o=!0,p(h))}function h(){o=!1;for(;i>0x2d00000&&null!==u;){let e=u.prev;null!==e&&(0,l.deleteMapEntry)(e)}}let p="function"==typeof requestIdleCallback?requestIdleCallback:e=>setTimeout(e,0);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},511,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={Fallback:function(){return u},createCacheMap:function(){return i},deleteFromCacheMap:function(){return h},deleteMapEntry:function(){return p},getFromCacheMap:function(){return s},isValueExpired:function(){return c},setInCacheMap:function(){return f},setSizeInCacheMap:function(){return y}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(73861),u={},o={};function i(){return{parent:null,key:null,value:null,map:null,prev:null,next:null,size:0}}function s(e,t,r,n,a){let i=function e(t,r,n,a,l,i){let s,f;if(null!==a)s=a.value,f=a.parent;else if(l&&i!==o)s=o,f=null;else return null===n.value?n:c(t,r,n.value)?(p(n),null):n;let d=n.map;if(null!==d){let n=d.get(s);if(void 0!==n){let a=e(t,r,n,f,l,s);if(null!==a)return a}let a=d.get(u);if(void 0!==a)return e(t,r,a,f,l,s)}return null}(e,t,r,n,a,0);return null===i||null===i.value?null:((0,l.lruPut)(i),i.value)}function c(e,t,r){return r.staleAt<=e||r.version{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={appendLayoutVaryPath:function(){return c},clonePageVaryPathWithNewSearchParams:function(){return y},finalizeLayoutVaryPath:function(){return f},finalizeMetadataVaryPath:function(){return h},finalizePageVaryPath:function(){return d},getFulfilledRouteVaryPath:function(){return s},getRouteVaryPath:function(){return i},getSegmentVaryPathForRequest:function(){return p}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(9396),u=e.r(511),o=e.r(67764);function i(e,t,r){return{value:e,parent:{value:t,parent:{value:r,parent:null}}}}function s(e,t,r,n){return{value:e,parent:{value:t,parent:{value:n?r:u.Fallback,parent:null}}}}function c(e,t){return{value:t,parent:e}}function f(e,t){return{value:e,parent:t}}function d(e,t,r){return{value:e,parent:{value:t,parent:r}}}function h(e,t,r){return{value:e+o.HEAD_REQUEST_KEY,parent:{value:t,parent:r}}}function p(e,t){let r=t.varyPath;if(t.isPage&&e!==l.FetchStrategy.Full&&e!==l.FetchStrategy.PPRRuntime){let e=r.parent.parent;return{value:r.value,parent:{value:u.Fallback,parent:e}}}return r}function y(e,t){let r=e.parent;return{value:e.value,parent:{value:t,parent:r.parent}}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},77048,(e,t,r)=>{"use strict";function n(e,t){let r=new URL(e);return{pathname:r.pathname,search:r.search,nextUrl:t}}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createCacheKey",{enumerable:!0,get:function(){return n}}),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},77709,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={cancelPrefetchTask:function(){return R},isPrefetchTaskDirty:function(){return E},pingPrefetchTask:function(){return M},reschedulePrefetchTask:function(){return P},schedulePrefetchTask:function(){return m},startRevalidationCooldown:function(){return b}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(22744),u=e.r(56019),o=e.r(20896),i=e.r(56655),s=e.r(77048),c=e.r(9396),f=e.r(13258),d="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e})),h=[],p=0,y=0,g=!1,v=null,_=null;function b(){null!==_&&clearTimeout(_),_=setTimeout(()=>{_=null,O()},300)}function m(e,t,r,n,a){let l={key:e,treeAtTimeOfPrefetch:t,cacheVersion:(0,o.getCurrentCacheVersion)(),priority:n,phase:1,hasBackgroundWork:!1,spawnedRuntimePrefetches:null,fetchStrategy:r,sortId:y++,isCanceled:!1,onInvalidate:a,_heapIndex:-1};return S(l),B(h,l),O(),l}function R(e){e.isCanceled=!0,function(e,t){let r=t._heapIndex;if(-1!==r&&(t._heapIndex=-1,0!==e.length)){let n=e.pop();n!==t&&(e[r]=n,n._heapIndex=r,W(e,n,r))}}(h,e)}function P(e,t,r,n){e.isCanceled=!1,e.phase=1,e.sortId=y++,e.priority=e===v?c.PrefetchPriority.Intent:n,e.treeAtTimeOfPrefetch=t,e.fetchStrategy=r,S(e),-1!==e._heapIndex?V(h,e):B(h,e),O()}function E(e,t,r){let n=(0,o.getCurrentCacheVersion)();return e.cacheVersion!==n||e.treeAtTimeOfPrefetch!==r||e.key.nextUrl!==t}function S(e){e.priority===c.PrefetchPriority.Intent&&e!==v&&(null!==v&&v.priority!==c.PrefetchPriority.Background&&(v.priority=c.PrefetchPriority.Default,V(h,v)),v=e)}function O(){g||(g=!0,d(A))}function T(e){return null===_&&(e.priority===c.PrefetchPriority.Intent?p<12:p<4)}function j(e){return p++,e.then(e=>null===e?(w(),null):(e.closed.then(w),e.value))}function w(){p--,O()}function M(e){e.isCanceled||-1!==e._heapIndex||(B(h,e),O())}function A(){g=!1;let e=Date.now(),t=$(h);for(;null!==t&&T(t);){t.cacheVersion=(0,o.getCurrentCacheVersion)();let r=function(e,t){let r=t.key,n=(0,o.readOrCreateRouteCacheEntry)(e,t,r),a=function(e,t,r){switch(r.status){case o.EntryStatus.Empty:j((0,o.fetchRouteOnCacheMiss)(r,t,t.key)),r.staleAt=e+6e4,r.status=o.EntryStatus.Pending;case o.EntryStatus.Pending:{let e=r.blockedTasks;return null===e?r.blockedTasks=new Set([t]):e.add(t),1}case o.EntryStatus.Rejected:break;case o.EntryStatus.Fulfilled:{if(0!==t.phase)return 2;if(!T(t))return 0;let i=r.tree,s=t.fetchStrategy===c.FetchStrategy.PPR?r.isPPREnabled?c.FetchStrategy.PPR:c.FetchStrategy.LoadingBoundary:t.fetchStrategy;switch(s){case c.FetchStrategy.PPR:{var n,a,u;if(F(n=e,a=t,u=r,(0,o.readOrCreateSegmentCacheEntry)(n,c.FetchStrategy.PPR,u,u.metadata),a.key,u.metadata),0===function e(t,r,n,a,l){let u=(0,o.readOrCreateSegmentCacheEntry)(t,r.fetchStrategy,n,l);F(t,r,n,u,r.key,l);let i=a[1],s=l.slots;if(null!==s)for(let a in s){if(!T(r))return 0;let l=s[a],u=l.segment,c=i[a],f=c?.[0];if(0===(void 0!==f&&L(n,u,f)?e(t,r,n,c,l):function e(t,r,n,a){if(a.hasRuntimePrefetch)return null===r.spawnedRuntimePrefetches?r.spawnedRuntimePrefetches=new Set([a.requestKey]):r.spawnedRuntimePrefetches.add(a.requestKey),2;let l=(0,o.readOrCreateSegmentCacheEntry)(t,r.fetchStrategy,n,a);if(F(t,r,n,l,r.key,a),null!==a.slots){if(!T(r))return 0;for(let l in a.slots)if(0===e(t,r,n,a.slots[l]))return 0}return 2}(t,r,n,l)))return 0}return 2}(e,t,r,t.treeAtTimeOfPrefetch,i))return 0;let l=t.spawnedRuntimePrefetches;if(null!==l){let n=new Map;N(e,t,r,n,c.FetchStrategy.PPRRuntime);let a=function e(t,r,n,a,l,u){if(l.has(a.requestKey))return C(t,r,n,a,!1,u,c.FetchStrategy.PPRRuntime);let o={},i=a.slots;if(null!==i)for(let a in i){let s=i[a];o[a]=e(t,r,n,s,l,u)}return[a.segment,o,null,null]}(e,t,r,i,l,n);n.size>0&&j((0,o.fetchSegmentPrefetchesUsingDynamicRequest)(t,r,c.FetchStrategy.PPRRuntime,a,n))}return 2}case c.FetchStrategy.Full:case c.FetchStrategy.PPRRuntime:case c.FetchStrategy.LoadingBoundary:{let n=new Map;N(e,t,r,n,s);let a=function e(t,r,n,a,u,i,s){let f=a[1],d=u.slots,h={};if(null!==d)for(let a in d){let u=d[a],p=u.segment,y=f[a],g=y?.[0];if(void 0!==g&&L(n,p,g)){let l=e(t,r,n,y,u,i,s);h[a]=l}else switch(s){case c.FetchStrategy.LoadingBoundary:{let e=u.hasLoadingBoundary!==l.HasLoadingBoundary.SubtreeHasNoLoadingBoundary?function e(t,r,n,a,u,i){let s=null===u?"inside-shared-layout":null,f=(0,o.readOrCreateSegmentCacheEntry)(t,r.fetchStrategy,n,a);switch(f.status){case o.EntryStatus.Empty:i.set(a.requestKey,(0,o.upgradeToPendingSegment)(f,c.FetchStrategy.LoadingBoundary)),"refetch"!==u&&(s=u="refetch");break;case o.EntryStatus.Fulfilled:if(a.hasLoadingBoundary===l.HasLoadingBoundary.SegmentHasLoadingBoundary)return(0,o.convertRouteTreeToFlightRouterState)(a);case o.EntryStatus.Pending:case o.EntryStatus.Rejected:}let d={};if(null!==a.slots)for(let l in a.slots){let o=a.slots[l];d[l]=e(t,r,n,o,u,i)}return[a.segment,d,null,s,a.isRootLayout]}(t,r,n,u,null,i):(0,o.convertRouteTreeToFlightRouterState)(u);h[a]=e;break}case c.FetchStrategy.PPRRuntime:{let e=C(t,r,n,u,!1,i,s);h[a]=e;break}case c.FetchStrategy.Full:{let e=C(t,r,n,u,!1,i,s);h[a]=e}}}return[u.segment,h,null,null,u.isRootLayout]}(e,t,r,t.treeAtTimeOfPrefetch,i,n,s);return n.size>0&&j((0,o.fetchSegmentPrefetchesUsingDynamicRequest)(t,r,s,a,n)),2}}}}return 2}(e,t,n);if(0!==a&&""!==r.search){let n=new URL(r.pathname,location.origin),a=(0,s.createCacheKey)(n.href,r.nextUrl),l=(0,o.readOrCreateRouteCacheEntry)(e,t,a);switch(l.status){case o.EntryStatus.Empty:U(t)&&(l.status=o.EntryStatus.Pending,j((0,o.fetchRouteOnCacheMiss)(l,t,a)));case o.EntryStatus.Pending:case o.EntryStatus.Fulfilled:case o.EntryStatus.Rejected:}}return a}(e,t),n=t.hasBackgroundWork;switch(t.hasBackgroundWork=!1,t.spawnedRuntimePrefetches=null,r){case 0:return;case 1:K(h),t=$(h);continue;case 2:1===t.phase?(t.phase=0,V(h,t)):n?(t.priority=c.PrefetchPriority.Background,V(h,t)):K(h),t=$(h);continue}}}function U(e){return e.priority===c.PrefetchPriority.Background||(e.hasBackgroundWork=!0,!1)}function N(e,t,r,n,a){C(e,t,r,r.metadata,!1,n,a===c.FetchStrategy.LoadingBoundary?c.FetchStrategy.Full:a)}function C(e,t,r,n,a,l,u){let i=(0,o.readOrCreateSegmentCacheEntry)(e,u,r,n),s=null;switch(i.status){case o.EntryStatus.Empty:s=(0,o.upgradeToPendingSegment)(i,u);break;case o.EntryStatus.Fulfilled:i.isPartial&&(0,o.canNewFetchStrategyProvideMoreContent)(i.fetchStrategy,u)&&(s=I(e,r,n,u));break;case o.EntryStatus.Pending:case o.EntryStatus.Rejected:(0,o.canNewFetchStrategyProvideMoreContent)(i.fetchStrategy,u)&&(s=I(e,r,n,u))}let c={};if(null!==n.slots)for(let o in n.slots){let i=n.slots[o];c[o]=C(e,t,r,i,a||null!==s,l,u)}null!==s&&l.set(n.requestKey,s);let f=a||null===s?null:"refetch";return[n.segment,c,null,f,n.isRootLayout]}function F(e,t,r,n,a,l){switch(n.status){case o.EntryStatus.Empty:j((0,o.fetchSegmentOnCacheMiss)(r,(0,o.upgradeToPendingSegment)(n,c.FetchStrategy.PPR),a,l));break;case o.EntryStatus.Pending:switch(n.fetchStrategy){case c.FetchStrategy.PPR:case c.FetchStrategy.PPRRuntime:case c.FetchStrategy.Full:break;case c.FetchStrategy.LoadingBoundary:U(t)&&k(e,r,a,l);break;default:n.fetchStrategy}break;case o.EntryStatus.Rejected:switch(n.fetchStrategy){case c.FetchStrategy.PPR:case c.FetchStrategy.PPRRuntime:case c.FetchStrategy.Full:break;case c.FetchStrategy.LoadingBoundary:k(e,r,a,l);break;default:n.fetchStrategy}case o.EntryStatus.Fulfilled:}}function k(e,t,r,n){let a=(0,o.readOrCreateRevalidatingSegmentEntry)(e,c.FetchStrategy.PPR,t,n);switch(a.status){case o.EntryStatus.Empty:x(j((0,o.fetchSegmentOnCacheMiss)(t,(0,o.upgradeToPendingSegment)(a,c.FetchStrategy.PPR),r,n)),(0,i.getSegmentVaryPathForRequest)(c.FetchStrategy.PPR,n));case o.EntryStatus.Pending:case o.EntryStatus.Fulfilled:case o.EntryStatus.Rejected:}}function I(e,t,r,n){let a=(0,o.readOrCreateRevalidatingSegmentEntry)(e,n,t,r);if(a.status===o.EntryStatus.Empty){let e=(0,o.upgradeToPendingSegment)(a,n);return x((0,o.waitForSegmentCacheEntry)(e),(0,i.getSegmentVaryPathForRequest)(n,r)),e}if((0,o.canNewFetchStrategyProvideMoreContent)(a.fetchStrategy,n)){let e=(0,o.overwriteRevalidatingSegmentCacheEntry)(n,t,r),a=(0,o.upgradeToPendingSegment)(e,n);return x((0,o.waitForSegmentCacheEntry)(a),(0,i.getSegmentVaryPathForRequest)(n,r)),a}switch(a.status){case o.EntryStatus.Pending:case o.EntryStatus.Fulfilled:case o.EntryStatus.Rejected:default:return null}}let D=()=>{};function x(e,t){e.then(e=>{null!==e&&(0,o.upsertSegmentEntry)(Date.now(),t,e)},D)}function L(e,t,r){return r===f.PAGE_SEGMENT_KEY?t===(0,f.addSearchParamsIfPageSegment)(f.PAGE_SEGMENT_KEY,Object.fromEntries(new URLSearchParams(e.renderedSearch))):(0,u.matchSegment)(r,t)}function H(e,t){let r=t.priority-e.priority;if(0!==r)return r;let n=t.phase-e.phase;return 0!==n?n:t.sortId-e.sortId}function B(e,t){let r=e.length;e.push(t),t._heapIndex=r,q(e,t,r)}function $(e){return 0===e.length?null:e[0]}function K(e){if(0===e.length)return null;let t=e[0];t._heapIndex=-1;let r=e.pop();return r!==t&&(e[0]=r,r._heapIndex=0,W(e,r,0)),t}function V(e,t){let r=t._heapIndex;-1!==r&&(0===r?W(e,t,0):H(e[r-1>>>1],t)>0?q(e,t,r):W(e,t,r))}function q(e,t,r){let n=r;for(;n>0;){let r=n-1>>>1,a=e[r];if(!(H(a,t)>0))return;e[r]=t,t._heapIndex=r,e[n]=a,a._heapIndex=n,n=r}}function W(e,t,r){let n=r,a=e.length,l=a>>>1;for(;nH(l,t))uH(o,l)?(e[n]=o,o._heapIndex=n,e[u]=t,t._heapIndex=u,n=u):(e[n]=l,l._heapIndex=n,e[r]=t,t._heapIndex=r,n=r);else{if(!(uH(o,t)))return;e[n]=o,o._heapIndex=n,e[u]=t,t._heapIndex=u,n=u}}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},72463,(e,t,r)=>{"use strict";function n(e){let t=e.indexOf("#"),r=e.indexOf("?"),n=r>-1&&(t<0||r-1?{pathname:e.substring(0,n?r:t),query:n?e.substring(r,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"parsePath",{enumerable:!0,get:function(){return n}})},41858,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"addPathPrefix",{enumerable:!0,get:function(){return a}});let n=e.r(72463);function a(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:a,hash:l}=(0,n.parsePath)(e);return`${t}${r}${a}${l}`}},38281,(e,t,r)=>{"use strict";function n(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"removeTrailingSlash",{enumerable:!0,get:function(){return n}})},82823,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return l}});let n=e.r(38281),a=e.r(72463),l=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:r,hash:l}=(0,a.parsePath)(e);return/\.[^/]+\/?$/.test(t)?`${(0,n.removeTrailingSlash)(t)}${r}${l}`:t.endsWith("/")?`${t}${r}${l}`:`${t}/${r}${l}`};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},5550,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"addBasePath",{enumerable:!0,get:function(){return l}});let n=e.r(41858),a=e.r(82823);function l(e,t){return(0,a.normalizePathTrailingSlash)((0,n.addPathPrefix)(e,"/t2-mapper"))}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},57630,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={createPrefetchURL:function(){return i},isExternalURL:function(){return o}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(82604),u=e.r(5550);function o(e){return e.origin!==window.location.origin}function i(e){let t;if((0,l.isBot)(window.navigator.userAgent))return null;try{t=new URL((0,u.addBasePath)(e),window.location.href)}catch(t){throw Object.defineProperty(Error(`Cannot prefetch '${e}' because it cannot be converted to a URL.`),"__NEXT_ERROR_CODE",{value:"E234",enumerable:!1,configurable:!0})}return o(t)?null:t}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},91949,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={IDLE_LINK_STATUS:function(){return f},PENDING_LINK_STATUS:function(){return c},mountFormInstance:function(){return m},mountLinkInstance:function(){return b},onLinkVisibilityChanged:function(){return P},onNavigationIntent:function(){return E},pingVisibleLinks:function(){return O},setLinkForCurrentNavigation:function(){return d},unmountLinkForCurrentNavigation:function(){return h},unmountPrefetchableInstance:function(){return R}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(9396),u=e.r(77048),o=e.r(77709),i=e.r(71645),s=null,c={pending:!0},f={pending:!1};function d(e){(0,i.startTransition)(()=>{s?.setOptimisticLinkStatus(f),e?.setOptimisticLinkStatus(c),s=e})}function h(e){s===e&&(s=null)}let p="function"==typeof WeakMap?new WeakMap:new Map,y=new Set,g="function"==typeof IntersectionObserver?new IntersectionObserver(function(e){for(let t of e){let e=t.intersectionRatio>0;P(t.target,e)}},{rootMargin:"200px"}):null;function v(e,t){void 0!==p.get(e)&&R(e),p.set(e,t),null!==g&&g.observe(e)}function _(t){if("undefined"==typeof window)return null;{let{createPrefetchURL:r}=e.r(57630);try{return r(t)}catch{return("function"==typeof reportError?reportError:console.error)(`Cannot prefetch '${t}' because it cannot be converted to a URL.`),null}}}function b(e,t,r,n,a,l){if(a){let a=_(t);if(null!==a){let t={router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:a.href,setOptimisticLinkStatus:l};return v(e,t),t}}return{router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:null,setOptimisticLinkStatus:l}}function m(e,t,r,n){let a=_(t);null===a||v(e,{router:r,fetchStrategy:n,isVisible:!1,prefetchTask:null,prefetchHref:a.href,setOptimisticLinkStatus:null})}function R(e){let t=p.get(e);if(void 0!==t){p.delete(e),y.delete(t);let r=t.prefetchTask;null!==r&&(0,o.cancelPrefetchTask)(r)}null!==g&&g.unobserve(e)}function P(e,t){let r=p.get(e);void 0!==r&&(r.isVisible=t,t?y.add(r):y.delete(r),S(r,l.PrefetchPriority.Default))}function E(e,t){let r=p.get(e);void 0!==r&&void 0!==r&&S(r,l.PrefetchPriority.Intent)}function S(t,r){if("undefined"!=typeof window){let n=t.prefetchTask;if(!t.isVisible){null!==n&&(0,o.cancelPrefetchTask)(n);return}let{getCurrentAppRouterState:a}=e.r(99781),l=a();if(null!==l){let e=l.tree;if(null===n){let n=l.nextUrl,a=(0,u.createCacheKey)(t.prefetchHref,n);t.prefetchTask=(0,o.schedulePrefetchTask)(a,e,t.fetchStrategy,r,null)}else(0,o.reschedulePrefetchTask)(n,e,t.fetchStrategy,r)}}}function O(e,t){for(let r of y){let n=r.prefetchTask;if(null!==n&&!(0,o.isPrefetchTaskDirty)(n,e,t))continue;null!==n&&(0,o.cancelPrefetchTask)(n);let a=(0,u.createCacheKey)(r.prefetchHref,e);r.prefetchTask=(0,o.schedulePrefetchTask)(a,t,r.fetchStrategy,l.PrefetchPriority.Default,null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},39470,(e,t,r)=>{"use strict";function n(){let e,t,r=new Promise((r,n)=>{e=r,t=n});return{resolve:e,reject:t,promise:r}}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"createPromiseWithResolvers",{enumerable:!0,get:function(){return n}})},20896,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a={EntryStatus:function(){return S},canNewFetchStrategyProvideMoreContent:function(){return en},convertRouteTreeToFlightRouterState:function(){return function e(t){let r={};if(null!==t.slots)for(let n in t.slots)r[n]=e(t.slots[n]);return[t.segment,r,null,null,t.isRootLayout]}},createDetachedSegmentCacheEntry:function(){return K},fetchRouteOnCacheMiss:function(){return Y},fetchSegmentOnCacheMiss:function(){return z},fetchSegmentPrefetchesUsingDynamicRequest:function(){return Q},getCurrentCacheVersion:function(){return A},getStaleTimeMs:function(){return E},overwriteRevalidatingSegmentCacheEntry:function(){return B},pingInvalidationListeners:function(){return N},readOrCreateRevalidatingSegmentEntry:function(){return H},readOrCreateRouteCacheEntry:function(){return I},readOrCreateSegmentCacheEntry:function(){return L},readRouteCacheEntry:function(){return C},readSegmentCacheEntry:function(){return F},requestOptimisticRouteCacheEntry:function(){return D},revalidateEntireCache:function(){return U},upgradeToPendingSegment:function(){return V},upsertSegmentEntry:function(){return $},waitForSegmentCacheEntry:function(){return k}};for(var l in a)Object.defineProperty(r,l,{enumerable:!0,get:a[l]});let u=e.r(22744),o=e.r(21768),i=e.r(87288),s=e.r(77709),c=e.r(56655),f=e.r(14297),d=e.r(51191),h=e.r(77048),p=e.r(33906),y=e.r(511),g=e.r(67764),v=e.r(50590),_=e.r(54069),b=e.r(91949),m=e.r(13258),R=e.r(9396),P=e.r(39470);function E(e){return 1e3*Math.max(e,30)}var S=((n={})[n.Empty=0]="Empty",n[n.Pending=1]="Pending",n[n.Fulfilled=2]="Fulfilled",n[n.Rejected=3]="Rejected",n);let O=["",{},null,"metadata-only"],T=(0,y.createCacheMap)(),j=(0,y.createCacheMap)(),w=null,M=0;function A(){return M}function U(e,t){M++,(0,s.startRevalidationCooldown)(),(0,b.pingVisibleLinks)(e,t),N(e,t)}function N(e,t){if(null!==w){let r=w;for(let n of(w=null,r))(0,s.isPrefetchTaskDirty)(n,e,t)&&function(e){let t=e.onInvalidate;if(null!==t){e.onInvalidate=null;try{t()}catch(e){"function"==typeof reportError?reportError(e):console.error(e)}}}(n)}}function C(e,t){let r=(0,c.getRouteVaryPath)(t.pathname,t.search,t.nextUrl);return(0,y.getFromCacheMap)(e,M,T,r,!1)}function F(e,t){return(0,y.getFromCacheMap)(e,M,j,t,!1)}function k(e){let t=e.promise;return null===t&&(t=e.promise=(0,P.createPromiseWithResolvers)()),t.promise}function I(e,t,r){null!==t.onInvalidate&&(null===w?w=new Set([t]):w.add(t));let n=C(e,r);if(null!==n)return n;let a={canonicalUrl:null,status:0,blockedTasks:null,tree:null,metadata:null,couldBeIntercepted:!0,isPPREnabled:!1,renderedSearch:null,ref:null,size:0,staleAt:1/0,version:M},l=(0,c.getRouteVaryPath)(r.pathname,r.search,r.nextUrl);return(0,y.setInCacheMap)(T,l,a,!1),a}function D(e,t,r){let n=t.search;if(""===n)return null;let a=new URL(t);a.search="";let l=C(e,(0,h.createCacheKey)(a.href,r));if(null===l||2!==l.status)return null;let u=new URL(l.canonicalUrl,t.origin),o=""!==u.search?u.search:n,i=""!==l.renderedSearch?l.renderedSearch:n,s=new URL(l.canonicalUrl,location.origin);return s.search=o,{canonicalUrl:(0,d.createHrefFromUrl)(s),status:2,blockedTasks:null,tree:x(l.tree,i),metadata:x(l.metadata,i),couldBeIntercepted:l.couldBeIntercepted,isPPREnabled:l.isPPREnabled,renderedSearch:i,ref:null,size:0,staleAt:l.staleAt,version:l.version}}function x(e,t){let r=null,n=e.slots;if(null!==n)for(let e in r={},n){let a=n[e];r[e]=x(a,t)}return e.isPage?{requestKey:e.requestKey,segment:e.segment,varyPath:(0,c.clonePageVaryPathWithNewSearchParams)(e.varyPath,t),isPage:!0,slots:r,isRootLayout:e.isRootLayout,hasLoadingBoundary:e.hasLoadingBoundary,hasRuntimePrefetch:e.hasRuntimePrefetch}:{requestKey:e.requestKey,segment:e.segment,varyPath:e.varyPath,isPage:!1,slots:r,isRootLayout:e.isRootLayout,hasLoadingBoundary:e.hasLoadingBoundary,hasRuntimePrefetch:e.hasRuntimePrefetch}}function L(e,t,r,n){let a=F(e,n.varyPath);if(null!==a)return a;let l=(0,c.getSegmentVaryPathForRequest)(t,n),u=K(r.staleAt);return(0,y.setInCacheMap)(j,l,u,!1),u}function H(e,t,r,n){var a;let l=(a=n.varyPath,(0,y.getFromCacheMap)(e,M,j,a,!0));if(null!==l)return l;let u=(0,c.getSegmentVaryPathForRequest)(t,n),o=K(r.staleAt);return(0,y.setInCacheMap)(j,u,o,!0),o}function B(e,t,r){let n=(0,c.getSegmentVaryPathForRequest)(e,r),a=K(t.staleAt);return(0,y.setInCacheMap)(j,n,a,!0),a}function $(e,t,r){if((0,y.isValueExpired)(e,M,r))return null;let n=F(e,t);if(null!==n){var a;if(r.fetchStrategy!==n.fetchStrategy&&(a=n.fetchStrategy,!(a=400)return G(e,Date.now()+1e4),null;r=n.redirected?new URL(n.url):_,t=await ee(er(r,s),h)}if(!t||!t.ok||204===t.status||!t.body)return G(e,Date.now()+1e4),null;let b=(0,d.createHrefFromUrl)(r),R=t.headers.get("vary"),S=null!==R&&R.includes(o.NEXT_URL),O=(0,P.createPromiseWithResolvers)(),j="2"===t.headers.get(o.NEXT_DID_POSTPONE_HEADER)||!0;{var v;let r,n,a,l=et(t.body,O.resolve,function(t){(0,y.setSizeInCacheMap)(e,t)}),o=await (0,i.createFromNextReadableStream)(l,h);if(o.buildId!==(0,f.getAppBuildId)())return G(e,Date.now()+1e4),null;let s=(0,p.getRenderedPathname)(t),d=(0,p.getRenderedSearch)(t),_={metadataVaryPath:null},R=(r=s.split("/").filter(e=>""!==e),n=g.ROOT_SEGMENT_REQUEST_KEY,function e(t,r,n,a,l,o,i,s){let f,d,h=null,y=t.slots;if(null!==y)for(let t in f=!1,d=(0,c.finalizeLayoutVaryPath)(a,n),h={},y){let r,u,f,d=y[t],v=d.name,_=d.paramType,b=d.paramKey;if(null!==_){let e=(0,p.parseDynamicParamFromURLPart)(_,l,o),t=null!==b?b:(0,p.getCacheKeyForDynamicParam)(e,"");f=(0,c.appendLayoutVaryPath)(n,t),u=[v,t,_],r=!0}else f=n,u=v,r=(0,p.doesStaticSegmentAppearInURL)(v);let m=r?o+1:o,R=(0,g.createSegmentRequestKeyPart)(u),P=(0,g.appendSegmentRequestKeyPart)(a,t,R);h[t]=e(d,u,f,P,l,m,i,s)}else a.endsWith(m.PAGE_SEGMENT_KEY)?(f=!0,d=(0,c.finalizePageVaryPath)(a,i,n),null===s.metadataVaryPath&&(s.metadataVaryPath=(0,c.finalizeMetadataVaryPath)(a,i,n))):(f=!1,d=(0,c.finalizeLayoutVaryPath)(a,n));return{requestKey:a,segment:r,varyPath:d,isPage:f,slots:h,isRootLayout:t.isRootLayout,hasLoadingBoundary:u.HasLoadingBoundary.SegmentHasLoadingBoundary,hasRuntimePrefetch:t.hasRuntimePrefetch}}(o.tree,n,null,g.ROOT_SEGMENT_REQUEST_KEY,r,0,d,_)),P=_.metadataVaryPath;if(null===P)return G(e,Date.now()+1e4),null;let T=E(o.staleTime);v=Date.now()+T,a={requestKey:g.HEAD_REQUEST_KEY,segment:g.HEAD_REQUEST_KEY,varyPath:P,isPage:!0,slots:null,isRootLayout:!1,hasLoadingBoundary:u.HasLoadingBoundary.SubtreeHasNoLoadingBoundary,hasRuntimePrefetch:!1},e.status=2,e.tree=R,e.metadata=a,e.staleAt=v,e.couldBeIntercepted=S,e.canonicalUrl=b,e.renderedSearch=d,e.isPPREnabled=j,q(e)}if(!S){let t=(0,c.getFulfilledRouteVaryPath)(n,a,l,S);(0,y.setInCacheMap)(T,t,e,!1)}return{value:null,closed:O.promise}}catch(t){return G(e,Date.now()+1e4),null}}async function z(e,t,r,n){let a=new URL(e.canonicalUrl,location.origin),l=r.nextUrl,u=n.requestKey,s=u===g.ROOT_SEGMENT_REQUEST_KEY?"/_index":u,c={[o.RSC_HEADER]:"1",[o.NEXT_ROUTER_PREFETCH_HEADER]:"1",[o.NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]:s};null!==l&&(c[o.NEXT_URL]=l);let d=er(a,s);try{let r=await ee(d,c);if(!r||!r.ok||204===r.status||"2"!==r.headers.get(o.NEXT_DID_POSTPONE_HEADER)&&0||!r.body)return X(t,Date.now()+1e4),null;let n=(0,P.createPromiseWithResolvers)(),a=et(r.body,n.resolve,function(e){(0,y.setSizeInCacheMap)(t,e)}),l=await (0,i.createFromNextReadableStream)(a,c);if(l.buildId!==(0,f.getAppBuildId)())return X(t,Date.now()+1e4),null;return{value:W(t,l.rsc,l.loading,e.staleAt,l.isPartial),closed:n.promise}}catch(e){return X(t,Date.now()+1e4),null}}async function Q(e,t,r,n,a){let l=e.key,u=new URL(t.canonicalUrl,location.origin),s=l.nextUrl;1===a.size&&a.has(t.metadata.requestKey)&&(n=O);let c={[o.RSC_HEADER]:"1",[o.NEXT_ROUTER_STATE_TREE_HEADER]:(0,v.prepareFlightRouterStateForRequest)(n)};switch(null!==s&&(c[o.NEXT_URL]=s),r){case R.FetchStrategy.Full:break;case R.FetchStrategy.PPRRuntime:c[o.NEXT_ROUTER_PREFETCH_HEADER]="2";break;case R.FetchStrategy.LoadingBoundary:c[o.NEXT_ROUTER_PREFETCH_HEADER]="1"}try{let n=await ee(u,c);if(!n||!n.ok||!n.body||(0,p.getRenderedSearch)(n)!==t.renderedSearch)return J(a,Date.now()+1e4),null;let l=(0,P.createPromiseWithResolvers)(),s=null,d=et(n.body,l.resolve,function(e){if(null===s)return;let t=e/s.length;for(let e of s)(0,y.setSizeInCacheMap)(e,t)}),h=await (0,i.createFromNextReadableStream)(d,c),g=r===R.FetchStrategy.PPRRuntime&&h.rp?.[0]===!0;return s=function(e,t,r,n,a,l,u,i){if(a.b!==(0,f.getAppBuildId)())return null!==i&&J(i,e+1e4),null;let s=(0,v.normalizeFlightData)(a.f);if("string"==typeof s)return null;let c="number"==typeof a.rp?.[1]?a.rp[1]:parseInt(n.headers.get(o.NEXT_ROUTER_STALE_TIME_HEADER)??"",10),d=e+(isNaN(c)?_.STATIC_STALETIME_MS:E(c));for(let n of s){let a=n.seedData;if(null!==a){let o=n.segmentPath,s=u.tree;for(let t=0;t{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={convertServerPatchToFullTree:function(){return m},navigate:function(){return d},navigateToSeededRoute:function(){return h}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(87288),u=e.r(95871),o=e.r(51191),i=e.r(20896),s=e.r(77048),c=e.r(13258),f=e.r(9396);function d(e,t,r,n,a,l,u,o){let c=Date.now(),d=e.href,h=d===t.href,y=(0,s.createCacheKey)(d,a),_=(0,i.readRouteCacheEntry)(c,y);if(null!==_&&_.status===i.EntryStatus.Fulfilled){let o=g(c,_,_.tree),i=o.flightRouterState,s=o.seedData,f=v(c,_),d=f.rsc,y=f.isPartial,b=_.canonicalUrl+e.hash;return p(c,e,t,a,h,r,n,i,s,d,y,b,_.renderedSearch,l,u)}if(null===_||_.status!==i.EntryStatus.Rejected){let o=(0,i.requestOptimisticRouteCacheEntry)(c,e,a);if(null!==o){let i=g(c,o,o.tree),s=i.flightRouterState,f=i.seedData,d=v(c,o),y=d.rsc,_=d.isPartial,b=o.canonicalUrl+e.hash;return p(c,e,t,a,h,r,n,s,f,y,_,b,o.renderedSearch,l,u)}}let m=o.collectedDebugInfo??[];return void 0===o.collectedDebugInfo&&(m=o.collectedDebugInfo=[]),{tag:f.NavigationResultTag.Async,data:b(c,e,t,a,r,n,l,u,m)}}function h(e,t,r,n,a,l,o,i,s,c){let d={scrollableSegments:null,separateRefreshUrls:null},h=t.href===a.href,p=(0,u.startPPRNavigation)(e,a,l,o,n.tree,i,n.data,n.head,null,null,!1,h,d);return null!==p?((0,u.spawnDynamicRequests)(p,t,s,i,d),y(p,r,n.renderedSearch,d.scrollableSegments,c,t.hash)):{tag:f.NavigationResultTag.MPA,data:r}}function p(e,t,r,n,a,l,o,i,s,c,d,h,p,g,v){let _={scrollableSegments:null,separateRefreshUrls:null},b=(0,u.startPPRNavigation)(e,r,l,o,i,g,null,null,s,c,d,a,_);return null!==b?((0,u.spawnDynamicRequests)(b,t,n,g,_),y(b,h,p,_.scrollableSegments,v,t.hash)):{tag:f.NavigationResultTag.MPA,data:h}}function y(e,t,r,n,a,l){return{tag:f.NavigationResultTag.Success,data:{flightRouterState:e.route,cacheNode:e.node,canonicalUrl:t,renderedSearch:r,scrollableSegments:n,shouldScroll:a,hash:l}}}function g(e,t,r){let n={},a={},l=r.slots;if(null!==l)for(let r in l){let u=g(e,t,l[r]);n[r]=u.flightRouterState,a[r]=u.seedData}let u=null,o=null,s=!0,f=(0,i.readSegmentCacheEntry)(e,r.varyPath);if(null!==f)switch(f.status){case i.EntryStatus.Fulfilled:u=f.rsc,o=f.loading,s=f.isPartial;break;case i.EntryStatus.Pending:{let e=(0,i.waitForSegmentCacheEntry)(f);u=e.then(e=>null!==e?e.rsc:null),o=e.then(e=>null!==e?e.loading:null),s=f.isPartial}case i.EntryStatus.Empty:case i.EntryStatus.Rejected:}return{flightRouterState:[(0,c.addSearchParamsIfPageSegment)(r.segment,Object.fromEntries(new URLSearchParams(t.renderedSearch))),n,null,null,r.isRootLayout],seedData:[u,a,o,s,!1]}}function v(e,t){let r=null,n=!0,a=(0,i.readSegmentCacheEntry)(e,t.metadata.varyPath);if(null!==a)switch(a.status){case i.EntryStatus.Fulfilled:r=a.rsc,n=a.isPartial;break;case i.EntryStatus.Pending:r=(0,i.waitForSegmentCacheEntry)(a).then(e=>null!==e?e.rsc:null),n=a.isPartial;case i.EntryStatus.Empty:case i.EntryStatus.Rejected:}return{rsc:r,isPartial:n}}let _=["",{},null,"refetch"];async function b(e,t,r,n,a,i,s,c,d){let p;switch(s){case u.FreshnessPolicy.Default:case u.FreshnessPolicy.HistoryTraversal:p=i;break;case u.FreshnessPolicy.Hydration:case u.FreshnessPolicy.RefreshAll:case u.FreshnessPolicy.HMRRefresh:p=_;break;default:p=i}let y=(0,l.fetchServerResponse)(t,{flightRouterState:p,nextUrl:n}),g=await y;if("string"==typeof g)return{tag:f.NavigationResultTag.MPA,data:g};let{flightData:v,canonicalUrl:b,renderedSearch:R,debugInfo:P}=g;null!==P&&d.push(...P);let E=m(i,v,R);return h(e,t,(0,o.createHrefFromUrl)(b),E,r,a,i,s,n,c)}function m(e,t,r){let n=e,a=null,l=null;for(let{segmentPath:e,tree:r,seedData:u,head:o}of t){let t=function e(t,r,n,a,l,u){let o;if(u===l.length)return{tree:n,data:a};let i=l[u],s=t[1],c=null!==r?r[1]:null,f={},d={};for(let t in s){let r=s[t],o=null!==c?c[t]??null:null;if(t===i){let i=e(r,o,n,a,l,u+2);f[t]=i.tree,d[t]=i.data}else f[t]=r,d[t]=o}return o=[t[0],f],2 in t&&(o[2]=t[2]),3 in t&&(o[3]=t[3]),4 in t&&(o[4]=t[4]),{tree:o,data:[null,d,null,!0,!1]}}(n,a,r,u,e,0);n=t.tree,a=t.data,l=o}return{tree:n,data:a,renderedSearch:r,head:l}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},54069,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DYNAMIC_STALETIME_MS:function(){return f},STATIC_STALETIME_MS:function(){return d},generateSegmentsFromPatch:function(){return function e(t){let r=[],[n,a]=t;if(0===Object.keys(a).length)return[[n]];for(let[t,l]of Object.entries(a))for(let a of e(l))""===n?r.push([t,...a]):r.push([n,t,...a]);return r}},handleExternalUrl:function(){return h},handleNavigationResult:function(){return p},navigateReducer:function(){return y}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(51191),u=e.r(47442),o=e.r(60355),i=e.r(9396),s=e.r(20896),c=e.r(95871),f=1e3*Number("0"),d=(0,s.getStaleTimeMs)(Number("300"));function h(e,t,r,n){return t.mpaNavigation=!0,t.canonicalUrl=r,t.pendingPush=n,t.scrollableSegments=void 0,(0,u.handleMutable)(e,t)}function p(e,t,r,n,a){switch(a.tag){case i.NavigationResultTag.MPA:return h(t,r,a.data,n);case i.NavigationResultTag.Success:{r.cache=a.data.cacheNode,r.patchedTree=a.data.flightRouterState,r.renderedSearch=a.data.renderedSearch,r.canonicalUrl=a.data.canonicalUrl,r.scrollableSegments=a.data.scrollableSegments??void 0,r.shouldScroll=a.data.shouldScroll,r.hashFragment=a.data.hash;let n=new URL(t.canonicalUrl,e);return e.pathname===n.pathname&&e.search===n.search&&e.hash!==n.hash&&(r.onlyHashChange=!0,r.shouldScroll=a.data.shouldScroll,r.hashFragment=e.hash,r.scrollableSegments=[]),(0,u.handleMutable)(t,r)}case i.NavigationResultTag.Async:return a.data.then(a=>p(e,t,r,n,a),()=>t);default:return t}}function y(e,t){let{url:r,isExternalUrl:n,navigateType:a,shouldScroll:u}=t,i={},s=(0,l.createHrefFromUrl)(r),f="push"===a;if(i.preserveCustomHistoryState=!1,i.pendingPush=f,n)return h(e,i,r.toString(),f);if(document.getElementById("__next-page-redirect"))return h(e,i,s,f);let d=new URL(e.canonicalUrl,location.origin),y=(0,o.navigate)(r,d,e.cache,e.tree,e.nextUrl,c.FreshnessPolicy.Default,u,i);return p(r,e,i,f,y)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},84356,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"hasInterceptionRouteInCurrentTree",{enumerable:!0,get:function(){return function e([t,r]){if(Array.isArray(t)&&("di(..)(..)"===t[2]||"ci(..)(..)"===t[2]||"di(.)"===t[2]||"ci(.)"===t[2]||"di(..)"===t[2]||"ci(..)"===t[2]||"di(...)"===t[2]||"ci(...)"===t[2])||"string"==typeof t&&(0,n.isInterceptionRouteAppPath)(t))return!0;if(r){for(let t in r)if(e(r[t]))return!0}return!1}}});let n=e.r(91463);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},69845,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={refreshDynamicData:function(){return f},refreshReducer:function(){return c}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(54069),u=e.r(60355),o=e.r(20896),i=e.r(84356),s=e.r(95871);function c(e){let t=e.nextUrl,r=e.tree;return(0,o.revalidateEntireCache)(t,r),f(e,s.FreshnessPolicy.RefreshAll)}function f(e,t){let r=e.nextUrl,n=(0,i.hasInterceptionRouteInCurrentTree)(e.tree)?e.previousNextUrl||r:null,a=e.canonicalUrl,o=new URL(a,location.origin),s=e.tree,c={tree:e.tree,renderedSearch:e.renderedSearch,data:null,head:null},f=Date.now(),d=(0,u.navigateToSeededRoute)(f,o,a,c,o,e.cache,s,t,n,!0),h={};return h.preserveCustomHistoryState=!1,(0,l.handleNavigationResult)(o,e,h,!1,d)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},91668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"serverPatchReducer",{enumerable:!0,get:function(){return i}});let n=e.r(51191),a=e.r(54069),l=e.r(60355),u=e.r(69845),o=e.r(95871);function i(e,t){let r={};r.preserveCustomHistoryState=!1;let i=t.mpa,s=new URL(t.url,location.origin),c=t.seed;if(i||null===c)return(0,a.handleExternalUrl)(e,r,s.href,!1);let f=new URL(e.canonicalUrl,location.origin);if(t.previousTree!==e.tree)return(0,u.refreshReducer)(e);let d=(0,n.createHrefFromUrl)(s),h=t.nextUrl,p=Date.now(),y=(0,l.navigateToSeededRoute)(p,s,d,c,f,e.cache,e.tree,o.FreshnessPolicy.RefreshAll,h,!0);return(0,a.handleNavigationResult)(s,e,r,!1,y)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},73790,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"restoreReducer",{enumerable:!0,get:function(){return o}});let n=e.r(51191),a=e.r(34727),l=e.r(95871),u=e.r(54069);function o(e,t){let r,o,i=t.historyState;i?(r=i.tree,o=i.renderedSearch):(r=e.tree,o=e.renderedSearch);let s=new URL(e.canonicalUrl,location.origin),c=t.url,f=(0,n.createHrefFromUrl)(c),d=(0,a.extractPathFromFlightRouterState)(r)??c.pathname,h=Date.now(),p={scrollableSegments:null,separateRefreshUrls:null},y=(0,l.startPPRNavigation)(h,s,e.cache,e.tree,r,l.FreshnessPolicy.HistoryTraversal,null,null,null,null,!1,!1,p);return null===y?(0,u.handleExternalUrl)(e,{preserveCustomHistoryState:!0},f,!1):((0,l.spawnDynamicRequests)(y,c,d,l.FreshnessPolicy.HistoryTraversal,p),{canonicalUrl:f,renderedSearch:o,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:y.node,tree:r,nextUrl:d,previousNextUrl:null,debugInfo:null})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},86720,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"hmrRefreshReducer",{enumerable:!0,get:function(){return l}});let n=e.r(69845),a=e.r(95871);function l(e){return(0,n.refreshDynamicData)(e,a.FreshnessPolicy.HMRRefresh)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},27801,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"assignLocation",{enumerable:!0,get:function(){return a}});let n=e.r(5550);function a(e,t){if(e.startsWith(".")){let r=t.origin+t.pathname;return new URL((r.endsWith("/")?r:r+"/")+e)}return new URL((0,n.addBasePath)(e),t.href)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},39584,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"pathHasPrefix",{enumerable:!0,get:function(){return a}});let n=e.r(72463);function a(e,t){if("string"!=typeof e)return!1;let{pathname:r}=(0,n.parsePath)(e);return r===t||r.startsWith(t+"/")}},52817,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"hasBasePath",{enumerable:!0,get:function(){return a}});let n=e.r(39584);function a(e){return(0,n.pathHasPrefix)(e,"/t2-mapper")}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},87250,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"removeBasePath",{enumerable:!0,get:function(){return a}}),e.r(52817);let n="/t2-mapper";function a(e){return 0===n.length||(e=e.slice(n.length)).startsWith("/")||(e=`/${e}`),e}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},39747,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={extractInfoFromServerReferenceId:function(){return l},omitUnusedArgs:function(){return u}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});function l(e){let t=parseInt(e.slice(0,2),16),r=t>>1&63,n=Array(6);for(let e=0;e<6;e++){let t=r>>5-e&1;n[e]=1===t}return{type:1==(t>>7&1)?"use-cache":"server-action",usedArgs:n,hasRestArgs:1==(1&t)}}function u(e,t){let r=Array(e.length);for(let n=0;n=6&&t.hasRestArgs)&&(r[n]=e[n]);return r}},39146,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ActionDidNotRevalidate:function(){return l},ActionDidRevalidateDynamicOnly:function(){return o},ActionDidRevalidateStaticAndDynamic:function(){return u}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=0,u=1,o=2},45794,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"serverActionReducer",{enumerable:!0,get:function(){return j}});let a=e.r(32120),l=e.r(92245),u=e.r(21768),o=e.r(92838),i=e.r(35326),s=e.r(27801),c=e.r(51191),f=e.r(54069),d=e.r(84356),h=e.r(50590),p=e.r(24063),y=e.r(68391),g=e.r(87250),v=e.r(52817),_=e.r(39747),b=e.r(20896),m=e.r(43369),R=e.r(60355),P=e.r(39146),E=e.r(57630),S=e.r(95871),O=i.createFromFetch;async function T(e,t,{actionId:r,actionArgs:c}){let f,d,p,g,v,b=(0,i.createTemporaryReferenceSet)(),R=(0,_.extractInfoFromServerReferenceId)(r),E="use-cache"===R.type?(0,_.omitUnusedArgs)(c,R):c,S=await (0,i.encodeReply)(E,{temporaryReferences:b}),T={Accept:u.RSC_CONTENT_TYPE_HEADER,[u.ACTION_HEADER]:r,[u.NEXT_ROUTER_STATE_TREE_HEADER]:(0,h.prepareFlightRouterStateForRequest)(e.tree)},j=(0,m.getDeploymentId)();j&&(T["x-deployment-id"]=j),t&&(T[u.NEXT_URL]=t);let w=await fetch(e.canonicalUrl,{method:"POST",headers:T,body:S});if("1"===w.headers.get(u.NEXT_ACTION_NOT_FOUND_HEADER))throw Object.defineProperty(new o.UnrecognizedActionError(`Server Action "${r}" was not found on the server. -Read more: https://nextjs.org/docs/messages/failed-to-find-server-action`),"__NEXT_ERROR_CODE",{value:"E715",enumerable:!1,configurable:!0});let M=w.headers.get("x-action-redirect"),[A,U]=M?.split(";")||[];switch(U){case"push":f=y.RedirectType.push;break;case"replace":f=y.RedirectType.replace;break;default:f=void 0}let N=!!w.headers.get(u.NEXT_IS_PRERENDER_HEADER),C=P.ActionDidNotRevalidate;try{let e=w.headers.get("x-action-revalidated");if(e){let t=JSON.parse(e);(t===P.ActionDidRevalidateStaticAndDynamic||t===P.ActionDidRevalidateDynamicOnly)&&(C=t)}}catch{}let F=A?(0,s.assignLocation)(A,new URL(e.canonicalUrl,window.location.href)):void 0,k=w.headers.get("content-type"),I=!!(k&&k.startsWith(u.RSC_CONTENT_TYPE_HEADER));if(!I&&!F)throw Object.defineProperty(Error(w.status>=400&&"text/plain"===k?await w.text():"An unexpected response was received from the server."),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});if(I){let e=await O(Promise.resolve(w),{callServer:a.callServer,findSourceMapURL:l.findSourceMapURL,temporaryReferences:b,debugChannel:n&&n(T)});d=F?void 0:e.a;let t=(0,h.normalizeFlightData)(e.f);""!==t&&(p=t,g=e.q,v=e.i)}else d=void 0,p=void 0,g=void 0,v=void 0;return{actionResult:d,actionFlightData:p,actionFlightDataRenderedSearch:g,actionFlightDataCouldBeIntercepted:v,redirectLocation:F,redirectType:f,revalidationKind:C,isPrerender:N}}function j(e,t){let{resolve:r,reject:n}=t,a={};a.preserveCustomHistoryState=!1;let l=(e.previousNextUrl||e.nextUrl)&&(0,d.hasInterceptionRouteInCurrentTree)(e.tree)?e.previousNextUrl||e.nextUrl:null;return T(e,l,t).then(async({revalidationKind:u,actionResult:o,actionFlightData:i,actionFlightDataRenderedSearch:s,actionFlightDataCouldBeIntercepted:d,redirectLocation:h,redirectType:p})=>{u!==P.ActionDidNotRevalidate&&(t.didRevalidate=!0,u===P.ActionDidRevalidateStaticAndDynamic&&(0,b.revalidateEntireCache)(l,e.tree));let _=p!==y.RedirectType.replace;if(e.pushRef.pendingPush=_,a.pendingPush=_,void 0!==h){let t=p||y.RedirectType.push;if((0,E.isExternalURL)(h)){let r=h.href;return n(w(r,t)),(0,f.handleExternalUrl)(e,a,r,_)}{let e=(0,c.createHrefFromUrl)(h,!1);n(w((0,v.hasBasePath)(e)?(0,g.removeBasePath)(e):e,t))}}else r(o);if(void 0===h&&u===P.ActionDidNotRevalidate&&void 0===i)return e;if(void 0===i&&void 0!==h)return(0,f.handleExternalUrl)(e,a,h.href,_);if("string"==typeof i)return(0,f.handleExternalUrl)(e,a,i,_);let m=new URL(e.canonicalUrl,location.origin),O=void 0!==h?h:m,T=e.tree,j=u===P.ActionDidNotRevalidate?S.FreshnessPolicy.Default:S.FreshnessPolicy.RefreshAll;if(void 0!==i){let t=i[0];if(void 0!==t&&t.isRootRender&&void 0!==s&&void 0!==d){let r=(0,c.createHrefFromUrl)(O),n={tree:t.tree,renderedSearch:s,data:t.seedData,head:t.head},u=Date.now(),o=(0,R.navigateToSeededRoute)(u,O,r,n,m,e.cache,T,j,l,!0);return(0,f.handleNavigationResult)(O,e,a,_,o)}}let M=(0,R.navigate)(O,m,e.cache,T,l,j,!0,a);return(0,f.handleNavigationResult)(O,e,a,_,M)},t=>(n(t),e))}function w(e,t){let r=(0,p.getRedirectError)(e,t);return r.handled=!0,r}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},4924,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"reducer",{enumerable:!0,get:function(){return c}});let n=e.r(88540),a=e.r(54069),l=e.r(91668),u=e.r(73790),o=e.r(69845),i=e.r(86720),s=e.r(45794),c="undefined"==typeof window?function(e,t){return e}:function(e,t){switch(t.type){case n.ACTION_NAVIGATE:return(0,a.navigateReducer)(e,t);case n.ACTION_SERVER_PATCH:return(0,l.serverPatchReducer)(e,t);case n.ACTION_RESTORE:return(0,u.restoreReducer)(e,t);case n.ACTION_REFRESH:return(0,o.refreshReducer)(e);case n.ACTION_HMR_REFRESH:return(0,i.hmrRefreshReducer)(e);case n.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Object.defineProperty(Error("Unknown action"),"__NEXT_ERROR_CODE",{value:"E295",enumerable:!1,configurable:!0})}};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},1411,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"prefetch",{enumerable:!0,get:function(){return o}});let n=e.r(57630),a=e.r(77048),l=e.r(77709),u=e.r(9396);function o(e,t,r,o,i){let s=(0,n.createPrefetchURL)(e);if(null===s)return;let c=(0,a.createCacheKey)(s.href,t);(0,l.schedulePrefetchTask)(c,r,o,u.PrefetchPriority.Default,i)}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},99781,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={createMutableActionQueue:function(){return _},dispatchNavigateAction:function(){return R},dispatchTraverseAction:function(){return P},getCurrentAppRouterState:function(){return b},publicAppRouterInstance:function(){return E}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(88540),u=e.r(4924),o=e.r(71645),i=e.r(64245),s=e.r(9396),c=e.r(1411),f=e.r(41538),d=e.r(5550),h=e.r(57630),p=e.r(91949);function y(e,t){null!==e.pending?(e.pending=e.pending.next,null!==e.pending&&g({actionQueue:e,action:e.pending,setState:t})):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:l.ACTION_REFRESH},t))}async function g({actionQueue:e,action:t,setState:r}){let n=e.state;e.pending=t;let a=t.payload,u=e.action(n,a);function o(n){if(t.discarded){t.payload.type===l.ACTION_SERVER_ACTION&&t.payload.didRevalidate&&(e.needsRefresh=!0),y(e,r);return}e.state=n,y(e,r),t.resolve(n)}(0,i.isThenable)(u)?u.then(o,n=>{y(e,r),t.reject(n)}):o(u)}let v=null;function _(e,t){let r={state:e,dispatch:(e,t)=>(function(e,t,r){let n={resolve:r,reject:()=>{}};if(t.type!==l.ACTION_RESTORE){let e=new Promise((e,t)=>{n={resolve:e,reject:t}});(0,o.startTransition)(()=>{r(e)})}let a={payload:t,next:null,resolve:n.resolve,reject:n.reject};null===e.pending?(e.last=a,g({actionQueue:e,action:a,setState:r})):t.type===l.ACTION_NAVIGATE||t.type===l.ACTION_RESTORE?(e.pending.discarded=!0,a.next=e.pending.next,g({actionQueue:e,action:a,setState:r})):(null!==e.last&&(e.last.next=a),e.last=a)})(r,e,t),action:async(e,t)=>(0,u.reducer)(e,t),pending:null,last:null,onRouterTransitionStart:null!==t&&"function"==typeof t.onRouterTransitionStart?t.onRouterTransitionStart:null};if("undefined"!=typeof window){if(null!==v)throw Object.defineProperty(Error("Internal Next.js Error: createMutableActionQueue was called more than once"),"__NEXT_ERROR_CODE",{value:"E624",enumerable:!1,configurable:!0});v=r}return r}function b(){return null!==v?v.state:null}function m(){return null!==v?v.onRouterTransitionStart:null}function R(e,t,r,n){let a=new URL((0,d.addBasePath)(e),location.href);(0,p.setLinkForCurrentNavigation)(n);let u=m();null!==u&&u(e,t),(0,f.dispatchAppRouterAction)({type:l.ACTION_NAVIGATE,url:a,isExternalUrl:(0,h.isExternalURL)(a),locationSearch:location.search,shouldScroll:r,navigateType:t})}function P(e,t){let r=m();null!==r&&r(e,"traverse"),(0,f.dispatchAppRouterAction)({type:l.ACTION_RESTORE,url:new URL(e),historyState:t})}let E={back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{let r,n=function(){if(null===v)throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0});return v}();switch(t?.kind??l.PrefetchKind.AUTO){case l.PrefetchKind.AUTO:r=s.FetchStrategy.PPR;break;case l.PrefetchKind.FULL:r=s.FetchStrategy.Full;break;default:r=s.FetchStrategy.PPR}(0,c.prefetch)(e,n.state.nextUrl,n.state.tree,r,t?.onInvalidate??null)},replace:(e,t)=>{(0,o.startTransition)(()=>{R(e,"replace",t?.scroll??!0,null)})},push:(e,t)=>{(0,o.startTransition)(()=>{R(e,"push",t?.scroll??!0,null)})},refresh:()=>{(0,o.startTransition)(()=>{(0,f.dispatchAppRouterAction)({type:l.ACTION_REFRESH})})},hmrRefresh:()=>{throw Object.defineProperty(Error("hmrRefresh can only be used in development mode. Please use refresh instead."),"__NEXT_ERROR_CODE",{value:"E485",enumerable:!1,configurable:!0})}};"undefined"!=typeof window&&window.next&&(window.next.router=E),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},58442,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={RedirectBoundary:function(){return h},RedirectErrorBoundary:function(){return d}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(90809),u=e.r(43476),o=l._(e.r(71645)),i=e.r(76562),s=e.r(24063),c=e.r(68391);function f({redirect:e,reset:t,redirectType:r}){let n=(0,i.useRouter)();return(0,o.useEffect)(()=>{o.default.startTransition(()=>{r===c.RedirectType.push?n.push(e,{}):n.replace(e,{}),t()})},[e,r,t,n]),null}class d extends o.default.Component{constructor(e){super(e),this.state={redirect:null,redirectType:null}}static getDerivedStateFromError(e){if((0,c.isRedirectError)(e)){let t=(0,s.getURLFromRedirectError)(e),r=(0,s.getRedirectTypeFromError)(e);return"handled"in e?{redirect:null,redirectType:null}:{redirect:t,redirectType:r}}throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,u.jsx)(f,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}}function h({children:e}){let t=(0,i.useRouter)();return(0,u.jsx)(d,{router:t,children:e})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},1244,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"unresolvedThenable",{enumerable:!0,get:function(){return n}});let n={then:()=>{}};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},97367,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={MetadataBoundary:function(){return o},OutletBoundary:function(){return s},RootLayoutBoundary:function(){return c},ViewportBoundary:function(){return i}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let l=e.r(54839),u={[l.METADATA_BOUNDARY_NAME]:function({children:e}){return e},[l.VIEWPORT_BOUNDARY_NAME]:function({children:e}){return e},[l.OUTLET_BOUNDARY_NAME]:function({children:e}){return e},[l.ROOT_LAYOUT_BOUNDARY_NAME]:function({children:e}){return e}},o=u[l.METADATA_BOUNDARY_NAME.slice(0)],i=u[l.VIEWPORT_BOUNDARY_NAME.slice(0)],s=u[l.OUTLET_BOUNDARY_NAME.slice(0)],c=u[l.ROOT_LAYOUT_BOUNDARY_NAME.slice(0)]}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/adafff78bc0c4657.js b/docs/_next/static/chunks/adafff78bc0c4657.js new file mode 100644 index 00000000..65479b36 --- /dev/null +++ b/docs/_next/static/chunks/adafff78bc0c4657.js @@ -0,0 +1,211 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},47071,99143,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(15080),s=e.i(40859);e.s(["useLoader",()=>s.G],99143);var s=s;let n=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function a(e,a){let o=(0,i.useThree)(e=>e.gl),l=(0,s.G)(r.TextureLoader,n(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==a||a(l)},[a]),(0,t.useEffect)(()=>{if("initTexture"in o){let e=[];Array.isArray(l)?e=l:l instanceof r.Texture?e=[l]:n(l)&&(e=Object.values(l)),e.forEach(e=>{e instanceof r.Texture&&o.initTexture(e)})}},[o,l]),(0,t.useMemo)(()=>{if(!n(e))return l;{let t={},r=0;for(let i in e)t[i]=l[r++];return t}},[e,l])}a.preload=e=>s.G.preload(r.TextureLoader,e),a.clear=e=>s.G.clear(r.TextureLoader,e),e.s(["useTexture",()=>a],47071)},75567,e=>{"use strict";var t=e.i(90072);function r(e,i={}){let{repeat:s=[1,1],disableMipmaps:n=!1}=i;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...s),e.flipY=!1,e.anisotropy=16,n?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function i(e){let r=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return r.colorSpace=t.NoColorSpace,r.wrapS=r.wrapT=t.RepeatWrapping,r.generateMipmaps=!1,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.needsUpdate=!0,r}e.s(["setupMask",()=>i,"setupTexture",()=>r])},47021,e=>{"use strict";var t=e.i(8560);let r=` +#ifdef USE_FOG + // Check fog enabled uniform - allows toggling without shader recompilation + #ifdef USE_VOLUMETRIC_FOG + if (!fogEnabled) { + // Skip all fog calculations when disabled + } else { + #endif + + float dist = vFogDepth; + + // Discard fragments at or beyond visible distance - matches Torque's behavior + // where objects beyond visibleDistance are not rendered at all. + // This prevents fully-fogged geometry from showing as silhouettes against + // the sky's fog-to-sky gradient. + if (dist >= fogFar) { + discard; + } + + // Step 1: Calculate distance-based haze (quadratic falloff) + // Since we discard at fogFar, haze never reaches 1.0 here + float haze = 0.0; + if (dist > fogNear) { + float fogScale = 1.0 / (fogFar - fogNear); + float distFactor = (dist - fogNear) * fogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } + + // Step 2: Calculate fog volume contributions + // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) + // All fog uses the global fogColor - see Tribes2_Fog_System.md for details + float volumeFog = 0.0; + + #ifdef USE_VOLUMETRIC_FOG + { + #ifdef USE_FOG_WORLD_POSITION + float fragmentHeight = vFogWorldPosition.y; + #else + float fragmentHeight = cameraHeight; + #endif + + float deltaY = fragmentHeight - cameraHeight; + float absDeltaY = abs(deltaY); + + // Determine if we're going up (positive) or down (negative) + if (absDeltaY > 0.01) { + // Non-horizontal ray: ray-march through fog volumes + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + // Skip inactive volumes (visibleDistance = 0) + if (volVisDist <= 0.0) continue; + + // Calculate fog factor for this volume + // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage + // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) + // Since we don't have quality settings, we use visFactor = 1.0 + float factor = (1.0 / volVisDist) * volPct; + + // Find ray intersection with this volume's height range + float rayMinY = min(cameraHeight, fragmentHeight); + float rayMaxY = max(cameraHeight, fragmentHeight); + + // Check if ray intersects volume height range + if (rayMinY < volMaxH && rayMaxY > volMinH) { + float intersectMin = max(rayMinY, volMinH); + float intersectMax = min(rayMaxY, volMaxH); + float intersectHeight = intersectMax - intersectMin; + + // Calculate distance traveled through this volume using similar triangles: + // subDist / dist = intersectHeight / absDeltaY + float subDist = dist * (intersectHeight / absDeltaY); + + // Accumulate fog: fog += subDist * factor + volumeFog += subDist * factor; + } + } + } else { + // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // If camera is inside this volume, apply fog for full distance + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float factor = (1.0 / volVisDist) * volPct; + volumeFog += dist * factor; + } + } + } + } + #endif + + // Step 3: Combine haze and volume fog + // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct + // This gives fog volumes priority over haze + float volPct = min(volumeFog, 1.0); + float hazePct = haze; + if (volPct + hazePct > 1.0) { + hazePct = 1.0 - volPct; + } + float fogFactor = hazePct + volPct; + + // Apply fog using global fogColor (per-volume colors not used in Tribes 2) + gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); + + #ifdef USE_VOLUMETRIC_FOG + } // end fogEnabled check + #endif +#endif +`;function i(){t.ShaderChunk.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 + + // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) + // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats + #ifdef USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + #endif + + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_fragment=r,t.ShaderChunk.fog_pars_vertex=` +#ifdef USE_FOG + varying float vFogDepth; + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_vertex=` +#ifdef USE_FOG + // Use Euclidean distance from camera, not view-space z-depth + // This ensures fog doesn't change when rotating the camera + vFogDepth = length(mvPosition.xyz); + #ifdef USE_FOG_WORLD_POSITION + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; + #endif +#endif +`}function s(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.uniforms.fogEnabled=t.fogEnabled,e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + #define USE_VOLUMETRIC_FOG + varying vec3 vFogWorldPosition; +#endif`),e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + uniform bool fogEnabled; + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",r)}e.s(["fogFragmentShader",0,r,"injectCustomFog",()=>s,"installCustomFogShader",()=>i])},48066,e=>{"use strict";let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0},fogEnabled:{value:!0}};function r(e,i,s=!0){t.cameraHeight.value=e,t.fogVolumeData.value.set(i),t.fogEnabled.value=s}function i(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0),t.fogEnabled.value=!0}function s(e){let t=new Float32Array(12);for(let r=0;r<3;r++){let i=4*r,s=e[r];s&&(t[i+0]=s.visibleDistance,t[i+1]=s.minHeight,t[i+2]=s.maxHeight,t[i+3]=s.percentage)}return t}e.s(["globalFogUniforms",0,t,"packFogVolumeData",()=>s,"resetGlobalFogUniforms",()=>i,"updateGlobalFogUniforms",()=>r])},67191,e=>{e.v({Label:"FloatingLabel-module__8y09Ka__Label"})},89887,60099,e=>{"use strict";let t,r;var i=e.i(43476),s=e.i(932),n=e.i(71645),a=e.i(90072),o=e.i(71753),l=e.i(31067),u=e.i(88014),c=e.i(15080);let d=new a.Vector3,h=new a.Vector3,f=new a.Vector3,p=new a.Vector2;function m(e,t,r){let i=d.setFromMatrixPosition(e.matrixWorld);i.project(t);let s=r.width/2,n=r.height/2;return[i.x*s+s,-(i.y*n)+n]}let y=e=>1e-10>Math.abs(e)?0:e;function g(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=y(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let b=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>g(e,t)),v=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>g(e,r(t),"translate(-50%,-50%)")),S=n.forwardRef(({children:e,eps:t=.001,style:r,className:i,prepend:s,center:g,fullscreen:S,portal:x,distanceFactor:E,sprite:R=!1,transform:k=!1,occlude:O,onOcclude:C,castShadow:T,receiveShadow:F,material:I,geometry:w,zIndexRange:M=[0x1000037,0],calculatePosition:j=m,as:_="div",wrapperClass:P,pointerEvents:D="auto",...U},L)=>{let{gl:Q,camera:N,scene:B,size:V,raycaster:H,events:A,viewport:W}=(0,c.useThree)(),[q]=n.useState(()=>document.createElement(_)),z=n.useRef(null),G=n.useRef(null),$=n.useRef(0),K=n.useRef([0,0]),Y=n.useRef(null),J=n.useRef(null),Z=(null==x?void 0:x.current)||A.connected||Q.domElement.parentNode,X=n.useRef(null),ee=n.useRef(!1),et=n.useMemo(()=>{var e;return O&&"blending"!==O||Array.isArray(O)&&O.length&&(e=O[0])&&"object"==typeof e&&"current"in e},[O]);n.useLayoutEffect(()=>{let e=Q.domElement;O&&"blending"===O?(e.style.zIndex=`${Math.floor(M[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[O]),n.useLayoutEffect(()=>{if(G.current){let e=z.current=u.createRoot(q);if(B.updateMatrixWorld(),k)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=j(G.current,N,V);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Z&&(s?Z.prepend(q):Z.appendChild(q)),()=>{Z&&Z.removeChild(q),e.unmount()}}},[Z,k]),n.useLayoutEffect(()=>{P&&(q.className=P)},[P]);let er=n.useMemo(()=>k?{position:"absolute",top:0,left:0,width:V.width,height:V.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:g?"translate3d(-50%,-50%,0)":"none",...S&&{top:-V.height/2,left:-V.width/2,width:V.width,height:V.height},...r},[r,g,S,V,k]),ei=n.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);n.useLayoutEffect(()=>{var t,s;ee.current=!1,k?null==(t=z.current)||t.render(n.createElement("div",{ref:Y,style:er},n.createElement("div",{ref:J,style:ei},n.createElement("div",{ref:L,className:i,style:r,children:e})))):null==(s=z.current)||s.render(n.createElement("div",{ref:L,style:er,className:i,children:e}))});let es=n.useRef(!0);(0,o.useFrame)(e=>{if(G.current){N.updateMatrixWorld(),G.current.updateWorldMatrix(!0,!1);let e=k?K.current:j(G.current,N,V);if(k||Math.abs($.current-N.zoom)>t||Math.abs(K.current[0]-e[0])>t||Math.abs(K.current[1]-e[1])>t){var r;let t,i,s,n,o=(r=G.current,t=d.setFromMatrixPosition(r.matrixWorld),i=h.setFromMatrixPosition(N.matrixWorld),s=t.sub(i),n=N.getWorldDirection(f),s.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(O)?l=O.map(e=>e.current):"blending"!==O&&(l=[B]));let u=es.current;l?es.current=function(e,t,r,i){let s=d.setFromMatrixPosition(e.matrixWorld),n=s.clone();n.project(t),p.set(n.x,n.y),r.setFromCamera(p,t);let a=r.intersectObjects(i,!0);if(a.length){let e=a[0].distance;return s.distanceTo(r.ray.origin)({vertexShader:k?void 0:` + /* + This shader is from the THREE's SpriteMaterial. + We need to turn the backing plane into a Sprite + (make it always face the camera) if "transfrom" + is false. + */ + #include + + void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + // This is somewhat arbitrary, but it seems to work well + // Need to figure out how to derive this dynamically if it even matters + float size = 0.03; + + 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 ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + 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; + } + `,fragmentShader:` + void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } + `}),[k]);return n.createElement("group",(0,l.default)({},U,{ref:G}),O&&!et&&n.createElement("mesh",{castShadow:T,receiveShadow:F,ref:X},w||n.createElement("planeGeometry",null),I||n.createElement("shaderMaterial",{side:a.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",()=>S],60099);var x=e.i(67191);let E=[0,0,0],R=new a.Vector3,k=(0,n.memo)(function(e){let t,r,a,l=(0,s.c)(11),{children:u,color:c,position:d,opacity:h}=e,f=void 0===c?"white":c,p=void 0===d?E:d,m=void 0===h?"fadeWithDistance":h,y="fadeWithDistance"===m,g=(0,n.useRef)(null),[b,v]=(0,n.useState)(0!==m),k=(0,n.useRef)(null);return l[0]!==y||l[1]!==b||l[2]!==m?(t=e=>{var t,r,i;let s,{camera:n}=e,a=g.current;if(!a)return;a.getWorldPosition(R);let o=(t=R.x,r=R.y,i=R.z,-((t-(s=n.matrixWorld.elements)[12])*s[8])+-((r-s[13])*s[9])+-((i-s[14])*s[10])<0);if(y){let e=o?1/0:n.position.distanceTo(R),t=e<200;if(b!==t&&v(t),k.current&&t){let t=Math.max(0,Math.min(1,1-e/200));k.current.style.opacity=t.toString()}}else{let e=!o&&0!==m;b!==e&&v(e),k.current&&(k.current.style.opacity=m.toString())}},l[0]=y,l[1]=b,l[2]=m,l[3]=t):t=l[3],(0,o.useFrame)(t),l[4]!==u||l[5]!==f||l[6]!==b||l[7]!==p?(r=b?(0,i.jsx)(S,{position:p,center:!0,children:(0,i.jsx)("div",{ref:k,className:x.default.Label,style:{color:f},children:u})}):null,l[4]=u,l[5]=f,l[6]=b,l[7]=p,l[8]=r):r=l[8],l[9]!==r?(a=(0,i.jsx)("group",{ref:g,children:r}),l[9]=r,l[10]=a):a=l[10],a});e.s(["FloatingLabel",0,k],89887)},13876,79473,43595,58647,30064,e=>{"use strict";var t=e.i(932),r=e.i(8155);let i=e=>(t,r,i)=>{let s=i.subscribe;return i.subscribe=(e,t,r)=>{let n=e;if(t){let s=(null==r?void 0:r.equalityFn)||Object.is,a=e(i.getState());n=r=>{let i=e(r);if(!s(a,i)){let e=a;t(a=i,e)}},(null==r?void 0:r.fireImmediately)&&t(a,a)}return s(n)},e(t,r,i)};e.s(["subscribeWithSelector",()=>i],79473);var s=e.i(66748);function n(e){let t=new Map;for(let r of e.state.datablocks.values()){if("tsshapeconstructor"!==r._class)continue;let e=r.baseshape;if("string"!=typeof e)continue;let i=e.toLowerCase(),s=i.replace(/\.dts$/i,"")+"_",n=new Map;for(let e=0;e<=127;e++){let t=r[`sequence${e}`];if("string"!=typeof t)continue;let i=t.indexOf(" ");if(-1===i)continue;let a=t.slice(0,i).toLowerCase(),o=t.slice(i+1).trim().toLowerCase();if(!o||!a.startsWith(s)||!a.endsWith(".dsq"))continue;let l=a.slice(s.length,-4);l&&n.set(o,l)}n.size>0&&t.set(i,n)}return t}function a(e,t,r){let i=new Map;for(let r of e){let e=t.clipAction(r);i.set(r.name.toLowerCase(),e)}if(r)for(let[e,t]of r){let r=i.get(t);r&&!i.has(e)&&i.set(e,r)}return i}function o(e){return e.toLowerCase()}function l(e){let t=o(e.trim());return t.startsWith("$")?t.slice(1):t}e.s(["buildSequenceAliasMap",()=>n,"getAliasedActions",()=>a],43595);let u={entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},c={runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},world:{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},playback:{recording:null,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:0,streamSnapshot:null},diagnostics:{eventCounts:{"object.created":0,"object.deleted":0,"field.changed":0,"method.called":0,"global.changed":0,"batch.flushed":0},recentEvents:[],maxRecentEvents:200,webglContextLost:!1,playbackEvents:[],maxPlaybackEvents:400,rendererSamples:[],maxRendererSamples:2400}},d=(0,r.createStore)()(i(e=>({...c,setRuntime(t){let r=function(e){let t={},r={},i={},s={};for(let r of e.state.objectsById.values())t[r._id]=0,r._name&&(i[o(r._name)]=r._id,r._isDatablock&&(s[o(r._name)]=r._id));for(let t of e.state.globals.keys())r[l(t)]=0;return{objectVersionById:t,globalVersionByName:r,objectIdsByName:i,datablockIdsByName:s}}(t),i=n(t);e(e=>({...e,runtime:{runtime:t,sequenceAliases:i,objectVersionById:r.objectVersionById,globalVersionByName:r.globalVersionByName,objectIdsByName:r.objectIdsByName,datablockIdsByName:r.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,r){0!==t.length&&e(e=>{let i={...e.runtime.objectVersionById},s={...e.runtime.globalVersionByName},n={...e.runtime.objectIdsByName},a={...e.runtime.datablockIdsByName},u={...e.diagnostics.eventCounts},c=[...e.diagnostics.recentEvents],d=e=>{null!=e&&(i[e]=(i[e]??0)+1)};for(let e of t){if(u[e.type]=(u[e.type]??0)+1,c.push(e),"object.created"===e.type){let t=e.object;if(d(e.objectId),t._name){let r=o(t._name);n[r]=e.objectId,t._isDatablock&&(a[r]=e.objectId)}d(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete i[e.objectId],t?._name){let e=o(t._name);delete n[e],t._isDatablock&&delete a[e]}d(t?._parent?._id);continue}if("field.changed"===e.type){d(e.objectId);continue}if("global.changed"===e.type){let t=l(e.name);s[t]=(s[t]??0)+1;continue}}let h=r?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);u["batch.flushed"]+=1,c.push({type:"batch.flushed",tick:h,events:t});let f=e.diagnostics.maxRecentEvents,p=c.length>f?c.slice(c.length-f):c;return{...e,runtime:{...e.runtime,objectVersionById:i,globalVersionByName:s,objectIdsByName:n,datablockIdsByName:a,lastRuntimeTick:h},diagnostics:{...e.diagnostics,eventCounts:u,recentEvents:p}}})},setDemoRecording(t){let r=Math.max(0,(t?.duration??0)*1e3),i=function(e=0){let t=Error().stack;if(!t)return null;let r=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return r.length>0?r.join(" <= "):null}(1);e(e=>{let s=e.playback.streamSnapshot,n=e.playback.recording,a={t:Date.now(),kind:"recording.set",message:"setDemoRecording invoked",playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:s?.entities.length??0,streamCameraMode:s?.camera?.mode??null,streamExhausted:s?.exhausted??!1,meta:{previousMissionName:n?.missionName??null,nextMissionName:t?.missionName??null,previousDurationSec:n?Number(n.duration.toFixed(3)):null,nextDurationSec:t?Number(t.duration.toFixed(3)):null,isNull:null==t,stack:i??"unavailable"}};return{...e,world:u,playback:{recording:t,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:r,streamSnapshot:null},diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[a],rendererSamples:[]}}})},setPlaybackTime(t){e(e=>{var r,i,s;let n=(r=t,i=0,s=e.playback.durationMs,r<0?0:r>s?s:r);return{...e,playback:{...e.playback,timeMs:n,frameCursor:n}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var r,i,s;let n=Number.isFinite(t)?(i=.01,s=16,(r=t)<.01?.01:r>16?16:r):1;e(e=>({...e,playback:{...e.playback,rate:n}}))},setPlaybackFrameCursor(t){let r=Number.isFinite(t)?t:0;e(e=>({...e,playback:{...e.playback,frameCursor:r}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))},setWebglContextLost(t){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:t}}))},recordPlaybackDiagnosticEvent(t){e(e=>{let r=e.playback.streamSnapshot,i={t:Date.now(),kind:t.kind,message:t.message,playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:r?.entities.length??0,streamCameraMode:r?.camera?.mode??null,streamExhausted:r?.exhausted??!1,meta:t.meta},s=[...e.diagnostics.playbackEvents,i],n=e.diagnostics.maxPlaybackEvents,a=s.length>n?s.slice(s.length-n):s;return{...e,diagnostics:{...e.diagnostics,playbackEvents:a}}})},appendRendererSample(t){e(e=>{let r=e.playback.streamSnapshot,i={t:t.t??Date.now(),playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:r?.entities.length??0,streamCameraMode:r?.camera?.mode??null,streamExhausted:r?.exhausted??!1,geometries:t.geometries,textures:t.textures,programs:t.programs,renderCalls:t.renderCalls,renderTriangles:t.renderTriangles,renderPoints:t.renderPoints,renderLines:t.renderLines,sceneObjects:t.sceneObjects,visibleSceneObjects:t.visibleSceneObjects,jsHeapUsed:t.jsHeapUsed,jsHeapTotal:t.jsHeapTotal,jsHeapLimit:t.jsHeapLimit},s=[...e.diagnostics.rendererSamples,i],n=e.diagnostics.maxRendererSamples,a=s.length>n?s.slice(s.length-n):s;return{...e,diagnostics:{...e.diagnostics,rendererSamples:a}}})},clearPlaybackDiagnostics(){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[],rendererSamples:[]}}))}})));function h(){return d}function f(e,t){return(0,s.useStoreWithEqualityFn)(d,e,t)}function p(e){let r,i,s,n=(0,t.c)(7),a=f(m);n[0]!==e?(r=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,n[0]=e,n[1]=r):r=n[1];let o=f(r);if(null==e||!a||-1===o)return;n[2]!==e||n[3]!==a.state.objectsById?(i=a.state.objectsById.get(e),n[2]=e,n[3]=a.state.objectsById,n[4]=i):i=n[4];let l=i;return n[5]!==l?(s=l?{...l}:void 0,n[5]=l,n[6]=s):s=n[6],s}function m(e){return e.runtime.runtime}function y(e){let r,i,s,n,a,l=(0,t.c)(11),u=f(g);l[0]!==e?(r=e?o(e):"",l[0]=e,l[1]=r):r=l[1];let c=r;l[2]!==c?(i=e=>c?e.runtime.objectIdsByName[c]:void 0,l[2]=c,l[3]=i):i=l[3];let d=f(i);l[4]!==d?(s=e=>null==d?-1:e.runtime.objectVersionById[d]??-1,l[4]=d,l[5]=s):s=l[5];let h=f(s);if(!u||!c||null==d||-1===h)return;l[6]!==d||l[7]!==u.state.objectsById?(n=u.state.objectsById.get(d),l[6]=d,l[7]=u.state.objectsById,l[8]=n):n=l[8];let p=n;return l[9]!==p?(a=p?{...p}:void 0,l[9]=p,l[10]=a):a=l[10],a}function g(e){return e.runtime.runtime}function b(e){let r,i,s,n,a,l=(0,t.c)(11),u=f(v);l[0]!==e?(r=e?o(e):"",l[0]=e,l[1]=r):r=l[1];let c=r;l[2]!==c?(i=e=>c?e.runtime.datablockIdsByName[c]:void 0,l[2]=c,l[3]=i):i=l[3];let d=f(i);l[4]!==d?(s=e=>null==d?-1:e.runtime.objectVersionById[d]??-1,l[4]=d,l[5]=s):s=l[5];let h=f(s);if(!u||!c||null==d||-1===h)return;l[6]!==d||l[7]!==u.state.objectsById?(n=u.state.objectsById.get(d),l[6]=d,l[7]=u.state.objectsById,l[8]=n):n=l[8];let p=n;return l[9]!==p?(a=p?{...p}:void 0,l[9]=p,l[10]=a):a=l[10],a}function v(e){return e.runtime.runtime}function S(e,r){let i,s,n,a,o=(0,t.c)(13);o[0]!==r?(i=void 0===r?[]:r,o[0]=r,o[1]=i):i=o[1];let l=i,u=f(k);o[2]!==e?(s=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,o[2]=e,o[3]=s):s=o[3];let c=f(s);if(null==e){let e;return o[4]!==l?(e=l.map(R),o[4]=l,o[5]=e):e=o[5],e}if(!u||-1===c){let e;return o[6]!==l?(e=l.map(E),o[6]=l,o[7]=e):e=o[7],e}let d=u.state.objectsById;if(o[8]!==e||o[9]!==u.state.objectsById){a=Symbol.for("react.early_return_sentinel");e:{let t=d.get(e);if(!t?._children){let e;o[12]===Symbol.for("react.memo_cache_sentinel")?(e=[],o[12]=e):e=o[12],a=e;break e}n=t._children.map(x)}o[8]=e,o[9]=u.state.objectsById,o[10]=n,o[11]=a}else n=o[10],a=o[11];return a!==Symbol.for("react.early_return_sentinel")?a:n}function x(e){return e._id}function E(e){return e._id}function R(e){return e._id}function k(e){return e.runtime.runtime}e.s(["engineStore",0,d,"useDatablockByName",()=>b,"useEngineSelector",()=>f,"useEngineStoreApi",()=>h,"useRuntimeChildIds",()=>S,"useRuntimeObjectById",()=>p,"useRuntimeObjectByName",()=>y],58647);let O={maxRuntimeEvents:80,maxPlaybackEvents:200,maxRendererSamples:1200,maxStreamEntities:40};function C(e){return e&&"object"==typeof e?{kind:"TorqueObject",id:"number"==typeof e._id?e._id:null,className:"string"==typeof e._className?e._className:null,class:"string"==typeof e._class?e._class:null,name:"string"==typeof e._name?e._name:null,isDatablock:!!e._isDatablock,parentId:e._parent&&"number"==typeof e._parent._id?e._parent._id:null,childCount:Array.isArray(e._children)?e._children.length:0}:null}function T(e,t={}){let r,i,s,n={...O,...t},a=(r=new WeakSet,function e(t,i=0){if(null==t)return t;let s=typeof t;if("string"===s||"number"===s||"boolean"===s)return t;if("bigint"===s)return t.toString();if("function"===s)return`[Function ${t.name||"anonymous"}]`;if("object"!==s)return String(t);if("_id"in t&&"_className"in t)return C(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){if(i>=2)return{kind:"Array",length:t.length};let r=t.slice(0,8).map(t=>e(t,i+1));return{kind:"Array",length:t.length,sample:r}}if(r.has(t))return"[Circular]";if(r.add(t),i>=2)return{kind:t?.constructor?.name??"Object"};let n=Object.keys(t).slice(0,12),a={};for(let r of n)try{a[r]=e(t[r],i+1)}catch(e){a[r]=`[Unserializable: ${e.message}]`}return Object.keys(t).length>n.length&&(a.__truncatedKeys=Object.keys(t).length-n.length),a}),o=e.diagnostics.recentEvents.slice(-n.maxRuntimeEvents).map(e=>(function(e,t){if("object.created"===e.type||"object.deleted"===e.type)return{type:e.type,objectId:e.objectId,object:C(e.object)};if("field.changed"===e.type)return{type:e.type,objectId:e.objectId,field:e.field,value:t(e.value),previousValue:t(e.previousValue),object:C(e.object)};if("method.called"===e.type)return{type:e.type,className:e.className,methodName:e.methodName,objectId:e.objectId??null,args:t(e.args)};if("global.changed"===e.type)return{type:e.type,name:e.name,value:t(e.value),previousValue:t(e.previousValue)};if("batch.flushed"===e.type){let t={};for(let r of e.events)t[r.type]=(t[r.type]??0)+1;return{type:e.type,tick:e.tick,eventCount:e.events.length,byType:t}}return{type:"unknown"}})(e,a)),l=e.diagnostics.playbackEvents.slice(-n.maxPlaybackEvents).map(e=>({...e,meta:e.meta?a(e.meta):void 0})),u=e.diagnostics.rendererSamples.slice(-n.maxRendererSamples);return{generatedAt:new Date().toISOString(),playback:{status:e.playback.status,timeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,rate:e.playback.rate,durationMs:e.playback.durationMs,recording:(i=e.playback.recording)?{duration:i.duration,missionName:i.missionName,gameType:i.gameType,hasStreamingPlayback:!!i.streamingPlayback}:null,streamSnapshot:function(e,t){let r=e.playback.streamSnapshot;if(!r)return null;let i={},s={};for(let e of r.entities){let t=e.type||"Unknown";i[t]=(i[t]??0)+1,e.visual?.kind&&(s[e.visual.kind]=(s[e.visual.kind]??0)+1)}let n=r.entities.slice(0,t).map(e=>({id:e.id,type:e.type,dataBlock:e.dataBlock??null,className:e.className??null,ghostIndex:e.ghostIndex??null,dataBlockId:e.dataBlockId??null,shapeHint:e.shapeHint??null,visualKind:e.visual?.kind??null,hasPosition:!!e.position,hasRotation:!!e.rotation}));return{timeSec:r.timeSec,exhausted:r.exhausted,cameraMode:r.camera?.mode??null,controlEntityId:r.camera?.controlEntityId??null,orbitTargetId:r.camera?.orbitTargetId??null,controlPlayerGhostId:r.controlPlayerGhostId??null,entityCount:r.entities.length,entitiesByType:i,visualsByKind:s,entitySample:n,status:r.status}}(e,n.maxStreamEntities)},runtime:(s=e.runtime.runtime)?{lastRuntimeTick:e.runtime.lastRuntimeTick,objectCount:s.state.objectsById.size,datablockCount:s.state.datablocks.size,globalCount:s.state.globals.size,activePackageCount:s.state.activePackages.length,executedScriptCount:s.state.executedScripts.size,failedScriptCount:s.state.failedScripts.size}:null,diagnostics:{webglContextLost:e.diagnostics.webglContextLost,eventCounts:e.diagnostics.eventCounts,playbackEventCount:e.diagnostics.playbackEvents.length,rendererSampleCount:e.diagnostics.rendererSamples.length,runtimeEventCount:e.diagnostics.recentEvents.length,playbackEventsByKind:function(e){let t={};for(let r of e)t[r.kind]=(t[r.kind]??0)+1;return t}(e.diagnostics.playbackEvents),rendererTrend:function(e){if(e.length<2)return null;let t=e[0],r=e[e.length-1];return{sampleCount:e.length,durationSec:Number(((r.t-t.t)/1e3).toFixed(3)),geometriesDelta:r.geometries-t.geometries,texturesDelta:r.textures-t.textures,programsDelta:r.programs-t.programs,sceneObjectsDelta:r.sceneObjects-t.sceneObjects,visibleSceneObjectsDelta:r.visibleSceneObjects-t.visibleSceneObjects,renderCallsDelta:r.renderCalls-t.renderCalls}}(u),playbackEvents:l,rendererSamples:u,runtimeEvents:o}}}function F(e,t={}){return JSON.stringify(T(e,t),null,2)}e.s(["buildSerializableDiagnosticsJson",()=>F,"buildSerializableDiagnosticsSnapshot",()=>T],30064),e.s([],13876)},19273,80166,e=>{"use strict";e.i(47167);var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},r=new class{#e=t;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function i(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",()=>i,"timeoutManager",()=>r],80166);var s="u"=0&&e!==1/0}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e?e(t):e}function d(e,t){let{type:r="all",exact:i,fetchStatus:s,predicate:n,queryKey:a,stale:o}=e;if(a){if(i){if(t.queryHash!==f(a,t.options))return!1}else if(!m(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!s||s===t.state.fetchStatus)&&(!n||!!n(t))}function h(e,t){let{exact:r,status:i,predicate:s,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(r){if(p(t.options.mutationKey)!==p(n))return!1}else if(!m(t.options.mutationKey,n))return!1}return(!i||t.state.status===i)&&(!s||!!s(t))}function f(e,t){return(t?.queryKeyHashFn||p)(e)}function p(e){return JSON.stringify(e,(e,t)=>v(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function m(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>m(e[r],t[r]))}var y=Object.prototype.hasOwnProperty;function g(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function v(e){if(!S(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!S(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function S(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e){return new Promise(t=>{r.setTimeout(t,e)})}function E(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r,i=0){if(t===r)return t;if(i>500)return r;let s=b(t)&&b(r);if(!s&&!(v(t)&&v(r)))return r;let n=(s?t:Object.keys(t)).length,a=s?r:Object.keys(r),o=a.length,l=s?Array(o):{},u=0;for(let c=0;cr?i.slice(1):i}function k(e,t,r=0){let i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var O=Symbol();function C(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==O?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function T(e,t){return"function"==typeof e?e(...t):!!e}function F(e,t,r){let i,s=!1;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),s||(s=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),e}e.s(["addConsumeAwareSignal",()=>F,"addToEnd",()=>R,"addToStart",()=>k,"ensureQueryFn",()=>C,"functionalUpdate",()=>a,"hashKey",()=>p,"hashQueryKeyByOptions",()=>f,"isServer",()=>s,"isValidTimeout",()=>o,"matchMutation",()=>h,"matchQuery",()=>d,"noop",()=>n,"partialMatchKey",()=>m,"replaceData",()=>E,"resolveEnabled",()=>c,"resolveStaleTime",()=>u,"shallowEqualObjects",()=>g,"shouldThrowError",()=>T,"skipToken",()=>O,"sleep",()=>x,"timeUntilStale",()=>l],19273)},40143,e=>{"use strict";let t,r,i,s,n,a;var o=e.i(80166).systemSetTimeoutZero,l=(t=[],r=0,i=e=>{e()},s=e=>{e()},n=o,{batch:e=>{let a;r++;try{a=e()}finally{let e;--r||(e=t,t=[],e.length&&n(()=>{s(()=>{e.forEach(e=>{i(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{r?t.push(e):n(()=>{i(e)})},setNotifyFunction:e=>{i=e},setBatchNotifyFunction:e=>{s=e},setScheduler:e=>{n=e}});e.s(["notifyManager",()=>l])},15823,e=>{"use strict";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",()=>t])},75555,e=>{"use strict";var t=e.i(15823),r=e.i(19273),i=new class extends t.Subscribable{#r;#i;#s;constructor(){super(),this.#s=e=>{if(!r.isServer&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",()=>i])},86491,14448,93803,36553,88587,e=>{"use strict";e.i(47167);var t=e.i(19273),r=e.i(40143),i=e.i(75555),s=e.i(15823),n=new class extends s.Subscribable{#n=!0;#i;#s;constructor(){super(),this.#s=e=>{if(!t.isServer&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function a(){let e,t,r=new Promise((r,i)=>{e=r,t=i});function i(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},r.reject=e=>{i({status:"rejected",reason:e}),t(e)},r}function o(e){return Math.min(1e3*2**e,3e4)}function l(e){return(e??"online")!=="online"||n.isOnline()}e.s(["onlineManager",()=>n],14448),e.s(["pendingThenable",()=>a],93803);var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function c(e){let r,s=!1,c=0,d=a(),h=()=>i.focusManager.isFocused()&&("always"===e.networkMode||n.isOnline())&&e.canRun(),f=()=>l(e.networkMode)&&e.canRun(),p=e=>{"pending"===d.status&&(r?.(),d.resolve(e))},m=e=>{"pending"===d.status&&(r?.(),d.reject(e))},y=()=>new Promise(t=>{r=e=>{("pending"!==d.status||h())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,"pending"===d.status&&e.onContinue?.()}),g=()=>{let r;if("pending"!==d.status)return;let i=0===c?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(p).catch(r=>{if("pending"!==d.status)return;let i=e.retry??3*!t.isServer,n=e.retryDelay??o,a="function"==typeof n?n(c,r):n,l=!0===i||"number"==typeof i&&ch()?void 0:y()).then(()=>{s?m(r):g()}))})};return{promise:d,status:()=>d.status,cancel:t=>{if("pending"===d.status){let r=new u(t);m(r),e.onCancel?.(r)}},continue:()=>(r?.(),d),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:f,start:()=>(f()?g():y().then(g),d)}}e.s(["CancelledError",()=>u,"canFetch",()=>l,"createRetryer",()=>c],36553);var d=e.i(80166),h=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,t.isValidTimeout)(this.gcTime)&&(this.#a=d.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(t.isServer?1/0:3e5))}clearGcTimeout(){this.#a&&(d.timeoutManager.clearTimeout(this.#a),this.#a=void 0)}};e.s(["Removable",()=>h],88587);var f=class extends h{#o;#l;#u;#c;#d;#h;#f;constructor(e){super(),this.#f=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=y(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=y(this.options);void 0!==e.data&&(this.setState(m(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,r){let i=(0,t.replaceData)(this.state.data,e,this.options);return this.#p({data:i,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),i}setState(e,t){this.#p({type:"setState",state:e,setStateOptions:t})}cancel(e){let r=this.#d?.promise;return this.#d?.cancel(e),r?r.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(e=>!1!==(0,t.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t.skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,t.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#f?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(e,r){let i;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let s=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,s.signal)})},a=()=>{let e,i=(0,t.ensureQueryFn)(this.options,r),s=(n(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#f=!1,this.options.persister)?this.options.persister(i,s,this):i(s)},o=(n(i={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),i);this.options.behavior?.onFetch(o,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#p({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=c({initialPromise:r?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof u&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),s.abort()},onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof u){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#p({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#p(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...p(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...m(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":let i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),r.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function p(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:l(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function m(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function y(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,i=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}e.s(["Query",()=>f,"fetchState",()=>p],86491)},12598,e=>{"use strict";var t=e.i(71645),r=e.i(43476),i=t.createContext(void 0),s=e=>{let r=t.useContext(i);if(e)return e;if(!r)throw Error("No QueryClient set, use QueryClientProvider to set one");return r},n=({client:e,children:s})=>(t.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,r.jsx)(i.Provider,{value:e,children:s}));e.s(["QueryClientProvider",()=>n,"useQueryClient",()=>s])},69230,e=>{"use strict";var t=e.i(75555),r=e.i(40143),i=e.i(86491),s=e.i(15823),n=e.i(93803),a=e.i(19273),o=e.i(80166),l=class extends s.Subscribable{constructor(e,t){super(),this.options=t,this.#c=e,this.#m=null,this.#y=(0,n.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#b=void 0;#v=void 0;#S;#x;#y;#m;#E;#R;#k;#O;#C;#T;#F=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),u(this.#g,this.options)?this.#I():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return c(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return c(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#j(),this.#g.removeObserver(this)}setOptions(e){let t=this.options,r=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,a.resolveEnabled)(this.options.enabled,this.#g))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#g.setOptions(this.options),t._defaulted&&!(0,a.shallowEqualObjects)(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});let i=this.hasListeners();i&&d(this.#g,r,this.options,t)&&this.#I(),this.updateResult(),i&&(this.#g!==r||(0,a.resolveEnabled)(this.options.enabled,this.#g)!==(0,a.resolveEnabled)(t.enabled,this.#g)||(0,a.resolveStaleTime)(this.options.staleTime,this.#g)!==(0,a.resolveStaleTime)(t.staleTime,this.#g))&&this.#P();let s=this.#D();i&&(this.#g!==r||(0,a.resolveEnabled)(this.options.enabled,this.#g)!==(0,a.resolveEnabled)(t.enabled,this.#g)||s!==this.#T)&&this.#U(s)}getOptimisticResult(e){var t,r;let i=this.#c.getQueryCache().build(this.#c,e),s=this.createResult(i,e);return t=this,r=s,(0,a.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#v=s,this.#x=this.options,this.#S=this.#g.state),s}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#y.status||this.#y.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#F.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#I({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#I(e){this.#_();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(a.noop)),t}#P(){this.#M();let e=(0,a.resolveStaleTime)(this.options.staleTime,this.#g);if(a.isServer||this.#v.isStale||!(0,a.isValidTimeout)(e))return;let t=(0,a.timeUntilStale)(this.#v.dataUpdatedAt,e);this.#O=o.timeoutManager.setTimeout(()=>{this.#v.isStale||this.updateResult()},t+1)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#U(e){this.#j(),this.#T=e,!a.isServer&&!1!==(0,a.resolveEnabled)(this.options.enabled,this.#g)&&(0,a.isValidTimeout)(this.#T)&&0!==this.#T&&(this.#C=o.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||t.focusManager.isFocused())&&this.#I()},this.#T))}#w(){this.#P(),this.#U(this.#D())}#M(){this.#O&&(o.timeoutManager.clearTimeout(this.#O),this.#O=void 0)}#j(){this.#C&&(o.timeoutManager.clearInterval(this.#C),this.#C=void 0)}createResult(e,t){let r,s=this.#g,o=this.options,l=this.#v,c=this.#S,f=this.#x,p=e!==s?e.state:this.#b,{state:m}=e,y={...m},g=!1;if(t._optimisticResults){let r=this.hasListeners(),n=!r&&u(e,t),a=r&&d(e,s,t,o);(n||a)&&(y={...y,...(0,i.fetchState)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(y.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:S}=y;r=y.data;let x=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===S){let e;l?.isPlaceholderData&&t.placeholderData===f?.placeholderData?(e=l.data,x=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#k?.state.data,this.#k):t.placeholderData,void 0!==e&&(S="success",r=(0,a.replaceData)(l?.data,e,t),g=!0)}if(t.select&&void 0!==r&&!x)if(l&&r===c?.data&&t.select===this.#E)r=this.#R;else try{this.#E=t.select,r=t.select(r),r=(0,a.replaceData)(l?.data,r,t),this.#R=r,this.#m=null}catch(e){this.#m=e}this.#m&&(b=this.#m,r=this.#R,v=Date.now(),S="error");let E="fetching"===y.fetchStatus,R="pending"===S,k="error"===S,O=R&&E,C=void 0!==r,T={status:S,fetchStatus:y.fetchStatus,isPending:R,isSuccess:"success"===S,isError:k,isInitialLoading:O,isLoading:O,data:r,dataUpdatedAt:y.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:E,isRefetching:E&&!R,isLoadingError:k&&!C,isPaused:"paused"===y.fetchStatus,isPlaceholderData:g,isRefetchError:k&&C,isStale:h(e,t),refetch:this.refetch,promise:this.#y,isEnabled:!1!==(0,a.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,r="error"===T.status&&!t,i=e=>{r?e.reject(T.error):t&&e.resolve(T.data)},a=()=>{i(this.#y=T.promise=(0,n.pendingThenable)())},o=this.#y;switch(o.status){case"pending":e.queryHash===s.queryHash&&i(o);break;case"fulfilled":(r||T.data!==o.value)&&a();break;case"rejected":r&&T.error===o.reason||a()}}return T}updateResult(){let e=this.#v,t=this.createResult(this.#g,this.options);if(this.#S=this.#g.state,this.#x=this.options,void 0!==this.#S.data&&(this.#k=this.#g),(0,a.shallowEqualObjects)(t,e))return;this.#v=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#F.size)return!0;let i=new Set(r??this.#F);return this.options.throwOnError&&i.add("error"),Object.keys(this.#v).some(t=>this.#v[t]!==e[t]&&i.has(t))};this.#L({listeners:r()})}#_(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;let t=this.#g;this.#g=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#w()}#L(e){r.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function u(e,t){return!1!==(0,a.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&c(e,t,t.refetchOnMount)}function c(e,t,r){if(!1!==(0,a.resolveEnabled)(t.enabled,e)&&"static"!==(0,a.resolveStaleTime)(t.staleTime,e)){let i="function"==typeof r?r(e):r;return"always"===i||!1!==i&&h(e,t)}return!1}function d(e,t,r,i){return(e!==t||!1===(0,a.resolveEnabled)(i.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&h(e,r)}function h(e,t){return!1!==(0,a.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,a.resolveStaleTime)(t.staleTime,e))}e.s(["QueryObserver",()=>l])},69637,54440,e=>{"use strict";let t;e.i(47167);var r=e.i(71645),i=e.i(19273),s=e.i(40143),n=e.i(12598);e.i(43476);var a=r.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),o=r.createContext(!1);o.Provider;var l=(e,t)=>void 0===t.state.data,u=e=>{if(e.suspense){let t=e=>"static"===e?e:Math.max(e??1e3,1e3),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>t(r(...e)):t(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3))}},c=(e,t)=>e.isLoading&&e.isFetching&&!t,d=(e,t)=>e?.suspense&&t.isPending,h=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function f(e,t,l){let f,p=r.useContext(o),m=r.useContext(a),y=(0,n.useQueryClient)(l),g=y.defaultQueryOptions(e);y.getDefaultOptions().queries?._experimental_beforeQuery?.(g);let b=y.getQueryCache().get(g.queryHash);g._optimisticResults=p?"isRestoring":"optimistic",u(g),f=b?.state.error&&"function"==typeof g.throwOnError?(0,i.shouldThrowError)(g.throwOnError,[b.state.error,b]):g.throwOnError,(g.suspense||g.experimental_prefetchInRender||f)&&!m.isReset()&&(g.retryOnMount=!1),r.useEffect(()=>{m.clearReset()},[m]);let v=!y.getQueryCache().get(g.queryHash),[S]=r.useState(()=>new t(y,g)),x=S.getOptimisticResult(g),E=!p&&!1!==e.subscribed;if(r.useSyncExternalStore(r.useCallback(e=>{let t=E?S.subscribe(s.notifyManager.batchCalls(e)):i.noop;return S.updateResult(),t},[S,E]),()=>S.getCurrentResult(),()=>S.getCurrentResult()),r.useEffect(()=>{S.setOptions(g)},[g,S]),d(g,x))throw h(g,S,m);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(n&&void 0===e.data||(0,i.shouldThrowError)(r,[e.error,s])))({result:x,errorResetBoundary:m,throwOnError:g.throwOnError,query:b,suspense:g.suspense}))throw x.error;if(y.getDefaultOptions().queries?._experimental_afterQuery?.(g,x),g.experimental_prefetchInRender&&!i.isServer&&c(x,p)){let e=v?h(g,S,m):b?.promise;e?.catch(i.noop).finally(()=>{S.updateResult()})}return g.notifyOnChangeProps?x:S.trackResult(x)}e.s(["defaultThrowOnError",()=>l,"ensureSuspenseTimers",()=>u,"fetchOptimistic",()=>h,"shouldSuspend",()=>d,"willFetch",()=>c],54440),e.s(["useBaseQuery",()=>f],69637)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/b00acbf8afd8b4b6.js b/docs/_next/static/chunks/b00acbf8afd8b4b6.js new file mode 100644 index 00000000..69c0d1e3 --- /dev/null +++ b/docs/_next/static/chunks/b00acbf8afd8b4b6.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,99140,e=>{e.v({AnimationItem:"page-module__v6zvCa__AnimationItem",AnimationList:"page-module__v6zvCa__AnimationList",AnimationName:"page-module__v6zvCa__AnimationName",CanvasContainer:"page-module__v6zvCa__CanvasContainer",CheckboxField:"page-module__v6zvCa__CheckboxField",ClipName:"page-module__v6zvCa__ClipName",CyclicIcon:"page-module__v6zvCa__CyclicIcon",LoadingIndicator:"page-module__v6zvCa__LoadingIndicator",PlayButton:"page-module__v6zvCa__PlayButton",SectionLabel:"page-module__v6zvCa__SectionLabel",Sidebar:"page-module__v6zvCa__Sidebar",SidebarSection:"page-module__v6zvCa__SidebarSection",Spinner:"page-module__v6zvCa__Spinner",loadingComplete:"page-module__v6zvCa__loadingComplete",spin:"page-module__v6zvCa__spin"})},39724,e=>{"use strict";var t,n=e.i(43476),a=e.i(932),o=e.i(71645),r=e.i(75056),i=e.i(90072),s=e.i(17751),c=e.i(12598),l=e.i(31067),u=e.i(15080),m=e.i(71753),p=e.i(85413),d=Object.defineProperty,h=(e,t,n)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?d(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,n};let f=new i.Ray,b=new i.Plane,g=Math.cos(Math.PI/180*70),v=(e,t)=>(e%t+t)%t;class y extends p.EventDispatcher{constructor(e,t){super(),h(this,"object"),h(this,"domElement"),h(this,"enabled",!0),h(this,"target",new i.Vector3),h(this,"minDistance",0),h(this,"maxDistance",1/0),h(this,"minZoom",0),h(this,"maxZoom",1/0),h(this,"minPolarAngle",0),h(this,"maxPolarAngle",Math.PI),h(this,"minAzimuthAngle",-1/0),h(this,"maxAzimuthAngle",1/0),h(this,"enableDamping",!1),h(this,"dampingFactor",.05),h(this,"enableZoom",!0),h(this,"zoomSpeed",1),h(this,"enableRotate",!0),h(this,"rotateSpeed",1),h(this,"enablePan",!0),h(this,"panSpeed",1),h(this,"screenSpacePanning",!0),h(this,"keyPanSpeed",7),h(this,"zoomToCursor",!1),h(this,"autoRotate",!1),h(this,"autoRotateSpeed",2),h(this,"reverseOrbit",!1),h(this,"reverseHorizontalOrbit",!1),h(this,"reverseVerticalOrbit",!1),h(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),h(this,"mouseButtons",{LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN}),h(this,"touches",{ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN}),h(this,"target0"),h(this,"position0"),h(this,"zoom0"),h(this,"_domElementKeyEvents",null),h(this,"getPolarAngle"),h(this,"getAzimuthalAngle"),h(this,"setPolarAngle"),h(this,"setAzimuthalAngle"),h(this,"getDistance"),h(this,"getZoomScale"),h(this,"listenToKeyEvents"),h(this,"stopListenToKeyEvents"),h(this,"saveState"),h(this,"reset"),h(this,"update"),h(this,"connect"),h(this,"dispose"),h(this,"dollyIn"),h(this,"dollyOut"),h(this,"getScale"),h(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=e=>{let t=v(e,2*Math.PI),a=u.phi;a<0&&(a+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-a);2*Math.PI-o{let t=v(e,2*Math.PI),a=u.theta;a<0&&(a+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-a);2*Math.PI-on.object.position.distanceTo(n.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",ee),this._domElementKeyEvents=e},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ee),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(a),n.update(),c=s.NONE},this.update=(()=>{let t=new i.Vector3,o=new i.Vector3(0,1,0),r=new i.Quaternion().setFromUnitVectors(e.up,o),h=r.clone().invert(),v=new i.Vector3,y=new i.Quaternion,x=2*Math.PI;return function(){let E=n.object.position;r.setFromUnitVectors(e.up,o),h.copy(r).invert(),t.copy(E).sub(n.target),t.applyQuaternion(r),u.setFromVector3(t),n.autoRotate&&c===s.NONE&&R(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(u.theta+=m.theta*n.dampingFactor,u.phi+=m.phi*n.dampingFactor):(u.theta+=m.theta,u.phi+=m.phi);let S=n.minAzimuthAngle,j=n.maxAzimuthAngle;isFinite(S)&&isFinite(j)&&(S<-Math.PI?S+=x:S>Math.PI&&(S-=x),j<-Math.PI?j+=x:j>Math.PI&&(j-=x),S<=j?u.theta=Math.max(S,Math.min(j,u.theta)):u.theta=u.theta>(S+j)/2?Math.max(S,u.theta):Math.min(j,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(d,n.dampingFactor):n.target.add(d),n.zoomToCursor&&A||n.object.isOrthographicCamera?u.radius=U(u.radius):u.radius=U(u.radius*p),t.setFromSpherical(u),t.applyQuaternion(h),E.copy(n.target).add(t),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),!0===n.enableDamping?(m.theta*=1-n.dampingFactor,m.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(m.set(0,0,0),d.set(0,0,0));let C=!1;if(n.zoomToCursor&&A){let a=null;if(n.object instanceof i.PerspectiveCamera&&n.object.isPerspectiveCamera){let e=t.length();a=U(e*p);let o=e-a;n.object.position.addScaledVector(w,o),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let e=new i.Vector3(N.x,N.y,0);e.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),C=!0;let o=new i.Vector3(N.x,N.y,0);o.unproject(n.object),n.object.position.sub(o).add(e),n.object.updateMatrixWorld(),a=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==a&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(a).add(n.object.position):(f.origin.copy(n.object.position),f.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(f.direction))l||8*(1-y.dot(n.object.quaternion))>l)&&(n.dispatchEvent(a),v.copy(n.object.position),y.copy(n.object.quaternion),C=!1,!0)}})(),this.connect=e=>{n.domElement=e,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",et),n.domElement.addEventListener("pointerdown",G),n.domElement.addEventListener("pointercancel",$),n.domElement.addEventListener("wheel",J)},this.dispose=()=>{var e,t,a,o,r,i;n.domElement&&(n.domElement.style.touchAction="auto"),null==(e=n.domElement)||e.removeEventListener("contextmenu",et),null==(t=n.domElement)||t.removeEventListener("pointerdown",G),null==(a=n.domElement)||a.removeEventListener("pointercancel",$),null==(o=n.domElement)||o.removeEventListener("wheel",J),null==(r=n.domElement)||r.ownerDocument.removeEventListener("pointermove",Q),null==(i=n.domElement)||i.ownerDocument.removeEventListener("pointerup",$),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",ee)};const n=this,a={type:"change"},o={type:"start"},r={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=s.NONE;const l=1e-6,u=new i.Spherical,m=new i.Spherical;let p=1;const d=new i.Vector3,y=new i.Vector2,x=new i.Vector2,E=new i.Vector2,S=new i.Vector2,j=new i.Vector2,C=new i.Vector2,P=new i.Vector2,T=new i.Vector2,_=new i.Vector2,w=new i.Vector3,N=new i.Vector2;let A=!1;const O=[],M={};function L(){return Math.pow(.95,n.zoomSpeed)}function R(e){n.reverseOrbit||n.reverseHorizontalOrbit?m.theta+=e:m.theta-=e}function z(e){n.reverseOrbit||n.reverseVerticalOrbit?m.phi+=e:m.phi-=e}const I=(()=>{let e=new i.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),d.add(e)}})(),k=(()=>{let e=new i.Vector3;return function(t,a){!0===n.screenSpacePanning?e.setFromMatrixColumn(a,1):(e.setFromMatrixColumn(a,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),d.add(e)}})(),V=(()=>{let e=new i.Vector3;return function(t,a){let o=n.domElement;if(o&&n.object instanceof i.PerspectiveCamera&&n.object.isPerspectiveCamera){let r=n.object.position;e.copy(r).sub(n.target);let i=e.length();I(2*t*(i*=Math.tan(n.object.fov/2*Math.PI/180))/o.clientHeight,n.object.matrix),k(2*a*i/o.clientHeight,n.object.matrix)}else o&&n.object instanceof i.OrthographicCamera&&n.object.isOrthographicCamera?(I(t*(n.object.right-n.object.left)/n.object.zoom/o.clientWidth,n.object.matrix),k(a*(n.object.top-n.object.bottom)/n.object.zoom/o.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function D(e){n.object instanceof i.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof i.OrthographicCamera&&n.object.isOrthographicCamera?p=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function F(e){if(!n.zoomToCursor||!n.domElement)return;A=!0;let t=n.domElement.getBoundingClientRect(),a=e.clientX-t.left,o=e.clientY-t.top,r=t.width,i=t.height;N.x=a/r*2-1,N.y=-(o/i*2)+1,w.set(N.x,N.y,1).unproject(n.object).sub(n.object.position).normalize()}function U(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function Y(e){y.set(e.clientX,e.clientY)}function H(e){S.set(e.clientX,e.clientY)}function Z(){if(1==O.length)y.set(O[0].pageX,O[0].pageY);else{let e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);y.set(e,t)}}function B(){if(1==O.length)S.set(O[0].pageX,O[0].pageY);else{let e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);S.set(e,t)}}function K(){let e=O[0].pageX-O[1].pageX,t=O[0].pageY-O[1].pageY,n=Math.sqrt(e*e+t*t);P.set(0,n)}function X(e){if(1==O.length)x.set(e.pageX,e.pageY);else{let t=ea(e),n=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);x.set(n,a)}E.subVectors(x,y).multiplyScalar(n.rotateSpeed);let t=n.domElement;t&&(R(2*Math.PI*E.x/t.clientHeight),z(2*Math.PI*E.y/t.clientHeight)),y.copy(x)}function W(e){if(1==O.length)j.set(e.pageX,e.pageY);else{let t=ea(e),n=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);j.set(n,a)}C.subVectors(j,S).multiplyScalar(n.panSpeed),V(C.x,C.y),S.copy(j)}function q(e){var t;let a=ea(e),o=e.pageX-a.x,r=e.pageY-a.y,i=Math.sqrt(o*o+r*r);T.set(0,i),_.set(0,Math.pow(T.y/P.y,n.zoomSpeed)),t=_.y,D(p/t),P.copy(T)}function G(e){var t,a,r;!1!==n.enabled&&(0===O.length&&(null==(t=n.domElement)||t.ownerDocument.addEventListener("pointermove",Q),null==(a=n.domElement)||a.ownerDocument.addEventListener("pointerup",$)),r=e,O.push(r),"touch"===e.pointerType?function(e){switch(en(e),O.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;Z(),c=s.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;B(),c=s.TOUCH_PAN;break;default:c=s.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&K(),n.enablePan&&B(),c=s.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&K(),n.enableRotate&&Z(),c=s.TOUCH_DOLLY_ROTATE;break;default:c=s.NONE}break;default:c=s.NONE}c!==s.NONE&&n.dispatchEvent(o)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===n.enableZoom)return;F(e),P.set(e.clientX,e.clientY),c=s.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;H(e),c=s.PAN}else{if(!1===n.enableRotate)return;Y(e),c=s.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;Y(e),c=s.ROTATE}else{if(!1===n.enablePan)return;H(e),c=s.PAN}break;default:c=s.NONE}c!==s.NONE&&n.dispatchEvent(o)}(e))}function Q(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(en(e),c){case s.TOUCH_ROTATE:if(!1===n.enableRotate)return;X(e),n.update();break;case s.TOUCH_PAN:if(!1===n.enablePan)return;W(e),n.update();break;case s.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&q(e),n.enablePan&&W(e),n.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&q(e),n.enableRotate&&X(e),n.update();break;default:c=s.NONE}}(e):function(e){if(!1!==n.enabled)switch(c){case s.ROTATE:let t;if(!1===n.enableRotate)return;x.set(e.clientX,e.clientY),E.subVectors(x,y).multiplyScalar(n.rotateSpeed),(t=n.domElement)&&(R(2*Math.PI*E.x/t.clientHeight),z(2*Math.PI*E.y/t.clientHeight)),y.copy(x),n.update();break;case s.DOLLY:var a,o;if(!1===n.enableZoom)return;(T.set(e.clientX,e.clientY),_.subVectors(T,P),_.y>0)?(a=L(),D(p/a)):_.y<0&&(o=L(),D(p*o)),P.copy(T),n.update();break;case s.PAN:if(!1===n.enablePan)return;j.set(e.clientX,e.clientY),C.subVectors(j,S).multiplyScalar(n.panSpeed),V(C.x,C.y),S.copy(j),n.update()}}(e))}function $(e){var t,a,o;(function(e){delete M[e.pointerId];for(let t=0;t0&&(a=L(),D(p/a)),n.update(),n.dispatchEvent(r)}}function ee(e){if(!1!==n.enabled&&!1!==n.enablePan){let t=!1;switch(e.code){case n.keys.UP:V(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}}function et(e){!1!==n.enabled&&e.preventDefault()}function en(e){let t=M[e.pointerId];void 0===t&&(t=new i.Vector2,M[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ea(e){return M[(e.pointerId===O[0].pointerId?O[1]:O[0]).pointerId]}this.dollyIn=(e=L())=>{D(p*e),n.update()},this.dollyOut=(e=L())=>{D(p/e),n.update()},this.getScale=()=>p,this.setScale=e=>{D(e),n.update()},this.getZoomScale=()=>L(),void 0!==t&&this.connect(t),this.update()}}let x=o.forwardRef(({makeDefault:e,camera:t,regress:n,domElement:a,enableDamping:r=!0,keyEvents:i=!1,onChange:s,onStart:c,onEnd:p,...d},h)=>{let f=(0,u.useThree)(e=>e.invalidate),b=(0,u.useThree)(e=>e.camera),g=(0,u.useThree)(e=>e.gl),v=(0,u.useThree)(e=>e.events),x=(0,u.useThree)(e=>e.setEvents),E=(0,u.useThree)(e=>e.set),S=(0,u.useThree)(e=>e.get),j=(0,u.useThree)(e=>e.performance),C=t||b,P=a||v.connected||g.domElement,T=o.useMemo(()=>new y(C),[C]);return(0,m.useFrame)(()=>{T.enabled&&T.update()},-1),o.useEffect(()=>(i&&T.connect(!0===i?P:i),T.connect(P),()=>void T.dispose()),[i,P,n,T,f]),o.useEffect(()=>{let e=e=>{f(),n&&j.regress(),s&&s(e)},t=e=>{c&&c(e)},a=e=>{p&&p(e)};return T.addEventListener("change",e),T.addEventListener("start",t),T.addEventListener("end",a),()=>{T.removeEventListener("start",t),T.removeEventListener("end",a),T.removeEventListener("change",e)}},[s,c,p,T,f,x]),o.useEffect(()=>{if(e){let e=S().controls;return E({controls:T}),()=>E({controls:e})}},[e,T]),o.createElement("primitive",(0,l.default)({ref:h,object:T,enableDamping:r},d))}),E=o.forwardRef(function({children:e,object:t,disable:n,disableX:a,disableY:r,disableZ:s,left:c,right:u,top:m,bottom:p,front:d,back:h,onCentered:f,precise:b=!0,cacheKey:g=0,...v},y){let x=o.useRef(null),E=o.useRef(null),S=o.useRef(null),[j]=o.useState(()=>new i.Box3),[C]=o.useState(()=>new i.Vector3),[P]=o.useState(()=>new i.Sphere);return o.useLayoutEffect(()=>{E.current.matrixWorld.identity(),j.setFromObject(null!=t?t:S.current,b);let e=j.max.x-j.min.x,o=j.max.y-j.min.y,i=j.max.z-j.min.z;j.getCenter(C),j.getBoundingSphere(P);let l=m?o/2:p?-o/2:0,g=c?-e/2:u?e/2:0,v=d?i/2:h?-i/2:0;E.current.position.set(n||a?0:-C.x+g,n||r?0:-C.y+l,n||s?0:-C.z+v),null==f||f({parent:x.current.parent,container:x.current,width:e,height:o,depth:i,boundingBox:j,boundingSphere:P,center:C,verticalAlignment:l,horizontalAlignment:g,depthAlignment:v})},[g,f,m,c,d,n,a,r,s,t,b,u,p,h,j,C,P]),o.useImperativeHandle(y,()=>x.current,[]),o.createElement("group",(0,l.default)({ref:x},v),o.createElement("group",{ref:E},o.createElement("group",{ref:S},e)))});var S=((t=S||{})[t.NONE=0]="NONE",t[t.START=1]="START",t[t.ACTIVE=2]="ACTIVE",t);let j=e=>1-Math.exp(-5*e)+.007*e,C=o.createContext(null);function P({children:e,maxDuration:t=1,margin:n=1.2,observe:a,fit:r,clip:s,interpolateFunc:c=j,onFit:l}){let p=o.useRef(null),{camera:d,size:h,invalidate:f}=(0,u.useThree)(),b=(0,u.useThree)(e=>e.controls),g=o.useRef(l);g.current=l;let v=o.useRef({camPos:new i.Vector3,camRot:new i.Quaternion,camZoom:1}),y=o.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),x=o.useRef(S.NONE),E=o.useRef(0),[P]=o.useState(()=>new i.Box3),T=o.useMemo(()=>{function e(){let e=P.getSize(new i.Vector3),t=P.getCenter(new i.Vector3),a=Math.max(e.x,e.y,e.z),o=d&&d.isOrthographicCamera?4*a:a/(2*Math.atan(Math.PI*d.fov/360)),r=d&&d.isOrthographicCamera?4*a:o/d.aspect;return{box:P,size:e,center:t,distance:n*Math.max(o,r)}}return{getSize:e,refresh(e){if(e&&e.isBox3)P.copy(e);else{let t=e||p.current;if(!t)return this;t.updateWorldMatrix(!0,!0),P.setFromObject(t)}if(P.isEmpty()){let e=d.position.length()||10;P.setFromCenterAndSize(new i.Vector3,new i.Vector3(e,e,e))}return v.current.camPos.copy(d.position),v.current.camRot.copy(d.quaternion),d&&d.isOrthographicCamera&&(v.current.camZoom=d.zoom),y.current.camPos=void 0,y.current.camRot=void 0,y.current.camZoom=void 0,y.current.camUp=void 0,y.current.target=void 0,this},reset(){let{center:t,distance:n}=e(),a=d.position.clone().sub(t).normalize();y.current.camPos=t.clone().addScaledVector(a,n),y.current.target=t.clone();let o=new i.Matrix4().lookAt(y.current.camPos,y.current.target,d.up);return y.current.camRot=new i.Quaternion().setFromRotationMatrix(o),x.current=S.START,E.current=0,this},moveTo(e){return y.current.camPos=Array.isArray(e)?new i.Vector3(...e):e.clone(),x.current=S.START,E.current=0,this},lookAt({target:e,up:t}){y.current.target=Array.isArray(e)?new i.Vector3(...e):e.clone(),t?y.current.camUp=Array.isArray(t)?new i.Vector3(...t):t.clone():y.current.camUp=d.up.clone();let n=new i.Matrix4().lookAt(y.current.camPos||d.position,y.current.target,y.current.camUp);return y.current.camRot=new i.Quaternion().setFromRotationMatrix(n),x.current=S.START,E.current=0,this},to({position:e,target:t}){return this.moveTo(e).lookAt({target:t})},fit(){if(!(d&&d.isOrthographicCamera))return this.reset();let e=0,t=0,a=[new i.Vector3(P.min.x,P.min.y,P.min.z),new i.Vector3(P.min.x,P.max.y,P.min.z),new i.Vector3(P.min.x,P.min.y,P.max.z),new i.Vector3(P.min.x,P.max.y,P.max.z),new i.Vector3(P.max.x,P.max.y,P.max.z),new i.Vector3(P.max.x,P.max.y,P.min.z),new i.Vector3(P.max.x,P.min.y,P.max.z),new i.Vector3(P.max.x,P.min.y,P.min.z)],o=y.current.camPos||d.position,r=y.current.target||(null==b?void 0:b.target),s=y.current.camUp||d.up,c=r?new i.Matrix4().lookAt(o,r,s).setPosition(o).invert():d.matrixWorldInverse;for(let n of a)n.applyMatrix4(c),e=Math.max(e,Math.abs(n.y)),t=Math.max(t,Math.abs(n.x));e*=2,t*=2;let l=(d.top-d.bottom)/e,u=(d.right-d.left)/t;return y.current.camZoom=Math.min(l,u)/n,x.current=S.START,E.current=0,g.current&&g.current(this.getSize()),this},clip(){let{distance:t}=e();return d.near=t/100,d.far=100*t,d.updateProjectionMatrix(),b&&(b.maxDistance=10*t,b.update()),f(),this}}},[P,d,b,n,f]);o.useLayoutEffect(()=>{if(b){let e=()=>{if(b&&y.current.target&&x.current!==S.NONE){let e=new i.Vector3().setFromMatrixColumn(d.matrix,2),t=v.current.camPos.distanceTo(b.target),n=(y.current.camPos||v.current.camPos).distanceTo(y.current.target),a=(1-E.current)*t+E.current*n;b.target.copy(d.position).addScaledVector(e,-a),b.update()}x.current=S.NONE};return b.addEventListener("start",e),()=>b.removeEventListener("start",e)}},[b]);let _=o.useRef(0);return o.useLayoutEffect(()=>{(a||0==_.current++)&&(T.refresh(),r&&T.reset().fit(),s&&T.clip())},[h,s,r,a,d,b]),(0,m.useFrame)((e,n)=>{if(x.current===S.START)x.current=S.ACTIVE,f();else if(x.current===S.ACTIVE){if(E.current+=n/t,E.current>=1)y.current.camPos&&d.position.copy(y.current.camPos),y.current.camRot&&d.quaternion.copy(y.current.camRot),y.current.camUp&&d.up.copy(y.current.camUp),y.current.camZoom&&d&&d.isOrthographicCamera&&(d.zoom=y.current.camZoom),d.updateMatrixWorld(),d.updateProjectionMatrix(),b&&y.current.target&&(b.target.copy(y.current.target),b.update()),x.current=S.NONE;else{let e=c(E.current);y.current.camPos&&d.position.lerpVectors(v.current.camPos,y.current.camPos,e),y.current.camRot&&d.quaternion.slerpQuaternions(v.current.camRot,y.current.camRot,e),y.current.camUp&&d.up.set(0,1,0).applyQuaternion(d.quaternion),y.current.camZoom&&d&&d.isOrthographicCamera&&(d.zoom=(1-e)*v.current.camZoom+e*y.current.camZoom),d.updateMatrixWorld(),d.updateProjectionMatrix()}f()}}),o.createElement("group",{ref:p},o.createElement(C.Provider,{value:T},e))}var T=e.i(79123),_=e.i(91907),w=e.i(25947),N=e.i(86855),A=e.i(51475),O=e.i(11889),M=e.i(56373),L=e.i(86447),R=e.i(1559),z=e.i(78440),I=e.i(59129),k=e.i(25998),V=e.i(18364),D=e.i(70238),F=e.i(91996),U=e.i(29402),Y=e.i(97442);let H={"shapes.vl2":"Shapes","TR2final105-client.vl2":"Team Rabbit 2"},Z=(0,F.getResourceList)().filter(e=>e.startsWith("shapes/")&&e.endsWith(".dts")).map(e=>{let[t,n]=(0,F.getSourceAndPath)(e),a=n.split("/").pop()??n,o=H[t]??(t||"Loose");return{resourceKey:e,displayName:a,shapeName:a,sourcePath:t,groupName:o}}),B=new Map(Z.map(e=>[e.shapeName,e])),K=function(e){let t=new Map;for(let n of e){let e=t.get(n.groupName)??[];e.push(n),t.set(n.groupName,e)}return t.forEach((e,n)=>{t.set(n,(0,U.default)(e,[e=>e.displayName.toLowerCase()],["asc"]))}),(0,U.default)(Array.from(t.entries()),[([e])=>+("Shapes"!==e),([e])=>e.toLowerCase()],["asc","asc"])}(Z),X="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function W(e){let t,r,i,s,c,l,u,m,p,d,h,f,b,g,v,y,x,E=(0,a.c)(42),{value:S,onChange:j}=e,[C,P]=(0,o.useState)(""),T=(0,o.useRef)(null);E[0]!==j?(t=e=>{e&&(j(e),T.current?.blur())},E[0]=j,E[1]=t):t=E[1],E[2]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{(0,o.startTransition)(()=>P(e))},E[2]=r):r=E[2],E[3]!==t||E[4]!==S?(i={placement:"bottom-start",resetValueOnHide:!0,selectedValue:S,setSelectedValue:t,setValue:r},E[3]=t,E[4]=S,E[5]=i):i=E[5];let _=(0,V.useComboboxStore)(i);E[6]!==_?(s=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),T.current?.focus(),_.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},c=[_],E[6]=_,E[7]=s,E[8]=c):(s=E[7],c=E[8]),(0,o.useEffect)(s,c),E[9]!==S?(l=B.get(S),E[9]=S,E[10]=l):l=E[10];let w=l;e:{let e,t;if(!C){let e;E[11]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:K},E[11]=e):e=E[11],u=e;break e}E[12]!==C?(e=(0,D.matchSorter)(Z,C,{keys:["displayName","groupName"]}),E[12]=C,E[13]=e):e=E[13];let n=e;E[14]!==n?(t={type:"flat",shapes:n},E[14]=n,E[15]=t):t=E[15],u=t}let N=u,A=w?.displayName??S,M="flat"===N.type?0===N.shapes.length:0===N.groups.length;return E[16]!==_?(m=()=>{try{document.exitPointerLock()}catch{}_.show()},p=e=>{"Escape"!==e.key||_.getState().open||T.current?.blur()},E[16]=_,E[17]=m,E[18]=p):(m=E[17],p=E[18]),E[19]!==A||E[20]!==m||E[21]!==p?(d=(0,n.jsx)(O.Combobox,{ref:T,autoSelect:!0,placeholder:A,className:Y.default.Input,onFocus:m,onKeyDown:p}),E[19]=A,E[20]=m,E[21]=p,E[22]=d):d=E[22],E[23]!==A?(h=(0,n.jsx)("div",{className:Y.default.SelectedValue,children:(0,n.jsx)("span",{className:Y.default.SelectedName,children:A})}),E[23]=A,E[24]=h):h=E[24],E[25]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)("kbd",{className:Y.default.Shortcut,children:X?"⌘K":"^K"}),E[25]=f):f=E[25],E[26]!==d||E[27]!==h?(b=(0,n.jsxs)("div",{className:Y.default.InputWrapper,children:[d,h,f]}),E[26]=d,E[27]=h,E[28]=b):b=E[28],E[29]!==N.groups||E[30]!==N.shapes||E[31]!==N.type?(g="flat"===N.type?N.shapes.map(q):N.groups.map(e=>{let[t,a]=e;return(0,n.jsxs)(I.ComboboxGroup,{className:Y.default.Group,children:[(0,n.jsx)(k.ComboboxGroupLabel,{className:Y.default.GroupLabel,children:t}),a.map(q)]},t)}),E[29]=N.groups,E[30]=N.shapes,E[31]=N.type,E[32]=g):g=E[32],E[33]!==M?(v=M&&(0,n.jsx)("div",{className:Y.default.NoResults,children:"No shapes found"}),E[33]=M,E[34]=v):v=E[34],E[35]!==g||E[36]!==v?(y=(0,n.jsx)(R.ComboboxPopover,{portal:!0,gutter:4,autoFocusOnHide:!1,className:Y.default.Popover,children:(0,n.jsxs)(L.ComboboxList,{className:Y.default.List,children:[g,v]})}),E[35]=g,E[36]=v,E[37]=y):y=E[37],E[38]!==_||E[39]!==b||E[40]!==y?(x=(0,n.jsxs)(z.ComboboxProvider,{store:_,children:[b,y]}),E[38]=_,E[39]=b,E[40]=y,E[41]=x):x=E[41],x}function q(e){return(0,n.jsx)(M.ComboboxItem,{value:e.shapeName,className:Y.default.Item,focusOnHover:!0,children:(0,n.jsx)("span",{className:Y.default.ItemName,children:e.displayName})},e.shapeName)}e.i(13876);var G=e.i(58647),Q=e.i(38847),$=e.i(32424),J=e.i(54970),ee=e.i(86608),et=e.i(33870),en=e.i(99140),ea=e.i(7368);let eo=new s.QueryClient,er=new i.Color(.1,.1,.1),ei={toneMapping:i.NoToneMapping,outputColorSpace:i.SRGBColorSpace},es=(0,$.createScriptLoader)(),ec=(0,et.createScriptCache)(),el={findFiles:e=>{let t=(0,J.default)(e,{nocase:!0});return(0,F.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,F.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,F.getResourceMap)()[(0,F.getResourceKey)(e)]},eu=(0,Q.createParser)({parse:e=>e,serialize:e=>e,eq:(e,t)=>e===t}).withDefault("deploy_inventory.dts");function em(e){"batch.flushed"===e.type&&G.engineStore.getState().applyRuntimeBatch(e.events,{tick:e.tick})}function ep(e){e instanceof Error&&"AbortError"===e.name||console.error("Shape runtime failed:",e)}function ed(){let e,t,n=(0,a.c)(3),r=o.useContext(C);return n[0]!==r?(e=()=>{r.refresh().fit()},t=[r],n[0]=r,n[1]=e,n[2]=t):(e=n[1],t=n[2]),(0,o.useEffect)(e,t),null}function eh(e){let t,n,r,i,s=(0,a.c)(11),{shapeName:c,onAnimations:l}=e,u=(0,_.useStaticShape)(c);s[0]!==c?(t=e=>e.runtime.sequenceAliases.get(c.toLowerCase()),s[0]=c,s[1]=t):t=s[1];let m=(0,G.useEngineSelector)(t);if(s[2]!==u.animations||s[3]!==u.scene||s[4]!==m){let e,t=new Map;if(u.scene.traverse(e=>{let n=e.userData;n?.vis_sequence&&null!=n.vis_cyclic&&t.set(n.vis_sequence.toLowerCase(),!!n.vis_cyclic)}),m)for(let[t,n]of(e=new Map,m))e.set(n,t);n=u.animations.map(n=>({name:n.name,alias:e?.get(n.name.toLowerCase())??null,cyclic:t.get(n.name.toLowerCase())??null})),s[2]=u.animations,s[3]=u.scene,s[4]=m,s[5]=n}else n=s[5];let p=n,d=(0,o.useEffectEvent)(l);return s[6]!==p||s[7]!==d?(r=()=>{d(p)},s[6]=p,s[7]=d,s[8]=r):r=s[8],s[9]!==p?(i=[p],s[9]=p,s[10]=i):i=s[10],(0,o.useEffect)(r,i),null}function ef(e){let t,n,r=(0,a.c)(5),{object:i,runtime:s,animation:c}=e;return r[0]!==c||r[1]!==i||r[2]!==s?(t=()=>{if(s&&c){for(let e=0;e<4;e++)s.$.nsCall("ShapeBase","stopThread",i,e);return s.$.nsCall("ShapeBase","playThread",i,0,c),()=>{for(let e=0;e<4;e++)s.$.nsCall("ShapeBase","stopThread",i,e)}}},n=[s,i,c],r[0]=c,r[1]=i,r[2]=s,r[3]=t,r[4]=n):(t=r[3],n=r[4]),(0,o.useEffect)(t,n),null}function eb(e){let t,o,r,i,s,c,l,u=(0,a.c)(19),{shapeName:m,runtime:p,onAnimations:d,selectedAnimation:h}=e;u[0]!==p||u[1]!==m?(t=function(e,t){let n;if(e){for(let a of e.state.objectsById.values())if(a.shapeFile&&String(a.shapeFile).toLowerCase()===t.toLowerCase()){n=a._name;break}}return{_id:99999,_class:"StaticShapeData",_className:"StaticShape",...n?{datablock:n}:{}}}(p,m),u[0]=p,u[1]=m,u[2]=t):t=u[2];let f=t;return u[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(_.ShapeRenderer,{}),u[3]=o):o=u[3],u[4]!==d||u[5]!==m?(r=(0,n.jsx)(eh,{shapeName:m,onAnimations:d}),u[4]=d,u[5]=m,u[6]=r):r=u[6],u[7]!==f||u[8]!==p||u[9]!==h?(i=(0,n.jsx)(ef,{object:f,runtime:p,animation:h}),u[7]=f,u[8]=p,u[9]=h,u[10]=i):i=u[10],u[11]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)(ed,{}),u[11]=s):s=u[11],u[12]!==r||u[13]!==i?(c=(0,n.jsxs)(E,{children:[o,r,i,s]}),u[12]=r,u[13]=i,u[14]=c):c=u[14],u[15]!==f||u[16]!==m||u[17]!==c?(l=(0,n.jsx)(w.ShapeInfoProvider,{type:"StaticShape",object:f,shapeName:m,children:c}),u[15]=f,u[16]=m,u[17]=c,u[18]=l):l=u[18],l}function eg(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("ambientLight",{intensity:.6}),(0,n.jsx)("directionalLight",{position:[50,80,30],intensity:1.2})]}),t[0]=e):e=t[0],e}function ev(){let e,t,s,l,u,m,p,d,h,f,b,g,v,y,E,S,j=(0,a.c)(31),[C,_]=(0,Q.useQueryState)("shape",eu),w=function(){let e,t,n=(0,a.c)(2),[r,i]=(0,o.useState)(null);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=new AbortController,t=!1,{runtime:n,ready:a}=(0,ee.runServer)({missionName:"SC_Normal",missionType:"CTF",runtimeOptions:{loadScript:es,fileSystem:el,cache:ec,signal:e.signal,ignoreScripts:ea.ignoreScripts}});a.then(()=>{t||e.signal.aborted||(G.engineStore.getState().setRuntime(n),i(n))}).catch(ep),G.engineStore.getState().setRuntime(n);let o=n.subscribeRuntimeEvents(em);return()=>{t=!0,e.abort(),o(),G.engineStore.getState().clearRuntime(),n.destroy()}},t=[],n[0]=e,n[1]=t):(e=n[0],t=n[1]),(0,o.useEffect)(e,t),r}();j[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],j[0]=e):e=j[0];let[O,M]=(0,o.useState)(e),[L,R]=(0,o.useState)("");j[1]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{M(e),R("")},j[1]=t):t=j[1];let z=t,[I,k]=(0,o.useState)(!0);return j[2]!==w?(s=()=>{if(w){let e=setTimeout(()=>k(!1),300);return()=>clearTimeout(e)}},l=[w],j[2]=w,j[3]=s,j[4]=l):(s=j[3],l=j[4]),(0,o.useEffect)(s,l),j[5]!==w||j[6]!==I?(u=I&&(0,n.jsx)("div",{className:en.default.LoadingIndicator,"data-complete":!!w,children:(0,n.jsx)("div",{className:en.default.Spinner})}),j[5]=w,j[6]=I,j[7]=u):u=j[7],j[8]===Symbol.for("react.memo_cache_sentinel")?(m={type:i.PCFShadowMap},p={background:er},d={position:[5,3,5],fov:90},j[8]=m,j[9]=p,j[10]=d):(m=j[8],p=j[9],d=j[10]),j[11]===Symbol.for("react.memo_cache_sentinel")?(h=(0,n.jsx)(eg,{}),j[11]=h):h=j[11],j[12]!==C||j[13]!==w||j[14]!==L?(f=(0,n.jsx)(P,{fit:!0,clip:!0,observe:!0,margin:1.5,children:(0,n.jsx)(o.Suspense,{fallback:null,children:(0,n.jsx)(eb,{shapeName:C,runtime:w,onAnimations:z,selectedAnimation:L},C)})}),j[12]=C,j[13]=w,j[14]=L,j[15]=f):f=j[15],j[16]===Symbol.for("react.memo_cache_sentinel")?(b=(0,n.jsx)(N.DebugElements,{}),g=(0,n.jsx)(x,{makeDefault:!0}),j[16]=b,j[17]=g):(b=j[16],g=j[17]),j[18]!==f?(v=(0,n.jsx)(r.Canvas,{frameloop:"always",gl:ei,shadows:m,scene:p,camera:d,children:(0,n.jsxs)(A.TickProvider,{children:[h,f,b,g]})}),j[18]=f,j[19]=v):v=j[19],j[20]!==v||j[21]!==u?(y=(0,n.jsxs)("div",{className:en.default.CanvasContainer,children:[u,v]}),j[20]=v,j[21]=u,j[22]=y):y=j[22],j[23]!==O||j[24]!==C||j[25]!==L||j[26]!==_?(E=(0,n.jsx)(ex,{currentShape:C,onChangeShape:_,animations:O,selectedAnimation:L,onChangeAnimation:R}),j[23]=O,j[24]=C,j[25]=L,j[26]=_,j[27]=E):E=j[27],j[28]!==y||j[29]!==E?(S=(0,n.jsx)(c.QueryClientProvider,{client:eo,children:(0,n.jsx)("main",{children:(0,n.jsxs)(T.SettingsProvider,{onClearFogEnabledOverride:ey,children:[y,E]})})}),j[28]=y,j[29]=E,j[30]=S):S=j[30],S}function ey(){}function ex(e){let t,o,r,i,s,c,l,u=(0,a.c)(19),{currentShape:m,onChangeShape:p,animations:d,selectedAnimation:h,onChangeAnimation:f}=e,{debugMode:b,setDebugMode:g}=(0,T.useDebug)();return u[0]!==m||u[1]!==p?(t=(0,n.jsx)("div",{className:en.default.SidebarSection,children:(0,n.jsx)(W,{value:m,onChange:p})}),u[0]=m,u[1]=p,u[2]=t):t=u[2],u[3]!==g?(o=e=>g(e.target.checked),u[3]=g,u[4]=o):o=u[4],u[5]!==b||u[6]!==o?(r=(0,n.jsx)("input",{id:"debugInput",type:"checkbox",checked:b,onChange:o}),u[5]=b,u[6]=o,u[7]=r):r=u[7],u[8]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("label",{htmlFor:"debugInput",children:"Debug"}),u[8]=i):i=u[8],u[9]!==r?(s=(0,n.jsx)("div",{className:en.default.SidebarSection,children:(0,n.jsxs)("div",{className:en.default.CheckboxField,children:[r,i]})}),u[9]=r,u[10]=s):s=u[10],u[11]!==d||u[12]!==f||u[13]!==h?(c=d.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:en.default.SidebarSection,children:(0,n.jsx)("div",{className:en.default.SectionLabel,children:"Animations"})}),(0,n.jsx)("div",{className:en.default.AnimationList,children:d.map(e=>(0,n.jsxs)("div",{className:en.default.AnimationItem,"data-active":h===e.name,onClick:()=>f(h===e.name?"":e.name),children:[(0,n.jsx)("button",{className:en.default.PlayButton,title:`Play ${e.alias??e.name}`,children:h===e.name?"■":"▶"}),(0,n.jsx)("span",{className:en.default.AnimationName,children:e.alias??e.name}),e.alias&&(0,n.jsx)("span",{className:en.default.ClipName,title:`GLB clip: ${e.name}`,children:e.name}),!0===e.cyclic&&(0,n.jsx)("span",{className:en.default.CyclicIcon,title:"Cyclic (looping)",children:"∞"})]},e.name))})]}),u[11]=d,u[12]=f,u[13]=h,u[14]=c):c=u[14],u[15]!==t||u[16]!==s||u[17]!==c?(l=(0,n.jsxs)("div",{className:en.default.Sidebar,children:[t,s,c]}),u[15]=t,u[16]=s,u[17]=c,u[18]=l):l=u[18],l}function eE(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)(o.Suspense,{children:(0,n.jsx)(ev,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>eE],39724)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/bb0aa1c978feffed.js b/docs/_next/static/chunks/bb0aa1c978feffed.js deleted file mode 100644 index 8a402e03..00000000 --- a/docs/_next/static/chunks/bb0aa1c978feffed.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,66027,15823,19273,75555,40143,14448,36553,88587,86491,69230,12598,54440,69637,t=>{"use strict";let e,r,s,i,n,a,o;var u=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};t.s(["Subscribable",()=>u],15823),t.i(47167);var c={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},l=new class{#t=c;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},h="undefined"==typeof window||"Deno"in globalThis;function d(){}function p(t,e){return"function"==typeof t?t(e):t}function f(t){return"number"==typeof t&&t>=0&&t!==1/0}function y(t,e){return Math.max(t+(e||0)-Date.now(),0)}function v(t,e){return"function"==typeof t?t(e):t}function b(t,e){return"function"==typeof t?t(e):t}function m(t,e){let{type:r="all",exact:s,fetchStatus:i,predicate:n,queryKey:a,stale:o}=t;if(a){if(s){if(e.queryHash!==O(a,e.options))return!1}else if(!S(e.queryKey,a))return!1}if("all"!==r){let t=e.isActive();if("active"===r&&!t||"inactive"===r&&t)return!1}return("boolean"!=typeof o||e.isStale()===o)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function g(t,e){let{exact:r,status:s,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(r){if(R(e.options.mutationKey)!==R(n))return!1}else if(!S(e.options.mutationKey,n))return!1}return(!s||e.state.status===s)&&(!i||!!i(e))}function O(t,e){return(e?.queryKeyHashFn||R)(t)}function R(t){return JSON.stringify(t,(t,e)=>Q(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e)}function S(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(r=>S(t[r],e[r]))}var w=Object.prototype.hasOwnProperty;function C(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(t[r]!==e[r])return!1;return!0}function T(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Q(t){if(!F(t))return!1;let e=t.constructor;if(void 0===e)return!0;let r=e.prototype;return!!F(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function F(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t){return new Promise(e=>{l.setTimeout(e,t)})}function E(t,e,r){return"function"==typeof r.structuralSharing?r.structuralSharing(t,e):!1!==r.structuralSharing?function t(e,r){if(e===r)return e;let s=T(e)&&T(r);if(!s&&!(Q(e)&&Q(r)))return r;let i=(s?e:Object.keys(e)).length,n=s?r:Object.keys(r),a=n.length,o=s?Array(a):{},u=0;for(let c=0;cr?s.slice(1):s}function j(t,e,r=0){let s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var U=Symbol();function D(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==U?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function x(t,e){return"function"==typeof t?t(...e):!!t}function q(t,e,r){let s,i=!1;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??=e(),i||(i=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),t}t.s(["addConsumeAwareSignal",()=>q,"addToEnd",()=>P,"addToStart",()=>j,"ensureQueryFn",()=>D,"functionalUpdate",()=>p,"hashKey",()=>R,"hashQueryKeyByOptions",()=>O,"isServer",()=>h,"isValidTimeout",()=>f,"matchMutation",()=>g,"matchQuery",()=>m,"noop",()=>d,"partialMatchKey",()=>S,"replaceData",()=>E,"resolveEnabled",()=>b,"resolveStaleTime",()=>v,"shallowEqualObjects",()=>C,"shouldThrowError",()=>x,"skipToken",()=>U,"sleep",()=>I,"timeUntilStale",()=>y],19273);var k=new class extends u{#r;#s;#i;constructor(){super(),this.#i=t=>{if(!h&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#s||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(t){this.#i=t,this.#s?.(),this.#s=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#r!==t&&(this.#r=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#r?this.#r:globalThis.document?.visibilityState!=="hidden"}};t.s(["focusManager",()=>k],75555);var M=(e=[],r=0,s=t=>{t()},i=t=>{t()},n=function(t){setTimeout(t,0)},{batch:t=>{let a;r++;try{a=t()}finally{let t;--r||(t=e,e=[],t.length&&n(()=>{i(()=>{t.forEach(t=>{s(t)})})}))}return a},batchCalls:t=>(...e)=>{a(()=>{t(...e)})},schedule:a=t=>{r?e.push(t):n(()=>{s(t)})},setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}});t.s(["notifyManager",()=>M],40143);var L=new class extends u{#n=!0;#s;#i;constructor(){super(),this.#i=t=>{if(!h&&window.addEventListener){let e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#s||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(t){this.#i=t,this.#s?.(),this.#s=t(this.setOnline.bind(this))}setOnline(t){this.#n!==t&&(this.#n=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#n}};function A(){let t,e,r=new Promise((r,s)=>{t=r,e=s});function s(t){Object.assign(r,t),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=e=>{s({status:"fulfilled",value:e}),t(e)},r.reject=t=>{s({status:"rejected",reason:t}),e(t)},r}function K(t){return Math.min(1e3*2**t,3e4)}function z(t){return(t??"online")!=="online"||L.isOnline()}t.s(["onlineManager",()=>L],14448);var H=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function _(t){let e,r=!1,s=0,i=A(),n=()=>k.isFocused()&&("always"===t.networkMode||L.isOnline())&&t.canRun(),a=()=>z(t.networkMode)&&t.canRun(),o=t=>{"pending"===i.status&&(e?.(),i.resolve(t))},u=t=>{"pending"===i.status&&(e?.(),i.reject(t))},c=()=>new Promise(r=>{e=t=>{("pending"!==i.status||n())&&r(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===i.status&&t.onContinue?.()}),l=()=>{let e;if("pending"!==i.status)return;let a=0===s?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(o).catch(e=>{if("pending"!==i.status)return;let a=t.retry??3*!h,o=t.retryDelay??K,d="function"==typeof o?o(s,e):o,p=!0===a||"number"==typeof a&&sn()?void 0:c()).then(()=>{r?u(e):l()}))})};return{promise:i,status:()=>i.status,cancel:e=>{if("pending"===i.status){let r=new H(e);u(r),t.onCancel?.(r)}},continue:()=>(e?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?l():c().then(l),i)}}t.s(["CancelledError",()=>H,"canFetch",()=>z,"createRetryer",()=>_],36553);var B=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#a=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(h?1/0:3e5))}clearGcTimeout(){this.#a&&(l.clearTimeout(this.#a),this.#a=void 0)}};t.s(["Removable",()=>B],88587);var G=class extends B{#o;#u;#c;#l;#h;#d;#p;constructor(t){super(),this.#p=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#l=t.client,this.#c=this.#l.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#o=V(this.options),this.state=t.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=V(this.options);void 0!==t.data&&(this.setState(W(t.data,t.dataUpdatedAt)),this.#o=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(t,e){let r=E(this.state.data,t,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t,e){this.#f({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#h?.promise;return this.#h?.cancel(t),e?e.then(d).catch(d):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(t=>!1!==b(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===U||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===v(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!y(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#h&&(this.#p?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(t,e){let r;if("idle"!==this.state.fetchStatus&&this.#h?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let s=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#p=!0,s.signal)})},n=()=>{let t,r=D(this.options,e),s=(i(t={client:this.#l,queryKey:this.queryKey,meta:this.meta}),t);return(this.#p=!1,this.options.persister)?this.options.persister(r,s,this):r(s)},a=(i(r={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#l,state:this.state,fetchFn:n}),r);this.options.behavior?.onFetch(a,this),this.#u=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#f({type:"fetch",meta:a.fetchOptions?.meta}),this.#h=_({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:t=>{t instanceof H&&t.revert&&this.setState({...this.#u,fetchStatus:"idle"}),s.abort()},onFail:(t,e)=>{this.#f({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let t=await this.#h.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#c.config.onSuccess?.(t,this),this.#c.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof H){if(t.silent)return this.#h.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#f({type:"error",error:t}),this.#c.config.onError?.(t,this),this.#c.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#f(t){let e=e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...N(e.data,this.options),fetchMeta:t.meta??null};case"success":let r={...e,...W(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#u=t.manual?r:void 0,r;case"error":let s=t.error;return{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),M.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:t})})}};function N(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function W(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function V(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,r=void 0!==e,s=r?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}t.s(["Query",()=>G,"fetchState",()=>N],86491);var $=class extends u{constructor(t,e){super(),this.options=e,this.#l=t,this.#y=null,this.#v=A(),this.bindMethods(),this.setOptions(e)}#l;#b=void 0;#m=void 0;#g=void 0;#O;#R;#v;#y;#S;#w;#C;#T;#Q;#F;#I=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),J(this.#b,this.options)?this.#E():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return X(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return X(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#j(),this.#U(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,r=this.#b;if(this.options=this.#l.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof b(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#D(),this.#b.setOptions(this.options),e._defaulted&&!C(this.options,e)&&this.#l.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let s=this.hasListeners();s&&Y(this.#b,r,this.options,e)&&this.#E(),this.updateResult(),s&&(this.#b!==r||b(this.options.enabled,this.#b)!==b(e.enabled,this.#b)||v(this.options.staleTime,this.#b)!==v(e.staleTime,this.#b))&&this.#x();let i=this.#q();s&&(this.#b!==r||b(this.options.enabled,this.#b)!==b(e.enabled,this.#b)||i!==this.#F)&&this.#k(i)}getOptimisticResult(t){var e,r;let s=this.#l.getQueryCache().build(this.#l,t),i=this.createResult(s,t);return e=this,r=i,C(e.getCurrentResult(),r)||(this.#g=i,this.#R=this.options,this.#O=this.#b.state),i}getCurrentResult(){return this.#g}trackResult(t,e){return new Proxy(t,{get:(t,r)=>(this.trackProp(r),e?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,r))})}trackProp(t){this.#I.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#l.defaultQueryOptions(t),r=this.#l.getQueryCache().build(this.#l,e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return this.#E({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#g))}#E(t){this.#D();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(d)),e}#x(){this.#j();let t=v(this.options.staleTime,this.#b);if(h||this.#g.isStale||!f(t))return;let e=y(this.#g.dataUpdatedAt,t);this.#T=l.setTimeout(()=>{this.#g.isStale||this.updateResult()},e+1)}#q(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#k(t){this.#U(),this.#F=t,!h&&!1!==b(this.options.enabled,this.#b)&&f(this.#F)&&0!==this.#F&&(this.#Q=l.setInterval(()=>{(this.options.refetchIntervalInBackground||k.isFocused())&&this.#E()},this.#F))}#P(){this.#x(),this.#k(this.#q())}#j(){this.#T&&(l.clearTimeout(this.#T),this.#T=void 0)}#U(){this.#Q&&(l.clearInterval(this.#Q),this.#Q=void 0)}createResult(t,e){let r,s=this.#b,i=this.options,n=this.#g,a=this.#O,o=this.#R,u=t!==s?t.state:this.#m,{state:c}=t,l={...c},h=!1;if(e._optimisticResults){let r=this.hasListeners(),n=!r&&J(t,e),a=r&&Y(t,s,e,i);(n||a)&&(l={...l,...N(c.data,t.options)}),"isRestoring"===e._optimisticResults&&(l.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:f}=l;r=l.data;let y=!1;if(void 0!==e.placeholderData&&void 0===r&&"pending"===f){let t;n?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(t=n.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#C?.state.data,this.#C):e.placeholderData,void 0!==t&&(f="success",r=E(n?.data,t,e),h=!0)}if(e.select&&void 0!==r&&!y)if(n&&r===a?.data&&e.select===this.#S)r=this.#w;else try{this.#S=e.select,r=e.select(r),r=E(n?.data,r,e),this.#w=r,this.#y=null}catch(t){this.#y=t}this.#y&&(d=this.#y,r=this.#w,p=Date.now(),f="error");let v="fetching"===l.fetchStatus,m="pending"===f,g="error"===f,O=m&&v,R=void 0!==r,S={status:f,fetchStatus:l.fetchStatus,isPending:m,isSuccess:"success"===f,isError:g,isInitialLoading:O,isLoading:O,data:r,dataUpdatedAt:l.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>u.dataUpdateCount||l.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!m,isLoadingError:g&&!R,isPaused:"paused"===l.fetchStatus,isPlaceholderData:h,isRefetchError:g&&R,isStale:Z(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==b(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=t=>{"error"===S.status?t.reject(S.error):void 0!==S.data&&t.resolve(S.data)},r=()=>{e(this.#v=S.promise=A())},i=this.#v;switch(i.status){case"pending":t.queryHash===s.queryHash&&e(i);break;case"fulfilled":("error"===S.status||S.data!==i.value)&&r();break;case"rejected":("error"!==S.status||S.error!==i.reason)&&r()}}return S}updateResult(){let t=this.#g,e=this.createResult(this.#b,this.options);if(this.#O=this.#b.state,this.#R=this.options,void 0!==this.#O.data&&(this.#C=this.#b),C(e,t))return;this.#g=e;let r=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#I.size)return!0;let s=new Set(r??this.#I);return this.options.throwOnError&&s.add("error"),Object.keys(this.#g).some(e=>this.#g[e]!==t[e]&&s.has(e))};this.#M({listeners:r()})}#D(){let t=this.#l.getQueryCache().build(this.#l,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#m=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#M(t){M.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#g)}),this.#l.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function J(t,e){return!1!==b(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&X(t,e,e.refetchOnMount)}function X(t,e,r){if(!1!==b(e.enabled,t)&&"static"!==v(e.staleTime,t)){let s="function"==typeof r?r(t):r;return"always"===s||!1!==s&&Z(t,e)}return!1}function Y(t,e,r,s){return(t!==e||!1===b(s.enabled,t))&&(!r.suspense||"error"!==t.state.status)&&Z(t,r)}function Z(t,e){return!1!==b(e.enabled,t)&&t.isStaleByTime(v(e.staleTime,t))}t.s(["QueryObserver",()=>$],69230);var tt=t.i(71645),te=t.i(43476),tr=tt.createContext(void 0),ts=t=>{let e=tt.useContext(tr);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},ti=({client:t,children:e})=>(tt.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,te.jsx)(tr.Provider,{value:t,children:e}));t.s(["QueryClientProvider",()=>ti,"useQueryClient",()=>ts],12598);var tn=tt.createContext((o=!1,{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o})),ta=tt.createContext(!1);ta.Provider;var to=(t,e)=>void 0===e.state.data,tu=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),r=t.staleTime;t.staleTime="function"==typeof r?(...t)=>e(r(...t)):e(r),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},tc=(t,e)=>t.isLoading&&t.isFetching&&!e,tl=(t,e)=>t?.suspense&&e.isPending,th=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function td(t,e,r){let s=tt.useContext(ta),i=tt.useContext(tn),n=ts(r),a=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=s?"isRestoring":"optimistic",tu(a),(a.suspense||a.throwOnError||a.experimental_prefetchInRender)&&!i.isReset()&&(a.retryOnMount=!1),tt.useEffect(()=>{i.clearReset()},[i]);let o=!n.getQueryCache().get(a.queryHash),[u]=tt.useState(()=>new e(n,a)),c=u.getOptimisticResult(a),l=!s&&!1!==t.subscribed;if(tt.useSyncExternalStore(tt.useCallback(t=>{let e=l?u.subscribe(M.batchCalls(t)):d;return u.updateResult(),e},[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),tt.useEffect(()=>{u.setOptions(a)},[a,u]),tl(a,c))throw th(a,u,i);if((({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(i&&void 0===t.data||x(r,[t.error,s])))({result:c,errorResetBoundary:i,throwOnError:a.throwOnError,query:n.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if(n.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!h&&tc(c,s)){let t=o?th(a,u,i):n.getQueryCache().get(a.queryHash)?.promise;t?.catch(d).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?c:u.trackResult(c)}function tp(t,e){return td(t,$,e)}t.s(["defaultThrowOnError",()=>to,"ensureSuspenseTimers",()=>tu,"fetchOptimistic",()=>th,"shouldSuspend",()=>tl,"willFetch",()=>tc],54440),t.s(["useBaseQuery",()=>td],69637),t.s(["useQuery",()=>tp],66027)},11152,40141,t=>{"use strict";var e=t.i(71645),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},s=e.default.createContext&&e.default.createContext(r),i=["attr","size","title"];function n(){return(n=Object.assign.bind()).apply(this,arguments)}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,s)}return r}function o(t){for(var e=1;ee.default.createElement(c,n({attr:o({},t.attr)},r),function t(r){return r&&r.map((r,s)=>e.default.createElement(r.tag,o({key:s},r.attr),t(r.child)))}(t.child))}function c(t){var a=r=>{var s,{attr:a,size:u,title:c}=t,l=function(t,e){if(null==t)return{};var r,s,i=function(t,e){if(null==t)return{};var r={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;r[s]=t[s]}return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}(t,i),h=u||r.size||"1em";return r.className&&(s=r.className),t.className&&(s=(s?s+" ":"")+t.className),e.default.createElement("svg",n({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,l,{className:s,style:o(o({color:t.color||r.color},r.style),t.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),c&&e.default.createElement("title",null,c),t.children)};return void 0!==s?e.default.createElement(s.Consumer,null,t=>a(t)):a(r)}function l(t){return u({tag:"svg",attr:{viewBox:"0 0 288 512"},child:[{tag:"path",attr:{d:"M112 316.94v156.69l22.02 33.02c4.75 7.12 15.22 7.12 19.97 0L176 473.63V316.94c-10.39 1.92-21.06 3.06-32 3.06s-21.61-1.14-32-3.06zM144 0C64.47 0 0 64.47 0 144s64.47 144 144 144 144-64.47 144-144S223.53 0 144 0zm0 76c-37.5 0-68 30.5-68 68 0 6.62-5.38 12-12 12s-12-5.38-12-12c0-50.73 41.28-92 92-92 6.62 0 12 5.38 12 12s-5.38 12-12 12z"},child:[]}]})(t)}function h(t){return u({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},child:[]}]})(t)}function d(t){return u({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},child:[]}]})(t)}t.s(["GenIcon",()=>u],40141),t.s(["FaMapPin",()=>l,"FaVolumeMute",()=>h,"FaVolumeUp",()=>d],11152)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/c1f9b49d5dc0251d.js b/docs/_next/static/chunks/c1f9b49d5dc0251d.js new file mode 100644 index 00000000..5fe5d8e3 --- /dev/null +++ b/docs/_next/static/chunks/c1f9b49d5dc0251d.js @@ -0,0 +1,211 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},47071,99143,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(15080),s=e.i(40859);e.s(["useLoader",()=>s.G],99143);var s=s;let n=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function a(e,a){let o=(0,i.useThree)(e=>e.gl),l=(0,s.G)(r.TextureLoader,n(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==a||a(l)},[a]),(0,t.useEffect)(()=>{if("initTexture"in o){let e=[];Array.isArray(l)?e=l:l instanceof r.Texture?e=[l]:n(l)&&(e=Object.values(l)),e.forEach(e=>{e instanceof r.Texture&&o.initTexture(e)})}},[o,l]),(0,t.useMemo)(()=>{if(!n(e))return l;{let t={},r=0;for(let i in e)t[i]=l[r++];return t}},[e,l])}a.preload=e=>s.G.preload(r.TextureLoader,e),a.clear=e=>s.G.clear(r.TextureLoader,e),e.s(["useTexture",()=>a],47071)},75567,e=>{"use strict";var t=e.i(90072);function r(e,i={}){let{repeat:s=[1,1],disableMipmaps:n=!1}=i;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...s),e.flipY=!1,e.anisotropy=16,n?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function i(e){let r=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return r.colorSpace=t.NoColorSpace,r.wrapS=r.wrapT=t.RepeatWrapping,r.generateMipmaps=!1,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.needsUpdate=!0,r}e.s(["setupMask",()=>i,"setupTexture",()=>r])},47021,e=>{"use strict";var t=e.i(8560);let r=` +#ifdef USE_FOG + // Check fog enabled uniform - allows toggling without shader recompilation + #ifdef USE_VOLUMETRIC_FOG + if (!fogEnabled) { + // Skip all fog calculations when disabled + } else { + #endif + + float dist = vFogDepth; + + // Discard fragments at or beyond visible distance - matches Torque's behavior + // where objects beyond visibleDistance are not rendered at all. + // This prevents fully-fogged geometry from showing as silhouettes against + // the sky's fog-to-sky gradient. + if (dist >= fogFar) { + discard; + } + + // Step 1: Calculate distance-based haze (quadratic falloff) + // Since we discard at fogFar, haze never reaches 1.0 here + float haze = 0.0; + if (dist > fogNear) { + float fogScale = 1.0 / (fogFar - fogNear); + float distFactor = (dist - fogNear) * fogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } + + // Step 2: Calculate fog volume contributions + // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) + // All fog uses the global fogColor - see Tribes2_Fog_System.md for details + float volumeFog = 0.0; + + #ifdef USE_VOLUMETRIC_FOG + { + #ifdef USE_FOG_WORLD_POSITION + float fragmentHeight = vFogWorldPosition.y; + #else + float fragmentHeight = cameraHeight; + #endif + + float deltaY = fragmentHeight - cameraHeight; + float absDeltaY = abs(deltaY); + + // Determine if we're going up (positive) or down (negative) + if (absDeltaY > 0.01) { + // Non-horizontal ray: ray-march through fog volumes + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + // Skip inactive volumes (visibleDistance = 0) + if (volVisDist <= 0.0) continue; + + // Calculate fog factor for this volume + // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage + // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) + // Since we don't have quality settings, we use visFactor = 1.0 + float factor = (1.0 / volVisDist) * volPct; + + // Find ray intersection with this volume's height range + float rayMinY = min(cameraHeight, fragmentHeight); + float rayMaxY = max(cameraHeight, fragmentHeight); + + // Check if ray intersects volume height range + if (rayMinY < volMaxH && rayMaxY > volMinH) { + float intersectMin = max(rayMinY, volMinH); + float intersectMax = min(rayMaxY, volMaxH); + float intersectHeight = intersectMax - intersectMin; + + // Calculate distance traveled through this volume using similar triangles: + // subDist / dist = intersectHeight / absDeltaY + float subDist = dist * (intersectHeight / absDeltaY); + + // Accumulate fog: fog += subDist * factor + volumeFog += subDist * factor; + } + } + } else { + // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // If camera is inside this volume, apply fog for full distance + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float factor = (1.0 / volVisDist) * volPct; + volumeFog += dist * factor; + } + } + } + } + #endif + + // Step 3: Combine haze and volume fog + // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct + // This gives fog volumes priority over haze + float volPct = min(volumeFog, 1.0); + float hazePct = haze; + if (volPct + hazePct > 1.0) { + hazePct = 1.0 - volPct; + } + float fogFactor = hazePct + volPct; + + // Apply fog using global fogColor (per-volume colors not used in Tribes 2) + gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); + + #ifdef USE_VOLUMETRIC_FOG + } // end fogEnabled check + #endif +#endif +`;function i(){t.ShaderChunk.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 + + // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) + // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats + #ifdef USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + #endif + + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_fragment=r,t.ShaderChunk.fog_pars_vertex=` +#ifdef USE_FOG + varying float vFogDepth; + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_vertex=` +#ifdef USE_FOG + // Use Euclidean distance from camera, not view-space z-depth + // This ensures fog doesn't change when rotating the camera + vFogDepth = length(mvPosition.xyz); + #ifdef USE_FOG_WORLD_POSITION + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; + #endif +#endif +`}function s(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.uniforms.fogEnabled=t.fogEnabled,e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + #define USE_VOLUMETRIC_FOG + varying vec3 vFogWorldPosition; +#endif`),e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + uniform bool fogEnabled; + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",r)}e.s(["fogFragmentShader",0,r,"injectCustomFog",()=>s,"installCustomFogShader",()=>i])},48066,e=>{"use strict";let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0},fogEnabled:{value:!0}};function r(e,i,s=!0){t.cameraHeight.value=e,t.fogVolumeData.value.set(i),t.fogEnabled.value=s}function i(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0),t.fogEnabled.value=!0}function s(e){let t=new Float32Array(12);for(let r=0;r<3;r++){let i=4*r,s=e[r];s&&(t[i+0]=s.visibleDistance,t[i+1]=s.minHeight,t[i+2]=s.maxHeight,t[i+3]=s.percentage)}return t}e.s(["globalFogUniforms",0,t,"packFogVolumeData",()=>s,"resetGlobalFogUniforms",()=>i,"updateGlobalFogUniforms",()=>r])},15823,e=>{"use strict";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",()=>t])},19273,80166,e=>{"use strict";e.i(47167);var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},r=new class{#e=t;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function i(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",()=>i,"timeoutManager",()=>r],80166);var s="u"=0&&e!==1/0}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e?e(t):e}function d(e,t){let{type:r="all",exact:i,fetchStatus:s,predicate:n,queryKey:a,stale:o}=e;if(a){if(i){if(t.queryHash!==f(a,t.options))return!1}else if(!p(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!s||s===t.state.fetchStatus)&&(!n||!!n(t))}function h(e,t){let{exact:r,status:i,predicate:s,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(r){if(m(t.options.mutationKey)!==m(n))return!1}else if(!p(t.options.mutationKey,n))return!1}return(!i||t.state.status===i)&&(!s||!!s(t))}function f(e,t){return(t?.queryKeyHashFn||m)(e)}function m(e){return JSON.stringify(e,(e,t)=>v(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function p(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>p(e[r],t[r]))}var y=Object.prototype.hasOwnProperty;function g(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function v(e){if(!S(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!S(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function S(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e){return new Promise(t=>{r.setTimeout(t,e)})}function k(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r,i=0){if(t===r)return t;if(i>500)return r;let s=b(t)&&b(r);if(!s&&!(v(t)&&v(r)))return r;let n=(s?t:Object.keys(t)).length,a=s?r:Object.keys(r),o=a.length,l=s?Array(o):{},u=0;for(let c=0;cr?i.slice(1):i}function R(e,t,r=0){let i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var C=Symbol();function O(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==C?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function T(e,t){return"function"==typeof e?e(...t):!!e}function F(e,t,r){let i,s=!1;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),s||(s=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),e}e.s(["addConsumeAwareSignal",()=>F,"addToEnd",()=>E,"addToStart",()=>R,"ensureQueryFn",()=>O,"functionalUpdate",()=>a,"hashKey",()=>m,"hashQueryKeyByOptions",()=>f,"isServer",()=>s,"isValidTimeout",()=>o,"matchMutation",()=>h,"matchQuery",()=>d,"noop",()=>n,"partialMatchKey",()=>p,"replaceData",()=>k,"resolveEnabled",()=>c,"resolveStaleTime",()=>u,"shallowEqualObjects",()=>g,"shouldThrowError",()=>T,"skipToken",()=>C,"sleep",()=>x,"timeUntilStale",()=>l],19273)},75555,e=>{"use strict";var t=e.i(15823),r=e.i(19273),i=new class extends t.Subscribable{#r;#i;#s;constructor(){super(),this.#s=e=>{if(!r.isServer&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",()=>i])},40143,e=>{"use strict";let t,r,i,s,n,a;var o=e.i(80166).systemSetTimeoutZero,l=(t=[],r=0,i=e=>{e()},s=e=>{e()},n=o,{batch:e=>{let a;r++;try{a=e()}finally{let e;--r||(e=t,t=[],e.length&&n(()=>{s(()=>{e.forEach(e=>{i(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{r?t.push(e):n(()=>{i(e)})},setNotifyFunction:e=>{i=e},setBatchNotifyFunction:e=>{s=e},setScheduler:e=>{n=e}});e.s(["notifyManager",()=>l])},86491,14448,93803,36553,88587,e=>{"use strict";e.i(47167);var t=e.i(19273),r=e.i(40143),i=e.i(75555),s=e.i(15823),n=new class extends s.Subscribable{#n=!0;#i;#s;constructor(){super(),this.#s=e=>{if(!t.isServer&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#i||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#i?.(),this.#i=void 0)}setEventListener(e){this.#s=e,this.#i?.(),this.#i=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function a(){let e,t,r=new Promise((r,i)=>{e=r,t=i});function i(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},r.reject=e=>{i({status:"rejected",reason:e}),t(e)},r}function o(e){return Math.min(1e3*2**e,3e4)}function l(e){return(e??"online")!=="online"||n.isOnline()}e.s(["onlineManager",()=>n],14448),e.s(["pendingThenable",()=>a],93803);var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function c(e){let r,s=!1,c=0,d=a(),h=()=>i.focusManager.isFocused()&&("always"===e.networkMode||n.isOnline())&&e.canRun(),f=()=>l(e.networkMode)&&e.canRun(),m=e=>{"pending"===d.status&&(r?.(),d.resolve(e))},p=e=>{"pending"===d.status&&(r?.(),d.reject(e))},y=()=>new Promise(t=>{r=e=>{("pending"!==d.status||h())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,"pending"===d.status&&e.onContinue?.()}),g=()=>{let r;if("pending"!==d.status)return;let i=0===c?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if("pending"!==d.status)return;let i=e.retry??3*!t.isServer,n=e.retryDelay??o,a="function"==typeof n?n(c,r):n,l=!0===i||"number"==typeof i&&ch()?void 0:y()).then(()=>{s?p(r):g()}))})};return{promise:d,status:()=>d.status,cancel:t=>{if("pending"===d.status){let r=new u(t);p(r),e.onCancel?.(r)}},continue:()=>(r?.(),d),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:f,start:()=>(f()?g():y().then(g),d)}}e.s(["CancelledError",()=>u,"canFetch",()=>l,"createRetryer",()=>c],36553);var d=e.i(80166),h=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,t.isValidTimeout)(this.gcTime)&&(this.#a=d.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(t.isServer?1/0:3e5))}clearGcTimeout(){this.#a&&(d.timeoutManager.clearTimeout(this.#a),this.#a=void 0)}};e.s(["Removable",()=>h],88587);var f=class extends h{#o;#l;#u;#c;#d;#h;#f;constructor(e){super(),this.#f=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=y(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=y(this.options);void 0!==e.data&&(this.setState(p(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,r){let i=(0,t.replaceData)(this.state.data,e,this.options);return this.#m({data:i,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),i}setState(e,t){this.#m({type:"setState",state:e,setStateOptions:t})}cancel(e){let r=this.#d?.promise;return this.#d?.cancel(e),r?r.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(e=>!1!==(0,t.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t.skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,t.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#f?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,r){let i;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let s=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,s.signal)})},a=()=>{let e,i=(0,t.ensureQueryFn)(this.options,r),s=(n(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#f=!1,this.options.persister)?this.options.persister(i,s,this):i(s)},o=(n(i={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),i);this.options.behavior?.onFetch(o,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#m({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=c({initialPromise:r?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof u&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),s.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof u){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#m({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#m(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...m(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...p(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":let i=e.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),r.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function m(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:l(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function p(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function y(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,i=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}e.s(["Query",()=>f,"fetchState",()=>m],86491)},69230,e=>{"use strict";var t=e.i(75555),r=e.i(40143),i=e.i(86491),s=e.i(15823),n=e.i(93803),a=e.i(19273),o=e.i(80166),l=class extends s.Subscribable{constructor(e,t){super(),this.options=t,this.#c=e,this.#p=null,this.#y=(0,n.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#b=void 0;#v=void 0;#S;#x;#y;#p;#k;#E;#R;#C;#O;#T;#F=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),u(this.#g,this.options)?this.#w():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return c(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return c(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#j(),this.#M(),this.#g.removeObserver(this)}setOptions(e){let t=this.options,r=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,a.resolveEnabled)(this.options.enabled,this.#g))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#g.setOptions(this.options),t._defaulted&&!(0,a.shallowEqualObjects)(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});let i=this.hasListeners();i&&d(this.#g,r,this.options,t)&&this.#w(),this.updateResult(),i&&(this.#g!==r||(0,a.resolveEnabled)(this.options.enabled,this.#g)!==(0,a.resolveEnabled)(t.enabled,this.#g)||(0,a.resolveStaleTime)(this.options.staleTime,this.#g)!==(0,a.resolveStaleTime)(t.staleTime,this.#g))&&this.#P();let s=this.#D();i&&(this.#g!==r||(0,a.resolveEnabled)(this.options.enabled,this.#g)!==(0,a.resolveEnabled)(t.enabled,this.#g)||s!==this.#T)&&this.#U(s)}getOptimisticResult(e){var t,r;let i=this.#c.getQueryCache().build(this.#c,e),s=this.createResult(i,e);return t=this,r=s,(0,a.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#v=s,this.#x=this.options,this.#S=this.#g.state),s}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#y.status||this.#y.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#F.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#w({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#w(e){this.#_();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(a.noop)),t}#P(){this.#j();let e=(0,a.resolveStaleTime)(this.options.staleTime,this.#g);if(a.isServer||this.#v.isStale||!(0,a.isValidTimeout)(e))return;let t=(0,a.timeUntilStale)(this.#v.dataUpdatedAt,e);this.#C=o.timeoutManager.setTimeout(()=>{this.#v.isStale||this.updateResult()},t+1)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#U(e){this.#M(),this.#T=e,!a.isServer&&!1!==(0,a.resolveEnabled)(this.options.enabled,this.#g)&&(0,a.isValidTimeout)(this.#T)&&0!==this.#T&&(this.#O=o.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||t.focusManager.isFocused())&&this.#w()},this.#T))}#I(){this.#P(),this.#U(this.#D())}#j(){this.#C&&(o.timeoutManager.clearTimeout(this.#C),this.#C=void 0)}#M(){this.#O&&(o.timeoutManager.clearInterval(this.#O),this.#O=void 0)}createResult(e,t){let r,s=this.#g,o=this.options,l=this.#v,c=this.#S,f=this.#x,m=e!==s?e.state:this.#b,{state:p}=e,y={...p},g=!1;if(t._optimisticResults){let r=this.hasListeners(),n=!r&&u(e,t),a=r&&d(e,s,t,o);(n||a)&&(y={...y,...(0,i.fetchState)(p.data,e.options)}),"isRestoring"===t._optimisticResults&&(y.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:S}=y;r=y.data;let x=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===S){let e;l?.isPlaceholderData&&t.placeholderData===f?.placeholderData?(e=l.data,x=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#R?.state.data,this.#R):t.placeholderData,void 0!==e&&(S="success",r=(0,a.replaceData)(l?.data,e,t),g=!0)}if(t.select&&void 0!==r&&!x)if(l&&r===c?.data&&t.select===this.#k)r=this.#E;else try{this.#k=t.select,r=t.select(r),r=(0,a.replaceData)(l?.data,r,t),this.#E=r,this.#p=null}catch(e){this.#p=e}this.#p&&(b=this.#p,r=this.#E,v=Date.now(),S="error");let k="fetching"===y.fetchStatus,E="pending"===S,R="error"===S,C=E&&k,O=void 0!==r,T={status:S,fetchStatus:y.fetchStatus,isPending:E,isSuccess:"success"===S,isError:R,isInitialLoading:C,isLoading:C,data:r,dataUpdatedAt:y.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!E,isLoadingError:R&&!O,isPaused:"paused"===y.fetchStatus,isPlaceholderData:g,isRefetchError:R&&O,isStale:h(e,t),refetch:this.refetch,promise:this.#y,isEnabled:!1!==(0,a.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,r="error"===T.status&&!t,i=e=>{r?e.reject(T.error):t&&e.resolve(T.data)},a=()=>{i(this.#y=T.promise=(0,n.pendingThenable)())},o=this.#y;switch(o.status){case"pending":e.queryHash===s.queryHash&&i(o);break;case"fulfilled":(r||T.data!==o.value)&&a();break;case"rejected":r&&T.error===o.reason||a()}}return T}updateResult(){let e=this.#v,t=this.createResult(this.#g,this.options);if(this.#S=this.#g.state,this.#x=this.options,void 0!==this.#S.data&&(this.#R=this.#g),(0,a.shallowEqualObjects)(t,e))return;this.#v=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#F.size)return!0;let i=new Set(r??this.#F);return this.options.throwOnError&&i.add("error"),Object.keys(this.#v).some(t=>this.#v[t]!==e[t]&&i.has(t))};this.#L({listeners:r()})}#_(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;let t=this.#g;this.#g=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#L(e){r.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function u(e,t){return!1!==(0,a.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&c(e,t,t.refetchOnMount)}function c(e,t,r){if(!1!==(0,a.resolveEnabled)(t.enabled,e)&&"static"!==(0,a.resolveStaleTime)(t.staleTime,e)){let i="function"==typeof r?r(e):r;return"always"===i||!1!==i&&h(e,t)}return!1}function d(e,t,r,i){return(e!==t||!1===(0,a.resolveEnabled)(i.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&h(e,r)}function h(e,t){return!1!==(0,a.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,a.resolveStaleTime)(t.staleTime,e))}e.s(["QueryObserver",()=>l])},12598,e=>{"use strict";var t=e.i(71645),r=e.i(43476),i=t.createContext(void 0),s=e=>{let r=t.useContext(i);if(e)return e;if(!r)throw Error("No QueryClient set, use QueryClientProvider to set one");return r},n=({client:e,children:s})=>(t.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,r.jsx)(i.Provider,{value:e,children:s}));e.s(["QueryClientProvider",()=>n,"useQueryClient",()=>s])},69637,54440,e=>{"use strict";let t;e.i(47167);var r=e.i(71645),i=e.i(19273),s=e.i(40143),n=e.i(12598);e.i(43476);var a=r.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),o=r.createContext(!1);o.Provider;var l=(e,t)=>void 0===t.state.data,u=e=>{if(e.suspense){let t=e=>"static"===e?e:Math.max(e??1e3,1e3),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>t(r(...e)):t(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3))}},c=(e,t)=>e.isLoading&&e.isFetching&&!t,d=(e,t)=>e?.suspense&&t.isPending,h=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function f(e,t,l){let f,m=r.useContext(o),p=r.useContext(a),y=(0,n.useQueryClient)(l),g=y.defaultQueryOptions(e);y.getDefaultOptions().queries?._experimental_beforeQuery?.(g);let b=y.getQueryCache().get(g.queryHash);g._optimisticResults=m?"isRestoring":"optimistic",u(g),f=b?.state.error&&"function"==typeof g.throwOnError?(0,i.shouldThrowError)(g.throwOnError,[b.state.error,b]):g.throwOnError,(g.suspense||g.experimental_prefetchInRender||f)&&!p.isReset()&&(g.retryOnMount=!1),r.useEffect(()=>{p.clearReset()},[p]);let v=!y.getQueryCache().get(g.queryHash),[S]=r.useState(()=>new t(y,g)),x=S.getOptimisticResult(g),k=!m&&!1!==e.subscribed;if(r.useSyncExternalStore(r.useCallback(e=>{let t=k?S.subscribe(s.notifyManager.batchCalls(e)):i.noop;return S.updateResult(),t},[S,k]),()=>S.getCurrentResult(),()=>S.getCurrentResult()),r.useEffect(()=>{S.setOptions(g)},[g,S]),d(g,x))throw h(g,S,p);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(n&&void 0===e.data||(0,i.shouldThrowError)(r,[e.error,s])))({result:x,errorResetBoundary:p,throwOnError:g.throwOnError,query:b,suspense:g.suspense}))throw x.error;if(y.getDefaultOptions().queries?._experimental_afterQuery?.(g,x),g.experimental_prefetchInRender&&!i.isServer&&c(x,m)){let e=v?h(g,S,p):b?.promise;e?.catch(i.noop).finally(()=>{S.updateResult()})}return g.notifyOnChangeProps?x:S.trackResult(x)}e.s(["defaultThrowOnError",()=>l,"ensureSuspenseTimers",()=>u,"fetchOptimistic",()=>h,"shouldSuspend",()=>d,"willFetch",()=>c],54440),e.s(["useBaseQuery",()=>f],69637)},67191,e=>{e.v({Label:"FloatingLabel-module__8y09Ka__Label"})},89887,60099,e=>{"use strict";let t,r;var i=e.i(43476),s=e.i(932),n=e.i(71645),a=e.i(90072),o=e.i(71753),l=e.i(31067),u=e.i(88014),c=e.i(15080);let d=new a.Vector3,h=new a.Vector3,f=new a.Vector3,m=new a.Vector2;function p(e,t,r){let i=d.setFromMatrixPosition(e.matrixWorld);i.project(t);let s=r.width/2,n=r.height/2;return[i.x*s+s,-(i.y*n)+n]}let y=e=>1e-10>Math.abs(e)?0:e;function g(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=y(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let b=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>g(e,t)),v=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>g(e,r(t),"translate(-50%,-50%)")),S=n.forwardRef(({children:e,eps:t=.001,style:r,className:i,prepend:s,center:g,fullscreen:S,portal:x,distanceFactor:k,sprite:E=!1,transform:R=!1,occlude:C,onOcclude:O,castShadow:T,receiveShadow:F,material:w,geometry:I,zIndexRange:j=[0x1000037,0],calculatePosition:M=p,as:_="div",wrapperClass:P,pointerEvents:D="auto",...U},L)=>{let{gl:Q,camera:N,scene:A,size:B,raycaster:V,events:H,viewport:W}=(0,c.useThree)(),[q]=n.useState(()=>document.createElement(_)),z=n.useRef(null),G=n.useRef(null),$=n.useRef(0),K=n.useRef([0,0]),Y=n.useRef(null),J=n.useRef(null),Z=(null==x?void 0:x.current)||H.connected||Q.domElement.parentNode,X=n.useRef(null),ee=n.useRef(!1),et=n.useMemo(()=>{var e;return C&&"blending"!==C||Array.isArray(C)&&C.length&&(e=C[0])&&"object"==typeof e&&"current"in e},[C]);n.useLayoutEffect(()=>{let e=Q.domElement;C&&"blending"===C?(e.style.zIndex=`${Math.floor(j[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[C]),n.useLayoutEffect(()=>{if(G.current){let e=z.current=u.createRoot(q);if(A.updateMatrixWorld(),R)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=M(G.current,N,B);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Z&&(s?Z.prepend(q):Z.appendChild(q)),()=>{Z&&Z.removeChild(q),e.unmount()}}},[Z,R]),n.useLayoutEffect(()=>{P&&(q.className=P)},[P]);let er=n.useMemo(()=>R?{position:"absolute",top:0,left:0,width:B.width,height:B.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:g?"translate3d(-50%,-50%,0)":"none",...S&&{top:-B.height/2,left:-B.width/2,width:B.width,height:B.height},...r},[r,g,S,B,R]),ei=n.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);n.useLayoutEffect(()=>{var t,s;ee.current=!1,R?null==(t=z.current)||t.render(n.createElement("div",{ref:Y,style:er},n.createElement("div",{ref:J,style:ei},n.createElement("div",{ref:L,className:i,style:r,children:e})))):null==(s=z.current)||s.render(n.createElement("div",{ref:L,style:er,className:i,children:e}))});let es=n.useRef(!0);(0,o.useFrame)(e=>{if(G.current){N.updateMatrixWorld(),G.current.updateWorldMatrix(!0,!1);let e=R?K.current:M(G.current,N,B);if(R||Math.abs($.current-N.zoom)>t||Math.abs(K.current[0]-e[0])>t||Math.abs(K.current[1]-e[1])>t){var r;let t,i,s,n,o=(r=G.current,t=d.setFromMatrixPosition(r.matrixWorld),i=h.setFromMatrixPosition(N.matrixWorld),s=t.sub(i),n=N.getWorldDirection(f),s.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(C)?l=C.map(e=>e.current):"blending"!==C&&(l=[A]));let u=es.current;l?es.current=function(e,t,r,i){let s=d.setFromMatrixPosition(e.matrixWorld),n=s.clone();n.project(t),m.set(n.x,n.y),r.setFromCamera(m,t);let a=r.intersectObjects(i,!0);if(a.length){let e=a[0].distance;return s.distanceTo(r.ray.origin)({vertexShader:R?void 0:` + /* + This shader is from the THREE's SpriteMaterial. + We need to turn the backing plane into a Sprite + (make it always face the camera) if "transfrom" + is false. + */ + #include + + void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + // This is somewhat arbitrary, but it seems to work well + // Need to figure out how to derive this dynamically if it even matters + float size = 0.03; + + 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 ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + 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; + } + `,fragmentShader:` + void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } + `}),[R]);return n.createElement("group",(0,l.default)({},U,{ref:G}),C&&!et&&n.createElement("mesh",{castShadow:T,receiveShadow:F,ref:X},I||n.createElement("planeGeometry",null),w||n.createElement("shaderMaterial",{side:a.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",()=>S],60099);var x=e.i(67191);let k=[0,0,0],E=new a.Vector3,R=(0,n.memo)(function(e){let t,r,a,l=(0,s.c)(11),{children:u,color:c,position:d,opacity:h}=e,f=void 0===c?"white":c,m=void 0===d?k:d,p=void 0===h?"fadeWithDistance":h,y="fadeWithDistance"===p,g=(0,n.useRef)(null),[b,v]=(0,n.useState)(0!==p),R=(0,n.useRef)(null);return l[0]!==y||l[1]!==b||l[2]!==p?(t=e=>{var t,r,i;let s,{camera:n}=e,a=g.current;if(!a)return;a.getWorldPosition(E);let o=(t=E.x,r=E.y,i=E.z,-((t-(s=n.matrixWorld.elements)[12])*s[8])+-((r-s[13])*s[9])+-((i-s[14])*s[10])<0);if(y){let e=o?1/0:n.position.distanceTo(E),t=e<200;if(b!==t&&v(t),R.current&&t){let t=Math.max(0,Math.min(1,1-e/200));R.current.style.opacity=t.toString()}}else{let e=!o&&0!==p;b!==e&&v(e),R.current&&(R.current.style.opacity=p.toString())}},l[0]=y,l[1]=b,l[2]=p,l[3]=t):t=l[3],(0,o.useFrame)(t),l[4]!==u||l[5]!==f||l[6]!==b||l[7]!==m?(r=b?(0,i.jsx)(S,{position:m,center:!0,children:(0,i.jsx)("div",{ref:R,className:x.default.Label,style:{color:f},children:u})}):null,l[4]=u,l[5]=f,l[6]=b,l[7]=m,l[8]=r):r=l[8],l[9]!==r?(a=(0,i.jsx)("group",{ref:g,children:r}),l[9]=r,l[10]=a):a=l[10],a});e.s(["FloatingLabel",0,R],89887)},51434,e=>{"use strict";var t=e.i(43476),r=e.i(932),i=e.i(71645),s=e.i(15080),n=e.i(90072);let a=(0,i.createContext)(void 0);function o(e){let o,u,c,d,h=(0,r.c)(7),{children:f}=e,{camera:m}=(0,s.useThree)();h[0]===Symbol.for("react.memo_cache_sentinel")?(o={audioLoader:null,audioListener:null},h[0]=o):o=h[0];let[p,y]=(0,i.useState)(o);return h[1]!==m?(u=()=>{let e=new n.AudioLoader,t=m.children.find(l);t||(t=new n.AudioListener,m.add(t)),y({audioLoader:e,audioListener:t})},c=[m],h[1]=m,h[2]=u,h[3]=c):(u=h[2],c=h[3]),(0,i.useEffect)(u,c),h[4]!==p||h[5]!==f?(d=(0,t.jsx)(a.Provider,{value:p,children:f}),h[4]=p,h[5]=f,h[6]=d):d=h[6],d}function l(e){return e instanceof n.AudioListener}function u(){let e=(0,i.useContext)(a);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>o,"useAudio",()=>u])},13876,79473,43595,58647,30064,e=>{"use strict";var t=e.i(932),r=e.i(8155);let i=e=>(t,r,i)=>{let s=i.subscribe;return i.subscribe=(e,t,r)=>{let n=e;if(t){let s=(null==r?void 0:r.equalityFn)||Object.is,a=e(i.getState());n=r=>{let i=e(r);if(!s(a,i)){let e=a;t(a=i,e)}},(null==r?void 0:r.fireImmediately)&&t(a,a)}return s(n)},e(t,r,i)};e.s(["subscribeWithSelector",()=>i],79473);var s=e.i(66748);function n(e){let t=new Map;for(let r of e.state.datablocks.values()){if("tsshapeconstructor"!==r._class)continue;let e=r.baseshape;if("string"!=typeof e)continue;let i=e.toLowerCase(),s=i.replace(/\.dts$/i,"")+"_",n=new Map;for(let e=0;e<=127;e++){let t=r[`sequence${e}`];if("string"!=typeof t)continue;let i=t.indexOf(" ");if(-1===i)continue;let a=t.slice(0,i).toLowerCase(),o=t.slice(i+1).trim().toLowerCase();if(!o||!a.startsWith(s)||!a.endsWith(".dsq"))continue;let l=a.slice(s.length,-4);l&&n.set(o,l)}n.size>0&&t.set(i,n)}return t}function a(e,t,r){let i=new Map;for(let r of e){let e=t.clipAction(r);i.set(r.name.toLowerCase(),e)}if(r)for(let[e,t]of r){let r=i.get(t);r&&!i.has(e)&&i.set(e,r)}return i}function o(e){return e.toLowerCase()}function l(e){let t=o(e.trim());return t.startsWith("$")?t.slice(1):t}e.s(["buildSequenceAliasMap",()=>n,"getAliasedActions",()=>a],43595);let u={entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},c={runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},world:{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},playback:{recording:null,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:0,streamSnapshot:null},diagnostics:{eventCounts:{"object.created":0,"object.deleted":0,"field.changed":0,"method.called":0,"global.changed":0,"batch.flushed":0},recentEvents:[],maxRecentEvents:200,webglContextLost:!1,playbackEvents:[],maxPlaybackEvents:400,rendererSamples:[],maxRendererSamples:2400}},d=(0,r.createStore)()(i(e=>({...c,setRuntime(t){let r=function(e){let t={},r={},i={},s={};for(let r of e.state.objectsById.values())t[r._id]=0,r._name&&(i[o(r._name)]=r._id,r._isDatablock&&(s[o(r._name)]=r._id));for(let t of e.state.globals.keys())r[l(t)]=0;return{objectVersionById:t,globalVersionByName:r,objectIdsByName:i,datablockIdsByName:s}}(t),i=n(t);e(e=>({...e,runtime:{runtime:t,sequenceAliases:i,objectVersionById:r.objectVersionById,globalVersionByName:r.globalVersionByName,objectIdsByName:r.objectIdsByName,datablockIdsByName:r.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,r){0!==t.length&&e(e=>{let i={...e.runtime.objectVersionById},s={...e.runtime.globalVersionByName},n={...e.runtime.objectIdsByName},a={...e.runtime.datablockIdsByName},u={...e.diagnostics.eventCounts},c=[...e.diagnostics.recentEvents],d=e=>{null!=e&&(i[e]=(i[e]??0)+1)};for(let e of t){if(u[e.type]=(u[e.type]??0)+1,c.push(e),"object.created"===e.type){let t=e.object;if(d(e.objectId),t._name){let r=o(t._name);n[r]=e.objectId,t._isDatablock&&(a[r]=e.objectId)}d(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete i[e.objectId],t?._name){let e=o(t._name);delete n[e],t._isDatablock&&delete a[e]}d(t?._parent?._id);continue}if("field.changed"===e.type){d(e.objectId);continue}if("global.changed"===e.type){let t=l(e.name);s[t]=(s[t]??0)+1;continue}}let h=r?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);u["batch.flushed"]+=1,c.push({type:"batch.flushed",tick:h,events:t});let f=e.diagnostics.maxRecentEvents,m=c.length>f?c.slice(c.length-f):c;return{...e,runtime:{...e.runtime,objectVersionById:i,globalVersionByName:s,objectIdsByName:n,datablockIdsByName:a,lastRuntimeTick:h},diagnostics:{...e.diagnostics,eventCounts:u,recentEvents:m}}})},setDemoRecording(t){let r=Math.max(0,(t?.duration??0)*1e3),i=function(e=0){let t=Error().stack;if(!t)return null;let r=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return r.length>0?r.join(" <= "):null}(1);e(e=>{let s=e.playback.streamSnapshot,n=e.playback.recording,a={t:Date.now(),kind:"recording.set",message:"setDemoRecording invoked",playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:s?.entities.length??0,streamCameraMode:s?.camera?.mode??null,streamExhausted:s?.exhausted??!1,meta:{previousMissionName:n?.missionName??null,nextMissionName:t?.missionName??null,previousDurationSec:n?Number(n.duration.toFixed(3)):null,nextDurationSec:t?Number(t.duration.toFixed(3)):null,isNull:null==t,stack:i??"unavailable"}};return{...e,world:u,playback:{recording:t,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:r,streamSnapshot:null},diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[a],rendererSamples:[]}}})},setPlaybackTime(t){e(e=>{var r,i,s;let n=(r=t,i=0,s=e.playback.durationMs,r<0?0:r>s?s:r);return{...e,playback:{...e.playback,timeMs:n,frameCursor:n}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var r,i,s;let n=Number.isFinite(t)?(i=.01,s=16,(r=t)<.01?.01:r>16?16:r):1;e(e=>({...e,playback:{...e.playback,rate:n}}))},setPlaybackFrameCursor(t){let r=Number.isFinite(t)?t:0;e(e=>({...e,playback:{...e.playback,frameCursor:r}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))},setWebglContextLost(t){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:t}}))},recordPlaybackDiagnosticEvent(t){e(e=>{let r=e.playback.streamSnapshot,i={t:Date.now(),kind:t.kind,message:t.message,playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:r?.entities.length??0,streamCameraMode:r?.camera?.mode??null,streamExhausted:r?.exhausted??!1,meta:t.meta},s=[...e.diagnostics.playbackEvents,i],n=e.diagnostics.maxPlaybackEvents,a=s.length>n?s.slice(s.length-n):s;return{...e,diagnostics:{...e.diagnostics,playbackEvents:a}}})},appendRendererSample(t){e(e=>{let r=e.playback.streamSnapshot,i={t:t.t??Date.now(),playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:r?.entities.length??0,streamCameraMode:r?.camera?.mode??null,streamExhausted:r?.exhausted??!1,geometries:t.geometries,textures:t.textures,programs:t.programs,renderCalls:t.renderCalls,renderTriangles:t.renderTriangles,renderPoints:t.renderPoints,renderLines:t.renderLines,sceneObjects:t.sceneObjects,visibleSceneObjects:t.visibleSceneObjects,jsHeapUsed:t.jsHeapUsed,jsHeapTotal:t.jsHeapTotal,jsHeapLimit:t.jsHeapLimit},s=[...e.diagnostics.rendererSamples,i],n=e.diagnostics.maxRendererSamples,a=s.length>n?s.slice(s.length-n):s;return{...e,diagnostics:{...e.diagnostics,rendererSamples:a}}})},clearPlaybackDiagnostics(){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[],rendererSamples:[]}}))}})));function h(){return d}function f(e,t){return(0,s.useStoreWithEqualityFn)(d,e,t)}function m(e){let r,i,s,n=(0,t.c)(7),a=f(p);n[0]!==e?(r=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,n[0]=e,n[1]=r):r=n[1];let o=f(r);if(null==e||!a||-1===o)return;n[2]!==e||n[3]!==a.state.objectsById?(i=a.state.objectsById.get(e),n[2]=e,n[3]=a.state.objectsById,n[4]=i):i=n[4];let l=i;return n[5]!==l?(s=l?{...l}:void 0,n[5]=l,n[6]=s):s=n[6],s}function p(e){return e.runtime.runtime}function y(e){let r,i,s,n,a,l=(0,t.c)(11),u=f(g);l[0]!==e?(r=e?o(e):"",l[0]=e,l[1]=r):r=l[1];let c=r;l[2]!==c?(i=e=>c?e.runtime.objectIdsByName[c]:void 0,l[2]=c,l[3]=i):i=l[3];let d=f(i);l[4]!==d?(s=e=>null==d?-1:e.runtime.objectVersionById[d]??-1,l[4]=d,l[5]=s):s=l[5];let h=f(s);if(!u||!c||null==d||-1===h)return;l[6]!==d||l[7]!==u.state.objectsById?(n=u.state.objectsById.get(d),l[6]=d,l[7]=u.state.objectsById,l[8]=n):n=l[8];let m=n;return l[9]!==m?(a=m?{...m}:void 0,l[9]=m,l[10]=a):a=l[10],a}function g(e){return e.runtime.runtime}function b(e){let r,i,s,n,a,l=(0,t.c)(11),u=f(v);l[0]!==e?(r=e?o(e):"",l[0]=e,l[1]=r):r=l[1];let c=r;l[2]!==c?(i=e=>c?e.runtime.datablockIdsByName[c]:void 0,l[2]=c,l[3]=i):i=l[3];let d=f(i);l[4]!==d?(s=e=>null==d?-1:e.runtime.objectVersionById[d]??-1,l[4]=d,l[5]=s):s=l[5];let h=f(s);if(!u||!c||null==d||-1===h)return;l[6]!==d||l[7]!==u.state.objectsById?(n=u.state.objectsById.get(d),l[6]=d,l[7]=u.state.objectsById,l[8]=n):n=l[8];let m=n;return l[9]!==m?(a=m?{...m}:void 0,l[9]=m,l[10]=a):a=l[10],a}function v(e){return e.runtime.runtime}function S(e,r){let i,s,n,a,o=(0,t.c)(13);o[0]!==r?(i=void 0===r?[]:r,o[0]=r,o[1]=i):i=o[1];let l=i,u=f(R);o[2]!==e?(s=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,o[2]=e,o[3]=s):s=o[3];let c=f(s);if(null==e){let e;return o[4]!==l?(e=l.map(E),o[4]=l,o[5]=e):e=o[5],e}if(!u||-1===c){let e;return o[6]!==l?(e=l.map(k),o[6]=l,o[7]=e):e=o[7],e}let d=u.state.objectsById;if(o[8]!==e||o[9]!==u.state.objectsById){a=Symbol.for("react.early_return_sentinel");e:{let t=d.get(e);if(!t?._children){let e;o[12]===Symbol.for("react.memo_cache_sentinel")?(e=[],o[12]=e):e=o[12],a=e;break e}n=t._children.map(x)}o[8]=e,o[9]=u.state.objectsById,o[10]=n,o[11]=a}else n=o[10],a=o[11];return a!==Symbol.for("react.early_return_sentinel")?a:n}function x(e){return e._id}function k(e){return e._id}function E(e){return e._id}function R(e){return e.runtime.runtime}e.s(["engineStore",0,d,"useDatablockByName",()=>b,"useEngineSelector",()=>f,"useEngineStoreApi",()=>h,"useRuntimeChildIds",()=>S,"useRuntimeObjectById",()=>m,"useRuntimeObjectByName",()=>y],58647);let C={maxRuntimeEvents:80,maxPlaybackEvents:200,maxRendererSamples:1200,maxStreamEntities:40};function O(e){return e&&"object"==typeof e?{kind:"TorqueObject",id:"number"==typeof e._id?e._id:null,className:"string"==typeof e._className?e._className:null,class:"string"==typeof e._class?e._class:null,name:"string"==typeof e._name?e._name:null,isDatablock:!!e._isDatablock,parentId:e._parent&&"number"==typeof e._parent._id?e._parent._id:null,childCount:Array.isArray(e._children)?e._children.length:0}:null}function T(e,t={}){let r,i,s,n={...C,...t},a=(r=new WeakSet,function e(t,i=0){if(null==t)return t;let s=typeof t;if("string"===s||"number"===s||"boolean"===s)return t;if("bigint"===s)return t.toString();if("function"===s)return`[Function ${t.name||"anonymous"}]`;if("object"!==s)return String(t);if("_id"in t&&"_className"in t)return O(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){if(i>=2)return{kind:"Array",length:t.length};let r=t.slice(0,8).map(t=>e(t,i+1));return{kind:"Array",length:t.length,sample:r}}if(r.has(t))return"[Circular]";if(r.add(t),i>=2)return{kind:t?.constructor?.name??"Object"};let n=Object.keys(t).slice(0,12),a={};for(let r of n)try{a[r]=e(t[r],i+1)}catch(e){a[r]=`[Unserializable: ${e.message}]`}return Object.keys(t).length>n.length&&(a.__truncatedKeys=Object.keys(t).length-n.length),a}),o=e.diagnostics.recentEvents.slice(-n.maxRuntimeEvents).map(e=>(function(e,t){if("object.created"===e.type||"object.deleted"===e.type)return{type:e.type,objectId:e.objectId,object:O(e.object)};if("field.changed"===e.type)return{type:e.type,objectId:e.objectId,field:e.field,value:t(e.value),previousValue:t(e.previousValue),object:O(e.object)};if("method.called"===e.type)return{type:e.type,className:e.className,methodName:e.methodName,objectId:e.objectId??null,args:t(e.args)};if("global.changed"===e.type)return{type:e.type,name:e.name,value:t(e.value),previousValue:t(e.previousValue)};if("batch.flushed"===e.type){let t={};for(let r of e.events)t[r.type]=(t[r.type]??0)+1;return{type:e.type,tick:e.tick,eventCount:e.events.length,byType:t}}return{type:"unknown"}})(e,a)),l=e.diagnostics.playbackEvents.slice(-n.maxPlaybackEvents).map(e=>({...e,meta:e.meta?a(e.meta):void 0})),u=e.diagnostics.rendererSamples.slice(-n.maxRendererSamples);return{generatedAt:new Date().toISOString(),playback:{status:e.playback.status,timeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,rate:e.playback.rate,durationMs:e.playback.durationMs,recording:(i=e.playback.recording)?{duration:i.duration,missionName:i.missionName,gameType:i.gameType,hasStreamingPlayback:!!i.streamingPlayback}:null,streamSnapshot:function(e,t){let r=e.playback.streamSnapshot;if(!r)return null;let i={},s={};for(let e of r.entities){let t=e.type||"Unknown";i[t]=(i[t]??0)+1,e.visual?.kind&&(s[e.visual.kind]=(s[e.visual.kind]??0)+1)}let n=r.entities.slice(0,t).map(e=>({id:e.id,type:e.type,dataBlock:e.dataBlock??null,className:e.className??null,ghostIndex:e.ghostIndex??null,dataBlockId:e.dataBlockId??null,shapeHint:e.shapeHint??null,visualKind:e.visual?.kind??null,hasPosition:!!e.position,hasRotation:!!e.rotation}));return{timeSec:r.timeSec,exhausted:r.exhausted,cameraMode:r.camera?.mode??null,controlEntityId:r.camera?.controlEntityId??null,orbitTargetId:r.camera?.orbitTargetId??null,controlPlayerGhostId:r.controlPlayerGhostId??null,entityCount:r.entities.length,entitiesByType:i,visualsByKind:s,entitySample:n,status:r.status}}(e,n.maxStreamEntities)},runtime:(s=e.runtime.runtime)?{lastRuntimeTick:e.runtime.lastRuntimeTick,objectCount:s.state.objectsById.size,datablockCount:s.state.datablocks.size,globalCount:s.state.globals.size,activePackageCount:s.state.activePackages.length,executedScriptCount:s.state.executedScripts.size,failedScriptCount:s.state.failedScripts.size}:null,diagnostics:{webglContextLost:e.diagnostics.webglContextLost,eventCounts:e.diagnostics.eventCounts,playbackEventCount:e.diagnostics.playbackEvents.length,rendererSampleCount:e.diagnostics.rendererSamples.length,runtimeEventCount:e.diagnostics.recentEvents.length,playbackEventsByKind:function(e){let t={};for(let r of e)t[r.kind]=(t[r.kind]??0)+1;return t}(e.diagnostics.playbackEvents),rendererTrend:function(e){if(e.length<2)return null;let t=e[0],r=e[e.length-1];return{sampleCount:e.length,durationSec:Number(((r.t-t.t)/1e3).toFixed(3)),geometriesDelta:r.geometries-t.geometries,texturesDelta:r.textures-t.textures,programsDelta:r.programs-t.programs,sceneObjectsDelta:r.sceneObjects-t.sceneObjects,visibleSceneObjectsDelta:r.visibleSceneObjects-t.visibleSceneObjects,renderCallsDelta:r.renderCalls-t.renderCalls}}(u),playbackEvents:l,rendererSamples:u,runtimeEvents:o}}}function F(e,t={}){return JSON.stringify(T(e,t),null,2)}e.s(["buildSerializableDiagnosticsJson",()=>F,"buildSerializableDiagnosticsSnapshot",()=>T],30064),e.s([],13876)},6112,e=>{"use strict";e.i(13876);var t=e.i(58647);function r(e){return(0,t.useDatablockByName)(e)}e.s(["useDatablock",()=>r])},61921,e=>{e.v(t=>Promise.all(["static/chunks/e94d845cf5e83dd7.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/8c435435e00c1d09.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/13f8b467e8aa89cb.js"].map(t=>e.l(t))).then(()=>t(42585)))},84968,e=>{e.v(t=>Promise.all(["static/chunks/6e9a6efec350bf8d.js"].map(t=>e.l(t))).then(()=>t(90208)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/0be79f7f5e0597a7.css","static/chunks/1cf33c843f96e1c9.js"].map(t=>e.l(t))).then(()=>t(94247)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/c339a594c158eab3.js b/docs/_next/static/chunks/c339a594c158eab3.js deleted file mode 100644 index 13e0ff20..00000000 --- a/docs/_next/static/chunks/c339a594c158eab3.js +++ /dev/null @@ -1,211 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47071,971,e=>{"use strict";var t=e.i(71645),a=e.i(90072),r=e.i(73949),i=e.i(91037);e.s(["useLoader",()=>i.G],971);var i=i;let n=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function o(e,o){let l=(0,r.useThree)(e=>e.gl),s=(0,i.G)(a.TextureLoader,n(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==o||o(s)},[o]),(0,t.useEffect)(()=>{if("initTexture"in l){let e=[];Array.isArray(s)?e=s:s instanceof a.Texture?e=[s]:n(s)&&(e=Object.values(s)),e.forEach(e=>{e instanceof a.Texture&&l.initTexture(e)})}},[l,s]),(0,t.useMemo)(()=>{if(!n(e))return s;{let t={},a=0;for(let r in e)t[r]=s[a++];return t}},[e,s])}o.preload=e=>i.G.preload(a.TextureLoader,e),o.clear=e=>i.G.clear(a.TextureLoader,e),e.s(["useTexture",()=>o],47071)},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},75567,e=>{"use strict";var t=e.i(90072);function a(e,r={}){let{repeat:i=[1,1],disableMipmaps:n=!1}=r;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...i),e.flipY=!1,e.anisotropy=16,n?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function r(e){let a=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return a.colorSpace=t.NoColorSpace,a.wrapS=a.wrapT=t.RepeatWrapping,a.generateMipmaps=!1,a.minFilter=t.LinearFilter,a.magFilter=t.LinearFilter,a.needsUpdate=!0,a}e.s(["setupMask",()=>r,"setupTexture",()=>a])},47021,e=>{"use strict";var t=e.i(8560);let a=` -#ifdef USE_FOG - // Check fog enabled uniform - allows toggling without shader recompilation - #ifdef USE_VOLUMETRIC_FOG - if (!fogEnabled) { - // Skip all fog calculations when disabled - } else { - #endif - - float dist = vFogDepth; - - // Discard fragments at or beyond visible distance - matches Torque's behavior - // where objects beyond visibleDistance are not rendered at all. - // This prevents fully-fogged geometry from showing as silhouettes against - // the sky's fog-to-sky gradient. - if (dist >= fogFar) { - discard; - } - - // Step 1: Calculate distance-based haze (quadratic falloff) - // Since we discard at fogFar, haze never reaches 1.0 here - float haze = 0.0; - if (dist > fogNear) { - float fogScale = 1.0 / (fogFar - fogNear); - float distFactor = (dist - fogNear) * fogScale - 1.0; - haze = 1.0 - distFactor * distFactor; - } - - // Step 2: Calculate fog volume contributions - // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) - // All fog uses the global fogColor - see Tribes2_Fog_System.md for details - float volumeFog = 0.0; - - #ifdef USE_VOLUMETRIC_FOG - { - #ifdef USE_FOG_WORLD_POSITION - float fragmentHeight = vFogWorldPosition.y; - #else - float fragmentHeight = cameraHeight; - #endif - - float deltaY = fragmentHeight - cameraHeight; - float absDeltaY = abs(deltaY); - - // Determine if we're going up (positive) or down (negative) - if (absDeltaY > 0.01) { - // Non-horizontal ray: ray-march through fog volumes - for (int i = 0; i < 3; i++) { - int offset = i * 4; - float volVisDist = fogVolumeData[offset + 0]; - float volMinH = fogVolumeData[offset + 1]; - float volMaxH = fogVolumeData[offset + 2]; - float volPct = fogVolumeData[offset + 3]; - - // Skip inactive volumes (visibleDistance = 0) - if (volVisDist <= 0.0) continue; - - // Calculate fog factor for this volume - // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage - // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) - // Since we don't have quality settings, we use visFactor = 1.0 - float factor = (1.0 / volVisDist) * volPct; - - // Find ray intersection with this volume's height range - float rayMinY = min(cameraHeight, fragmentHeight); - float rayMaxY = max(cameraHeight, fragmentHeight); - - // Check if ray intersects volume height range - if (rayMinY < volMaxH && rayMaxY > volMinH) { - float intersectMin = max(rayMinY, volMinH); - float intersectMax = min(rayMaxY, volMaxH); - float intersectHeight = intersectMax - intersectMin; - - // Calculate distance traveled through this volume using similar triangles: - // subDist / dist = intersectHeight / absDeltaY - float subDist = dist * (intersectHeight / absDeltaY); - - // Accumulate fog: fog += subDist * factor - volumeFog += subDist * factor; - } - } - } else { - // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume - for (int i = 0; i < 3; i++) { - int offset = i * 4; - float volVisDist = fogVolumeData[offset + 0]; - float volMinH = fogVolumeData[offset + 1]; - float volMaxH = fogVolumeData[offset + 2]; - float volPct = fogVolumeData[offset + 3]; - - if (volVisDist <= 0.0) continue; - - // If camera is inside this volume, apply fog for full distance - if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { - float factor = (1.0 / volVisDist) * volPct; - volumeFog += dist * factor; - } - } - } - } - #endif - - // Step 3: Combine haze and volume fog - // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct - // This gives fog volumes priority over haze - float volPct = min(volumeFog, 1.0); - float hazePct = haze; - if (volPct + hazePct > 1.0) { - hazePct = 1.0 - volPct; - } - float fogFactor = hazePct + volPct; - - // Apply fog using global fogColor (per-volume colors not used in Tribes 2) - gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); - - #ifdef USE_VOLUMETRIC_FOG - } // end fogEnabled check - #endif -#endif -`;function r(){t.ShaderChunk.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 - - // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) - // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats - #ifdef USE_VOLUMETRIC_FOG - uniform float fogVolumeData[12]; - uniform float cameraHeight; - #endif - - #ifdef USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; - #endif -#endif -`,t.ShaderChunk.fog_fragment=a,t.ShaderChunk.fog_pars_vertex=` -#ifdef USE_FOG - varying float vFogDepth; - #ifdef USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; - #endif -#endif -`,t.ShaderChunk.fog_vertex=` -#ifdef USE_FOG - // Use Euclidean distance from camera, not view-space z-depth - // This ensures fog doesn't change when rotating the camera - vFogDepth = length(mvPosition.xyz); - #ifdef USE_FOG_WORLD_POSITION - vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; - #endif -#endif -`}function i(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.uniforms.fogEnabled=t.fogEnabled,e.vertexShader=e.vertexShader.replace("#include ",`#include -#ifdef USE_FOG - #define USE_FOG_WORLD_POSITION - #define USE_VOLUMETRIC_FOG - varying vec3 vFogWorldPosition; -#endif`),e.vertexShader=e.vertexShader.replace("#include ",`#include -#ifdef USE_FOG - vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; -#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include -#ifdef USE_FOG - #define USE_VOLUMETRIC_FOG - uniform float fogVolumeData[12]; - uniform float cameraHeight; - uniform bool fogEnabled; - #define USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; -#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",a)}e.s(["fogFragmentShader",0,a,"injectCustomFog",()=>i,"installCustomFogShader",()=>r])},48066,e=>{"use strict";let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0},fogEnabled:{value:!0}};function a(e,r,i=!0){t.cameraHeight.value=e,t.fogVolumeData.value.set(r),t.fogEnabled.value=i}function r(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0),t.fogEnabled.value=!0}function i(e){let t=new Float32Array(12);for(let a=0;a<3;a++){let r=4*a,i=e[a];i&&(t[r+0]=i.visibleDistance,t[r+1]=i.minHeight,t[r+2]=i.maxHeight,t[r+3]=i.percentage)}return t}e.s(["globalFogUniforms",0,t,"packFogVolumeData",()=>i,"resetGlobalFogUniforms",()=>r,"updateGlobalFogUniforms",()=>a])},67191,e=>{e.v({Label:"FloatingLabel-module__8y09Ka__Label"})},89887,60099,e=>{"use strict";let t,a;var r=e.i(43476),i=e.i(932),n=e.i(71645),o=e.i(90072),l=e.i(49774),s=e.i(31067),c=e.i(88014),u=e.i(73949);let d=new o.Vector3,f=new o.Vector3,m=new o.Vector3,g=new o.Vector2;function p(e,t,a){let r=d.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=a.width/2,n=a.height/2;return[r.x*i+i,-(r.y*n)+n]}let h=e=>1e-10>Math.abs(e)?0:e;function y(e,t,a=""){let r="matrix3d(";for(let a=0;16!==a;a++)r+=h(t[a]*e.elements[a])+(15!==a?",":")");return a+r}let b=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>y(e,t)),v=(a=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>y(e,a(t),"translate(-50%,-50%)")),x=n.forwardRef(({children:e,eps:t=.001,style:a,className:r,prepend:i,center:y,fullscreen:x,portal:k,distanceFactor:S,sprite:_=!1,transform:j=!1,occlude:M,onOcclude:E,castShadow:P,receiveShadow:F,material:C,geometry:I,zIndexRange:O=[0x1000037,0],calculatePosition:D=p,as:T="div",wrapperClass:w,pointerEvents:N="auto",...R},B)=>{let{gl:V,camera:L,scene:H,size:W,raycaster:U,events:z,viewport:A}=(0,u.useThree)(),[G]=n.useState(()=>document.createElement(T)),$=n.useRef(null),Y=n.useRef(null),q=n.useRef(0),K=n.useRef([0,0]),J=n.useRef(null),X=n.useRef(null),Z=(null==k?void 0:k.current)||z.connected||V.domElement.parentNode,Q=n.useRef(null),ee=n.useRef(!1),et=n.useMemo(()=>{var e;return M&&"blending"!==M||Array.isArray(M)&&M.length&&(e=M[0])&&"object"==typeof e&&"current"in e},[M]);n.useLayoutEffect(()=>{let e=V.domElement;M&&"blending"===M?(e.style.zIndex=`${Math.floor(O[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[M]),n.useLayoutEffect(()=>{if(Y.current){let e=$.current=c.createRoot(G);if(H.updateMatrixWorld(),j)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=D(Y.current,L,W);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Z&&(i?Z.prepend(G):Z.appendChild(G)),()=>{Z&&Z.removeChild(G),e.unmount()}}},[Z,j]),n.useLayoutEffect(()=>{w&&(G.className=w)},[w]);let ea=n.useMemo(()=>j?{position:"absolute",top:0,left:0,width:W.width,height:W.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:y?"translate3d(-50%,-50%,0)":"none",...x&&{top:-W.height/2,left:-W.width/2,width:W.width,height:W.height},...a},[a,y,x,W,j]),er=n.useMemo(()=>({position:"absolute",pointerEvents:N}),[N]);n.useLayoutEffect(()=>{var t,i;ee.current=!1,j?null==(t=$.current)||t.render(n.createElement("div",{ref:J,style:ea},n.createElement("div",{ref:X,style:er},n.createElement("div",{ref:B,className:r,style:a,children:e})))):null==(i=$.current)||i.render(n.createElement("div",{ref:B,style:ea,className:r,children:e}))});let ei=n.useRef(!0);(0,l.useFrame)(e=>{if(Y.current){L.updateMatrixWorld(),Y.current.updateWorldMatrix(!0,!1);let e=j?K.current:D(Y.current,L,W);if(j||Math.abs(q.current-L.zoom)>t||Math.abs(K.current[0]-e[0])>t||Math.abs(K.current[1]-e[1])>t){var a;let t,r,i,n,l=(a=Y.current,t=d.setFromMatrixPosition(a.matrixWorld),r=f.setFromMatrixPosition(L.matrixWorld),i=t.sub(r),n=L.getWorldDirection(m),i.angleTo(n)>Math.PI/2),s=!1;et&&(Array.isArray(M)?s=M.map(e=>e.current):"blending"!==M&&(s=[H]));let c=ei.current;s?ei.current=function(e,t,a,r){let i=d.setFromMatrixPosition(e.matrixWorld),n=i.clone();n.project(t),g.set(n.x,n.y),a.setFromCamera(g,t);let o=a.intersectObjects(r,!0);if(o.length){let e=o[0].distance;return i.distanceTo(a.ray.origin)({vertexShader:j?void 0:` - /* - This shader is from the THREE's SpriteMaterial. - We need to turn the backing plane into a Sprite - (make it always face the camera) if "transfrom" - is false. - */ - #include - - void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - // This is somewhat arbitrary, but it seems to work well - // Need to figure out how to derive this dynamically if it even matters - float size = 0.03; - - 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 ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - 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; - } - `,fragmentShader:` - void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } - `}),[j]);return n.createElement("group",(0,s.default)({},R,{ref:Y}),M&&!et&&n.createElement("mesh",{castShadow:P,receiveShadow:F,ref:Q},I||n.createElement("planeGeometry",null),C||n.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",()=>x],60099);var k=e.i(67191);let S=[0,0,0],_=new o.Vector3,j=(0,n.memo)(function(e){let t,a,o,s=(0,i.c)(11),{children:c,color:u,position:d,opacity:f}=e,m=void 0===u?"white":u,g=void 0===d?S:d,p=void 0===f?"fadeWithDistance":f,h="fadeWithDistance"===p,y=(0,n.useRef)(null),[b,v]=(0,n.useState)(0!==p),j=(0,n.useRef)(null);return s[0]!==h||s[1]!==b||s[2]!==p?(t=e=>{var t,a,r;let i,{camera:n}=e,o=y.current;if(!o)return;o.getWorldPosition(_);let l=(t=_.x,a=_.y,r=_.z,-((t-(i=n.matrixWorld.elements)[12])*i[8])+-((a-i[13])*i[9])+-((r-i[14])*i[10])<0);if(h){let e=l?1/0:n.position.distanceTo(_),t=e<200;if(b!==t&&v(t),j.current&&t){let t=Math.max(0,Math.min(1,1-e/200));j.current.style.opacity=t.toString()}}else{let e=!l&&0!==p;b!==e&&v(e),j.current&&(j.current.style.opacity=p.toString())}},s[0]=h,s[1]=b,s[2]=p,s[3]=t):t=s[3],(0,l.useFrame)(t),s[4]!==c||s[5]!==m||s[6]!==b||s[7]!==g?(a=b?(0,r.jsx)(x,{position:g,center:!0,children:(0,r.jsx)("div",{ref:j,className:k.default.Label,style:{color:m},children:c})}):null,s[4]=c,s[5]=m,s[6]=b,s[7]=g,s[8]=a):a=s[8],s[9]!==a?(o=(0,r.jsx)("group",{ref:y,children:a}),s[9]=a,s[10]=o):o=s[10],o});e.s(["FloatingLabel",0,j],89887)},51434,e=>{"use strict";var t=e.i(43476),a=e.i(932),r=e.i(71645),i=e.i(73949),n=e.i(90072);let o=(0,r.createContext)(void 0);function l(e){let l,c,u,d,f=(0,a.c)(7),{children:m}=e,{camera:g}=(0,i.useThree)();f[0]===Symbol.for("react.memo_cache_sentinel")?(l={audioLoader:null,audioListener:null},f[0]=l):l=f[0];let[p,h]=(0,r.useState)(l);return f[1]!==g?(c=()=>{let e=new n.AudioLoader,t=g.children.find(s);t||(t=new n.AudioListener,g.add(t)),h({audioLoader:e,audioListener:t})},u=[g],f[1]=g,f[2]=c,f[3]=u):(c=f[2],u=f[3]),(0,r.useEffect)(c,u),f[4]!==p||f[5]!==m?(d=(0,t.jsx)(o.Provider,{value:p,children:m}),f[4]=p,f[5]=m,f[6]=d):d=f[6],d}function s(e){return e instanceof n.AudioListener}function c(){let e=(0,r.useContext)(o);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>l,"useAudio",()=>c])},6112,79473,58647,30064,13876,e=>{"use strict";var t=e.i(932),a=e.i(8155);let r=e=>(t,a,r)=>{let i=r.subscribe;return r.subscribe=(e,t,a)=>{let n=e;if(t){let i=(null==a?void 0:a.equalityFn)||Object.is,o=e(r.getState());n=a=>{let r=e(a);if(!i(o,r)){let e=o;t(o=r,e)}},(null==a?void 0:a.fireImmediately)&&t(o,o)}return i(n)},e(t,a,r)};e.s(["subscribeWithSelector",()=>r],79473);var i=e.i(66748);function n(e){return e.toLowerCase()}function o(e){let t=n(e.trim());return t.startsWith("$")?t.slice(1):t}let l={runtime:{runtime:null,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},world:{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},playback:{recording:null,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:0,streamSnapshot:null},diagnostics:{eventCounts:{"object.created":0,"object.deleted":0,"field.changed":0,"method.called":0,"global.changed":0,"batch.flushed":0},recentEvents:[],maxRecentEvents:200,webglContextLost:!1,playbackEvents:[],maxPlaybackEvents:400,rendererSamples:[],maxRendererSamples:2400}},s=(0,a.createStore)()(r(e=>({...l,setRuntime(t){let a=function(e){let t={},a={},r={},i={};for(let a of e.state.objectsById.values())t[a._id]=0,a._name&&(r[n(a._name)]=a._id,a._isDatablock&&(i[n(a._name)]=a._id));for(let t of e.state.globals.keys())a[o(t)]=0;return{objectVersionById:t,globalVersionByName:a,objectIdsByName:r,datablockIdsByName:i}}(t);e(e=>({...e,runtime:{runtime:t,objectVersionById:a.objectVersionById,globalVersionByName:a.globalVersionByName,objectIdsByName:a.objectIdsByName,datablockIdsByName:a.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,a){0!==t.length&&e(e=>{let r={...e.runtime.objectVersionById},i={...e.runtime.globalVersionByName},l={...e.runtime.objectIdsByName},s={...e.runtime.datablockIdsByName},c={...e.diagnostics.eventCounts},u=[...e.diagnostics.recentEvents],d=e=>{null!=e&&(r[e]=(r[e]??0)+1)};for(let e of t){if(c[e.type]=(c[e.type]??0)+1,u.push(e),"object.created"===e.type){let t=e.object;if(d(e.objectId),t._name){let a=n(t._name);l[a]=e.objectId,t._isDatablock&&(s[a]=e.objectId)}d(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete r[e.objectId],t?._name){let e=n(t._name);delete l[e],t._isDatablock&&delete s[e]}d(t?._parent?._id);continue}if("field.changed"===e.type){d(e.objectId);continue}if("global.changed"===e.type){let t=o(e.name);i[t]=(i[t]??0)+1;continue}}let f=a?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);c["batch.flushed"]+=1,u.push({type:"batch.flushed",tick:f,events:t});let m=e.diagnostics.maxRecentEvents,g=u.length>m?u.slice(u.length-m):u;return{...e,runtime:{...e.runtime,objectVersionById:r,globalVersionByName:i,objectIdsByName:l,datablockIdsByName:s,lastRuntimeTick:f},diagnostics:{...e.diagnostics,eventCounts:c,recentEvents:g}}})},setDemoRecording(t){let a=Math.max(0,(t?.duration??0)*1e3),r=function(e=0){let t=Error().stack;if(!t)return null;let a=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return a.length>0?a.join(" <= "):null}(1);e(e=>{let i=e.playback.streamSnapshot,n=e.playback.recording,o={t:Date.now(),kind:"recording.set",message:"setDemoRecording invoked",playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:i?.entities.length??0,streamCameraMode:i?.camera?.mode??null,streamExhausted:i?.exhausted??!1,meta:{previousMissionName:n?.missionName??null,nextMissionName:t?.missionName??null,previousDurationSec:n?Number(n.duration.toFixed(3)):null,nextDurationSec:t?Number(t.duration.toFixed(3)):null,isNull:null==t,isMetadataOnly:!!t?.isMetadataOnly,isPartial:!!t?.isPartial,hasStreamingPlayback:!!t?.streamingPlayback,stack:r??"unavailable"}};return{...e,world:function(e){if(!e)return{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}};let t={},a=[],r=[],i=[],n=[];for(let o of e.entities){let e=String(o.id);t[e]=o;let l=o.type.toLowerCase();if("player"===l){a.push(e),e.startsWith("player_")&&r.push(e);continue}if("projectile"===l){i.push(e);continue}(o.dataBlock?.toLowerCase()==="flag"||o.dataBlock?.toLowerCase().includes("flag"))&&n.push(e)}return{entitiesById:t,players:a,ghosts:r,projectiles:i,flags:n,teams:{},scores:{}}}(t),playback:{recording:t,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:a,streamSnapshot:null},diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[o],rendererSamples:[]}}})},setPlaybackTime(t){e(e=>{var a,r,i;let n=(a=t,r=0,i=e.playback.durationMs,a<0?0:a>i?i:a);return{...e,playback:{...e.playback,timeMs:n,frameCursor:n}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var a,r,i;let n=Number.isFinite(t)?(r=.01,i=16,(a=t)<.01?.01:a>16?16:a):1;e(e=>({...e,playback:{...e.playback,rate:n}}))},setPlaybackFrameCursor(t){let a=Number.isFinite(t)?t:0;e(e=>({...e,playback:{...e.playback,frameCursor:a}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))},setWebglContextLost(t){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:t}}))},recordPlaybackDiagnosticEvent(t){e(e=>{let a=e.playback.streamSnapshot,r={t:Date.now(),kind:t.kind,message:t.message,playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:a?.entities.length??0,streamCameraMode:a?.camera?.mode??null,streamExhausted:a?.exhausted??!1,meta:t.meta},i=[...e.diagnostics.playbackEvents,r],n=e.diagnostics.maxPlaybackEvents,o=i.length>n?i.slice(i.length-n):i;return{...e,diagnostics:{...e.diagnostics,playbackEvents:o}}})},appendRendererSample(t){e(e=>{let a=e.playback.streamSnapshot,r={t:t.t??Date.now(),playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:a?.entities.length??0,streamCameraMode:a?.camera?.mode??null,streamExhausted:a?.exhausted??!1,geometries:t.geometries,textures:t.textures,programs:t.programs,renderCalls:t.renderCalls,renderTriangles:t.renderTriangles,renderPoints:t.renderPoints,renderLines:t.renderLines,sceneObjects:t.sceneObjects,visibleSceneObjects:t.visibleSceneObjects,jsHeapUsed:t.jsHeapUsed,jsHeapTotal:t.jsHeapTotal,jsHeapLimit:t.jsHeapLimit},i=[...e.diagnostics.rendererSamples,r],n=e.diagnostics.maxRendererSamples,o=i.length>n?i.slice(i.length-n):i;return{...e,diagnostics:{...e.diagnostics,rendererSamples:o}}})},clearPlaybackDiagnostics(){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[],rendererSamples:[]}}))}})));function c(){return s}function u(e,t){return(0,i.useStoreWithEqualityFn)(s,e,t)}function d(e){let a,r,i,n=(0,t.c)(7),o=u(f);n[0]!==e?(a=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,n[0]=e,n[1]=a):a=n[1];let l=u(a);if(null==e||!o||-1===l)return;n[2]!==e||n[3]!==o.state.objectsById?(r=o.state.objectsById.get(e),n[2]=e,n[3]=o.state.objectsById,n[4]=r):r=n[4];let s=r;return n[5]!==s?(i=s?{...s}:void 0,n[5]=s,n[6]=i):i=n[6],i}function f(e){return e.runtime.runtime}function m(e){let a,r,i,o,l,s=(0,t.c)(11),c=u(g);s[0]!==e?(a=e?n(e):"",s[0]=e,s[1]=a):a=s[1];let d=a;s[2]!==d?(r=e=>d?e.runtime.objectIdsByName[d]:void 0,s[2]=d,s[3]=r):r=s[3];let f=u(r);s[4]!==f?(i=e=>null==f?-1:e.runtime.objectVersionById[f]??-1,s[4]=f,s[5]=i):i=s[5];let m=u(i);if(!c||!d||null==f||-1===m)return;s[6]!==f||s[7]!==c.state.objectsById?(o=c.state.objectsById.get(f),s[6]=f,s[7]=c.state.objectsById,s[8]=o):o=s[8];let p=o;return s[9]!==p?(l=p?{...p}:void 0,s[9]=p,s[10]=l):l=s[10],l}function g(e){return e.runtime.runtime}function p(e){let a,r,i,o,l,s=(0,t.c)(11),c=u(h);s[0]!==e?(a=e?n(e):"",s[0]=e,s[1]=a):a=s[1];let d=a;s[2]!==d?(r=e=>d?e.runtime.datablockIdsByName[d]:void 0,s[2]=d,s[3]=r):r=s[3];let f=u(r);s[4]!==f?(i=e=>null==f?-1:e.runtime.objectVersionById[f]??-1,s[4]=f,s[5]=i):i=s[5];let m=u(i);if(!c||!d||null==f||-1===m)return;s[6]!==f||s[7]!==c.state.objectsById?(o=c.state.objectsById.get(f),s[6]=f,s[7]=c.state.objectsById,s[8]=o):o=s[8];let g=o;return s[9]!==g?(l=g?{...g}:void 0,s[9]=g,s[10]=l):l=s[10],l}function h(e){return e.runtime.runtime}function y(e,a){let r,i,n,o,l=(0,t.c)(13);l[0]!==a?(r=void 0===a?[]:a,l[0]=a,l[1]=r):r=l[1];let s=r,c=u(k);l[2]!==e?(i=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,l[2]=e,l[3]=i):i=l[3];let d=u(i);if(null==e){let e;return l[4]!==s?(e=s.map(x),l[4]=s,l[5]=e):e=l[5],e}if(!c||-1===d){let e;return l[6]!==s?(e=s.map(v),l[6]=s,l[7]=e):e=l[7],e}let f=c.state.objectsById;if(l[8]!==e||l[9]!==c.state.objectsById){o=Symbol.for("react.early_return_sentinel");e:{let t=f.get(e);if(!t?._children){let e;l[12]===Symbol.for("react.memo_cache_sentinel")?(e=[],l[12]=e):e=l[12],o=e;break e}n=t._children.map(b)}l[8]=e,l[9]=c.state.objectsById,l[10]=n,l[11]=o}else n=l[10],o=l[11];return o!==Symbol.for("react.early_return_sentinel")?o:n}function b(e){return e._id}function v(e){return e._id}function x(e){return e._id}function k(e){return e.runtime.runtime}e.s(["engineStore",0,s,"useDatablockByName",()=>p,"useEngineSelector",()=>u,"useEngineStoreApi",()=>c,"useRuntimeChildIds",()=>y,"useRuntimeObjectById",()=>d,"useRuntimeObjectByName",()=>m],58647);let S={maxRuntimeEvents:80,maxPlaybackEvents:200,maxRendererSamples:1200,maxStreamEntities:40};function _(e){return e&&"object"==typeof e?{kind:"TorqueObject",id:"number"==typeof e._id?e._id:null,className:"string"==typeof e._className?e._className:null,class:"string"==typeof e._class?e._class:null,name:"string"==typeof e._name?e._name:null,isDatablock:!!e._isDatablock,parentId:e._parent&&"number"==typeof e._parent._id?e._parent._id:null,childCount:Array.isArray(e._children)?e._children.length:0}:null}function j(e,t={}){let a,r,i,n={...S,...t},o=(a=new WeakSet,function e(t,r=0){if(null==t)return t;let i=typeof t;if("string"===i||"number"===i||"boolean"===i)return t;if("bigint"===i)return t.toString();if("function"===i)return`[Function ${t.name||"anonymous"}]`;if("object"!==i)return String(t);if("_id"in t&&"_className"in t)return _(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){if(r>=2)return{kind:"Array",length:t.length};let a=t.slice(0,8).map(t=>e(t,r+1));return{kind:"Array",length:t.length,sample:a}}if(a.has(t))return"[Circular]";if(a.add(t),r>=2)return{kind:t?.constructor?.name??"Object"};let n=Object.keys(t).slice(0,12),o={};for(let a of n)try{o[a]=e(t[a],r+1)}catch(e){o[a]=`[Unserializable: ${e.message}]`}return Object.keys(t).length>n.length&&(o.__truncatedKeys=Object.keys(t).length-n.length),o}),l=e.diagnostics.recentEvents.slice(-n.maxRuntimeEvents).map(e=>(function(e,t){if("object.created"===e.type||"object.deleted"===e.type)return{type:e.type,objectId:e.objectId,object:_(e.object)};if("field.changed"===e.type)return{type:e.type,objectId:e.objectId,field:e.field,value:t(e.value),previousValue:t(e.previousValue),object:_(e.object)};if("method.called"===e.type)return{type:e.type,className:e.className,methodName:e.methodName,objectId:e.objectId??null,args:t(e.args)};if("global.changed"===e.type)return{type:e.type,name:e.name,value:t(e.value),previousValue:t(e.previousValue)};if("batch.flushed"===e.type){let t={};for(let a of e.events)t[a.type]=(t[a.type]??0)+1;return{type:e.type,tick:e.tick,eventCount:e.events.length,byType:t}}return{type:"unknown"}})(e,o)),s=e.diagnostics.playbackEvents.slice(-n.maxPlaybackEvents).map(e=>({...e,meta:e.meta?o(e.meta):void 0})),c=e.diagnostics.rendererSamples.slice(-n.maxRendererSamples);return{generatedAt:new Date().toISOString(),playback:{status:e.playback.status,timeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,rate:e.playback.rate,durationMs:e.playback.durationMs,recording:(r=e.playback.recording)?{duration:r.duration,missionName:r.missionName,gameType:r.gameType,isMetadataOnly:!!r.isMetadataOnly,isPartial:!!r.isPartial,hasStreamingPlayback:!!r.streamingPlayback,entitiesCount:r.entities.length,cameraModesCount:r.cameraModes.length,controlPlayerGhostId:r.controlPlayerGhostId??null}:null,streamSnapshot:function(e,t){let a=e.playback.streamSnapshot;if(!a)return null;let r={},i={};for(let e of a.entities){let t=e.type||"Unknown";r[t]=(r[t]??0)+1,e.visual?.kind&&(i[e.visual.kind]=(i[e.visual.kind]??0)+1)}let n=a.entities.slice(0,t).map(e=>({id:e.id,type:e.type,dataBlock:e.dataBlock??null,className:e.className??null,ghostIndex:e.ghostIndex??null,dataBlockId:e.dataBlockId??null,shapeHint:e.shapeHint??null,visualKind:e.visual?.kind??null,hasPosition:!!e.position,hasRotation:!!e.rotation}));return{timeSec:a.timeSec,exhausted:a.exhausted,cameraMode:a.camera?.mode??null,controlEntityId:a.camera?.controlEntityId??null,orbitTargetId:a.camera?.orbitTargetId??null,controlPlayerGhostId:a.controlPlayerGhostId??null,entityCount:a.entities.length,entitiesByType:r,visualsByKind:i,entitySample:n,status:a.status}}(e,n.maxStreamEntities)},runtime:(i=e.runtime.runtime)?{lastRuntimeTick:e.runtime.lastRuntimeTick,objectCount:i.state.objectsById.size,datablockCount:i.state.datablocks.size,globalCount:i.state.globals.size,activePackageCount:i.state.activePackages.length,executedScriptCount:i.state.executedScripts.size,failedScriptCount:i.state.failedScripts.size}:null,diagnostics:{webglContextLost:e.diagnostics.webglContextLost,eventCounts:e.diagnostics.eventCounts,playbackEventCount:e.diagnostics.playbackEvents.length,rendererSampleCount:e.diagnostics.rendererSamples.length,runtimeEventCount:e.diagnostics.recentEvents.length,playbackEventsByKind:function(e){let t={};for(let a of e)t[a.kind]=(t[a.kind]??0)+1;return t}(e.diagnostics.playbackEvents),rendererTrend:function(e){if(e.length<2)return null;let t=e[0],a=e[e.length-1];return{sampleCount:e.length,durationSec:Number(((a.t-t.t)/1e3).toFixed(3)),geometriesDelta:a.geometries-t.geometries,texturesDelta:a.textures-t.textures,programsDelta:a.programs-t.programs,sceneObjectsDelta:a.sceneObjects-t.sceneObjects,visibleSceneObjectsDelta:a.visibleSceneObjects-t.visibleSceneObjects,renderCallsDelta:a.renderCalls-t.renderCalls}}(c),playbackEvents:s,rendererSamples:c,runtimeEvents:l}}}function M(e,t={}){return JSON.stringify(j(e,t),null,2)}function E(e){return p(e)}e.s(["buildSerializableDiagnosticsJson",()=>M,"buildSerializableDiagnosticsSnapshot",()=>j],30064),e.s([],13876),e.s(["useDatablock",()=>E],6112)},61921,e=>{e.v(t=>Promise.all(["static/chunks/cb4089eec9313f48.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/b9c295cb642f6712.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/6e74e9455d83b68c.js"].map(t=>e.l(t))).then(()=>t(42585)))},84968,e=>{e.v(t=>Promise.all(["static/chunks/70bf3e06d5674fac.js"].map(t=>e.l(t))).then(()=>t(90208)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/0be79f7f5e0597a7.css","static/chunks/1cf33c843f96e1c9.js"].map(t=>e.l(t))).then(()=>t(94247)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/d1fcaa9fc5e053d9.js b/docs/_next/static/chunks/d1fcaa9fc5e053d9.js deleted file mode 100644 index 6b97ffda..00000000 --- a/docs/_next/static/chunks/d1fcaa9fc5e053d9.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68027,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return a}});let n=e.r(43476),o=e.r(12354),i={fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},u={fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"},a=function({error:e}){let t=e?.digest;return(0,n.jsxs)("html",{id:"__next_error__",children:[(0,n.jsx)("head",{}),(0,n.jsxs)("body",{children:[(0,n.jsx)(o.HandleISRError,{error:e}),(0,n.jsx)("div",{style:i,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("h2",{style:u,children:["Application error: a ",t?"server":"client","-side exception has occurred while loading ",window.location.hostname," (see the"," ",t?"server logs":"browser console"," for more information)."]}),t?(0,n.jsx)("p",{style:u,children:`Digest: ${t}`}):null]})})]})]})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},35451,(e,t,r)=>{var n={229:function(e){var t,r,n,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var l=[],s=!1,c=-1;function f(){s&&n&&(s=!1,n.length?l=n.concat(l):c=-1,l.length&&d())}function d(){if(!s){var e=a(f);s=!0;for(var t=l.length;t;){for(n=l,l=[];++c1)for(var r=1;r{"use strict";var n,o;t.exports=(null==(n=e.g.process)?void 0:n.env)&&"object"==typeof(null==(o=e.g.process)?void 0:o.env)?e.g.process:e.r(35451)},45689,(e,t,r)=>{"use strict";var n=Symbol.for("react.transitional.element");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}r.Fragment=Symbol.for("react.fragment"),r.jsx=o,r.jsxs=o},43476,(e,t,r)=>{"use strict";t.exports=e.r(45689)},50740,(e,t,r)=>{"use strict";var n=e.i(47167),o=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),_=Symbol.for("react.view_transition"),b=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function E(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||v}function S(){}function j(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||v}E.prototype.isReactComponent={},E.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},E.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=E.prototype;var O=j.prototype=new S;O.constructor=j,m(O,E.prototype),O.isPureReactComponent=!0;var w=Array.isArray;function P(){}var R={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function x(e,t,r){var n=r.ref;return{$$typeof:o,type:e,key:t,ref:void 0!==n?n:null,props:r}}function A(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var M=/\/+/g;function C(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function N(e,t,r){if(null==e)return e;var n=[],u=0;return!function e(t,r,n,u,a){var l,s,c,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case o:case i:d=!0;break;case y:return e((d=t._init)(t._payload),r,n,u,a)}}if(d)return a=a(t),d=""===u?"."+C(t,0):u,w(a)?(n="",null!=d&&(n=d.replace(M,"$&/")+"/"),e(a,r,n,"",function(e){return e})):null!=a&&(A(a)&&(l=a,s=n+(null==a.key||t&&t.key===a.key?"":(""+a.key).replace(M,"$&/")+"/")+d,a=x(l.type,s,l.props)),r.push(a)),1;d=0;var p=""===u?".":u+":";if(w(t))for(var h=0;h{"use strict";t.exports=e.r(50740)},18800,(e,t,r)=>{"use strict";var n=e.r(71645);function o(e){var t="https://react.dev/errors/"+e;if(1{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),t.exports=e.r(18800)},90317,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={bindSnapshot:function(){return s},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return c}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class u{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let a="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return a?new a:new u}function s(e){return a?a.bind(e):u.bind(e)}function c(){return a?a.snapshot():function(e,...t){return e(...t)}}},42344,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(90317).createAsyncLocalStorage)()},63599,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=e.r(42344)},12354,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HandleISRError",{enumerable:!0,get:function(){return o}});let n="undefined"==typeof window?e.r(63599).workAsyncStorage:void 0;function o({error:e}){if(n){let t=n.getStore();if(t?.isStaticGeneration)throw e&&console.error(e),e}return null}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},74575,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAssetPrefix",{enumerable:!0,get:function(){return o}});let n=e.r(12718);function o(){let e=document.currentScript;if(!(e instanceof HTMLScriptElement))throw Object.defineProperty(new n.InvariantError(`Expected document.currentScript to be a 404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/_not-found/index.txt b/docs/_not-found/index.txt index b857093d..5f0295bb 100644 --- a/docs/_not-found/index.txt +++ b/docs/_not-found/index.txt @@ -1,15 +1,15 @@ 1:"$Sreact.fragment" -2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] -3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -5:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +5:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] 6:"$Sreact.suspense" -8:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] -a:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] -c:I[68027,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] +8:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +a:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] +c:I[68027,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] -0:{"P":null,"b":"YSDmiCN1S-sDYVxEL27I6","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} +0:{"P":null,"b":"AwXCwaoi1jnfKLMnIzgVt","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} 9:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] -d:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] +d:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] 7:null b:[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$Ld","3",{}]] diff --git a/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb b/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb index 737ef945..1da7a4db 100644 Binary files a/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb and b/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb index 14a0f1f3..88e039e3 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb index b611079e..33e71cf4 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb index 786ada3d..5b251878 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb index e03e891d..6deaca8e 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb index 211fcb70..6a563c0d 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb index 28d57ba8..947766fb 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb index 538e05c3..37c27f0a 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb index 02eae975..f7e29d78 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb index 602c0ece..73cb51ae 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb index f2d6844d..e4b9d5e6 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb index 24e34589..9453b677 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb index 0fb179a1..405e6cc2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb index b40357be..59c95c7f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb index 8b811d74..3c8906df 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb index 8fbc0b36..b3757008 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/beacon.glb b/docs/base/@vl2/shapes.vl2/shapes/beacon.glb index d4cbbb91..a2341d9a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/beacon.glb and b/docs/base/@vl2/shapes.vl2/shapes/beacon.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb index 38e431c4..7d39985f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb index 1b9dd13b..8c6c9fb3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb index 707dee93..5ed48b4d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg12.glb b/docs/base/@vl2/shapes.vl2/shapes/borg12.glb index 7272f41c..9c68510d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg12.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg12.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg13.glb b/docs/base/@vl2/shapes.vl2/shapes/borg13.glb index 98ca9ad0..a5fee32d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg13.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg13.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg2.glb b/docs/base/@vl2/shapes.vl2/shapes/borg2.glb index ed256708..ba952754 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg2.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg2.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg3.glb b/docs/base/@vl2/shapes.vl2/shapes/borg3.glb index e75e304b..7ff5e300 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg3.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg3.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/camera.glb b/docs/base/@vl2/shapes.vl2/shapes/camera.glb index f8c461f3..e9d4e0cc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/camera.glb and b/docs/base/@vl2/shapes.vl2/shapes/camera.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb b/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb index ba49b02d..169b1ce1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb and b/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb index da15e825..db5baa4e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb index 65a32dd6..eb1ffdf4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb index 1088eada..26b65e2d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb index b93d060f..e732face 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/disc.glb b/docs/base/@vl2/shapes.vl2/shapes/disc.glb index f6735324..7b254a1a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/disc.glb and b/docs/base/@vl2/shapes.vl2/shapes/disc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb index 49966bf5..edd08aa4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb index 1b375c2b..22cafb90 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb b/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb index e8ec5e08..5dafcd85 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb and b/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb index c6a4a3dc..05d2fde7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb b/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb index 4d50a38c..6b81d2a4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb and b/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/flag.glb b/docs/base/@vl2/shapes.vl2/shapes/flag.glb index e4cb9731..5b3fc8fc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/flag.glb and b/docs/base/@vl2/shapes.vl2/shapes/flag.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb b/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb index ccc5bc1f..74fd32cd 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb and b/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade.glb index e68998fd..9f78693d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb index 31f53915..b34abf46 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb index 989f9587..b04b328d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb index 26dfcecc..8310c36c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb b/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb index df899c42..dde73574 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/light_female.glb b/docs/base/@vl2/shapes.vl2/shapes/light_female.glb index 9a89dae5..6798e273 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/light_female.glb and b/docs/base/@vl2/shapes.vl2/shapes/light_female.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/light_male.glb b/docs/base/@vl2/shapes.vl2/shapes/light_male.glb index db8848e5..8ab4e647 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/light_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/light_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb b/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb index d0950f99..d5aeceac 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb and b/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb b/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb index 825d4851..8a75bec3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mine.glb b/docs/base/@vl2/shapes.vl2/shapes/mine.glb index 40ff806e..d89d6d18 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/mine.glb and b/docs/base/@vl2/shapes.vl2/shapes/mine.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb index 85a1ff8c..148d25cb 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb b/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb index 88a73698..48e6efb2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb and b/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb b/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb index bdf7ac92..0aca5353 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb b/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb index 193a6107..efc426c6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb b/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb index 9c2aa3dc..a24dcccd 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb index e824c40e..315e3b04 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb index 91af1bce..073e7098 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb index 7a774d9b..7200663e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb index 7b29ee6c..6ad8babf 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb index de857585..61cfcd6e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb index 0091f5c4..dfeb3330 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb index d8a8c4db..76439175 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb index 66db7210..ecff75fc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb index 0584a5fc..30eea55e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb index 791970a4..ce47e42e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb b/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb index 7b5a07dd..aed10db9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb and b/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb b/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb index 21c6941b..236b9558 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb and b/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb b/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb index 630f31a4..fb21190f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb and b/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb index 0b08f6c0..3fe0e653 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb index 299352e6..94aac279 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb and b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb b/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb index c4df26e9..ba4dc748 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb and b/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb index e8b97d24..81f99e3f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb b/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb index f00631f3..a59c2439 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb b/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb index 3c0c789c..5ed51914 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb b/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb index f6d2f4d5..c921ed7d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb b/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb index 93c43b7f..9fdddb7b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/switch.glb b/docs/base/@vl2/shapes.vl2/shapes/switch.glb index d00dba02..1348a2fe 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/switch.glb and b/docs/base/@vl2/shapes.vl2/shapes/switch.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb index 44e7a2d6..9ca77520 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb index e7f6bc4b..024372fe 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb index 0b2a9c81..ad8ccefa 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb index 9ecf8503..e04937c1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb index 1533b649..7548785e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb index 1ca638a2..f3f8c0d8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb index 2875a23e..8bd646b8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb index 4e5438c7..7de12c91 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb index aae483de..94fbbf4e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb index 96681926..37a9092a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb index 633161d4..d14631ab 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb index 06a3bf15..6c2e9717 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb index b7ac3c3a..a9a0f778 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb index 97760ab9..e261a06c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb index e0924bf8..2a2bc81e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb index 92c627ec..ff3f08a0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb index aa244a16..787bb4c3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb index c26f514a..ee7299ca 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb index b5be3f68..623a3d57 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb index 4db3e322..e264fa1e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb index 97851f9b..ae07cb31 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb index 1c02ddaa..ab743d8a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb index 6a2bb98e..ffa4a7e9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb index 6123a055..85b17cd8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb index e7a7859b..de909b53 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb index c645f23f..6f4956c4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb index 54661bff..74168467 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb index dc466004..ce70134c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb index 5ef9ed68..c68c16d2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb index 96eca25c..f88a0eea 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb index 0a590ff3..1095c5e2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb index e18a6cf5..1054c86d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb index 40f1978c..ff26364c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb index 2ea266c3..122a34d2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb index bc8eec0f..9a119d71 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb index 91405000..1a604647 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb index d898ac6a..c967a245 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb index 8c53ee68..cd3716ee 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb index d898ac6a..c967a245 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb index 03e6a050..42d7a156 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb index 0b019e46..13e83b48 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb index cf53f159..7f4fc1b9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb index 93683613..0cfabdd1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb index 79f7bd37..cac14681 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb index d536d0f6..5da5e5c7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb index e9f451e7..23e151a7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb index e056ccde..2defc5e2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb index 8bd874d0..ce44dd4b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb index a446a984..03419a7c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb index 27815435..dc3ac5d9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb index d8f035ea..468b059a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb index a0a06023..90877db3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb index 7820769b..1b6f958d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg2.dts b/docs/base/@vl2/shapes.vl2/shapes/xorg2.dts index e69de29b..eb3c06fe 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg2.dts and b/docs/base/@vl2/shapes.vl2/shapes/xorg2.dts differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg2.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg2.glb new file mode 100644 index 00000000..1c62bae6 Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/xorg2.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb index b0ab5538..e084c8f8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb differ diff --git a/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb b/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb index 737ef945..1da7a4db 100644 Binary files a/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb and b/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb index 4d72bdd0..0391ed2b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb index 794af0d6..fc93d23a 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb index a569de61..a3820d4e 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb index 5d17028d..b90e0e14 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb index 6a1824bb..a6434a92 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb index 768a4f2a..8f9e8334 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb index e297ea6d..ea401ebb 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb index eae15fe2..2a286650 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb index 7c454bc2..120a3c90 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb index ac997871..32269df8 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb index 6b3f549e..650f2be5 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb index b9e8e64b..6abf6ec8 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb index 2756d9f7..e3e371d5 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb index 9e7cd992..8a5d1258 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb index 49410914..825b2436 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb index 83ec0e35..4f36a5c8 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb index b7e764df..6dbb88fc 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb index 30cd3f78..f6f38305 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb index 85a2b00f..caf2db2d 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb index c6a93e24..a28a7aef 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb index 6af7938f..f4b0870a 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb index b3697458..791fbefb 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb index 0405686e..c67f9fca 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb index 0ec0fddd..e133f6a7 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb index d5b4eed5..7ded6bdb 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb index d7566a7b..8684cd72 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb index 623a4952..78c08aa0 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb index f0dd9032..9b0263c7 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb index 06fd2a8f..f0015a7f 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb index 03b509b4..06f54e58 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb index 99842d79..9cca5505 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb index e3ee8ee5..1571da19 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb index 8a93bd95..b6a18460 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb index 59a119b3..14e7c238 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb index f93aee7f..b8658bc6 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb index cd6b967e..50fd943a 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb index 15fea7b7..fea047e0 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb index 7fb18a79..76bc5d4a 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb differ diff --git a/docs/index.html b/docs/index.html index 28c268d4..3bf3685d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -MapGenius – Explore maps for Tribes 2 \ No newline at end of file +MapGenius – Explore maps for Tribes 2 \ No newline at end of file diff --git a/docs/index.txt b/docs/index.txt index bf7ac3b3..e1c2e50c 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -1,20 +1,21 @@ 1:"$Sreact.fragment" -2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] -3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -5:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/c339a594c158eab3.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/f12455938f261f57.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] -9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/8206544674c0f63e.js","/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js"],"default"] +9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" -c:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] -e:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] +c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] -:HL["/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","style"] -0:{"P":null,"b":"YSDmiCN1S-sDYVxEL27I6","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f6c55b3b7050a508.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c339a594c158eab3.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/f12455938f261f57.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +:HL["/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","style"] +0:{"P":null,"b":"AwXCwaoi1jnfKLMnIzgVt","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3a7943ba4f8effca.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/c1f9b49d5dc0251d.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/8206544674c0f63e.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/07f1e4bb8e7d8066.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/791b17fa51a62bf9.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/3adaddad39f53f70.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/44bbdd420cb3ec27.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] -11:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] +11:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] b:null f:[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L11","3",{}]] diff --git a/docs/shapes/__next._full.txt b/docs/shapes/__next._full.txt new file mode 100644 index 00000000..9fa96171 --- /dev/null +++ b/docs/shapes/__next._full.txt @@ -0,0 +1,20 @@ +1:"$Sreact.fragment" +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js"],"default"] +9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] +a:"$Sreact.suspense" +c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] +10:I[68027,[],"default"] +:HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +0:{"P":null,"b":"AwXCwaoi1jnfKLMnIzgVt","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +7:{} +8:"$0:f:0:1:1:children:1:children:0:props:children:0:props:serverProvidedParams:params" +d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] +11:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] +b:null +f:[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L11","3",{}]] diff --git a/docs/shapes/__next._head.txt b/docs/shapes/__next._head.txt new file mode 100644 index 00000000..d5ce669f --- /dev/null +++ b/docs/shapes/__next._head.txt @@ -0,0 +1,6 @@ +1:"$Sreact.fragment" +2:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +3:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] +4:"$Sreact.suspense" +5:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/__next._index.txt b/docs/shapes/__next._index.txt new file mode 100644 index 00000000..37d57782 --- /dev/null +++ b/docs/shapes/__next._index.txt @@ -0,0 +1,6 @@ +1:"$Sreact.fragment" +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +:HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/__next._tree.txt b/docs/shapes/__next._tree.txt new file mode 100644 index 00000000..2d629132 --- /dev/null +++ b/docs/shapes/__next._tree.txt @@ -0,0 +1,3 @@ +:HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"shapes","paramType":null,"paramKey":"shapes","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/docs/shapes/__next.shapes.__PAGE__.txt b/docs/shapes/__next.shapes.__PAGE__.txt new file mode 100644 index 00000000..f1032186 --- /dev/null +++ b/docs/shapes/__next.shapes.__PAGE__.txt @@ -0,0 +1,10 @@ +1:"$Sreact.fragment" +2:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +3:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js"],"default"] +6:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] +7:"$Sreact.suspense" +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +4:{} +5:"$0:rsc:props:children:0:props:serverProvidedParams:params" +8:null diff --git a/docs/shapes/__next.shapes.txt b/docs/shapes/__next.shapes.txt new file mode 100644 index 00000000..1564bf17 --- /dev/null +++ b/docs/shapes/__next.shapes.txt @@ -0,0 +1,4 @@ +1:"$Sreact.fragment" +2:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +3:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +0:{"buildId":"AwXCwaoi1jnfKLMnIzgVt","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/index.html b/docs/shapes/index.html new file mode 100644 index 00000000..befaeaf8 --- /dev/null +++ b/docs/shapes/index.html @@ -0,0 +1 @@ +MapGenius – Explore maps for Tribes 2 \ No newline at end of file diff --git a/docs/shapes/index.txt b/docs/shapes/index.txt new file mode 100644 index 00000000..9fa96171 --- /dev/null +++ b/docs/shapes/index.txt @@ -0,0 +1,20 @@ +1:"$Sreact.fragment" +2:I[12985,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js"],"NuqsAdapter"] +3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] +5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] +6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js"],"default"] +9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] +a:"$Sreact.suspense" +c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] +e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] +10:I[68027,[],"default"] +:HL["/t2-mapper/_next/static/chunks/e620039d1c837dab.css","style"] +:HL["/t2-mapper/_next/static/chunks/97a75e62963e0840.css","style"] +0:{"P":null,"b":"AwXCwaoi1jnfKLMnIzgVt","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e620039d1c837dab.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/97a75e62963e0840.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/b00acbf8afd8b4b6.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/adafff78bc0c4657.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/3ff360e595385fc4.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/20b7c805b0b1f5f3.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/4fc14a6c1457c064.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +7:{} +8:"$0:f:0:1:1:children:1:children:0:props:children:0:props:serverProvidedParams:params" +d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] +11:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] +b:null +f:[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L11","3",{}]] diff --git a/package-lock.json b/package-lock.json index f5f8e2f1..2433b754 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,24 +9,25 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@ariakit/react": "^0.4.20", + "@ariakit/react": "^0.4.21", "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.4.2", - "@tanstack/react-query": "^5.90.15", + "@react-three/fiber": "^9.5.0", + "@tanstack/react-query": "^5.90.21", "ignore": "^7.0.5", "lodash.orderby": "^4.6.0", "match-sorter": "^8.2.0", - "next": "^16.1.1", + "next": "^16.1.6", "nipplejs": "^0.10.2", - "nuqs": "^2.8.6", + "nuqs": "^2.8.9", "picomatch": "^4.0.3", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.4", + "react-dom": "^19.2.4", "react-error-boundary": "^6.0.1", "react-icons": "^5.5.0", + "t2-demo-parser": "file:.yalc/t2-demo-parser", "three": "^0.182.0", "unzipper": "^0.12.3", - "zustand": "^5.0.9" + "zustand": "^5.0.11" }, "devDependencies": { "@eslint/js": "^9.39.2", @@ -34,7 +35,7 @@ "@types/lodash.orderby": "^4.6.9", "@types/node": "24.3.1", "@types/picomatch": "^4.0.2", - "@types/react": "^19.2.7", + "@types/react": "^19.2.14", "@types/three": "^0.182.0", "@types/unzipper": "^0.10.11", "babel-plugin-react-compiler": "^1.0.0", @@ -50,22 +51,33 @@ "tsx": "^4.21.0", "typescript": "5.9.3", "typescript-eslint": "^8.51.0", - "vitest": "^4.0.16" + "vitest": "^4.0.18" + } + }, + ".yalc/t2-demo-parser": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "debug": "^4.4.3", + "fflate": "^0.8.2" + }, + "bin": { + "t2-demo-parser": "dist/cli.js" } }, "node_modules/@ariakit/core": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.17.tgz", - "integrity": "sha512-OmbUcVZgmQw0AvpX5urCAi3KtEuD30DG8W8gpQVzFpCUWUtJ21bmc6a4s2rm2g1oKPIVShy61FGLtKdKLaTG6g==", + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.18.tgz", + "integrity": "sha512-9urEa+GbZTSyredq3B/3thQjTcSZSUC68XctwCkJNH/xNfKN5O+VThiem2rcJxpsGw8sRUQenhagZi0yB4foyg==", "license": "MIT" }, "node_modules/@ariakit/react": { - "version": "0.4.20", - "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.20.tgz", - "integrity": "sha512-1X44x3co7MInk5SV4lSvRdy8Nwrt56YNBreKPkcZ/LlwdmY2/2r4A26I7Kzhv+VYIxDTavZYrqOlWnix5ojceg==", + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.21.tgz", + "integrity": "sha512-UjP99Y7cWxA5seRECEE0RPZFImkLGFIWPflp65t0BVZwlMw4wp9OJZRHMrnkEkKl5KBE2NR/gbbzwHc6VNGzsA==", "license": "MIT", "dependencies": { - "@ariakit/react-core": "0.4.20" + "@ariakit/react-core": "0.4.21" }, "funding": { "type": "opencollective", @@ -77,12 +89,12 @@ } }, "node_modules/@ariakit/react-core": { - "version": "0.4.20", - "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.20.tgz", - "integrity": "sha512-4rfmaKgSIctHRDrA4wt8MLSI4rNA6wyD7XSTShghHrJfDEXujuOoZqvmPjtMr///kWfW9OV9USOOn8ie/7H/nw==", + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.21.tgz", + "integrity": "sha512-rUI9uB/gT3mROFja/ka7/JukkdljIZR3eq3BGiQqX4Ni/KBMDvPK8FvVLnC0TGzWcqNY2bbfve8QllvHzuw4fQ==", "license": "MIT", "dependencies": { - "@ariakit/core": "0.4.17", + "@ariakit/core": "0.4.18", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" }, @@ -1069,21 +1081,21 @@ } }, "node_modules/@floating-ui/core": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz", - "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.4.tgz", + "integrity": "sha512-C3HlIdsBxszvm5McXlB8PeOEWfBhcGBTZGkGlWc2U0KFY5IwG5OQEuQ8rq52DZmcHDlPLd+YFBK+cZcytwIFWg==", "license": "MIT", "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "node_modules/@floating-ui/dom": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", - "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.5.tgz", + "integrity": "sha512-N0bD2kIPInNHUHehXhMke1rBGs1dwqvC9O9KYMyyjK7iXt7GAhnro7UlcuYcGdS/yYOlq0MAVgrow8IbWJwyqg==", "license": "MIT", "dependencies": { - "@floating-ui/core": "^1.7.3", + "@floating-ui/core": "^1.7.4", "@floating-ui/utils": "^0.2.10" } }, @@ -1728,9 +1740,9 @@ } }, "node_modules/@next/env": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.1.tgz", - "integrity": "sha512-3oxyM97Sr2PqiVyMyrZUtrtM3jqqFxOQJVuKclDsgj/L728iZt/GyslkN4NwarledZATCenbk4Offjk1hQmaAA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz", + "integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -1744,9 +1756,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.1.tgz", - "integrity": "sha512-JS3m42ifsVSJjSTzh27nW+Igfha3NdBOFScr9C80hHGrWx55pTrVL23RJbqir7k7/15SKlrLHhh/MQzqBBYrQA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.6.tgz", + "integrity": "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==", "cpu": [ "arm64" ], @@ -1760,9 +1772,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.1.tgz", - "integrity": "sha512-hbyKtrDGUkgkyQi1m1IyD3q4I/3m9ngr+V93z4oKHrPcmxwNL5iMWORvLSGAf2YujL+6HxgVvZuCYZfLfb4bGw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.6.tgz", + "integrity": "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==", "cpu": [ "x64" ], @@ -1776,9 +1788,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.1.tgz", - "integrity": "sha512-/fvHet+EYckFvRLQ0jPHJCUI5/B56+2DpI1xDSvi80r/3Ez+Eaa2Yq4tJcRTaB1kqj/HrYKn8Yplm9bNoMJpwQ==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.6.tgz", + "integrity": "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==", "cpu": [ "arm64" ], @@ -1792,9 +1804,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.1.tgz", - "integrity": "sha512-MFHrgL4TXNQbBPzkKKur4Fb5ICEJa87HM7fczFs2+HWblM7mMLdco3dvyTI+QmLBU9xgns/EeeINSZD6Ar+oLg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.6.tgz", + "integrity": "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==", "cpu": [ "arm64" ], @@ -1808,9 +1820,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.1.tgz", - "integrity": "sha512-20bYDfgOQAPUkkKBnyP9PTuHiJGM7HzNBbuqmD0jiFVZ0aOldz+VnJhbxzjcSabYsnNjMPsE0cyzEudpYxsrUQ==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.6.tgz", + "integrity": "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==", "cpu": [ "x64" ], @@ -1824,9 +1836,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.1.tgz", - "integrity": "sha512-9pRbK3M4asAHQRkwaXwu601oPZHghuSC8IXNENgbBSyImHv/zY4K5udBusgdHkvJ/Tcr96jJwQYOll0qU8+fPA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.6.tgz", + "integrity": "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==", "cpu": [ "x64" ], @@ -1840,9 +1852,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.1.tgz", - "integrity": "sha512-bdfQkggaLgnmYrFkSQfsHfOhk/mCYmjnrbRCGgkMcoOBZ4n+TRRSLmT/CU5SATzlBJ9TpioUyBW/vWFXTqQRiA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.6.tgz", + "integrity": "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==", "cpu": [ "arm64" ], @@ -1856,9 +1868,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.1.tgz", - "integrity": "sha512-Ncwbw2WJ57Al5OX0k4chM68DKhEPlrXBaSXDCi2kPi5f4d8b3ejr3RRJGfKBLrn2YJL5ezNS7w2TZLHSti8CMw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.6.tgz", + "integrity": "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==", "cpu": [ "x64" ], @@ -2008,20 +2020,18 @@ } }, "node_modules/@react-three/fiber": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-9.4.2.tgz", - "integrity": "sha512-H4B4+FDNHpvIb4FmphH4ubxOfX5bxmfOw0+3pkQwR9u9wFiyMS7wUDkNn0m4RqQuiLWeia9jfN1eBvtyAVGEog==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-9.5.0.tgz", + "integrity": "sha512-FiUzfYW4wB1+PpmsE47UM+mCads7j2+giRBltfwH7SNhah95rqJs3ltEs9V3pP8rYdS0QlNne+9Aj8dS/SiaIA==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.17.8", - "@types/react-reconciler": "^0.32.0", "@types/webxr": "*", "base64-js": "^1.5.1", "buffer": "^6.0.3", "its-fine": "^2.0.0", - "react-reconciler": "^0.31.0", "react-use-measure": "^2.1.7", - "scheduler": "^0.25.0", + "scheduler": "^0.27.0", "suspend-react": "^0.1.3", "use-sync-external-store": "^1.4.0", "zustand": "^5.0.3" @@ -2031,8 +2041,8 @@ "expo-asset": ">=8.4", "expo-file-system": ">=11.0", "expo-gl": ">=11.0", - "react": "^19.0.0", - "react-dom": "^19.0.0", + "react": ">=19 <19.3", + "react-dom": ">=19 <19.3", "react-native": ">=0.78", "three": ">=0.156" }, @@ -2057,16 +2067,10 @@ } } }, - "node_modules/@react-three/fiber/node_modules/scheduler": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", - "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.54.0.tgz", - "integrity": "sha512-OywsdRHrFvCdvsewAInDKCNyR3laPA2mc9bRYJ6LBp5IyvF3fvXbbNR0bSzHlZVFtn6E0xw2oZlyjg4rKCVcng==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", + "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", "cpu": [ "arm" ], @@ -2078,9 +2082,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.54.0.tgz", - "integrity": "sha512-Skx39Uv+u7H224Af+bDgNinitlmHyQX1K/atIA32JP3JQw6hVODX5tkbi2zof/E69M1qH2UoN3Xdxgs90mmNYw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", + "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", "cpu": [ "arm64" ], @@ -2092,9 +2096,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.54.0.tgz", - "integrity": "sha512-k43D4qta/+6Fq+nCDhhv9yP2HdeKeP56QrUUTW7E6PhZP1US6NDqpJj4MY0jBHlJivVJD5P8NxrjuobZBJTCRw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", + "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", "cpu": [ "arm64" ], @@ -2106,9 +2110,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.54.0.tgz", - "integrity": "sha512-cOo7biqwkpawslEfox5Vs8/qj83M/aZCSSNIWpVzfU2CYHa2G3P1UN5WF01RdTHSgCkri7XOlTdtk17BezlV3A==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", + "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", "cpu": [ "x64" ], @@ -2120,9 +2124,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.54.0.tgz", - "integrity": "sha512-miSvuFkmvFbgJ1BevMa4CPCFt5MPGw094knM64W9I0giUIMMmRYcGW/JWZDriaw/k1kOBtsWh1z6nIFV1vPNtA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", + "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", "cpu": [ "arm64" ], @@ -2134,9 +2138,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.54.0.tgz", - "integrity": "sha512-KGXIs55+b/ZfZsq9aR026tmr/+7tq6VG6MsnrvF4H8VhwflTIuYh+LFUlIsRdQSgrgmtM3fVATzEAj4hBQlaqQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", + "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", "cpu": [ "x64" ], @@ -2148,9 +2152,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.54.0.tgz", - "integrity": "sha512-EHMUcDwhtdRGlXZsGSIuXSYwD5kOT9NVnx9sqzYiwAc91wfYOE1g1djOEDseZJKKqtHAHGwnGPQu3kytmfaXLQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", + "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", "cpu": [ "arm" ], @@ -2162,9 +2166,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.54.0.tgz", - "integrity": "sha512-+pBrqEjaakN2ySv5RVrj/qLytYhPKEUwk+e3SFU5jTLHIcAtqh2rLrd/OkbNuHJpsBgxsD8ccJt5ga/SeG0JmA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", + "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", "cpu": [ "arm" ], @@ -2176,9 +2180,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.54.0.tgz", - "integrity": "sha512-NSqc7rE9wuUaRBsBp5ckQ5CVz5aIRKCwsoa6WMF7G01sX3/qHUw/z4pv+D+ahL1EIKy6Enpcnz1RY8pf7bjwng==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", + "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", "cpu": [ "arm64" ], @@ -2190,9 +2194,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.54.0.tgz", - "integrity": "sha512-gr5vDbg3Bakga5kbdpqx81m2n9IX8M6gIMlQQIXiLTNeQW6CucvuInJ91EuCJ/JYvc+rcLLsDFcfAD1K7fMofg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", + "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", "cpu": [ "arm64" ], @@ -2204,9 +2208,23 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.54.0.tgz", - "integrity": "sha512-gsrtB1NA3ZYj2vq0Rzkylo9ylCtW/PhpLEivlgWe0bpgtX5+9j9EZa0wtZiCjgu6zmSeZWyI/e2YRX1URozpIw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", + "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", + "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", "cpu": [ "loong64" ], @@ -2218,9 +2236,23 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.54.0.tgz", - "integrity": "sha512-y3qNOfTBStmFNq+t4s7Tmc9hW2ENtPg8FeUD/VShI7rKxNW7O4fFeaYbMsd3tpFlIg1Q8IapFgy7Q9i2BqeBvA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", + "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", + "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", "cpu": [ "ppc64" ], @@ -2232,9 +2264,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.54.0.tgz", - "integrity": "sha512-89sepv7h2lIVPsFma8iwmccN7Yjjtgz0Rj/Ou6fEqg3HDhpCa+Et+YSufy27i6b0Wav69Qv4WBNl3Rs6pwhebQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", + "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", "cpu": [ "riscv64" ], @@ -2246,9 +2278,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.54.0.tgz", - "integrity": "sha512-ZcU77ieh0M2Q8Ur7D5X7KvK+UxbXeDHwiOt/CPSBTI1fBmeDMivW0dPkdqkT4rOgDjrDDBUed9x4EgraIKoR2A==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", + "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", "cpu": [ "riscv64" ], @@ -2260,9 +2292,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.54.0.tgz", - "integrity": "sha512-2AdWy5RdDF5+4YfG/YesGDDtbyJlC9LHmL6rZw6FurBJ5n4vFGupsOBGfwMRjBYH7qRQowT8D/U4LoSvVwOhSQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", + "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", "cpu": [ "s390x" ], @@ -2274,9 +2306,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.54.0.tgz", - "integrity": "sha512-WGt5J8Ij/rvyqpFexxk3ffKqqbLf9AqrTBbWDk7ApGUzaIs6V+s2s84kAxklFwmMF/vBNGrVdYgbblCOFFezMQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", + "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", "cpu": [ "x64" ], @@ -2288,9 +2320,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.54.0.tgz", - "integrity": "sha512-JzQmb38ATzHjxlPHuTH6tE7ojnMKM2kYNzt44LO/jJi8BpceEC8QuXYA908n8r3CNuG/B3BV8VR3Hi1rYtmPiw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", + "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", "cpu": [ "x64" ], @@ -2301,10 +2333,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", + "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.54.0.tgz", - "integrity": "sha512-huT3fd0iC7jigGh7n3q/+lfPcXxBi+om/Rs3yiFxjvSxbSB6aohDFXbWvlspaqjeOh+hx7DDHS+5Es5qRkWkZg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", + "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", "cpu": [ "arm64" ], @@ -2316,9 +2362,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.54.0.tgz", - "integrity": "sha512-c2V0W1bsKIKfbLMBu/WGBz6Yci8nJ/ZJdheE0EwB73N3MvHYKiKGs3mVilX4Gs70eGeDaMqEob25Tw2Gb9Nqyw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", + "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", "cpu": [ "arm64" ], @@ -2330,9 +2376,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.54.0.tgz", - "integrity": "sha512-woEHgqQqDCkAzrDhvDipnSirm5vxUXtSKDYTVpZG3nUdW/VVB5VdCYA2iReSj/u3yCZzXID4kuKG7OynPnB3WQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", + "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", "cpu": [ "ia32" ], @@ -2344,9 +2390,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.54.0.tgz", - "integrity": "sha512-dzAc53LOuFvHwbCEOS0rPbXp6SIhAf2txMP5p6mGyOXXw5mWY8NGGbPMPrs4P1WItkfApDathBj/NzMLUZ9rtQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", + "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", "cpu": [ "x64" ], @@ -2358,9 +2404,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.54.0.tgz", - "integrity": "sha512-hYT5d3YNdSh3mbCU1gwQyPgQd3T2ne0A3KG8KSBdav5TiBg6eInVmV+TeR5uHufiIgSFg0XsOWGW5/RhNcSvPg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", + "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", "cpu": [ "x64" ], @@ -2394,9 +2440,9 @@ } }, "node_modules/@tanstack/query-core": { - "version": "5.90.15", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.15.tgz", - "integrity": "sha512-mInIZNUZftbERE+/Hbtswfse49uUQwch46p+27gP9DWJL927UjnaWEF2t3RMOqBcXbfMdcNkPe06VyUIAZTV1g==", + "version": "5.90.20", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.20.tgz", + "integrity": "sha512-OMD2HLpNouXEfZJWcKeVKUgQ5n+n3A2JFmBaScpNDUqSrQSjiveC7dKMe53uJUg1nDG16ttFPz2xfilz6i2uVg==", "license": "MIT", "funding": { "type": "github", @@ -2404,12 +2450,12 @@ } }, "node_modules/@tanstack/react-query": { - "version": "5.90.15", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.15.tgz", - "integrity": "sha512-uQvnDDcTOgJouNtAyrgRej+Azf0U5WDov3PXmHFUBc+t1INnAYhIlpZtCGNBLwCN41b43yO7dPNZu8xWkUFBwQ==", + "version": "5.90.21", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.21.tgz", + "integrity": "sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg==", "license": "MIT", "dependencies": { - "@tanstack/query-core": "5.90.15" + "@tanstack/query-core": "5.90.20" }, "funding": { "type": "github", @@ -2596,23 +2642,14 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", - "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "version": "19.2.14", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", + "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "license": "MIT", "dependencies": { "csstype": "^3.2.2" } }, - "node_modules/@types/react-reconciler": { - "version": "0.32.1", - "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.32.1.tgz", - "integrity": "sha512-RsqPttsBQ+6af0nATFXJJpemYQH7kL9+xLNm1z+0MjQFDKBZDM2R6SBrjdvRmHu9i9fM6povACj57Ft+pKRNOA==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*" - } - }, "node_modules/@types/send": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", @@ -3216,16 +3253,16 @@ } }, "node_modules/@vitest/expect": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.16.tgz", - "integrity": "sha512-eshqULT2It7McaJkQGLkPjPjNph+uevROGuIMJdG3V+0BSR2w9u6J9Lwu+E8cK5TETlfou8GRijhafIMhXsimA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.18.tgz", + "integrity": "sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", + "@vitest/spy": "4.0.18", + "@vitest/utils": "4.0.18", "chai": "^6.2.1", "tinyrainbow": "^3.0.3" }, @@ -3234,13 +3271,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.16.tgz", - "integrity": "sha512-yb6k4AZxJTB+q9ycAvsoxGn+j/po0UaPgajllBgt1PzoMAAmJGYFdDk0uCcRcxb3BrME34I6u8gHZTQlkqSZpg==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.18.tgz", + "integrity": "sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.0.16", + "@vitest/spy": "4.0.18", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -3261,9 +3298,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.16.tgz", - "integrity": "sha512-eNCYNsSty9xJKi/UdVD8Ou16alu7AYiS2fCPRs0b1OdhJiV89buAXQLpTbe+X8V9L6qrs9CqyvU7OaAopJYPsA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.18.tgz", + "integrity": "sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw==", "dev": true, "license": "MIT", "dependencies": { @@ -3274,13 +3311,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.16.tgz", - "integrity": "sha512-VWEDm5Wv9xEo80ctjORcTQRJ539EGPB3Pb9ApvVRAY1U/WkHXmmYISqU5E79uCwcW7xYUV38gwZD+RV755fu3Q==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.18.tgz", + "integrity": "sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.0.16", + "@vitest/utils": "4.0.18", "pathe": "^2.0.3" }, "funding": { @@ -3288,13 +3325,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.16.tgz", - "integrity": "sha512-sf6NcrYhYBsSYefxnry+DR8n3UV4xWZwWxYbCJUt2YdvtqzSPR7VfGrY0zsv090DAbjFZsi7ZaMi1KnSRyK1XA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.18.tgz", + "integrity": "sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.16", + "@vitest/pretty-format": "4.0.18", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -3303,9 +3340,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.16.tgz", - "integrity": "sha512-4jIOWjKP0ZUaEmJm00E0cOBLU+5WE0BpeNr3XN6TEF05ltro6NJqHWxXD0kA8/Zc8Nh23AT8WQxwNG+WeROupw==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.18.tgz", + "integrity": "sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw==", "dev": true, "license": "MIT", "funding": { @@ -3313,13 +3350,13 @@ } }, "node_modules/@vitest/utils": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.16.tgz", - "integrity": "sha512-h8z9yYhV3e1LEfaQ3zdypIrnAg/9hguReGZoS7Gl0aBG5xgA410zBqECqmaF/+RkTggRsfnzc1XaAHA6bmUufA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.18.tgz", + "integrity": "sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.16", + "@vitest/pretty-format": "4.0.18", "tinyrainbow": "^3.0.3" }, "funding": { @@ -4089,9 +4126,9 @@ "license": "CC-BY-4.0" }, "node_modules/chai": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.1.tgz", - "integrity": "sha512-p4Z49OGG5W/WBCPSS/dH3jQ73kD6tiMmUM+bckNK6Jr5JHMG3k9bg/BvKR8lKmtVBKmOiuVaV2ws8s9oSbwysg==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", "engines": { @@ -4399,7 +4436,6 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -7224,7 +7260,6 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, "license": "MIT" }, "node_modules/nanoid": { @@ -7289,12 +7324,12 @@ } }, "node_modules/next": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/next/-/next-16.1.1.tgz", - "integrity": "sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz", + "integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==", "license": "MIT", "dependencies": { - "@next/env": "16.1.1", + "@next/env": "16.1.6", "@swc/helpers": "0.5.15", "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001579", @@ -7308,14 +7343,14 @@ "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "16.1.1", - "@next/swc-darwin-x64": "16.1.1", - "@next/swc-linux-arm64-gnu": "16.1.1", - "@next/swc-linux-arm64-musl": "16.1.1", - "@next/swc-linux-x64-gnu": "16.1.1", - "@next/swc-linux-x64-musl": "16.1.1", - "@next/swc-win32-arm64-msvc": "16.1.1", - "@next/swc-win32-x64-msvc": "16.1.1", + "@next/swc-darwin-arm64": "16.1.6", + "@next/swc-darwin-x64": "16.1.6", + "@next/swc-linux-arm64-gnu": "16.1.6", + "@next/swc-linux-arm64-musl": "16.1.6", + "@next/swc-linux-x64-gnu": "16.1.6", + "@next/swc-linux-x64-musl": "16.1.6", + "@next/swc-win32-arm64-msvc": "16.1.6", + "@next/swc-win32-x64-msvc": "16.1.6", "sharp": "^0.34.4" }, "peerDependencies": { @@ -7361,9 +7396,9 @@ "license": "MIT" }, "node_modules/nuqs": { - "version": "2.8.6", - "resolved": "https://registry.npmjs.org/nuqs/-/nuqs-2.8.6.tgz", - "integrity": "sha512-aRxeX68b4ULmhio8AADL2be1FWDy0EPqaByPvIYWrA7Pm07UjlrICp/VPlSnXJNAG0+3MQwv3OporO2sOXMVGA==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/nuqs/-/nuqs-2.8.9.tgz", + "integrity": "sha512-8ou6AEwsxMWSYo2qkfZtYFVzngwbKmg4c00HVxC1fF6CEJv3Fwm6eoZmfVPALB+vw8Udo7KL5uy96PFcYe1BIQ==", "license": "MIT", "dependencies": { "@standard-schema/spec": "1.0.0" @@ -8109,24 +8144,24 @@ } }, "node_modules/react": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", - "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", + "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { - "react": "^19.2.3" + "react": "^19.2.4" } }, "node_modules/react-error-boundary": { @@ -8155,27 +8190,6 @@ "dev": true, "license": "MIT" }, - "node_modules/react-reconciler": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.31.0.tgz", - "integrity": "sha512-7Ob7Z+URmesIsIVRjnLoDGwBEG/tVitidU0nMsqX/eeJaLY89RISO/10ERe0MqmzuKUUB1rmY+h1itMbUHg9BQ==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.25.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "react": "^19.0.0" - } - }, - "node_modules/react-reconciler/node_modules/scheduler": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", - "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", - "license": "MIT" - }, "node_modules/react-use-measure": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.7.tgz", @@ -8355,9 +8369,9 @@ } }, "node_modules/rollup": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz", - "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", + "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", "dev": true, "license": "MIT", "dependencies": { @@ -8371,28 +8385,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.54.0", - "@rollup/rollup-android-arm64": "4.54.0", - "@rollup/rollup-darwin-arm64": "4.54.0", - "@rollup/rollup-darwin-x64": "4.54.0", - "@rollup/rollup-freebsd-arm64": "4.54.0", - "@rollup/rollup-freebsd-x64": "4.54.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.54.0", - "@rollup/rollup-linux-arm-musleabihf": "4.54.0", - "@rollup/rollup-linux-arm64-gnu": "4.54.0", - "@rollup/rollup-linux-arm64-musl": "4.54.0", - "@rollup/rollup-linux-loong64-gnu": "4.54.0", - "@rollup/rollup-linux-ppc64-gnu": "4.54.0", - "@rollup/rollup-linux-riscv64-gnu": "4.54.0", - "@rollup/rollup-linux-riscv64-musl": "4.54.0", - "@rollup/rollup-linux-s390x-gnu": "4.54.0", - "@rollup/rollup-linux-x64-gnu": "4.54.0", - "@rollup/rollup-linux-x64-musl": "4.54.0", - "@rollup/rollup-openharmony-arm64": "4.54.0", - "@rollup/rollup-win32-arm64-msvc": "4.54.0", - "@rollup/rollup-win32-ia32-msvc": "4.54.0", - "@rollup/rollup-win32-x64-gnu": "4.54.0", - "@rollup/rollup-win32-x64-msvc": "4.54.0", + "@rollup/rollup-android-arm-eabi": "4.59.0", + "@rollup/rollup-android-arm64": "4.59.0", + "@rollup/rollup-darwin-arm64": "4.59.0", + "@rollup/rollup-darwin-x64": "4.59.0", + "@rollup/rollup-freebsd-arm64": "4.59.0", + "@rollup/rollup-freebsd-x64": "4.59.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", + "@rollup/rollup-linux-arm-musleabihf": "4.59.0", + "@rollup/rollup-linux-arm64-gnu": "4.59.0", + "@rollup/rollup-linux-arm64-musl": "4.59.0", + "@rollup/rollup-linux-loong64-gnu": "4.59.0", + "@rollup/rollup-linux-loong64-musl": "4.59.0", + "@rollup/rollup-linux-ppc64-gnu": "4.59.0", + "@rollup/rollup-linux-ppc64-musl": "4.59.0", + "@rollup/rollup-linux-riscv64-gnu": "4.59.0", + "@rollup/rollup-linux-riscv64-musl": "4.59.0", + "@rollup/rollup-linux-s390x-gnu": "4.59.0", + "@rollup/rollup-linux-x64-gnu": "4.59.0", + "@rollup/rollup-linux-x64-musl": "4.59.0", + "@rollup/rollup-openbsd-x64": "4.59.0", + "@rollup/rollup-openharmony-arm64": "4.59.0", + "@rollup/rollup-win32-arm64-msvc": "4.59.0", + "@rollup/rollup-win32-ia32-msvc": "4.59.0", + "@rollup/rollup-win32-x64-gnu": "4.59.0", + "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" } }, @@ -9187,6 +9204,10 @@ "react": ">=17.0" } }, + "node_modules/t2-demo-parser": { + "resolved": ".yalc/t2-demo-parser", + "link": true + }, "node_modules/tar-fs": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz", @@ -9781,9 +9802,9 @@ } }, "node_modules/vite": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz", - "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", "dev": true, "license": "MIT", "dependencies": { @@ -9885,19 +9906,19 @@ } }, "node_modules/vitest": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.16.tgz", - "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.18.tgz", + "integrity": "sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "4.0.16", - "@vitest/mocker": "4.0.16", - "@vitest/pretty-format": "4.0.16", - "@vitest/runner": "4.0.16", - "@vitest/snapshot": "4.0.16", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", + "@vitest/expect": "4.0.18", + "@vitest/mocker": "4.0.18", + "@vitest/pretty-format": "4.0.18", + "@vitest/runner": "4.0.18", + "@vitest/snapshot": "4.0.18", + "@vitest/spy": "4.0.18", + "@vitest/utils": "4.0.18", "es-module-lexer": "^1.7.0", "expect-type": "^1.2.2", "magic-string": "^0.30.21", @@ -9925,10 +9946,10 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.0.16", - "@vitest/browser-preview": "4.0.16", - "@vitest/browser-webdriverio": "4.0.16", - "@vitest/ui": "4.0.16", + "@vitest/browser-playwright": "4.0.18", + "@vitest/browser-preview": "4.0.18", + "@vitest/browser-webdriverio": "4.0.18", + "@vitest/ui": "4.0.18", "happy-dom": "*", "jsdom": "*" }, @@ -10259,9 +10280,9 @@ } }, "node_modules/zustand": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.9.tgz", - "integrity": "sha512-ALBtUj0AfjJt3uNRQoL1tL2tMvj6Gp/6e39dnfT6uzpelGru8v1tPOGBzayOWbPJvujM8JojDk3E1LxeFisBNg==", + "version": "5.0.11", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.11.tgz", + "integrity": "sha512-fdZY+dk7zn/vbWNCYmzZULHRrss0jx5pPFiOuMZ/5HJN6Yv3u+1Wswy/4MpZEkEGhtNH+pwxZB8OKgUBPzYAGg==", "license": "MIT", "engines": { "node": ">=12.20.0" diff --git a/package.json b/package.json index 5a0e5556..5a3c01d6 100644 --- a/package.json +++ b/package.json @@ -23,25 +23,25 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@ariakit/react": "^0.4.20", + "@ariakit/react": "^0.4.21", "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.4.2", - "@tanstack/react-query": "^5.90.15", + "@react-three/fiber": "^9.5.0", + "@tanstack/react-query": "^5.90.21", "ignore": "^7.0.5", "lodash.orderby": "^4.6.0", "match-sorter": "^8.2.0", - "next": "^16.1.1", + "next": "^16.1.6", "nipplejs": "^0.10.2", - "nuqs": "^2.8.6", + "nuqs": "^2.8.9", "picomatch": "^4.0.3", - "react": "^19.2.3", - "react-dom": "^19.2.3", + "react": "^19.2.4", + "react-dom": "^19.2.4", "react-error-boundary": "^6.0.1", "react-icons": "^5.5.0", "t2-demo-parser": "file:.yalc/t2-demo-parser", "three": "^0.182.0", "unzipper": "^0.12.3", - "zustand": "^5.0.9" + "zustand": "^5.0.11" }, "devDependencies": { "@eslint/js": "^9.39.2", @@ -49,7 +49,7 @@ "@types/lodash.orderby": "^4.6.9", "@types/node": "24.3.1", "@types/picomatch": "^4.0.2", - "@types/react": "^19.2.7", + "@types/react": "^19.2.14", "@types/three": "^0.182.0", "@types/unzipper": "^0.10.11", "babel-plugin-react-compiler": "^1.0.0", @@ -65,6 +65,6 @@ "tsx": "^4.21.0", "typescript": "5.9.3", "typescript-eslint": "^8.51.0", - "vitest": "^4.0.16" + "vitest": "^4.0.18" } } diff --git a/scripts/blender/dts2gltf.py b/scripts/blender/dts2gltf.py index 28d25b72..5c3df193 100644 --- a/scripts/blender/dts2gltf.py +++ b/scripts/blender/dts2gltf.py @@ -74,13 +74,18 @@ for i, in_path in enumerate(input_files, start=1): # Reset scene for each file bpy.ops.wm.read_factory_settings(use_empty=True) + # Match the fps the addon uses for keyframe placement so the glTF exporter + # converts frame numbers to the correct times (factory default is 24fps). + bpy.context.scene.render.fps = 30 + bpy.context.scene.render.fps_base = 1.0 + # Re-enable add-on after reset addon_utils.enable(args.addon, default_set=True, handle_error=None) # Import print(f"[dts2gltf] [{i}/{total}] Converting: {in_path}") try: - res = op_call(filepath=in_path, merge_verts=True, import_sequences=True) + res = op_call(filepath=in_path, merge_verts=True, import_sequences=True, dsq_name_from_filename=True) if "FINISHED" not in res: raise RuntimeError(f"Import failed via {op_id}") except Exception: @@ -108,6 +113,11 @@ for i, in_path in enumerate(input_files, start=1): # Blender and T2 are Z-up, but these assets are destined for Three.js which # is Y-up. It's easiest to match the Y-up of our destination engine. export_yup=True, + # Don't force-sample all bones; only export F-curves that exist. + # This prevents placeholder animations (IFL/visibility-only sequences) + # from getting rest-pose channels for every bone, which would override + # other playing animations. + export_force_sampling=False, # Draco compression export_draco_mesh_compression_enable=True, export_draco_mesh_compression_level=6, diff --git a/src/components/DemoEntities.tsx b/src/components/DemoEntities.tsx index 969c0bf7..124430db 100644 --- a/src/components/DemoEntities.tsx +++ b/src/components/DemoEntities.tsx @@ -7,7 +7,7 @@ import { DemoPlayerModel } from "./DemoPlayerModel"; import { DemoShapeModel, DemoWeaponModel } from "./DemoShapeModel"; import { DemoSpriteProjectile, DemoTracerProjectile } from "./DemoProjectiles"; import { PlayerNameplate } from "./PlayerNameplate"; -import { useEngineStoreApi } from "../state"; +import { useEngineSelector } from "../state"; import type { DemoEntity } from "../demo/types"; /** @@ -23,9 +23,11 @@ export function DemoEntityGroup({ entity: DemoEntity; timeRef: MutableRefObject; }) { - const engineStore = useEngineStoreApi(); const debug = useDebug(); const debugMode = debug?.debugMode ?? false; + const controlPlayerGhostId = useEngineSelector( + (state) => state.playback.streamSnapshot?.controlPlayerGhostId, + ); const name = String(entity.id); if (entity.visual?.kind === "tracer") { @@ -77,9 +79,7 @@ export function DemoEntityGroup({ // Player entities use skeleton-preserving DemoPlayerModel for animation. if (entity.type === "Player") { - const isControlPlayer = - entity.id === - engineStore.getState().playback.recording?.controlPlayerGhostId; + const isControlPlayer = entity.id === controlPlayerGhostId; return ( @@ -103,7 +103,7 @@ export function DemoEntityGroup({ - + diff --git a/src/components/DemoParticleEffects.tsx b/src/components/DemoParticleEffects.tsx new file mode 100644 index 00000000..23f2e4d7 --- /dev/null +++ b/src/components/DemoParticleEffects.tsx @@ -0,0 +1,715 @@ +import { useEffect, useRef } from "react"; +import { useFrame, useThree } from "@react-three/fiber"; +import { + AdditiveBlending, + BoxGeometry, + BufferGeometry, + DataTexture, + DoubleSide, + Float32BufferAttribute, + Group, + Mesh, + MeshBasicMaterial, + NormalBlending, + RGBAFormat, + ShaderMaterial, + SphereGeometry, + Texture, + TextureLoader, + Uint16BufferAttribute, + UnsignedByteType, +} from "three"; +import { textureToUrl } from "../loaders"; +import { setupEffectTexture } from "../demo/demoPlaybackUtils"; +import { + EmitterInstance, + resolveEmitterData, +} from "../particles/ParticleSystem"; +import { + particleVertexShader, + particleFragmentShader, +} from "../particles/shaders"; +import type { EmitterDataResolved } from "../particles/types"; +import type { + DemoStreamSnapshot, + DemoStreamingPlayback, +} from "../demo/types"; +import { useDebug } from "./SettingsProvider"; + +// ── Constants ── + +const MAX_PARTICLES_PER_EMITTER = 256; +const QUAD_CORNERS = new Float32Array([ + -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, +]); + +// ── Texture cache ── + +const _textureLoader = new TextureLoader(); +const _textureCache = new Map(); +/** Set of textures whose image data has finished loading. */ +const _texturesReady = new Set(); + +/** 1×1 white placeholder so particles are visible before async textures load. */ +const _placeholderTexture = new DataTexture( + new Uint8Array([255, 255, 255, 255]), + 1, + 1, + RGBAFormat, + UnsignedByteType, +); +_placeholderTexture.needsUpdate = true; + +function getParticleTexture(textureName: string): Texture { + if (!textureName) return _placeholderTexture; + const cached = _textureCache.get(textureName); + if (cached) return cached; + try { + const url = textureToUrl(textureName); + const tex = _textureLoader.load(url, (t) => { + setupEffectTexture(t); + _texturesReady.add(t); + }); + setupEffectTexture(tex); + _textureCache.set(textureName, tex); + return tex; + } catch { + return _placeholderTexture; + } +} + +// ── Debug geometry (reusable) ── + +const _debugOriginGeo = new SphereGeometry(1, 6, 6); +const _debugOriginMat = new MeshBasicMaterial({ color: 0xff0000, wireframe: true }); +const _debugParticleGeo = new BoxGeometry(0.3, 0.3, 0.3); +const _debugParticleMat = new MeshBasicMaterial({ color: 0x00ff00, wireframe: true }); + +// ── sRGB → linear conversion for shader attributes ── + +function srgbToLinear(c: number): number { + return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); +} + +// ── Geometry builder ── + +function createParticleGeometry(maxParticles: number): BufferGeometry { + const geo = new BufferGeometry(); + const vertCount = maxParticles * 4; + const indexCount = maxParticles * 6; + + // Per-vertex quad corner offsets. + const corners = new Float32Array(vertCount * 2); + for (let i = 0; i < maxParticles; i++) { + corners.set(QUAD_CORNERS, i * 8); + } + + // Index buffer. + const indices = new Uint16Array(indexCount); + for (let i = 0; i < maxParticles; i++) { + const vBase = i * 4; + const iBase = i * 6; + indices[iBase] = vBase; + indices[iBase + 1] = vBase + 1; + indices[iBase + 2] = vBase + 2; + indices[iBase + 3] = vBase; + indices[iBase + 4] = vBase + 2; + indices[iBase + 5] = vBase + 3; + } + + // Per-particle attributes (4 verts share the same value). + const positions = new Float32Array(vertCount * 3); + const colors = new Float32Array(vertCount * 4); + const sizes = new Float32Array(vertCount); + const spins = new Float32Array(vertCount); + + geo.setIndex(new Uint16BufferAttribute(indices, 1)); + geo.setAttribute("quadCorner", new Float32BufferAttribute(corners, 2)); + geo.setAttribute("position", new Float32BufferAttribute(positions, 3)); + geo.setAttribute("particleColor", new Float32BufferAttribute(colors, 4)); + geo.setAttribute("particleSize", new Float32BufferAttribute(sizes, 1)); + geo.setAttribute("particleSpin", new Float32BufferAttribute(spins, 1)); + + geo.setDrawRange(0, 0); + return geo; +} + +function createParticleMaterial( + texture: Texture, + useInvAlpha: boolean, +): ShaderMaterial { + // Use the placeholder until the real texture's image data is ready. + const ready = _texturesReady.has(texture); + return new ShaderMaterial({ + vertexShader: particleVertexShader, + fragmentShader: particleFragmentShader, + uniforms: { + particleTexture: { value: ready ? texture : _placeholderTexture }, + hasTexture: { value: true }, + }, + transparent: true, + depthWrite: false, + depthTest: true, + side: DoubleSide, + blending: useInvAlpha ? NormalBlending : AdditiveBlending, + }); +} + +// ── Per-emitter rendering state ── + +interface ActiveEmitter { + emitter: EmitterInstance; + mesh: Mesh; + geometry: BufferGeometry; + material: ShaderMaterial; + /** The intended texture (may still be loading). */ + targetTexture: Texture; + origin: [number, number, number]; + isBurst: boolean; + hasBurst: boolean; + /** Entity ID this emitter follows (for projectile trails). */ + followEntityId?: string; + /** Debug: origin marker mesh. */ + debugOriginMesh?: Mesh; + /** Debug: particle marker meshes. */ + debugParticleMeshes?: Mesh[]; +} + +/** Check if a ShaderMaterial compiled successfully. Must call after first render. */ +function checkShaderCompilation( + renderer: import("three").WebGLRenderer, + material: ShaderMaterial, + label: string, +): void { + const props = renderer.properties.get(material) as { currentProgram?: { program: WebGLProgram } }; + const program = props.currentProgram; + if (!program) return; // Not yet compiled. + const glProgram = program!.program; + const glContext = renderer.getContext(); + if (!glContext.getProgramParameter(glProgram, glContext.LINK_STATUS)) { + console.error( + `[ParticleFX] Shader LINK ERROR (${label}):`, + glContext.getProgramInfoLog(glProgram), + ); + } +} + +// ── Explosion resolution ── + +interface ResolvedExplosion { + burstEmitters: Array<{ data: EmitterDataResolved; density: number }>; + streamingEmitters: EmitterDataResolved[]; + lifetimeMS: number; +} + +function resolveExplosion( + explosionDataBlockId: number, + getDataBlockData: (id: number) => Record | undefined, +): ResolvedExplosion | null { + const expBlock = getDataBlockData(explosionDataBlockId); + if (!expBlock) { + console.log("[resolveExplosion] getDataBlockData returned undefined for id:", explosionDataBlockId); + return null; + } + + // DEBUG: log the raw explosion datablock fields + console.log("[resolveExplosion] expBlock keys:", Object.keys(expBlock), "particleEmitter:", expBlock.particleEmitter, "emitters:", expBlock.emitters, "particleDensity:", expBlock.particleDensity); + + const burstEmitters: ResolvedExplosion["burstEmitters"] = []; + const streamingEmitters: EmitterDataResolved[] = []; + + // Burst emitter: particleEmitter + particleDensity. + const particleEmitterId = expBlock.particleEmitter as number | null; + if (typeof particleEmitterId === "number") { + const emitterRaw = getDataBlockData(particleEmitterId); + console.log("[resolveExplosion] burst emitter lookup — particleEmitterId:", particleEmitterId, "found:", !!emitterRaw); + if (emitterRaw) { + console.log("[resolveExplosion] burst emitter raw keys:", Object.keys(emitterRaw), "particles:", emitterRaw.particles); + const resolved = resolveEmitterData(emitterRaw, getDataBlockData); + if (resolved) { + const density = (expBlock.particleDensity as number) ?? 10; + console.log("[resolveExplosion] burst emitter RESOLVED — density:", density, "textureName:", resolved.particles.textureName, "particleLifetimeMS:", resolved.particles.lifetimeMS, "emitterLifetimeMS:", resolved.lifetimeMS); + burstEmitters.push({ data: resolved, density }); + } else { + console.log("[resolveExplosion] resolveEmitterData returned null for burst emitter"); + } + } + } else { + console.log("[resolveExplosion] no particleEmitter field (value:", expBlock.particleEmitter, ")"); + } + + // Streaming emitters: emitters[0..3]. + const emitterRefs = expBlock.emitters as (number | null)[] | undefined; + if (Array.isArray(emitterRefs)) { + console.log("[resolveExplosion] emitters array:", emitterRefs); + for (const ref of emitterRefs) { + if (typeof ref !== "number") continue; + const emitterRaw = getDataBlockData(ref); + if (!emitterRaw) { + console.log("[resolveExplosion] streaming emitter ref", ref, "not found"); + continue; + } + console.log("[resolveExplosion] streaming emitter raw keys:", Object.keys(emitterRaw), "particles:", emitterRaw.particles); + const resolved = resolveEmitterData(emitterRaw, getDataBlockData); + if (resolved) { + console.log("[resolveExplosion] streaming emitter RESOLVED — textureName:", resolved.particles.textureName, "particleLifetimeMS:", resolved.particles.lifetimeMS, "emitterLifetimeMS:", resolved.lifetimeMS, "ejectionPeriodMS:", resolved.ejectionPeriodMS); + streamingEmitters.push(resolved); + } else { + console.log("[resolveExplosion] resolveEmitterData returned null for streaming emitter ref:", ref); + } + } + } else { + console.log("[resolveExplosion] no emitters array on expBlock"); + } + + if (burstEmitters.length === 0 && streamingEmitters.length === 0) { + console.log("[resolveExplosion] no emitters resolved at all, returning null"); + return null; + } + + // lifetimeMS is in ticks (32ms each) in the demo parser. + const lifetimeTicks = (expBlock.lifetimeMS as number) ?? 31; + const lifetimeMS = lifetimeTicks * 32; + + return { burstEmitters, streamingEmitters, lifetimeMS }; +} + +// ── Update GPU buffers from particle state ── + +function syncBuffers(active: ActiveEmitter): void { + const particles = active.emitter.particles; + const geo = active.geometry; + const posAttr = geo.getAttribute("position") as Float32BufferAttribute; + const colorAttr = geo.getAttribute("particleColor") as Float32BufferAttribute; + const sizeAttr = geo.getAttribute("particleSize") as Float32BufferAttribute; + const spinAttr = geo.getAttribute("particleSpin") as Float32BufferAttribute; + + const posArr = posAttr.array as Float32Array; + const colArr = colorAttr.array as Float32Array; + const sizeArr = sizeAttr.array as Float32Array; + const spinArr = spinAttr.array as Float32Array; + + const count = Math.min(particles.length, MAX_PARTICLES_PER_EMITTER); + + for (let i = 0; i < count; i++) { + const p = particles[i]; + + // Swizzle Torque [x,y,z] → Three.js [y,z,x]. + const tx = p.pos[1]; + const ty = p.pos[2]; + const tz = p.pos[0]; + + // Convert sRGB particle colors to linear for the shader. + const lr = srgbToLinear(p.r); + const lg = srgbToLinear(p.g); + const lb = srgbToLinear(p.b); + const la = p.a; + + // Write the same values to all 4 vertices of the quad. + for (let v = 0; v < 4; v++) { + const vi = i * 4 + v; + const pi = vi * 3; + posArr[pi] = tx; + posArr[pi + 1] = ty; + posArr[pi + 2] = tz; + + const ci = vi * 4; + colArr[ci] = lr; + colArr[ci + 1] = lg; + colArr[ci + 2] = lb; + colArr[ci + 3] = la; + + sizeArr[vi] = p.size; + spinArr[vi] = p.currentSpin; + } + } + + // Zero out unused vertices so they collapse to zero-area quads. + for (let i = count; i < MAX_PARTICLES_PER_EMITTER; i++) { + for (let v = 0; v < 4; v++) { + sizeArr[i * 4 + v] = 0; + } + } + + posAttr.needsUpdate = true; + colorAttr.needsUpdate = true; + sizeAttr.needsUpdate = true; + spinAttr.needsUpdate = true; + + geo.setDrawRange(0, count * 6); +} + +// ── Main component ── + +export function DemoParticleEffects({ + playback, + snapshotRef, +}: { + playback: DemoStreamingPlayback; + snapshotRef: React.RefObject; +}) { + const { debugMode } = useDebug(); + const gl = useThree((s) => s.gl); + const groupRef = useRef(null); + const activeEmittersRef = useRef([]); + /** Track which explosion entity IDs we've already processed. */ + const processedExplosionsRef = useRef>(new Set()); + /** Track which projectile entity IDs have trail emitters attached. */ + const trailEntitiesRef = useRef>(new Set()); + /** Throttle for periodic debug logs. */ + const lastDebugLogRef = useRef(0); + + useEffect(() => { + console.log("[ParticleFX] MOUNTED — playback:", !!playback, "snapshotRef:", !!snapshotRef); + }, [playback, snapshotRef]); + + useFrame((_, delta) => { + const group = groupRef.current; + const snapshot = snapshotRef.current; + if (!group || !snapshot) { + // DEBUG: log when snapshot or group is missing + console.log("[ParticleFX] early return — group:", !!group, "snapshot:", !!snapshot); + return; + } + + const dtMS = delta * 1000; + const getDataBlockData = playback.getDataBlockData.bind(playback); + + // DEBUG: periodically log entity type counts (every 2 seconds). + const now = performance.now(); + if (now - lastDebugLogRef.current > 2000) { + lastDebugLogRef.current = now; + const typeCounts: Record = {}; + let withMaintainEmitter = 0; + let withExplosionDataBlockId = 0; + for (const e of snapshot.entities) { + typeCounts[e.type] = (typeCounts[e.type] || 0) + 1; + if (e.maintainEmitterId) withMaintainEmitter++; + if (e.explosionDataBlockId) withExplosionDataBlockId++; + } + console.log( + "[ParticleFX] types:", typeCounts, + "| active emitters:", activeEmittersRef.current.length, + "| processedExplosions:", processedExplosionsRef.current.size, + "| trailEntities:", trailEntitiesRef.current.size, + "| withExplosionDataBlockId:", withExplosionDataBlockId, + "| withMaintainEmitter:", withMaintainEmitter, + ); + } + + // Detect new explosion entities and create emitters. + for (const entity of snapshot.entities) { + if ( + entity.type !== "Explosion" || + !entity.explosionDataBlockId || + !entity.position + ) { + // DEBUG: log entities that are type "Explosion" but fail the other checks + if (entity.type === "Explosion") { + console.log("[ParticleFX] Explosion entity SKIPPED — id:", entity.id, "explosionDataBlockId:", entity.explosionDataBlockId, "position:", entity.position); + } + continue; + } + if (processedExplosionsRef.current.has(entity.id)) continue; + processedExplosionsRef.current.add(entity.id); + + // DEBUG: log new explosion entity being processed + console.log("[ParticleFX] NEW explosion entity:", entity.id, "dataBlockId:", entity.explosionDataBlockId, "pos:", entity.position); + + const resolved = resolveExplosion( + entity.explosionDataBlockId, + getDataBlockData, + ); + if (!resolved) { + console.log("[ParticleFX] resolveExplosion returned null for dataBlockId:", entity.explosionDataBlockId); + continue; + } + + // DEBUG: log resolved explosion details + console.log("[ParticleFX] resolveExplosion OK — burstEmitters:", resolved.burstEmitters.length, "streamingEmitters:", resolved.streamingEmitters.length, "lifetimeMS:", resolved.lifetimeMS); + + const origin: [number, number, number] = [...entity.position]; + + // Create burst emitters. + for (const burst of resolved.burstEmitters) { + const emitter = new EmitterInstance( + burst.data, + MAX_PARTICLES_PER_EMITTER, + ); + emitter.emitBurst(origin, burst.density); + + // DEBUG: log burst emitter creation + console.log("[ParticleFX] Created BURST emitter — particles after burst:", emitter.particles.length, "origin:", origin, "texture:", burst.data.particles.textureName, "particleLifetimeMS:", burst.data.particles.lifetimeMS, "keyframes:", burst.data.particles.keys.length, "key0:", burst.data.particles.keys[0]); + + const texture = getParticleTexture(burst.data.particles.textureName); + console.log("[ParticleFX] burst texture loaded:", !!texture, "textureName:", burst.data.particles.textureName); + const geometry = createParticleGeometry(MAX_PARTICLES_PER_EMITTER); + const material = createParticleMaterial( + texture, + burst.data.particles.useInvAlpha, + ); + const mesh = new Mesh(geometry, material); + mesh.frustumCulled = false; + group.add(mesh); + + activeEmittersRef.current.push({ + emitter, + mesh, + geometry, + material, + targetTexture: texture, + origin, + isBurst: true, + hasBurst: true, + }); + } + + // Create streaming emitters (lifetime capped by explosion duration). + for (const emitterData of resolved.streamingEmitters) { + const emitter = new EmitterInstance( + emitterData, + MAX_PARTICLES_PER_EMITTER, + resolved.lifetimeMS, + ); + + // DEBUG: log streaming emitter creation + console.log("[ParticleFX] Created STREAMING emitter — emitterLifetimeMS:", emitterData.lifetimeMS, "ejectionPeriodMS:", emitterData.ejectionPeriodMS, "origin:", origin, "texture:", emitterData.particles.textureName, "particleLifetimeMS:", emitterData.particles.lifetimeMS); + + const texture = getParticleTexture(emitterData.particles.textureName); + console.log("[ParticleFX] streaming texture loaded:", !!texture, "textureName:", emitterData.particles.textureName); + const geometry = createParticleGeometry(MAX_PARTICLES_PER_EMITTER); + const material = createParticleMaterial( + texture, + emitterData.particles.useInvAlpha, + ); + const mesh = new Mesh(geometry, material); + mesh.frustumCulled = false; + group.add(mesh); + + activeEmittersRef.current.push({ + emitter, + mesh, + geometry, + material, + targetTexture: texture, + origin, + isBurst: false, + hasBurst: false, + }); + } + } + + // Detect projectile entities with trail emitters (maintainEmitterId). + const currentEntityIds = new Set(); + for (const entity of snapshot.entities) { + currentEntityIds.add(entity.id); + + if (!entity.maintainEmitterId || trailEntitiesRef.current.has(entity.id)) { + continue; + } + trailEntitiesRef.current.add(entity.id); + + const emitterRaw = getDataBlockData(entity.maintainEmitterId); + if (!emitterRaw) continue; + + const emitterData = resolveEmitterData(emitterRaw, getDataBlockData); + if (!emitterData) continue; + + const origin: [number, number, number] = entity.position + ? [...entity.position] + : [0, 0, 0]; + + const emitter = new EmitterInstance(emitterData, MAX_PARTICLES_PER_EMITTER); + + console.log( + "[ParticleFX] Created TRAIL emitter for", + entity.type, + entity.id, + "— maintainEmitterId:", + entity.maintainEmitterId, + "texture:", + emitterData.particles.textureName, + ); + + const texture = getParticleTexture(emitterData.particles.textureName); + const geometry = createParticleGeometry(MAX_PARTICLES_PER_EMITTER); + const material = createParticleMaterial( + texture, + emitterData.particles.useInvAlpha, + ); + const mesh = new Mesh(geometry, material); + mesh.frustumCulled = false; + group.add(mesh); + + activeEmittersRef.current.push({ + emitter, + mesh, + geometry, + material, + targetTexture: texture, + origin, + isBurst: false, + hasBurst: false, + followEntityId: entity.id, + }); + } + + // Mark trail emitters as dead when their projectile disappears. + for (const entry of activeEmittersRef.current) { + if (entry.followEntityId && !currentEntityIds.has(entry.followEntityId)) { + entry.emitter.kill(); + } + } + + // Prune trail entity tracking set. + for (const id of trailEntitiesRef.current) { + if (!currentEntityIds.has(id)) { + trailEntitiesRef.current.delete(id); + } + } + + // Update all active emitters. + const active = activeEmittersRef.current; + for (let i = active.length - 1; i >= 0; i--) { + const entry = active[i]; + + // One-time shader compilation check on first frame. + checkShaderCompilation(gl, entry.material, entry.isBurst ? "burst" : "stream"); + + // Update trail emitter origin to follow the projectile's position. + if (entry.followEntityId) { + const tracked = snapshot.entities.find( + (e) => e.id === entry.followEntityId, + ); + if (tracked?.position) { + entry.origin[0] = tracked.position[0]; + entry.origin[1] = tracked.position[1]; + entry.origin[2] = tracked.position[2]; + } + } + + // Streaming emitters emit periodically. + if (!entry.isBurst) { + entry.emitter.emitPeriodic(entry.origin, dtMS); + } + + // Advance physics and interpolation. + entry.emitter.update(dtMS); + + // DEBUG: log particle state on first few frames of each emitter + if (entry.emitter.particles.length > 0 && Math.random() < 0.02) { + const p0 = entry.emitter.particles[0]; + console.log("[ParticleFX] update — isBurst:", entry.isBurst, "particleCount:", entry.emitter.particles.length, "p0.pos:", p0.pos, "p0.size:", p0.size, "p0.a:", p0.a, "p0.age/lifetime:", p0.currentAge, "/", p0.totalLifetime, "drawRange:", entry.geometry.drawRange); + } + + // Swap in the real texture once it finishes loading. + if ( + _texturesReady.has(entry.targetTexture) && + entry.material.uniforms.particleTexture.value !== entry.targetTexture + ) { + entry.material.uniforms.particleTexture.value = entry.targetTexture; + } + + // Sync GPU buffers. + syncBuffers(entry); + + // Debug visualization: place markers at origin and particle positions. + if (debugMode) { + // Origin marker (red wireframe sphere). + if (!entry.debugOriginMesh) { + entry.debugOriginMesh = new Mesh(_debugOriginGeo, _debugOriginMat); + entry.debugOriginMesh.frustumCulled = false; + group.add(entry.debugOriginMesh); + } + // Swizzle origin to Three.js coordinates. + entry.debugOriginMesh.position.set( + entry.origin[1], + entry.origin[2], + entry.origin[0], + ); + + // Particle markers (green wireframe boxes) — show up to 8. + if (!entry.debugParticleMeshes) { + entry.debugParticleMeshes = []; + } + const maxDebugParticles = Math.min(entry.emitter.particles.length, 8); + // Add meshes if needed. + while (entry.debugParticleMeshes.length < maxDebugParticles) { + const m = new Mesh(_debugParticleGeo, _debugParticleMat); + m.frustumCulled = false; + group.add(m); + entry.debugParticleMeshes.push(m); + } + // Update positions or hide extras. + for (let j = 0; j < entry.debugParticleMeshes.length; j++) { + const dm = entry.debugParticleMeshes[j]; + if (j < entry.emitter.particles.length) { + const p = entry.emitter.particles[j]; + dm.position.set(p.pos[1], p.pos[2], p.pos[0]); + dm.visible = true; + } else { + dm.visible = false; + } + } + } else { + // Clean up debug meshes when debug mode is off. + if (entry.debugOriginMesh) { + group.remove(entry.debugOriginMesh); + entry.debugOriginMesh = undefined; + } + if (entry.debugParticleMeshes) { + for (const dm of entry.debugParticleMeshes) { + group.remove(dm); + } + entry.debugParticleMeshes = undefined; + } + } + + // Remove dead emitters. + if (entry.emitter.isDead()) { + console.log("[ParticleFX] removing DEAD emitter — isBurst:", entry.isBurst, "origin:", entry.origin); + group.remove(entry.mesh); + entry.geometry.dispose(); + entry.material.dispose(); + if (entry.debugOriginMesh) group.remove(entry.debugOriginMesh); + if (entry.debugParticleMeshes) { + for (const dm of entry.debugParticleMeshes) group.remove(dm); + } + active.splice(i, 1); + } + } + + // Prune processed set when it gets large. + if (processedExplosionsRef.current.size > 500) { + const currentIds = new Set(snapshot.entities.map((e) => e.id)); + for (const id of processedExplosionsRef.current) { + if (!currentIds.has(id)) { + processedExplosionsRef.current.delete(id); + } + } + } + }); + + // Cleanup on unmount. + useEffect(() => { + return () => { + const group = groupRef.current; + for (const entry of activeEmittersRef.current) { + if (group) { + group.remove(entry.mesh); + if (entry.debugOriginMesh) group.remove(entry.debugOriginMesh); + if (entry.debugParticleMeshes) { + for (const dm of entry.debugParticleMeshes) group.remove(dm); + } + } + entry.geometry.dispose(); + entry.material.dispose(); + } + activeEmittersRef.current = []; + processedExplosionsRef.current.clear(); + trailEntitiesRef.current.clear(); + }; + }, []); + + return ; +} diff --git a/src/components/DemoPlayback.tsx b/src/components/DemoPlayback.tsx index d70c13c6..45e95f00 100644 --- a/src/components/DemoPlayback.tsx +++ b/src/components/DemoPlayback.tsx @@ -30,9 +30,6 @@ function DemoPlaybackDiagnostics({ recording }: { recording: DemoRecording }) { meta: { missionName: recording.missionName ?? null, gameType: recording.gameType ?? null, - isMetadataOnly: !!recording.isMetadataOnly, - isPartial: !!recording.isPartial, - hasStreamingPlayback: !!recording.streamingPlayback, durationSec: Number(recording.duration.toFixed(3)), }, }); diff --git a/src/components/DemoPlaybackStreaming.tsx b/src/components/DemoPlaybackStreaming.tsx index 054f94dc..ef59e263 100644 --- a/src/components/DemoPlaybackStreaming.tsx +++ b/src/components/DemoPlaybackStreaming.tsx @@ -4,34 +4,48 @@ import { useGLTF } from "@react-three/drei"; import { Group, Quaternion, - Raycaster, Vector3, } from "three"; import { buildStreamDemoEntity, - CAMERA_COLLISION_RADIUS, DEFAULT_EYE_HEIGHT, - hasAncestorNamed, nextLifecycleInstanceId, - streamSnapshotSignature, STREAM_TICK_SEC, torqueHorizontalFovToThreeVerticalFov, } from "../demo/demoPlaybackUtils"; import { shapeToUrl } from "../loaders"; import { TickProvider } from "./TickProvider"; import { DemoEntityGroup } from "./DemoEntities"; +import { DemoParticleEffects } from "./DemoParticleEffects"; import { PlayerEyeOffset } from "./DemoPlayerModel"; import { useEngineStoreApi } from "../state"; -import type { DemoEntity, DemoRecording, DemoStreamSnapshot } from "../demo/types"; +import type { + DemoEntity, + DemoRecording, + DemoStreamEntity, + DemoStreamSnapshot, +} from "../demo/types"; + +type EntityById = Map; + +/** Cache entity-by-id Maps per snapshot so they're built once, not every frame. */ +const _snapshotEntityCache = new WeakMap(); +function getEntityMap(snapshot: DemoStreamSnapshot): EntityById { + let map = _snapshotEntityCache.get(snapshot); + if (!map) { + map = new Map(snapshot.entities.map((e) => [e.id, e])); + _snapshotEntityCache.set(snapshot, map); + } + return map; +} const _tmpVec = new Vector3(); const _interpQuatA = new Quaternion(); const _interpQuatB = new Quaternion(); +const _billboardFlip = new Quaternion(0, 1, 0, 0); // 180° around Y const _orbitDir = new Vector3(); const _orbitTarget = new Vector3(); const _orbitCandidate = new Vector3(); -const _hitNormal = new Vector3(); -const _orbitRaycaster = new Raycaster(); let streamingDemoPlaybackMountCount = 0; let streamingDemoPlaybackUnmountCount = 0; @@ -50,8 +64,8 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording const eyeOffsetRef = useRef(new Vector3(0, DEFAULT_EYE_HEIGHT, 0)); const streamRef = useRef(recording.streamingPlayback ?? null); const publishedSnapshotRef = useRef(null); - const entitySignatureRef = useRef(""); const entityMapRef = useRef>(new Map()); + const lastSyncedSnapshotRef = useRef(null); const lastEntityRebuildEventMsRef = useRef(0); const exhaustedEventLoggedRef = useRef(false); const [entities, setEntities] = useState([]); @@ -109,13 +123,18 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording }, [engineStore]); const syncRenderableEntities = useCallback((snapshot: DemoStreamSnapshot) => { - const previousEntityCount = entityMapRef.current.size; - const nextSignature = streamSnapshotSignature(snapshot); - const shouldRebuild = entitySignatureRef.current !== nextSignature; + if (snapshot === lastSyncedSnapshotRef.current) return; + lastSyncedSnapshotRef.current = snapshot; + + const prevMap = entityMapRef.current; const nextMap = new Map(); + // Derive shouldRebuild from the entity loop itself instead of computing + // an O(n) string signature every frame. Entity count change catches + // add/remove; identity check catches per-entity changes. + let shouldRebuild = snapshot.entities.length !== prevMap.size; for (const entity of snapshot.entities) { - let renderEntity = entityMapRef.current.get(entity.id); + let renderEntity = prevMap.get(entity.id); if ( !renderEntity || renderEntity.type !== entity.type || @@ -139,6 +158,7 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording entity.dataBlockId, entity.shapeHint, ); + shouldRebuild = true; } renderEntity.playerName = entity.playerName; @@ -151,6 +171,7 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording renderEntity.ghostIndex = entity.ghostIndex; renderEntity.dataBlockId = entity.dataBlockId; renderEntity.shapeHint = entity.shapeHint; + renderEntity.threads = entity.threads; if (renderEntity.keyframes.length === 0) { renderEntity.keyframes.push({ @@ -176,7 +197,6 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording entityMapRef.current = nextMap; if (shouldRebuild) { - entitySignatureRef.current = nextSignature; setEntities(Array.from(nextMap.values())); const now = Date.now(); if (now - lastEntityRebuildEventMsRef.current >= 500) { @@ -185,7 +205,7 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording kind: "stream.entities.rebuild", message: "Renderable demo entity list was rebuilt", meta: { - previousEntityCount, + previousEntityCount: prevMap.size, nextEntityCount: nextMap.size, snapshotTimeSec: Number(snapshot.timeSec.toFixed(3)), }, @@ -208,7 +228,7 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording useEffect(() => { streamRef.current = recording.streamingPlayback ?? null; entityMapRef.current = new Map(); - entitySignatureRef.current = ""; + lastSyncedSnapshotRef.current = null; publishedSnapshotRef.current = null; timeRef.current = 0; playbackClockRef.current = 0; @@ -383,8 +403,8 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording } } - const currentEntities = new Map(renderCurrent.entities.map((e) => [e.id, e])); - const previousEntities = new Map(renderPrev.entities.map((e) => [e.id, e])); + const currentEntities = getEntityMap(renderCurrent); + const previousEntities = getEntityMap(renderPrev); const root = rootRef.current; if (root) { for (const child of root.children) { @@ -412,7 +432,7 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording } if (entity.faceViewer) { - child.quaternion.copy(state.camera.quaternion); + child.quaternion.copy(state.camera.quaternion).multiply(_billboardFlip); } else if (entity.visual?.kind === "tracer") { child.quaternion.identity(); } else if (entity.rotation) { @@ -466,31 +486,6 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording const orbitDistance = Math.max(0.1, currentCamera.orbitDistance ?? 4); _orbitCandidate.copy(_orbitTarget).addScaledVector(_orbitDir, orbitDistance); - // Mirror Camera::validateEyePoint: cast 2.5x desired distance toward - // the candidate and pull in if an obstacle blocks the orbit. - _orbitRaycaster.near = 0.001; - _orbitRaycaster.far = orbitDistance * 2.5; - _orbitRaycaster.camera = state.camera; - _orbitRaycaster.set(_orbitTarget, _orbitDir); - const hits = _orbitRaycaster.intersectObjects(state.scene.children, true); - for (const hit of hits) { - if (hit.distance <= 0.0001) continue; - if (hasAncestorNamed(hit.object, currentCamera.orbitTargetId)) continue; - if (!hit.face) break; - - _hitNormal.copy(hit.face.normal).transformDirection(hit.object.matrixWorld); - const dot = -_orbitDir.dot(_hitNormal); - if (dot > 0.01) { - let colDist = hit.distance - CAMERA_COLLISION_RADIUS / dot; - if (colDist > orbitDistance) colDist = orbitDistance; - if (colDist < 0) colDist = 0; - _orbitCandidate - .copy(_orbitTarget) - .addScaledVector(_orbitDir, colDist); - } - break; - } - state.camera.position.copy(_orbitCandidate); state.camera.lookAt(_orbitTarget); } @@ -539,6 +534,10 @@ export function StreamingDemoPlayback({ recording }: { recording: DemoRecording ))} + {firstPersonShape && ( diff --git a/src/components/DemoPlayerModel.tsx b/src/components/DemoPlayerModel.tsx index c82781c9..96d0d6ad 100644 --- a/src/components/DemoPlayerModel.tsx +++ b/src/components/DemoPlayerModel.tsx @@ -19,9 +19,10 @@ import { processShapeScene, } from "../demo/demoPlaybackUtils"; import { pickMoveAnimation } from "../demo/playerAnimation"; +import { getAliasedActions } from "../torqueScript/shapeConstructor"; import { useStaticShape } from "./GenericShape"; import { ShapeErrorBoundary } from "./DemoEntities"; -import { useEngineStoreApi } from "../state"; +import { useEngineStoreApi, useEngineSelector } from "../state"; import type { DemoEntity } from "../demo/types"; /** @@ -41,6 +42,12 @@ export function DemoPlayerModel({ }) { const engineStore = useEngineStoreApi(); const gltf = useStaticShape(entity.dataBlock!); + const shapeAliases = useEngineSelector((state) => { + const shapeName = entity.dataBlock?.toLowerCase(); + return shapeName + ? state.runtime.sequenceAliases.get(shapeName) + : undefined; + }); // Clone scene preserving skeleton bindings, create mixer, find Mount0 bone. const { clonedScene, mixer, mount0 } = useMemo(() => { @@ -56,25 +63,21 @@ export function DemoPlayerModel({ return { clonedScene: scene, mixer: mix, mount0: m0 }; }, [gltf]); - // Build case-insensitive clip lookup and start with Root animation. + // Build case-insensitive clip lookup with alias support. const animActionsRef = useRef(new Map()); - const currentAnimRef = useRef({ name: "Root", timeScale: 1 }); + const currentAnimRef = useRef({ name: "root", timeScale: 1 }); const isDeadRef = useRef(false); useEffect(() => { - const actions = new Map(); - for (const clip of gltf.animations) { - const action = mixer.clipAction(clip); - actions.set(clip.name.toLowerCase(), action); - } + const actions = getAliasedActions(gltf.animations, mixer, shapeAliases); animActionsRef.current = actions; - // Start with Root (idle) animation. + // Start with root (idle) animation. const rootAction = actions.get("root"); if (rootAction) { rootAction.play(); } - currentAnimRef.current = { name: "Root", timeScale: 1 }; + currentAnimRef.current = { name: "root", timeScale: 1 }; // Force initial pose evaluation. mixer.update(0); @@ -83,7 +86,7 @@ export function DemoPlayerModel({ mixer.stopAllAction(); animActionsRef.current = new Map(); }; - }, [mixer, gltf.animations]); + }, [mixer, gltf.animations, shapeAliases]); // Per-frame animation selection and mixer update. useFrame((_, delta) => { @@ -101,7 +104,7 @@ export function DemoPlayerModel({ isDeadRef.current = true; const deathClips = [...actions.keys()].filter((k) => - k.startsWith("die"), + k.startsWith("death"), ); if (deathClips.length > 0) { const pick = deathClips[Math.floor(Math.random() * deathClips.length)]; @@ -129,7 +132,7 @@ export function DemoPlayerModel({ deathAction.clampWhenFinished = false; } // Reset to root so movement selection picks up on next iteration. - currentAnimRef.current = { name: "Root", timeScale: 1 }; + currentAnimRef.current = { name: "root", timeScale: 1 }; const rootAction = actions.get("root"); if (rootAction) rootAction.reset().play(); } diff --git a/src/components/DemoProvider.tsx b/src/components/DemoProvider.tsx index 62c87c4d..e0f99751 100644 --- a/src/components/DemoProvider.tsx +++ b/src/components/DemoProvider.tsx @@ -56,12 +56,7 @@ export function useDemoActions() { ); const play = useCallback(() => { - if ( - (recording?.isMetadataOnly || recording?.isPartial) && - !recording.streamingPlayback - ) { - return; - } + if (!recording) return; setPlaybackStatus("playing"); }, [recording, setPlaybackStatus]); diff --git a/src/components/DemoShapeModel.tsx b/src/components/DemoShapeModel.tsx index d2228e04..e23b02ff 100644 --- a/src/components/DemoShapeModel.tsx +++ b/src/components/DemoShapeModel.tsx @@ -11,14 +11,17 @@ import { } from "./GenericShape"; import { ShapeInfoProvider } from "./ShapeInfoProvider"; import type { TorqueObject } from "../torqueScript"; +import type { DemoThreadState } from "../demo/types"; /** Renders a shape model for a demo entity using the existing shape pipeline. */ export function DemoShapeModel({ shapeName, entityId, + threads, }: { shapeName: string; entityId: number | string; + threads?: DemoThreadState[]; }) { const torqueObject = useMemo( () => ({ @@ -35,7 +38,7 @@ export function DemoShapeModel({ shapeName={shapeName} type="StaticShape" > - + ); } diff --git a/src/components/GenericShape.tsx b/src/components/GenericShape.tsx index edb6c15d..52953982 100644 --- a/src/components/GenericShape.tsx +++ b/src/components/GenericShape.tsx @@ -1,26 +1,43 @@ -import { memo, Suspense, useMemo, useRef } from "react"; +import { memo, Suspense, useEffect, useMemo, useRef } from "react"; import { ErrorBoundary } from "react-error-boundary"; import { useGLTF, useTexture } from "@react-three/drei"; import { useFrame } from "@react-three/fiber"; import { FALLBACK_TEXTURE_URL, textureToUrl, shapeToUrl } from "../loaders"; -import { filterGeometryByVertexGroups, getHullBoneIndices } from "../meshUtils"; import { MeshStandardMaterial, MeshBasicMaterial, MeshLambertMaterial, AdditiveBlending, + AnimationMixer, + AnimationClip, + LoopOnce, + LoopRepeat, Texture, BufferGeometry, Group, } from "three"; +import type { AnimationAction } from "three"; +import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js"; import { setupTexture } from "../textureUtils"; import { useDebug, useSettings } from "./SettingsProvider"; import { useShapeInfo, isOrganicShape } from "./ShapeInfoProvider"; +import { useEngineSelector } from "../state"; import { FloatingLabel } from "./FloatingLabel"; -import { useIflTexture } from "./useIflTexture"; +import { + useIflTexture, + loadIflAtlas, + getFrameIndexForTime, + updateAtlasFrame, +} from "./useIflTexture"; +import type { IflAtlas } from "./useIflTexture"; import { injectCustomFog } from "../fogShader"; import { globalFogUniforms } from "../globalFogUniforms"; import { injectShapeLighting } from "../shapeMaterial"; +import { + processShapeScene, + replaceWithShapeMaterial, +} from "../demo/demoPlaybackUtils"; +import type { DemoThreadState } from "../demo/types"; /** Shared props for texture rendering components */ interface TextureProps { @@ -83,8 +100,10 @@ export function createMaterialFromFlags( // Animated vis also needs transparent materials so opacity can be updated per frame. const isFaded = vis < 1 || animated; - // SelfIlluminating materials are unlit (use MeshBasicMaterial) - if (isSelfIlluminating) { + // SelfIlluminating or Additive materials are unlit (use MeshBasicMaterial). + // Additive materials without SelfIlluminating (e.g. explosion shells) must + // also be unlit, otherwise they render black with no scene lighting. + if (isSelfIlluminating || isAdditive) { const isBlended = isAdditive || isTranslucent || isFaded; const mat = new MeshBasicMaterial({ map: texture, @@ -399,9 +418,11 @@ function HardcodedShape({ label }: { label?: string }) { */ export function ShapeRenderer({ loadingColor = "yellow", + demoThreads, children, }: { loadingColor?: string; + demoThreads?: DemoThreadState[]; children?: React.ReactNode; }) { const { object, shapeName } = useShapeInfo(); @@ -423,259 +444,594 @@ export function ShapeRenderer({ } > }> - + {children} ); } -/** Check if a GLB node has an auto-playing "Ambient" vis animation. */ -function hasAmbientVisAnimation(userData: any): boolean { - return ( - userData != null && - (userData.vis_sequence ?? "").toLowerCase() === "ambient" && - Array.isArray(userData.vis_keyframes) && - userData.vis_keyframes.length > 1 && - (userData.vis_duration ?? 0) > 0 - ); -} - -/** - * Wraps child meshes and animates their material opacity using DTS vis keyframes. - * Used for auto-playing "Ambient" sequences (glow pulses, light effects). - */ -function AnimatedVisGroup({ - keyframes, - duration, - cyclic, - children, -}: { +/** Vis node info collected from the scene for vis opacity animation. */ +interface VisNode { + mesh: any; keyframes: number[]; duration: number; cyclic: boolean; - children: React.ReactNode; -}) { - const groupRef = useRef(null); - const { animationEnabled } = useSettings(); - - useFrame(() => { - const group = groupRef.current; - if (!group) return; - - if (!animationEnabled) { - group.traverse((child) => { - if ((child as any).isMesh) { - const mat = (child as any).material; - if (mat && !Array.isArray(mat)) { - mat.opacity = keyframes[0]; - } - } - }); - return; - } - - const elapsed = performance.now() / 1000; - const t = cyclic - ? (elapsed % duration) / duration - : Math.min(elapsed / duration, 1); - - const n = keyframes.length; - const pos = t * n; - const lo = Math.floor(pos) % n; - const hi = (lo + 1) % n; - const frac = pos - Math.floor(pos); - const vis = keyframes[lo] + (keyframes[hi] - keyframes[lo]) * frac; - - group.traverse((child) => { - if ((child as any).isMesh) { - const mat = (child as any).material; - if (mat && !Array.isArray(mat)) { - mat.opacity = vis; - } - } - }); - }); - - return {children}; } -export const ShapeModel = memo(function ShapeModel() { - const { object, shapeName, isOrganic } = useShapeInfo(); +/** Active animation thread state, keyed by thread slot number. */ +interface ThreadState { + sequence: string; + action?: AnimationAction; + visNodes?: VisNode[]; + startTime: number; +} + +// Thread slot constants matching power.cs globals +const DEPLOY_THREAD = 3; + +/** + * Unified shape renderer. Clones the full scene graph (preserving skeleton + * bindings), applies Tribes 2 materials via processShapeScene, and drives + * animation threads either through TorqueScript (for deployable shapes with + * a runtime) or directly (ambient/power vis sequences). + */ +export const ShapeModel = memo(function ShapeModel({ + gltf, + demoThreads, +}: { + gltf: ReturnType; + demoThreads?: DemoThreadState[]; +}) { + const { object, shapeName } = useShapeInfo(); const { debugMode } = useDebug(); - const { nodes } = useStaticShape(shapeName); + const { animationEnabled } = useSettings(); + const runtime = useEngineSelector((state) => state.runtime.runtime); - const hullBoneIndices = useMemo(() => { - const skeletonsFound = Object.values(nodes).filter( - (node: any) => node.skeleton, - ); + const { + clonedScene, + mixer, + clipsByName, + visNodesBySequence, + iflMeshes, + } = useMemo(() => { + const scene = SkeletonUtils.clone(gltf.scene) as Group; - if (skeletonsFound.length > 0) { - const skeleton = (skeletonsFound[0] as any).skeleton; - return getHullBoneIndices(skeleton); + // Detect IFL materials BEFORE processShapeScene replaces them, since the + // replacement materials lose the original userData (flag_names, resource_path). + const iflInfos: Array<{ + mesh: any; + iflPath: string; + hasVisSequence: boolean; + iflSequence?: string; + iflDuration?: number; + iflCyclic?: boolean; + iflToolBegin?: number; + }> = []; + scene.traverse((node: any) => { + if (!node.isMesh || !node.material) return; + const mat = Array.isArray(node.material) + ? node.material[0] + : node.material; + if (!mat?.userData) return; + const flags = new Set(mat.userData.flag_names ?? []); + const rp: string | undefined = mat.userData.resource_path; + if (flags.has("IflMaterial") && rp) { + const ud = node.userData; + // ifl_sequence is set by the addon when ifl_matters links this IFL to + // a controlling sequence. vis_sequence is a separate system (opacity + // animation) and must NOT be used as a fallback — the two are independent. + const iflSeq = ud?.ifl_sequence + ? String(ud.ifl_sequence).toLowerCase() + : undefined; + const iflDur = ud?.ifl_duration + ? Number(ud.ifl_duration) + : undefined; + const iflCyclic = ud?.ifl_sequence ? !!ud.ifl_cyclic : undefined; + const iflToolBegin = ud?.ifl_tool_begin != null + ? Number(ud.ifl_tool_begin) + : undefined; + iflInfos.push({ + mesh: node, + iflPath: `textures/${rp}.ifl`, + hasVisSequence: !!(ud?.vis_sequence), + iflSequence: iflSeq, + iflDuration: iflDur, + iflCyclic, + iflToolBegin, + }); + } + }); + + processShapeScene(scene); + + // Un-hide IFL meshes that don't have a vis sequence — they should always + // be visible. IFL meshes WITH vis sequences stay hidden until their + // sequence is activated by playThread. + for (const { mesh, hasVisSequence } of iflInfos) { + if (!hasVisSequence) { + mesh.visible = true; + } } - return new Set(); - }, [nodes]); - const processedNodes = useMemo(() => { - return Object.entries(nodes) - .filter( - ([name, node]: [string, any]) => - node.material && - node.material.name !== "Unassigned" && - !node.name.match(/^Hulk/i) && - // DTS per-object visibility: skip invisible objects (engine threshold - // is 0.01) unless they have an Ambient vis animation that will bring - // them to life (e.g. glow effects that pulse from 0 to 1). - ((node.userData?.vis ?? 1) > 0.01 || - hasAmbientVisAnimation(node.userData)), - ) - .map(([name, node]: [string, any]) => { - let geometry = filterGeometryByVertexGroups( - node.geometry, - hullBoneIndices, - ); - let backGeometry = null; + // Collect ALL vis-animated nodes, grouped by sequence name. + const visBySeq = new Map(); + scene.traverse((node: any) => { + if (!node.isMesh) return; + const ud = node.userData; + if (!ud) return; + const kf = ud.vis_keyframes; + const dur = ud.vis_duration; + const seqName = (ud.vis_sequence ?? "").toLowerCase(); + if (!seqName || !Array.isArray(kf) || kf.length <= 1 || !dur || dur <= 0) + return; - // Compute smooth vertex normals for ALL shapes to match Tribes 2's lighting - if (geometry) { - geometry = geometry.clone(); + let list = visBySeq.get(seqName); + if (!list) { + list = []; + visBySeq.set(seqName, list); + } + list.push({ + mesh: node, + keyframes: kf, + duration: dur, + cyclic: !!ud.vis_cyclic, + }); + }); - // First compute face normals - geometry.computeVertexNormals(); + // Build clips by name (case-insensitive) + const clips = new Map(); + for (const clip of gltf.animations) { + clips.set(clip.name.toLowerCase(), clip); + } - // Then smooth normals across vertices at the same position - // This handles split vertices (for UV seams) that computeVertexNormals misses - const posAttr = geometry.attributes.position; - const normAttr = geometry.attributes.normal; - const positions = posAttr.array as Float32Array; - const normals = normAttr.array as Float32Array; + // Only create a mixer if there are skeleton animation clips. + const mix = clips.size > 0 ? new AnimationMixer(scene) : null; - // Build a map of position -> list of vertex indices at that position - const positionMap = new Map(); - for (let i = 0; i < posAttr.count; i++) { - // Round to avoid floating point precision issues - const key = `${positions[i * 3].toFixed(4)},${positions[i * 3 + 1].toFixed(4)},${positions[i * 3 + 2].toFixed(4)}`; - if (!positionMap.has(key)) { - positionMap.set(key, []); - } - positionMap.get(key)!.push(i); + return { + clonedScene: scene, + mixer: mix, + clipsByName: clips, + visNodesBySequence: visBySeq, + iflMeshes: iflInfos, + }; + }, [gltf]); + + const threadsRef = useRef(new Map()); + const iflMeshAtlasRef = useRef(new Map()); + + interface IflAnimInfo { + atlas: IflAtlas; + sequenceName?: string; + /** Controlling sequence duration in seconds. */ + sequenceDuration?: number; + cyclic?: boolean; + /** Torque `toolBegin`: offset into IFL timeline (seconds). */ + toolBegin?: number; + } + const iflAnimInfosRef = useRef([]); + const iflTimeRef = useRef(0); + const animationEnabledRef = useRef(animationEnabled); + animationEnabledRef.current = animationEnabled; + + // Stable ref for the deploy-end callback so useFrame can advance the + // lifecycle when animation is toggled off mid-deploy. + const onDeployEndRef = useRef<((slot: number) => void) | null>(null); + + // Refs for demo thread-driven animation (exposed from the main animation effect). + const demoThreadsRef = useRef(demoThreads); + demoThreadsRef.current = demoThreads; + const handlePlayThreadRef = useRef<((slot: number, seq: string) => void) | null>(null); + const handleStopThreadRef = useRef<((slot: number) => void) | null>(null); + const prevDemoThreadsRef = useRef(undefined); + + // Load IFL texture atlases imperatively (processShapeScene can't resolve + // .ifl paths since they require async loading of the frame list). + useEffect(() => { + iflAnimInfosRef.current = []; + iflMeshAtlasRef.current.clear(); + for (const info of iflMeshes) { + loadIflAtlas(info.iflPath) + .then((atlas) => { + const mat = Array.isArray(info.mesh.material) + ? info.mesh.material[0] + : info.mesh.material; + if (mat) { + mat.map = atlas.texture; + mat.needsUpdate = true; } + iflAnimInfosRef.current.push({ + atlas, + sequenceName: info.iflSequence, + sequenceDuration: info.iflDuration, + cyclic: info.iflCyclic, + toolBegin: info.iflToolBegin, + }); + iflMeshAtlasRef.current.set(info.mesh, atlas); + }) + .catch(() => {}); + } + }, [iflMeshes]); - // Average normals for vertices at the same position - for (const indices of positionMap.values()) { - if (indices.length > 1) { - // Sum all normals at this position - let nx = 0, - ny = 0, - nz = 0; - for (const idx of indices) { - nx += normals[idx * 3]; - ny += normals[idx * 3 + 1]; - nz += normals[idx * 3 + 2]; - } - // Normalize the sum - const len = Math.sqrt(nx * nx + ny * ny + nz * nz); - if (len > 0) { - nx /= len; - ny /= len; - nz /= len; - } - // Apply averaged normal to all vertices at this position - for (const idx of indices) { - normals[idx * 3] = nx; - normals[idx * 3 + 1] = ny; - normals[idx * 3 + 2] = nz; - } - } - } - normAttr.needsUpdate = true; + // Animation setup. Shared helpers (handlePlayThread, handleStopThread) are + // used by both mission rendering and demo playback. The lifecycle that + // decides WHEN to call them differs: mission mode auto-plays deploy and + // subscribes to TorqueScript; demo mode does nothing on mount and lets + // the useFrame handler drive everything from ghost thread data. + useEffect(() => { + const threads = threadsRef.current; - // For organic shapes, also create back geometry with flipped normals - if (isOrganic) { - backGeometry = geometry.clone(); - const backNormAttr = backGeometry.attributes.normal; - const backNormals = backNormAttr.array; - for (let i = 0; i < backNormals.length; i++) { - backNormals[i] = -backNormals[i]; - } - backNormAttr.needsUpdate = true; + function prepareVisNode(v: VisNode) { + v.mesh.visible = true; + if (v.mesh.material?.isMeshStandardMaterial) { + const mat = v.mesh.material as MeshStandardMaterial; + const result = replaceWithShapeMaterial(mat, v.mesh.userData?.vis ?? 0); + v.mesh.material = Array.isArray(result) ? result[1] : result; + } + if (v.mesh.material && !Array.isArray(v.mesh.material)) { + v.mesh.material.transparent = true; + v.mesh.material.depthWrite = false; + } + const atlas = iflMeshAtlasRef.current.get(v.mesh); + if (atlas && v.mesh.material && !Array.isArray(v.mesh.material)) { + v.mesh.material.map = atlas.texture; + v.mesh.material.needsUpdate = true; + } + } + + function handlePlayThread(slot: number, sequenceName: string) { + const seqLower = sequenceName.toLowerCase(); + handleStopThread(slot); + + const clip = clipsByName.get(seqLower); + const vNodes = visNodesBySequence.get(seqLower); + const thread: ThreadState = { + sequence: seqLower, + startTime: performance.now() / 1000, + }; + + if (clip && mixer) { + const action = mixer.clipAction(clip); + if (seqLower === "deploy") { + action.setLoop(LoopOnce, 1); + action.clampWhenFinished = true; + } else { + action.setLoop(LoopRepeat, Infinity); + } + action.reset().play(); + thread.action = action; + + // When animations are disabled, snap deploy to its end pose. + if (!animationEnabledRef.current && seqLower === "deploy") { + action.time = clip.duration; + mixer.update(0); + // In mission mode, onDeployEndRef advances the lifecycle. + // In demo mode it's null — the ghost data drives what's next. + if (onDeployEndRef.current) { + queueMicrotask(() => onDeployEndRef.current?.(slot)); } } + } - const vis: number = node.userData?.vis ?? 1; - const visAnim = hasAmbientVisAnimation(node.userData) - ? { - keyframes: node.userData.vis_keyframes as number[], - duration: node.userData.vis_duration as number, - cyclic: !!node.userData.vis_cyclic, + if (vNodes) { + for (const v of vNodes) prepareVisNode(v); + thread.visNodes = vNodes; + } + + threads.set(slot, thread); + } + + function handleStopThread(slot: number) { + const thread = threads.get(slot); + if (!thread) return; + if (thread.action) thread.action.stop(); + if (thread.visNodes) { + for (const v of thread.visNodes) { + v.mesh.visible = false; + if (v.mesh.material && !Array.isArray(v.mesh.material)) { + v.mesh.material.opacity = v.keyframes[0]; + } + } + } + threads.delete(slot); + } + + handlePlayThreadRef.current = handlePlayThread; + handleStopThreadRef.current = handleStopThread; + + // ── Demo playback: all animation driven by ghost thread data ── + // No deploy lifecycle, no auto-play, no TorqueScript. The useFrame + // handler reads demoThreads and calls handlePlayThread/handleStopThread. + if (demoThreadsRef.current != null) { + return () => { + handlePlayThreadRef.current = null; + handleStopThreadRef.current = null; + for (const slot of [...threads.keys()]) handleStopThread(slot); + }; + } + + // ── Mission rendering: deploy lifecycle + TorqueScript ── + const hasDeployClip = clipsByName.has("deploy"); + const useTorqueDeploy = !!(runtime && hasDeployClip && object.datablock); + + function fireOnEndSequence(slot: number) { + if (!runtime) return; + const dbName = object.datablock; + if (!dbName) return; + const datablock = runtime.getObjectByName(String(dbName)); + if (datablock) { + runtime.$.call(datablock, "onEndSequence", object, slot); + } + } + + onDeployEndRef.current = useTorqueDeploy + ? fireOnEndSequence + : () => startPostDeployThreads(); + + function startPostDeployThreads() { + const autoPlaySequences = ["ambient", "power"]; + for (const seqName of autoPlaySequences) { + const vNodes = visNodesBySequence.get(seqName); + if (vNodes) { + const startTime = performance.now() / 1000; + for (const v of vNodes) prepareVisNode(v); + const slot = seqName === "power" ? 0 : 1; + threads.set(slot, { sequence: seqName, visNodes: vNodes, startTime }); + } + const clip = clipsByName.get(seqName); + if (clip && mixer) { + const action = mixer.clipAction(clip); + action.setLoop(LoopRepeat, Infinity); + action.reset().play(); + const slot = seqName === "power" ? 0 : 1; + const existing = threads.get(slot); + if (existing) { + existing.action = action; + } else { + threads.set(slot, { + sequence: seqName, + action, + startTime: performance.now() / 1000, + }); + } + } + } + } + + const unsubs: (() => void)[] = []; + + const onFinished = mixer + ? (e: { action: AnimationAction }) => { + for (const [slot, thread] of threads) { + if (thread.action === e.action) { + if (useTorqueDeploy) { + fireOnEndSequence(slot); + } else { + startPostDeployThreads(); + } + break; } - : undefined; - return { node, geometry, backGeometry, vis, visAnim }; - }); - }, [nodes, hullBoneIndices, isOrganic]); + } + } + : null; - // Disable shadows for organic shapes to avoid artifacts with alpha-tested materials - // Shadow maps don't properly handle alpha transparency, causing checkerboard patterns - const enableShadows = !isOrganic; + if (onFinished && mixer) { + mixer.addEventListener("finished", onFinished); + } + + if (runtime) { + unsubs.push( + runtime.$.onMethodCalled( + "ShapeBase", + "playThread", + (thisObj, slot, sequence) => { + if (thisObj._id !== object._id) return; + handlePlayThread(Number(slot), String(sequence)); + }, + ), + ); + unsubs.push( + runtime.$.onMethodCalled( + "ShapeBase", + "stopThread", + (thisObj, slot) => { + if (thisObj._id !== object._id) return; + handleStopThread(Number(slot)); + }, + ), + ); + unsubs.push( + runtime.$.onMethodCalled( + "ShapeBase", + "pauseThread", + (thisObj, slot) => { + if (thisObj._id !== object._id) return; + const thread = threads.get(Number(slot)); + if (thread?.action) { + thread.action.paused = true; + } + }, + ), + ); + } + + if (useTorqueDeploy) { + runtime.$.call(object, "deploy"); + } else if (hasDeployClip) { + handlePlayThread(DEPLOY_THREAD, "deploy"); + } else { + startPostDeployThreads(); + } + + return () => { + if (onFinished && mixer) { + mixer.removeEventListener("finished", onFinished); + } + unsubs.forEach((fn) => fn()); + onDeployEndRef.current = null; + handlePlayThreadRef.current = null; + handleStopThreadRef.current = null; + for (const slot of [...threads.keys()]) handleStopThread(slot); + }; + }, [mixer, clipsByName, visNodesBySequence, object, runtime]); + + // Build DTS sequence index → animation name lookup. If the glTF has the + // dts_sequence_names extra (set by the addon), use it for an exact mapping + // from ghost ThreadMask indices to animation names. Otherwise fall back to + // positional indexing (which only works if no sequences were filtered). + const seqIndexToName = useMemo(() => { + const raw = gltf.scene.userData?.dts_sequence_names; + if (typeof raw === "string") { + try { + const names: string[] = JSON.parse(raw); + return names.map((n) => n.toLowerCase()); + } catch {} + } + return gltf.animations.map((a) => a.name.toLowerCase()); + }, [gltf]); + + useFrame((_, delta) => { + const threads = threadsRef.current; + + // React to demo thread state changes. The ghost ThreadMask data tells us + // exactly which DTS sequences are playing/stopped on each of 4 thread slots. + const currentDemoThreads = demoThreadsRef.current; + const prevDemoThreads = prevDemoThreadsRef.current; + if (currentDemoThreads !== prevDemoThreads) { + prevDemoThreadsRef.current = currentDemoThreads; + const playThread = handlePlayThreadRef.current; + const stopThread = handleStopThreadRef.current; + if (playThread && stopThread) { + // Use sparse arrays instead of Maps — thread indices are 0-3. + const currentBySlot: Array = []; + if (currentDemoThreads) { + for (const t of currentDemoThreads) currentBySlot[t.index] = t; + } + const prevBySlot: Array = []; + if (prevDemoThreads) { + for (const t of prevDemoThreads) prevBySlot[t.index] = t; + } + const maxSlot = Math.max(currentBySlot.length, prevBySlot.length); + for (let slot = 0; slot < maxSlot; slot++) { + const t = currentBySlot[slot]; + const prev = prevBySlot[slot]; + if (t) { + const changed = !prev + || prev.sequence !== t.sequence + || prev.state !== t.state + || prev.atEnd !== t.atEnd; + if (!changed) continue; + const seqName = seqIndexToName[t.sequence]; + if (!seqName) continue; + if (t.state === 0) { + playThread(slot, seqName); + } else { + stopThread(slot); + } + } else if (prev) { + // Thread disappeared — stop it. + stopThread(slot); + } + } + } + } + + if (mixer) { + // If animation is disabled and deploy is still mid-animation, + // snap to the fully-deployed pose and fire onEndSequence. + if (!animationEnabled) { + const deployThread = threads.get(DEPLOY_THREAD); + if (deployThread?.action) { + const clip = deployThread.action.getClip(); + if (deployThread.action.time < clip.duration - 0.001) { + deployThread.action.time = clip.duration; + mixer.update(0); + onDeployEndRef.current?.(DEPLOY_THREAD); + } + } + } + + if (animationEnabled) { + mixer.update(delta); + } + } + + // Drive vis opacity animations for active threads. + for (const [, thread] of threads) { + if (!thread.visNodes) continue; + + for (const { mesh, keyframes, duration, cyclic } of thread.visNodes) { + const mat = mesh.material; + if (!mat || Array.isArray(mat)) continue; + + if (!animationEnabled) { + mat.opacity = keyframes[0]; + continue; + } + + const elapsed = performance.now() / 1000 - thread.startTime; + const t = cyclic + ? (elapsed % duration) / duration + : Math.min(elapsed / duration, 1); + + const n = keyframes.length; + const pos = t * n; + const lo = Math.floor(pos) % n; + const hi = (lo + 1) % n; + const frac = pos - Math.floor(pos); + mat.opacity = keyframes[lo] + (keyframes[hi] - keyframes[lo]) * frac; + } + } + + // Advance IFL texture atlases. + // Matches Torque's animateIfls(): + // time = th->pos * th->sequence->duration + th->sequence->toolBegin + // where pos is [0,1) cyclic or [0,1] clamped, then frame is looked up in + // cumulative iflFrameOffTimes (seconds, at 1/30s per IFL tick). + // toolBegin offsets into the IFL timeline so the sequence window aligns + // with the desired frames (e.g. skipping a long "off" period). + const iflAnimInfos = iflAnimInfosRef.current; + if (iflAnimInfos.length > 0) { + iflTimeRef.current += delta; + for (const info of iflAnimInfos) { + if (!animationEnabled) { + updateAtlasFrame(info.atlas, 0); + continue; + } + + if (info.sequenceName && info.sequenceDuration) { + // Sequence-driven IFL: find the thread playing this sequence and + // compute time = pos * duration + toolBegin (matching the engine). + let iflTime = 0; + for (const [, thread] of threads) { + if (thread.sequence === info.sequenceName) { + const elapsed = performance.now() / 1000 - thread.startTime; + const dur = info.sequenceDuration; + // Reproduce th->pos: cyclic wraps [0,1), non-cyclic clamps [0,1] + const pos = info.cyclic + ? (elapsed / dur) % 1 + : Math.min(elapsed / dur, 1); + iflTime = pos * dur + (info.toolBegin ?? 0); + break; + } + } + updateAtlasFrame(info.atlas, getFrameIndexForTime(info.atlas, iflTime)); + } else { + // No controlling sequence: use accumulated real time. + // (In the engine, these would stay at frame 0, but cycling is more + // useful for display purposes.) + updateAtlasFrame( + info.atlas, + getFrameIndexForTime(info.atlas, iflTimeRef.current), + ); + } + } + } + }); return ( - {processedNodes.map(({ node, geometry, backGeometry, vis, visAnim }) => { - const animated = !!visAnim; - const fallback = ( - - - - ); - const textures = node.material ? ( - Array.isArray(node.material) ? ( - node.material.map((mat, index) => ( - - )) - ) : ( - - ) - ) : null; - - if (visAnim) { - return ( - - {textures} - - ); - } - - return ( - - {textures} - - ); - })} + {debugMode ? ( {object._id}: {shapeName} @@ -684,3 +1040,9 @@ export const ShapeModel = memo(function ShapeModel() { ); }); + +function ShapeModelLoader({ demoThreads }: { demoThreads?: DemoThreadState[] }) { + const { shapeName } = useShapeInfo(); + const gltf = useStaticShape(shapeName); + return ; +} diff --git a/src/components/Mission.tsx b/src/components/Mission.tsx index 04b23eae..7e89b9cc 100644 --- a/src/components/Mission.tsx +++ b/src/components/Mission.tsx @@ -22,6 +22,7 @@ import { } from "../manifest"; import { MissionProvider } from "./MissionContext"; import { engineStore } from "../state"; +import { ignoreScripts } from "../torqueScript/ignoreScripts"; const loadScript = createScriptLoader(); // Shared cache for parsed scripts - survives runtime restarts @@ -92,36 +93,7 @@ function useExecutedMission( cache: scriptCache, signal: controller.signal, progress: progressTracker, - ignoreScripts: [ - "scripts/admin.cs", - // `ignoreScripts` supports globs, but out of an abundance of caution - // we don't want to do `ai*.cs` in case there's some non-AI related - // word like "air" in a script name. - "scripts/ai.cs", - "scripts/aiBotProfiles.cs", - "scripts/aiBountyGame.cs", - "scripts/aiChat.cs", - "scripts/aiCnH.cs", - "scripts/aiCTF.cs", - "scripts/aiDeathMatch.cs", - "scripts/aiDebug.cs", - "scripts/aiDefaultTasks.cs", - "scripts/aiDnD.cs", - "scripts/aiHumanTasks.cs", - "scripts/aiHunters.cs", - "scripts/aiInventory.cs", - "scripts/aiObjectiveBuilder.cs", - "scripts/aiObjectives.cs", - "scripts/aiRabbit.cs", - "scripts/aiSiege.cs", - "scripts/aiTDM.cs", - "scripts/aiTeamHunters.cs", - "scripts/deathMessages.cs", - "scripts/graphBuild.cs", - "scripts/navGraph.cs", - "scripts/serverTasks.cs", - "scripts/spdialog.cs", - ], + ignoreScripts, }, }); diff --git a/src/components/PlayerHUD.tsx b/src/components/PlayerHUD.tsx index 24d5cf16..46ae9300 100644 --- a/src/components/PlayerHUD.tsx +++ b/src/components/PlayerHUD.tsx @@ -1,67 +1,7 @@ -import { useMemo } from "react"; -import { useDemoCurrentTime, useDemoRecording } from "./DemoProvider"; -import type { DemoEntity, DemoKeyframe, CameraModeFrame } from "../demo/types"; +import { useDemoRecording } from "./DemoProvider"; import { useEngineSelector } from "../state"; import styles from "./PlayerHUD.module.css"; -/** - * Binary search for the most recent keyframe at or before `time`. - * Returns the keyframe's health/energy values (carried forward from last - * known ghost update). - */ -function getStatusAtTime( - keyframes: DemoKeyframe[], - time: number, -): { health: number; energy: number } { - if (keyframes.length === 0) return { health: 1, energy: 1 }; - - let lo = 0; - let hi = keyframes.length - 1; - - if (time <= keyframes[0].time) { - return { - health: keyframes[0].health ?? 1, - energy: keyframes[0].energy ?? 1, - }; - } - if (time >= keyframes[hi].time) { - return { - health: keyframes[hi].health ?? 1, - energy: keyframes[hi].energy ?? 1, - }; - } - - while (hi - lo > 1) { - const mid = (lo + hi) >> 1; - if (keyframes[mid].time <= time) lo = mid; - else hi = mid; - } - - return { - health: keyframes[lo].health ?? 1, - energy: keyframes[lo].energy ?? 1, - }; -} - -/** Binary search for the active CameraModeFrame at a given time. */ -function getCameraModeAtTime( - frames: CameraModeFrame[], - time: number, -): CameraModeFrame | null { - if (frames.length === 0) return null; - if (time < frames[0].time) return null; - if (time >= frames[frames.length - 1].time) return frames[frames.length - 1]; - - let lo = 0; - let hi = frames.length - 1; - while (hi - lo > 1) { - const mid = (lo + hi) >> 1; - if (frames[mid].time <= time) lo = mid; - else hi = mid; - } - return frames[lo]; -} - function HealthBar({ value }: { value: number }) { const pct = Math.max(0, Math.min(100, value * 100)); return ( @@ -106,69 +46,13 @@ function Compass() { export function PlayerHUD() { const recording = useDemoRecording(); - const currentTime = useDemoCurrentTime(); const streamSnapshot = useEngineSelector( (state) => state.playback.streamSnapshot, ); - // Build an entity lookup by ID for quick access. - const entityMap = useMemo(() => { - const map = new Map(); - if (!recording) return map; - for (const entity of recording.entities) { - map.set(entity.id, entity); - } - return map; - }, [recording]); - if (!recording) return null; - if (recording.isMetadataOnly || recording.isPartial) { - const status = streamSnapshot?.status; - if (!status) return null; - return ( -
- - - - - - - - -
- ); - } - - // Determine which entity to show status for based on camera mode. - const frame = getCameraModeAtTime(recording.cameraModes, currentTime); - - // Resolve health and energy for the active player: - // - First-person: health from ghost entity (DamageMask), energy from the - // recording_player entity (CO readPacketData, higher precision). - // - Third-person (orbit): both from the orbit target entity. - let status = { health: 1, energy: 1 }; - if (frame?.mode === "first-person") { - const ghostEntity = recording.controlPlayerGhostId - ? entityMap.get(recording.controlPlayerGhostId) - : undefined; - const recEntity = entityMap.get("recording_player"); - const ghostStatus = ghostEntity - ? getStatusAtTime(ghostEntity.keyframes, currentTime) - : undefined; - const recStatus = recEntity - ? getStatusAtTime(recEntity.keyframes, currentTime) - : undefined; - status = { - health: ghostStatus?.health ?? 1, - // Prefer CO energy (available every tick) over ghost energy (sparse). - energy: recStatus?.energy ?? ghostStatus?.energy ?? 1, - }; - } else if (frame?.mode === "third-person" && frame.orbitTargetId) { - const entity = entityMap.get(frame.orbitTargetId); - if (entity) { - status = getStatusAtTime(entity.keyframes, currentTime); - } - } + const status = streamSnapshot?.status; + if (!status) return null; return (
diff --git a/src/components/RuntimeProvider.tsx b/src/components/RuntimeProvider.tsx index 994915aa..26e38679 100644 --- a/src/components/RuntimeProvider.tsx +++ b/src/components/RuntimeProvider.tsx @@ -24,3 +24,4 @@ export function useRuntime(): TorqueRuntime { } return runtime; } + diff --git a/src/components/ShapeSelect.tsx b/src/components/ShapeSelect.tsx new file mode 100644 index 00000000..2077dd4c --- /dev/null +++ b/src/components/ShapeSelect.tsx @@ -0,0 +1,207 @@ +import { + startTransition, + useEffect, + useMemo, + useRef, + useState, +} from "react"; +import { + Combobox, + ComboboxItem, + ComboboxList, + ComboboxPopover, + ComboboxProvider, + ComboboxGroup, + ComboboxGroupLabel, + useComboboxStore, +} from "@ariakit/react"; +import { matchSorter } from "match-sorter"; +import { getResourceList, getSourceAndPath } from "../manifest"; +import orderBy from "lodash.orderby"; +import styles from "./MissionSelect.module.css"; + +interface ShapeItem { + /** Manifest resource key (lowercased path like "shapes/beacon.glb"). */ + resourceKey: string; + /** Display name (e.g. "beacon.dts"). */ + displayName: string; + /** The .dts shape name to pass to shapeToUrl (e.g. "beacon.dts"). */ + shapeName: string; + /** Source vl2 archive. */ + sourcePath: string; + /** Group label for the combobox. */ + groupName: string; +} + +const sourceGroupNames: Record = { + "shapes.vl2": "Shapes", + "TR2final105-client.vl2": "Team Rabbit 2", +}; + +const allShapes: ShapeItem[] = getResourceList() + .filter((key) => key.startsWith("shapes/") && key.endsWith(".dts")) + .map((resourceKey) => { + const [sourcePath, actualPath] = getSourceAndPath(resourceKey); + const fileName = actualPath.split("/").pop() ?? actualPath; + const groupName = sourceGroupNames[sourcePath] ?? (sourcePath || "Loose"); + return { + resourceKey, + displayName: fileName, + shapeName: fileName, + sourcePath, + groupName, + }; + }); + +const shapesByName = new Map(allShapes.map((s) => [s.shapeName, s])); + +function groupShapes(shapes: ShapeItem[]) { + const groupMap = new Map(); + + for (const shape of shapes) { + const group = groupMap.get(shape.groupName) ?? []; + group.push(shape); + groupMap.set(shape.groupName, group); + } + + groupMap.forEach((groupShapes, groupName) => { + groupMap.set( + groupName, + orderBy(groupShapes, [(s) => s.displayName.toLowerCase()], ["asc"]), + ); + }); + + return orderBy( + Array.from(groupMap.entries()), + [ + ([groupName]) => (groupName === "Shapes" ? 0 : 1), + ([groupName]) => groupName.toLowerCase(), + ], + ["asc", "asc"], + ); +} + +const defaultGroups = groupShapes(allShapes); + +const isMac = + typeof navigator !== "undefined" && + /Mac|iPhone|iPad|iPod/.test(navigator.platform); + +export function ShapeSelect({ + value, + onChange, +}: { + value: string; + onChange: (shapeName: string) => void; +}) { + const [searchValue, setSearchValue] = useState(""); + const inputRef = useRef(null); + + const combobox = useComboboxStore({ + placement: "bottom-start", + resetValueOnHide: true, + selectedValue: value, + setSelectedValue: (newValue) => { + if (newValue) { + onChange(newValue); + inputRef.current?.blur(); + } + }, + setValue: (value) => { + startTransition(() => setSearchValue(value)); + }, + }); + + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === "k" && (e.metaKey || e.ctrlKey)) { + e.preventDefault(); + inputRef.current?.focus(); + combobox.show(); + } + }; + document.addEventListener("keydown", handleKeyDown); + return () => document.removeEventListener("keydown", handleKeyDown); + }, [combobox]); + + const selectedShape = shapesByName.get(value); + + const filteredResults = useMemo(() => { + if (!searchValue) + return { type: "grouped" as const, groups: defaultGroups }; + const matches = matchSorter(allShapes, searchValue, { + keys: ["displayName", "groupName"], + }); + return { type: "flat" as const, shapes: matches }; + }, [searchValue]); + + const displayValue = selectedShape?.displayName ?? value; + + const noResults = + filteredResults.type === "flat" + ? filteredResults.shapes.length === 0 + : filteredResults.groups.length === 0; + + const renderItem = (shape: ShapeItem) => { + return ( + + {shape.displayName} + + ); + }; + + return ( + +
+ { + try { + document.exitPointerLock(); + } catch {} + combobox.show(); + }} + onKeyDown={(e) => { + if (e.key === "Escape" && !combobox.getState().open) { + inputRef.current?.blur(); + } + }} + /> +
+ {displayValue} +
+ {isMac ? "⌘K" : "^K"} +
+ + + {filteredResults.type === "flat" + ? filteredResults.shapes.map(renderItem) + : filteredResults.groups.map(([groupName, shapes]) => ( + + + {groupName} + + {shapes.map(renderItem)} + + ))} + {noResults && ( +
No shapes found
+ )} +
+
+
+ ); +} diff --git a/src/components/TerrainBlock.tsx b/src/components/TerrainBlock.tsx index 02f33cae..258ed3ee 100644 --- a/src/components/TerrainBlock.tsx +++ b/src/components/TerrainBlock.tsx @@ -1,4 +1,4 @@ -import { memo, useMemo, useRef, useState } from "react"; +import { memo, useEffect, useMemo, useRef, useState } from "react"; import { useFrame, useThree } from "@react-three/fiber"; import { useQuery } from "@tanstack/react-query"; import { @@ -23,6 +23,10 @@ import { uint16ToFloat32 } from "../arrayUtils"; import { setupMask } from "../textureUtils"; import { TerrainTile } from "./TerrainTile"; import { useSceneObject } from "./useSceneObject"; +import { + createTerrainHeightSampler, + setTerrainHeightSampler, +} from "../terrainHeight"; const DEFAULT_SQUARE_SIZE = 8; const DEFAULT_VISIBLE_DISTANCE = 600; @@ -572,6 +576,15 @@ export const TerrainBlock = memo(function TerrainBlock({ return geometry; }, [squareSize, terrain]); + // Register terrain height sampler for item physics simulation. + useEffect(() => { + if (!terrain) return; + setTerrainHeightSampler( + createTerrainHeightSampler(terrain.heightMap, squareSize), + ); + return () => setTerrainHeightSampler(null); + }, [terrain, squareSize]); + // Get sun direction for lightmap generation const sun = useSceneObject("Sun"); const sunDirection = useMemo(() => { diff --git a/src/components/useIflTexture.ts b/src/components/useIflTexture.ts index 9d9c905d..11908793 100644 --- a/src/components/useIflTexture.ts +++ b/src/components/useIflTexture.ts @@ -7,20 +7,24 @@ import { NearestFilter, SRGBColorSpace, Texture, + TextureLoader, } from "three"; import { iflTextureToUrl, loadImageFrameList } from "../loaders"; -import { useTick } from "./TickProvider"; +import { useTick, TICK_RATE } from "./TickProvider"; import { useSettings } from "./SettingsProvider"; -interface IflAtlas { +/** One IFL tick in seconds (Torque converts at 1/30s per tick). */ +export const IFL_TICK_SECONDS = 1 / 30; + +export interface IflAtlas { texture: CanvasTexture; columns: number; rows: number; frameCount: number; - /** Tick at which each frame starts (cumulative). */ - frameStartTicks: number[]; - /** Total ticks for one complete animation cycle. */ - totalTicks: number; + /** Cumulative end time (seconds) for each frame. */ + frameOffsetSeconds: number[]; + /** Total IFL cycle duration in seconds. */ + totalDurationSeconds: number; /** Last rendered frame index, to avoid redundant offset updates. */ lastFrame: number; } @@ -28,6 +32,14 @@ interface IflAtlas { // Module-level cache for atlas textures, shared across all components. const atlasCache = new Map(); +const _textureLoader = new TextureLoader(); + +function loadTextureAsync(url: string): Promise { + return new Promise((resolve, reject) => { + _textureLoader.load(url, resolve, undefined, reject); + }); +} + function createAtlas(textures: Texture[]): IflAtlas { const firstImage = textures[0].image as HTMLImageElement; const frameWidth = firstImage.width; @@ -67,8 +79,8 @@ function createAtlas(textures: Texture[]): IflAtlas { columns, rows, frameCount, - frameStartTicks: [], - totalTicks: 0, + frameOffsetSeconds: [], + totalDurationSeconds: 0, lastFrame: -1, }; } @@ -77,16 +89,15 @@ function computeTiming( atlas: IflAtlas, frames: { name: string; frameCount: number }[], ) { - let totalTicks = 0; - atlas.frameStartTicks = frames.map((frame) => { - const start = totalTicks; - totalTicks += frame.frameCount; - return start; + let cumulativeSeconds = 0; + atlas.frameOffsetSeconds = frames.map((frame) => { + cumulativeSeconds += frame.frameCount * IFL_TICK_SECONDS; + return cumulativeSeconds; }); - atlas.totalTicks = totalTicks; + atlas.totalDurationSeconds = cumulativeSeconds; } -function updateAtlasFrame(atlas: IflAtlas, frameIndex: number) { +export function updateAtlasFrame(atlas: IflAtlas, frameIndex: number) { if (frameIndex === atlas.lastFrame) return; atlas.lastFrame = frameIndex; @@ -96,19 +107,42 @@ function updateAtlasFrame(atlas: IflAtlas, frameIndex: number) { atlas.texture.offset.set(col / atlas.columns, row / atlas.rows); } -function getFrameIndexForTick(atlas: IflAtlas, tick: number): number { - if (atlas.totalTicks === 0) return 0; - - const cycleTick = tick % atlas.totalTicks; - const { frameStartTicks } = atlas; - - // Binary search would be faster for many frames, but linear is fine for typical IFLs. - for (let i = frameStartTicks.length - 1; i >= 0; i--) { - if (cycleTick >= frameStartTicks[i]) { - return i; - } +/** + * Find the frame index for a given time in seconds. Matches Torque's + * `animateIfls()` lookup using cumulative `iflFrameOffTimes`. + */ +export function getFrameIndexForTime( + atlas: IflAtlas, + seconds: number, +): number { + const dur = atlas.totalDurationSeconds; + if (dur <= 0) return 0; + let t = seconds; + if (t > dur) t -= dur * Math.floor(t / dur); + for (let i = 0; i < atlas.frameOffsetSeconds.length; i++) { + if (t <= atlas.frameOffsetSeconds[i]) return i; } - return 0; + return atlas.frameOffsetSeconds.length - 1; +} + +/** + * Imperatively load an IFL atlas (all frames). Returns a cached atlas if the + * same IFL has been loaded before. The returned atlas can be animated + * per-frame with `updateAtlasFrame` + `getFrameIndexForTime`. + */ +export async function loadIflAtlas(iflPath: string): Promise { + const cached = atlasCache.get(iflPath); + if (cached) return cached; + + const frames = await loadImageFrameList(iflPath); + const urls = frames.map((f) => iflTextureToUrl(f.name, iflPath)); + const textures = await Promise.all(urls.map(loadTextureAsync)); + + const atlas = createAtlas(textures); + computeTiming(atlas, frames); + atlasCache.set(iflPath, atlas); + + return atlas; } /** @@ -141,7 +175,8 @@ export function useIflTexture(iflPath: string): Texture { }, [iflPath, textures, frames]); useTick((tick) => { - const frameIndex = animationEnabled ? getFrameIndexForTick(atlas, tick) : 0; + const time = tick / TICK_RATE; + const frameIndex = animationEnabled ? getFrameIndexForTime(atlas, time) : 0; updateAtlasFrame(atlas, frameIndex); }); diff --git a/src/demo/playerAnimation.ts b/src/demo/playerAnimation.ts index ad6af404..bf8c9d36 100644 --- a/src/demo/playerAnimation.ts +++ b/src/demo/playerAnimation.ts @@ -10,7 +10,7 @@ const FALLING_THRESHOLD = -10; const MOVE_THRESHOLD = 0.1; export interface MoveAnimationResult { - /** GLB animation clip name (e.g. "Forward", "Back", "Side", "Fall", "Root"). */ + /** Engine alias name (e.g. "root", "run", "back", "side", "fall"). */ animation: string; /** 1 for forward playback, -1 for reversed (right strafe). */ timeScale: number; @@ -38,14 +38,14 @@ export function pickMoveAnimation( rotation: [number, number, number, number], ): MoveAnimationResult { if (!velocity) { - return { animation: "Root", timeScale: 1 }; + return { animation: "root", timeScale: 1 }; } const [vx, vy, vz] = velocity; // Falling: Torque Z velocity below threshold. if (vz < FALLING_THRESHOLD) { - return { animation: "Fall", timeScale: 1 }; + return { animation: "fall", timeScale: 1 }; } // Convert world velocity to player object space using body yaw. @@ -66,18 +66,18 @@ export function pickMoveAnimation( const maxDot = Math.max(forwardDot, backDot, leftDot, rightDot); if (maxDot < MOVE_THRESHOLD) { - return { animation: "Root", timeScale: 1 }; + return { animation: "root", timeScale: 1 }; } if (maxDot === forwardDot) { - return { animation: "Forward", timeScale: 1 }; + return { animation: "run", timeScale: 1 }; } if (maxDot === backDot) { - return { animation: "Back", timeScale: 1 }; + return { animation: "back", timeScale: 1 }; } if (maxDot === leftDot) { - return { animation: "Side", timeScale: 1 }; + return { animation: "side", timeScale: 1 }; } // Right strafe: same Side animation, reversed. - return { animation: "Side", timeScale: -1 }; + return { animation: "side", timeScale: -1 }; } diff --git a/src/demo/streaming.ts b/src/demo/streaming.ts index eb39b640..09cab715 100644 --- a/src/demo/streaming.ts +++ b/src/demo/streaming.ts @@ -5,7 +5,9 @@ import { DemoParser, } from "t2-demo-parser"; import { Matrix4, Quaternion } from "three"; +import { getTerrainHeightAt } from "../terrainHeight"; import type { + DemoThreadState, DemoVisual, DemoRecording, DemoStreamCamera, @@ -69,8 +71,24 @@ interface MutableStreamEntity { expiryTick?: number; /** Billboard toward camera (Torque's faceViewer). */ faceViewer?: boolean; + /** Numeric ID of the ExplosionData datablock (for particle effect resolution). */ + explosionDataBlockId?: number; + /** Numeric ID of the ParticleEmitterData for in-flight trail particles. */ + maintainEmitterId?: number; + /** Whether we've already tried to resolve maintainEmitter (debug flag). */ + maintainEmitterChecked?: boolean; /** Target's sensor group (team number). */ sensorGroup?: number; + /** DTS animation thread states from ghost ThreadMask data. */ + threads?: DemoThreadState[]; + /** Item physics simulation state (dropped weapons/items). */ + itemPhysics?: { + velocity: [number, number, number]; + atRest: boolean; + elasticity: number; + friction: number; + gravityMod: number; + }; } interface StreamState { @@ -791,6 +809,7 @@ class StreamingPlayback implements DemoStreamingPlayback { if (block.type === BlockTypeMove) { this.state.moveTicks += 1; this.advanceProjectiles(); + this.advanceItems(); this.removeExpiredExplosions(); this.updateCameraAndHud(); return true; @@ -965,6 +984,33 @@ class StreamingPlayback implements DemoStreamingPlayback { const ghostIndex = ghost.index; const prevEntityId = this.state.entityIdByGhostIndex.get(ghostIndex); + // When a projectile entity is being removed (ghost delete, ghost index + // reuse, or same-class index reuse), spawn an explosion at its last known + // position if it hasn't already exploded. The Torque engine's KillGhost + // mechanism silently drops pending ExplosionMask data when a ghost goes + // out of scope, so explosion positions almost never arrive in the demo + // stream. The original client compensated with client-side raycast + // collision detection in processTick(); we approximate by triggering the + // explosion when the ghost disappears. + if (prevEntityId) { + const prevEntity = this.state.entitiesById.get(prevEntityId); + if ( + prevEntity && + prevEntity.type === "Projectile" && + !prevEntity.hasExploded && + prevEntity.explosionShape && + prevEntity.position && + // Ghost is being deleted or its index is being reassigned to a new + // ghost (either a different class or a fresh create of the same class). + (ghost.type === "delete" || ghost.type === "create") + ) { + this.spawnExplosion( + prevEntity, + [...prevEntity.position] as [number, number, number], + ); + } + } + if (ghost.type === "delete") { if (prevEntityId) { this.state.entitiesById.delete(prevEntityId); @@ -983,8 +1029,32 @@ class StreamingPlayback implements DemoStreamingPlayback { this.state.entitiesById.delete(prevEntityId); } - let entity = this.state.entitiesById.get(entityId); - if (!entity) { + let entity: MutableStreamEntity; + const existingEntity = this.state.entitiesById.get(entityId); + if (existingEntity && ghost.type === "create") { + // Same-class ghost index reuse: reset the entity for the new ghost + // to avoid stale fields (hasExploded, explosionShape, etc.) from the + // previous occupant leaking into the new one. + existingEntity.spawnTick = this.state.moveTicks; + existingEntity.rotation = [0, 0, 0, 1]; + existingEntity.hasExploded = undefined; + existingEntity.explosionShape = undefined; + existingEntity.explosionLifetimeTicks = undefined; + existingEntity.faceViewer = undefined; + existingEntity.simulatedVelocity = undefined; + existingEntity.projectilePhysics = undefined; + existingEntity.gravityMod = undefined; + existingEntity.direction = undefined; + existingEntity.velocity = undefined; + existingEntity.position = undefined; + existingEntity.dataBlock = undefined; + existingEntity.dataBlockId = undefined; + existingEntity.shapeHint = undefined; + existingEntity.visual = undefined; + entity = existingEntity; + } else if (existingEntity) { + entity = existingEntity; + } else { entity = { id: entityId, ghostIndex, @@ -1042,7 +1112,7 @@ class StreamingPlayback implements DemoStreamingPlayback { return undefined; } - private getDataBlockData( + getDataBlockData( dataBlockId: number, ): Record | undefined { const initialBlock = this.initialBlock.dataBlocks.get(dataBlockId); @@ -1060,20 +1130,35 @@ class StreamingPlayback implements DemoStreamingPlayback { shape: string; faceViewer: boolean; lifetimeTicks: number; + explosionDataBlockId: number; } | undefined { const projBlock = this.getDataBlockData(projDataBlockId); - const explosionId = projBlock?.explosion as number | undefined; - if (explosionId == null) return undefined; + // The demo parser's field names don't match the V12 engine. The parser's + // `maintainSound` field is actually the engine's `explosion` DataBlockRef. + // (Parser reads bits correctly but assigns wrong names to ProjectileData fields.) + const explosionId = projBlock?.maintainSound as number | undefined; + if (explosionId == null) { + console.log("[streaming] resolveExplosionInfo — no explosion field on projBlock id:", projDataBlockId); + return undefined; + } const expBlock = this.getDataBlockData(explosionId); - if (!expBlock) return undefined; + if (!expBlock) { + console.log("[streaming] resolveExplosionInfo — expBlock not found for explosionId:", explosionId); + return undefined; + } const shape = expBlock.dtsFileName as string | undefined; - if (!shape) return undefined; + if (!shape) { + console.log("[streaming] resolveExplosionInfo — no dtsFileName on expBlock, explosionId:", explosionId, "keys:", Object.keys(expBlock)); + return undefined; + } // The parser's lifetimeMS field is actually in ticks (32ms each), not ms. const lifetimeTicks = (expBlock.lifetimeMS as number | undefined) ?? 31; + console.log("[streaming] resolveExplosionInfo OK — projDataBlockId:", projDataBlockId, "explosionId:", explosionId, "shape:", shape, "lifetimeTicks:", lifetimeTicks); return { shape, faceViewer: expBlock.faceViewer !== false && expBlock.faceViewer !== 0, lifetimeTicks, + explosionDataBlockId: explosionId, }; } @@ -1121,6 +1206,24 @@ class StreamingPlayback implements DemoStreamingPlayback { entity.explosionShape = info.shape; entity.faceViewer = info.faceViewer; entity.explosionLifetimeTicks = info.lifetimeTicks; + entity.explosionDataBlockId = info.explosionDataBlockId; + } + } + + // Resolve trail particle emitter for projectiles (once per entity). + if ( + entity.type === "Projectile" && + entity.maintainEmitterId == null + ) { + // The demo parser's `activateEmitter` is actually the engine's + // `baseEmitter` — the primary trail emitter for projectiles. + const trailEmitterId = blockData?.activateEmitter as number | null; + if (typeof trailEmitterId === "number" && trailEmitterId > 0) { + entity.maintainEmitterId = trailEmitterId; + console.log("[streaming] baseEmitter resolved for", entity.className, entity.id, "— emitterId:", trailEmitterId); + } else if (!entity.maintainEmitterChecked) { + console.log("[streaming] baseEmitter NOT found on", entity.className, entity.id, "— blockData keys:", blockData ? Object.keys(blockData) : "NO blockData", "activateEmitter:", blockData?.activateEmitter); + entity.maintainEmitterChecked = true; } } } @@ -1138,6 +1241,10 @@ class StreamingPlayback implements DemoStreamingPlayback { entity.weaponShape = weaponShape; } } + } else if (weaponImage && !weaponImage.dataBlockId) { + // Server explicitly unmounted the weapon (dataBlockId = 0), e.g. on + // player death. Clear the weapon so it stops rendering. + entity.weaponShape = undefined; } } } @@ -1215,6 +1322,31 @@ class StreamingPlayback implements DemoStreamingPlayback { } } + // Item physics: simulate dropped items falling under gravity and bouncing. + if (entity.type === "Item") { + const atRest = data.atRest as boolean | undefined; + if (atRest === true) { + // Server says item is at rest — stop simulating. + entity.itemPhysics = undefined; + } else if (atRest === false && isVec3Like(data.velocity)) { + // Item is moving — initialize or update physics simulation. + const blockData = + entity.dataBlockId != null + ? this.getDataBlockData(entity.dataBlockId) + : undefined; + entity.itemPhysics = { + velocity: [data.velocity.x, data.velocity.y, data.velocity.z], + atRest: false, + elasticity: getNumberField(blockData, ["elasticity"]) ?? 0.2, + friction: getNumberField(blockData, ["friction"]) ?? 0.6, + gravityMod: getNumberField(blockData, ["gravityMod"]) ?? 1.0, + }; + } else if (position && !isVec3Like(data.velocity)) { + // Server snapped position without velocity — stop simulating. + entity.itemPhysics = undefined; + } + } + // Compute simulatedVelocity for projectile physics. if (entity.projectilePhysics) { if (entity.projectilePhysics === "linear") { @@ -1295,26 +1427,7 @@ class StreamingPlayback implements DemoStreamingPlayback { explodePos && entity.explosionShape ) { - entity.hasExploded = true; - const fxId = `fx_${this.state.nextExplosionId++}`; - const lifetimeTicks = entity.explosionLifetimeTicks ?? 31; - const fxEntity: MutableStreamEntity = { - id: fxId, - ghostIndex: -1, - className: "Explosion", - spawnTick: this.state.moveTicks, - type: "Explosion", - dataBlock: entity.explosionShape, - position: [explodePos.x, explodePos.y, explodePos.z], - rotation: [0, 0, 0, 1], - isExplosion: true, - faceViewer: entity.faceViewer !== false, - expiryTick: this.state.moveTicks + lifetimeTicks, - }; - this.state.entitiesById.set(fxId, fxEntity); - // Stop the projectile — the explosion takes over visually. - entity.position = undefined; - entity.simulatedVelocity = undefined; + this.spawnExplosion(entity, [explodePos.x, explodePos.y, explodePos.z]); } if (typeof data.damageLevel === "number") { @@ -1329,6 +1442,10 @@ class StreamingPlayback implements DemoStreamingPlayback { entity.actionAtEnd = !!data.actionAtEnd; } + if (Array.isArray(data.threads)) { + entity.threads = data.threads as DemoThreadState[]; + } + if (typeof data.energy === "number") { entity.energy = clamp(data.energy, 0, 1); } @@ -1376,6 +1493,78 @@ class StreamingPlayback implements DemoStreamingPlayback { } } + private advanceItems(): void { + const dt = TICK_DURATION_MS / 1000; // 0.032 + for (const entity of this.state.entitiesById.values()) { + const phys = entity.itemPhysics; + if (!phys || phys.atRest || !entity.position) continue; + const v = phys.velocity; + const p = entity.position; + + // Gravity: Tribes 2 uses -20 m/s² (Torque Z-up). + v[2] += -20 * phys.gravityMod * dt; + + // Move + p[0] += v[0] * dt; + p[1] += v[1] * dt; + p[2] += v[2] * dt; + + // Terrain collision (flat normal approximation: [0, 0, 1]) + const groundZ = getTerrainHeightAt(p[0], p[1]); + if (groundZ != null && p[2] < groundZ) { + p[2] = groundZ; + const bd = Math.abs(v[2]); // normal impact speed + v[2] = bd * phys.elasticity; // reflect with restitution + // Friction: reduce horizontal speed proportional to impact + const friction = bd * phys.friction; + const hSpeed = Math.sqrt(v[0] * v[0] + v[1] * v[1]); + if (hSpeed > 0) { + const scale = Math.max(0, 1 - friction / hSpeed); + v[0] *= scale; + v[1] *= scale; + } + // At-rest check + const speed = Math.sqrt( + v[0] * v[0] + v[1] * v[1] + v[2] * v[2], + ); + if (speed < 0.15) { + v[0] = v[1] = v[2] = 0; + phys.atRest = true; + } + } + } + } + + /** Create a synthetic explosion entity from a projectile. */ + private spawnExplosion( + entity: MutableStreamEntity, + position: [number, number, number], + ): void { + entity.hasExploded = true; + const fxId = `fx_${this.state.nextExplosionId++}`; + const lifetimeTicks = entity.explosionLifetimeTicks ?? 31; + // DEBUG: log explosion spawn + console.log("[streaming] spawnExplosion — fxId:", fxId, "explosionDataBlockId:", entity.explosionDataBlockId, "explosionShape:", entity.explosionShape, "pos:", position, "lifetimeTicks:", lifetimeTicks, "moveTicks:", this.state.moveTicks); + const fxEntity: MutableStreamEntity = { + id: fxId, + ghostIndex: -1, + className: "Explosion", + spawnTick: this.state.moveTicks, + type: "Explosion", + dataBlock: entity.explosionShape, + explosionDataBlockId: entity.explosionDataBlockId, + position, + rotation: [0, 0, 0, 1], + isExplosion: true, + faceViewer: entity.faceViewer !== false, + expiryTick: this.state.moveTicks + lifetimeTicks, + }; + this.state.entitiesById.set(fxId, fxEntity); + // Stop the projectile — the explosion takes over visually. + entity.position = undefined; + entity.simulatedVelocity = undefined; + } + private removeExpiredExplosions(): void { for (const [id, entity] of this.state.entitiesById) { if ( @@ -1543,16 +1732,17 @@ class StreamingPlayback implements DemoStreamingPlayback { entity.type === "Player" && entity.sensorGroup != null ? this.resolveIffColor(entity.sensorGroup) : undefined, - // Clone mutable arrays so each snapshot is an immutable record of - // tick-time state. advanceProjectiles() mutates entity.position - // in-place, which would otherwise corrupt previous snapshots and - // break inter-tick interpolation in the renderer. - position: entity.position - ? ([...entity.position] as [number, number, number]) - : undefined, - rotation: entity.rotation - ? ([...entity.rotation] as [number, number, number, number]) - : undefined, + // Only clone position for entities whose position is mutated in-place + // by advanceProjectiles() or advanceItems(). Other entities get new + // arrays from applyGhostData(), so the old reference stays valid. + position: + entity.position && + (entity.simulatedVelocity || + (entity.itemPhysics && !entity.itemPhysics.atRest)) + ? ([...entity.position] as [number, number, number]) + : entity.position, + // Rotation is always replaced (never mutated in-place), so no clone. + rotation: entity.rotation, velocity: entity.velocity, health: entity.health, energy: entity.energy, @@ -1560,6 +1750,9 @@ class StreamingPlayback implements DemoStreamingPlayback { actionAtEnd: entity.actionAtEnd, damageState: entity.damageState, faceViewer: entity.faceViewer, + threads: entity.threads, + explosionDataBlockId: entity.explosionDataBlockId, + maintainEmitterId: entity.maintainEmitterId, }); } @@ -1657,10 +1850,6 @@ export async function createDemoStreamingRecording( duration: header.demoLengthMs / 1000, missionName: infoMissionName ?? initialBlock.missionName ?? null, gameType, - entities: [], - cameraModes: [], - isMetadataOnly: true, - isPartial: true, streamingPlayback: new StreamingPlayback(parser), }; } diff --git a/src/demo/types.ts b/src/demo/types.ts index 141bedd1..d28c6576 100644 --- a/src/demo/types.ts +++ b/src/demo/types.ts @@ -1,3 +1,11 @@ +export interface DemoThreadState { + index: number; + sequence: number; + state: number; + forward: boolean; + atEnd: boolean; +} + export interface DemoKeyframe { time: number; /** Position in Torque space [x, y, z]. */ @@ -66,6 +74,8 @@ export interface DemoEntity { /** Time (seconds) when this entity leaves ghost scope. */ despawnTime?: number; keyframes: DemoKeyframe[]; + /** DTS animation thread states from ghost ThreadMask data. */ + threads?: DemoThreadState[]; /** Weapon shape file name for Player entities (e.g. "weapon_disc.dts"). */ weaponShape?: string; /** Player name resolved from the target system string table. */ @@ -74,34 +84,14 @@ export interface DemoEntity { iffColor?: { r: number; g: number; b: number }; } -export interface CameraModeFrame { - time: number; - /** "first-person" = Player control object (camera at eye point). - * "third-person" = Camera in OrbitObjectMode (orbiting a ghost). - * "observer" = Camera in free/stationary/fly mode. */ - mode: "first-person" | "third-person" | "observer"; - /** Entity ID to hide in first-person (e.g. "player_5"). */ - controlEntityId?: string; - /** Entity ID being orbited in third-person (e.g. "player_5"). */ - orbitTargetId?: string; -} - export interface DemoRecording { duration: number; /** Mission name as it appears in the demo (e.g. "S5-WoodyMyrk"). */ missionName: string | null; /** Game type display name from the demo (e.g. "Capture the Flag"). */ gameType: string | null; - /** True while playback uses deferred/streaming block parsing. */ - isMetadataOnly?: boolean; - /** Legacy alias for `isMetadataOnly`. */ - isPartial?: boolean; /** Streaming parser session used for Move-tick-driven playback. */ - streamingPlayback?: DemoStreamingPlayback; - entities: DemoEntity[]; - cameraModes: CameraModeFrame[]; - /** Ghost entity ID for the recording player (e.g. "player_5"). */ - controlPlayerGhostId?: string; + streamingPlayback: DemoStreamingPlayback; } export interface DemoStreamEntity { @@ -130,6 +120,12 @@ export interface DemoStreamEntity { actionAtEnd?: boolean; damageState?: number; faceViewer?: boolean; + /** DTS animation thread states from ghost ThreadMask data. */ + threads?: DemoThreadState[]; + /** Numeric ID of the ExplosionData datablock (for particle effect resolution). */ + explosionDataBlockId?: number; + /** Numeric ID of the ParticleEmitterData for in-flight trail particles. */ + maintainEmitterId?: number; } export interface DemoStreamCamera { @@ -166,4 +162,6 @@ export interface DemoStreamingPlayback { stepToTime(targetTimeSec: number, maxMoveTicks?: number): DemoStreamSnapshot; /** DTS shape names for weapon effects (explosions) that should be preloaded. */ getEffectShapes(): string[]; + /** Resolve a datablock by its numeric ID. */ + getDataBlockData(id: number): Record | undefined; } diff --git a/src/particles/ParticleSystem.ts b/src/particles/ParticleSystem.ts new file mode 100644 index 00000000..dbc16829 --- /dev/null +++ b/src/particles/ParticleSystem.ts @@ -0,0 +1,472 @@ +import type { + EmitterDataResolved, + Particle, + ParticleDataResolved, + ParticleKey, +} from "./types"; + +const DEG_TO_RAD = Math.PI / 180; +const GRAVITY_Z = -9.81; +/** Converts (degrees/sec * ms) to radians. */ +const SPIN_FACTOR = Math.PI / (180 * 1000); + +// V12 bit-packing scaling constants. The demo parser reads raw bit-packed +// integers/floats without applying the scaling the V12 client does on read. +// See particleEngine.cc lines 205-257, 471-550. +const VELOCITY_SCALE = 1 / 100; // ejectionVelocity, velocityVariance, ejectionOffset +const SPIN_RANDOM_OFFSET = -1000; // spinRandomMin, spinRandomMax +const MAX_PARTICLE_SIZE = 50; // sizes[] packed as size/MaxParticleSize +const LIFETIME_SHIFT = 5; // lifetimeMS packed as ms >> 5; unpack with << 5 +const DRAG_SCALE = 5; // dragCoefficient packed as drag/5 +const GRAVITY_SCALE = 10; // gravityCoefficient packed as gravity/10 + +// ── Datablock resolution ── + +function getNumber( + raw: Record, + key: string, + def: number, +): number { + const v = raw[key]; + return typeof v === "number" && Number.isFinite(v) ? v : def; +} + +function getBool( + raw: Record, + key: string, + def: boolean, +): boolean { + const v = raw[key]; + if (typeof v === "boolean") return v; + if (typeof v === "number") return v !== 0; + return def; +} + +export function resolveParticleData( + raw: Record, +): ParticleDataResolved { + // The demo parser packs keyframes into a `keys` array of {r,g,b,a,size,time}. + const rawKeys = raw.keys as + | Array<{ + r?: number; + g?: number; + b?: number; + a?: number; + size?: number; + time?: number; + }> + | undefined; + + const keys: ParticleKey[] = []; + if (Array.isArray(rawKeys) && rawKeys.length > 0) { + for (let i = 0; i < rawKeys.length && i < 4; i++) { + const k = rawKeys[i]; + keys.push({ + r: k.r ?? 1, + g: k.g ?? 1, + b: k.b ?? 1, + a: k.a ?? 1, + // V12 packs size as size/MaxParticleSize; parser returns [0,1]. + size: (k.size ?? (1 / MAX_PARTICLE_SIZE)) * MAX_PARTICLE_SIZE, + time: i === 0 ? 0 : k.time ?? 1, + }); + } + } + // Ensure at least two keyframes for interpolation. + if (keys.length === 0) { + keys.push({ r: 1, g: 1, b: 1, a: 1, size: 1, time: 0 }); + } + if (keys.length < 2) { + keys.push({ ...keys[0], time: 1 }); + } + + // Resolve texture name. The parser stores `textures` as string[]. + let textureName = ""; + if (typeof raw.textureName === "string" && raw.textureName) { + textureName = raw.textureName; + } else { + const names = raw.textures as string[] | undefined; + if (Array.isArray(names) && names.length > 0 && names[0]) { + textureName = names[0]; + } + } + + return { + dragCoefficient: getNumber(raw, "dragCoefficient", 0) * DRAG_SCALE, + windCoefficient: getNumber(raw, "windCoefficient", 1), + gravityCoefficient: getNumber(raw, "gravityCoefficient", 0) * GRAVITY_SCALE, + inheritedVelFactor: getNumber(raw, "inheritedVelFactor", 0), + constantAcceleration: getNumber(raw, "constantAcceleration", 0), + lifetimeMS: getNumber(raw, "lifetimeMS", 31) << LIFETIME_SHIFT, + lifetimeVarianceMS: getNumber(raw, "lifetimeVarianceMS", 0) << LIFETIME_SHIFT, + spinSpeed: getNumber(raw, "spinSpeed", 0), + // V12 packs spinRandom as value+1000; parser returns raw integer. + spinRandomMin: getNumber(raw, "spinRandomMin", 1000) + SPIN_RANDOM_OFFSET, + spinRandomMax: getNumber(raw, "spinRandomMax", 1000) + SPIN_RANDOM_OFFSET, + useInvAlpha: getBool(raw, "useInvAlpha", false), + keys, + textureName, + }; +} + +export function resolveEmitterData( + raw: Record, + getDataBlockData: (id: number) => Record | undefined, +): EmitterDataResolved | null { + // The demo parser stores `particles` as (number | null)[] — an array of + // datablock ref IDs. Resolve the first valid one. + let particleRaw: Record | undefined; + const particleRefs = raw.particles as (number | null)[] | undefined; + if (Array.isArray(particleRefs)) { + for (const ref of particleRefs) { + if (typeof ref === "number") { + particleRaw = getDataBlockData(ref); + if (particleRaw) break; + } + } + } + if (!particleRaw) return null; + + return { + ejectionPeriodMS: getNumber(raw, "ejectionPeriodMS", 100), + periodVarianceMS: getNumber(raw, "periodVarianceMS", 0), + // V12 packs velocity/offset as value*100; parser returns raw integer. + ejectionVelocity: getNumber(raw, "ejectionVelocity", 200) * VELOCITY_SCALE, + velocityVariance: getNumber(raw, "velocityVariance", 100) * VELOCITY_SCALE, + ejectionOffset: getNumber(raw, "ejectionOffset", 0) * VELOCITY_SCALE, + thetaMin: getNumber(raw, "thetaMin", 0), + thetaMax: getNumber(raw, "thetaMax", 90), + phiReferenceVel: getNumber(raw, "phiReferenceVel", 0), + phiVariance: getNumber(raw, "phiVariance", 360), + overrideAdvances: getBool(raw, "overrideAdvances", false), + orientParticles: getBool(raw, "orientParticles", false), + orientOnVelocity: getBool(raw, "orientOnVelocity", true), + lifetimeMS: getNumber(raw, "lifetimeMS", 0) << LIFETIME_SHIFT, + lifetimeVarianceMS: getNumber(raw, "lifetimeVarianceMS", 0) << LIFETIME_SHIFT, + particles: resolveParticleData(particleRaw), + }; +} + +// ── Emitter instance (owns particles, runs simulation) ── + +function randomRange(min: number, max: number): number { + return min + Math.random() * (max - min); +} + +function randomVariance(base: number, variance: number): number { + return base + (Math.random() * 2 - 1) * variance; +} + +/** + * Compute perpendicular axis (`axisx`) for theta rotation, matching V12's + * `emitParticles` which uses: if |axis.z| < 0.9 cross with (0,0,1) else (0,1,0). + */ +function computeAxisX( + ax: number, + ay: number, + az: number, +): [number, number, number] { + let cx: number, cy: number, cz: number; + if (Math.abs(az) < 0.9) { + // cross(axis, (0,0,1)) + cx = ay; + cy = -ax; + cz = 0; + } else { + // cross(axis, (0,1,0)) + cx = -az; + cy = 0; + cz = ax; + } + const len = Math.sqrt(cx * cx + cy * cy + cz * cz); + if (len < 1e-8) return [1, 0, 0]; + return [cx / len, cy / len, cz / len]; +} + +/** + * Rotate vector `v` around arbitrary axis `a` (unit vector) by `angle` radians. + * Uses Rodrigues' rotation formula. + */ +function rotateAroundAxis( + vx: number, + vy: number, + vz: number, + ax: number, + ay: number, + az: number, + angle: number, +): [number, number, number] { + const c = Math.cos(angle); + const s = Math.sin(angle); + const dot = vx * ax + vy * ay + vz * az; + // cross(a, v) + const crossX = ay * vz - az * vy; + const crossY = az * vx - ax * vz; + const crossZ = ax * vy - ay * vx; + return [ + vx * c + crossX * s + ax * dot * (1 - c), + vy * c + crossY * s + ay * dot * (1 - c), + vz * c + crossZ * s + az * dot * (1 - c), + ]; +} + +function interpolateKeys( + keys: ParticleKey[], + t: number, +): { r: number; g: number; b: number; a: number; size: number } { + for (let i = 1; i < keys.length; i++) { + if (keys[i].time >= t) { + const prev = keys[i - 1]; + const curr = keys[i]; + const span = curr.time - prev.time; + const f = span > 0 ? (t - prev.time) / span : 0; + return { + r: prev.r + (curr.r - prev.r) * f, + g: prev.g + (curr.g - prev.g) * f, + b: prev.b + (curr.b - prev.b) * f, + a: prev.a + (curr.a - prev.a) * f, + size: prev.size + (curr.size - prev.size) * f, + }; + } + } + const last = keys[keys.length - 1]; + return { r: last.r, g: last.g, b: last.b, a: last.a, size: last.size }; +} + +export class EmitterInstance { + readonly data: EmitterDataResolved; + readonly particles: Particle[] = []; + readonly maxParticles: number; + + private internalClock = 0; + private nextParticleTime = 0; + private emitterAge = 0; + private emitterLifetime: number; + private emitterDead = false; + + constructor( + data: EmitterDataResolved, + maxParticles = 256, + overrideLifetimeMS?: number, + ) { + this.data = data; + this.maxParticles = maxParticles; + + let lifetime = overrideLifetimeMS ?? data.lifetimeMS; + if (!overrideLifetimeMS && data.lifetimeVarianceMS > 0) { + lifetime += Math.round(randomVariance(0, data.lifetimeVarianceMS)); + } + this.emitterLifetime = lifetime; + } + + /** + * Burst-emit a fixed number of particles (for explosion particleDensity). + * The axis defaults to straight up in Torque space (0,0,1). + */ + emitBurst( + pos: [number, number, number], + count: number, + axis: [number, number, number] = [0, 0, 1], + ): void { + for (let i = 0; i < count && this.particles.length < this.maxParticles; i++) { + this.addParticle(pos, axis); + } + } + + /** + * Periodic emission over a time delta. Faithful to V12's emitParticles timing. + */ + emitPeriodic( + pos: [number, number, number], + dtMS: number, + axis: [number, number, number] = [0, 0, 1], + ): void { + if (this.emitterDead) return; + + let timeLeft = dtMS; + while (timeLeft > 0) { + if (this.nextParticleTime > 0) { + const step = Math.min(timeLeft, this.nextParticleTime); + this.nextParticleTime -= step; + timeLeft -= step; + this.internalClock += step; + continue; + } + + if (this.particles.length < this.maxParticles) { + this.addParticle(pos, axis); + } + + // Compute next emission time. + let period = this.data.ejectionPeriodMS; + if (this.data.periodVarianceMS > 0) { + period += Math.round(randomVariance(0, this.data.periodVarianceMS)); + } + this.nextParticleTime = Math.max(1, period); + } + } + + /** Advance all live particles by dtMS. */ + update(dtMS: number): void { + this.emitterAge += dtMS; + + // Check emitter lifetime. + if ( + this.emitterLifetime > 0 && + this.emitterAge >= this.emitterLifetime + ) { + this.emitterDead = true; + } + + const dt = dtMS / 1000; + const pData = this.data.particles; + + // Age particles, remove dead, update physics + interpolation. + for (let i = this.particles.length - 1; i >= 0; i--) { + const p = this.particles[i]; + p.currentAge += dtMS; + + if (p.currentAge >= p.totalLifetime) { + // Remove dead particle (swap with last for O(1) removal). + this.particles[i] = this.particles[this.particles.length - 1]; + this.particles.pop(); + continue; + } + + // Physics integration (V12 updateSingleParticle). + const drag = pData.dragCoefficient; + const gravCoeff = pData.gravityCoefficient; + + // a = acc - vel*drag - wind*windCoeff + gravity*gravCoeff + // We skip wind for now (no wind system yet). + const ax = -p.vel[0] * drag; + const ay = -p.vel[1] * drag; + const az = -p.vel[2] * drag + GRAVITY_Z * gravCoeff; + + // Symplectic Euler: update vel first, then pos with new vel. + p.vel[0] += ax * dt; + p.vel[1] += ay * dt; + p.vel[2] += az * dt; + + p.pos[0] += p.vel[0] * dt; + p.pos[1] += p.vel[1] * dt; + p.pos[2] += p.vel[2] * dt; + + // Color/size keyframe interpolation. + const normalizedAge = p.currentAge / p.totalLifetime; + const interp = interpolateKeys(pData.keys, normalizedAge); + p.r = interp.r; + p.g = interp.g; + p.b = interp.b; + p.a = interp.a; + p.size = interp.size; + p.currentSpin = p.spinSpeed * p.currentAge * SPIN_FACTOR; + } + } + + isDead(): boolean { + return this.emitterDead && this.particles.length === 0; + } + + /** Immediately stop emitting new particles. Existing particles live out their lifetime. */ + kill(): void { + this.emitterDead = true; + } + + private addParticle( + pos: [number, number, number], + axis: [number, number, number], + ): void { + const d = this.data; + const pData = d.particles; + + // Compute ejection direction from theta/phi (V12 addParticle). + let ejX = axis[0]; + let ejY = axis[1]; + let ejZ = axis[2]; + + const axisx = computeAxisX(ejX, ejY, ejZ); + + // Theta: angle off main axis. + const theta = + (d.thetaMin + Math.random() * (d.thetaMax - d.thetaMin)) * DEG_TO_RAD; + + // Phi: rotation around main axis. + const phiRef = (this.internalClock / 1000) * d.phiReferenceVel; + const phi = (phiRef + Math.random() * d.phiVariance) * DEG_TO_RAD; + + // Rotate axis by theta around axisx, then by phi around original axis. + [ejX, ejY, ejZ] = rotateAroundAxis( + ejX, ejY, ejZ, + axisx[0], axisx[1], axisx[2], + theta, + ); + [ejX, ejY, ejZ] = rotateAroundAxis( + ejX, ejY, ejZ, + axis[0], axis[1], axis[2], + phi, + ); + + // Normalize ejection direction. + const ejLen = Math.sqrt(ejX * ejX + ejY * ejY + ejZ * ejZ); + if (ejLen > 1e-8) { + ejX /= ejLen; + ejY /= ejLen; + ejZ /= ejLen; + } + + // Velocity with variance. + const speed = randomVariance(d.ejectionVelocity, d.velocityVariance); + + const spawnPos: [number, number, number] = [ + pos[0] + ejX * d.ejectionOffset, + pos[1] + ejY * d.ejectionOffset, + pos[2] + ejZ * d.ejectionOffset, + ]; + + const vel: [number, number, number] = [ + ejX * speed, + ejY * speed, + ejZ * speed, + ]; + + // V12: acc = vel * constantAcceleration (set once, never changes). + // We fold this into the initial velocity for simplicity since the + // constant acceleration just biases the starting velocity direction. + // Actually, in V12 acc is a separate constant vector added each frame. + // For faithfulness, we should track it. But since it's constant, we can + // just apply it in the update loop as a per-particle property. + // For now, bake it into the velocity since most Tribes 2 datablocks + // have constantAcceleration = 0. + + // Particle lifetime with variance. + let lifetime = pData.lifetimeMS; + if (pData.lifetimeVarianceMS > 0) { + lifetime += Math.round(randomVariance(0, pData.lifetimeVarianceMS)); + } + lifetime = Math.max(1, lifetime); + + // Spin speed. + const spin = + pData.spinSpeed + randomRange(pData.spinRandomMin, pData.spinRandomMax); + + // Initial color/size from first keyframe. + const k0 = pData.keys[0]; + + this.particles.push({ + pos: spawnPos, + vel, + orientDir: [ejX, ejY, ejZ], + currentAge: 0, + totalLifetime: lifetime, + dataIndex: 0, + spinSpeed: spin, + currentSpin: 0, + r: k0.r, + g: k0.g, + b: k0.b, + a: k0.a, + size: k0.size, + }); + } +} diff --git a/src/particles/shaders.ts b/src/particles/shaders.ts new file mode 100644 index 00000000..603f28f8 --- /dev/null +++ b/src/particles/shaders.ts @@ -0,0 +1,48 @@ +export const particleVertexShader = /* glsl */ ` +// 'position' is auto-declared by Three.js for ShaderMaterial. +attribute vec4 particleColor; +attribute float particleSize; +attribute float particleSpin; +attribute vec2 quadCorner; // (-0.5,-0.5) to (0.5,0.5) + +varying vec2 vUv; +varying vec4 vColor; + +void main() { + vUv = quadCorner + 0.5; // [0,1] range + vColor = particleColor; + + // Transform particle center to view space for billboarding. + vec3 viewPos = (modelViewMatrix * vec4(position, 1.0)).xyz; + + // Apply spin rotation to quad corner. + float c = cos(particleSpin); + float s = sin(particleSpin); + vec2 rotated = vec2( + c * quadCorner.x - s * quadCorner.y, + s * quadCorner.x + c * quadCorner.y + ); + + // Offset in view space (camera-facing billboard). + viewPos.xy += rotated * particleSize; + + gl_Position = projectionMatrix * vec4(viewPos, 1.0); +} +`; + +export const particleFragmentShader = /* glsl */ ` +uniform sampler2D particleTexture; +uniform bool hasTexture; + +varying vec2 vUv; +varying vec4 vColor; + +void main() { + if (hasTexture) { + vec4 texColor = texture2D(particleTexture, vUv); + gl_FragColor = texColor * vColor; + } else { + gl_FragColor = vColor; + } +} +`; diff --git a/src/particles/types.ts b/src/particles/types.ts new file mode 100644 index 00000000..0acd25a6 --- /dev/null +++ b/src/particles/types.ts @@ -0,0 +1,62 @@ +/** Resolved particle data from a ParticleData datablock. */ +export interface ParticleDataResolved { + dragCoefficient: number; + windCoefficient: number; + gravityCoefficient: number; + inheritedVelFactor: number; + constantAcceleration: number; + lifetimeMS: number; + lifetimeVarianceMS: number; + spinSpeed: number; + spinRandomMin: number; + spinRandomMax: number; + useInvAlpha: boolean; + /** 1-4 keyframes with normalized time (0-1). */ + keys: ParticleKey[]; + textureName: string; +} + +export interface ParticleKey { + r: number; + g: number; + b: number; + a: number; + size: number; + time: number; +} + +/** Resolved emitter data from a ParticleEmitterData datablock. */ +export interface EmitterDataResolved { + ejectionPeriodMS: number; + periodVarianceMS: number; + ejectionVelocity: number; + velocityVariance: number; + ejectionOffset: number; + thetaMin: number; + thetaMax: number; + phiReferenceVel: number; + phiVariance: number; + overrideAdvances: boolean; + orientParticles: boolean; + orientOnVelocity: boolean; + lifetimeMS: number; + lifetimeVarianceMS: number; + particles: ParticleDataResolved; +} + +/** Live particle instance during simulation. */ +export interface Particle { + pos: [number, number, number]; + vel: [number, number, number]; + orientDir: [number, number, number]; + currentAge: number; + totalLifetime: number; + dataIndex: number; + spinSpeed: number; + currentSpin: number; + r: number; + g: number; + b: number; + a: number; + size: number; +} diff --git a/src/state/diagnosticsSnapshot.ts b/src/state/diagnosticsSnapshot.ts index 3a5c49a4..687ef94f 100644 --- a/src/state/diagnosticsSnapshot.ts +++ b/src/state/diagnosticsSnapshot.ts @@ -226,12 +226,7 @@ function summarizeRecording(state: EngineStoreState): JsonLike { duration: recording.duration, missionName: recording.missionName, gameType: recording.gameType, - isMetadataOnly: !!recording.isMetadataOnly, - isPartial: !!recording.isPartial, hasStreamingPlayback: !!recording.streamingPlayback, - entitiesCount: recording.entities.length, - cameraModesCount: recording.cameraModes.length, - controlPlayerGhostId: recording.controlPlayerGhostId ?? null, }; } diff --git a/src/state/engineStore.ts b/src/state/engineStore.ts index e3148022..7d9da044 100644 --- a/src/state/engineStore.ts +++ b/src/state/engineStore.ts @@ -8,6 +8,10 @@ import type { TorqueObject, TorqueRuntime, } from "../torqueScript"; +import { + buildSequenceAliasMap, + type SequenceAliasMap, +} from "../torqueScript/shapeConstructor"; export type PlaybackStatus = "stopped" | "playing" | "paused"; @@ -77,6 +81,7 @@ export interface AppendRendererSampleInput { export interface RuntimeSliceState { runtime: TorqueRuntime | null; + sequenceAliases: SequenceAliasMap; objectVersionById: Record; globalVersionByName: Record; objectIdsByName: Record; @@ -182,60 +187,15 @@ function initialDiagnosticsCounts(): Record { }; } -function projectWorldFromDemo(recording: DemoRecording | null): WorldSliceState { - if (!recording) { - return { - entitiesById: {}, - players: [], - ghosts: [], - projectiles: [], - flags: [], - teams: {}, - scores: {}, - }; - } - - const entitiesById: Record = {}; - const players: string[] = []; - const ghosts: string[] = []; - const projectiles: string[] = []; - const flags: string[] = []; - - for (const entity of recording.entities) { - const entityId = keyFromEntityId(entity.id); - entitiesById[entityId] = entity; - - const type = entity.type.toLowerCase(); - if (type === "player") { - players.push(entityId); - if (entityId.startsWith("player_")) { - ghosts.push(entityId); - } - continue; - } - if (type === "projectile") { - projectiles.push(entityId); - continue; - } - - if ( - entity.dataBlock?.toLowerCase() === "flag" || - entity.dataBlock?.toLowerCase().includes("flag") - ) { - flags.push(entityId); - } - } - - return { - entitiesById, - players, - ghosts, - projectiles, - flags, - teams: {}, - scores: {}, - }; -} +const emptyWorld: WorldSliceState = { + entitiesById: {}, + players: [], + ghosts: [], + projectiles: [], + flags: [], + teams: {}, + scores: {}, +}; function buildRuntimeIndexes(runtime: TorqueRuntime): Pick< RuntimeSliceState, @@ -289,6 +249,7 @@ const initialState: Omit< > = { runtime: { runtime: null, + sequenceAliases: new Map(), objectVersionById: {}, globalVersionByName: {}, objectIdsByName: {}, @@ -331,10 +292,12 @@ export const engineStore = createStore()( setRuntime(runtime: TorqueRuntime) { const indexes = buildRuntimeIndexes(runtime); + const sequenceAliases = buildSequenceAliasMap(runtime); set((state) => ({ ...state, runtime: { runtime, + sequenceAliases, objectVersionById: indexes.objectVersionById, globalVersionByName: indexes.globalVersionByName, objectIdsByName: indexes.objectIdsByName, @@ -349,6 +312,7 @@ export const engineStore = createStore()( ...state, runtime: { runtime: null, + sequenceAliases: new Map(), objectVersionById: {}, globalVersionByName: {}, objectIdsByName: {}, @@ -483,15 +447,12 @@ export const engineStore = createStore()( : null, nextDurationSec: recording ? Number(recording.duration.toFixed(3)) : null, isNull: recording == null, - isMetadataOnly: !!recording?.isMetadataOnly, - isPartial: !!recording?.isPartial, - hasStreamingPlayback: !!recording?.streamingPlayback, stack: stack ?? "unavailable", }, }; return { ...state, - world: projectWorldFromDemo(recording), + world: emptyWorld, playback: { recording, status: "stopped", diff --git a/src/terrainHeight.ts b/src/terrainHeight.ts new file mode 100644 index 00000000..5592a043 --- /dev/null +++ b/src/terrainHeight.ts @@ -0,0 +1,69 @@ +/** + * Module-level terrain height sampler that bridges React (TerrainBlock) and + * non-React (streaming.ts) code. TerrainBlock registers a sampler once the + * heightmap is loaded; item physics queries it during simulation. + */ + +const TERRAIN_SIZE = 256; +const HALF_SIZE = TERRAIN_SIZE / 2; // 128 +const HEIGHT_SCALE = 2048; + +export type HeightFn = (torqueX: number, torqueY: number) => number; + +let sampler: HeightFn | null = null; + +/** Called by TerrainBlock when heightmap is loaded. Pass null on unmount. */ +export function setTerrainHeightSampler(fn: HeightFn | null): void { + sampler = fn; +} + +/** Returns terrain Z at Torque (x, y) or null if no terrain is loaded. */ +export function getTerrainHeightAt( + torqueX: number, + torqueY: number, +): number | null { + return sampler ? sampler(torqueX, torqueY) : null; +} + +/** + * Build a height sampler closure from raw heightmap data and terrain params. + * Uses bilinear interpolation and clamps to terrain bounds. + * + * Coordinate mapping (derived from terrain geometry rotations): + * - Torque X → heightmap row + * - Torque Y → heightmap col + */ +export function createTerrainHeightSampler( + heightMap: Uint16Array, + squareSize: number, +): HeightFn { + return (torqueX: number, torqueY: number): number => { + // Convert Torque world coords to fractional heightmap coords. + // The terrain origin is at (-squareSize * 128, -squareSize * 128, 0), + // so grid center (128, 128) corresponds to Torque (0, 0). + const col = torqueY / squareSize + HALF_SIZE; + const row = torqueX / squareSize + HALF_SIZE; + + // Clamp to valid range + const clampedCol = Math.max(0, Math.min(TERRAIN_SIZE - 1, col)); + const clampedRow = Math.max(0, Math.min(TERRAIN_SIZE - 1, row)); + + const col0 = Math.floor(clampedCol); + const row0 = Math.floor(clampedRow); + const col1 = Math.min(col0 + 1, TERRAIN_SIZE - 1); + const row1 = Math.min(row0 + 1, TERRAIN_SIZE - 1); + + const fx = clampedCol - col0; + const fy = clampedRow - row0; + + // Bilinear interpolation + const h00 = heightMap[row0 * TERRAIN_SIZE + col0]; + const h10 = heightMap[row0 * TERRAIN_SIZE + col1]; + const h01 = heightMap[row1 * TERRAIN_SIZE + col0]; + const h11 = heightMap[row1 * TERRAIN_SIZE + col1]; + + const h0 = h00 * (1 - fx) + h10 * fx; + const h1 = h01 * (1 - fx) + h11 * fx; + return ((h0 * (1 - fy) + h1 * fy) / 65535) * HEIGHT_SCALE; + }; +} diff --git a/src/torqueScript/engineMethods.ts b/src/torqueScript/engineMethods.ts new file mode 100644 index 00000000..4e5701d0 --- /dev/null +++ b/src/torqueScript/engineMethods.ts @@ -0,0 +1,128 @@ +import type { TorqueRuntime } from "./types"; + +/** + * Register C++ engine method stubs that TorqueScript code expects to exist. + * These are methods that would normally be implemented in the Torque C++ engine + * (on classes like ShapeBase, GameBase, SimObject, SimGroup) and called by + * game scripts (power.cs, staticShape.cs, station.cs, deployables.cs, etc.). + */ +export function registerEngineStubs(runtime: TorqueRuntime): void { + const reg = runtime.$.registerMethod.bind(runtime.$); + + // ---- Animation thread methods (ShapeBase) ---- + + reg("ShapeBase", "playThread", (this_, slot, sequence) => { + if (!this_._threads) this_._threads = {}; + this_._threads[Number(slot)] = { + sequence: String(sequence), + playing: true, + direction: true, // forward + }; + }); + + reg("ShapeBase", "stopThread", (this_, slot) => { + if (this_._threads) { + delete this_._threads[Number(slot)]; + } + }); + + reg("ShapeBase", "setThreadDir", (this_, slot, forward) => { + if (!this_._threads) this_._threads = {}; + const s = Number(slot); + if (this_._threads[s]) { + this_._threads[s].direction = !!Number(forward); + } else { + this_._threads[s] = { + sequence: "", + playing: false, + direction: !!Number(forward), + }; + } + }); + + reg("ShapeBase", "pauseThread", (this_, slot) => { + if (this_._threads?.[Number(slot)]) { + this_._threads[Number(slot)].playing = false; + } + }); + + // ---- Audio (no-op) ---- + + reg("ShapeBase", "playAudio", () => {}); + reg("ShapeBase", "stopAudio", () => {}); + + // ---- Object hierarchy (SimObject / SimGroup) ---- + + reg("SimObject", "getDatablock", (this_) => { + const dbName = this_.datablock; + if (!dbName) return ""; + return runtime.getObjectByName(String(dbName)) ?? ""; + }); + + reg("SimObject", "getGroup", (this_) => { + return this_._parent ?? ""; + }); + + reg("SimObject", "getName", (this_) => { + return this_._name ?? ""; + }); + + reg("SimObject", "getType", () => { + // Return a bitmask; scripts use this with $TypeMasks checks. + // GameBaseObjectType = 0x4000 covers StaticShape/Turret/etc. + return 0x4000; + }); + + reg("SimGroup", "getCount", (this_) => { + return this_._children ? this_._children.length : 0; + }); + + reg("SimGroup", "getObject", (this_, index) => { + const children = this_._children; + if (!children) return ""; + return children[Number(index)] ?? ""; + }); + + // ---- Power / energy stubs (GameBase) ---- + + reg("GameBase", "isEnabled", () => true); + reg("GameBase", "isDisabled", () => false); + reg("GameBase", "setPoweredState", () => {}); + reg("GameBase", "setRechargeRate", () => {}); + reg("GameBase", "getRechargeRate", () => 0); + reg("GameBase", "setEnergyLevel", () => {}); + reg("GameBase", "getEnergyLevel", () => 0); + + // ---- Damage / repair stubs (ShapeBase) ---- + + reg("ShapeBase", "getDamageLevel", () => 0); + reg("ShapeBase", "setDamageLevel", () => {}); + reg("ShapeBase", "getRepairRate", () => 0); + reg("ShapeBase", "setRepairRate", () => {}); + reg("ShapeBase", "getDamagePercent", () => 0); + + // ---- Client / control stubs (GameBase) ---- + + reg("GameBase", "getControllingClient", () => 0); + + // ---- Object method: schedule ---- + // %obj.schedule(delay, "methodName", args...) calls the method on %obj + // after a delay. Distinct from the global schedule() function in builtins. + + reg("SimObject", "schedule", (this_, delay, methodName, ...args) => { + const ms = Number(delay) || 0; + const timeoutId = setTimeout(() => { + runtime.state.pendingTimeouts.delete(timeoutId); + try { + runtime.$.call(this_, String(methodName), ...args); + } catch (err) { + console.error( + `schedule: error calling ${methodName} on ${this_._id}:`, + err, + ); + } + }, ms); + runtime.state.pendingTimeouts.add(timeoutId); + return timeoutId; + }); +} diff --git a/src/torqueScript/ignoreScripts.ts b/src/torqueScript/ignoreScripts.ts new file mode 100644 index 00000000..e9d7bdd0 --- /dev/null +++ b/src/torqueScript/ignoreScripts.ts @@ -0,0 +1,30 @@ +export const ignoreScripts = [ + "scripts/admin.cs", + // `ignoreScripts` supports globs, but out of an abundance of caution + // we don't want to do `ai*.cs` in case there's some non-AI related + // word like "air" in a script name. + "scripts/ai.cs", + "scripts/aiBotProfiles.cs", + "scripts/aiBountyGame.cs", + "scripts/aiChat.cs", + "scripts/aiCnH.cs", + "scripts/aiCTF.cs", + "scripts/aiDeathMatch.cs", + "scripts/aiDebug.cs", + "scripts/aiDefaultTasks.cs", + "scripts/aiDnD.cs", + "scripts/aiHumanTasks.cs", + "scripts/aiHunters.cs", + "scripts/aiInventory.cs", + "scripts/aiObjectiveBuilder.cs", + "scripts/aiObjectives.cs", + "scripts/aiRabbit.cs", + "scripts/aiSiege.cs", + "scripts/aiTDM.cs", + "scripts/aiTeamHunters.cs", + "scripts/deathMessages.cs", + "scripts/graphBuild.cs", + "scripts/navGraph.cs", + "scripts/serverTasks.cs", + "scripts/spdialog.cs", +]; diff --git a/src/torqueScript/index.ts b/src/torqueScript/index.ts index a6c1636c..2316cb64 100644 --- a/src/torqueScript/index.ts +++ b/src/torqueScript/index.ts @@ -2,6 +2,7 @@ import TorqueScript from "@/generated/TorqueScript.cjs"; import { generate, type GeneratorOptions } from "./codegen"; import type { Program } from "./ast"; import { createRuntime } from "./runtime"; +import { registerEngineStubs } from "./engineMethods"; import { TorqueObject, TorqueRuntime, TorqueRuntimeOptions } from "./types"; export { generate, type GeneratorOptions } from "./codegen"; @@ -221,6 +222,8 @@ export function runServer(options: RunServerOptions): RunServerResult { preloadScripts: [...preloadScripts, ...gameScripts], }); + registerEngineStubs(runtime); + const ready = (async function createServer() { try { // Load all required scripts diff --git a/src/torqueScript/reactivity.ts b/src/torqueScript/reactivity.ts index 3f289811..1c290d7f 100644 --- a/src/torqueScript/reactivity.ts +++ b/src/torqueScript/reactivity.ts @@ -175,6 +175,10 @@ export const DEFAULT_REACTIVE_METHOD_RULES: ReactiveMethodRule[] = [ "deleteallobjects", "add", "remove", + "playthread", + "stopthread", + "setthreaddir", + "pausethread", ], }, { diff --git a/src/torqueScript/runtime.ts b/src/torqueScript/runtime.ts index 011b3811..c410ba41 100644 --- a/src/torqueScript/runtime.ts +++ b/src/torqueScript/runtime.ts @@ -1185,7 +1185,7 @@ export function createRuntime( className: string, methodName: string, callback: (thisObj: TorqueObject, ...args: any[]) => void, - ): void { + ): () => void { let classMethods = methodHooks.get(className); if (!classMethods) { classMethods = new CaseInsensitiveMap(); @@ -1197,6 +1197,10 @@ export function createRuntime( classMethods.set(methodName, hooks); } hooks.push(callback); + return () => { + const idx = hooks!.indexOf(callback); + if (idx !== -1) hooks!.splice(idx, 1); + }; }, }; diff --git a/src/torqueScript/shapeConstructor.ts b/src/torqueScript/shapeConstructor.ts new file mode 100644 index 00000000..256f27bd --- /dev/null +++ b/src/torqueScript/shapeConstructor.ts @@ -0,0 +1,94 @@ +import type { AnimationAction, AnimationClip, AnimationMixer } from "three"; +import type { TorqueRuntime } from "./types"; + +/** + * Outer key: shape filename (lowercase, e.g. "light_male.dts"). + * Inner map: alias (lowercase) -> GLB clip name (lowercase). + */ +export type SequenceAliasMap = Map>; + +/** + * Build sequence alias maps from TSShapeConstructor datablocks already + * registered in the runtime. Each datablock has `baseshape` and + * `sequence0`–`sequence127` properties like: + * + * sequence1 = "light_male_forward.dsq run" + * + * The GLB clip name is derived by stripping the DTS model prefix and .dsq + * extension from the DSQ filename, matching the Blender addon's + * `dsq_name_from_filename` behavior. + */ +export function buildSequenceAliasMap(runtime: TorqueRuntime): SequenceAliasMap { + const result: SequenceAliasMap = new Map(); + + for (const obj of runtime.state.datablocks.values()) { + if (obj._class !== "tsshapeconstructor") continue; + + const baseShape = obj.baseshape; + if (typeof baseShape !== "string") continue; + + const shapeKey = baseShape.toLowerCase(); + // Derive prefix: "light_male.dts" -> "light_male_" + const stem = shapeKey.replace(/\.dts$/i, ""); + const prefix = stem + "_"; + + const aliases = new Map(); + + for (let i = 0; i <= 127; i++) { + const value = obj[`sequence${i}`]; + if (typeof value !== "string") continue; + + // Format: "filename.dsq alias" + const spaceIdx = value.indexOf(" "); + if (spaceIdx === -1) continue; + + const dsqFile = value.slice(0, spaceIdx).toLowerCase(); + const alias = value.slice(spaceIdx + 1).trim().toLowerCase(); + if (!alias) continue; + + // Strip prefix and .dsq to get the GLB clip name. + // Only process DSQs matching the model prefix (others won't be in the GLB). + if (!dsqFile.startsWith(prefix) || !dsqFile.endsWith(".dsq")) continue; + + const clipName = dsqFile.slice(prefix.length, -4); + if (clipName) { + aliases.set(alias, clipName); + } + } + + if (aliases.size > 0) { + result.set(shapeKey, aliases); + } + } + + return result; +} + +/** + * Build a case-insensitive action map from GLB clips, augmented with + * TSShapeConstructor aliases. Both the original clip name and the alias + * resolve to the same AnimationAction. + */ +export function getAliasedActions( + clips: AnimationClip[], + mixer: AnimationMixer, + aliases: Map | undefined, +): Map { + const actions = new Map(); + + for (const clip of clips) { + const action = mixer.clipAction(clip); + actions.set(clip.name.toLowerCase(), action); + } + + if (aliases) { + for (const [alias, clipName] of aliases) { + const action = actions.get(clipName); + if (action && !actions.has(alias)) { + actions.set(alias, action); + } + } + } + + return actions; +} diff --git a/src/torqueScript/types.ts b/src/torqueScript/types.ts index 76e11a1b..9deb5416 100644 --- a/src/torqueScript/types.ts +++ b/src/torqueScript/types.ts @@ -301,7 +301,7 @@ export interface RuntimeAPI { className: string, methodName: string, callback: (thisObj: TorqueObject, ...args: any[]) => void, - ): void; + ): () => void; } export interface FunctionsAPI {