diff --git a/app/page.tsx b/app/page.tsx index 7df5a6c5..c318c2ee 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,5 +1,12 @@ "use client"; -import { useState, useEffect, useCallback, Suspense, useRef } from "react"; +import { + useState, + useEffect, + useCallback, + Suspense, + useRef, + lazy, +} from "react"; import { Canvas, GLProps } from "@react-three/fiber"; import { NoToneMapping, SRGBColorSpace, PCFShadowMap, Camera } from "three"; import { Mission } from "@/src/components/Mission"; @@ -25,6 +32,12 @@ import { CamerasProvider } from "@/src/components/CamerasProvider"; import { getMissionList, getMissionInfo } from "@/src/manifest"; import { createParser, parseAsBoolean, useQueryState } from "nuqs"; +const MapInfoDialog = lazy(() => + import("@/src/components/MapInfoDialog").then((mod) => ({ + default: mod.MapInfoDialog, + })), +); + // Three.js has its own loaders for textures and models, but we need to load other // stuff too, e.g. missions, terrains, and more. This client is used for those. const queryClient = new QueryClient(); @@ -94,6 +107,7 @@ function MapInspector() { const isTouch = useTouchDevice(); const { missionName, missionType } = currentMission; + const [mapInfoOpen, setMapInfoOpen] = useState(false); const [loadingProgress, setLoadingProgress] = useState(0); const [showLoadingIndicator, setShowLoadingIndicator] = useState(true); const isLoading = loadingProgress < 1; @@ -127,6 +141,23 @@ function MapInspector() { }; }, [changeMission]); + useEffect(() => { + const handleKey = (e: KeyboardEvent) => { + if (e.code !== "KeyI" || e.metaKey || e.ctrlKey || e.altKey) return; + const target = e.target as HTMLElement; + if ( + target.tagName === "INPUT" || + target.tagName === "TEXTAREA" || + target.isContentEditable + ) { + return; + } + setMapInfoOpen(true); + }; + window.addEventListener("keydown", handleKey); + return () => window.removeEventListener("keydown", handleKey); + }, []); + const handleLoadingChange = useCallback( (_loading: boolean, progress: number = 0) => { setLoadingProgress(progress); @@ -208,9 +239,20 @@ function MapInspector() { missionName={missionName} missionType={missionType} onChangeMission={changeMission} + onOpenMapInfo={() => setMapInfoOpen(true)} cameraRef={cameraRef} isTouch={isTouch} /> + {mapInfoOpen && ( + + setMapInfoOpen(false)} + missionName={missionName} + missionType={missionType ?? ""} + /> + + )} diff --git a/app/style.css b/app/style.css index f31af830..85493c0b 100644 --- a/app/style.css +++ b/app/style.css @@ -10,6 +10,9 @@ html { *:before, *:after { box-sizing: inherit; +} + +body { user-select: none; -webkit-touch-callout: none; } @@ -203,6 +206,10 @@ input[type="range"] { .LabelledButton .ButtonLabel { display: none; } + + .MapInfoButton { + display: none; + } } .CopyCoordinatesButton[data-copied="true"] { @@ -569,6 +576,295 @@ input[type="range"] { margin-right: 3px; } +.MapInfoDialog-overlay { + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.7); + z-index: 10; + display: flex; + align-items: center; + justify-content: center; + padding: 20px; +} + +.MapInfoDialog { + position: relative; + width: 800px; + height: 600px; + max-width: calc(100dvw - 40px); + max-height: calc(100dvh - 40px); + display: grid; + grid-template-columns: 100%; + grid-template-rows: 1fr auto; + background: rgba(20, 37, 38, 0.8); + border: 1px solid rgba(65, 131, 139, 0.6); + border-radius: 3px; + box-shadow: + 0 0 0 1px rgba(0, 190, 220, 0.12), + 0 0 60px rgba(0, 140, 180, 0.12), + inset 0 0 60px rgba(1, 7, 13, 0.6); + color: #bccec3; + font-size: 14px; + line-height: 1.5; + outline: none; + user-select: text; + -webkit-touch-callout: default; +} + +.MapInfoDialog-inner { + display: grid; + grid-template-columns: 1fr auto; + grid-template-rows: 100%; + min-height: 0; + overflow: hidden; +} + +.MapInfoDialog-left { + width: 100%; + overflow-y: auto; + padding: 24px 28px; +} + +.MapInfoDialog-right { + border-left: 1px solid rgba(0, 190, 220, 0.3); + height: 100%; + width: auto; + margin-left: auto; + margin-right: 0; +} + +.MapInfoDialog-preview { + display: block; + height: 100%; + width: auto; + overflow: hidden; +} + +.MapInfoDialog-preview--floated { + float: right; + clear: right; + margin: 0 0 16px 20px; + max-height: 260px; + max-width: 30%; + width: auto; + display: block; +} + +.MapInfoDialog-title { + font-size: 26px; + font-weight: 500; + color: #7dffff; + margin: 0; + text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); +} + +.MapInfoDialog-meta { + display: flex; + flex-wrap: wrap; + gap: 8px 16px; + margin-bottom: 4px; + font-size: 15px; + font-weight: 400; + /* text-transform: uppercase; */ +} + +.MapInfoDialog-planet { + color: rgba(219, 202, 168, 0.7); +} + +.MapInfoDialog-quote { + margin: 16px 0; + padding: 0 0 0 14px; + border-left: 2px solid rgba(0, 190, 220, 0.35); + font-style: italic; +} + +.MapInfoDialog-quote p { + margin: 0 0 4px; +} + +.MapInfoDialog-quote cite { + font-style: normal; + font-size: 12px; + color: rgba(255, 255, 255, 0.45); + display: block; +} + +.MapInfoDialog-blurb { + font-size: 13px; + margin: 0 0 16px; +} + +.MapInfoDialog-section { + margin-top: 20px; +} + +.MapInfoDialog-sectionTitle { + font-size: 16px; + font-weight: 500; + color: #7dffff; + margin: 0 0 8px; + letter-spacing: 0.04em; + text-transform: uppercase; + text-shadow: 0 0 16px rgba(0, 210, 240, 0.25); +} + +.MapInfoDialog-musicTrack { + margin-top: 16px; + font-size: 14px; + color: rgba(202, 208, 172, 0.5); + font-style: italic; + display: flex; + align-items: center; + gap: 6px; +} + +.MapInfoDialog-musicTrack[data-playing="true"] { + color: rgba(247, 253, 216, 0.7); +} + +.MapInfoDialog-musicBtn { + display: grid; + place-content: center; + background: transparent; + border: 0; + padding: 0; + cursor: pointer; + color: rgb(85, 118, 99); + width: 32px; + height: 32px; + border-radius: 20px; + font-size: 20px; + font-style: normal; + line-height: 1; + flex-shrink: 0; + opacity: 0.5; +} + +.MapInfoDialog-musicTrack[data-playing="true"] .MapInfoDialog-musicBtn { + color: rgb(109, 255, 170); + opacity: 1; +} + +.MapInfoDialog-musicTrack[data-playing="true"] .MapInfoDialog-musicBtn:hover { + opacity: 0.7; +} + +.MapInfoDialog-footer { + display: flex; + align-items: center; + gap: 16px; + padding: 10px 12px; + border-top: 1px solid rgba(0, 190, 220, 0.25); + background: rgba(2, 20, 21, 0.7); + flex-shrink: 0; +} + +.MapInfoDialog-closeBtn { + padding: 4px 18px; + background: linear-gradient( + to bottom, + rgba(41, 172, 156, 0.7), + rgba(0, 80, 65, 0.7) + ); + border: 1px solid rgba(41, 97, 84, 0.6); + border-top-color: rgba(101, 185, 176, 0.5); + border-radius: 3px; + box-shadow: + inset 0 1px 0 rgba(120, 220, 195, 0.2), + inset 0 -1px 0 rgba(0, 0, 0, 0.3), + 0 2px 4px rgba(0, 0, 0, 0.4); + color: rgba(154, 239, 225, 0.9); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5); + font-size: 14px; + font-weight: 500; + cursor: pointer; +} + +.MapInfoDialog-closeBtn:active { + transform: translate(0, 1px); +} + +.MapInfoDialog-hint { + font-size: 12px; + color: rgba(201, 220, 216, 0.3); + margin-left: auto; +} + +@media (max-width: 719px) { + .MapInfoDialog-inner { + display: block; + overflow: auto; + } + + .MapInfoDialog-hint { + display: none; + } + + .MapInfoDialog-left { + width: 100%; + height: auto; + margin: 0; + overflow: auto; + padding: 16px 20px; + } + + .MapInfoDialog-right { + width: 100%; + height: auto; + margin: 0; + overflow: auto; + border-left: 0; + } + + .MapInfoDialog-preview { + width: auto; + height: auto; + margin: 16px auto; + } + + .MapInfoDialog-closeBtn { + width: 220px; + height: 36px; + margin: 0 auto; + } +} + +.GuiMarkup-line { + margin-bottom: 1px; +} + +.GuiMarkup-spacer { + height: 0.6em; +} + +.GuiMarkup-bulletLine { + display: flex; + align-items: baseline; + gap: 5px; + margin-bottom: 3px; +} + +.GuiMarkup-bulletIcon { + flex-shrink: 0; + display: flex; + align-items: center; +} + +.GuiMarkup-bulletText { + flex: 1; + min-width: 0; +} + +.GuiMarkup-bitmap { + max-height: 1em; + vertical-align: middle; +} + +.GuiMarkup-bullet { + opacity: 0.8; +} + .TouchJoystick { position: fixed; bottom: 20px; @@ -609,3 +905,7 @@ input[type="range"] { inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 2px rgba(0, 0, 0, 0.3) !important; } + +.MusicTrackName { + text-transform: capitalize; +} diff --git a/docs/404.html b/docs/404.html index 5d37cd20..4a374c3a 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 5d37cd20..4a374c3a 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 ad760411..4a5ad290 100644 --- a/docs/__next.__PAGE__.txt +++ b/docs/__next.__PAGE__.txt @@ -1,9 +1,9 @@ 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/69160059bd4715b0.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/05a33d80986f6f4c.js","/t2-mapper/_next/static/chunks/648c99009376fcef.js"],"default"] +3:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/fd5173b60870d6fb.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 6:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] 7:"$Sreact.suspense" -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/69160059bd4715b0.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/05a33d80986f6f4c.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/648c99009376fcef.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/fd5173b60870d6fb.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/5619c5b2b1355f74.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.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} 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 4da93e34..a0f400a5 100644 --- a/docs/__next._full.txt +++ b/docs/__next._full.txt @@ -3,14 +3,14 @@ 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/69160059bd4715b0.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/05a33d80986f6f4c.js","/t2-mapper/_next/static/chunks/648c99009376fcef.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/fd5173b60870d6fb.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.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"] 10:I[68027,[],"default"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"P":null,"b":"h-5uE8DkCRlEiwNbWUb1K","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e830bdf778a42251.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/69160059bd4715b0.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/05a33d80986f6f4c.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/648c99009376fcef.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/748c06086372a1f2.css","style"] +0:{"P":null,"b":"8Gyh12L4dTN96synIylXt","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/748c06086372a1f2.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/fd5173b60870d6fb.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/5619c5b2b1355f74.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.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} 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"}]] diff --git a/docs/__next._head.txt b/docs/__next._head.txt index f899e59f..0599601d 100644 --- a/docs/__next._head.txt +++ b/docs/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","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} +0:{"buildId":"8Gyh12L4dTN96synIylXt","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 76a674b1..cd08d784 100644 --- a/docs/__next._index.txt +++ b/docs/__next._index.txt @@ -2,5 +2,5 @@ 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"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e830bdf778a42251.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} +:HL["/t2-mapper/_next/static/chunks/748c06086372a1f2.css","style"] +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/748c06086372a1f2.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} diff --git a/docs/__next._tree.txt b/docs/__next._tree.txt index 3a02f440..95f61bba 100644 --- a/docs/__next._tree.txt +++ b/docs/__next._tree.txt @@ -1,2 +1,2 @@ -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","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/748c06086372a1f2.css","style"] +0:{"buildId":"8Gyh12L4dTN96synIylXt","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/h-5uE8DkCRlEiwNbWUb1K/_buildManifest.js b/docs/_next/static/8Gyh12L4dTN96synIylXt/_buildManifest.js similarity index 100% rename from docs/_next/static/h-5uE8DkCRlEiwNbWUb1K/_buildManifest.js rename to docs/_next/static/8Gyh12L4dTN96synIylXt/_buildManifest.js diff --git a/docs/_next/static/h-5uE8DkCRlEiwNbWUb1K/_clientMiddlewareManifest.json b/docs/_next/static/8Gyh12L4dTN96synIylXt/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/h-5uE8DkCRlEiwNbWUb1K/_clientMiddlewareManifest.json rename to docs/_next/static/8Gyh12L4dTN96synIylXt/_clientMiddlewareManifest.json diff --git a/docs/_next/static/h-5uE8DkCRlEiwNbWUb1K/_ssgManifest.js b/docs/_next/static/8Gyh12L4dTN96synIylXt/_ssgManifest.js similarity index 100% rename from docs/_next/static/h-5uE8DkCRlEiwNbWUb1K/_ssgManifest.js rename to docs/_next/static/8Gyh12L4dTN96synIylXt/_ssgManifest.js diff --git a/docs/_next/static/chunks/05a33d80986f6f4c.js b/docs/_next/static/chunks/05a33d80986f6f4c.js deleted file mode 100644 index e7b99ed1..00000000 --- a/docs/_next/static/chunks/05a33d80986f6f4c.js +++ /dev/null @@ -1,528 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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("|"),a=RegExp(i,"g"),o=RegExp(i,"");function s(e){return n[e]}var l=function(e){return e.replace(a,s)};t.exports=l,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=l},29402,(e,t,r)=>{var n,i,a,o,s="__lodash_hash_undefined__",l=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",p="[object Map]",A="[object Number]",g="[object Object]",v="[object Promise]",y="[object RegExp]",C="[object Set]",B="[object String]",b="[object Symbol]",x="[object WeakMap]",S="[object ArrayBuffer]",E="[object DataView]",M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,T=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,D=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,G={};G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G[u]=G[c]=G[S]=G[d]=G[E]=G[f]=G[h]=G[m]=G[p]=G[A]=G[g]=G[y]=G[C]=G[B]=G[x]=!1;var L=e.g&&e.g.Object===Object&&e.g,O="object"==typeof self&&self&&self.Object===Object&&self,_=L||O||Function("return this")(),P=r&&!r.nodeType&&r,k=P&&t&&!t.nodeType&&t,H=k&&k.exports===P&&L.process,j=function(){try{return H&&H.binding("util")}catch(e){}}(),U=j&&j.isTypedArray;function N(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=eM(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ex.prototype.clear=function(){this.__data__={hash:new eB,map:new(el||eb),string:new eB}},ex.prototype.delete=function(e){return eL(this,e).delete(e)},ex.prototype.get=function(e){return eL(this,e).get(e)},ex.prototype.has=function(e){return eL(this,e).has(e)},ex.prototype.set=function(e,t){return eL(this,e).set(e,t),this},eS.prototype.add=eS.prototype.push=function(e){return this.__data__.set(e,s),this},eS.prototype.has=function(e){return this.__data__.has(e)},eE.prototype.clear=function(){this.__data__=new eb},eE.prototype.delete=function(e){return this.__data__.delete(e)},eE.prototype.get=function(e){return this.__data__.get(e)},eE.prototype.has=function(e){return this.__data__.has(e)},eE.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 ex(n)}return r.set(e,t),this};var eF=(n=function(e,t){return e&&eT(e,t,e0)},function(e,t){if(null==e)return e;if(!eq(e))return n(e,t);for(var r=e.length,i=-1,a=Object(e);++is))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eS:void 0;for(a.set(e,t),a.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$=U?J(U):function(e){return ez(e)&&eW(e.length)&&!!G[ee.call(e)]};function e0(e){return eq(e)?function(e,t){var r=eV(e)||eQ(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&o&&l&&!s&&!u||n&&o&&l||!r&&l||!i)return 1;if(!n&&!a&&!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))}},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;to+1e3&&(l.update(1e3*s/(e-o),100),o=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:t}}).Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,l=48*o,u=3*o,c=2*o,d=3*o,f=15*o,h=74*o,m=30*o,p=document.createElement("canvas");p.width=s,p.height=l,p.style.cssText="width:80px;height:48px";var A=p.getContext("2d");return A.font="bold "+9*o+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,s,l),A.fillStyle=t,A.fillText(e,u,c),A.fillRect(d,f,h,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d,f,h,m),{dom:p,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,s,f),A.fillStyle=t,A.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),A.drawImage(p,d+o,f,h-o,m,d,f,h-o,m),A.fillRect(d+h-o,f,o,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d+h-o,f,o,a((1-l/g)*m))}}},t.exports=n},31713,e=>{"use strict";let t,r,n,i,a,o,s,l;var u,c,d=e.i(43476),f=e.i(932),h=e.i(71645),m=e.i(91037),p=e.i(8560),A=e.i(90072);e.s(["ACESFilmicToneMapping",()=>A.ACESFilmicToneMapping,"AddEquation",()=>A.AddEquation,"AddOperation",()=>A.AddOperation,"AdditiveAnimationBlendMode",()=>A.AdditiveAnimationBlendMode,"AdditiveBlending",()=>A.AdditiveBlending,"AgXToneMapping",()=>A.AgXToneMapping,"AlphaFormat",()=>A.AlphaFormat,"AlwaysCompare",()=>A.AlwaysCompare,"AlwaysDepth",()=>A.AlwaysDepth,"AlwaysStencilFunc",()=>A.AlwaysStencilFunc,"AmbientLight",()=>A.AmbientLight,"AnimationAction",()=>A.AnimationAction,"AnimationClip",()=>A.AnimationClip,"AnimationLoader",()=>A.AnimationLoader,"AnimationMixer",()=>A.AnimationMixer,"AnimationObjectGroup",()=>A.AnimationObjectGroup,"AnimationUtils",()=>A.AnimationUtils,"ArcCurve",()=>A.ArcCurve,"ArrayCamera",()=>A.ArrayCamera,"ArrowHelper",()=>A.ArrowHelper,"AttachedBindMode",()=>A.AttachedBindMode,"Audio",()=>A.Audio,"AudioAnalyser",()=>A.AudioAnalyser,"AudioContext",()=>A.AudioContext,"AudioListener",()=>A.AudioListener,"AudioLoader",()=>A.AudioLoader,"AxesHelper",()=>A.AxesHelper,"BackSide",()=>A.BackSide,"BasicDepthPacking",()=>A.BasicDepthPacking,"BasicShadowMap",()=>A.BasicShadowMap,"BatchedMesh",()=>A.BatchedMesh,"Bone",()=>A.Bone,"BooleanKeyframeTrack",()=>A.BooleanKeyframeTrack,"Box2",()=>A.Box2,"Box3",()=>A.Box3,"Box3Helper",()=>A.Box3Helper,"BoxGeometry",()=>A.BoxGeometry,"BoxHelper",()=>A.BoxHelper,"BufferAttribute",()=>A.BufferAttribute,"BufferGeometry",()=>A.BufferGeometry,"BufferGeometryLoader",()=>A.BufferGeometryLoader,"ByteType",()=>A.ByteType,"Cache",()=>A.Cache,"Camera",()=>A.Camera,"CameraHelper",()=>A.CameraHelper,"CanvasTexture",()=>A.CanvasTexture,"CapsuleGeometry",()=>A.CapsuleGeometry,"CatmullRomCurve3",()=>A.CatmullRomCurve3,"CineonToneMapping",()=>A.CineonToneMapping,"CircleGeometry",()=>A.CircleGeometry,"ClampToEdgeWrapping",()=>A.ClampToEdgeWrapping,"Clock",()=>A.Clock,"Color",()=>A.Color,"ColorKeyframeTrack",()=>A.ColorKeyframeTrack,"ColorManagement",()=>A.ColorManagement,"CompressedArrayTexture",()=>A.CompressedArrayTexture,"CompressedCubeTexture",()=>A.CompressedCubeTexture,"CompressedTexture",()=>A.CompressedTexture,"CompressedTextureLoader",()=>A.CompressedTextureLoader,"ConeGeometry",()=>A.ConeGeometry,"ConstantAlphaFactor",()=>A.ConstantAlphaFactor,"ConstantColorFactor",()=>A.ConstantColorFactor,"Controls",()=>A.Controls,"CubeCamera",()=>A.CubeCamera,"CubeDepthTexture",()=>A.CubeDepthTexture,"CubeReflectionMapping",()=>A.CubeReflectionMapping,"CubeRefractionMapping",()=>A.CubeRefractionMapping,"CubeTexture",()=>A.CubeTexture,"CubeTextureLoader",()=>A.CubeTextureLoader,"CubeUVReflectionMapping",()=>A.CubeUVReflectionMapping,"CubicBezierCurve",()=>A.CubicBezierCurve,"CubicBezierCurve3",()=>A.CubicBezierCurve3,"CubicInterpolant",()=>A.CubicInterpolant,"CullFaceBack",()=>A.CullFaceBack,"CullFaceFront",()=>A.CullFaceFront,"CullFaceFrontBack",()=>A.CullFaceFrontBack,"CullFaceNone",()=>A.CullFaceNone,"Curve",()=>A.Curve,"CurvePath",()=>A.CurvePath,"CustomBlending",()=>A.CustomBlending,"CustomToneMapping",()=>A.CustomToneMapping,"CylinderGeometry",()=>A.CylinderGeometry,"Cylindrical",()=>A.Cylindrical,"Data3DTexture",()=>A.Data3DTexture,"DataArrayTexture",()=>A.DataArrayTexture,"DataTexture",()=>A.DataTexture,"DataTextureLoader",()=>A.DataTextureLoader,"DataUtils",()=>A.DataUtils,"DecrementStencilOp",()=>A.DecrementStencilOp,"DecrementWrapStencilOp",()=>A.DecrementWrapStencilOp,"DefaultLoadingManager",()=>A.DefaultLoadingManager,"DepthFormat",()=>A.DepthFormat,"DepthStencilFormat",()=>A.DepthStencilFormat,"DepthTexture",()=>A.DepthTexture,"DetachedBindMode",()=>A.DetachedBindMode,"DirectionalLight",()=>A.DirectionalLight,"DirectionalLightHelper",()=>A.DirectionalLightHelper,"DiscreteInterpolant",()=>A.DiscreteInterpolant,"DodecahedronGeometry",()=>A.DodecahedronGeometry,"DoubleSide",()=>A.DoubleSide,"DstAlphaFactor",()=>A.DstAlphaFactor,"DstColorFactor",()=>A.DstColorFactor,"DynamicCopyUsage",()=>A.DynamicCopyUsage,"DynamicDrawUsage",()=>A.DynamicDrawUsage,"DynamicReadUsage",()=>A.DynamicReadUsage,"EdgesGeometry",()=>A.EdgesGeometry,"EllipseCurve",()=>A.EllipseCurve,"EqualCompare",()=>A.EqualCompare,"EqualDepth",()=>A.EqualDepth,"EqualStencilFunc",()=>A.EqualStencilFunc,"EquirectangularReflectionMapping",()=>A.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>A.EquirectangularRefractionMapping,"Euler",()=>A.Euler,"EventDispatcher",()=>A.EventDispatcher,"ExternalTexture",()=>A.ExternalTexture,"ExtrudeGeometry",()=>A.ExtrudeGeometry,"FileLoader",()=>A.FileLoader,"Float16BufferAttribute",()=>A.Float16BufferAttribute,"Float32BufferAttribute",()=>A.Float32BufferAttribute,"FloatType",()=>A.FloatType,"Fog",()=>A.Fog,"FogExp2",()=>A.FogExp2,"FramebufferTexture",()=>A.FramebufferTexture,"FrontSide",()=>A.FrontSide,"Frustum",()=>A.Frustum,"FrustumArray",()=>A.FrustumArray,"GLBufferAttribute",()=>A.GLBufferAttribute,"GLSL1",()=>A.GLSL1,"GLSL3",()=>A.GLSL3,"GreaterCompare",()=>A.GreaterCompare,"GreaterDepth",()=>A.GreaterDepth,"GreaterEqualCompare",()=>A.GreaterEqualCompare,"GreaterEqualDepth",()=>A.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>A.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>A.GreaterStencilFunc,"GridHelper",()=>A.GridHelper,"Group",()=>A.Group,"HalfFloatType",()=>A.HalfFloatType,"HemisphereLight",()=>A.HemisphereLight,"HemisphereLightHelper",()=>A.HemisphereLightHelper,"IcosahedronGeometry",()=>A.IcosahedronGeometry,"ImageBitmapLoader",()=>A.ImageBitmapLoader,"ImageLoader",()=>A.ImageLoader,"ImageUtils",()=>A.ImageUtils,"IncrementStencilOp",()=>A.IncrementStencilOp,"IncrementWrapStencilOp",()=>A.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>A.InstancedBufferAttribute,"InstancedBufferGeometry",()=>A.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>A.InstancedInterleavedBuffer,"InstancedMesh",()=>A.InstancedMesh,"Int16BufferAttribute",()=>A.Int16BufferAttribute,"Int32BufferAttribute",()=>A.Int32BufferAttribute,"Int8BufferAttribute",()=>A.Int8BufferAttribute,"IntType",()=>A.IntType,"InterleavedBuffer",()=>A.InterleavedBuffer,"InterleavedBufferAttribute",()=>A.InterleavedBufferAttribute,"Interpolant",()=>A.Interpolant,"InterpolateDiscrete",()=>A.InterpolateDiscrete,"InterpolateLinear",()=>A.InterpolateLinear,"InterpolateSmooth",()=>A.InterpolateSmooth,"InterpolationSamplingMode",()=>A.InterpolationSamplingMode,"InterpolationSamplingType",()=>A.InterpolationSamplingType,"InvertStencilOp",()=>A.InvertStencilOp,"KeepStencilOp",()=>A.KeepStencilOp,"KeyframeTrack",()=>A.KeyframeTrack,"LOD",()=>A.LOD,"LatheGeometry",()=>A.LatheGeometry,"Layers",()=>A.Layers,"LessCompare",()=>A.LessCompare,"LessDepth",()=>A.LessDepth,"LessEqualCompare",()=>A.LessEqualCompare,"LessEqualDepth",()=>A.LessEqualDepth,"LessEqualStencilFunc",()=>A.LessEqualStencilFunc,"LessStencilFunc",()=>A.LessStencilFunc,"Light",()=>A.Light,"LightProbe",()=>A.LightProbe,"Line",()=>A.Line,"Line3",()=>A.Line3,"LineBasicMaterial",()=>A.LineBasicMaterial,"LineCurve",()=>A.LineCurve,"LineCurve3",()=>A.LineCurve3,"LineDashedMaterial",()=>A.LineDashedMaterial,"LineLoop",()=>A.LineLoop,"LineSegments",()=>A.LineSegments,"LinearFilter",()=>A.LinearFilter,"LinearInterpolant",()=>A.LinearInterpolant,"LinearMipMapLinearFilter",()=>A.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>A.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>A.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>A.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>A.LinearSRGBColorSpace,"LinearToneMapping",()=>A.LinearToneMapping,"LinearTransfer",()=>A.LinearTransfer,"Loader",()=>A.Loader,"LoaderUtils",()=>A.LoaderUtils,"LoadingManager",()=>A.LoadingManager,"LoopOnce",()=>A.LoopOnce,"LoopPingPong",()=>A.LoopPingPong,"LoopRepeat",()=>A.LoopRepeat,"MOUSE",()=>A.MOUSE,"Material",()=>A.Material,"MaterialLoader",()=>A.MaterialLoader,"MathUtils",()=>A.MathUtils,"Matrix2",()=>A.Matrix2,"Matrix3",()=>A.Matrix3,"Matrix4",()=>A.Matrix4,"MaxEquation",()=>A.MaxEquation,"Mesh",()=>A.Mesh,"MeshBasicMaterial",()=>A.MeshBasicMaterial,"MeshDepthMaterial",()=>A.MeshDepthMaterial,"MeshDistanceMaterial",()=>A.MeshDistanceMaterial,"MeshLambertMaterial",()=>A.MeshLambertMaterial,"MeshMatcapMaterial",()=>A.MeshMatcapMaterial,"MeshNormalMaterial",()=>A.MeshNormalMaterial,"MeshPhongMaterial",()=>A.MeshPhongMaterial,"MeshPhysicalMaterial",()=>A.MeshPhysicalMaterial,"MeshStandardMaterial",()=>A.MeshStandardMaterial,"MeshToonMaterial",()=>A.MeshToonMaterial,"MinEquation",()=>A.MinEquation,"MirroredRepeatWrapping",()=>A.MirroredRepeatWrapping,"MixOperation",()=>A.MixOperation,"MultiplyBlending",()=>A.MultiplyBlending,"MultiplyOperation",()=>A.MultiplyOperation,"NearestFilter",()=>A.NearestFilter,"NearestMipMapLinearFilter",()=>A.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>A.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>A.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>A.NearestMipmapNearestFilter,"NeutralToneMapping",()=>A.NeutralToneMapping,"NeverCompare",()=>A.NeverCompare,"NeverDepth",()=>A.NeverDepth,"NeverStencilFunc",()=>A.NeverStencilFunc,"NoBlending",()=>A.NoBlending,"NoColorSpace",()=>A.NoColorSpace,"NoNormalPacking",()=>A.NoNormalPacking,"NoToneMapping",()=>A.NoToneMapping,"NormalAnimationBlendMode",()=>A.NormalAnimationBlendMode,"NormalBlending",()=>A.NormalBlending,"NormalGAPacking",()=>A.NormalGAPacking,"NormalRGPacking",()=>A.NormalRGPacking,"NotEqualCompare",()=>A.NotEqualCompare,"NotEqualDepth",()=>A.NotEqualDepth,"NotEqualStencilFunc",()=>A.NotEqualStencilFunc,"NumberKeyframeTrack",()=>A.NumberKeyframeTrack,"Object3D",()=>A.Object3D,"ObjectLoader",()=>A.ObjectLoader,"ObjectSpaceNormalMap",()=>A.ObjectSpaceNormalMap,"OctahedronGeometry",()=>A.OctahedronGeometry,"OneFactor",()=>A.OneFactor,"OneMinusConstantAlphaFactor",()=>A.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>A.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>A.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>A.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>A.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>A.OneMinusSrcColorFactor,"OrthographicCamera",()=>A.OrthographicCamera,"PCFShadowMap",()=>A.PCFShadowMap,"PCFSoftShadowMap",()=>A.PCFSoftShadowMap,"PMREMGenerator",()=>p.PMREMGenerator,"Path",()=>A.Path,"PerspectiveCamera",()=>A.PerspectiveCamera,"Plane",()=>A.Plane,"PlaneGeometry",()=>A.PlaneGeometry,"PlaneHelper",()=>A.PlaneHelper,"PointLight",()=>A.PointLight,"PointLightHelper",()=>A.PointLightHelper,"Points",()=>A.Points,"PointsMaterial",()=>A.PointsMaterial,"PolarGridHelper",()=>A.PolarGridHelper,"PolyhedronGeometry",()=>A.PolyhedronGeometry,"PositionalAudio",()=>A.PositionalAudio,"PropertyBinding",()=>A.PropertyBinding,"PropertyMixer",()=>A.PropertyMixer,"QuadraticBezierCurve",()=>A.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>A.QuadraticBezierCurve3,"Quaternion",()=>A.Quaternion,"QuaternionKeyframeTrack",()=>A.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>A.QuaternionLinearInterpolant,"R11_EAC_Format",()=>A.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>A.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>A.RED_RGTC1_Format,"REVISION",()=>A.REVISION,"RG11_EAC_Format",()=>A.RG11_EAC_Format,"RGBADepthPacking",()=>A.RGBADepthPacking,"RGBAFormat",()=>A.RGBAFormat,"RGBAIntegerFormat",()=>A.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>A.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>A.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>A.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>A.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>A.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>A.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>A.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>A.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>A.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>A.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>A.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>A.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>A.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>A.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>A.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>A.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>A.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>A.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>A.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>A.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>A.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>A.RGBDepthPacking,"RGBFormat",()=>A.RGBFormat,"RGBIntegerFormat",()=>A.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>A.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>A.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>A.RGB_ETC1_Format,"RGB_ETC2_Format",()=>A.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>A.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>A.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>A.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>A.RGDepthPacking,"RGFormat",()=>A.RGFormat,"RGIntegerFormat",()=>A.RGIntegerFormat,"RawShaderMaterial",()=>A.RawShaderMaterial,"Ray",()=>A.Ray,"Raycaster",()=>A.Raycaster,"RectAreaLight",()=>A.RectAreaLight,"RedFormat",()=>A.RedFormat,"RedIntegerFormat",()=>A.RedIntegerFormat,"ReinhardToneMapping",()=>A.ReinhardToneMapping,"RenderTarget",()=>A.RenderTarget,"RenderTarget3D",()=>A.RenderTarget3D,"RepeatWrapping",()=>A.RepeatWrapping,"ReplaceStencilOp",()=>A.ReplaceStencilOp,"ReverseSubtractEquation",()=>A.ReverseSubtractEquation,"RingGeometry",()=>A.RingGeometry,"SIGNED_R11_EAC_Format",()=>A.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>A.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>A.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>A.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>A.SRGBColorSpace,"SRGBTransfer",()=>A.SRGBTransfer,"Scene",()=>A.Scene,"ShaderChunk",()=>p.ShaderChunk,"ShaderLib",()=>p.ShaderLib,"ShaderMaterial",()=>A.ShaderMaterial,"ShadowMaterial",()=>A.ShadowMaterial,"Shape",()=>A.Shape,"ShapeGeometry",()=>A.ShapeGeometry,"ShapePath",()=>A.ShapePath,"ShapeUtils",()=>A.ShapeUtils,"ShortType",()=>A.ShortType,"Skeleton",()=>A.Skeleton,"SkeletonHelper",()=>A.SkeletonHelper,"SkinnedMesh",()=>A.SkinnedMesh,"Source",()=>A.Source,"Sphere",()=>A.Sphere,"SphereGeometry",()=>A.SphereGeometry,"Spherical",()=>A.Spherical,"SphericalHarmonics3",()=>A.SphericalHarmonics3,"SplineCurve",()=>A.SplineCurve,"SpotLight",()=>A.SpotLight,"SpotLightHelper",()=>A.SpotLightHelper,"Sprite",()=>A.Sprite,"SpriteMaterial",()=>A.SpriteMaterial,"SrcAlphaFactor",()=>A.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>A.SrcAlphaSaturateFactor,"SrcColorFactor",()=>A.SrcColorFactor,"StaticCopyUsage",()=>A.StaticCopyUsage,"StaticDrawUsage",()=>A.StaticDrawUsage,"StaticReadUsage",()=>A.StaticReadUsage,"StereoCamera",()=>A.StereoCamera,"StreamCopyUsage",()=>A.StreamCopyUsage,"StreamDrawUsage",()=>A.StreamDrawUsage,"StreamReadUsage",()=>A.StreamReadUsage,"StringKeyframeTrack",()=>A.StringKeyframeTrack,"SubtractEquation",()=>A.SubtractEquation,"SubtractiveBlending",()=>A.SubtractiveBlending,"TOUCH",()=>A.TOUCH,"TangentSpaceNormalMap",()=>A.TangentSpaceNormalMap,"TetrahedronGeometry",()=>A.TetrahedronGeometry,"Texture",()=>A.Texture,"TextureLoader",()=>A.TextureLoader,"TextureUtils",()=>A.TextureUtils,"Timer",()=>A.Timer,"TimestampQuery",()=>A.TimestampQuery,"TorusGeometry",()=>A.TorusGeometry,"TorusKnotGeometry",()=>A.TorusKnotGeometry,"Triangle",()=>A.Triangle,"TriangleFanDrawMode",()=>A.TriangleFanDrawMode,"TriangleStripDrawMode",()=>A.TriangleStripDrawMode,"TrianglesDrawMode",()=>A.TrianglesDrawMode,"TubeGeometry",()=>A.TubeGeometry,"UVMapping",()=>A.UVMapping,"Uint16BufferAttribute",()=>A.Uint16BufferAttribute,"Uint32BufferAttribute",()=>A.Uint32BufferAttribute,"Uint8BufferAttribute",()=>A.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>A.Uint8ClampedBufferAttribute,"Uniform",()=>A.Uniform,"UniformsGroup",()=>A.UniformsGroup,"UniformsLib",()=>p.UniformsLib,"UniformsUtils",()=>A.UniformsUtils,"UnsignedByteType",()=>A.UnsignedByteType,"UnsignedInt101111Type",()=>A.UnsignedInt101111Type,"UnsignedInt248Type",()=>A.UnsignedInt248Type,"UnsignedInt5999Type",()=>A.UnsignedInt5999Type,"UnsignedIntType",()=>A.UnsignedIntType,"UnsignedShort4444Type",()=>A.UnsignedShort4444Type,"UnsignedShort5551Type",()=>A.UnsignedShort5551Type,"UnsignedShortType",()=>A.UnsignedShortType,"VSMShadowMap",()=>A.VSMShadowMap,"Vector2",()=>A.Vector2,"Vector3",()=>A.Vector3,"Vector4",()=>A.Vector4,"VectorKeyframeTrack",()=>A.VectorKeyframeTrack,"VideoFrameTexture",()=>A.VideoFrameTexture,"VideoTexture",()=>A.VideoTexture,"WebGL3DRenderTarget",()=>A.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>A.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>A.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>A.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>A.WebGLRenderTarget,"WebGLRenderer",()=>p.WebGLRenderer,"WebGLUtils",()=>p.WebGLUtils,"WebGPUCoordinateSystem",()=>A.WebGPUCoordinateSystem,"WebXRController",()=>A.WebXRController,"WireframeGeometry",()=>A.WireframeGeometry,"WrapAroundEnding",()=>A.WrapAroundEnding,"ZeroCurvatureEnding",()=>A.ZeroCurvatureEnding,"ZeroFactor",()=>A.ZeroFactor,"ZeroSlopeEnding",()=>A.ZeroSlopeEnding,"ZeroStencilOp",()=>A.ZeroStencilOp,"createCanvasElement",()=>A.createCanvasElement,"error",()=>A.error,"getConsoleFunction",()=>A.getConsoleFunction,"log",()=>A.log,"setConsoleFunction",()=>A.setConsoleFunction,"warn",()=>A.warn,"warnOnce",()=>A.warnOnce],32009);var g=e.i(32009);function v(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let y=["x","y","top","bottom","left","right","width","height"];var C=e.i(46791);function B({ref:e,children:t,fallback:r,resize:n,style:i,gl:a,events:o=m.f,eventSource:s,eventPrefix:l,shadows:u,linear:c,flat:f,legacy:p,orthographic:A,frameloop:C,dpr:B,performance:b,raycaster:x,camera:S,scene:E,onPointerMissed:M,onCreated:F,...T}){h.useMemo(()=>(0,m.e)(g),[]);let R=(0,m.u)(),[w,D]=function({debounce:e,scroll:t,polyfill:r,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){var i,a,o;let s=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,h.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,h.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=e?"number"==typeof e?e:e.scroll:null,f=e?"number"==typeof e?e:e.resize:null,m=(0,h.useRef)(!1);(0,h.useEffect)(()=>(m.current=!0,()=>void(m.current=!1)));let[p,A,g]=(0,h.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:r,top:i,width:a,height:o,bottom:s,right:l,x:d,y:f}=c.current.element.getBoundingClientRect(),h={left:r,top:i,width:a,height:o,bottom:s,right:l,x:d,y:f};c.current.element instanceof HTMLElement&&n&&(h.height=c.current.element.offsetHeight,h.width=c.current.element.offsetWidth),Object.freeze(h),m.current&&(e=c.current.lastBounds,t=h,!y.every(r=>e[r]===t[r]))&&u(c.current.lastBounds=h)};return[e,f?v(e,f):e,d?v(e,d):e]},[u,n,d,f]);function C(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function B(){c.current.element&&(c.current.resizeObserver=new s(g),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return i=g,a=!!t,(0,h.useEffect)(()=>{if(a)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,a]),o=A,(0,h.useEffect)(()=>(window.addEventListener("resize",o),()=>void window.removeEventListener("resize",o)),[o]),(0,h.useEffect)(()=>{C(),B()},[t,g,A]),(0,h.useEffect)(()=>C,[]),[e=>{e&&e!==c.current.element&&(C(),c.current.element=e,c.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),B())},l,p]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=h.useRef(null),G=h.useRef(null);h.useImperativeHandle(e,()=>I.current);let L=(0,m.a)(M),[O,_]=h.useState(!1),[P,k]=h.useState(!1);if(O)throw O;if(P)throw P;let H=h.useRef(null);(0,m.b)(()=>{let e=I.current;D.width>0&&D.height>0&&e&&(H.current||(H.current=(0,m.c)(e)),async function(){await H.current.configure({gl:a,scene:E,events:o,shadows:u,linear:c,flat:f,legacy:p,orthographic:A,frameloop:C,dpr:B,performance:b,raycaster:x,camera:S,size:D,onPointerMissed:(...e)=>null==L.current?void 0:L.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(s?(0,m.i)(s)?s.current:s:G.current),l&&e.setEvents({compute:(e,t)=>{let r=e[l+"X"],n=e[l+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==F||F(e)}}),H.current.render((0,d.jsx)(R,{children:(0,d.jsx)(m.E,{set:k,children:(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)(m.B,{set:_}),children:null!=t?t:null})})}))}())}),h.useEffect(()=>{let e=I.current;if(e)return()=>(0,m.d)(e)},[]);let j=s?"none":"auto";return(0,d.jsx)("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...i},...T,children:(0,d.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,d.jsx)("canvas",{ref:I,style:{display:"block"},children:r})})})}function b(e){return(0,d.jsx)(C.FiberProvider,{children:(0,d.jsx)(B,{...e})})}e.i(39695),e.i(98133),e.i(95087);var x=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.i(47167);var S={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},E=new class{#e=S;#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)}},M="undefined"==typeof window||"Deno"in globalThis;function F(){}function T(e){return"number"==typeof e&&e>=0&&e!==1/0}function R(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return"function"==typeof e?e(t):e}function D(e,t){return"function"==typeof e?e(t):e}function I(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==L(o,t.options))return!1}else if(!_(t.queryKey,o))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof s||t.isStale()===s)&&(!i||i===t.state.fetchStatus)&&(!a||!!a(t))}function G(e,t){let{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(O(t.options.mutationKey)!==O(a))return!1}else if(!_(t.options.mutationKey,a))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function L(e,t){return(t?.queryKeyHashFn||O)(e)}function O(e){return JSON.stringify(e,(e,t)=>j(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function _(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>_(e[r],t[r]))}var P=Object.prototype.hasOwnProperty;function k(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 H(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function j(e){if(!U(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!U(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function U(e){return"[object Object]"===Object.prototype.toString.call(e)}function N(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=H(t)&&H(r);if(!n&&!(j(t)&&j(r)))return r;let i=(n?t:Object.keys(t)).length,a=n?r:Object.keys(r),o=a.length,s=n?Array(o):{},l=0;for(let u=0;ur?n.slice(1):n}function K(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Q=Symbol();function V(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Q?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}var q=new class extends x{#r;#n;#i;constructor(){super(),this.#i=e=>{if(!M&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=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"}},X=(r=[],n=0,i=e=>{e()},a=e=>{e()},o=function(e){setTimeout(e,0)},{batch:e=>{let t;n++;try{t=e()}finally{let e;--n||(e=r,r=[],e.length&&o(()=>{a(()=>{e.forEach(e=>{i(e)})})}))}return t},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s=e=>{n?r.push(e):o(()=>{i(e)})},setNotifyFunction:e=>{i=e},setBatchNotifyFunction:e=>{a=e},setScheduler:e=>{o=e}}),W=new class extends x{#a=!0;#n;#i;constructor(){super(),this.#i=e=>{if(!M&&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.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#a!==e&&(this.#a=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#a}};function Y(){let e,t,r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function z(e){return Math.min(1e3*2**e,3e4)}function Z(e){return(e??"online")!=="online"||W.isOnline()}var $=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ee(e){let t,r=!1,n=0,i=Y(),a=()=>q.isFocused()&&("always"===e.networkMode||W.isOnline())&&e.canRun(),o=()=>Z(e.networkMode)&&e.canRun(),s=e=>{"pending"===i.status&&(t?.(),i.resolve(e))},l=e=>{"pending"===i.status&&(t?.(),i.reject(e))},u=()=>new Promise(r=>{t=e=>{("pending"!==i.status||a())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,"pending"===i.status&&e.onContinue?.()}),c=()=>{let t;if("pending"!==i.status)return;let o=0===n?e.initialPromise:void 0;try{t=o??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(s).catch(t=>{if("pending"!==i.status)return;let o=e.retry??3*!M,s=e.retryDelay??z,d="function"==typeof s?s(n,t):s,f=!0===o||"number"==typeof o&&n{E.setTimeout(e,d)}).then(()=>a()?void 0:u()).then(()=>{r?l(t):c()}))})};return{promise:i,status:()=>i.status,cancel:t=>{if("pending"===i.status){let r=new $(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?c():u().then(c),i)}}var et=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#o=E.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M?1/0:3e5))}clearGcTimeout(){this.#o&&(E.clearTimeout(this.#o),this.#o=void 0)}},er=class extends et{#s;#l;#u;#c;#d;#f;#h;constructor(e){super(),this.#h=!1,this.#f=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.#s=ea(this.options),this.state=e.state??this.#s,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=ea(this.options);void 0!==e.data&&(this.setState(ei(e.data,e.dataUpdatedAt)),this.#s=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){let r=N(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#m({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(F).catch(F):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#s)}isActive(){return this.observers.some(e=>!1!==D(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Q||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===w(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||!R(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.#h?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,t){let r;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&t?.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 n=new AbortController,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,n.signal)})},a=()=>{let e,r=V(this.options,t),n=(i(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#h=!1,this.options.persister)?this.options.persister(r,n,this):r(n)},o=(i(r={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),r);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=ee({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof $&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.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 $){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,...en(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...ei(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 n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),X.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function en(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function ei(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ea(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var eo=class extends x{constructor(e,t){super(),this.options=t,this.#c=e,this.#p=null,this.#A=Y(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#v=void 0;#y=void 0;#C;#B;#A;#p;#b;#x;#S;#E;#M;#F;#T=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),es(this.#g,this.options)?this.#R():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return el(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return el(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#D(),this.#I(),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 D(this.options.enabled,this.#g))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#G(),this.#g.setOptions(this.options),t._defaulted&&!k(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});let n=this.hasListeners();n&&eu(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),n&&(this.#g!==r||D(this.options.enabled,this.#g)!==D(t.enabled,this.#g)||w(this.options.staleTime,this.#g)!==w(t.staleTime,this.#g))&&this.#L();let i=this.#O();n&&(this.#g!==r||D(this.options.enabled,this.#g)!==D(t.enabled,this.#g)||i!==this.#F)&&this.#_(i)}getOptimisticResult(e){var t,r;let n=this.#c.getQueryCache().build(this.#c,e),i=this.createResult(n,e);return t=this,r=i,k(t.getCurrentResult(),r)||(this.#y=i,this.#B=this.options,this.#C=this.#g.state),i}getCurrentResult(){return this.#y}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.#A.status||this.#A.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#T.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.#R({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#y))}#R(e){this.#G();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(F)),t}#L(){this.#D();let e=w(this.options.staleTime,this.#g);if(M||this.#y.isStale||!T(e))return;let t=R(this.#y.dataUpdatedAt,e);this.#E=E.setTimeout(()=>{this.#y.isStale||this.updateResult()},t+1)}#O(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#_(e){this.#I(),this.#F=e,!M&&!1!==D(this.options.enabled,this.#g)&&T(this.#F)&&0!==this.#F&&(this.#M=E.setInterval(()=>{(this.options.refetchIntervalInBackground||q.isFocused())&&this.#R()},this.#F))}#w(){this.#L(),this.#_(this.#O())}#D(){this.#E&&(E.clearTimeout(this.#E),this.#E=void 0)}#I(){this.#M&&(E.clearInterval(this.#M),this.#M=void 0)}createResult(e,t){let r,n=this.#g,i=this.options,a=this.#y,o=this.#C,s=this.#B,l=e!==n?e.state:this.#v,{state:u}=e,c={...u},d=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&es(e,t),o=r&&eu(e,n,t,i);(a||o)&&(c={...c,...en(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:h,status:m}=c;r=c.data;let p=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===m){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,p=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#S?.state.data,this.#S):t.placeholderData,void 0!==e&&(m="success",r=N(a?.data,e,t),d=!0)}if(t.select&&void 0!==r&&!p)if(a&&r===o?.data&&t.select===this.#b)r=this.#x;else try{this.#b=t.select,r=t.select(r),r=N(a?.data,r,t),this.#x=r,this.#p=null}catch(e){this.#p=e}this.#p&&(f=this.#p,r=this.#x,h=Date.now(),m="error");let A="fetching"===c.fetchStatus,g="pending"===m,v="error"===m,y=g&&A,C=void 0!==r,B={status:m,fetchStatus:c.fetchStatus,isPending:g,isSuccess:"success"===m,isError:v,isInitialLoading:y,isLoading:y,data:r,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:A,isRefetching:A&&!g,isLoadingError:v&&!C,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:v&&C,isStale:ec(e,t),refetch:this.refetch,promise:this.#A,isEnabled:!1!==D(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===B.status?e.reject(B.error):void 0!==B.data&&e.resolve(B.data)},r=()=>{t(this.#A=B.promise=Y())},i=this.#A;switch(i.status){case"pending":e.queryHash===n.queryHash&&t(i);break;case"fulfilled":("error"===B.status||B.data!==i.value)&&r();break;case"rejected":("error"!==B.status||B.error!==i.reason)&&r()}}return B}updateResult(){let e=this.#y,t=this.createResult(this.#g,this.options);if(this.#C=this.#g.state,this.#B=this.options,void 0!==this.#C.data&&(this.#S=this.#g),k(t,e))return;this.#y=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#T.size)return!0;let n=new Set(r??this.#T);return this.options.throwOnError&&n.add("error"),Object.keys(this.#y).some(t=>this.#y[t]!==e[t]&&n.has(t))};this.#P({listeners:r()})}#G(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;let t=this.#g;this.#g=e,this.#v=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#w()}#P(e){X.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#y)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function es(e,t){return!1!==D(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&el(e,t,t.refetchOnMount)}function el(e,t,r){if(!1!==D(t.enabled,e)&&"static"!==w(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&ec(e,t)}return!1}function eu(e,t,r,n){return(e!==t||!1===D(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&ec(e,r)}function ec(e,t){return!1!==D(t.enabled,e)&&e.isStaleByTime(w(t.staleTime,e))}var ed=h.createContext(void 0),ef=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(ed.Provider,{value:e,children:t})),eh=h.createContext((l=!1,{clearReset:()=>{l=!1},reset:()=>{l=!0},isReset:()=>l})),em=h.createContext(!1);em.Provider;var ep=(e,t)=>void 0===t.state.data,eA=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function eg(e,t,r){let n=h.useContext(em),i=h.useContext(eh),a=(e=>{let t=h.useContext(ed);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t})(r),o=a.defaultQueryOptions(e);if(a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=n?"isRestoring":"optimistic",o.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=o.staleTime;o.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof o.gcTime&&(o.gcTime=Math.max(o.gcTime,1e3))}(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&!i.isReset()&&(o.retryOnMount=!1),h.useEffect(()=>{i.clearReset()},[i]);let s=!a.getQueryCache().get(o.queryHash),[l]=h.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),c=!n&&!1!==e.subscribed;if(h.useSyncExternalStore(h.useCallback(e=>{let t=c?l.subscribe(X.batchCalls(e)):F;return l.updateResult(),t},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(o)},[o,l]),o?.suspense&&u.isPending)throw eA(o,l,i);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>{var a;return e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||(a=[e.error,n],"function"==typeof r?r(...a):!!r))})({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if(a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!M&&u.isLoading&&u.isFetching&&!n){let e=s?eA(o,l,i):a.getQueryCache().get(o.queryHash)?.promise;e?.catch(F).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?u:l.trackResult(u)}var ev=e.i(54970),ey=e.i(12979),eC=e.i(49774),eB=e.i(73949),eb=e.i(62395),ex=e.i(75567),eS=e.i(47071);let eE={value:!0},eM=` -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 eF=e.i(79123),eT=e.i(47021),eR=e.i(48066);let ew={0:32,1:32,2:32,3:32,4:32,5:32};function eD({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:i,lightmap:a}){let{debugMode:o}=(0,eF.useDebug)(),s=(0,eS.useTexture)(r.map(e=>(0,ey.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,ex.setupTexture)(e))}),l=i?(0,ey.textureToUrl)(i):null,u=(0,eS.useTexture)(l??ey.FALLBACK_TEXTURE_URL,e=>{(0,ex.setupTexture)(e)}),c=(0,h.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:i,detailTexture:a=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=eE;let s=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:i[r]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),a&&(e.uniforms.detailTexture={value:a},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; -${n?"uniform sampler2D visibilityMask;":""} -${o?"uniform sampler2D terrainLightmap;":""} -uniform bool sunLightPointsDown; -${a?`uniform sampler2D detailTexture; -uniform float detailTiling; -uniform float detailFadeDistance; -varying vec3 vTerrainWorldPos;`:""} - -${eM} - -// Global variable to store shadow factor from RE_Direct for use in output calculation -float terrainShadowFactor = 1.0; -`+e.fragmentShader,n){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; - - ${a?`// 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:s,alphaTextures:n,visibilityMask:t,tiling:ew,detailTexture:l?u:null,lightmap:a}),(0,eT.injectCustomFog)(e,eR.globalFogUniforms)},[s,n,t,u,l,a]),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!o,e.needsUpdate=!0)},[o]);let m=`${l?"detail":"nodetail"}-${a?"lightmap":"nolightmap"}`;return(0,d.jsx)("meshLambertMaterial",{ref:f,map:e,depthWrite:!0,side:A.FrontSide,defines:{DEBUG_MODE:+!!o},onBeforeCompile:c},m)}function eI(e){let t,r,n=(0,f.c)(8),{displacementMap:i,visibilityMask:a,textureNames:o,alphaTextures:s,detailTextureName:l,lightmap:u}=e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),n[0]=t):t=n[0],n[1]!==s||n[2]!==l||n[3]!==i||n[4]!==u||n[5]!==o||n[6]!==a?(r=(0,d.jsx)(h.Suspense,{fallback:t,children:(0,d.jsx)(eD,{displacementMap:i,visibilityMask:a,textureNames:o,alphaTextures:s,detailTextureName:l,lightmap:u})}),n[1]=s,n[2]=l,n[3]=i,n[4]=u,n[5]=o,n[6]=a,n[7]=r):r=n[7],r}let eG=(0,h.memo)(function(e){let t,r,n,i=(0,f.c)(15),{tileX:a,tileZ:o,blockSize:s,basePosition:l,textureNames:u,geometry:c,displacementMap:h,visibilityMask:m,alphaTextures:p,detailTextureName:A,lightmap:g,visible:v}=e,y=void 0===v||v,C=s/2,B=l.x+a*s+C,b=l.z+o*s+C;i[0]!==B||i[1]!==b?(t=[B,0,b],i[0]=B,i[1]=b,i[2]=t):t=i[2];let x=t;return i[3]!==p||i[4]!==A||i[5]!==h||i[6]!==g||i[7]!==u||i[8]!==m?(r=(0,d.jsx)(eI,{displacementMap:h,visibilityMask:m,textureNames:u,alphaTextures:p,detailTextureName:A,lightmap:g}),i[3]=p,i[4]=A,i[5]=h,i[6]=g,i[7]=u,i[8]=m,i[9]=r):r=i[9],i[10]!==c||i[11]!==x||i[12]!==r||i[13]!==y?(n=(0,d.jsx)("mesh",{position:x,geometry:c,castShadow:!0,receiveShadow:!0,visible:y,children:r}),i[10]=c,i[11]=x,i[12]=r,i[13]=y,i[14]=n):n=i[14],n});var eL=e.i(77482);function eO(e){let t,r=(0,f.c)(3),n=(0,eL.useRuntime)();return r[0]!==e||r[1]!==n?(t=n.getObjectByName(e),r[0]=e,r[1]=n,r[2]=t):t=r[2],t}function e_(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r0?n:(t[0]!==r?(e=(0,eb.getFloat)(r,"visibleDistance")??600,t[0]=r,t[1]=e):e=t[1],e)}(),G=(0,eB.useThree)(ek),L=-(128*R);M[6]!==L?(i={x:L,z:L},M[6]=L,M[7]=i):i=M[7];let O=i;if(M[8]!==F){let e=(0,eb.getProperty)(F,"emptySquares");a=e?e.split(" ").map(eH):[],M[8]=F,M[9]=a}else a=M[9];let _=a,{data:P}=((E=(0,f.c)(2))[0]!==T?(S={queryKey:["terrain",T],queryFn:()=>(0,ey.loadTerrain)(T)},E[0]=T,E[1]=S):S=E[1],eg(S,eo,void 0));e:{let e;if(!P){o=null;break e}let t=256*R;M[10]!==t||M[11]!==R||M[12]!==P.heightMap?(!function(e,t,r){let n=e.attributes.position,i=e.attributes.uv,a=e.attributes.normal,o=n.array,s=i.array,l=a.array,u=n.count,c=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),i=Math.floor(r=Math.max(0,Math.min(255,r))),a=Math.min(n+1,255),o=Math.min(i+1,255),s=e-n,l=r-i;return(t[256*i+n]/65535*2048*(1-s)+t[256*i+a]/65535*2048*s)*(1-l)+(t[256*o+n]/65535*2048*(1-s)+t[256*o+a]/65535*2048*s)*l};for(let e=0;e0?(m/=g,p/=g,A/=g):(m=0,p=1,A=0),l[3*e]=m,l[3*e+1]=p,l[3*e+2]=A}n.needsUpdate=!0,a.needsUpdate=!0}(e=function(e,t){let r=new A.BufferGeometry,n=new Float32Array(198147),i=new Float32Array(198147),a=new Float32Array(132098),o=new Uint32Array(393216),s=0,l=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let o=257*t+r;n[3*o]=r*l-e/2,n[3*o+1]=e/2-t*l,n[3*o+2]=0,i[3*o]=0,i[3*o+1]=0,i[3*o+2]=1,a[2*o]=r/256,a[2*o+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,i=(e+1)*257+t,a=i+1;((t^e)&1)==0?(o[s++]=r,o[s++]=i,o[s++]=a,o[s++]=r,o[s++]=a,o[s++]=n):(o[s++]=r,o[s++]=i,o[s++]=n,o[s++]=n,o[s++]=i,o[s++]=a)}return r.setIndex(new A.BufferAttribute(o,1)),r.setAttribute("position",new A.Float32BufferAttribute(n,3)),r.setAttribute("normal",new A.Float32BufferAttribute(i,3)),r.setAttribute("uv",new A.Float32BufferAttribute(a,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),P.heightMap,R),M[10]=t,M[11]=R,M[12]=P.heightMap,M[13]=e):e=M[13],o=e}let k=o,H=eO("Sun");t:{let e,t;if(!H){let e;M[14]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector3(.57735,-.57735,.57735),M[14]=e):e=M[14],s=e;break t}M[15]!==H?(e=((0,eb.getProperty)(H,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(ej),M[15]=H,M[16]=e):e=M[16];let[r,n,i]=e,a=Math.sqrt(r*r+i*i+n*n),o=r/a,l=i/a,u=n/a;M[17]!==l||M[18]!==u||M[19]!==o?(t=new A.Vector3(o,l,u),M[17]=l,M[18]=u,M[19]=o,M[20]=t):t=M[20],s=t}let j=s;r:{let e;if(!P){l=null;break r}M[21]!==R||M[22]!==j||M[23]!==P.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),i=Math.max(0,Math.min(255,r)),a=Math.floor(n),o=Math.floor(i),s=Math.min(a+1,255),l=Math.min(o+1,255),u=n-a,c=i-o;return((e[256*o+a]/65535*(1-u)+e[256*o+s]/65535*u)*(1-c)+(e[256*l+a]/65535*(1-u)+e[256*l+s]/65535*u)*c)*2048},i=new A.Vector3(-t.x,-t.y,-t.z).normalize(),a=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=n(o,s),u=n(o-.5,s),c=n(o+.5,s),d=n(o,s-.5),f=-((n(o,s+.5)-d)/1),h=-((c-u)/1),m=Math.sqrt(f*f+r*r+h*h),p=Math.max(0,f/m*i.x+r/m*i.y+h/m*i.z),A=1;p>0&&(A=function(e,t,r,n,i,a){let o=n.z/i,s=n.x/i,l=n.y,u=Math.sqrt(o*o+s*s);if(u<1e-4)return 1;let c=.5/u,d=o*c,f=s*c,h=l*c,m=e,p=t,A=r+.1;for(let e=0;e<768&&(m+=d,p+=f,A+=h,!(m<0)&&!(m>=256)&&!(p<0)&&!(p>=256)&&!(A>2048));e++)if(AArray(q).fill(null),M[34]=q,M[35]=v):v=M[35];let[W,Y]=(0,h.useState)(v);M[36]===Symbol.for("react.memo_cache_sentinel")?(y={xStart:0,xEnd:0,zStart:0,zEnd:0},M[36]=y):y=M[36];let z=(0,h.useRef)(y);return(M[37]!==O.x||M[38]!==O.z||M[39]!==D||M[40]!==G.position.x||M[41]!==G.position.z||M[42]!==q||M[43]!==I?(C=()=>{let e=G.position.x-O.x,t=G.position.z-O.z,r=Math.floor((e-I)/D),n=Math.ceil((e+I)/D),i=Math.floor((t-I)/D),a=Math.ceil((t+I)/D),o=z.current;if(r===o.xStart&&n===o.xEnd&&i===o.zStart&&a===o.zEnd)return;o.xStart=r,o.xEnd=n,o.zStart=i,o.zEnd=a;let s=[];for(let e=r;e{let t=W[e];return(0,d.jsx)(eG,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:D,basePosition:O,textureNames:P.textureNames,geometry:k,displacementMap:N,visibilityMask:K,alphaTextures:Q,detailTextureName:w,lightmap:U,visible:null!==t},e)}),M[55]=O,M[56]=D,M[57]=w,M[58]=X,M[59]=Q,M[60]=N,M[61]=k,M[62]=P.textureNames,M[63]=U,M[64]=W,M[65]=b):b=M[65],M[66]!==B||M[67]!==b?(x=(0,d.jsxs)(d.Fragment,{children:[B,b]}),M[66]=B,M[67]=b,M[68]=x):x=M[68],x):null});function ek(e){return e.camera}function eH(e){return parseInt(e,10)}function ej(e){return parseFloat(e)}function eU(e){return(0,ex.setupMask)(e)}function eN(e,t){return t}let eJ=(0,h.createContext)(null);function eK(){return(0,h.useContext)(eJ)}function eQ(e,t){return(0,d.jsx)(rU,{object:e},e._id)}var eV=h;let eq=(0,eV.createContext)(null),eX={didCatch:!1,error:null};class eW extends eV.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=eX}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(eX))}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(eX))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,eV.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,eV.createElement)(eq.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}var eY=e.i(31067),ez=A;function eZ(e,t){if(t===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==A.TriangleFanDrawMode&&t!==A.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;e=2.0 are supported."));return}let s=new tO(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===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(a),s.setPlugins(o),s.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}}function e3(){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 e5={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 e8{constructor(e){this.parser=e,this.name=e5.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,a)}}class tc{constructor(e){this.parser=e,this.name=e5.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 a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.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 td{constructor(e){this.parser=e,this.name=e5.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 a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.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 tf{constructor(e){this.name=e5.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,a=e.count,o=e.byteStride,s=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}}}class th{constructor(e){this.name=e5.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!==tb.TRIANGLES&&e.mode!==tb.TRIANGLE_STRIP&&e.mode!==tb.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[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 ez.Matrix4,r=new ez.Vector3,o=new ez.Quaternion,s=new ez.Vector3(1,1,1),l=new ez.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"},tT={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tR={CUBICSPLINE:void 0,LINEAR:ez.InterpolateLinear,STEP:ez.InterpolateDiscrete};function tw(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 tD(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 tI(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new ez.TextureLoader(this.options.manager):this.textureLoader=new ez.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ez.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};return tw(i,a,n),tD(a,n),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,n=t.length;r{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,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&&a.setY(t,d[e*s+1]),s>=3&&a.setZ(t,d[e*s+2]),s>=4&&a.setW(t,d[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=tS[r.magFilter]||ez.LinearFilter,t.minFilter=tS[r.minFilter]||ez.LinearMipmapLinearFilter,t.wrapS=tE[r.wrapS]||ez.RepeatWrapping,t.wrapT=tE[r.wrapT]||ez.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],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new ez.Texture(e);t.needsUpdate=!0,r(t)}),t.load(ez.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),tD(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",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[e5.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[e5.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[e5.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?e1:e2),"colorSpace"in a?a.colorSpace=n:a.encoding=n===e1?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new ez.PointsMaterial,ez.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 ez.LineBasicMaterial,ez.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||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(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 ez.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},s=a.extensions||{},l=[];if(s[e5.KHR_MATERIALS_UNLIT]){let e=i[e5.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new ez.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],e2),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(o,"map",n.baseColorTexture,e1)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(o,"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,o)})))}!0===a.doubleSided&&(o.side=ez.DoubleSide);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==ez.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new ez.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==ez.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==ez.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new ez.Color().setRGB(e[0],e[1],e[2],e2)}return void 0!==a.emissiveTexture&&t!==ez.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,e1)),Promise.all(l).then(function(){let n=new t(o);return a.name&&(n.name=a.name),tD(n,a),r.associations.set(n,{materials:e}),a.extensions&&tw(i,n,a),n})}createUniqueName(e){let t=ez.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 a=0,o=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new ez.Group:1===t.length?t[0]:new ez.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof ez.Material||e instanceof ez.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 a,o=[],s=e.name?e.name:e.uuid,l=[];switch(tT[i.path]===tT.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),tT[i.path]){case tT.weights:a=ez.NumberKeyframeTrack;break;case tT.rotation:a=ez.QuaternionKeyframeTrack;break;case tT.position:case tT.scale:a=ez.VectorKeyframeTrack;break;default:a=1===r.itemSize?ez.NumberKeyframeTrack:ez.VectorKeyframeTrack}let u=void 0!==n.interpolation?tR[n.interpolation]:ez.InterpolateLinear,c=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(tk.has(e)){let t=tk.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++,a=e.byteLength,o=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),tk.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new tP.BufferGeometry;e.index&&t.setIndex(new tP.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=tj.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,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){var i,a,o;let s,l,u,c,d,f,h=n.attributeIDs,m=n.attributeTypes,p=t.GetEncodedGeometryType(r);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(p===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 A={index:null,attributes:[]};for(let r in h){let i,a,o=self[m[r]];if(n.useUniqueIDs)a=h[r],i=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[h[r]])))continue;i=t.GetAttribute(d,a)}A.attributes.push(function(e,t,r,n,i,a){let o=a.num_components(),s=r.num_points()*o,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,a,u,l,c);let d=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:n,array:d,itemSize:o}}(e,t,d,r,o,i))}return p===e.TRIANGULAR_MESH&&(i=e,a=t,o=d,s=3*o.num_faces(),l=4*s,u=i._malloc(l),a.GetTrianglesUInt32Array(o,l,u),c=new Uint32Array(i.HEAPF32.buffer,u,s).slice(),i._free(u),A.index={array:c,itemSize:1}),e.destroy(d),A}(t,r,o,a),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(o),t.destroy(r)}})}}}var tU=e.i(971);let tN=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 c={keys:s,deep:n,inject:o,castShadow:i,receiveShadow:a};if(Array.isArray(t=h.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return tN(t)}return t},[t,e])))return h.createElement("group",(0,eY.default)({},l,{ref:u}),t.map(e=>h.createElement(tJ,(0,eY.default)({key:e.uuid,object:e},c))),r);let{children:d,...f}=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:i,receiveShadow:a}){let o={};for(let r of t)o[r]=e[r];return r&&(o.geometry&&"materialsOnly"!==r&&(o.geometry=o.geometry.clone()),o.material&&"geometriesOnly"!==r&&(o.material=o.material.clone())),n&&(o="function"==typeof n?{...o,children:n(e)}:h.isValidElement(n)?{...o,children:n}:{...o,...n}),e instanceof A.Mesh&&(i&&(o.castShadow=!0),a&&(o.receiveShadow=!0)),o}(t,c),m=t.type[0].toLowerCase()+t.type.slice(1);return h.createElement(m,(0,eY.default)({},f,l,{ref:u}),t.children.map(e=>"Bone"===e.type?h.createElement("primitive",(0,eY.default)({key:e.uuid,object:e},c)):h.createElement(tJ,(0,eY.default)({key:e.uuid,object:e},c,{isChild:!0}))),r,d)}),tK=null,tQ="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function tV(e=!0,r=!0,n){return i=>{n&&n(i),e&&(tK||(tK=new tH),tK.setDecoderPath("string"==typeof e?e:tQ),i.setDRACOLoader(tK)),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 a=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 o(t,r,n,i,a,o){let s=e.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&o&&o(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:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[s[a]])},decodeIndexBuffer(t,r,n,i){o(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){o(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){o(e.exports[l[a]],t,r,n,i,e.exports[s[u]])}}})())}}let tq=(e,t,r,n)=>(0,tU.useLoader)(e9,e,tV(t,r,n));tq.preload=(e,t,r,n)=>tU.useLoader.preload(e9,e,tV(t,r,n)),tq.clear=e=>tU.useLoader.clear(e9,e),tq.setDecoderPath=e=>{tQ=e};var tX=e.i(89887);let tW=` -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 tY({materialName:e,material:t,lightMap:r}){let n=(0,eF.useDebug)(),i=n?.debugMode??!1,a=(0,ey.textureToUrl)(e),o=(0,eS.useTexture)(a,e=>(0,ex.setupTexture)(e)),s=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),l=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),u=(0,h.useCallback)(e=>{let t;(0,eT.injectCustomFog)(e,eR.globalFogUniforms),t=l??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new A.Vector3(0,.4,1):new A.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include -${tW} -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 `)},[l]),c=(0,h.useRef)(null),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=c.current??f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let m={DEBUG_MODE:+!!i},p=`${l}`;return s?(0,d.jsx)("meshBasicMaterial",{ref:c,map:o,toneMapped:!1,defines:m,onBeforeCompile:u},p):(0,d.jsx)("meshLambertMaterial",{ref:f,map:o,lightMap:r,toneMapped:!1,defines:m,onBeforeCompile:u},p)}function tz(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=A.SRGBColorSpace),t??null}function tZ(e){let t,r,n,i=(0,f.c)(13),{node:a}=e;e:{let e,r;if(!a.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],t=e;break e}if(Array.isArray(a.material)){let e;i[1]!==a.material?(e=a.material.map(t$),i[1]=a.material,i[2]=e):e=i[2],t=e;break e}i[3]!==a.material?(e=tz(a.material),i[3]=a.material,i[4]=e):e=i[4],i[5]!==e?(r=[e],i[5]=e,i[6]=r):r=i[6],t=r}let o=t;return i[7]!==o||i[8]!==a.material?(r=a.material?(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(a.material)?a.material.map((e,t)=>(0,d.jsx)(tY,{materialName:e.userData.resource_path,material:e,lightMap:o[t]},t)):(0,d.jsx)(tY,{materialName:a.material.userData.resource_path,material:a.material,lightMap:o[0]})}):null,i[7]=o,i[8]=a.material,i[9]=r):r=i[9],i[10]!==a.geometry||i[11]!==r?(n=(0,d.jsx)("mesh",{geometry:a.geometry,castShadow:!0,receiveShadow:!0,children:r}),i[10]=a.geometry,i[11]=r,i[12]=n):n=i[12],n}function t$(e){return tz(e)}let t0=(0,h.memo)(function(e){let t,r,n,i,a,o,s=(0,f.c)(10),{object:l,interiorFile:u}=e,{nodes:c}=((o=(0,f.c)(2))[0]!==u?(a=(0,ey.interiorToUrl)(u),o[0]=u,o[1]=a):a=o[1],tq(a)),h=(0,eF.useDebug)(),m=h?.debugMode??!1;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],s[0]=t):t=s[0],s[1]!==c?(r=Object.entries(c).filter(t3).map(t5),s[1]=c,s[2]=r):r=s[2],s[3]!==m||s[4]!==u||s[5]!==l?(n=m?(0,d.jsxs)(tX.FloatingLabel,{children:[l._id,": ",u]}):null,s[3]=m,s[4]=u,s[5]=l,s[6]=n):n=s[6],s[7]!==r||s[8]!==n?(i=(0,d.jsxs)("group",{rotation:t,children:[r,n]}),s[7]=r,s[8]=n,s[9]=i):i=s[9],i});function t1(e){let t,r,n,i,a=(0,f.c)(9),{color:o,label:s}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("boxGeometry",{args:[10,10,10]}),a[0]=t):t=a[0],a[1]!==o?(r=(0,d.jsx)("meshStandardMaterial",{color:o,wireframe:!0}),a[1]=o,a[2]=r):r=a[2],a[3]!==o||a[4]!==s?(n=s?(0,d.jsx)(tX.FloatingLabel,{color:o,children:s}):null,a[3]=o,a[4]=s,a[5]=n):n=a[5],a[6]!==r||a[7]!==n?(i=(0,d.jsxs)("mesh",{children:[t,r,n]}),a[6]=r,a[7]=n,a[8]=i):i=a[8],i}function t2(e){let t,r=(0,f.c)(3),{label:n}=e,i=(0,eF.useDebug)(),a=i?.debugMode??!1;return r[0]!==a||r[1]!==n?(t=a?(0,d.jsx)(t1,{color:"red",label:n}):null,r[0]=a,r[1]=n,r[2]=t):t=r[2],t}let t9=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u,c=(0,f.c)(22),{object:m}=e;c[0]!==m?(t=(0,eb.getProperty)(m,"interiorFile"),c[0]=m,c[1]=t):t=c[1];let p=t;c[2]!==m?(r=(0,eb.getPosition)(m),c[2]=m,c[3]=r):r=c[3];let A=r;c[4]!==m?(n=(0,eb.getScale)(m),c[4]=m,c[5]=n):n=c[5];let g=n;c[6]!==m?(i=(0,eb.getRotation)(m),c[6]=m,c[7]=i):i=c[7];let v=i,y=`${m._id}: ${p}`;return c[8]!==y?(a=(0,d.jsx)(t2,{label:y}),c[8]=y,c[9]=a):a=c[9],c[10]===Symbol.for("react.memo_cache_sentinel")?(o=(0,d.jsx)(t1,{color:"orange"}),c[10]=o):o=c[10],c[11]!==p||c[12]!==m?(s=(0,d.jsx)(h.Suspense,{fallback:o,children:(0,d.jsx)(t0,{object:m,interiorFile:p})}),c[11]=p,c[12]=m,c[13]=s):s=c[13],c[14]!==a||c[15]!==s?(l=(0,d.jsx)(eW,{fallback:a,children:s}),c[14]=a,c[15]=s,c[16]=l):l=c[16],c[17]!==A||c[18]!==v||c[19]!==g||c[20]!==l?(u=(0,d.jsx)("group",{position:A,quaternion:v,scale:g,children:l}),c[17]=A,c[18]=v,c[19]=g,c[20]=l,c[21]=u):u=c[21],u});function t3(e){let[,t]=e;return t.isMesh}function t5(e){let[t,r]=e;return(0,d.jsx)(tZ,{node:r},t)}function t8(e,{path:t}){let[r]=(0,tU.useLoader)(A.CubeTextureLoader,[e],e=>e.setPath(t));return r}t8.preload=(e,{path:t})=>tU.useLoader.preload(A.CubeTextureLoader,[e],e=>e.setPath(t));let t6=()=>{};function t4(e){return e.wrapS=A.RepeatWrapping,e.wrapT=A.RepeatWrapping,e.minFilter=A.LinearFilter,e.magFilter=A.LinearFilter,e.colorSpace=A.NoColorSpace,e.needsUpdate=!0,e}let t7=` - 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; - } -`,re=` - 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 rt({textureUrl:e,radius:t,heightPercent:r,speed:n,windDirection:i,layerIndex:a}){let{debugMode:o}=(0,eF.useDebug)(),{animationEnabled:s}=(0,eF.useSettings)(),l=(0,h.useRef)(null),u=(0,eS.useTexture)(e,t4),c=(0,h.useMemo)(()=>{let e=r-.05;return function(e,t,r,n){var i;let a,o,s,l,u,c,d,f,h,m,p,g,v,y,C,B,b,x=new A.BufferGeometry,S=new Float32Array(75),E=new Float32Array(50),M=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],F=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*F,a=e-t*F,o=e*M[n];S[3*n]=i,S[3*n+1]=o,S[3*n+2]=a,E[2*n]=r,E[2*n+1]=t}i=S,a=e=>({x:i[3*e],y:i[3*e+1],z:i[3*e+2]}),o=(e,t,r,n)=>{i[3*e]=t,i[3*e+1]=r,i[3*e+2]=n},s=a(1),l=a(3),u=a(5),c=a(6),d=a(8),f=a(9),h=a(15),m=a(16),p=a(18),g=a(19),v=a(21),y=a(23),C=u.x+(s.x-u.x)*.5,B=u.y+(s.y-u.y)*.5,b=u.z+(s.z-u.z)*.5,o(0,c.x+(C-c.x)*2,c.y+(B-c.y)*2,c.z+(b-c.z)*2),C=f.x+(l.x-f.x)*.5,B=f.y+(l.y-f.y)*.5,b=f.z+(l.z-f.z)*.5,o(4,d.x+(C-d.x)*2,d.y+(B-d.y)*2,d.z+(b-d.z)*2),C=v.x+(h.x-v.x)*.5,B=v.y+(h.y-v.y)*.5,b=v.z+(h.z-v.z)*.5,o(20,m.x+(C-m.x)*2,m.y+(B-m.y)*2,m.z+(b-m.z)*2),C=y.x+(g.x-y.x)*.5,B=y.y+(g.y-y.y)*.5,b=y.z+(g.z-y.z)*.5,o(24,p.x+(C-p.x)*2,p.y+(B-p.y)*2,p.z+(b-p.z)*2);let T=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(S,e),R=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;R.push(r,i,a),R.push(r,a,n)}return x.setIndex(R),x.setAttribute("position",new A.Float32BufferAttribute(S,3)),x.setAttribute("uv",new A.Float32BufferAttribute(E,2)),x.setAttribute("alpha",new A.Float32BufferAttribute(T,1)),x.computeBoundingSphere(),x}(t,r,e,0)},[t,r]);(0,h.useEffect)(()=>()=>{c.dispose()},[c]);let f=(0,h.useMemo)(()=>new A.ShaderMaterial({uniforms:{cloudTexture:{value:u},uvOffset:{value:new A.Vector2(0,0)},debugMode:{value:+!!o},layerIndex:{value:a}},vertexShader:t7,fragmentShader:re,transparent:!0,depthWrite:!1,side:A.DoubleSide}),[u,o,a]);return(0,h.useEffect)(()=>()=>{f.dispose()},[f]),(0,eC.useFrame)(s?(e,t)=>{let r=1e3*t/32;l.current??=new A.Vector2(0,0),l.current.x+=i.x*n*r,l.current.y+=i.y*n*r,l.current.x-=Math.floor(l.current.x),l.current.y-=Math.floor(l.current.y),f.uniforms.uvOffset.value.copy(l.current)}:t6),(0,d.jsx)("mesh",{geometry:c,frustumCulled:!1,renderOrder:10,children:(0,d.jsx)("primitive",{object:f,attach:"material"})})}function rr(e){var t;let r,n,i,a,o,s,l,u,c,m,p,g,v,y,C,B,b,x,S,E=(0,f.c)(37),{object:M}=e;E[0]!==M?(r=(0,eb.getProperty)(M,"materialList"),E[0]=M,E[1]=r):r=E[1];let{data:F}=(t=r,(x=(0,f.c)(7))[0]!==t?(C=["detailMapList",t],B=()=>(0,ey.loadDetailMapList)(t),x[0]=t,x[1]=C,x[2]=B):(C=x[1],B=x[2]),S=!!t,x[3]!==C||x[4]!==B||x[5]!==S?(b={queryKey:C,queryFn:B,enabled:S},x[3]=C,x[4]=B,x[5]=S,x[6]=b):b=x[6],eg(b,eo,void 0));E[2]!==M?(n=(0,eb.getFloat)(M,"visibleDistance")??500,E[2]=M,E[3]=n):n=E[3];let T=.95*n;E[4]!==M?(i=(0,eb.getFloat)(M,"cloudSpeed1")??1e-4,E[4]=M,E[5]=i):i=E[5],E[6]!==M?(a=(0,eb.getFloat)(M,"cloudSpeed2")??2e-4,E[6]=M,E[7]=a):a=E[7],E[8]!==M?(o=(0,eb.getFloat)(M,"cloudSpeed3")??3e-4,E[8]=M,E[9]=o):o=E[9],E[10]!==i||E[11]!==a||E[12]!==o?(s=[i,a,o],E[10]=i,E[11]=a,E[12]=o,E[13]=s):s=E[13];let R=s;E[14]!==M?(l=(0,eb.getFloat)(M,"cloudHeightPer1")??.35,E[14]=M,E[15]=l):l=E[15],E[16]!==M?(u=(0,eb.getFloat)(M,"cloudHeightPer2")??.25,E[16]=M,E[17]=u):u=E[17],E[18]!==M?(c=(0,eb.getFloat)(M,"cloudHeightPer3")??.2,E[18]=M,E[19]=c):c=E[19],E[20]!==l||E[21]!==u||E[22]!==c?(m=[l,u,c],E[20]=l,E[21]=u,E[22]=c,E[23]=m):m=E[23];let w=m;if(E[24]!==M){e:{let e,t=(0,eb.getProperty)(M,"windVelocity");if(t){let[e,r]=t.split(" ").map(rn);if(0!==e||0!==r){p=new A.Vector2(r,-e).normalize();break e}}E[26]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector2(1,0),E[26]=e):e=E[26],p=e}E[24]=M,E[25]=p}else p=E[25];let D=p;t:{let e;if(!F){let e;E[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],E[27]=e):e=E[27],g=e;break t}if(E[28]!==w||E[29]!==R||E[30]!==F){e=[];for(let t=0;t<3;t++){let r=F[7+t];r&&e.push({texture:r,height:w[t],speed:R[t]})}E[28]=w,E[29]=R,E[30]=F,E[31]=e}else e=E[31];g=e}let I=g,G=(0,h.useRef)(null);return(E[32]===Symbol.for("react.memo_cache_sentinel")?(v=e=>{let{camera:t}=e;G.current&&G.current.position.copy(t.position)},E[32]=v):v=E[32],(0,eC.useFrame)(v),I&&0!==I.length)?(E[33]!==I||E[34]!==T||E[35]!==D?(y=(0,d.jsx)("group",{ref:G,children:I.map((e,t)=>{let r=(0,ey.textureToUrl)(e.texture);return(0,d.jsx)(h.Suspense,{fallback:null,children:(0,d.jsx)(rt,{textureUrl:r,radius:T,heightPercent:e.height,speed:e.speed,windDirection:D,layerIndex:t})},t)})}),E[33]=I,E[34]=T,E[35]=D,E[36]=y):y=E[36],y):null}function rn(e){return parseFloat(e)}let ri=!1;function ra(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new A.Color().setRGB(t,r,n),new A.Color().setRGB(t,r,n).convertSRGBToLinear()]}function ro({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:n}=(0,eB.useThree)(),i=t8(e,{path:""}),a=!!t,o=(0,h.useMemo)(()=>n.projectionMatrixInverse,[n]),s=(0,h.useMemo)(()=>r?(0,eR.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),l=(0,h.useRef)({skybox:{value:i},fogColor:{value:t??new A.Color(0,0,0)},enableFog:{value:a},inverseProjectionMatrix:{value:o},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eR.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:.18}}),u=(0,h.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,h.useEffect)(()=>{l.current.skybox.value=i,l.current.fogColor.value=t??new A.Color(0,0,0),l.current.enableFog.value=a,l.current.fogVolumeData.value=s,l.current.horizonFogHeight.value=u},[i,t,a,s,u]),(0,d.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,d.jsxs)("bufferGeometry",{children:[(0,d.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,d.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,d.jsx)("shaderMaterial",{uniforms:l.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 rs(e){let t,r,n,i,a=(0,f.c)(6),{materialList:o,fogColor:s,fogState:l}=e,{data:u}=((i=(0,f.c)(2))[0]!==o?(n={queryKey:["detailMapList",o],queryFn:()=>(0,ey.loadDetailMapList)(o)},i[0]=o,i[1]=n):n=i[1],eg(n,eo,void 0));a[0]!==u?(t=u?[(0,ey.textureToUrl)(u[1]),(0,ey.textureToUrl)(u[3]),(0,ey.textureToUrl)(u[4]),(0,ey.textureToUrl)(u[5]),(0,ey.textureToUrl)(u[0]),(0,ey.textureToUrl)(u[2])]:null,a[0]=u,a[1]=t):t=a[1];let c=t;return c?(a[2]!==s||a[3]!==l||a[4]!==c?(r=(0,d.jsx)(ro,{skyBoxFiles:c,fogColor:s,fogState:l}),a[2]=s,a[3]=l,a[4]=c,a[5]=r):r=a[5],r):null}function rl({skyColor:e,fogColor:t,fogState:r}){let{camera:n}=(0,eB.useThree)(),i=!!t,a=(0,h.useMemo)(()=>n.projectionMatrixInverse,[n]),o=(0,h.useMemo)(()=>r?(0,eR.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),s=(0,h.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),l=(0,h.useRef)({skyColor:{value:e},fogColor:{value:t??new A.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:a},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eR.globalFogUniforms.cameraHeight,fogVolumeData:{value:o},horizonFogHeight:{value:s}});return(0,h.useEffect)(()=>{l.current.skyColor.value=e,l.current.fogColor.value=t??new A.Color(0,0,0),l.current.enableFog.value=i,l.current.fogVolumeData.value=o,l.current.horizonFogHeight.value=s},[e,t,i,o,s]),(0,d.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,d.jsxs)("bufferGeometry",{children:[(0,d.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,d.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,d.jsx)("shaderMaterial",{uniforms:l.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 ru(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function rc({fogState:e,enabled:t}){let{scene:r,camera:n}=(0,eB.useThree)(),i=(0,h.useRef)(null),a=(0,h.useMemo)(()=>(0,eR.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,h.useEffect)(()=>{ri||((0,eT.installCustomFogShader)(),ri=!0)},[]),(0,h.useEffect)(()=>{(0,eR.resetGlobalFogUniforms)();let[t,o]=ru(e,n.position.y),s=new A.Fog(e.fogColor,t,o);return r.fog=s,i.current=s,(0,eR.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,eR.resetGlobalFogUniforms)()}},[r,n,e,a]),(0,h.useEffect)(()=>{let r=i.current;if(r)if(t){let[t,i]=ru(e,n.position.y);r.near=t,r.far=i}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,eC.useFrame)(()=>{let r=i.current;if(!r)return;let o=n.position.y;if((0,eR.updateGlobalFogUniforms)(o,a,t),t){let[t,n]=ru(e,o);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}function rd(e){return parseFloat(e)}function rf(e){return parseFloat(e)}function rh(e){return parseFloat(e)}let rm=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function rp(e){return rm.test(e)}let rA=(0,h.createContext)(null);function rg(){let e=(0,h.useContext)(rA);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function rv(e){let t,r,n,i=(0,f.c)(10),{children:a,object:o,shapeName:s,type:l}=e;i[0]!==s?(t=rp(s),i[0]=s,i[1]=t):t=i[1];let u=t;i[2]!==u||i[3]!==o||i[4]!==s||i[5]!==l?(r={object:o,shapeName:s,type:l,isOrganic:u},i[2]=u,i[3]=o,i[4]=s,i[5]=l,i[6]=r):r=i[6];let c=r;return i[7]!==a||i[8]!==c?(n=(0,d.jsx)(rA.Provider,{value:c,children:a}),i[7]=a,i[8]=c,i[9]=n):n=i[9],n}var ry=e.i(51475);let rC=new Map;function rB(e){e.onBeforeCompile=t=>{(0,eT.injectCustomFog)(t,eR.globalFogUniforms),e instanceof A.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 rb(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive");if(r.has("SelfIlluminating")){let e=new A.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,fog:!0,...a&&{blending:A.AdditiveBlending}});return rB(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new A.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new A.MeshLambertMaterial({...e,side:0});return rB(r),rB(n),[r,n]}let o=new A.MeshLambertMaterial({map:t,side:2,reflectivity:0});return rB(o),o}let rx=(0,h.memo)(function(e){let t,r,n,i,a,o,s=(0,f.c)(35),{material:l,shapeName:u,geometry:c,backGeometry:h,castShadow:m,receiveShadow:p}=e,g=void 0!==m&&m,v=void 0!==p&&p,y=l.userData.resource_path;s[0]!==l.userData.flag_names?(t=l.userData.flag_names??[],s[0]=l.userData.flag_names,s[1]=t):t=s[1],s[2]!==t?(r=new Set(t),s[2]=t,s[3]=r):r=s[3];let C=r,B=function(e){var t;let r,n,i,a,o=(0,f.c)(14),{animationEnabled:s}=(0,eF.useSettings)();o[0]!==e?(r={queryKey:["ifl",e],queryFn:()=>(0,ey.loadImageFrameList)(e)},o[0]=e,o[1]=r):r=o[1];let{data:l}=eg({...r,enabled:!0,suspense:!0,throwOnError:ep,placeholderData:void 0},eo,void 0);if(o[2]!==l||o[3]!==e){let t;o[5]!==e?(t=t=>(0,ey.iflTextureToUrl)(t.name,e),o[5]=e,o[6]=t):t=o[6],n=l.map(t),o[2]=l,o[3]=e,o[4]=n}else n=o[4];let u=n,c=(0,eS.useTexture)(u);if(o[7]!==l||o[8]!==e||o[9]!==c){let r;if(!(i=rC.get(e))){let t,r,n,a,o,s,l,u,d;r=(t=c[0].image).width,n=t.height,o=Math.ceil(Math.sqrt(a=c.length)),s=Math.ceil(a/o),(l=document.createElement("canvas")).width=r*o,l.height=n*s,u=l.getContext("2d"),c.forEach((e,t)=>{let i=Math.floor(t/o);u.drawImage(e.image,t%o*r,i*n)}),(d=new A.CanvasTexture(l)).colorSpace=A.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=A.NearestFilter,d.magFilter=A.NearestFilter,d.wrapS=A.ClampToEdgeWrapping,d.wrapT=A.ClampToEdgeWrapping,d.repeat.set(1/o,1/s),i={texture:d,columns:o,rows:s,frameCount:a,frameStartTicks:[],totalTicks:0,lastFrame:-1},rC.set(e,i)}r=0,(t=i).frameStartTicks=l.map(e=>{let t=r;return r+=e.frameCount,t}),t.totalTicks=r,o[7]=l,o[8]=e,o[9]=c,o[10]=i}else i=o[10];let d=i;return o[11]!==s||o[12]!==d?(a=e=>{let t=s?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(d,e):0;!function(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)}(d,t)},o[11]=s,o[12]=d,o[13]=a):a=o[13],(0,ry.useTick)(a),d.texture}(`textures/${y}.ifl`);s[4]!==u?(n=u&&rp(u),s[4]=u,s[5]=n):n=s[5];let b=n;s[6]!==C||s[7]!==b||s[8]!==l||s[9]!==B?(i=rb(l,B,C,b),s[6]=C,s[7]=b,s[8]=l,s[9]=B,s[10]=i):i=s[10];let x=i;if(Array.isArray(x)){let e,t,r,n,i,a=h||c;return s[11]!==x[0]?(e=(0,d.jsx)("primitive",{object:x[0],attach:"material"}),s[11]=x[0],s[12]=e):e=s[12],s[13]!==g||s[14]!==v||s[15]!==a||s[16]!==e?(t=(0,d.jsx)("mesh",{geometry:a,castShadow:g,receiveShadow:v,children:e}),s[13]=g,s[14]=v,s[15]=a,s[16]=e,s[17]=t):t=s[17],s[18]!==x[1]?(r=(0,d.jsx)("primitive",{object:x[1],attach:"material"}),s[18]=x[1],s[19]=r):r=s[19],s[20]!==g||s[21]!==c||s[22]!==v||s[23]!==r?(n=(0,d.jsx)("mesh",{geometry:c,castShadow:g,receiveShadow:v,children:r}),s[20]=g,s[21]=c,s[22]=v,s[23]=r,s[24]=n):n=s[24],s[25]!==n||s[26]!==t?(i=(0,d.jsxs)(d.Fragment,{children:[t,n]}),s[25]=n,s[26]=t,s[27]=i):i=s[27],i}return s[28]!==x?(a=(0,d.jsx)("primitive",{object:x,attach:"material"}),s[28]=x,s[29]=a):a=s[29],s[30]!==g||s[31]!==c||s[32]!==v||s[33]!==a?(o=(0,d.jsx)("mesh",{geometry:c,castShadow:g,receiveShadow:v,children:a}),s[30]=g,s[31]=c,s[32]=v,s[33]=a,s[34]=o):o=s[34],o}),rS=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(40),{material:c,shapeName:h,geometry:m,backGeometry:p,castShadow:A,receiveShadow:g}=e,v=void 0!==A&&A,y=void 0!==g&&g,C=c.userData.resource_path;u[0]!==c.userData.flag_names?(t=c.userData.flag_names??[],u[0]=c.userData.flag_names,u[1]=t):t=u[1],u[2]!==t?(r=new Set(t),u[2]=t,u[3]=r):r=u[3];let B=r;C||console.warn(`No resource_path was found on "${h}" - rendering fallback.`),u[4]!==C?(n=C?(0,ey.textureToUrl)(C):ey.FALLBACK_TEXTURE_URL,u[4]=C,u[5]=n):n=u[5];let b=n;u[6]!==h?(i=h&&rp(h),u[6]=h,u[7]=i):i=u[7];let x=i,S=B.has("Translucent");u[8]!==x||u[9]!==S?(a=e=>x||S?(0,ex.setupTexture)(e,{disableMipmaps:!0}):(0,ex.setupTexture)(e),u[8]=x,u[9]=S,u[10]=a):a=u[10];let E=(0,eS.useTexture)(b,a);u[11]!==B||u[12]!==x||u[13]!==c||u[14]!==E?(o=rb(c,E,B,x),u[11]=B,u[12]=x,u[13]=c,u[14]=E,u[15]=o):o=u[15];let M=o;if(Array.isArray(M)){let e,t,r,n,i,a=p||m;return u[16]!==M[0]?(e=(0,d.jsx)("primitive",{object:M[0],attach:"material"}),u[16]=M[0],u[17]=e):e=u[17],u[18]!==v||u[19]!==y||u[20]!==e||u[21]!==a?(t=(0,d.jsx)("mesh",{geometry:a,castShadow:v,receiveShadow:y,children:e}),u[18]=v,u[19]=y,u[20]=e,u[21]=a,u[22]=t):t=u[22],u[23]!==M[1]?(r=(0,d.jsx)("primitive",{object:M[1],attach:"material"}),u[23]=M[1],u[24]=r):r=u[24],u[25]!==v||u[26]!==m||u[27]!==y||u[28]!==r?(n=(0,d.jsx)("mesh",{geometry:m,castShadow:v,receiveShadow:y,children:r}),u[25]=v,u[26]=m,u[27]=y,u[28]=r,u[29]=n):n=u[29],u[30]!==t||u[31]!==n?(i=(0,d.jsxs)(d.Fragment,{children:[t,n]}),u[30]=t,u[31]=n,u[32]=i):i=u[32],i}return u[33]!==M?(s=(0,d.jsx)("primitive",{object:M,attach:"material"}),u[33]=M,u[34]=s):s=u[34],u[35]!==v||u[36]!==m||u[37]!==y||u[38]!==s?(l=(0,d.jsx)("mesh",{geometry:m,castShadow:v,receiveShadow:y,children:s}),u[35]=v,u[36]=m,u[37]=y,u[38]=s,u[39]=l):l=u[39],l}),rE=(0,h.memo)(function(e){let t=(0,f.c)(14),{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o,receiveShadow:s}=e,l=void 0!==o&&o,u=void 0!==s&&s,c=new Set(r.userData.flag_names??[]).has("IflMaterial"),h=r.userData.resource_path;if(c&&h){let e;return t[0]!==a||t[1]!==l||t[2]!==i||t[3]!==r||t[4]!==u||t[5]!==n?(e=(0,d.jsx)(rx,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:l,receiveShadow:u}),t[0]=a,t[1]=l,t[2]=i,t[3]=r,t[4]=u,t[5]=n,t[6]=e):e=t[6],e}if(!r.name)return null;{let e;return t[7]!==a||t[8]!==l||t[9]!==i||t[10]!==r||t[11]!==u||t[12]!==n?(e=(0,d.jsx)(rS,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:l,receiveShadow:u}),t[7]=a,t[8]=l,t[9]=i,t[10]=r,t[11]=u,t[12]=n,t[13]=e):e=t[13],e}});function rM(e){let t,r,n,i,a=(0,f.c)(9),{color:o,label:s}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("boxGeometry",{args:[10,10,10]}),a[0]=t):t=a[0],a[1]!==o?(r=(0,d.jsx)("meshStandardMaterial",{color:o,wireframe:!0}),a[1]=o,a[2]=r):r=a[2],a[3]!==o||a[4]!==s?(n=s?(0,d.jsx)(tX.FloatingLabel,{color:o,children:s}):null,a[3]=o,a[4]=s,a[5]=n):n=a[5],a[6]!==r||a[7]!==n?(i=(0,d.jsxs)("mesh",{children:[t,r,n]}),a[6]=r,a[7]=n,a[8]=i):i=a[8],i}function rF(e){let t,r=(0,f.c)(4),{color:n,label:i}=e,{debugMode:a}=(0,eF.useDebug)();return r[0]!==n||r[1]!==a||r[2]!==i?(t=a?(0,d.jsx)(rM,{color:n,label:i}):null,r[0]=n,r[1]=a,r[2]=i,r[3]=t):t=r[3],t}function rT(e){let t,r,n,i,a,o=(0,f.c)(13),{loadingColor:s,children:l}=e,u=void 0===s?"yellow":s,{object:c,shapeName:m}=rg();if(!m){let e,t=`${c._id}: `;return o[0]!==t?(e=(0,d.jsx)(rF,{color:"orange",label:t}),o[0]=t,o[1]=e):e=o[1],e}let p=`${c._id}: ${m}`;return o[2]!==p?(t=(0,d.jsx)(rF,{color:"red",label:p}),o[2]=p,o[3]=t):t=o[3],o[4]!==u?(r=(0,d.jsx)(rM,{color:u}),o[4]=u,o[5]=r):r=o[5],o[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,d.jsx)(rR,{}),o[6]=n):n=o[6],o[7]!==l||o[8]!==r?(i=(0,d.jsxs)(h.Suspense,{fallback:r,children:[n,l]}),o[7]=l,o[8]=r,o[9]=i):i=o[9],o[10]!==t||o[11]!==i?(a=(0,d.jsx)(eW,{fallback:t,children:i}),o[10]=t,o[11]=i,o[12]=a):a=o[12],a}let rR=(0,h.memo)(function(){var e;let t,r,n,i,a,o,s,l,u=(0,f.c)(19),{object:c,shapeName:m,isOrganic:p}=rg(),{debugMode:A}=(0,eF.useDebug)(),{nodes:g}=((l=(0,f.c)(2))[0]!==m?(s=(0,ey.shapeToUrl)(m),l[0]=m,l[1]=s):s=l[1],tq(s));if(u[0]!==g){e:{let r,n=Object.values(g).filter(rw);if(n.length>0){let r;e=n[0].skeleton,r=new Set,e.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),t=r;break e}u[2]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,u[2]=r):r=u[2],t=r}u[0]=g,u[1]=t}else t=u[1];let v=t;u[3]!==v||u[4]!==p||u[5]!==g?(r=Object.entries(g).filter(rD).map(e=>{let[,t]=e,r=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(o)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let i of e)t+=a[3*i],r+=a[3*i+1],n+=a[3*i+2];let i=Math.sqrt(t*t+r*r+n*n);for(let o of(i>0&&(t/=i,r/=i,n/=i),e))a[3*o]=t,a[3*o+1]=r,a[3*o+2]=n}if(t.needsUpdate=!0,p){let e=(n=r.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:t,geometry:r,backGeometry:n}=e;return(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)("mesh",{geometry:r,children:(0,d.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:t.material?Array.isArray(t.material)?t.material.map((e,t)=>(0,d.jsx)(rE,{material:e,shapeName:m,geometry:r,backGeometry:n,castShadow:C,receiveShadow:C},t)):(0,d.jsx)(rE,{material:t.material,shapeName:m,geometry:r,backGeometry:n,castShadow:C,receiveShadow:C}):null},t.id)}),u[8]=C,u[9]=y,u[10]=m,u[11]=i):i=u[11],u[12]!==A||u[13]!==c||u[14]!==m?(a=A?(0,d.jsxs)(tX.FloatingLabel,{children:[c._id,": ",m]}):null,u[12]=A,u[13]=c,u[14]=m,u[15]=a):a=u[15],u[16]!==i||u[17]!==a?(o=(0,d.jsxs)("group",{rotation:n,children:[i,a]}),u[16]=i,u[17]=a,u[18]=o):o=u[18],o});function rw(e){return e.skeleton}function rD(e){let[,t]=e;return t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)}var rI=e.i(6112);let rG={1:"Storm",2:"Inferno"},rL=(0,h.createContext)(null);function rO(){let e=(0,h.useContext)(rL);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function r_({children:e}){let{camera:t}=(0,eB.useThree)(),[r,n]=(0,h.useState)(-1),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(()=>({initialized:!1,position:null,quarternion:null})),l=(0,h.useCallback)(e=>{a(t=>({...t,[e.id]:e}))},[]),u=(0,h.useCallback)(e=>{a(t=>{let{[e.id]:r,...n}=t;return n})},[]),c=Object.keys(i).length,f=(0,h.useCallback)(e=>{if(e>=0&&e{f(c?(r+1)%c:-1)},[c,r,f]);(0,h.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),i=r.split(",").map(e=>parseFloat(e));s({initialized:!0,position:new A.Vector3(...n),quarternion:new A.Quaternion(...i)})}else s({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,h.useEffect)(()=>{o.initialized&&o.position&&(t.position.copy(o.position),o.quarternion&&t.quaternion.copy(o.quarternion))},[t,o]),(0,h.useEffect)(()=>{o.initialized&&!o.position&&c>0&&-1===r&&f(0)},[c,f,r,o]);let p=(0,h.useMemo)(()=>({registerCamera:l,unregisterCamera:u,nextCamera:m,setCameraIndex:f,cameraCount:c}),[l,u,m,f,c]);return 0===c&&-1!==r&&n(-1),(0,d.jsx)(rL.Provider,{value:p,children:e})}let rP=(0,h.createContext)(null),rk=rP.Provider,rH=(0,h.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),rj={AudioEmitter:function(e){let t,r=(0,f.c)(3),{audioEnabled:n}=(0,eF.useSettings)();return r[0]!==n||r[1]!==e?(t=n?(0,d.jsx)(rH,{...e}):null,r[0]=n,r[1]=e,r[2]=t):t=r[2],t},Camera:function(e){let t,r,n,i,a,o=(0,f.c)(14),{object:s}=e,{registerCamera:l,unregisterCamera:u}=rO(),c=(0,h.useId)();o[0]!==s?(t=(0,eb.getProperty)(s,"dataBlock"),o[0]=s,o[1]=t):t=o[1];let d=t;o[2]!==s?(r=(0,eb.getPosition)(s),o[2]=s,o[3]=r):r=o[3];let m=r;o[4]!==s?(n=(0,eb.getRotation)(s),o[4]=s,o[5]=n):n=o[5];let p=n;return o[6]!==d||o[7]!==c||o[8]!==m||o[9]!==p||o[10]!==l||o[11]!==u?(i=()=>{if("Observer"===d){let e={id:c,position:new A.Vector3(...m),rotation:p};return l(e),()=>{u(e)}}},a=[c,d,l,u,m,p],o[6]=d,o[7]=c,o[8]=m,o[9]=p,o[10]=l,o[11]=u,o[12]=i,o[13]=a):(i=o[12],a=o[13]),(0,h.useEffect)(i,a),null},ForceFieldBare:(0,h.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:t9,Item:function(e){let t,r,n,i,a,o,s,l,u,c=(0,f.c)(23),{object:h}=e,m=eK();c[0]!==h?(t=(0,eb.getProperty)(h,"dataBlock")??"",c[0]=h,c[1]=t):t=c[1];let p=t,A=(0,rI.useDatablock)(p);c[2]!==h?(r=(0,eb.getPosition)(h),c[2]=h,c[3]=r):r=c[3];let g=r;c[4]!==h?(n=(0,eb.getScale)(h),c[4]=h,c[5]=n):n=c[5];let v=n;c[6]!==h?(i=(0,eb.getRotation)(h),c[6]=h,c[7]=i):i=c[7];let y=i;c[8]!==A?(a=(0,eb.getProperty)(A,"shapeFile"),c[8]=A,c[9]=a):a=c[9];let C=a;C||console.error(` missing shape for datablock: ${p}`);let B=p?.toLowerCase()==="flag",b=m?.team??null,x=b&&b>0?rG[b]:null,S=B&&x?`${x} Flag`:null;return c[10]!==S?(o=S?(0,d.jsx)(tX.FloatingLabel,{opacity:.6,children:S}):null,c[10]=S,c[11]=o):o=c[11],c[12]!==o?(s=(0,d.jsx)(rT,{loadingColor:"pink",children:o}),c[12]=o,c[13]=s):s=c[13],c[14]!==g||c[15]!==y||c[16]!==v||c[17]!==s?(l=(0,d.jsx)("group",{position:g,quaternion:y,scale:v,children:s}),c[14]=g,c[15]=y,c[16]=v,c[17]=s,c[18]=l):l=c[18],c[19]!==h||c[20]!==C||c[21]!==l?(u=(0,d.jsx)(rv,{type:"Item",object:h,shapeName:C,children:l}),c[19]=h,c[20]=C,c[21]=l,c[22]=u):u=c[22],u},SimGroup:function(e){let t,r,n,i,a=(0,f.c)(17),{object:o}=e,s=eK(),l=null,u=!1;if(s&&s.hasTeams){if(u=!0,null!=s.team)l=s.team;else if(o._name){let e;if(a[0]!==o._name){let t;a[2]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,a[2]=t):t=a[2],e=o._name.match(t),a[0]=o._name,a[1]=e}else e=a[1];let t=e;t&&(l=parseInt(t[1],10))}}else if(o._name){let e;a[3]!==o._name?(e=o._name.toLowerCase(),a[3]=o._name,a[4]=e):e=a[4],u="teams"===e}a[5]!==u||a[6]!==o||a[7]!==s||a[8]!==l?(t={object:o,parent:s,hasTeams:u,team:l},a[5]=u,a[6]=o,a[7]=s,a[8]=l,a[9]=t):t=a[9];let c=t;return a[10]!==o._children?(r=o._children??[],a[10]=o._children,a[11]=r):r=a[11],a[12]!==r?(n=r.map(eQ),a[12]=r,a[13]=n):n=a[13],a[14]!==c||a[15]!==n?(i=(0,d.jsx)(eJ.Provider,{value:c,children:n}),a[14]=c,a[15]=n,a[16]=i):i=a[16],i},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,eF.useSettings)(),n=(0,eb.getProperty)(e,"materialList"),i=(0,h.useMemo)(()=>ra((0,eb.getProperty)(e,"SkySolidColor")),[e]),a=(0,eb.getInt)(e,"useSkyTextures")??1,o=(0,h.useMemo)(()=>(function(e,t=!0){let r=(0,eb.getFloat)(e,"fogDistance")??0,n=(0,eb.getFloat)(e,"visibleDistance")??1e3,i=(0,eb.getFloat)(e,"high_fogDistance"),a=(0,eb.getFloat)(e,"high_visibleDistance"),o=t&&null!=i&&i>0?i:r,s=t&&null!=a&&a>0?a:n,l=function(e){if(!e)return new A.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new A.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,eb.getProperty)(e,"fogColor")),u=[];for(let t=1;t<=3;t++){let r=function(e,t=1){if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[n,i,a]=r;return n<=0||a<=i?null:{visibleDistance:n,minHeight:i,maxHeight:a,percentage:Math.max(0,Math.min(1,t))}}((0,eb.getProperty)(e,`fogVolume${t}`),1);r&&u.push(r)}let c=u.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:o,visibleDistance:s,fogColor:l,fogVolumes:u,fogLine:c,enabled:s>o}})(e,r),[e,r]),s=(0,h.useMemo)(()=>ra((0,eb.getProperty)(e,"fogColor")),[e]),l=i||s,u=o.enabled&&t,c=o.fogColor,{scene:f,gl:m}=(0,eB.useThree)();(0,h.useEffect)(()=>{if(u){let e=c.clone();f.background=e,m.setClearColor(e)}else if(l){let e=l[0].clone();f.background=e,m.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,m,u,c,l]);let p=i?.[1];return(0,d.jsxs)(d.Fragment,{children:[n&&a?(0,d.jsx)(h.Suspense,{fallback:null,children:(0,d.jsx)(rs,{materialList:n,fogColor:u?c:void 0,fogState:u?o:void 0},n)}):p?(0,d.jsx)(rl,{skyColor:p,fogColor:u?c:void 0,fogState:u?o:void 0}):null,(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(rr,{object:e})}),o.enabled?(0,d.jsx)(rc,{fogState:o,enabled:t}):null]})},StaticShape:function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(19),{object:c}=e;u[0]!==c?(t=(0,eb.getProperty)(c,"dataBlock")??"",u[0]=c,u[1]=t):t=u[1];let h=t,m=(0,rI.useDatablock)(h);u[2]!==c?(r=(0,eb.getPosition)(c),u[2]=c,u[3]=r):r=u[3];let p=r;u[4]!==c?(n=(0,eb.getRotation)(c),u[4]=c,u[5]=n):n=u[5];let A=n;u[6]!==c?(i=(0,eb.getScale)(c),u[6]=c,u[7]=i):i=u[7];let g=i;u[8]!==m?(a=(0,eb.getProperty)(m,"shapeFile"),u[8]=m,u[9]=a):a=u[9];let v=a;return v||console.error(` missing shape for datablock: ${h}`),u[10]===Symbol.for("react.memo_cache_sentinel")?(o=(0,d.jsx)(rT,{}),u[10]=o):o=u[10],u[11]!==p||u[12]!==A||u[13]!==g?(s=(0,d.jsx)("group",{position:p,quaternion:A,scale:g,children:o}),u[11]=p,u[12]=A,u[13]=g,u[14]=s):s=u[14],u[15]!==c||u[16]!==v||u[17]!==s?(l=(0,d.jsx)(rv,{type:"StaticShape",object:c,shapeName:v,children:s}),u[15]=c,u[16]=v,u[17]=s,u[18]=l):l=u[18],l},Sun:function(e){let t,r,n,i,a,o,s,l,u,c,m=(0,f.c)(25),{object:p}=e;m[0]!==p?(t=((0,eb.getProperty)(p,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(rh),m[0]=p,m[1]=t):t=m[1];let[g,v,y]=t,C=Math.sqrt(g*g+y*y+v*v),B=g/C,b=y/C,x=v/C;m[2]!==B||m[3]!==b||m[4]!==x?(r=new A.Vector3(B,b,x),m[2]=B,m[3]=b,m[4]=x,m[5]=r):r=m[5];let S=r,E=-(5e3*S.x),M=-(5e3*S.y),F=-(5e3*S.z);m[6]!==E||m[7]!==M||m[8]!==F?(n=new A.Vector3(E,M,F),m[6]=E,m[7]=M,m[8]=F,m[9]=n):n=m[9];let T=n;if(m[10]!==p){let[e,t,r]=((0,eb.getProperty)(p,"color")??"0.7 0.7 0.7 1").split(" ").map(rf);i=new A.Color(e,t,r),m[10]=p,m[11]=i}else i=m[11];let R=i;if(m[12]!==p){let[e,t,r]=((0,eb.getProperty)(p,"ambient")??"0.5 0.5 0.5 1").split(" ").map(rd);a=new A.Color(e,t,r),m[12]=p,m[13]=a}else a=m[13];let w=a,D=S.y<0;return m[14]!==D?(o=()=>{eE.value=D},s=[D],m[14]=D,m[15]=o,m[16]=s):(o=m[15],s=m[16]),(0,h.useEffect)(o,s),m[17]!==R||m[18]!==T?(l=(0,d.jsx)("directionalLight",{position:T,color:R,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}),m[17]=R,m[18]=T,m[19]=l):l=m[19],m[20]!==w?(u=(0,d.jsx)("ambientLight",{color:w,intensity:1}),m[20]=w,m[21]=u):u=m[21],m[22]!==l||m[23]!==u?(c=(0,d.jsxs)(d.Fragment,{children:[l,u]}),m[22]=l,m[23]=u,m[24]=c):c=m[24],c},TerrainBlock:eP,TSStatic:function(e){let t,r,n,i,a,o,s,l=(0,f.c)(17),{object:u}=e;l[0]!==u?(t=(0,eb.getProperty)(u,"shapeName"),l[0]=u,l[1]=t):t=l[1];let c=t;l[2]!==u?(r=(0,eb.getPosition)(u),l[2]=u,l[3]=r):r=l[3];let h=r;l[4]!==u?(n=(0,eb.getRotation)(u),l[4]=u,l[5]=n):n=l[5];let m=n;l[6]!==u?(i=(0,eb.getScale)(u),l[6]=u,l[7]=i):i=l[7];let p=i;return c||console.error(" missing shapeName for object",u),l[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,d.jsx)(rT,{}),l[8]=a):a=l[8],l[9]!==h||l[10]!==m||l[11]!==p?(o=(0,d.jsx)("group",{position:h,quaternion:m,scale:p,children:a}),l[9]=h,l[10]=m,l[11]=p,l[12]=o):o=l[12],l[13]!==u||l[14]!==c||l[15]!==o?(s=(0,d.jsx)(rv,{type:"TSStatic",object:u,shapeName:c,children:o}),l[13]=u,l[14]=c,l[15]=o,l[16]=s):s=l[16],s},Turret:function(e){let t,r,n,i,a,o,s,l,u,c,h,m=(0,f.c)(27),{object:p}=e;m[0]!==p?(t=(0,eb.getProperty)(p,"dataBlock")??"",m[0]=p,m[1]=t):t=m[1];let A=t;m[2]!==p?(r=(0,eb.getProperty)(p,"initialBarrel"),m[2]=p,m[3]=r):r=m[3];let g=r,v=(0,rI.useDatablock)(A),y=(0,rI.useDatablock)(g);m[4]!==p?(n=(0,eb.getPosition)(p),m[4]=p,m[5]=n):n=m[5];let C=n;m[6]!==p?(i=(0,eb.getRotation)(p),m[6]=p,m[7]=i):i=m[7];let B=i;m[8]!==p?(a=(0,eb.getScale)(p),m[8]=p,m[9]=a):a=m[9];let b=a;m[10]!==v?(o=(0,eb.getProperty)(v,"shapeFile"),m[10]=v,m[11]=o):o=m[11];let x=o;m[12]!==y?(s=(0,eb.getProperty)(y,"shapeFile"),m[12]=y,m[13]=s):s=m[13];let S=s;return x||console.error(` missing shape for datablock: ${A}`),g&&!S&&console.error(` missing shape for barrel datablock: ${g}`),m[14]===Symbol.for("react.memo_cache_sentinel")?(l=(0,d.jsx)(rT,{}),m[14]=l):l=m[14],m[15]!==S||m[16]!==p?(u=S?(0,d.jsx)(rv,{type:"Turret",object:p,shapeName:S,children:(0,d.jsx)("group",{position:[0,1.5,0],children:(0,d.jsx)(rT,{})})}):null,m[15]=S,m[16]=p,m[17]=u):u=m[17],m[18]!==C||m[19]!==B||m[20]!==b||m[21]!==u?(c=(0,d.jsxs)("group",{position:C,quaternion:B,scale:b,children:[l,u]}),m[18]=C,m[19]=B,m[20]=b,m[21]=u,m[22]=c):c=m[22],m[23]!==p||m[24]!==x||m[25]!==c?(h=(0,d.jsx)(rv,{type:"Turret",object:p,shapeName:x,children:c}),m[23]=p,m[24]=x,m[25]=c,m[26]=h):h=m[26],h},WaterBlock:(0,h.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,r,n,i=(0,f.c)(7),{object:a}=e;i[0]!==a?(t=(0,eb.getPosition)(a),i[0]=a,i[1]=t):t=i[1];let o=t;i[2]!==a?(r=(0,eb.getProperty)(a,"name"),i[2]=a,i[3]=r):r=i[3];let s=r;return i[4]!==s||i[5]!==o?(n=s?(0,d.jsx)(tX.FloatingLabel,{position:o,opacity:.6,children:s}):null,i[4]=s,i[5]=o,i[6]=n):n=i[6],n}};function rU(e){let t,r,n,i=(0,f.c)(9),{object:a}=e,{missionType:o}=(0,h.useContext)(rP);i[0]!==a?(t=new Set(((0,eb.getProperty)(a,"missionTypesList")??"").toLowerCase().split(/s+/).filter(Boolean)),i[0]=a,i[1]=t):t=i[1];let s=t;i[2]!==o||i[3]!==s?(r=!s.size||s.has(o.toLowerCase()),i[2]=o,i[3]=s,i[4]=r):r=i[4];let l=r,u=rj[a._className];return i[5]!==u||i[6]!==a||i[7]!==l?(n=l&&u?(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(u,{object:a})}):null,i[5]=u,i[6]=a,i[7]=l,i[8]=n):n=i[8],n}var rN=e.i(86608),rJ=e.i(38433),rK=e.i(33870),rQ=e.i(91996);let rV=async e=>{let t;try{t=(0,ey.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let r=await fetch(t);if(!r.ok)return console.error(`Script fetch failed: ${e} (${r.status})`),null;return await r.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}},rq=(0,rK.createScriptCache)(),rX={findFiles:e=>{let t=(0,ev.default)(e,{nocase:!0});return(0,rQ.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,rQ.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,rQ.getResourceMap)()[(0,rQ.getResourceKey)(e)]},rW=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(17),{name:c,missionType:m,onLoadingChange:p}=e,{data:A}=((l=(0,f.c)(2))[0]!==c?(s={queryKey:["parsedMission",c],queryFn:()=>(0,ey.loadMission)(c)},l[0]=c,l[1]=s):s=l[1],eg(s,eo,void 0)),{missionGroup:g,runtime:v,progress:y}=function(e,t,r){let n,i,a,o=(0,f.c)(6);o[0]===Symbol.for("react.memo_cache_sentinel")?(n={missionGroup:void 0,runtime:void 0,progress:0},o[0]=n):n=o[0];let[s,l]=(0,h.useState)(n);return o[1]!==e||o[2]!==t||o[3]!==r?(i=()=>{if(!r)return;let n=new AbortController,i=(0,rJ.createProgressTracker)(),a=()=>{l(e=>({...e,progress:i.progress}))};i.on("update",a);let{runtime:o}=(0,rN.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:rV,fileSystem:rX,cache:rq,signal:n.signal,progress:i,ignoreScripts:["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"]},onMissionLoadDone:()=>{l({missionGroup:s.getObjectByName("MissionGroup"),runtime:s,progress:1})}}),s=o;return()=>{i.off("update",a),n.abort(),s.destroy()}},a=[e,t,r],o[1]=e,o[2]=t,o[3]=r,o[4]=i,o[5]=a):(i=o[4],a=o[5]),(0,h.useEffect)(i,a),s}(c,m,A),C=!A||!g||!v;u[0]!==g||u[1]!==m||u[2]!==A?(t={metadata:A,missionType:m,missionGroup:g},u[0]=g,u[1]=m,u[2]=A,u[3]=t):t=u[3];let B=t;return(u[4]!==C||u[5]!==p||u[6]!==y?(r=()=>{p?.(C,y)},n=[C,y,p],u[4]=C,u[5]=p,u[6]=y,u[7]=r,u[8]=n):(r=u[7],n=u[8]),(0,h.useEffect)(r,n),C)?null:(u[9]!==g?(i=(0,d.jsx)(rU,{object:g}),u[9]=g,u[10]=i):i=u[10],u[11]!==v||u[12]!==i?(a=(0,d.jsx)(eL.RuntimeProvider,{runtime:v,children:i}),u[11]=v,u[12]=i,u[13]=a):a=u[13],u[14]!==B||u[15]!==a?(o=(0,d.jsx)(rk,{value:B,children:a}),u[14]=B,u[15]=a,u[16]=o):o=u[16],o)});var rY=class extends x{constructor(e={}){super(),this.config=e,this.#k=new Map}#k;build(e,t,r){let n=t.queryKey,i=t.queryHash??L(n,t),a=this.get(i);return a||(a=new er({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#k.has(e.queryHash)||(this.#k.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#k.get(e.queryHash);t&&(e.destroy(),t===e&&this.#k.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){X.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#k.get(e)}getAll(){return[...this.#k.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>I(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>I(e,t)):t}notify(e){X.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){X.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){X.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rz=class extends et{#c;#H;#j;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#j=e.mutationCache,this.#H=[],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.#H.includes(e)||(this.#H.push(e),this.clearGcTimeout(),this.#j.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#H=this.#H.filter(t=>t!==e),this.scheduleGc(),this.#j.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#H.length||("pending"===this.state.status?this.scheduleGc():this.#j.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#m({type:"continue"})},r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#j.canRun(this)});let n="pending"===this.state.status,i=!this.#d.canStart();try{if(n)t();else{this.#m({type:"pending",variables:e,isPaused:i}),await this.#j.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#m({type:"pending",context:t,variables:e,isPaused:i})}let a=await this.#d.start();return await this.#j.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#j.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#m({type:"success",data:a}),a}catch(t){try{await this.#j.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.#j.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.#m({type:"error",error:t}),t}finally{this.#j.runNext(this)}}#m(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),X.batch(()=>{this.#H.forEach(t=>{t.onMutationUpdate(e)}),this.#j.notify({mutation:this,type:"updated",action:e})})}},rZ=class extends x{constructor(e={}){super(),this.config=e,this.#U=new Set,this.#N=new Map,this.#J=0}#U;#N;#J;build(e,t,r){let n=new rz({client:e,mutationCache:this,mutationId:++this.#J,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#U.add(e);let t=r$(e);if("string"==typeof t){let r=this.#N.get(t);r?r.push(e):this.#N.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#U.delete(e)){let t=r$(e);if("string"==typeof t){let r=this.#N.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#N.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=r$(e);if("string"!=typeof t)return!0;{let r=this.#N.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=r$(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#N.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){X.batch(()=>{this.#U.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#U.clear(),this.#N.clear()})}getAll(){return Array.from(this.#U)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>G(t,e))}findAll(e={}){return this.getAll().filter(t=>G(e,t))}notify(e){X.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return X.batch(()=>Promise.all(e.map(e=>e.continue().catch(F))))}};function r$(e){return e.options.scope?.id}function r0(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=V(t.options,t.fetchOptions),c=async(e,n,i)=>{if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let a=(()=>{var e,a;let o,s,l={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return e=()=>t.signal,a=()=>r=!0,s=!1,Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(o??=e(),s||(s=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),l})(),o=await u(a),{maxPages:s}=t.options,l=i?K:J;return{pages:l(e.pages,o,s),pageParams:l(e.pageParams,n,s)}};if(i&&a.length){let e="backward"===i,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:r1)(n,t);s=await c(t,r,e)}else{let t=e??a.length;do{let e=0===l?o[0]??n.initialPageParam:r1(n,s);if(l>0&&null==e)break;s=await c(s,e),l++}while(lt.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function r1(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 r2=class{#K;#j;#f;#Q;#V;#q;#X;#W;constructor(e={}){this.#K=e.queryCache||new rY,this.#j=e.mutationCache||new rZ,this.#f=e.defaultOptions||{},this.#Q=new Map,this.#V=new Map,this.#q=0}mount(){this.#q++,1===this.#q&&(this.#X=q.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onFocus())}),this.#W=W.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onOnline())}))}unmount(){this.#q--,0===this.#q&&(this.#X?.(),this.#X=void 0,this.#W?.(),this.#W=void 0)}isFetching(e){return this.#K.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#j.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#K.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#K.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(w(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#K.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=this.#K.get(n.queryHash),a=i?.state.data,o="function"==typeof t?t(a):t;if(void 0!==o)return this.#K.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return X.batch(()=>this.#K.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#K.get(t.queryHash)?.state}removeQueries(e){let t=this.#K;X.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#K;return X.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(X.batch(()=>this.#K.findAll(e).map(e=>e.cancel(r)))).then(F).catch(F)}invalidateQueries(e,t={}){return X.batch(()=>(this.#K.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(X.batch(()=>this.#K.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(F)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(F)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#K.build(this,t);return r.isStaleByTime(w(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(F).catch(F)}fetchInfiniteQuery(e){return e.behavior=r0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(F).catch(F)}ensureInfiniteQueryData(e){return e.behavior=r0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return W.isOnline()?this.#j.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#K}getMutationCache(){return this.#j}getDefaultOptions(){return this.#f}setDefaultOptions(e){this.#f=e}setQueryDefaults(e,t){this.#Q.set(O(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#Q.values()],r={};return t.forEach(t=>{_(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#V.set(O(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#V.values()],r={};return t.forEach(t=>{_(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#f.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=L(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Q&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#f.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#K.clear(),this.#j.clear()}},r9=e.i(8155);let r3=e=>{let t=(0,r9.createStore)(e),r=e=>(function(e,t=e=>e){let r=h.default.useSyncExternalStore(e.subscribe,h.default.useCallback(()=>t(e.getState()),[e,t]),h.default.useCallback(()=>t(e.getInitialState()),[e,t]));return h.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},r5=h.createContext(null);function r8({map:e,children:t,onChange:r,domElement:n}){let i=e.map(e=>e.name+e.keys).join("-"),a=h.useMemo(()=>{let t,r;return t=()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(e,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());a=r=>{let n=e(r);if(!i(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return i(a)},t(e,r,n)})?r3(r):r3},[i]),o=h.useMemo(()=>[a.subscribe,a.getState,a],[i]),s=a.setState;return h.useEffect(()=>{let t=e.map(({name:e,keys:t,up:n})=>({keys:t,up:n,fn:t=>{s({[e]:t}),r&&r(e,t,o[1]())}})).reduce((e,{keys:t,fn:r,up:n=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:n}),e),{}),i=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,pressed:a,up:o}=n;n.pressed=!0,(o||!a)&&i(!0)},a=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,up:a}=n;n.pressed=!1,a&&i(!1)},l=n||window;return l.addEventListener("keydown",i,{passive:!0}),l.addEventListener("keyup",a,{passive:!0}),()=>{l.removeEventListener("keydown",i),l.removeEventListener("keyup",a)}},[n,i]),h.createElement(r5.Provider,{value:o,children:t})}function r6(e){let[t,r,n]=h.useContext(r5);return e?n(e):[t,r]}var r4=Object.defineProperty;class r7{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?r4(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;t{let n;return(n="symbol"!=typeof t?t+"":t)in e?ne(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let nr=new A.Euler(0,0,0,"YXZ"),nn=new A.Vector3,ni={type:"change"},na={type:"lock"},no={type:"unlock"},ns=Math.PI/2;class nl extends r7{constructor(e,t){super(),nt(this,"camera"),nt(this,"domElement"),nt(this,"isLocked"),nt(this,"minPolarAngle"),nt(this,"maxPolarAngle"),nt(this,"pointerSpeed"),nt(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nr.setFromQuaternion(this.camera.quaternion),nr.y-=.002*e.movementX*this.pointerSpeed,nr.x-=.002*e.movementY*this.pointerSpeed,nr.x=Math.max(ns-this.maxPolarAngle,Math.min(ns-this.minPolarAngle,nr.x)),this.camera.quaternion.setFromEuler(nr),this.dispatchEvent(ni))}),nt(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(na),this.isLocked=!0):(this.dispatchEvent(no),this.isLocked=!1))}),nt(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),nt(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))}),nt(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))}),nt(this,"dispose",()=>{this.disconnect()}),nt(this,"getObject",()=>this.camera),nt(this,"direction",new A.Vector3(0,0,-1)),nt(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),nt(this,"moveForward",e=>{nn.setFromMatrixColumn(this.camera.matrix,0),nn.crossVectors(this.camera.up,nn),this.camera.position.addScaledVector(nn,e)}),nt(this,"moveRight",e=>{nn.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(nn,e)}),nt(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),nt(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)}}(c={}).forward="forward",c.backward="backward",c.left="left",c.right="right",c.up="up",c.down="down",c.lookUp="lookUp",c.lookDown="lookDown",c.lookLeft="lookLeft",c.lookRight="lookRight",c.camera1="camera1",c.camera2="camera2",c.camera3="camera3",c.camera4="camera4",c.camera5="camera5",c.camera6="camera6",c.camera7="camera7",c.camera8="camera8",c.camera9="camera9";let nu=Math.PI/2-.01;function nc(){let e,t,r,n,i,a,o,s,l,u,c,d,m,p=(0,f.c)(26),{speedMultiplier:g,setSpeedMultiplier:v}=(0,eF.useControls)(),[y,C]=r6(),{camera:B,gl:b}=(0,eB.useThree)(),{nextCamera:x,setCameraIndex:S,cameraCount:E}=rO(),M=(0,h.useRef)(null);p[0]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector3,p[0]=e):e=p[0];let F=(0,h.useRef)(e);p[1]===Symbol.for("react.memo_cache_sentinel")?(t=new A.Vector3,p[1]=t):t=p[1];let T=(0,h.useRef)(t);p[2]===Symbol.for("react.memo_cache_sentinel")?(r=new A.Vector3,p[2]=r):r=p[2];let R=(0,h.useRef)(r);p[3]===Symbol.for("react.memo_cache_sentinel")?(n=new A.Euler(0,0,0,"YXZ"),p[3]=n):n=p[3];let w=(0,h.useRef)(n);return p[4]!==B||p[5]!==b.domElement?(i=()=>{let e=new nl(B,b.domElement);return M.current=e,()=>{e.dispose()}},a=[B,b.domElement],p[4]=B,p[5]=b.domElement,p[6]=i,p[7]=a):(i=p[6],a=p[7]),(0,h.useEffect)(i,a),p[8]!==B||p[9]!==b.domElement||p[10]!==x?(o=()=>{let e=b.domElement,t=new A.Euler(0,0,0,"YXZ"),r=!1,n=!1,i=0,a=0,o=t=>{M.current?.isLocked||t.target===e&&(r=!0,n=!1,i=t.clientX,a=t.clientY)},s=e=>{!r||!n&&3>Math.abs(e.clientX-i)&&3>Math.abs(e.clientY-a)||(n=!0,t.setFromQuaternion(B.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-nu,Math.min(nu,t.x)),B.quaternion.setFromEuler(t))},l=()=>{r=!1},u=t=>{let r=M.current;!r||r.isLocked?x():t.target!==e||n||r.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),document.addEventListener("click",u),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),document.removeEventListener("click",u)}},s=[B,b.domElement,x],p[8]=B,p[9]=b.domElement,p[10]=x,p[11]=o,p[12]=s):(o=p[11],s=p[12]),(0,h.useEffect)(o,s),p[13]!==E||p[14]!==S||p[15]!==y?(l=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return y(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,r=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;v(e=>Math.max(.1,Math.min(5,Math.round((e+r)*20)/20)))},t=b.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},d=[b.domElement,v],p[18]=b.domElement,p[19]=v,p[20]=c,p[21]=d):(c=p[20],d=p[21]),(0,h.useEffect)(c,d),p[22]!==B||p[23]!==C||p[24]!==g?(m=(e,t)=>{let{forward:r,backward:n,left:i,right:a,up:o,down:s,lookUp:l,lookDown:u,lookLeft:c,lookRight:d}=C();if((l||u||c||d)&&(w.current.setFromQuaternion(B.quaternion,"YXZ"),c&&(w.current.y=w.current.y+ +t),d&&(w.current.y=w.current.y-t),l&&(w.current.x=w.current.x+ +t),u&&(w.current.x=w.current.x-t),w.current.x=Math.max(-nu,Math.min(nu,w.current.x)),B.quaternion.setFromEuler(w.current)),!r&&!n&&!i&&!a&&!o&&!s)return;let f=80*g;B.getWorldDirection(F.current),F.current.normalize(),T.current.crossVectors(B.up,F.current).normalize(),R.current.set(0,0,0),r&&R.current.add(F.current),n&&R.current.sub(F.current),i&&R.current.add(T.current),a&&R.current.sub(T.current),o&&(R.current.y=R.current.y+1),s&&(R.current.y=R.current.y-1),R.current.lengthSq()>0&&(R.current.normalize().multiplyScalar(f*t),B.position.add(R.current))},p[22]=B,p[23]=C,p[24]=g,p[25]=m):m=p[25],(0,eC.useFrame)(m),null}let nd=[{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 nf(){let e,t,r=(0,f.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],r[0]=e):e=r[0],(0,h.useEffect)(nh,e),r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)(nc,{}),r[1]=t):t=r[1],t}function nh(){return window.addEventListener("keydown",nm,{capture:!0}),window.addEventListener("keyup",nm,{capture:!0}),()=>{window.removeEventListener("keydown",nm,{capture:!0}),window.removeEventListener("keyup",nm,{capture:!0})}}function nm(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}function np(){let e,t,r,n,i,a,o,s,l,u,c,h,m,p,A,g,v,y,C,B,b,x,S,E,M=(0,f.c)(51),F=r6(nE),T=r6(nS),R=r6(nx),w=r6(nb),D=r6(nB),I=r6(nC),G=r6(ny),L=r6(nv),O=r6(ng),_=r6(nA);return M[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,d.jsx)("div",{className:"KeyboardOverlay-spacer"}),M[0]=e):e=M[0],M[1]!==F?(t=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":F,children:"W"}),M[1]=F,M[2]=t):t=M[2],M[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,d.jsx)("div",{className:"KeyboardOverlay-spacer"}),M[3]=r):r=M[3],M[4]!==t?(n=(0,d.jsxs)("div",{className:"KeyboardOverlay-row",children:[e,t,r]}),M[4]=t,M[5]=n):n=M[5],M[6]!==R?(i=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":R,children:"A"}),M[6]=R,M[7]=i):i=M[7],M[8]!==T?(a=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":T,children:"S"}),M[8]=T,M[9]=a):a=M[9],M[10]!==w?(o=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":w,children:"D"}),M[10]=w,M[11]=o):o=M[11],M[12]!==i||M[13]!==a||M[14]!==o?(s=(0,d.jsxs)("div",{className:"KeyboardOverlay-row",children:[i,a,o]}),M[12]=i,M[13]=a,M[14]=o,M[15]=s):s=M[15],M[16]!==n||M[17]!==s?(l=(0,d.jsxs)("div",{className:"KeyboardOverlay-column",children:[n,s]}),M[16]=n,M[17]=s,M[18]=l):l=M[18],M[19]===Symbol.for("react.memo_cache_sentinel")?(u=(0,d.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↑"}),M[19]=u):u=M[19],M[20]!==D?(c=(0,d.jsx)("div",{className:"KeyboardOverlay-row",children:(0,d.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":D,children:[u," Space"]})}),M[20]=D,M[21]=c):c=M[21],M[22]===Symbol.for("react.memo_cache_sentinel")?(h=(0,d.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↓"}),M[22]=h):h=M[22],M[23]!==I?(m=(0,d.jsx)("div",{className:"KeyboardOverlay-row",children:(0,d.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":I,children:[h," Shift"]})}),M[23]=I,M[24]=m):m=M[24],M[25]!==c||M[26]!==m?(p=(0,d.jsxs)("div",{className:"KeyboardOverlay-column",children:[c,m]}),M[25]=c,M[26]=m,M[27]=p):p=M[27],M[28]===Symbol.for("react.memo_cache_sentinel")?(A=(0,d.jsx)("div",{className:"KeyboardOverlay-spacer"}),M[28]=A):A=M[28],M[29]!==G?(g=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":G,children:"↑"}),M[29]=G,M[30]=g):g=M[30],M[31]===Symbol.for("react.memo_cache_sentinel")?(v=(0,d.jsx)("div",{className:"KeyboardOverlay-spacer"}),M[31]=v):v=M[31],M[32]!==g?(y=(0,d.jsxs)("div",{className:"KeyboardOverlay-row",children:[A,g,v]}),M[32]=g,M[33]=y):y=M[33],M[34]!==O?(C=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":O,children:"←"}),M[34]=O,M[35]=C):C=M[35],M[36]!==L?(B=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":L,children:"↓"}),M[36]=L,M[37]=B):B=M[37],M[38]!==_?(b=(0,d.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":_,children:"→"}),M[38]=_,M[39]=b):b=M[39],M[40]!==C||M[41]!==B||M[42]!==b?(x=(0,d.jsxs)("div",{className:"KeyboardOverlay-row",children:[C,B,b]}),M[40]=C,M[41]=B,M[42]=b,M[43]=x):x=M[43],M[44]!==y||M[45]!==x?(S=(0,d.jsxs)("div",{className:"KeyboardOverlay-column",children:[y,x]}),M[44]=y,M[45]=x,M[46]=S):S=M[46],M[47]!==p||M[48]!==S||M[49]!==l?(E=(0,d.jsxs)("div",{className:"KeyboardOverlay",children:[l,p,S]}),M[47]=p,M[48]=S,M[49]=l,M[50]=E):E=M[50],E}function nA(e){return e.lookRight}function ng(e){return e.lookLeft}function nv(e){return e.lookDown}function ny(e){return e.lookUp}function nC(e){return e.down}function nB(e){return e.up}function nb(e){return e.right}function nx(e){return e.left}function nS(e){return e.backward}function nE(e){return e.forward}let nM=Math.PI/2-.01;function nF({joystickState:t,joystickZone:r,lookJoystickState:n,lookJoystickZone:i}){let{touchMode:a}=(0,eF.useControls)();(0,h.useEffect)(()=>{let n=r.current;if(!n)return;let i=null,a=!1;return e.A(84968).then(e=>{a||((i=e.default.create({zone:n,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,r)=>{t.current.angle=r.angle.radian,t.current.force=Math.min(1,r.force)}),i.on("end",()=>{t.current.force=0}))}),()=>{a=!0,i?.destroy()}},[t,r,a]),(0,h.useEffect)(()=>{if("dualStick"!==a)return;let t=i.current;if(!t)return;let r=null,o=!1;return e.A(84968).then(e=>{o||((r=e.default.create({zone:t,mode:"static",position:{right:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,t)=>{n.current.angle=t.angle.radian,n.current.force=Math.min(1,t.force)}),r.on("end",()=>{n.current.force=0}))}),()=>{o=!0,r?.destroy()}},[a,n,i]);let o=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return"dualStick"===a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{ref:r,className:"TouchJoystick TouchJoystick--left",onContextMenu:e=>e.preventDefault(),onTouchStart:o}),(0,d.jsx)("div",{ref:i,className:"TouchJoystick TouchJoystick--right",onContextMenu:e=>e.preventDefault(),onTouchStart:o})]}):(0,d.jsx)("div",{ref:r,className:"TouchJoystick",onContextMenu:e=>e.preventDefault(),onTouchStart:o})}function nT(e){let t,r,n,i,a,o,s,l,u,c,d=(0,f.c)(25),{joystickState:m,joystickZone:p,lookJoystickState:g}=e,{speedMultiplier:v,touchMode:y}=(0,eF.useControls)(),{camera:C,gl:B}=(0,eB.useThree)();d[0]===Symbol.for("react.memo_cache_sentinel")?(t=new A.Euler(0,0,0,"YXZ"),d[0]=t):t=d[0];let b=(0,h.useRef)(t),x=(0,h.useRef)(null);d[1]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},d[1]=r):r=d[1];let S=(0,h.useRef)(r);d[2]===Symbol.for("react.memo_cache_sentinel")?(n=new A.Vector3,d[2]=n):n=d[2];let E=(0,h.useRef)(n);d[3]===Symbol.for("react.memo_cache_sentinel")?(i=new A.Vector3,d[3]=i):i=d[3];let M=(0,h.useRef)(i);d[4]===Symbol.for("react.memo_cache_sentinel")?(a=new A.Vector3,d[4]=a):a=d[4];let F=(0,h.useRef)(a);return d[5]!==C.quaternion?(o=()=>{b.current.setFromQuaternion(C.quaternion,"YXZ")},d[5]=C.quaternion,d[6]=o):o=d[6],d[7]!==C?(s=[C],d[7]=C,d[8]=s):s=d[8],(0,h.useEffect)(o,s),d[9]!==C.quaternion||d[10]!==B.domElement||d[11]!==p||d[12]!==y?(l=()=>{if("moveLookStick"!==y)return;let e=B.domElement,t=e=>{let t=p.current;if(!t)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom},r=e=>{if(null===x.current)for(let r=0;r{if(null!==x.current)for(let t=0;t{for(let t=0;t{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",n),e.removeEventListener("touchend",i),e.removeEventListener("touchcancel",i),x.current=null}},d[9]=C.quaternion,d[10]=B.domElement,d[11]=p,d[12]=y,d[13]=l):l=d[13],d[14]!==C||d[15]!==B.domElement||d[16]!==p||d[17]!==y?(u=[C,B.domElement,p,y],d[14]=C,d[15]=B.domElement,d[16]=p,d[17]=y,d[18]=u):u=d[18],(0,h.useEffect)(l,u),d[19]!==C||d[20]!==m.current||d[21]!==g||d[22]!==v||d[23]!==y?(c=(e,t)=>{let{force:r,angle:n}=m.current;if("dualStick"===y){let e=g.current;if(e.force>.15){let r=(e.force-.15)/.85,n=Math.cos(e.angle),i=Math.sin(e.angle);b.current.setFromQuaternion(C.quaternion,"YXZ"),b.current.y=b.current.y-n*r*2.5*t,b.current.x=b.current.x+i*r*2.5*t,b.current.x=Math.max(-nM,Math.min(nM,b.current.x)),C.quaternion.setFromEuler(b.current)}if(r>.08){let e=80*v*((r-.08)/.92),i=Math.cos(n),a=Math.sin(n);C.getWorldDirection(E.current),E.current.normalize(),M.current.crossVectors(C.up,E.current).normalize(),F.current.set(0,0,0).addScaledVector(E.current,a).addScaledVector(M.current,-i),F.current.lengthSq()>0&&(F.current.normalize().multiplyScalar(e*t),C.position.add(F.current))}}else if("moveLookStick"===y&&r>0){let e=80*v*.5;if(C.getWorldDirection(E.current),E.current.normalize(),F.current.copy(E.current).multiplyScalar(e*t),C.position.add(F.current),r>=.15){let e=Math.cos(n),i=Math.sin(n),a=(r-.15)/.85;b.current.setFromQuaternion(C.quaternion,"YXZ"),b.current.y=b.current.y-e*a*1.25*t,b.current.x=b.current.x+i*a*1.25*t,b.current.x=Math.max(-nM,Math.min(nM,b.current.x)),C.quaternion.setFromEuler(b.current)}}},d[19]=C,d[20]=m.current,d[21]=g,d[22]=v,d[23]=y,d[24]=c):c=d[24],(0,eC.useFrame)(c),null}var nR="undefined"!=typeof window&&!!(null==(u=window.document)?void 0:u.createElement);function nw(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function nD(e){return e?"self"in e?e.self:nw(e).defaultView||window:self}function nI(e,t=!1){let{activeElement:r}=nw(e);if(!(null==r?void 0:r.nodeName))return null;if(nL(r)&&r.contentDocument)return nI(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=nw(r).getElementById(e);if(t)return t}}return r}function nG(e,t){return e===t||e.contains(t)}function nL(e){return"IFRAME"===e.tagName}function nO(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==n_.indexOf(e.type)}var n_=["button","color","file","image","reset","submit"];function nP(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function nk(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function nH(e){return e.isContentEditable||nk(e)}function nj(e){let t=0,r=0;if(nk(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=nw(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&nG(e,n.anchorNode)&&n.focusNode&&nG(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function nU(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function nN(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 nN(e.parentElement)||document.scrollingElement||document.body}function nJ(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function nK(e,t){return t&&e.item(t)||null}var nQ=Symbol("FOCUS_SILENTLY");function nV(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function nq(){}function nX(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nW(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function nY(e){return e}function nz(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function nZ(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function n$(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function n0(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function n1(...e){for(let t of e)if(void 0!==t)return t}function n2(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function n9(){return nR&&!!navigator.maxTouchPoints}function n3(){return!!nR&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function n5(){return nR&&n3()&&/apple/i.test(navigator.vendor)}function n8(e){return!!(e.currentTarget&&!nG(e.currentTarget,e.target))}function n6(e){return e.target===e.currentTarget}function n4(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 n7(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function ie(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!nG(r,n)}function it(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,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function ir(e,t,r,n=window){let i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(ir(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var ii={...h},ia=ii.useId;ii.useDeferredValue;var io=ii.useInsertionEffect,is=nR?h.useLayoutEffect:h.useEffect;function il(e){let t=(0,h.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return io?io(()=>{t.current=e}):t.current=e,(0,h.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function iu(...e){return(0,h.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)n2(r,t)}},e)}function ic(e){if(ia){let t=ia();return e||t}let[t,r]=(0,h.useState)(e);return is(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function id(e,t){let r=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,h.useEffect)(()=>()=>{r.current=!1},[])}function ih(){return(0,h.useReducer)(()=>[],[])}function im(e){return il("function"==typeof e?e:()=>e)}function ip(e,t,r=[]){let n=(0,h.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function iA(e=!1,t){let[r,n]=(0,h.useState)(null);return{portalRef:iu(n,t),portalNode:r,domReady:!e||r}}var ig=!1,iv=!1,iy=0,iC=0;function iB(e){let t,r;t=e.movementX||e.screenX-iy,r=e.movementY||e.screenY-iC,iy=e.screenX,iC=e.screenY,(t||r||0)&&(iv=!0)}function ib(){iv=!1}function ix(e){let t=h.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function iS(e,t){return h.memo(e,t)}function iE(e,t){let r,{wrapElement:n,render:i,...a}=t,o=iu(t.ref,i&&(0,h.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(h.isValidElement(i)){let e={...i.props,ref:o};r=h.cloneElement(i,function(e,t){let r={...e};for(let n in t){if(!nX(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}(a,e))}else r=i?i(a):(0,d.jsx)(e,{...a});return n?n(r):r}function iM(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function iF(e=[],t=[]){let r=h.createContext(void 0),n=h.createContext(void 0),i=()=>h.useContext(r),a=t=>e.reduceRight((e,r)=>(0,d.jsx)(r,{...t,children:e}),(0,d.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:i,useScopedContext:(e=!1)=>{let t=h.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=h.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:a,ScopedContextProvider:e=>(0,d.jsx)(a,{...e,children:t.reduceRight((t,r)=>(0,d.jsx)(r,{...e,children:t}),(0,d.jsx)(n.Provider,{...e}))})}}var iT=iF(),iR=iT.useContext;iT.useScopedContext,iT.useProviderContext;var iw=iF([iT.ContextProvider],[iT.ScopedContextProvider]),iD=iw.useContext;iw.useScopedContext;var iI=iw.useProviderContext,iG=iw.ContextProvider,iL=iw.ScopedContextProvider,iO=(0,h.createContext)(void 0),i_=(0,h.createContext)(void 0),iP=(0,h.createContext)(!0),ik="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 iH(e){return!(!e.matches(ik)||!nP(e)||e.closest("[inert]"))}function ij(e){if(!iH(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=nI(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function iU(e,t){let r=Array.from(e.querySelectorAll(ik));t&&r.unshift(e);let n=r.filter(iH);return n.forEach((e,t)=>{if(nL(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...iU(r))}}),n}function iN(e,t,r){let n=Array.from(e.querySelectorAll(ik)),i=n.filter(ij);return(t&&ij(e)&&i.unshift(e),i.forEach((e,t)=>{if(nL(e)&&e.contentDocument){let n=iN(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function iJ(e,t){var r;let n,i,a,o;return r=document.body,n=nI(r),a=(i=iU(r,!1)).indexOf(n),(o=i.slice(a+1)).find(ij)||(e?i.find(ij):null)||(t?o[0]:null)||null}function iK(e,t){var r;let n,i,a,o;return r=document.body,n=nI(r),a=(i=iU(r,!1).reverse()).indexOf(n),(o=i.slice(a+1)).find(ij)||(e?i.find(ij):null)||(t?o[0]:null)||null}function iQ(e){let t=nI(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function iV(e){let t=nI(e);if(!t)return!1;if(nG(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function iq(e){!iV(e)&&iH(e)&&e.focus()}var iX=n5(),iW=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],iY=Symbol("safariFocusAncestor");function iz(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function iZ(e,t){return il(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var i$=!1,i0=!0;function i1(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(i0=!1)}function i2(e){e.metaKey||e.ctrlKey||e.altKey||(i0=!0)}var i9=iM(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var a,o,s,l,u;let c=(0,h.useRef)(null);(0,h.useEffect)(()=>{!e||i$||(ir("mousedown",i1,!0),ir("keydown",i2,!0),i$=!0)},[e]),iX&&(0,h.useEffect)(()=>{if(!e)return;let t=c.current;if(!t||!iz(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 d=e&&n$(i),f=!!d&&!t,[m,p]=(0,h.useState)(!1);(0,h.useEffect)(()=>{e&&f&&m&&p(!1)},[e,f,m]),(0,h.useEffect)(()=>{if(!e||!m)return;let t=c.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{iH(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,m]);let A=iZ(i.onKeyPressCapture,d),g=iZ(i.onMouseDownCapture,d),v=iZ(i.onClickCapture,d),y=i.onMouseDown,C=il(t=>{if(null==y||y(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!iX||n8(t)||!nO(r)&&!iz(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let a=function(e){for(;e&&!iH(e);)e=e.closest(ik);return e||null}(r.parentElement);a&&(a[iY]=!0),it(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),a&&(a[iY]=!1),n||iq(r)})}),B=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&iQ(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",p(!0)))},b=i.onKeyDownCapture,x=il(t=>{if(null==b||b(t),t.defaultPrevented||!e||m||t.metaKey||t.altKey||t.ctrlKey||!n6(t))return;let r=t.currentTarget;it(r,"focusout",()=>B(t,r))}),S=i.onFocusCapture,E=il(t=>{if(null==S||S(t),t.defaultPrevented||!e)return;if(!n6(t))return void p(!1);let r=t.currentTarget;i0||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:iW.includes(n))}(t.target)?it(t.target,"focusout",()=>B(t,r)):p(!1)}),M=i.onBlur,F=il(t=>{null==M||M(t),!e||ie(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),T=(0,h.useContext)(iP),R=il(t=>{e&&r&&t&&T&&queueMicrotask(()=>{iQ(t)||iH(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,h.useState)(()=>r(void 0));return is(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,void 0]),n}(c),D=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),I=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),G=i.style,L=(0,h.useMemo)(()=>f?{pointerEvents:"none",...G}:G,[f,G]);return i={"data-focus-visible":e&&m||void 0,"data-autofocus":r||void 0,"aria-disabled":d||void 0,...i,ref:iu(c,R,i.ref),style:L,tabIndex:(a=e,o=f,s=D,l=I,u=i.tabIndex,a?o?s&&!l?-1:void 0:s?u:u||0:u),disabled:!!I&&!!f||void 0,contentEditable:d?void 0:i.contentEditable,onKeyPressCapture:A,onClickCapture:v,onMouseDownCapture:g,onMouseDown:C,onKeyDownCapture:x,onFocusCapture:E,onBlur:F},n0(i)});function i3(e){let t=[];for(let r of e)t.push(...r);return t}function i5(e){return e.slice().reverse()}function i8(e,t,r){return il(n=>{var i;let a,o;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!n6(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(a=n.target)||nk(a))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let s=e.getState(),l=null==(i=nK(e,s.activeId))?void 0:i.element;if(!l)return;let{view:u,...c}=n;l!==(null==r?void 0:r.current)&&l.focus(),o=new KeyboardEvent(n.type,c),l.dispatchEvent(o)||n.preventDefault(),n.currentTarget.contains(l)&&n.stopPropagation()})}ix(function(e){return iE("div",i9(e))});var i6=iM(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...i}){let a=iI();nz(e=e||a,!1);let o=(0,h.useRef)(null),s=(0,h.useRef)(null),l=function(e){let[t,r]=(0,h.useState)(!1),n=(0,h.useCallback)(()=>r(!0),[]),i=e.useState(t=>nK(e,t.activeId));return(0,h.useEffect)(()=>{let e=null==i?void 0:i.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(e),u=e.useState("moves"),[,c]=function(e){let[t,r]=(0,h.useState)(null);return is(()=>{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,h.useEffect)(()=>{var n;if(!e||!u||!t||!r)return;let{activeId:i}=e.getState(),a=null==(n=nK(e,i))?void 0:n.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[e,u,t,r]),is(()=>{if(!e||!u||!t)return;let{baseElement:r,activeId:n}=e.getState();if(null!==n||!r)return;let i=s.current;s.current=null,i&&n4(i,{relatedTarget:r}),iQ(r)||r.focus()},[e,u,t]);let f=e.useState("activeId"),m=e.useState("virtualFocus");is(()=>{var r;if(!e||!t||!m)return;let n=s.current;if(s.current=null,!n)return;let i=(null==(r=nK(e,f))?void 0:r.element)||nI(n);i!==n&&n4(n,{relatedTarget:i})},[e,f,m,t]);let p=i8(e,i.onKeyDownCapture,s),A=i8(e,i.onKeyUpCapture,s),g=i.onFocusCapture,v=il(t=>{var r;let n;if(null==g||g(t),t.defaultPrevented||!e)return;let{virtualFocus:i}=e.getState();if(!i)return;let a=t.relatedTarget,o=(n=(r=t.currentTarget)[nQ],delete r[nQ],n);n6(t)&&o&&(t.stopPropagation(),s.current=a)}),y=i.onFocus,C=il(r=>{if(null==y||y(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?n6(r)&&!nV(e,n)&&queueMicrotask(l):n6(r)&&e.setActiveId(null)}),B=i.onBlurCapture,b=il(t=>{var r;if(null==B||B(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:i}=e.getState();if(!n)return;let a=null==(r=nK(e,i))?void 0:r.element,o=t.relatedTarget,l=nV(e,o),u=s.current;s.current=null,n6(t)&&l?(o===a?u&&u!==o&&n4(u,t):a?n4(a,t):u&&n4(u,t),t.stopPropagation()):!nV(e,t.target)&&a&&n4(a,t)}),x=i.onKeyDown,S=im(n),E=il(t=>{var r;if(null==x||x(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!n6(t))return;let{orientation:n,renderedItems:i,activeId:a}=e.getState(),o=nK(e,a);if(null==(r=null==o?void 0:o.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)&&nk(t.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=i3(i5(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(!S(t))return;t.preventDefault(),e.move(r)}}});return i=ip(i,t=>(0,d.jsx)(iG,{value:e,children:t}),[e]),i={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=nK(e,r.activeId))?void 0:n.id}),...i,ref:iu(o,c,i.ref),onKeyDownCapture:p,onKeyUpCapture:A,onFocusCapture:v,onFocus:C,onBlurCapture:b,onKeyDown:E},i=i9({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...i})});ix(function(e){return iE("div",i6(e))});var i4=iF();i4.useContext,i4.useScopedContext;var i7=i4.useProviderContext,ae=iF([i4.ContextProvider],[i4.ScopedContextProvider]);ae.useContext,ae.useScopedContext;var at=ae.useProviderContext,ar=ae.ContextProvider,an=ae.ScopedContextProvider,ai=(0,h.createContext)(void 0),aa=(0,h.createContext)(void 0),ao=iF([ar],[an]);ao.useContext,ao.useScopedContext;var as=ao.useProviderContext,al=ao.ContextProvider,au=ao.ScopedContextProvider,ac=iM(function({store:e,...t}){let r=as();return e=e||r,t={...t,ref:iu(null==e?void 0:e.setAnchorElement,t.ref)}});ix(function(e){return iE("div",ac(e))});var ad=(0,h.createContext)(void 0),af=iF([al,iG],[au,iL]),ah=af.useContext,am=af.useScopedContext,ap=af.useProviderContext,aA=af.ContextProvider,ag=af.ScopedContextProvider,av=(0,h.createContext)(void 0),ay=(0,h.createContext)(!1);function aC(e,t){let r=e.__unstableInternals;return nz(r,"Invalid store"),r[t]}function aB(e,...t){let r=e,n=r,i=Symbol(),a=nq,o=new Set,s=new Set,l=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,h=(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)}),m=(e,a,o=!1)=>{var l,h;if(!nX(r,e))return;let m=(h=r[e],"function"==typeof a?a("function"==typeof h?h():h):a);if(m===r[e])return;if(!o)for(let r of t)null==(l=null==r?void 0:r.setState)||l.call(r,e,m);let p=r;r={...r,[e]:m};let A=Symbol();i=A,s.add(e);let g=(t,n,i)=>{var a;let o=f.get(t);(!o||o.some(t=>i?i.has(t):t===e))&&(null==(a=d.get(t))||a(),d.set(t,t(r,n)))};for(let e of u)g(e,p);queueMicrotask(()=>{if(i!==A)return;let e=r;for(let e of c)g(e,n,s);n=e,s.clear()})},p={getState:()=>r,setState:m,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{let e=o.size,n=Symbol();o.add(n);let i=()=>{o.delete(n),o.size||a()};if(e)return i;let s=Object.keys(r).map(e=>nW(...t.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&nX(n,e))return aE(t,[e],t=>{m(e,t[e],!0)})}))),u=[];for(let e of l)u.push(e());return a=nW(...s,...u,...t.map(ax)),i},subscribe:(e,t)=>h(e,t),sync:(e,t)=>(d.set(t,t(r,r)),h(e,t)),batch:(e,t)=>(d.set(t,t(r,n)),h(e,t,c)),pick:e=>aB(function(e,t){let r={};for(let n of t)nX(e,n)&&(r[n]=e[n]);return r}(r,e),p),omit:e=>aB(function(e,t){let r={...e};for(let e of t)nX(r,e)&&delete r[e];return r}(r,e),p)}};return p}function ab(e,...t){if(e)return aC(e,"setup")(...t)}function ax(e,...t){if(e)return aC(e,"init")(...t)}function aS(e,...t){if(e)return aC(e,"subscribe")(...t)}function aE(e,...t){if(e)return aC(e,"sync")(...t)}function aM(e,...t){if(e)return aC(e,"batch")(...t)}function aF(e,...t){if(e)return aC(e,"omit")(...t)}function aT(...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=aB(r,...e);return Object.assign({},...e,n)}function aR(e,t){}function aw(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 aD(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 aI=iM(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:n,setValueOnChange:i,showMinLength:a=0,showOnChange:o,showOnMouseDown:s,showOnClick:l=s,showOnKeyDown:u,showOnKeyPress:c=u,blurActiveItemOnClick:d,setValueOnClick:f=!0,moveOnKeyPress:m=!0,autoComplete:p="list",...A}){var g;let v,y=ap();nz(e=e||y,!1);let C=(0,h.useRef)(null),[B,b]=ih(),x=(0,h.useRef)(!1),S=(0,h.useRef)(!1),E=e.useState(e=>e.virtualFocus&&r),M="inline"===p||"both"===p,[F,T]=(0,h.useState)(M);g=[M],v=(0,h.useRef)(!1),is(()=>{if(v.current)return(()=>{M&&T(!0)})();v.current=!0},g),is(()=>()=>{v.current=!1},[]);let R=e.useState("value"),w=(0,h.useRef)();(0,h.useEffect)(()=>aE(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let D=e.useState(e=>{var t;if(M&&F){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=e.useState("renderedItems"),G=e.useState("open"),L=e.useState("contentElement"),O=(0,h.useMemo)(()=>{if(!M||!F)return R;if(aw(I,D,E)){if(aD(R,D)){let e=(null==D?void 0:D.slice(R.length))||"";return R+e}return R}return D||R},[M,F,I,D,E,R]);(0,h.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>T(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,h.useEffect)(()=>{if(!M||!F||!D||!aw(I,D,E)||!aD(R,D))return;let e=nq;return queueMicrotask(()=>{let t=C.current;if(!t)return;let{start:r,end:n}=nj(t),i=R.length,a=D.length;nJ(t,i,a),e=()=>{if(!iQ(t))return;let{start:e,end:o}=nj(t);e!==i||o===a&&nJ(t,r,n)}}),()=>e()},[B,M,F,D,I,E,R]);let _=(0,h.useRef)(null),P=il(n),k=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(!G||!L)return;let t=nN(L);if(!t)return;_.current=t;let r=()=>{x.current=!1},n=()=>{if(!e||!x.current)return;let{activeId:t}=e.getState();null===t||t!==k.current&&(x.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)}},[G,L,e]),is(()=>{!R||S.current||(x.current=!0)},[R]),is(()=>{"always"!==E&&G||(x.current=G)},[E,G]);let H=e.useState("resetValueOnSelect");id(()=>{var t,r;let n=x.current;if(!e||!G||!n&&!H)return;let{baseElement:i,contentElement:a,activeId:o}=e.getState();if(!i||iQ(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(b);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(E&&n){let r,n=P(I),i=void 0!==n?n:null!=(t=null==(r=I.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();k.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,G,B,R,E,H,P,I]),(0,h.useEffect)(()=>{if(!M)return;let t=C.current;if(!t)return;let r=[t,L].filter(e=>!!e),n=t=>{r.every(e=>ie(t,e))&&(null==e||e.setValue(O))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[M,L,e,O]);let j=e=>e.currentTarget.value.length>=a,U=A.onChange,N=im(null!=o?o:j),J=im(null!=i?i:!e.tag),K=il(t=>{if(null==U||U(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,o=t.nativeEvent;if(x.current=!0,"input"===o.type&&(o.isComposing&&(x.current=!1,S.current=!0),M)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;T(e&&t)}if(J(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{nJ(r,i,a)}),M&&E&&t&&b()}N(t)&&e.show(),E&&x.current||e.setActiveId(null)}),Q=A.onCompositionEnd,V=il(e=>{x.current=!0,S.current=!1,null==Q||Q(e),e.defaultPrevented||E&&b()}),q=A.onMouseDown,X=im(null!=d?d:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=im(f),Y=im(null!=l?l:j),z=il(t=>{null==q||q(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(X(t)&&e.setActiveId(null),W(t)&&e.setValue(O),Y(t)&&it(t.currentTarget,"mouseup",e.show))}),Z=A.onKeyDown,$=im(null!=c?c:j),ee=il(t=>{if(null==Z||Z(t),t.repeat||(x.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)&&$(t)&&(t.preventDefault(),e.show())}),et=A.onBlur,er=il(e=>{if(x.current=!1,null==et||et(e),e.defaultPrevented)return}),en=ic(A.id),ei=e.useState(e=>null===e.activeId);return A={id:en,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":nU(L,"listbox"),"aria-expanded":G,"aria-controls":null==L?void 0:L.id,"data-active-item":ei||void 0,value:O,...A,ref:iu(C,A.ref),onChange:K,onCompositionEnd:V,onMouseDown:z,onKeyDown:ee,onBlur:er},A=i6({store:e,focusable:t,...A,moveOnKeyPress:e=>!nZ(m,e)&&(M&&T(!0),!0)}),{autoComplete:"off",...A=ac({store:e,...A})}}),aG=ix(function(e){return iE("input",aI(e))});function aL(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var aO=Symbol("composite-hover"),a_=iM(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=iD();nz(e=e||i,!1);let a=((0,h.useEffect)(()=>{ig||(ir("mousemove",iB,!0),ir("mousedown",ib,!0),ir("mouseup",ib,!0),ir("keydown",ib,!0),ir("scroll",ib,!0),ig=!0)},[]),il(()=>iv)),o=n.onMouseMove,s=im(t),l=il(t=>{if((null==o||o(t),!t.defaultPrevented&&a())&&s(t)){if(!iV(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!iQ(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),u=n.onMouseLeave,c=im(r),d=il(t=>{var r;let n;null==u||u(t),!t.defaultPrevented&&a()&&((n=aL(t))&&nG(t.currentTarget,n)||function(e){let t=aL(e);if(!t)return!1;do{if(nX(t,aO)&&t[aO])return!0;t=t.parentElement}while(t)return!1}(t)||!s(t)||c(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),f=(0,h.useCallback)(e=>{e&&(e[aO]=!0)},[]);return n0(n={...n,ref:iu(f,n.ref),onMouseMove:l,onMouseLeave:d})});iS(ix(function(e){return iE("div",a_(e))}));var aP=iM(function({store:e,shouldRegisterItem:t=!0,getItem:r=nY,element:n,...i}){let a=iR();e=e||a;let o=ic(i.id),s=(0,h.useRef)(n);return(0,h.useEffect)(()=>{let n=s.current;if(!o||!n||!t)return;let i=r({id:o,element:n});return null==e?void 0:e.renderItem(i)},[o,t,r,e]),n0(i={...i,ref:iu(s,i.ref)})});function ak(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?nO(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(nO(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}ix(function(e){return iE("div",aP(e))});var aH=Symbol("command"),aj=iM(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let n,i,a=(0,h.useRef)(null),[o,s]=(0,h.useState)(!1);(0,h.useEffect)(()=>{a.current&&s(nO(a.current))},[]);let[l,u]=(0,h.useState)(!1),c=(0,h.useRef)(!1),d=n$(r),[f,m]=(n=r.onLoadedMetadataCapture,i=(0,h.useMemo)(()=>Object.assign(()=>{},{...n,[aH]:!0}),[n,aH,!0]),[null==n?void 0:n[aH],{onLoadedMetadataCapture:i}]),p=r.onKeyDown,A=il(r=>{null==p||p(r);let n=r.currentTarget;if(r.defaultPrevented||f||d||!n6(r)||nk(n)||n.isContentEditable)return;let i=e&&"Enter"===r.key,a=t&&" "===r.key,o="Enter"===r.key&&!e,s=" "===r.key&&!t;if(o||s)return void r.preventDefault();if(i||a){let e=ak(r);if(i){if(!e){r.preventDefault();let{view:e,...t}=r,i=()=>n7(n,t);nR&&/firefox\//i.test(navigator.userAgent)?it(n,"keyup",i):queueMicrotask(i)}}else a&&(c.current=!0,e||(r.preventDefault(),u(!0)))}}),g=r.onKeyUp,v=il(e=>{if(null==g||g(e),e.defaultPrevented||f||d||e.metaKey)return;let r=t&&" "===e.key;if(c.current&&r&&(c.current=!1,!ak(e))){e.preventDefault(),u(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>n7(t,n))}});return i9(r={"data-active":l||void 0,type:o?"button":void 0,...m,...r,ref:iu(a,r.ref),onKeyDown:A,onKeyUp:v})});ix(function(e){return iE("button",aj(e))});var{useSyncExternalStore:aU}=e.i(2239).default,aN=()=>()=>{};function aJ(e,t=nY){let r=h.useCallback(t=>e?aS(e,null,t):aN(),[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&&nX(i,r)?i[r]:void 0};return aU(r,n,n)}function aK(e,t){let r=h.useRef({}),n=h.useCallback(t=>e?aS(e,null,t):aN(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!nX(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return aU(n,i,i)}function aQ(e,t,r,n){var i;let a,o=nX(t,r)?t[r]:void 0,s=(i={value:o,setValue:n?t[n]:void 0},a=(0,h.useRef)(i),is(()=>{a.current=i}),a);is(()=>aE(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),is(()=>{if(void 0!==o)return e.setState(r,o),aM(e,[r],()=>{void 0!==o&&e.setState(r,o)})})}function aV(e,t){let[r,n]=h.useState(()=>e(t));is(()=>ax(r),[r]);let i=h.useCallback(e=>aJ(r,e),[r]);return[h.useMemo(()=>({...r,useState:i}),[r,i]),il(()=>{n(r=>e({...t,...r.getState()}))})]}function aq(e,t,r,n=!1){var i;let a,o;if(!t||!r)return;let{renderedItems:s}=t.getState(),l=nN(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),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(l,n);for(let e=0;e=0){void 0!==o&&ot||(e&&(null==m?void 0:m.baseElement)&&m.baseElement===e.baseElement?m.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===c,ariaSetSize:e=>null!=o?o:e&&(null==m?void 0:m.ariaSetSize)&&m.baseElement===e.baseElement?m.ariaSetSize:void 0,ariaPosInSet(e){if(null!=s)return s;if(!e||!(null==m?void 0:m.ariaPosInSet)||m.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===A);return m.ariaPosInSet+t.findIndex(e=>e.id===c)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(i)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===c}}),b=(0,h.useCallback)(e=>{var t;let r={...e,id:c||e.id,rowId:A,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return a?a(r):r},[c,A,p,a]),x=l.onFocus,S=(0,h.useRef)(!1),E=il(t=>{var r,n;if(null==x||x(t),t.defaultPrevented||n8(t)||!c||!e||(r=e,!n6(t)&&nV(r,t.target)))return;let{virtualFocus:i,baseElement:a}=e.getState();e.setActiveId(c),nH(t.currentTarget)&&function(e,t=!1){if(nk(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=nw(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!i||!n6(t)||!nH(n=t.currentTarget)&&("INPUT"!==n.tagName||nO(n))&&(null==a?void 0:a.isConnected)&&((n5()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),S.current=!0,t.relatedTarget===a||nV(e,t.relatedTarget))?(a[nQ]=!0,a.focus({preventScroll:!0})):a.focus())}),M=l.onBlurCapture,F=il(t=>{if(null==M||M(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&S.current&&(S.current=!1,t.preventDefault(),t.stopPropagation())}),T=l.onKeyDown,R=im(r),w=im(n),D=il(t=>{if(null==T||T(t),t.defaultPrevented||!n6(t)||!e)return;let{currentTarget:r}=t,n=e.getState(),i=e.item(c),a=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,s="vertical"!==n.orientation,l=()=>!(!a&&!s&&n.baseElement&&nk(n.baseElement)),u={ArrowUp:(a||o)&&e.up,ArrowRight:(a||s)&&e.next,ArrowDown:(a||o)&&e.down,ArrowLeft:(a||s)&&e.previous,Home:()=>{if(l())return!a||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(l())return!a||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>aq(r,e,null==e?void 0:e.up,!0),PageDown:()=>aq(r,e,null==e?void 0:e.down)}[t.key];if(u){if(nH(r)){let e=nj(r),n=s&&"ArrowLeft"===t.key,i=s&&"ArrowRight"===t.key,a=o&&"ArrowUp"===t.key,l=o&&"ArrowDown"===t.key;if(i||l){let{length:t}=function(e){if(nk(e))return e.value;if(e.isContentEditable){let t=nw(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((n||a)&&0!==e.start)return}let n=u();if(R(t)||void 0!==n){if(!w(t))return;t.preventDefault(),e.move(n)}}}),I=(0,h.useMemo)(()=>({id:c,baseElement:g}),[c,g]);return l={id:c,"data-active-item":v||void 0,...l=ip(l,e=>(0,d.jsx)(iO.Provider,{value:I,children:e}),[I]),ref:iu(f,l.ref),tabIndex:B?l.tabIndex:-1,onFocus:E,onBlurCapture:F,onKeyDown:D},l=aj(l),n0({...l=aP({store:e,...l,getItem:b,shouldRegisterItem:!!c&&l.shouldRegisterItem}),"aria-setsize":y,"aria-posinset":C})});iS(ix(function(e){return iE("button",aX(e))}));var aW=iM(function({store:e,value:t,hideOnClick:r,setValueOnClick:n,selectValueOnClick:i=!0,resetValueOnSelect:a,focusOnHover:o=!1,moveOnKeyPress:s=!0,getItem:l,...u}){var c,f;let m=am();nz(e=e||m,!1);let{resetValueOnSelectState:p,multiSelectable:A,selected:g}=aK(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)}),v=(0,h.useCallback)(e=>{let r={...e,value:t};return l?l(r):r},[t,l]);n=null!=n?n:!A,r=null!=r?r:null!=t&&!A;let y=u.onClick,C=im(n),B=im(i),b=im(null!=(c=null!=a?a:p)?c:A),x=im(r),S=il(r=>{null==y||y(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=n3();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&&(B(r)&&(b(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),C(r)&&(null==e||e.setValue(t))),x(r)&&(null==e||e.hide()))}),E=u.onKeyDown,M=il(t=>{if(null==E||E(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||iQ(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),nk(r)&&(null==e||e.setValue(r.value)))});A&&null!=g&&(u={"aria-selected":g,...u}),u=ip(u,e=>(0,d.jsx)(av.Provider,{value:t,children:(0,d.jsx)(ay.Provider,{value:null!=g&&g,children:e})}),[t,g]),u={role:null!=(f=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,h.useContext)(ad)])?f:"option",children:t,...u,onClick:S,onKeyDown:M};let F=im(s);return u=aX({store:e,...u,getItem:v,moveOnKeyPress:t=>{if(!F(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=a_({store:e,focusOnHover:o,...u})}),aY=iS(ix(function(e){return iE("div",aW(e))})),az=e.i(74080);function aZ(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function a$(...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 a0(e,t,r){return!r&&!1!==t&&(!e||!!t)}var a1=iM(function({store:e,alwaysVisible:t,...r}){let n=i7();nz(e=e||n,!1);let i=(0,h.useRef)(null),a=ic(r.id),[o,s]=(0,h.useState)(null),l=e.useState("open"),u=e.useState("mounted"),c=e.useState("animated"),f=e.useState("contentElement"),m=aJ(e.disclosure,"contentElement");is(()=>{i.current&&(null==e||e.setContentElement(i.current))},[e]),is(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),is(()=>{if(c){var e;let t;return(null==f?void 0:f.isConnected)?(e=()=>{s(l?"enter":u?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void s(null)}},[c,f,l,u]),is(()=>{if(!e||!c||!o||!f)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,az.flushSync)(t);if("leave"===o&&l||"enter"===o&&!l)return;if("number"==typeof c)return aZ(c,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:s}=getComputedStyle(f),{transitionDuration:u="0",animationDuration:d="0",transitionDelay:h="0",animationDelay:p="0"}=m?getComputedStyle(m):{},A=a$(a,s,h,p)+a$(n,i,u,d);if(!A){"enter"===o&&e.setState("animated",!1),t();return}return aZ(Math.max(A-1e3/60,0),r)},[e,c,f,m,l,o]);let p=a0(u,(r=ip(r,t=>(0,d.jsx)(an,{value:e,children:t}),[e])).hidden,t),A=r.style,g=(0,h.useMemo)(()=>p?{...A,display:"none"}:A,[p,A]);return n0(r={id:a,"data-open":l||void 0,"data-enter":"enter"===o||void 0,"data-leave":"leave"===o||void 0,hidden:p,...r,ref:iu(a?e.setContentElement:null,i,r.ref),style:g})}),a2=ix(function(e){return iE("div",a1(e))});ix(function({unmountOnHide:e,...t}){let r=i7();return!1===aJ(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,d.jsx)(a2,{...t})});var a9=iM(function({store:e,alwaysVisible:t,...r}){let n=am(!0),i=ah(),a=!!(e=e||i)&&e===n;nz(e,!1);let o=(0,h.useRef)(null),s=ic(r.id),l=e.useState("mounted"),u=a0(l,r.hidden,t),c=u?{...r.style,display:"none"}:r.style,f=e.useState(e=>Array.isArray(e.selectedValue)),m=function(e,t,r){let n=function(e){let[t]=(0,h.useState)(e);return t}(r),[i,a]=(0,h.useState)(n);return(0,h.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},o=new MutationObserver(i);return o.observe(r,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,n]),i}(o,"role",r.role),p="listbox"===m||"tree"===m||"grid"===m,[A,g]=(0,h.useState)(!1),v=e.useState("contentElement");is(()=>{if(!l)return;let e=o.current;if(!e||v!==e)return;let t=()=>{g(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[l,v]),A||(r={role:"listbox","aria-multiselectable":p&&f||void 0,...r}),r=ip(r,t=>(0,d.jsx)(ag,{value:e,children:(0,d.jsx)(ad.Provider,{value:m,children:t})}),[e,m]);let y=!s||n&&a?null:e.setContentElement;return n0(r={id:s,hidden:u,...r,ref:iu(y,o,r.ref),style:c})}),a3=ix(function(e){return iE("div",a9(e))}),a5=(0,h.createContext)(null),a8=iM(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}}});ix(function(e){return iE("span",a8(e))});var a6=iM(function(e){return a8(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),a4=ix(function(e){return iE("span",a6(e))});function a7(e){queueMicrotask(()=>{null==e||e.focus()})}var oe=iM(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:n,portal:i=!0,...a}){let o=(0,h.useRef)(null),s=iu(o,a.ref),l=(0,h.useContext)(a5),[u,c]=(0,h.useState)(null),[f,m]=(0,h.useState)(null),p=(0,h.useRef)(null),A=(0,h.useRef)(null),g=(0,h.useRef)(null),v=(0,h.useRef)(null);return is(()=>{let e=o.current;if(!e||!i)return void c(null);let t=r?"function"==typeof r?r(e):r:nw(e).createElement("div");if(!t)return void c(null);let a=t.isConnected;if(a||(l||nw(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)}`}()),c(t),n2(n,t),!a)return()=>{t.remove(),n2(n,null)}},[i,r,l,n]),is(()=>{if(!i||!e||!t)return;let r=nw(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),m(r),()=>{r.remove(),m(null)}},[i,e,t]),(0,h.useEffect)(()=>{if(!u||!e)return;let t=0,r=e=>{if(!ie(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=u.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(u.hasAttribute("data-tabindex")&&t(u),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of iN(u,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return u.addEventListener("focusin",r,!0),u.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),u.removeEventListener("focusin",r,!0),u.removeEventListener("focusout",r,!0)}},[u,e]),a={...a=ip(a,t=>{if(t=(0,d.jsx)(a5.Provider,{value:u||l,children:t}),!i)return t;if(!u)return(0,d.jsx)("span",{ref:s,id:a.id,style:{position:"fixed"},hidden:!0});t=(0,d.jsxs)(d.Fragment,{children:[e&&u&&(0,d.jsx)(a4,{ref:A,"data-focus-trap":a.id,className:"__focus-trap-inner-before",onFocus:e=>{ie(e,u)?a7(iJ()):a7(p.current)}}),t,e&&u&&(0,d.jsx)(a4,{ref:g,"data-focus-trap":a.id,className:"__focus-trap-inner-after",onFocus:e=>{ie(e,u)?a7(iK()):a7(v.current)}})]}),u&&(t=(0,az.createPortal)(t,u));let r=(0,d.jsxs)(d.Fragment,{children:[e&&u&&(0,d.jsx)(a4,{ref:p,"data-focus-trap":a.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==v.current&&ie(e,u)?a7(A.current):a7(iK())}}),e&&(0,d.jsx)("span",{"aria-owns":null==u?void 0:u.id,style:{position:"fixed"}}),e&&u&&(0,d.jsx)(a4,{ref:v,"data-focus-trap":a.id,className:"__focus-trap-outer-after",onFocus:e=>{if(ie(e,u))a7(g.current);else{let e=iJ();if(e===A.current)return void requestAnimationFrame(()=>{var e;return null==(e=iJ())?void 0:e.focus()});a7(e)}}})]});return f&&e&&(r=(0,az.createPortal)(r,f)),(0,d.jsxs)(d.Fragment,{children:[r,t]})},[u,l,i,a.id,e,f]),ref:s}});ix(function(e){return iE("div",oe(e))});var ot=(0,h.createContext)(0);function or({level:e,children:t}){let r=(0,h.useContext)(ot),n=Math.max(Math.min(e||r+1,6),1);return(0,d.jsx)(ot.Provider,{value:n,children:t})}var on=iM(function({autoFocusOnShow:e=!0,...t}){return ip(t,t=>(0,d.jsx)(iP.Provider,{value:e,children:t}),[e])});ix(function(e){return iE("div",on(e))});var oi=new WeakMap;function oa(e,t,r){oi.has(e)||oi.set(e,new Map);let n=oi.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 a=r(),o=()=>{a(),i(),n.delete(t)};return n.set(t,o),()=>{n.get(t)===o&&(a(),n.set(t,i))}}function oo(e,t,r){return oa(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function os(e,t,r){return oa(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function ol(e,t){return e?oa(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var ou=["SCRIPT","STYLE"];function oc(e){return`__ariakit-dialog-snapshot-${e}`}function od(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),o=nw(i),s=i;for(;i.parentElement&&i!==o.body;){if(null==n||n(i.parentElement,s),!a)for(let n of i.parentElement.children)(function(e,t,r){return!ou.includes(t.tagName)&&!!function(e,t){let r=nw(t),n=oc(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&nG(t,e))})(e,n,t)&&r(n,s);i=i.parentElement}}}function of(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 oh(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function om(e,t=""){return nW(os(e,oh("",!0),!0),os(e,oh(t,!0),!0))}function op(e,t){if(e[oh(t,!0)])return!0;let r=oh(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function oA(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return od(e,t,t=>{of(t,...n)||r.unshift(function(e,t=""){return nW(os(e,oh(),!0),os(e,oh(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(om(t,e))}),()=>{for(let e of r)e()}}function og({store:e,type:t,listener:r,capture:n,domReady:i}){let a=il(r),o=aJ(e,"open"),s=(0,h.useRef)(!1);is(()=>{if(!o||!i)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{s.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,o,i]),(0,h.useEffect)(()=>{if(o)return ir(t,t=>{let{contentElement:r,disclosureElement:n}=e.getState(),i=t.target;!r||!i||!(!("HTML"===i.tagName||nG(nw(i).body,i))||nG(r,i)||function(e,t){if(!e)return!1;if(nG(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=nw(e).getElementById(r);if(t)return nG(e,t)}return!1}(n,i)||i.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))&&(!s.current||op(i,r.id))&&(i&&i[iY]||a(t))},n)},[o,n])}function ov(e,t){return"function"==typeof e?e(t):!!e}var oy=(0,h.createContext)({});function oC(){return"inert"in HTMLElement.prototype}function oB(e,t){if(!("style"in e))return nq;if(oC())return os(e,"inert",!0);let r=iN(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&nG(t,e)))return nq;let r=oa(e,"focus",()=>(e.focus=nq,()=>{delete e.focus}));return nW(oo(e,"tabindex","-1"),r)});return nW(...r,oo(e,"aria-hidden","true"),ol(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function ob(e={}){let t=aT(e.store,aF(e.disclosure,["contentElement","disclosureElement"]));aR(e,t);let r=null==t?void 0:t.getState(),n=n1(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=n1(e.animated,null==r?void 0:r.animated,!1),a=aB({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:n1(null==r?void 0:r.contentElement,null),disclosureElement:n1(null==r?void 0:r.disclosureElement,null)},t);return ab(a,()=>aE(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),ab(a,()=>aS(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),ab(a,()=>aE(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)}}function ox(e,t,r){return id(t,[r.store,r.disclosure]),aQ(e,r,"open","setOpen"),aQ(e,r,"mounted","setMounted"),aQ(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}iM(function(e){return e});var oS=ix(function(e){return iE("div",e)});function oE({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let i=(0,h.useRef)(null),a=function(e={}){let[t,r]=aV(ob,e);return ox(t,r,e)}({disclosure:e}),o=aJ(e,"contentElement");(0,h.useEffect)(()=>{let e=i.current;!e||o&&(e.style.zIndex=getComputedStyle(o).zIndex)},[o]),is(()=>{let e=null==o?void 0:o.id;if(!e)return;let t=i.current;if(t)return om(t,e)},[o]);let s=a1({ref:i,store:a,role:"presentation","data-backdrop":(null==o?void 0:o.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,h.isValidElement)(t))return(0,d.jsx)(oS,{...s,render:t});let l="boolean"!=typeof t?t:"div";return(0,d.jsx)(oS,{...s,render:(0,d.jsx)(l,{})})}function oM(e={}){return ob(e)}Object.assign(oS,["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]=ix(function(e){return iE(t,e)}),e),{}));var oF=n5();function oT(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?iH(r)?r:null:r:null}var oR=iM(function({store:e,open:t,onClose:r,focusable:n=!0,modal:i=!0,portal:a=!!i,backdrop:o=!!i,hideOnEscape:s=!0,hideOnInteractOutside:l=!0,getPersistentElements:u,preventBodyScroll:c=!!i,autoFocusOnShow:f=!0,autoFocusOnHide:m=!0,initialFocus:p,finalFocus:A,unmountOnHide:g,unstable_treeSnapshotKey:v,...y}){var C;let B,b,x,S=at(),E=(0,h.useRef)(null),M=function(e={}){let[t,r]=aV(oM,e);return ox(t,r,e)}({store:e||S,open:t,setOpen(e){if(e)return;let t=E.current;if(!t)return;let n=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&M.setOpen(!0)}}),{portalRef:F,domReady:T}=iA(a,y.portalRef),R=y.preserveTabOrder,w=aJ(M,e=>R&&!i&&e.mounted),D=ic(y.id),I=aJ(M,"open"),G=aJ(M,"mounted"),L=aJ(M,"contentElement"),O=a0(G,y.hidden,y.alwaysVisible);B=function({attribute:e,contentId:t,contentElement:r,enabled:n}){let[i,a]=ih(),o=(0,h.useCallback)(()=>{if(!n||!r)return!1;let{body:i}=nw(r),a=i.getAttribute(e);return!a||a===t},[i,n,r,e,t]);return(0,h.useEffect)(()=>{if(!n||!t||!r)return;let{body:i}=nw(r);if(o())return i.setAttribute(e,t),()=>i.removeAttribute(e);let s=new MutationObserver(()=>(0,az.flushSync)(a));return s.observe(i,{attributeFilter:[e]}),()=>s.disconnect()},[i,n,t,r,o,e]),o}({attribute:"data-dialog-prevent-body-scroll",contentElement:L,contentId:D,enabled:c&&!O}),(0,h.useEffect)(()=>{var e,t;if(!B()||!L)return;let r=nw(L),n=nD(L),{documentElement:i,body:a}=r,o=i.style.getPropertyValue("--scrollbar-width"),s=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,l=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=n3()&&!(nR&&navigator.platform.startsWith("Mac")&&!n9());return nW((e="--scrollbar-width",t=`${s}px`,i?oa(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:o}=n,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=ol(a,{position:"fixed",overflow:"hidden",top:`${-(i-Math.floor(c))}px`,left:`${-(r-Math.floor(u))}px`,right:"0",[l]:`${s}px`});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():ol(a,{overflow:"hidden",[l]:`${s}px`}))},[B,L]),C=aJ(M,"open"),b=(0,h.useRef)(),(0,h.useEffect)(()=>{if(!C){b.current=null;return}return ir("mousedown",e=>{b.current=e.target},!0)},[C]),og({...x={store:M,domReady:T,capture:!0},type:"click",listener:e=>{let{contentElement:t}=M.getState(),r=b.current;r&&nP(r)&&op(r,null==t?void 0:t.id)&&ov(l,e)&&M.hide()}}),og({...x,type:"focusin",listener:e=>{let{contentElement:t}=M.getState();!t||e.target===nw(t)||ov(l,e)&&M.hide()}}),og({...x,type:"contextmenu",listener:e=>{ov(l,e)&&M.hide()}});let{wrapElement:_,nestedDialogs:P}=function(e){let t=(0,h.useContext)(oy),[r,n]=(0,h.useState)([]),i=(0,h.useCallback)(e=>{var r;return n(t=>[...t,e]),nW(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);is(()=>aE(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 a=(0,h.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,h.useCallback)(e=>(0,d.jsx)(oy.Provider,{value:a,children:e}),[a]),nestedDialogs:r}}(M);y=ip(y,_,[_]),is(()=>{if(!I)return;let e=E.current,t=nI(e,!0);!t||"BODY"===t.tagName||e&&nG(e,t)||M.setDisclosureElement(t)},[M,I]),oF&&(0,h.useEffect)(()=>{if(!G)return;let{disclosureElement:e}=M.getState();if(!e||!nO(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),it(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||iq(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[M,G]),(0,h.useEffect)(()=>{if(!G||!T)return;let e=E.current;if(!e)return;let t=nD(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)}},[G,T]),(0,h.useEffect)(()=>{if(!i||!G||!T)return;let e=E.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=M.hide,(r=nw(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()}}},[M,i,G,T]),is(()=>{if(!oC()||I||!G||!T)return;let e=E.current;if(e)return oB(e)},[I,G,T]);let k=I&&T;is(()=>{if(D&&k)return function(e,t){let{body:r}=nw(t[0]),n=[];return od(e,t,t=>{n.push(os(t,oc(e),!0))}),nW(os(r,oc(e),!0),()=>{for(let e of n)e()})}(D,[E.current])},[D,k,v]);let H=il(u);is(()=>{if(!D||!k)return;let{disclosureElement:e}=M.getState(),t=[E.current,...H()||[],...P.map(e=>e.getState().contentElement)];if(i){let e,r;return nW(oA(D,t),(e=[],r=t.map(e=>null==e?void 0:e.id),od(D,t,n=>{of(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(oB(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&nG(e,r))||e.unshift(oo(r,"role","none"))}),()=>{for(let t of e)t()}))}return oA(D,[e,...t])},[D,M,k,H,P,i,v]);let j=!!f,U=im(f),[N,J]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!I||!j||!T||!(null==L?void 0:L.isConnected))return;let e=oT(p,!0)||L.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=iN(e,t,r);return n||null}(L,!0,a&&w)||L,t=iH(e);U(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!oF||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[I,j,T,L,p,a,w,U]);let K=!!m,Q=im(m),[V,q]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(I)return q(!0),()=>q(!1)},[I]);let X=(0,h.useCallback)((e,t=!0)=>{let r,{disclosureElement:n}=M.getState();if(!(!(r=nI())||e&&nG(e,r))&&iH(r))return;let i=oT(A)||n;if(null==i?void 0:i.id){let e=nw(i),t=`[aria-activedescendant="${i.id}"]`,r=e.querySelector(t);r&&(i=r)}if(i&&!iH(i)){let e=i.closest("[data-dialog]");if(null==e?void 0:e.id){let t=nw(e),r=`[aria-controls~="${e.id}"]`,n=t.querySelector(r);n&&(i=n)}}let a=i&&iH(i);!a&&t?requestAnimationFrame(()=>X(e,!1)):!Q(a?i:null)||a&&(null==i||i.focus({preventScroll:!0}))},[M,A,Q]),W=(0,h.useRef)(!1);is(()=>{if(I||!V||!K)return;let e=E.current;W.current=!0,X(e)},[I,V,T,K,X]),(0,h.useEffect)(()=>{if(!V||!K)return;let e=E.current;return()=>{if(W.current){W.current=!1;return}X(e)}},[V,K,X]);let Y=im(s);(0,h.useEffect)(()=>{if(T&&G)return ir("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=E.current;if(!t||op(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=M.getState();!("BODY"===r.tagName||nG(t,r)||!n||nG(n,r))||Y(e)&&M.hide()},!0)},[M,T,G,Y]);let z=(y=ip(y,e=>(0,d.jsx)(or,{level:i?1:void 0,children:e}),[i])).hidden,Z=y.alwaysVisible;y=ip(y,e=>o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(oE,{store:M,backdrop:o,hidden:z,alwaysVisible:Z}),e]}):e,[M,o,z,Z]);let[$,ee]=(0,h.useState)(),[et,er]=(0,h.useState)();return y=on({...y={id:D,"data-dialog":"",role:"dialog",tabIndex:n?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...y=ip(y,e=>(0,d.jsx)(an,{value:M,children:(0,d.jsx)(ai.Provider,{value:ee,children:(0,d.jsx)(aa.Provider,{value:er,children:e})})}),[M]),ref:iu(E,y.ref)},autoFocusOnShow:N}),y=oe({portal:a,...y=i9({...y=a1({store:M,...y}),focusable:n}),portalRef:F,preserveTabOrder:w})});function ow(e,t=at){return ix(function(r){let n=t();return aJ(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,d.jsx)(e,{...r}):null})}ow(ix(function(e){return iE("div",oR(e))}),at);let oD=Math.min,oI=Math.max,oG=Math.round,oL=Math.floor,oO=e=>({x:e,y:e}),o_={left:"right",right:"left",bottom:"top",top:"bottom"},oP={start:"end",end:"start"};function ok(e,t){return"function"==typeof e?e(t):e}function oH(e){return e.split("-")[0]}function oj(e){return e.split("-")[1]}function oU(e){return"x"===e?"y":"x"}function oN(e){return"y"===e?"height":"width"}let oJ=new Set(["top","bottom"]);function oK(e){return oJ.has(oH(e))?"y":"x"}function oQ(e){return e.replace(/start|end/g,e=>oP[e])}let oV=["left","right"],oq=["right","left"],oX=["top","bottom"],oW=["bottom","top"];function oY(e){return e.replace(/left|right|bottom|top/g,e=>o_[e])}function oz(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oZ(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 o$(e,t,r){let n,{reference:i,floating:a}=e,o=oK(t),s=oU(oK(t)),l=oN(s),u=oH(t),c="y"===o,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,h=i[l]/2-a[l]/2;switch(u){case"top":n={x:d,y:i.y-a.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-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(oj(t)){case"start":n[s]-=h*(r&&c?-1:1);break;case"end":n[s]+=h*(r&&c?-1:1)}return n}let o0=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,s=a.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=o$(u,n,l),f=n,h={},m=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let ss=["transform","translate","scale","rotate","perspective"],sl=["transform","translate","scale","rotate","perspective","filter"],su=["paint","layout","strict","content"];function sc(e){let t=sd(),r=o7(e)?sm(e):e;return ss.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||sl.some(e=>(r.willChange||"").includes(e))||su.some(e=>(r.contain||"").includes(e))}function sd(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let sf=new Set(["html","body","#document"]);function sh(e){return sf.has(o5(e))}function sm(e){return o8(e).getComputedStyle(e)}function sp(e){return o7(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sA(e){if("html"===o5(e))return e;let t=e.assignedSlot||e.parentNode||st(e)&&e.host||o6(e);return st(t)?t.host:t}function sg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=sA(t);return sh(r)?t.ownerDocument?t.ownerDocument.body:t.body:se(r)&&sn(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=o8(i);if(a){let e=sv(o);return t.concat(o,o.visualViewport||[],sn(i)?i:[],e&&r?sg(e):[])}return t.concat(i,sg(i,[],r))}function sv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sy(e){let t=sm(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=se(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,s=oG(r)!==a||oG(n)!==o;return s&&(r=a,n=o),{width:r,height:n,$:s}}function sC(e){return o7(e)?e:e.contextElement}function sB(e){let t=sC(e);if(!se(t))return oO(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=sy(t),o=(a?oG(r.width):r.width)/n,s=(a?oG(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let sb=oO(0);function sx(e){let t=o8(e);return sd()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:sb}function sS(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=sC(e),s=oO(1);t&&(n?o7(n)&&(s=sB(n)):s=sB(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===o8(o))&&i)?sx(o):oO(0),u=(a.left+l.x)/s.x,c=(a.top+l.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){let e=o8(o),t=n&&o7(n)?o8(n):n,r=e,i=sv(r);for(;i&&n&&t!==r;){let e=sB(i),t=i.getBoundingClientRect(),n=sm(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=o,i=sv(r=o8(i))}}return oZ({width:d,height:f,x:u,y:c})}function sE(e,t){let r=sp(e).scrollLeft;return t?t.left+r:sS(o6(e)).left+r}function sM(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-sE(e,r),y:r.top+t.scrollTop}}let sF=new Set(["absolute","fixed"]);function sT(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=o8(e),n=o6(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=sd();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}let u=sE(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,a,o,s,l,u;n=o6(e),t=o6(n),r=sp(n),a=n.ownerDocument.body,o=oI(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=oI(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),l=-r.scrollLeft+sE(n),u=-r.scrollTop,"rtl"===sm(a).direction&&(l+=oI(t.clientWidth,a.clientWidth)-o),i={width:o,height:s,x:l,y:u}}else if(o7(t)){let e,n,a,o,s,l;n=(e=sS(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=se(t)?sB(t):oO(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,i={width:s,height:l,x:a*o.x,y:n*o.y}}else{let r=sx(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oZ(i)}function sR(e){return"static"===sm(e).position}function sw(e,t){if(!se(e)||"fixed"===sm(e).position)return null;if(t)return t(e);let r=e.offsetParent;return o6(e)===r&&(r=r.ownerDocument.body),r}function sD(e,t){var r;let n=o8(e);if(so(e))return n;if(!se(e)){let t=sA(e);for(;t&&!sh(t);){if(o7(t)&&!sR(t))return t;t=sA(t)}return n}let i=sw(e,t);for(;i&&(r=i,si.has(o5(r)))&&sR(i);)i=sw(i,t);return i&&sh(i)&&sR(i)&&!sc(i)?n:i||function(e){let t=sA(e);for(;se(t)&&!sh(t);){if(sc(t))return t;if(so(t))break;t=sA(t)}return null}(e)||n}let sI=async function(e){let t=this.getOffsetParent||sD,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=se(t),i=o6(t),a="fixed"===r,o=sS(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=oO(0);if(n||!n&&!a)if(("body"!==o5(t)||sn(i))&&(s=sp(t)),n){let e=sS(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=sE(i));a&&!n&&i&&(l.x=sE(i));let u=!i||n||a?oO(0):sM(i,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},sG={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=o6(n),s=!!t&&so(t.floating);if(n===o||s&&a)return r;let l={scrollLeft:0,scrollTop:0},u=oO(1),c=oO(0),d=se(n);if((d||!d&&!a)&&(("body"!==o5(n)||sn(o))&&(l=sp(n)),se(n))){let e=sS(n);u=sB(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?oO(0):sM(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-l.scrollTop*u.y+c.y+f.y}},getDocumentElement:o6,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?so(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=sg(e,[],!1).filter(e=>o7(e)&&"body"!==o5(e)),i=null,a="fixed"===sm(e).position,o=a?sA(e):e;for(;o7(o)&&!sh(o);){let t=sm(o),r=sc(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&sF.has(i.position)||sn(o)&&!r&&function e(t,r){let n=sA(t);return!(n===r||!o7(n)||sh(n))&&("fixed"===sm(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=sA(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],s=a.reduce((e,r)=>{let n=sT(t,r,i);return e.top=oI(n.top,e.top),e.right=oD(n.right,e.right),e.bottom=oD(n.bottom,e.bottom),e.left=oI(n.left,e.left),e},sT(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:sD,getElementRects:sI,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=sy(e);return{width:t,height:r}},getScale:sB,isElement:o7,isRTL:function(e){return"rtl"===sm(e).direction}};function sL(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sO(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 s_(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function sP(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var sk=iM(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:n=!0,autoFocusOnShow:i=!0,wrapperProps:a,fixed:o=!1,flip:s=!0,shift:l=0,slide:u=!0,overlap:c=!1,sameWidth:f=!1,fitViewport:m=!1,gutter:p,arrowPadding:A=4,overflowPadding:g=8,getAnchorRect:v,updatePosition:y,...C}){let B=as();nz(e=e||B,!1);let b=e.useState("arrowElement"),x=e.useState("anchorElement"),S=e.useState("disclosureElement"),E=e.useState("popoverElement"),M=e.useState("contentElement"),F=e.useState("placement"),T=e.useState("mounted"),R=e.useState("rendered"),w=(0,h.useRef)(null),[D,I]=(0,h.useState)(!1),{portalRef:G,domReady:L}=iA(r,C.portalRef),O=il(v),_=il(y),P=!!y;is(()=>{if(!(null==E?void 0:E.isConnected))return;E.style.setProperty("--popover-overflow-padding",`${g}px`);let t={contextElement:x||void 0,getBoundingClientRect:()=>{let e=null==O?void 0:O(x);return e||!x?function(e){if(!e)return sO();let{x:t,y:r,width:n,height:i}=e;return sO(t,r,n,i)}(e):x.getBoundingClientRect()}},r=async()=>{var r,n,i,a,d;let h,v,y;if(!T)return;b||(w.current=w.current||document.createElement("div"));let C=b||w.current,B=[(r={gutter:p,shift:l},void 0===(n=({placement:e})=>{var t;let n=((null==C?void 0:C.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:a,placement:o,middlewareData:s}=e,l=await o9(e,n);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return nz(!r||r.every(s_),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,o,s,l,u;let c,d,f,{placement:h,middlewareData:m,rects:p,initialPlacement:A,platform:g,elements:v}=e,{mainAxis:y=!0,crossAxis:C=!0,fallbackPlacements:B,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...E}=ok(t,e);if(null!=(r=m.arrow)&&r.alignmentOffset)return{};let M=oH(h),F=oK(A),T=oH(A)===A,R=await (null==g.isRTL?void 0:g.isRTL(v.floating)),w=B||(T||!S?[oY(A)]:(c=oY(A),[oQ(A),c,oQ(c)])),D="none"!==x;!B&&D&&w.push(...(d=oj(A),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?oq:oV;return t?oV:oq;case"left":case"right":return t?oX:oW;default:return[]}}(oH(A),"start"===x,R),d&&(f=f.map(e=>e+"-"+d),S&&(f=f.concat(f.map(oQ)))),f));let I=[A,...w],G=await o1(e,E),L=[],O=(null==(n=m.flip)?void 0:n.overflows)||[];if(y&&L.push(G[M]),C){let e,t,r,n,i=(s=h,l=p,void 0===(u=R)&&(u=!1),e=oj(s),r=oN(t=oU(oK(s))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(n=oY(n)),[n,oY(n)]);L.push(G[i[0]],G[i[1]])}if(O=[...O,{placement:h,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=m.flip)?void 0:i.index)||0)+1,t=I[e];if(t&&("alignment"!==C||F===oK(t)||O.every(e=>oK(e.placement)!==F||e.overflows[0]>0)))return{data:{index:e,overflows:O},reset:{placement:t}};let r=null==(a=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(b){case"bestFit":{let e=null==(o=O.filter(e=>{if(D){let t=oK(e.placement);return t===F||"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:o[0];e&&(r=e);break}case"initialPlacement":r=A}if(h!==r)return{reset:{placement:r}}}return{}}}}({flip:s,overflowPadding:g}),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:a,middlewareData:o}=e,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=ok(t,e),c={x:r,y:n},d=oK(i),f=oU(d),h=c[f],m=c[d],p=ok(s,e),A="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+A.mainAxis,r=a.reference[f]+a.reference[e]-A.mainAxis;hr&&(h=r)}if(u){var g,v;let e="y"===f?"width":"height",t=o2.has(oH(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(g=o.offset)?void 0:g[d])||0)+(t?0:A.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[d])||0)-(t?A.crossAxis:0);mn&&(m=n)}return{[f]:h,[d]:m}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=ok(r,e),u={x:t,y:n},c=await o1(e,l),d=oK(oH(i)),f=oU(d),h=u[f],m=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+c[e],n=h-c[t];h=oI(r,oD(h,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=m+c[e],n=m-c[t];m=oI(r,oD(m,n))}let p=s.fn({...e,[f]:h,[d]:m});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[f]:a,[d]:o}}}}}}}({slide:u,shift:l,overlap:c,overflowPadding:g}),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:a,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=ok(r,e)||{};if(null==u)return{};let d=oz(c),f={x:t,y:n},h=oU(oK(i)),m=oN(h),p=await o.getDimensions(u),A="y"===h,g=A?"clientHeight":"clientWidth",v=a.reference[m]+a.reference[h]-f[h]-a.floating[m],y=f[h]-a.reference[h],C=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),B=C?C[g]:0;B&&await (null==o.isElement?void 0:o.isElement(C))||(B=s.floating[g]||a.floating[m]);let b=B/2-p[m]/2-1,x=oD(d[A?"top":"left"],b),S=oD(d[A?"bottom":"right"],b),E=B-p[m]-S,M=B/2-p[m]/2+(v/2-y/2),F=oI(x,oD(M,E)),T=!l.arrow&&null!=oj(i)&&M!==F&&a.reference[m]/2-(M{},...d}=ok(a,e),f=await o1(e,d),h=oH(o),m=oj(o),p="y"===oK(o),{width:A,height:g}=s.floating;"top"===h||"bottom"===h?(n=h,i=m===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(i=h,n="end"===m?"top":"bottom");let v=g-f.top-f.bottom,y=A-f.left-f.right,C=oD(g-f[n],v),B=oD(A-f[i],y),b=!e.middlewareData.shift,x=C,S=B;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(S=y),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=v),b&&!m){let e=oI(f.left,0),t=oI(f.right,0),r=oI(f.top,0),n=oI(f.bottom,0);p?S=A-2*(0!==e||0!==t?e+t:oI(f.left,f.right)):x=g-2*(0!==r||0!==n?r+n:oI(f.top,f.bottom))}await c({...e,availableWidth:S,availableHeight:x});let E=await l.getDimensions(u.floating);return A!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}],x=await (d={placement:F,strategy:o?"fixed":"absolute",middleware:B},h=new Map,y={...(v={platform:sG,...d}).platform,_c:h},o0(t,E,{...v,platform:y}));null==e||e.setState("currentPlacement",x.placement),I(!0);let S=sP(x.x),M=sP(x.y);if(Object.assign(E.style,{top:"0",left:"0",transform:`translate3d(${S}px,${M}px,0)`}),C&&x.middlewareData.arrow){let{x:e,y:t}=x.middlewareData.arrow,r=x.placement.split("-")[0],n=C.clientWidth/2,i=C.clientHeight/2,a=null!=e?e+n:-n,o=null!=t?t+i:-i;E.style.setProperty("--popover-transform-origin",{top:`${a}px calc(100% + ${i}px)`,bottom:`${a}px ${-i}px`,left:`calc(100% + ${n}px) ${o}px`,right:`${-n}px ${o}px`}[r]),Object.assign(C.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:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=sC(e),d=a||o?[...c?sg(c):[],...sg(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,n=null,i=o6(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(s||t(),!f||!h)return;let m={rootMargin:-oL(d)+"px "+-oL(i.clientWidth-(c+f))+"px "+-oL(i.clientHeight-(d+h))+"px "+-oL(c)+"px",threshold:oI(0,oD(1,l))||1},p=!0;function A(t){let n=t[0].intersectionRatio;if(n!==l){if(!p)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||sL(u,e.getBoundingClientRect())||o(),p=!1}try{n=new IntersectionObserver(A,{...m,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(A,m)}n.observe(e)}(!0),a}(c,r):null,h=-1,m=null;s&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),m.observe(t));let p=u?sS(e):null;return u&&function t(){let n=sS(e);p&&!sL(p,n)&&r(),p=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(i)}}(t,E,async()=>{P?(await _({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[e,R,E,b,x,E,F,T,L,o,s,l,u,c,f,m,p,A,g,O,P,_]),is(()=>{if(!T||!L||!(null==E?void 0:E.isConnected)||!(null==M?void 0:M.isConnected))return;let e=()=>{E.style.zIndex=getComputedStyle(M).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,E,M]);let k=o?"fixed":"absolute";return C=ip(C,t=>(0,d.jsx)("div",{...a,style:{position:k,top:0,left:0,width:"max-content",...null==a?void 0:a.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,k,a]),C={"data-placing":!D||void 0,...C=ip(C,t=>(0,d.jsx)(au,{value:e,children:t}),[e]),style:{position:"relative",...C.style}},C=oR({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:S||x,autoFocusOnShow:D&&i,...C,portalRef:G})});ow(ix(function(e){return iE("div",sk(e))}),as);var sH=iM(function({store:e,modal:t,tabIndex:r,alwaysVisible:n,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...o}){let s=ap();nz(e=e||s,!1);let l=e.useState("baseElement"),u=(0,h.useRef)(!1),c=aJ(e.tag,e=>null==e?void 0:e.renderedItems.length);return o=a9({store:e,alwaysVisible:n,...o}),o=sk({store:e,modal:t,alwaysVisible:n,backdrop:!1,autoFocusOnShow:!1,finalFocus:l,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:c,...o,getPersistentElements(){var r;let n=(null==(r=o.getPersistentElements)?void 0:r.call(o))||[];if(!t||!e)return n;let{contentElement:i,baseElement:a}=e.getState();if(!a)return n;let s=nw(a),l=[];if((null==i?void 0:i.id)&&l.push(`[aria-controls~="${i.id}"]`),(null==a?void 0:a.id)&&l.push(`[aria-controls~="${a.id}"]`),!l.length)return[...n,a];let u=l.join(",");return[...n,...s.querySelectorAll(u)]},autoFocusOnHide:e=>!nZ(i,e)&&(!u.current||(u.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&&(u.current="click"===t.type),l}})}),sj=ow(ix(function(e){return iE("div",sH(e))}),ap);(0,h.createContext)(null),(0,h.createContext)(null);var sU=iF([iG],[iL]),sN=sU.useContext;sU.useScopedContext,sU.useProviderContext,sU.ContextProvider,sU.ScopedContextProvider;var sJ={id:null};function sK(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function sQ(e,t){return e.filter(e=>e.rowId===t)}function sV(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 sq(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var sX=n5()&&n9();function sW({tag:e,...t}={}){let r=aT(t.store,function(e,...t){if(e)return aC(e,"pick")(...t)}(e,["value","rtl"]));aR(t,r);let n=null==e?void 0:e.getState(),i=null==r?void 0:r.getState(),a=n1(t.activeId,null==i?void 0:i.activeId,t.defaultActiveId,null),o=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),n=function(e={}){var t,r;aR(e,e.store);let n=null==(t=e.store)?void 0:t.getState(),i=n1(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:n1(null==n?void 0:n.renderedItems,[])},s=null==(r=e.store)?void 0:r.__unstablePrivateStore,l=aB({items:i,renderedItems:o.renderedItems},s),u=aB(o,e.store),c=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,a])=>{var o;let s=t(r),l=t(a);return s!==l&&s&&l?(o=s,l.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)?(e>i&&(n=!0),-1):(et):e);l.setState("renderedItems",i),u.setState("renderedItems",i)};ab(u,()=>ax(l)),ab(l,()=>aM(l,["items"],e=>{u.setState("items",e.items)})),ab(l,()=>aM(l,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return nw(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=(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})}},f=e=>d(e,e=>l.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>nW(f(e),d(e,e=>l.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=l.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:l}}(e),i=n1(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=aB({...n.getState(),id:n1(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:n1(null==r?void 0:r.baseElement,null),includesBaseElement:n1(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:n1(null==r?void 0:r.moves,0),orientation:n1(e.orientation,null==r?void 0:r.orientation,"both"),rtl:n1(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:n1(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:n1(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:n1(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:n1(e.focusShift,null==r?void 0:r.focusShift,!1)},n,e.store);ab(a,()=>aE(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=sK(e.renderedItems))?void 0:r.id})}));let o=(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:h=i.rtl}=t,m="up"===e||"down"===e,p="next"===e||"down"===e,A=m?i3(function(e,t,r){let n=sq(e);for(let i of e)for(let e=0;ee.id===s);if(!g)return null==(n=sK(A))?void 0:n.id;let v=A.some(e=>e.rowId),y=A.indexOf(g),C=A.slice(y+1),B=sQ(C,g.rowId);if(o){let e=B.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&&(m?"horizontal"!==u:"vertical"!==u),x=v&&c&&(m?"horizontal"!==c:"vertical"!==c),S=p?(!v||m)&&b&&d:!!m&&d;if(b){let e=sK(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[sJ]:[],...e.slice(0,n)]}(x&&!S?A:sQ(A,g.rowId),s,S),s);return null==e?void 0:e.id}if(x){let e=sK(S?B:C,s);return S?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let E=sK(B,s);return!E&&S?null:null==E?void 0:E.id};return{...n,...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=sK(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=sK(i5(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:a,includesBaseElement:n1(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:n1(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:n1(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:n1(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:n1(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),s=function({popover:e,...t}={}){let r=aT(t.store,aF(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));aR(t,r);let n=null==r?void 0:r.getState(),i=oM({...t,store:r}),a=n1(t.placement,null==n?void 0:n.placement,"bottom"),o=aB({...i.getState(),placement:a,currentPlacement:a,anchorElement:n1(null==n?void 0:n.anchorElement,null),popoverElement:n1(null==n?void 0:n.popoverElement,null),arrowElement:n1(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:n1(t.placement,null==i?void 0:i.placement,"bottom-start")}),l=n1(t.value,null==i?void 0:i.value,t.defaultValue,""),u=n1(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...s.getState(),value:l,selectedValue:u,resetValueOnSelect:n1(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:n1(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=aB(d,o,s,r);return sX&&ab(f,()=>aE(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),ab(f,()=>{if(e)return nW(aE(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),aE(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),ab(f,()=>aE(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",l)})),ab(f,()=>aE(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),ab(f,()=>aE(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),ab(f,()=>aM(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=o.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...s,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function sY(e={}){var t,r,n,i,a,o,s,l;let u;t=e,u=sN();let[c,d]=aV(sW,e={id:ic((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return id(d,[(n=e).tag]),aQ(c,n,"value","setValue"),aQ(c,n,"selectedValue","setSelectedValue"),aQ(c,n,"resetValueOnHide"),aQ(c,n,"resetValueOnSelect"),Object.assign((o=c,id(s=d,[(l=n).popover]),aQ(o,l,"placement"),i=ox(o,s,l),a=i,id(d,[n.store]),aQ(a,n,"items","setItems"),aQ(i=a,n,"activeId","setActiveId"),aQ(i,n,"includesBaseElement"),aQ(i,n,"virtualFocus"),aQ(i,n,"orientation"),aQ(i,n,"rtl"),aQ(i,n,"focusLoop"),aQ(i,n,"focusWrap"),aQ(i,n,"focusShift"),i),{tag:n.tag})}function sz(e={}){let t=sY(e);return(0,d.jsx)(aA,{value:t,children:e.children})}var sZ=(0,h.createContext)(void 0),s$=iM(function(e){let[t,r]=(0,h.useState)();return n0(e={role:"group","aria-labelledby":t,...e=ip(e,e=>(0,d.jsx)(sZ.Provider,{value:r,children:e}),[])})});ix(function(e){return iE("div",s$(e))});var s0=iM(function({store:e,...t}){return s$(t)});ix(function(e){return iE("div",s0(e))});var s1=iM(function({store:e,...t}){let r=am();return nz(e=e||r,!1),"grid"===nU(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=s0({store:e,...t})}),s2=ix(function(e){return iE("div",s1(e))}),s9=iM(function(e){let t=(0,h.useContext)(sZ),r=ic(e.id);return is(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),n0(e={id:r,"aria-hidden":!0,...e})});ix(function(e){return iE("div",s9(e))});var s3=iM(function({store:e,...t}){return s9(t)});ix(function(e){return iE("div",s3(e))});var s5=iM(function(e){return s3(e)}),s8=ix(function(e){return iE("div",s5(e))}),s6=e.i(38360);let s4={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},s7=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function le(e,t,r={}){let{keys:n,threshold:i=s4.MATCHES,baseSort:a=s7,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return n!==a?n>a?-1:1:i===o?r(e,t):i{let s=lt(i,u,c),l=t,{minRanking:d,maxRanking:f,threshold:h}=a;return s=s4.MATCHES?s=d:s>f&&(s=f),s>e&&(e=s,r=o,n=h,l=i),{rankedValue:l,rank:e,keyIndex:r,keyThreshold:n}},{rankedValue:s,rank:s4.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:lt(s,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:h=i}=d;return f>=h&&e.push({...d,item:a,index:o}),e},[])).map(({item:e})=>e)}function lt(e,t,r){if(e=lr(e,r),(t=lr(t,r)).length>e.length)return s4.NO_MATCH;if(e===t)return s4.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(),a=i.value;if(e.length===t.length&&0===a)return s4.EQUAL;if(0===a)return s4.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return s4.WORD_STARTS_WITH;o=n.next()}return a>0?s4.CONTAINS:1===t.length?s4.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return s4.NO_MATCH;return r=a-s,n=i/t.length,s4.MATCHES+1/r*n}(e,t)}function lr(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,s6.default)(e)),e}le.rankings=s4;let ln={maxRanking:1/0,minRanking:-1/0};var li=e.i(29402);let la=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),lo={"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)"},ls={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},ll=(0,rQ.getMissionList)().filter(e=>!la.has(e)).map(e=>{let t,r=(0,rQ.getMissionInfo)(e),[n]=(0,rQ.getSourceAndPath)(r.resourcePath),i=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",a=lo[n]??ls[i]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:a,missionTypes:r.missionTypes}}),lu=new Map(ll.map(e=>[e.missionName,e])),lc=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,li.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,li.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(ll),ld="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function lf(e){let t,r,n,i,a,o=(0,f.c)(12),{mission:s}=e,l=s.displayName||s.missionName;return o[0]!==l?(t=(0,d.jsx)("span",{className:"MissionSelect-itemName",children:l}),o[0]=l,o[1]=t):t=o[1],o[2]!==s.missionTypes?(r=s.missionTypes.length>0&&(0,d.jsx)("span",{className:"MissionSelect-itemTypes",children:s.missionTypes.map(lh)}),o[2]=s.missionTypes,o[3]=r):r=o[3],o[4]!==t||o[5]!==r?(n=(0,d.jsxs)("span",{className:"MissionSelect-itemHeader",children:[t,r]}),o[4]=t,o[5]=r,o[6]=n):n=o[6],o[7]!==s.missionName?(i=(0,d.jsx)("span",{className:"MissionSelect-itemMissionName",children:s.missionName}),o[7]=s.missionName,o[8]=i):i=o[8],o[9]!==n||o[10]!==i?(a=(0,d.jsxs)(d.Fragment,{children:[n,i]}),o[9]=n,o[10]=i,o[11]=a):a=o[11],a}function lh(e){return(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e)}function lm(e){let t,r,n,i,a,o,s,l,u,c,m,p,A,g,v,y,C,B=(0,f.c)(43),{value:b,missionType:x,onChange:S}=e,[E,M]=(0,h.useState)(""),F=(0,h.useRef)(null),T=(0,h.useRef)(x);B[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,h.startTransition)(()=>M(e))},B[0]=t):t=B[0];let R=sY({resetValueOnHide:!0,selectedValue:b,setSelectedValue:e=>{if(e){let t=T.current,r=(0,rQ.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),S({missionName:e,missionType:t}),F.current?.blur()}},setValue:t});B[1]!==R?(r=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),F.current?.focus(),R.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},n=[R],B[1]=R,B[2]=r,B[3]=n):(r=B[2],n=B[3]),(0,h.useEffect)(r,n),B[4]!==b?(i=lu.get(b),B[4]=b,B[5]=i):i=B[5];let w=i;e:{let e,t;if(!E){let e;B[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:lc},B[6]=e):e=B[6],a=e;break e}B[7]!==E?(e=le(ll,E,{keys:["displayName","missionName","missionTypes","groupName"]}),B[7]=E,B[8]=e):e=B[8];let r=e;B[9]!==r?(t={type:"flat",missions:r},B[9]=r,B[10]=t):t=B[10],a=t}let D=a,I=w?w.displayName||w.missionName:b,G="flat"===D.type?0===D.missions.length:0===D.groups.length,L=e=>(0,d.jsx)(aY,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(T.current=r,e.missionName===b&&S({missionName:e.missionName,missionType:r})):T.current=null}else T.current=null},children:(0,d.jsx)(lf,{mission:e})},e.missionName);B[11]!==R?(o=()=>{document.exitPointerLock(),R.show()},s=e=>{"Escape"!==e.key||R.getState().open||F.current?.blur()},B[11]=R,B[12]=o,B[13]=s):(o=B[12],s=B[13]),B[14]!==I||B[15]!==o||B[16]!==s?(l=(0,d.jsx)(aG,{ref:F,autoSelect:!0,placeholder:I,className:"MissionSelect-input",onFocus:o,onKeyDown:s}),B[14]=I,B[15]=o,B[16]=s,B[17]=l):l=B[17],B[18]!==I?(u=(0,d.jsx)("span",{className:"MissionSelect-selectedName",children:I}),B[18]=I,B[19]=u):u=B[19],B[20]!==x?(c=x&&(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":x,children:x}),B[20]=x,B[21]=c):c=B[21],B[22]!==c||B[23]!==u?(m=(0,d.jsxs)("div",{className:"MissionSelect-selectedValue",children:[u,c]}),B[22]=c,B[23]=u,B[24]=m):m=B[24],B[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,d.jsx)("kbd",{className:"MissionSelect-shortcut",children:ld?"⌘K":"^K"}),B[25]=p):p=B[25],B[26]!==m||B[27]!==l?(A=(0,d.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[l,m,p]}),B[26]=m,B[27]=l,B[28]=A):A=B[28];let O="flat"===D.type?D.missions.map(L):D.groups.map(e=>{let[t,r]=e;return t?(0,d.jsxs)(s2,{className:"MissionSelect-group",children:[(0,d.jsx)(s8,{className:"MissionSelect-groupLabel",children:t}),r.map(L)]},t):(0,d.jsx)(h.Fragment,{children:r.map(L)},"ungrouped")});return B[29]!==G?(g=G&&(0,d.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"}),B[29]=G,B[30]=g):g=B[30],B[31]!==a3||B[32]!==O||B[33]!==g?(v=(0,d.jsxs)(a3,{className:"MissionSelect-list",children:[O,g]}),B[31]=a3,B[32]=O,B[33]=g,B[34]=v):v=B[34],B[35]!==sj||B[36]!==v?(y=(0,d.jsx)(sj,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:"MissionSelect-popover",children:v}),B[35]=sj,B[36]=v,B[37]=y):y=B[37],B[38]!==sz||B[39]!==R||B[40]!==A||B[41]!==y?(C=(0,d.jsxs)(sz,{store:R,children:[A,y]}),B[38]=sz,B[39]=R,B[40]=A,B[41]=y,B[42]=C):C=B[42],C}var lp={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},lA=h.default.createContext&&h.default.createContext(lp),lg=["attr","size","title"];function lv(){return(lv=Object.assign.bind()).apply(this,arguments)}function ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lC(e){for(var t=1;th.default.createElement(lb,lv({attr:lC({},e.attr)},t),function e(t){return t&&t.map((t,r)=>h.default.createElement(t.tag,lC({key:r},t.attr),e(t.child)))}(e.child))}function lb(e){var t=t=>{var r,{attr:n,size:i,title:a}=e,o=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,lg),s=i||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),h.default.createElement("svg",lv({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,o,{className:r,style:lC(lC({color:e.color||t.color},t.style),e.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),a&&h.default.createElement("title",null,a),e.children)};return void 0!==lA?h.default.createElement(lA.Consumer,null,e=>t(e)):t(lp)}function lx(e){return lB({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:[]}]})(e)}function lS(e){return lB({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)}function lE(e){let t,r,n,i,a,o=(0,f.c)(11),{cameraRef:s,missionName:l,missionType:u}=e,{fogEnabled:c}=(0,eF.useSettings)(),[m,p]=(0,h.useState)(!1),A=(0,h.useRef)(null);o[0]!==s||o[1]!==c||o[2]!==l||o[3]!==u?(t=async()=>{clearTimeout(A.current);let e=s.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,i=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${i}`}(e),r=new URLSearchParams;r.set("mission",`${l}~${u}`),r.set("fog",c.toString());let n=`${window.location.pathname}?${r}${t}`,i=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(i),p(!0),A.current=setTimeout(()=>{p(!1)},1100)}catch(e){console.error(e)}},o[0]=s,o[1]=c,o[2]=l,o[3]=u,o[4]=t):t=o[4];let g=t,v=m?"true":"false";return o[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,d.jsx)(lx,{className:"MapPin"}),n=(0,d.jsx)(lS,{className:"ClipboardCheck"}),i=(0,d.jsx)("span",{className:"ButtonLabel",children:" Copy coordinates URL"}),o[5]=r,o[6]=n,o[7]=i):(r=o[5],n=o[6],i=o[7]),o[8]!==g||o[9]!==v?(a=(0,d.jsxs)("button",{type:"button",className:"IconButton LabelledButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:g,"data-copied":v,id:"copyCoordinatesButton",children:[r,n,i]}),o[8]=g,o[9]=v,o[10]=a):a=o[10],a}function lM(e){return lB({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)}function lF(e){let t,r,n,i,a,o,s,l,u,c,m,p,A,g,v,y,C,B,b,x,S,E,M,F,T,R,w,D,I,G,L,O,_,P,k,H,j,U,N,J,K,Q=(0,f.c)(94),{missionName:V,missionType:q,onChangeMission:X,cameraRef:W,isTouch:Y}=e,{fogEnabled:z,setFogEnabled:Z,fov:$,setFov:ee,audioEnabled:et,setAudioEnabled:er,animationEnabled:en,setAnimationEnabled:ei}=(0,eF.useSettings)(),{speedMultiplier:ea,setSpeedMultiplier:eo,touchMode:es,setTouchMode:el}=(0,eF.useControls)(),{debugMode:eu,setDebugMode:ec}=(0,eF.useDebug)(),[ed,ef]=(0,h.useState)(!1),eh=(0,h.useRef)(null),em=(0,h.useRef)(null),ep=(0,h.useRef)(null);Q[0]!==ed?(t=()=>{ed&&eh.current?.focus()},r=[ed],Q[0]=ed,Q[1]=t,Q[2]=r):(t=Q[1],r=Q[2]),(0,h.useEffect)(t,r),Q[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{let t=e.relatedTarget;t&&ep.current?.contains(t)||ef(!1)},Q[3]=n):n=Q[3];let eA=n;Q[4]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{"Escape"===e.key&&(ef(!1),em.current?.focus())},Q[4]=i):i=Q[4];let eg=i;Q[5]!==W||Q[6]!==V||Q[7]!==q?(a=(0,d.jsx)("div",{className:"Controls-group",children:(0,d.jsx)(lE,{cameraRef:W,missionName:V,missionType:q})}),Q[5]=W,Q[6]=V,Q[7]=q,Q[8]=a):a=Q[8],Q[9]!==Z?(o=e=>{Z(e.target.checked)},Q[9]=Z,Q[10]=o):o=Q[10],Q[11]!==z||Q[12]!==o?(s=(0,d.jsx)("input",{id:"fogInput",type:"checkbox",checked:z,onChange:o}),Q[11]=z,Q[12]=o,Q[13]=s):s=Q[13],Q[14]===Symbol.for("react.memo_cache_sentinel")?(l=(0,d.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),Q[14]=l):l=Q[14],Q[15]!==s?(u=(0,d.jsxs)("div",{className:"CheckboxField",children:[s,l]}),Q[15]=s,Q[16]=u):u=Q[16],Q[17]!==er?(c=e=>{er(e.target.checked)},Q[17]=er,Q[18]=c):c=Q[18],Q[19]!==et||Q[20]!==c?(m=(0,d.jsx)("input",{id:"audioInput",type:"checkbox",checked:et,onChange:c}),Q[19]=et,Q[20]=c,Q[21]=m):m=Q[21],Q[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,d.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),Q[22]=p):p=Q[22],Q[23]!==m?(A=(0,d.jsxs)("div",{className:"CheckboxField",children:[m,p]}),Q[23]=m,Q[24]=A):A=Q[24],Q[25]!==A||Q[26]!==u?(g=(0,d.jsxs)("div",{className:"Controls-group",children:[u,A]}),Q[25]=A,Q[26]=u,Q[27]=g):g=Q[27],Q[28]!==ei?(v=e=>{ei(e.target.checked)},Q[28]=ei,Q[29]=v):v=Q[29],Q[30]!==en||Q[31]!==v?(y=(0,d.jsx)("input",{id:"animationInput",type:"checkbox",checked:en,onChange:v}),Q[30]=en,Q[31]=v,Q[32]=y):y=Q[32],Q[33]===Symbol.for("react.memo_cache_sentinel")?(C=(0,d.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),Q[33]=C):C=Q[33],Q[34]!==y?(B=(0,d.jsxs)("div",{className:"CheckboxField",children:[y,C]}),Q[34]=y,Q[35]=B):B=Q[35],Q[36]!==ec?(b=e=>{ec(e.target.checked)},Q[36]=ec,Q[37]=b):b=Q[37],Q[38]!==eu||Q[39]!==b?(x=(0,d.jsx)("input",{id:"debugInput",type:"checkbox",checked:eu,onChange:b}),Q[38]=eu,Q[39]=b,Q[40]=x):x=Q[40],Q[41]===Symbol.for("react.memo_cache_sentinel")?(S=(0,d.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),Q[41]=S):S=Q[41],Q[42]!==x?(E=(0,d.jsxs)("div",{className:"CheckboxField",children:[x,S]}),Q[42]=x,Q[43]=E):E=Q[43],Q[44]!==B||Q[45]!==E?(M=(0,d.jsxs)("div",{className:"Controls-group",children:[B,E]}),Q[44]=B,Q[45]=E,Q[46]=M):M=Q[46],Q[47]===Symbol.for("react.memo_cache_sentinel")?(F=(0,d.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),Q[47]=F):F=Q[47],Q[48]!==ee?(T=e=>ee(parseInt(e.target.value)),Q[48]=ee,Q[49]=T):T=Q[49],Q[50]!==$||Q[51]!==T?(R=(0,d.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:$,onChange:T}),Q[50]=$,Q[51]=T,Q[52]=R):R=Q[52],Q[53]!==$?(w=(0,d.jsx)("output",{htmlFor:"fovInput",children:$}),Q[53]=$,Q[54]=w):w=Q[54],Q[55]!==R||Q[56]!==w?(D=(0,d.jsxs)("div",{className:"Field",children:[F,R,w]}),Q[55]=R,Q[56]=w,Q[57]=D):D=Q[57],Q[58]===Symbol.for("react.memo_cache_sentinel")?(I=(0,d.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),Q[58]=I):I=Q[58],Q[59]!==eo?(G=e=>eo(parseFloat(e.target.value)),Q[59]=eo,Q[60]=G):G=Q[60],Q[61]!==ea||Q[62]!==G?(L=(0,d.jsxs)("div",{className:"Field",children:[I,(0,d.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:ea,onChange:G})]}),Q[61]=ea,Q[62]=G,Q[63]=L):L=Q[63],Q[64]!==D||Q[65]!==L?(O=(0,d.jsxs)("div",{className:"Controls-group",children:[D,L]}),Q[64]=D,Q[65]=L,Q[66]=O):O=Q[66],Q[67]!==Y||Q[68]!==el||Q[69]!==es?(_=Y&&(0,d.jsx)("div",{className:"Controls-group",children:(0,d.jsxs)("div",{className:"Field",children:[(0,d.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick:"})," ",(0,d.jsxs)("select",{id:"touchModeInput",value:es,onChange:e=>el(e.target.value),children:[(0,d.jsx)("option",{value:"dualStick",children:"Dual Stick"}),(0,d.jsx)("option",{value:"moveLookStick",children:"Single Stick"})]})]})}),Q[67]=Y,Q[68]=el,Q[69]=es,Q[70]=_):_=Q[70],Q[71]!==g||Q[72]!==M||Q[73]!==O||Q[74]!==_||Q[75]!==a?(P=(0,d.jsxs)(d.Fragment,{children:[a,g,M,O,_]}),Q[71]=g,Q[72]=M,Q[73]=O,Q[74]=_,Q[75]=a,Q[76]=P):P=Q[76];let ev=P;return Q[77]!==V||Q[78]!==q||Q[79]!==X?(k=(0,d.jsx)(lm,{value:V,missionType:q,onChange:X}),Q[77]=V,Q[78]=q,Q[79]=X,Q[80]=k):k=Q[80],Q[81]===Symbol.for("react.memo_cache_sentinel")?(H=()=>{ef(lT)},Q[81]=H):H=Q[81],Q[82]===Symbol.for("react.memo_cache_sentinel")?(j=(0,d.jsx)(lM,{}),Q[82]=j):j=Q[82],Q[83]!==ed?(U=(0,d.jsx)("button",{ref:em,className:"IconButton Controls-toggle",onClick:H,"aria-expanded":ed,"aria-controls":"settingsPanel","aria-label":"Settings",children:j}),Q[83]=ed,Q[84]=U):U=Q[84],Q[85]!==ev||Q[86]!==ed?(N=(0,d.jsx)("div",{className:"Controls-dropdown",ref:eh,id:"settingsPanel",tabIndex:-1,onKeyDown:eg,onBlur:eA,"data-open":ed,children:ev}),Q[85]=ev,Q[86]=ed,Q[87]=N):N=Q[87],Q[88]!==U||Q[89]!==N?(J=(0,d.jsxs)("div",{ref:ep,children:[U,N]}),Q[88]=U,Q[89]=N,Q[90]=J):J=Q[90],Q[91]!==k||Q[92]!==J?(K=(0,d.jsxs)("div",{id:"controls",onKeyDown:lD,onPointerDown:lw,onClick:lR,children:[k,J]}),Q[91]=k,Q[92]=J,Q[93]=K):K=Q[93],K}function lT(e){return!e}function lR(e){return e.stopPropagation()}function lw(e){return e.stopPropagation()}function lD(e){return e.stopPropagation()}let lI=()=>null,lG=h.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:i,...a},o)=>{let s=(0,eB.useThree)(({set:e})=>e),l=(0,eB.useThree)(({camera:e})=>e),u=(0,eB.useThree)(({size:e})=>e),c=h.useRef(null);h.useImperativeHandle(o,()=>c.current,[]);let d=h.useRef(null),f=function(e,t,r){let n=(0,eB.useThree)(e=>e.size),i=(0,eB.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,o=n.height*i.dpr,s=("number"==typeof e?void 0:e)||{},{samples:l=0,depth:u,...c}=s,d=null!=u?u:s.depthBuffer,f=h.useMemo(()=>{let e=new A.WebGLRenderTarget(a,o,{minFilter:A.LinearFilter,magFilter:A.LinearFilter,type:A.HalfFloatType,...c});return d&&(e.depthTexture=new A.DepthTexture(a,o,A.FloatType)),e.samples=l,e},[]);return h.useLayoutEffect(()=>{f.setSize(a,o),l&&(f.samples=l)},[l,f,a,o]),h.useEffect(()=>()=>f.dispose(),[]),f}(t);h.useLayoutEffect(()=>{a.manual||(c.current.aspect=u.width/u.height)},[u,a]),h.useLayoutEffect(()=>{c.current.updateProjectionMatrix()});let m=0,p=null,g="function"==typeof i;return(0,eC.useFrame)(t=>{g&&(r===1/0||m{if(n)return s(()=>({camera:c.current})),()=>s(()=>({camera:l}))},[c,n,s]),h.createElement(h.Fragment,null,h.createElement("perspectiveCamera",(0,eY.default)({ref:c},a),!g&&i),h.createElement("group",{ref:d},g&&i(f.texture)))});function lL(){let e,t,r=(0,f.c)(3),{fov:n}=(0,eF.useSettings)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],r[0]=e):e=r[0],r[1]!==n?(t=(0,d.jsx)(lG,{makeDefault:!0,position:e,fov:n}),r[1]=n,r[2]=t):t=r[2],t}var lO=e.i(51434),l_=e.i(81405);function lP(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function lk({showPanel:e=0,className:t,parent:r}){let n=function(e,t=[],r){let[n,i]=h.useState();return h.useLayoutEffect(()=>{let t=e();return i(t),lP(void 0,t),()=>lP(void 0,null)},t),n}(()=>new l_.default,[]);return h.useEffect(()=>{if(n){let i=r&&r.current||document.body;n.showPanel(e),null==i||i.appendChild(n.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&n.dom.classList.add(...a);let o=(0,m.j)(()=>n.begin()),s=(0,m.k)(()=>n.end());return()=>{a.length&&n.dom.classList.remove(...a),null==i||i.removeChild(n.dom),o(),s()}}},[r,n,t,e]),null}var lH=e.i(60099);function lj(){let e,t,r=(0,f.c)(3),{debugMode:n}=(0,eF.useDebug)(),i=(0,h.useRef)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=i.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},r[0]=e):e=r[0],(0,h.useEffect)(e),r[1]!==n?(t=n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(lk,{className:"StatsPanel"}),(0,d.jsx)("axesHelper",{ref:i,args:[70],renderOrder:999,children:(0,d.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,d.jsx)(lH.Html,{position:[80,0,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,d.jsx)(lH.Html,{position:[0,80,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,d.jsx)(lH.Html,{position:[0,0,80],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null,r[1]=n,r[2]=t):t=r[2],t}var lU=e.i(50361),lN=e.i(24540);function lJ(e,t,r){try{return e(t)}catch(e){return(0,lN.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function lK(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),lJ(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}}}}lK({parse:e=>e,serialize:String}),lK({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),lK({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),lK({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}}),lK({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let lQ=lK({parse:e=>"true"===e.toLowerCase(),serialize:String});function lV(e,t){return e.valueOf()===t.valueOf()}lK({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:lV}),lK({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:lV}),lK({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:lV});let lq=(0,lU.r)(),lX={};function lW(e,t,r,n,i,a){let o=!1,s=Object.entries(e).reduce((e,[s,l])=>{var u;let c=t?.[s]??s,d=n[c],f="multi"===l.type?[]:null,h=void 0===d?("multi"===l.type?r?.getAll(c):r?.get(c))??f:d;return i&&a&&((u=i[c]??f)===h||null!==u&&null!==h&&"string"!=typeof u&&"string"!=typeof h&&u.length===h.length&&u.every((e,t)=>e===h[t]))?e[s]=a[s]??null:(o=!0,e[s]=((0,lU.i)(h)?null:lJ(l.parse,h,c))??null,i&&(i[c]=h)),e},{});if(!o){let t=Object.keys(e),r=Object.keys(a??{});o=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:s,hasChanged:o}}function lY(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function lz(e,t={}){let{parse:r,type:n,serialize:i,eq:a,defaultValue:o,...s}=t,[{[e]:l},u]=function(e,t={}){let r=(0,h.useId)(),n=(0,lN.i)(),i=(0,lN.a)(),{history:a="replace",scroll:o=n?.scroll??!1,shallow:s=n?.shallow??!0,throttleMs:l=lU.s.timeMs,limitUrlUpdates:u=n?.limitUrlUpdates,clearOnDefault:c=n?.clearOnDefault??!0,startTransition:d,urlKeys:f=lX}=t,m=Object.keys(e).join(","),p=(0,h.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,f[e]??e])),[m,JSON.stringify(f)]),A=(0,lN.r)(Object.values(p)),g=A.searchParams,v=(0,h.useRef)({}),y=(0,h.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),C=lU.t.useQueuedQueries(Object.values(p)),[B,b]=(0,h.useState)(()=>lW(e,f,g??new URLSearchParams,C).state),x=(0,h.useRef)(B);if((0,lN.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,m,B,g),Object.keys(v.current).join("&")!==Object.values(p).join("&")){let{state:t,hasChanged:n}=lW(e,f,g,C,v.current,x.current);n&&((0,lN.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t)),v.current=Object.fromEntries(Object.entries(p).map(([t,r])=>[r,e[t]?.type==="multi"?g?.getAll(r):g?.get(r)??null]))}(0,h.useEffect)(()=>{let{state:t,hasChanged:n}=lW(e,f,g,C,v.current,x.current);n&&((0,lN.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t))},[Object.values(p).map(e=>`${e}=${g?.getAll(e)}`).join("&"),JSON.stringify(C)]),(0,h.useEffect)(()=>{let t=Object.keys(e).reduce((t,n)=>(t[n]=({state:t,query:i})=>{b(a=>{let{defaultValue:o}=e[n],s=p[n],l=t??o??null;return Object.is(a[n]??o??null,l)?((0,lN.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,m,s,t,o,x.current),a):(x.current={...x.current,[n]:l},v.current[s]=i,(0,lN.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,m,s,t,o,x.current),x.current)})},t),{});for(let n of Object.keys(e)){let e=p[n];(0,lN.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,m),lq.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=p[n];(0,lN.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,m),lq.off(e,t[n])}}},[m,p]);let S=(0,h.useCallback)((t,n={})=>{let f,h=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g="function"==typeof t?t(lY(x.current,y))??h:t??h;(0,lN.c)("[nuq+ %s `%s`] setState: %O",r,m,g);let v=0,C=!1,B=[];for(let[t,r]of Object.entries(g)){let h=e[t],m=p[t];if(!h||void 0===r)continue;(n.clearOnDefault??h.clearOnDefault??c)&&null!==r&&void 0!==h.defaultValue&&(h.eq??((e,t)=>e===t))(r,h.defaultValue)&&(r=null);let g=null===r?null:(h.serialize??String)(r);lq.emit(m,{state:r,query:g});let y={key:m,query:g,options:{history:n.history??h.history??a,shallow:n.shallow??h.shallow??s,scroll:n.scroll??h.scroll??o,startTransition:n.startTransition??h.startTransition??d}};if(n?.limitUrlUpdates?.method==="debounce"||u?.method==="debounce"||h.limitUrlUpdates?.method==="debounce"){!0===y.options.shallow&&console.warn((0,lN.s)(422));let e=n?.limitUrlUpdates?.timeMs??u?.timeMs??h.limitUrlUpdates?.timeMs??lU.s.timeMs,t=lU.t.push(y,e,A,i);vt(e),C?lU.n.flush(A,i):lU.n.getPendingPromise(A));return f??b},[m,a,s,o,l,u?.method,u?.timeMs,d,p,A.updateUrl,A.getSearchParamsSnapshot,A.rateLimitFactor,i,y]);return[(0,h.useMemo)(()=>lY(B,y),[B,y]),S]}({[e]:{parse:r??(e=>e),type:n,serialize:i,eq:a,defaultValue:o}},s);return[l,(0,h.useCallback)((t,r={})=>u(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,u])]}let lZ=new r2,l$={toneMapping:A.NoToneMapping,outputColorSpace:A.SRGBColorSpace},l0=lK({parse(e){let[t,r]=e.split("~"),n=r,i=(0,rQ.getMissionInfo)(t).missionTypes;return r&&i.includes(r)||(n=i[0]),{missionName:t,missionType:n}},serialize:({missionName:e,missionType:t})=>1===(0,rQ.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function l1(){let e,t,r,n,i,a,o,s,l,u,c,m,p,g,v,y,C,B,x,S,E,M,F,T,R,w,D,I,G,L=(0,f.c)(52),[O,_]=lz("mission",l0),[P,k]=lz("fog",lQ);L[0]!==k?(e=()=>{k(null)},L[0]=k,L[1]=e):e=L[1];let H=e;L[2]!==H||L[3]!==_?(t=e=>{window.location.hash="",H(),_(e)},L[2]=H,L[3]=_,L[4]=t):t=L[4];let j=t,U=(w=(0,f.c)(2),D=(0,h.useRef)(null),w[0]===Symbol.for("react.memo_cache_sentinel")?(T=e=>{let t=window.matchMedia("(pointer: coarse)");return t.addEventListener("change",e),D.current=t,()=>{t.removeEventListener("change",e)}},w[0]=T):T=w[0],I=T,w[1]===Symbol.for("react.memo_cache_sentinel")?(R=()=>D.current?.matches??null,w[1]=R):R=w[1],G=R,(0,h.useSyncExternalStore)(I,G,lI)),{missionName:N,missionType:J}=O,[K,Q]=(0,h.useState)(0),[V,q]=(0,h.useState)(!0),X=K<1;L[5]!==X?(r=()=>{if(X)q(!0);else{let e=setTimeout(()=>q(!1),500);return()=>clearTimeout(e)}},n=[X],L[5]=X,L[6]=r,L[7]=n):(r=L[6],n=L[7]),(0,h.useEffect)(r,n),L[8]!==j?(i=()=>(window.setMissionName=e=>{let t=(0,rQ.getMissionInfo)(e).missionTypes;j({missionName:e,missionType:t[0]})},window.getMissionList=rQ.getMissionList,window.getMissionInfo=rQ.getMissionInfo,l2),a=[j],L[8]=j,L[9]=i,L[10]=a):(i=L[9],a=L[10]),(0,h.useEffect)(i,a),L[11]===Symbol.for("react.memo_cache_sentinel")?(o=(e,t)=>{Q(void 0===t?0:t)},L[11]=o):o=L[11];let W=o,Y=(0,h.useRef)(null);L[12]===Symbol.for("react.memo_cache_sentinel")?(s={angle:0,force:0},L[12]=s):s=L[12];let z=(0,h.useRef)(s),Z=(0,h.useRef)(null);L[13]===Symbol.for("react.memo_cache_sentinel")?(l={angle:0,force:0},L[13]=l):l=L[13];let $=(0,h.useRef)(l),ee=(0,h.useRef)(null);L[14]!==X||L[15]!==K||L[16]!==V?(u=V&&(0,d.jsxs)("div",{id:"loadingIndicator","data-complete":!X,children:[(0,d.jsx)("div",{className:"LoadingSpinner"}),(0,d.jsx)("div",{className:"LoadingProgress",children:(0,d.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*K}%`}})}),(0,d.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*K),"%"]})]}),L[14]=X,L[15]=K,L[16]=V,L[17]=u):u=L[17],L[18]===Symbol.for("react.memo_cache_sentinel")?(c={type:A.PCFShadowMap},m=e=>{Y.current=e.camera},L[18]=c,L[19]=m):(c=L[18],m=L[19]);let et=`${N}~${J}`;return L[20]!==N||L[21]!==J||L[22]!==et?(p=(0,d.jsx)(rW,{name:N,missionType:J,onLoadingChange:W},et),L[20]=N,L[21]=J,L[22]=et,L[23]=p):p=L[23],L[24]===Symbol.for("react.memo_cache_sentinel")?(g=(0,d.jsx)(lL,{}),v=(0,d.jsx)(lj,{}),L[24]=g,L[25]=v):(g=L[24],v=L[25]),L[26]!==U?(y=null===U?null:U?(0,d.jsx)(nT,{joystickState:z,joystickZone:Z,lookJoystickState:$,lookJoystickZone:ee}):(0,d.jsx)(nf,{}),L[26]=U,L[27]=y):y=L[27],L[28]!==p||L[29]!==y?(C=(0,d.jsx)(b,{frameloop:"always",gl:l$,shadows:c,onCreated:m,children:(0,d.jsx)(r_,{children:(0,d.jsxs)(lO.AudioProvider,{children:[p,g,v,y]})})}),L[28]=p,L[29]=y,L[30]=C):C=L[30],L[31]!==C||L[32]!==u?(B=(0,d.jsxs)("div",{id:"canvasContainer",children:[u,C]}),L[31]=C,L[32]=u,L[33]=B):B=L[33],L[34]!==U?(x=U&&(0,d.jsx)(nF,{joystickState:z,joystickZone:Z,lookJoystickState:$,lookJoystickZone:ee}),L[34]=U,L[35]=x):x=L[35],L[36]!==U?(S=!1===U&&(0,d.jsx)(np,{}),L[36]=U,L[37]=S):S=L[37],L[38]!==j||L[39]!==U||L[40]!==N||L[41]!==J?(E=(0,d.jsx)(lF,{missionName:N,missionType:J,onChangeMission:j,cameraRef:Y,isTouch:U}),L[38]=j,L[39]=U,L[40]=N,L[41]=J,L[42]=E):E=L[42],L[43]!==B||L[44]!==x||L[45]!==S||L[46]!==E?(M=(0,d.jsxs)(r8,{map:nd,children:[B,x,S,E]}),L[43]=B,L[44]=x,L[45]=S,L[46]=E,L[47]=M):M=L[47],L[48]!==H||L[49]!==P||L[50]!==M?(F=(0,d.jsx)(ef,{client:lZ,children:(0,d.jsx)("main",{children:(0,d.jsx)(eF.SettingsProvider,{fogEnabledOverride:P,onClearFogEnabledOverride:H,children:M})})}),L[48]=H,L[49]=P,L[50]=M,L[51]=F):F=L[51],F}function l2(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}function l9(){let e,t=(0,f.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(l1,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>l9],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/143bcebca21d60e5.js b/docs/_next/static/chunks/143bcebca21d60e5.js new file mode 100644 index 00000000..65a6eef7 --- /dev/null +++ b/docs/_next/static/chunks/143bcebca21d60e5.js @@ -0,0 +1,528 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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("|"),a=RegExp(i,"g"),o=RegExp(i,"");function l(e){return n[e]}var s=function(e){return e.replace(a,l)};t.exports=s,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=s},29402,(e,t,r)=>{var n,i,a,o,l="__lodash_hash_undefined__",s=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",m="[object Error]",h="[object Function]",p="[object Map]",A="[object Number]",g="[object Object]",v="[object Promise]",B="[object RegExp]",C="[object Set]",y="[object String]",b="[object Symbol]",x="[object WeakMap]",E="[object ArrayBuffer]",M="[object DataView]",S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,T=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,D=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,G={};G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G[u]=G[c]=G[E]=G[d]=G[M]=G[f]=G[m]=G[h]=G[p]=G[A]=G[g]=G[B]=G[C]=G[y]=G[x]=!1;var L=e.g&&e.g.Object===Object&&e.g,_="object"==typeof self&&self&&self.Object===Object&&self,P=L||_||Function("return this")(),O=r&&!r.nodeType&&r,k=O&&t&&!t.nodeType&&t,H=k&&k.exports===O&&L.process,j=function(){try{return H&&H.binding("util")}catch(e){}}(),U=j&&j.isTypedArray;function N(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},ex.prototype.clear=function(){this.__data__={hash:new ey,map:new(es||eb),string:new ey}},ex.prototype.delete=function(e){return eL(this,e).delete(e)},ex.prototype.get=function(e){return eL(this,e).get(e)},ex.prototype.has=function(e){return eL(this,e).has(e)},ex.prototype.set=function(e,t){return eL(this,e).set(e,t),this},eE.prototype.add=eE.prototype.push=function(e){return this.__data__.set(e,l),this},eE.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.clear=function(){this.__data__=new eb},eM.prototype.delete=function(e){return this.__data__.delete(e)},eM.prototype.get=function(e){return this.__data__.get(e)},eM.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!es||n.length<199)return n.push([e,t]),this;r=this.__data__=new ex(n)}return r.set(e,t),this};var eF=(n=function(e,t){return e&&eT(e,t,e0)},function(e,t){if(null==e)return e;if(!eX(e))return n(e,t);for(var r=e.length,i=-1,a=Object(e);++il))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eE:void 0;for(a.set(e,t),a.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$=U?J(U):function(e){return ez(e)&&eW(e.length)&&!!G[ee.call(e)]};function e0(e){return eX(e)?function(e,t){var r=eV(e)||eQ(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&o&&s&&!l&&!u||n&&o&&s||!r&&s||!i)return 1;if(!n&&!a&&!u&&e=l)return s;return s*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});s--;)l[s]=l[s].value;return l}(e,t,r))}},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;to+1e3&&(s.update(1e3*l/(e-o),100),o=e,l=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:t}}).Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),l=80*o,s=48*o,u=3*o,c=2*o,d=3*o,f=15*o,m=74*o,h=30*o,p=document.createElement("canvas");p.width=l,p.height=s,p.style.cssText="width:80px;height:48px";var A=p.getContext("2d");return A.font="bold "+9*o+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,l,s),A.fillStyle=t,A.fillText(e,u,c),A.fillRect(d,f,m,h),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d,f,m,h),{dom:p,update:function(s,g){n=Math.min(n,s),i=Math.max(i,s),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,l,f),A.fillStyle=t,A.fillText(a(s)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),A.drawImage(p,d+o,f,m-o,h,d,f,m-o,h),A.fillRect(d+m-o,f,o,h),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d+m-o,f,o,a((1-s/g)*h))}}},t.exports=n},31713,e=>{"use strict";let t;var r,n,i=e.i(43476),a=e.i(932),o=e.i(71645),l=e.i(91037),s=e.i(8560),u=e.i(90072);e.s(["ACESFilmicToneMapping",()=>u.ACESFilmicToneMapping,"AddEquation",()=>u.AddEquation,"AddOperation",()=>u.AddOperation,"AdditiveAnimationBlendMode",()=>u.AdditiveAnimationBlendMode,"AdditiveBlending",()=>u.AdditiveBlending,"AgXToneMapping",()=>u.AgXToneMapping,"AlphaFormat",()=>u.AlphaFormat,"AlwaysCompare",()=>u.AlwaysCompare,"AlwaysDepth",()=>u.AlwaysDepth,"AlwaysStencilFunc",()=>u.AlwaysStencilFunc,"AmbientLight",()=>u.AmbientLight,"AnimationAction",()=>u.AnimationAction,"AnimationClip",()=>u.AnimationClip,"AnimationLoader",()=>u.AnimationLoader,"AnimationMixer",()=>u.AnimationMixer,"AnimationObjectGroup",()=>u.AnimationObjectGroup,"AnimationUtils",()=>u.AnimationUtils,"ArcCurve",()=>u.ArcCurve,"ArrayCamera",()=>u.ArrayCamera,"ArrowHelper",()=>u.ArrowHelper,"AttachedBindMode",()=>u.AttachedBindMode,"Audio",()=>u.Audio,"AudioAnalyser",()=>u.AudioAnalyser,"AudioContext",()=>u.AudioContext,"AudioListener",()=>u.AudioListener,"AudioLoader",()=>u.AudioLoader,"AxesHelper",()=>u.AxesHelper,"BackSide",()=>u.BackSide,"BasicDepthPacking",()=>u.BasicDepthPacking,"BasicShadowMap",()=>u.BasicShadowMap,"BatchedMesh",()=>u.BatchedMesh,"Bone",()=>u.Bone,"BooleanKeyframeTrack",()=>u.BooleanKeyframeTrack,"Box2",()=>u.Box2,"Box3",()=>u.Box3,"Box3Helper",()=>u.Box3Helper,"BoxGeometry",()=>u.BoxGeometry,"BoxHelper",()=>u.BoxHelper,"BufferAttribute",()=>u.BufferAttribute,"BufferGeometry",()=>u.BufferGeometry,"BufferGeometryLoader",()=>u.BufferGeometryLoader,"ByteType",()=>u.ByteType,"Cache",()=>u.Cache,"Camera",()=>u.Camera,"CameraHelper",()=>u.CameraHelper,"CanvasTexture",()=>u.CanvasTexture,"CapsuleGeometry",()=>u.CapsuleGeometry,"CatmullRomCurve3",()=>u.CatmullRomCurve3,"CineonToneMapping",()=>u.CineonToneMapping,"CircleGeometry",()=>u.CircleGeometry,"ClampToEdgeWrapping",()=>u.ClampToEdgeWrapping,"Clock",()=>u.Clock,"Color",()=>u.Color,"ColorKeyframeTrack",()=>u.ColorKeyframeTrack,"ColorManagement",()=>u.ColorManagement,"CompressedArrayTexture",()=>u.CompressedArrayTexture,"CompressedCubeTexture",()=>u.CompressedCubeTexture,"CompressedTexture",()=>u.CompressedTexture,"CompressedTextureLoader",()=>u.CompressedTextureLoader,"ConeGeometry",()=>u.ConeGeometry,"ConstantAlphaFactor",()=>u.ConstantAlphaFactor,"ConstantColorFactor",()=>u.ConstantColorFactor,"Controls",()=>u.Controls,"CubeCamera",()=>u.CubeCamera,"CubeDepthTexture",()=>u.CubeDepthTexture,"CubeReflectionMapping",()=>u.CubeReflectionMapping,"CubeRefractionMapping",()=>u.CubeRefractionMapping,"CubeTexture",()=>u.CubeTexture,"CubeTextureLoader",()=>u.CubeTextureLoader,"CubeUVReflectionMapping",()=>u.CubeUVReflectionMapping,"CubicBezierCurve",()=>u.CubicBezierCurve,"CubicBezierCurve3",()=>u.CubicBezierCurve3,"CubicInterpolant",()=>u.CubicInterpolant,"CullFaceBack",()=>u.CullFaceBack,"CullFaceFront",()=>u.CullFaceFront,"CullFaceFrontBack",()=>u.CullFaceFrontBack,"CullFaceNone",()=>u.CullFaceNone,"Curve",()=>u.Curve,"CurvePath",()=>u.CurvePath,"CustomBlending",()=>u.CustomBlending,"CustomToneMapping",()=>u.CustomToneMapping,"CylinderGeometry",()=>u.CylinderGeometry,"Cylindrical",()=>u.Cylindrical,"Data3DTexture",()=>u.Data3DTexture,"DataArrayTexture",()=>u.DataArrayTexture,"DataTexture",()=>u.DataTexture,"DataTextureLoader",()=>u.DataTextureLoader,"DataUtils",()=>u.DataUtils,"DecrementStencilOp",()=>u.DecrementStencilOp,"DecrementWrapStencilOp",()=>u.DecrementWrapStencilOp,"DefaultLoadingManager",()=>u.DefaultLoadingManager,"DepthFormat",()=>u.DepthFormat,"DepthStencilFormat",()=>u.DepthStencilFormat,"DepthTexture",()=>u.DepthTexture,"DetachedBindMode",()=>u.DetachedBindMode,"DirectionalLight",()=>u.DirectionalLight,"DirectionalLightHelper",()=>u.DirectionalLightHelper,"DiscreteInterpolant",()=>u.DiscreteInterpolant,"DodecahedronGeometry",()=>u.DodecahedronGeometry,"DoubleSide",()=>u.DoubleSide,"DstAlphaFactor",()=>u.DstAlphaFactor,"DstColorFactor",()=>u.DstColorFactor,"DynamicCopyUsage",()=>u.DynamicCopyUsage,"DynamicDrawUsage",()=>u.DynamicDrawUsage,"DynamicReadUsage",()=>u.DynamicReadUsage,"EdgesGeometry",()=>u.EdgesGeometry,"EllipseCurve",()=>u.EllipseCurve,"EqualCompare",()=>u.EqualCompare,"EqualDepth",()=>u.EqualDepth,"EqualStencilFunc",()=>u.EqualStencilFunc,"EquirectangularReflectionMapping",()=>u.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>u.EquirectangularRefractionMapping,"Euler",()=>u.Euler,"EventDispatcher",()=>u.EventDispatcher,"ExternalTexture",()=>u.ExternalTexture,"ExtrudeGeometry",()=>u.ExtrudeGeometry,"FileLoader",()=>u.FileLoader,"Float16BufferAttribute",()=>u.Float16BufferAttribute,"Float32BufferAttribute",()=>u.Float32BufferAttribute,"FloatType",()=>u.FloatType,"Fog",()=>u.Fog,"FogExp2",()=>u.FogExp2,"FramebufferTexture",()=>u.FramebufferTexture,"FrontSide",()=>u.FrontSide,"Frustum",()=>u.Frustum,"FrustumArray",()=>u.FrustumArray,"GLBufferAttribute",()=>u.GLBufferAttribute,"GLSL1",()=>u.GLSL1,"GLSL3",()=>u.GLSL3,"GreaterCompare",()=>u.GreaterCompare,"GreaterDepth",()=>u.GreaterDepth,"GreaterEqualCompare",()=>u.GreaterEqualCompare,"GreaterEqualDepth",()=>u.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>u.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>u.GreaterStencilFunc,"GridHelper",()=>u.GridHelper,"Group",()=>u.Group,"HalfFloatType",()=>u.HalfFloatType,"HemisphereLight",()=>u.HemisphereLight,"HemisphereLightHelper",()=>u.HemisphereLightHelper,"IcosahedronGeometry",()=>u.IcosahedronGeometry,"ImageBitmapLoader",()=>u.ImageBitmapLoader,"ImageLoader",()=>u.ImageLoader,"ImageUtils",()=>u.ImageUtils,"IncrementStencilOp",()=>u.IncrementStencilOp,"IncrementWrapStencilOp",()=>u.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>u.InstancedBufferAttribute,"InstancedBufferGeometry",()=>u.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>u.InstancedInterleavedBuffer,"InstancedMesh",()=>u.InstancedMesh,"Int16BufferAttribute",()=>u.Int16BufferAttribute,"Int32BufferAttribute",()=>u.Int32BufferAttribute,"Int8BufferAttribute",()=>u.Int8BufferAttribute,"IntType",()=>u.IntType,"InterleavedBuffer",()=>u.InterleavedBuffer,"InterleavedBufferAttribute",()=>u.InterleavedBufferAttribute,"Interpolant",()=>u.Interpolant,"InterpolateDiscrete",()=>u.InterpolateDiscrete,"InterpolateLinear",()=>u.InterpolateLinear,"InterpolateSmooth",()=>u.InterpolateSmooth,"InterpolationSamplingMode",()=>u.InterpolationSamplingMode,"InterpolationSamplingType",()=>u.InterpolationSamplingType,"InvertStencilOp",()=>u.InvertStencilOp,"KeepStencilOp",()=>u.KeepStencilOp,"KeyframeTrack",()=>u.KeyframeTrack,"LOD",()=>u.LOD,"LatheGeometry",()=>u.LatheGeometry,"Layers",()=>u.Layers,"LessCompare",()=>u.LessCompare,"LessDepth",()=>u.LessDepth,"LessEqualCompare",()=>u.LessEqualCompare,"LessEqualDepth",()=>u.LessEqualDepth,"LessEqualStencilFunc",()=>u.LessEqualStencilFunc,"LessStencilFunc",()=>u.LessStencilFunc,"Light",()=>u.Light,"LightProbe",()=>u.LightProbe,"Line",()=>u.Line,"Line3",()=>u.Line3,"LineBasicMaterial",()=>u.LineBasicMaterial,"LineCurve",()=>u.LineCurve,"LineCurve3",()=>u.LineCurve3,"LineDashedMaterial",()=>u.LineDashedMaterial,"LineLoop",()=>u.LineLoop,"LineSegments",()=>u.LineSegments,"LinearFilter",()=>u.LinearFilter,"LinearInterpolant",()=>u.LinearInterpolant,"LinearMipMapLinearFilter",()=>u.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>u.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>u.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>u.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>u.LinearSRGBColorSpace,"LinearToneMapping",()=>u.LinearToneMapping,"LinearTransfer",()=>u.LinearTransfer,"Loader",()=>u.Loader,"LoaderUtils",()=>u.LoaderUtils,"LoadingManager",()=>u.LoadingManager,"LoopOnce",()=>u.LoopOnce,"LoopPingPong",()=>u.LoopPingPong,"LoopRepeat",()=>u.LoopRepeat,"MOUSE",()=>u.MOUSE,"Material",()=>u.Material,"MaterialLoader",()=>u.MaterialLoader,"MathUtils",()=>u.MathUtils,"Matrix2",()=>u.Matrix2,"Matrix3",()=>u.Matrix3,"Matrix4",()=>u.Matrix4,"MaxEquation",()=>u.MaxEquation,"Mesh",()=>u.Mesh,"MeshBasicMaterial",()=>u.MeshBasicMaterial,"MeshDepthMaterial",()=>u.MeshDepthMaterial,"MeshDistanceMaterial",()=>u.MeshDistanceMaterial,"MeshLambertMaterial",()=>u.MeshLambertMaterial,"MeshMatcapMaterial",()=>u.MeshMatcapMaterial,"MeshNormalMaterial",()=>u.MeshNormalMaterial,"MeshPhongMaterial",()=>u.MeshPhongMaterial,"MeshPhysicalMaterial",()=>u.MeshPhysicalMaterial,"MeshStandardMaterial",()=>u.MeshStandardMaterial,"MeshToonMaterial",()=>u.MeshToonMaterial,"MinEquation",()=>u.MinEquation,"MirroredRepeatWrapping",()=>u.MirroredRepeatWrapping,"MixOperation",()=>u.MixOperation,"MultiplyBlending",()=>u.MultiplyBlending,"MultiplyOperation",()=>u.MultiplyOperation,"NearestFilter",()=>u.NearestFilter,"NearestMipMapLinearFilter",()=>u.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>u.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>u.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>u.NearestMipmapNearestFilter,"NeutralToneMapping",()=>u.NeutralToneMapping,"NeverCompare",()=>u.NeverCompare,"NeverDepth",()=>u.NeverDepth,"NeverStencilFunc",()=>u.NeverStencilFunc,"NoBlending",()=>u.NoBlending,"NoColorSpace",()=>u.NoColorSpace,"NoNormalPacking",()=>u.NoNormalPacking,"NoToneMapping",()=>u.NoToneMapping,"NormalAnimationBlendMode",()=>u.NormalAnimationBlendMode,"NormalBlending",()=>u.NormalBlending,"NormalGAPacking",()=>u.NormalGAPacking,"NormalRGPacking",()=>u.NormalRGPacking,"NotEqualCompare",()=>u.NotEqualCompare,"NotEqualDepth",()=>u.NotEqualDepth,"NotEqualStencilFunc",()=>u.NotEqualStencilFunc,"NumberKeyframeTrack",()=>u.NumberKeyframeTrack,"Object3D",()=>u.Object3D,"ObjectLoader",()=>u.ObjectLoader,"ObjectSpaceNormalMap",()=>u.ObjectSpaceNormalMap,"OctahedronGeometry",()=>u.OctahedronGeometry,"OneFactor",()=>u.OneFactor,"OneMinusConstantAlphaFactor",()=>u.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>u.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>u.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>u.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>u.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>u.OneMinusSrcColorFactor,"OrthographicCamera",()=>u.OrthographicCamera,"PCFShadowMap",()=>u.PCFShadowMap,"PCFSoftShadowMap",()=>u.PCFSoftShadowMap,"PMREMGenerator",()=>s.PMREMGenerator,"Path",()=>u.Path,"PerspectiveCamera",()=>u.PerspectiveCamera,"Plane",()=>u.Plane,"PlaneGeometry",()=>u.PlaneGeometry,"PlaneHelper",()=>u.PlaneHelper,"PointLight",()=>u.PointLight,"PointLightHelper",()=>u.PointLightHelper,"Points",()=>u.Points,"PointsMaterial",()=>u.PointsMaterial,"PolarGridHelper",()=>u.PolarGridHelper,"PolyhedronGeometry",()=>u.PolyhedronGeometry,"PositionalAudio",()=>u.PositionalAudio,"PropertyBinding",()=>u.PropertyBinding,"PropertyMixer",()=>u.PropertyMixer,"QuadraticBezierCurve",()=>u.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>u.QuadraticBezierCurve3,"Quaternion",()=>u.Quaternion,"QuaternionKeyframeTrack",()=>u.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>u.QuaternionLinearInterpolant,"R11_EAC_Format",()=>u.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>u.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>u.RED_RGTC1_Format,"REVISION",()=>u.REVISION,"RG11_EAC_Format",()=>u.RG11_EAC_Format,"RGBADepthPacking",()=>u.RGBADepthPacking,"RGBAFormat",()=>u.RGBAFormat,"RGBAIntegerFormat",()=>u.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>u.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>u.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>u.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>u.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>u.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>u.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>u.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>u.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>u.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>u.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>u.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>u.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>u.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>u.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>u.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>u.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>u.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>u.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>u.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>u.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>u.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>u.RGBDepthPacking,"RGBFormat",()=>u.RGBFormat,"RGBIntegerFormat",()=>u.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>u.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>u.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>u.RGB_ETC1_Format,"RGB_ETC2_Format",()=>u.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>u.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>u.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>u.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>u.RGDepthPacking,"RGFormat",()=>u.RGFormat,"RGIntegerFormat",()=>u.RGIntegerFormat,"RawShaderMaterial",()=>u.RawShaderMaterial,"Ray",()=>u.Ray,"Raycaster",()=>u.Raycaster,"RectAreaLight",()=>u.RectAreaLight,"RedFormat",()=>u.RedFormat,"RedIntegerFormat",()=>u.RedIntegerFormat,"ReinhardToneMapping",()=>u.ReinhardToneMapping,"RenderTarget",()=>u.RenderTarget,"RenderTarget3D",()=>u.RenderTarget3D,"RepeatWrapping",()=>u.RepeatWrapping,"ReplaceStencilOp",()=>u.ReplaceStencilOp,"ReverseSubtractEquation",()=>u.ReverseSubtractEquation,"RingGeometry",()=>u.RingGeometry,"SIGNED_R11_EAC_Format",()=>u.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>u.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>u.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>u.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>u.SRGBColorSpace,"SRGBTransfer",()=>u.SRGBTransfer,"Scene",()=>u.Scene,"ShaderChunk",()=>s.ShaderChunk,"ShaderLib",()=>s.ShaderLib,"ShaderMaterial",()=>u.ShaderMaterial,"ShadowMaterial",()=>u.ShadowMaterial,"Shape",()=>u.Shape,"ShapeGeometry",()=>u.ShapeGeometry,"ShapePath",()=>u.ShapePath,"ShapeUtils",()=>u.ShapeUtils,"ShortType",()=>u.ShortType,"Skeleton",()=>u.Skeleton,"SkeletonHelper",()=>u.SkeletonHelper,"SkinnedMesh",()=>u.SkinnedMesh,"Source",()=>u.Source,"Sphere",()=>u.Sphere,"SphereGeometry",()=>u.SphereGeometry,"Spherical",()=>u.Spherical,"SphericalHarmonics3",()=>u.SphericalHarmonics3,"SplineCurve",()=>u.SplineCurve,"SpotLight",()=>u.SpotLight,"SpotLightHelper",()=>u.SpotLightHelper,"Sprite",()=>u.Sprite,"SpriteMaterial",()=>u.SpriteMaterial,"SrcAlphaFactor",()=>u.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>u.SrcAlphaSaturateFactor,"SrcColorFactor",()=>u.SrcColorFactor,"StaticCopyUsage",()=>u.StaticCopyUsage,"StaticDrawUsage",()=>u.StaticDrawUsage,"StaticReadUsage",()=>u.StaticReadUsage,"StereoCamera",()=>u.StereoCamera,"StreamCopyUsage",()=>u.StreamCopyUsage,"StreamDrawUsage",()=>u.StreamDrawUsage,"StreamReadUsage",()=>u.StreamReadUsage,"StringKeyframeTrack",()=>u.StringKeyframeTrack,"SubtractEquation",()=>u.SubtractEquation,"SubtractiveBlending",()=>u.SubtractiveBlending,"TOUCH",()=>u.TOUCH,"TangentSpaceNormalMap",()=>u.TangentSpaceNormalMap,"TetrahedronGeometry",()=>u.TetrahedronGeometry,"Texture",()=>u.Texture,"TextureLoader",()=>u.TextureLoader,"TextureUtils",()=>u.TextureUtils,"Timer",()=>u.Timer,"TimestampQuery",()=>u.TimestampQuery,"TorusGeometry",()=>u.TorusGeometry,"TorusKnotGeometry",()=>u.TorusKnotGeometry,"Triangle",()=>u.Triangle,"TriangleFanDrawMode",()=>u.TriangleFanDrawMode,"TriangleStripDrawMode",()=>u.TriangleStripDrawMode,"TrianglesDrawMode",()=>u.TrianglesDrawMode,"TubeGeometry",()=>u.TubeGeometry,"UVMapping",()=>u.UVMapping,"Uint16BufferAttribute",()=>u.Uint16BufferAttribute,"Uint32BufferAttribute",()=>u.Uint32BufferAttribute,"Uint8BufferAttribute",()=>u.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>u.Uint8ClampedBufferAttribute,"Uniform",()=>u.Uniform,"UniformsGroup",()=>u.UniformsGroup,"UniformsLib",()=>s.UniformsLib,"UniformsUtils",()=>u.UniformsUtils,"UnsignedByteType",()=>u.UnsignedByteType,"UnsignedInt101111Type",()=>u.UnsignedInt101111Type,"UnsignedInt248Type",()=>u.UnsignedInt248Type,"UnsignedInt5999Type",()=>u.UnsignedInt5999Type,"UnsignedIntType",()=>u.UnsignedIntType,"UnsignedShort4444Type",()=>u.UnsignedShort4444Type,"UnsignedShort5551Type",()=>u.UnsignedShort5551Type,"UnsignedShortType",()=>u.UnsignedShortType,"VSMShadowMap",()=>u.VSMShadowMap,"Vector2",()=>u.Vector2,"Vector3",()=>u.Vector3,"Vector4",()=>u.Vector4,"VectorKeyframeTrack",()=>u.VectorKeyframeTrack,"VideoFrameTexture",()=>u.VideoFrameTexture,"VideoTexture",()=>u.VideoTexture,"WebGL3DRenderTarget",()=>u.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>u.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>u.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>u.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>u.WebGLRenderTarget,"WebGLRenderer",()=>s.WebGLRenderer,"WebGLUtils",()=>s.WebGLUtils,"WebGPUCoordinateSystem",()=>u.WebGPUCoordinateSystem,"WebXRController",()=>u.WebXRController,"WireframeGeometry",()=>u.WireframeGeometry,"WrapAroundEnding",()=>u.WrapAroundEnding,"ZeroCurvatureEnding",()=>u.ZeroCurvatureEnding,"ZeroFactor",()=>u.ZeroFactor,"ZeroSlopeEnding",()=>u.ZeroSlopeEnding,"ZeroStencilOp",()=>u.ZeroStencilOp,"createCanvasElement",()=>u.createCanvasElement,"error",()=>u.error,"getConsoleFunction",()=>u.getConsoleFunction,"log",()=>u.log,"setConsoleFunction",()=>u.setConsoleFunction,"warn",()=>u.warn,"warnOnce",()=>u.warnOnce],32009);var c=e.i(32009);function d(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let f=["x","y","top","bottom","left","right","width","height"];var m=e.i(46791);function h({ref:e,children:t,fallback:r,resize:n,style:a,gl:s,events:u=l.f,eventSource:m,eventPrefix:h,shadows:p,linear:A,flat:g,legacy:v,orthographic:B,frameloop:C,dpr:y,performance:b,raycaster:x,camera:E,scene:M,onPointerMissed:S,onCreated:F,...T}){o.useMemo(()=>(0,l.e)(c),[]);let R=(0,l.u)(),[w,D]=function({debounce:e,scroll:t,polyfill:r,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){var i,a,l;let s=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[u,c]=(0,o.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),m=(0,o.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u,orientationHandler:null}),h=e?"number"==typeof e?e:e.scroll:null,p=e?"number"==typeof e?e:e.resize:null,A=(0,o.useRef)(!1);(0,o.useEffect)(()=>(A.current=!0,()=>void(A.current=!1)));let[g,v,B]=(0,o.useMemo)(()=>{let e=()=>{let e,t;if(!m.current.element)return;let{left:r,top:i,width:a,height:o,bottom:l,right:s,x:u,y:d}=m.current.element.getBoundingClientRect(),h={left:r,top:i,width:a,height:o,bottom:l,right:s,x:u,y:d};m.current.element instanceof HTMLElement&&n&&(h.height=m.current.element.offsetHeight,h.width=m.current.element.offsetWidth),Object.freeze(h),A.current&&(e=m.current.lastBounds,t=h,!f.every(r=>e[r]===t[r]))&&c(m.current.lastBounds=h)};return[e,p?d(e,p):e,h?d(e,h):e]},[c,n,h,p]);function C(){m.current.scrollContainers&&(m.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",B,!0)),m.current.scrollContainers=null),m.current.resizeObserver&&(m.current.resizeObserver.disconnect(),m.current.resizeObserver=null),m.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",m.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",m.current.orientationHandler))}function y(){m.current.element&&(m.current.resizeObserver=new s(B),m.current.resizeObserver.observe(m.current.element),t&&m.current.scrollContainers&&m.current.scrollContainers.forEach(e=>e.addEventListener("scroll",B,{capture:!0,passive:!0})),m.current.orientationHandler=()=>{B()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",m.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",m.current.orientationHandler))}return i=B,a=!!t,(0,o.useEffect)(()=>{if(a)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,a]),l=v,(0,o.useEffect)(()=>(window.addEventListener("resize",l),()=>void window.removeEventListener("resize",l)),[l]),(0,o.useEffect)(()=>{C(),y()},[t,B,v]),(0,o.useEffect)(()=>C,[]),[e=>{e&&e!==m.current.element&&(C(),m.current.element=e,m.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},u,g]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=o.useRef(null),G=o.useRef(null);o.useImperativeHandle(e,()=>I.current);let L=(0,l.a)(S),[_,P]=o.useState(!1),[O,k]=o.useState(!1);if(_)throw _;if(O)throw O;let H=o.useRef(null);(0,l.b)(()=>{let e=I.current;D.width>0&&D.height>0&&e&&(H.current||(H.current=(0,l.c)(e)),async function(){await H.current.configure({gl:s,scene:M,events:u,shadows:p,linear:A,flat:g,legacy:v,orthographic:B,frameloop:C,dpr:y,performance:b,raycaster:x,camera:E,size:D,onPointerMissed:(...e)=>null==L.current?void 0:L.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(m?(0,l.i)(m)?m.current:m:G.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==F||F(e)}}),H.current.render((0,i.jsx)(R,{children:(0,i.jsx)(l.E,{set:k,children:(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(l.B,{set:P}),children:null!=t?t:null})})}))}())}),o.useEffect(()=>{let e=I.current;if(e)return()=>(0,l.d)(e)},[]);let j=m?"none":"auto";return(0,i.jsx)("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...a},...T,children:(0,i.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,i.jsx)("canvas",{ref:I,style:{display:"block"},children:r})})})}function p(e){return(0,i.jsx)(m.FiberProvider,{children:(0,i.jsx)(h,{...e})})}e.i(39695),e.i(98133),e.i(95087);var A=e.i(66027),g=e.i(54970),v=e.i(12979),B=e.i(49774),C=e.i(73949),y=e.i(62395),b=e.i(75567),x=e.i(47071);let E={value:!0},M=` +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 S=e.i(79123),F=e.i(47021),T=e.i(48066);let R={0:32,1:32,2:32,3:32,4:32,5:32};function w({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:a,lightmap:l}){let{debugMode:s}=(0,S.useDebug)(),c=(0,x.useTexture)(r.map(e=>(0,v.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,b.setupTexture)(e))}),d=a?(0,v.textureToUrl)(a):null,f=(0,x.useTexture)(d??v.FALLBACK_TEXTURE_URL,e=>{(0,b.setupTexture)(e)}),m=(0,o.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:i,detailTexture:a=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=E;let l=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:i[r]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),a&&(e.uniforms.detailTexture={value:a},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; +${n?"uniform sampler2D visibilityMask;":""} +${o?"uniform sampler2D terrainLightmap;":""} +uniform bool sunLightPointsDown; +${a?`uniform sampler2D detailTexture; +uniform float detailTiling; +uniform float detailFadeDistance; +varying vec3 vTerrainWorldPos;`:""} + +${M} + +// Global variable to store shadow factor from RE_Direct for use in output calculation +float terrainShadowFactor = 1.0; +`+e.fragmentShader,n){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; + ${l>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""} + ${l>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""} + ${l>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""} + ${l>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""} + ${l>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; + ${l>1?"float a1 = texture2D(mask1, alphaUv).r;":""} + ${l>2?"float a2 = texture2D(mask2, alphaUv).r;":""} + ${l>3?"float a3 = texture2D(mask3, alphaUv).r;":""} + ${l>4?"float a4 = texture2D(mask4, alphaUv).r;":""} + ${l>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; + ${l>1?"blended += c1 * a1;":""} + ${l>2?"blended += c2 * a2;":""} + ${l>3?"blended += c3 * a3;":""} + ${l>4?"blended += c4 * a4;":""} + ${l>5?"blended += c5 * a5;":""} + + // Assign to diffuseColor before lighting + vec3 textureColor = blended; + + ${a?`// 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:c,alphaTextures:n,visibilityMask:t,tiling:R,detailTexture:d?f:null,lightmap:l}),(0,F.injectCustomFog)(e,T.globalFogUniforms)},[c,n,t,f,d,l]),h=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let p=`${d?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,i.jsx)("meshLambertMaterial",{ref:h,map:e,depthWrite:!0,side:u.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:m},p)}function D(e){let t,r,n=(0,a.c)(8),{displacementMap:l,visibilityMask:s,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f}=e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),n[0]=t):t=n[0],n[1]!==c||n[2]!==d||n[3]!==l||n[4]!==f||n[5]!==u||n[6]!==s?(r=(0,i.jsx)(o.Suspense,{fallback:t,children:(0,i.jsx)(w,{displacementMap:l,visibilityMask:s,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f})}),n[1]=c,n[2]=d,n[3]=l,n[4]=f,n[5]=u,n[6]=s,n[7]=r):r=n[7],r}let I=(0,o.memo)(function(e){let t,r,n,o=(0,a.c)(15),{tileX:l,tileZ:s,blockSize:u,basePosition:c,textureNames:d,geometry:f,displacementMap:m,visibilityMask:h,alphaTextures:p,detailTextureName:A,lightmap:g,visible:v}=e,B=void 0===v||v,C=u/2,y=c.x+l*u+C,b=c.z+s*u+C;o[0]!==y||o[1]!==b?(t=[y,0,b],o[0]=y,o[1]=b,o[2]=t):t=o[2];let x=t;return o[3]!==p||o[4]!==A||o[5]!==m||o[6]!==g||o[7]!==d||o[8]!==h?(r=(0,i.jsx)(D,{displacementMap:m,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:A,lightmap:g}),o[3]=p,o[4]=A,o[5]=m,o[6]=g,o[7]=d,o[8]=h,o[9]=r):r=o[9],o[10]!==f||o[11]!==x||o[12]!==r||o[13]!==B?(n=(0,i.jsx)("mesh",{position:x,geometry:f,castShadow:!0,receiveShadow:!0,visible:B,children:r}),o[10]=f,o[11]=x,o[12]=r,o[13]=B,o[14]=n):n=o[14],n});var G=e.i(77482);function L(e){let t,r=(0,a.c)(3),n=(0,G.useRuntime)();return r[0]!==e||r[1]!==n?(t=n.getObjectByName(e),r[0]=e,r[1]=n,r[2]=t):t=r[2],t}function _(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r0?n:(t[0]!==r?(e=(0,y.getFloat)(r,"visibleDistance")??600,t[0]=r,t[1]=e):e=t[1],e)}(),V=(0,C.useThree)(O),X=-(128*N);D[6]!==X?(l={x:X,z:X},D[6]=X,D[7]=l):l=D[7];let q=l;if(D[8]!==G){let e=(0,y.getProperty)(G,"emptySquares");s=e?e.split(" ").map(k):[],D[8]=G,D[9]=s}else s=D[9];let W=s,{data:Y}=((w=(0,a.c)(2))[0]!==P?(R={queryKey:["terrain",P],queryFn:()=>(0,v.loadTerrain)(P)},w[0]=P,w[1]=R):R=w[1],(0,A.useQuery)(R));e:{let e;if(!Y){c=null;break e}let t=256*N;D[10]!==t||D[11]!==N||D[12]!==Y.heightMap?(!function(e,t,r){let n=e.attributes.position,i=e.attributes.uv,a=e.attributes.normal,o=n.array,l=i.array,s=a.array,u=n.count,c=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),i=Math.floor(r=Math.max(0,Math.min(255,r))),a=Math.min(n+1,255),o=Math.min(i+1,255),l=e-n,s=r-i;return(t[256*i+n]/65535*2048*(1-l)+t[256*i+a]/65535*2048*l)*(1-s)+(t[256*o+n]/65535*2048*(1-l)+t[256*o+a]/65535*2048*l)*s};for(let e=0;e0?(h/=g,p/=g,A/=g):(h=0,p=1,A=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=A}n.needsUpdate=!0,a.needsUpdate=!0}(e=function(e,t){let r=new u.BufferGeometry,n=new Float32Array(198147),i=new Float32Array(198147),a=new Float32Array(132098),o=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let o=257*t+r;n[3*o]=r*s-e/2,n[3*o+1]=e/2-t*s,n[3*o+2]=0,i[3*o]=0,i[3*o+1]=0,i[3*o+2]=1,a[2*o]=r/256,a[2*o+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,i=(e+1)*257+t,a=i+1;((t^e)&1)==0?(o[l++]=r,o[l++]=i,o[l++]=a,o[l++]=r,o[l++]=a,o[l++]=n):(o[l++]=r,o[l++]=i,o[l++]=n,o[l++]=n,o[l++]=i,o[l++]=a)}return r.setIndex(new u.BufferAttribute(o,1)),r.setAttribute("position",new u.Float32BufferAttribute(n,3)),r.setAttribute("normal",new u.Float32BufferAttribute(i,3)),r.setAttribute("uv",new u.Float32BufferAttribute(a,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),Y.heightMap,N),D[10]=t,D[11]=N,D[12]=Y.heightMap,D[13]=e):e=D[13],c=e}let z=c,Z=L("Sun");t:{let e,t;if(!Z){let e;D[14]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3(.57735,-.57735,.57735),D[14]=e):e=D[14],d=e;break t}D[15]!==Z?(e=((0,y.getProperty)(Z,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(H),D[15]=Z,D[16]=e):e=D[16];let[r,n,i]=e,a=Math.sqrt(r*r+i*i+n*n),o=r/a,l=i/a,s=n/a;D[17]!==l||D[18]!==s||D[19]!==o?(t=new u.Vector3(o,l,s),D[17]=l,D[18]=s,D[19]=o,D[20]=t):t=D[20],d=t}let $=d;r:{let e;if(!Y){f=null;break r}D[21]!==N||D[22]!==$||D[23]!==Y.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),i=Math.max(0,Math.min(255,r)),a=Math.floor(n),o=Math.floor(i),l=Math.min(a+1,255),s=Math.min(o+1,255),u=n-a,c=i-o;return((e[256*o+a]/65535*(1-u)+e[256*o+l]/65535*u)*(1-c)+(e[256*s+a]/65535*(1-u)+e[256*s+l]/65535*u)*c)*2048},i=new u.Vector3(-t.x,-t.y,-t.z).normalize(),a=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,l=e/2+.25,s=n(o,l),u=n(o-.5,l),c=n(o+.5,l),d=n(o,l-.5),f=-((n(o,l+.5)-d)/1),m=-((c-u)/1),h=Math.sqrt(f*f+r*r+m*m),p=Math.max(0,f/h*i.x+r/h*i.y+m/h*i.z),A=1;p>0&&(A=function(e,t,r,n,i,a){let o=n.z/i,l=n.x/i,s=n.y,u=Math.sqrt(o*o+l*l);if(u<1e-4)return 1;let c=.5/u,d=o*c,f=l*c,m=s*c,h=e,p=t,A=r+.1;for(let e=0;e<768&&(h+=d,p+=f,A+=m,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(A>2048));e++)if(AArray(eo).fill(null),D[34]=eo,D[35]=x):x=D[35];let[es,eu]=(0,o.useState)(x);D[36]===Symbol.for("react.memo_cache_sentinel")?(E={xStart:0,xEnd:0,zStart:0,zEnd:0},D[36]=E):E=D[36];let ec=(0,o.useRef)(E);return(D[37]!==q.x||D[38]!==q.z||D[39]!==K||D[40]!==V.position.x||D[41]!==V.position.z||D[42]!==eo||D[43]!==Q?(M=()=>{let e=V.position.x-q.x,t=V.position.z-q.z,r=Math.floor((e-Q)/K),n=Math.ceil((e+Q)/K),i=Math.floor((t-Q)/K),a=Math.ceil((t+Q)/K),o=ec.current;if(r===o.xStart&&n===o.xEnd&&i===o.zStart&&a===o.zEnd)return;o.xStart=r,o.xEnd=n,o.zStart=i,o.zEnd=a;let l=[];for(let e=r;e{let t=es[e];return(0,i.jsx)(I,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:K,basePosition:q,textureNames:Y.textureNames,geometry:z,displacementMap:et,visibilityMask:en,alphaTextures:ei,detailTextureName:J,lightmap:ee,visible:null!==t},e)}),D[55]=q,D[56]=K,D[57]=J,D[58]=el,D[59]=ei,D[60]=et,D[61]=z,D[62]=Y.textureNames,D[63]=ee,D[64]=es,D[65]=F):F=D[65],D[66]!==S||D[67]!==F?(T=(0,i.jsxs)(i.Fragment,{children:[S,F]}),D[66]=S,D[67]=F,D[68]=T):T=D[68],T):null});function O(e){return e.camera}function k(e){return parseInt(e,10)}function H(e){return parseFloat(e)}function j(e){return(0,b.setupMask)(e)}function U(e,t){return t}let N=(0,o.createContext)(null);function J(){return(0,o.useContext)(N)}function K(e,t){return(0,i.jsx)(t$,{object:e},e._id)}var Q=o;let V=(0,Q.createContext)(null),X={didCatch:!1,error:null};class q extends Q.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=X}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(X))}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(X))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,Q.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,Q.createElement)(V.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}var W=e.i(31067),Y=u;function z(e,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==u.TriangleFanDrawMode&&t!==u.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;e=2.0 are supported."));return}let l=new eK(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}}function en(){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 ei={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 ea{constructor(e){this.parser=e,this.name=ei.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,a)}}class eB{constructor(e){this.parser=e,this.name=ei.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 a=i.extensions[t],o=n.images[a.source],l=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(l=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,l);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 eC{constructor(e){this.parser=e,this.name=ei.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 a=i.extensions[t],o=n.images[a.source],l=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(l=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,l);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 ey{constructor(e){this.name=ei.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,a=e.count,o=e.byteStride,l=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,l,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,l,e.mode,e.filter),t})})}}}class eb{constructor(e){this.name=ei.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!==eD.TRIANGLES&&e.mode!==eD.TRIANGLE_STRIP&&e.mode!==eD.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[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 Y.Matrix4,r=new Y.Vector3,o=new Y.Quaternion,l=new Y.Vector3(1,1,1),s=new Y.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"},eO={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ek={CUBICSPLINE:void 0,LINEAR:Y.InterpolateLinear,STEP:Y.InterpolateDiscrete};function eH(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 ej(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 eU(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new Y.TextureLoader(this.options.manager):this.textureLoader=new Y.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Y.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};return eH(i,a,n),ej(a,n),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,n=t.length;r{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,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&&a.setY(t,d[e*l+1]),l>=3&&a.setZ(t,d[e*l+2]),l>=4&&a.setW(t,d[e*l+3]),l>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];let s=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=eG[r.magFilter]||Y.LinearFilter,t.minFilter=eG[r.minFilter]||Y.LinearMipmapLinearFilter,t.wrapS=eL[r.wrapS]||Y.RepeatWrapping,t.wrapT=eL[r.wrapT]||Y.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[l]=s,s}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],a=self.URL||self.webkitURL,o=i.uri||"",l=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){l=!0;let t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let s=Promise.resolve(o).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new Y.Texture(e);t.needsUpdate=!0,r(t)}),t.load(Y.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(o),ej(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",o),e});return this.sourceCache[e]=s,s}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[ei.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[ei.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[ei.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?ee:et),"colorSpace"in a?a.colorSpace=n:a.encoding=n===ee?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new Y.PointsMaterial,Y.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 Y.LineBasicMaterial,Y.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||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(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 Y.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},l=a.extensions||{},s=[];if(l[ei.KHR_MATERIALS_UNLIT]){let e=i[ei.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),s.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new Y.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],et),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(r.assignTexture(o,"map",n.baseColorTexture,ee)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(r.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(r.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=Y.DoubleSide);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==Y.MeshBasicMaterial&&(s.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new Y.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==Y.MeshBasicMaterial&&(s.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==Y.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new Y.Color().setRGB(e[0],e[1],e[2],et)}return void 0!==a.emissiveTexture&&t!==Y.MeshBasicMaterial&&s.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,ee)),Promise.all(s).then(function(){let n=new t(o);return a.name&&(n.name=a.name),ej(n,a),r.associations.set(n,{materials:e}),a.extensions&&eH(i,n,a),n})}createUniqueName(e){let t=Y.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 a=0,o=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new Y.Group:1===t.length?t[0]:new Y.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof Y.Material||e instanceof Y.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 a,o=[],l=e.name?e.name:e.uuid,s=[];switch(eO[i.path]===eO.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(l),eO[i.path]){case eO.weights:a=Y.NumberKeyframeTrack;break;case eO.rotation:a=Y.QuaternionKeyframeTrack;break;case eO.position:case eO.scale:a=Y.VectorKeyframeTrack;break;default:a=1===r.itemSize?Y.NumberKeyframeTrack:Y.VectorKeyframeTrack}let u=void 0!==n.interpolation?ek[n.interpolation]:Y.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=s.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(eX.has(e)){let t=eX.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++,a=e.byteLength,o=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),eX.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new eV.BufferGeometry;e.index&&t.setIndex(new eV.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=eW.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,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){var i,a,o;let l,s,u,c,d,f,m=n.attributeIDs,h=n.attributeTypes,p=t.GetEncodedGeometryType(r);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(p===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 A={index:null,attributes:[]};for(let r in m){let i,a,o=self[h[r]];if(n.useUniqueIDs)a=m[r],i=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[m[r]])))continue;i=t.GetAttribute(d,a)}A.attributes.push(function(e,t,r,n,i,a){let o=a.num_components(),l=r.num_points()*o,s=l*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(s);t.GetAttributeDataArrayForAllPoints(r,a,u,s,c);let d=new i(e.HEAPF32.buffer,c,l).slice();return e._free(c),{name:n,array:d,itemSize:o}}(e,t,d,r,o,i))}return p===e.TRIANGULAR_MESH&&(i=e,a=t,o=d,l=3*o.num_faces(),s=4*l,u=i._malloc(s),a.GetTrianglesUInt32Array(o,s,u),c=new Uint32Array(i.HEAPF32.buffer,u,l).slice(),i._free(u),A.index={array:c,itemSize:1}),e.destroy(d),A}(t,r,o,a),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(o),t.destroy(r)}})}}}var eY=e.i(971);let ez=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 f={keys:s,deep:n,inject:l,castShadow:i,receiveShadow:a};if(Array.isArray(t=o.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return ez(t)}return t},[t,e])))return o.createElement("group",(0,W.default)({},c,{ref:d}),t.map(e=>o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f))),r);let{children:m,...h}=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:i,receiveShadow:a}){let l={};for(let r of t)l[r]=e[r];return r&&(l.geometry&&"materialsOnly"!==r&&(l.geometry=l.geometry.clone()),l.material&&"geometriesOnly"!==r&&(l.material=l.material.clone())),n&&(l="function"==typeof n?{...l,children:n(e)}:o.isValidElement(n)?{...l,children:n}:{...l,...n}),e instanceof u.Mesh&&(i&&(l.castShadow=!0),a&&(l.receiveShadow=!0)),l}(t,f),p=t.type[0].toLowerCase()+t.type.slice(1);return o.createElement(p,(0,W.default)({},h,c,{ref:d}),t.children.map(e=>"Bone"===e.type?o.createElement("primitive",(0,W.default)({key:e.uuid,object:e},f)):o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f,{isChild:!0}))),r,m)}),e$=null,e0="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function e1(e=!0,r=!0,n){return i=>{n&&n(i),e&&(e$||(e$=new eq),e$.setDecoderPath("string"==typeof e?e:e0),i.setDRACOLoader(e$)),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 a=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 o(t,r,n,i,a,o){let l=e.exports.sbrk,s=n+3&-4,u=l(s*i),c=l(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&o&&o(u,s,i),r.set(d.subarray(u,u+n*i)),l(u-l(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}let l={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[l[a]])},decodeIndexBuffer(t,r,n,i){o(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){o(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){o(e.exports[s[a]],t,r,n,i,e.exports[l[u]])}}})())}}let e2=(e,t,r,n)=>(0,eY.useLoader)(er,e,e1(t,r,n));e2.preload=(e,t,r,n)=>eY.useLoader.preload(er,e,e1(t,r,n)),e2.clear=e=>eY.useLoader.clear(er,e),e2.setDecoderPath=e=>{e0=e};var e9=e.i(89887);let e3=` +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 e5({materialName:e,material:t,lightMap:r}){let n=(0,S.useDebug)(),a=n?.debugMode??!1,l=(0,v.textureToUrl)(e),s=(0,x.useTexture)(l,e=>(0,b.setupTexture)(e)),c=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),f=(0,o.useCallback)(e=>{let t;(0,F.injectCustomFog)(e,T.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new u.Vector3(0,.4,1):new u.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include +${e3} +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 `)},[d]),m=(0,o.useRef)(null),h=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=m.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!a,e.needsUpdate=!0)},[a]);let p={DEBUG_MODE:+!!a},A=`${d}`;return c?(0,i.jsx)("meshBasicMaterial",{ref:m,map:s,toneMapped:!1,defines:p,onBeforeCompile:f},A):(0,i.jsx)("meshLambertMaterial",{ref:h,map:s,lightMap:r,toneMapped:!1,defines:p,onBeforeCompile:f},A)}function e8(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=u.SRGBColorSpace),t??null}function e6(e){let t,r,n,l=(0,a.c)(13),{node:s}=e;e:{let e,r;if(!s.material){let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],l[0]=e):e=l[0],t=e;break e}if(Array.isArray(s.material)){let e;l[1]!==s.material?(e=s.material.map(e4),l[1]=s.material,l[2]=e):e=l[2],t=e;break e}l[3]!==s.material?(e=e8(s.material),l[3]=s.material,l[4]=e):e=l[4],l[5]!==e?(r=[e],l[5]=e,l[6]=r):r=l[6],t=r}let u=t;return l[7]!==u||l[8]!==s.material?(r=s.material?(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(s.material)?s.material.map((e,t)=>(0,i.jsx)(e5,{materialName:e.userData.resource_path,material:e,lightMap:u[t]},t)):(0,i.jsx)(e5,{materialName:s.material.userData.resource_path,material:s.material,lightMap:u[0]})}):null,l[7]=u,l[8]=s.material,l[9]=r):r=l[9],l[10]!==s.geometry||l[11]!==r?(n=(0,i.jsx)("mesh",{geometry:s.geometry,castShadow:!0,receiveShadow:!0,children:r}),l[10]=s.geometry,l[11]=r,l[12]=n):n=l[12],n}function e4(e){return e8(e)}let e7=(0,o.memo)(function(e){let t,r,n,o,l,s,u=(0,a.c)(10),{object:c,interiorFile:d}=e,{nodes:f}=((s=(0,a.c)(2))[0]!==d?(l=(0,v.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],e2(l)),m=(0,S.useDebug)(),h=m?.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]!==f?(r=Object.entries(f).filter(tn).map(ti),u[1]=f,u[2]=r):r=u[2],u[3]!==h||u[4]!==d||u[5]!==c?(n=h?(0,i.jsxs)(e9.FloatingLabel,{children:[c._id,": ",d]}):null,u[3]=h,u[4]=d,u[5]=c,u[6]=n):n=u[6],u[7]!==r||u[8]!==n?(o=(0,i.jsxs)("group",{rotation:t,children:[r,n]}),u[7]=r,u[8]=n,u[9]=o):o=u[9],o});function te(e){let t,r,n,o,l=(0,a.c)(9),{color:s,label:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(r=(0,i.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=r):r=l[2],l[3]!==s||l[4]!==u?(n=u?(0,i.jsx)(e9.FloatingLabel,{color:s,children:u}):null,l[3]=s,l[4]=u,l[5]=n):n=l[5],l[6]!==r||l[7]!==n?(o=(0,i.jsxs)("mesh",{children:[t,r,n]}),l[6]=r,l[7]=n,l[8]=o):o=l[8],o}function tt(e){let t,r=(0,a.c)(3),{label:n}=e,o=(0,S.useDebug)(),l=o?.debugMode??!1;return r[0]!==l||r[1]!==n?(t=l?(0,i.jsx)(te,{color:"red",label:n}):null,r[0]=l,r[1]=n,r[2]=t):t=r[2],t}let tr=(0,o.memo)(function(e){let t,r,n,l,s,u,c,d,f,m=(0,a.c)(22),{object:h}=e;m[0]!==h?(t=(0,y.getProperty)(h,"interiorFile"),m[0]=h,m[1]=t):t=m[1];let p=t;m[2]!==h?(r=(0,y.getPosition)(h),m[2]=h,m[3]=r):r=m[3];let A=r;m[4]!==h?(n=(0,y.getScale)(h),m[4]=h,m[5]=n):n=m[5];let g=n;m[6]!==h?(l=(0,y.getRotation)(h),m[6]=h,m[7]=l):l=m[7];let v=l,B=`${h._id}: ${p}`;return m[8]!==B?(s=(0,i.jsx)(tt,{label:B}),m[8]=B,m[9]=s):s=m[9],m[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,i.jsx)(te,{color:"orange"}),m[10]=u):u=m[10],m[11]!==p||m[12]!==h?(c=(0,i.jsx)(o.Suspense,{fallback:u,children:(0,i.jsx)(e7,{object:h,interiorFile:p})}),m[11]=p,m[12]=h,m[13]=c):c=m[13],m[14]!==s||m[15]!==c?(d=(0,i.jsx)(q,{fallback:s,children:c}),m[14]=s,m[15]=c,m[16]=d):d=m[16],m[17]!==A||m[18]!==v||m[19]!==g||m[20]!==d?(f=(0,i.jsx)("group",{position:A,quaternion:v,scale:g,children:d}),m[17]=A,m[18]=v,m[19]=g,m[20]=d,m[21]=f):f=m[21],f});function tn(e){let[,t]=e;return t.isMesh}function ti(e){let[t,r]=e;return(0,i.jsx)(e6,{node:r},t)}function ta(e,{path:t}){let[r]=(0,eY.useLoader)(u.CubeTextureLoader,[e],e=>e.setPath(t));return r}ta.preload=(e,{path:t})=>eY.useLoader.preload(u.CubeTextureLoader,[e],e=>e.setPath(t));let to=()=>{};function tl(e){return e.wrapS=u.RepeatWrapping,e.wrapT=u.RepeatWrapping,e.minFilter=u.LinearFilter,e.magFilter=u.LinearFilter,e.colorSpace=u.NoColorSpace,e.needsUpdate=!0,e}let ts=` + 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; + } +`,tu=` + 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 tc({textureUrl:e,radius:t,heightPercent:r,speed:n,windDirection:a,layerIndex:l}){let{debugMode:s}=(0,S.useDebug)(),{animationEnabled:c}=(0,S.useSettings)(),d=(0,o.useRef)(null),f=(0,x.useTexture)(e,tl),m=(0,o.useMemo)(()=>{let e=r-.05;return function(e,t,r,n){var i;let a,o,l,s,c,d,f,m,h,p,A,g,v,B,C,y,b,x=new u.BufferGeometry,E=new Float32Array(75),M=new Float32Array(50),S=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],F=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*F,a=e-t*F,o=e*S[n];E[3*n]=i,E[3*n+1]=o,E[3*n+2]=a,M[2*n]=r,M[2*n+1]=t}i=E,a=e=>({x:i[3*e],y:i[3*e+1],z:i[3*e+2]}),o=(e,t,r,n)=>{i[3*e]=t,i[3*e+1]=r,i[3*e+2]=n},l=a(1),s=a(3),c=a(5),d=a(6),f=a(8),m=a(9),h=a(15),p=a(16),A=a(18),g=a(19),v=a(21),B=a(23),C=c.x+(l.x-c.x)*.5,y=c.y+(l.y-c.y)*.5,b=c.z+(l.z-c.z)*.5,o(0,d.x+(C-d.x)*2,d.y+(y-d.y)*2,d.z+(b-d.z)*2),C=m.x+(s.x-m.x)*.5,y=m.y+(s.y-m.y)*.5,b=m.z+(s.z-m.z)*.5,o(4,f.x+(C-f.x)*2,f.y+(y-f.y)*2,f.z+(b-f.z)*2),C=v.x+(h.x-v.x)*.5,y=v.y+(h.y-v.y)*.5,b=v.z+(h.z-v.z)*.5,o(20,p.x+(C-p.x)*2,p.y+(y-p.y)*2,p.z+(b-p.z)*2),C=B.x+(g.x-B.x)*.5,y=B.y+(g.y-B.y)*.5,b=B.z+(g.z-B.z)*.5,o(24,A.x+(C-A.x)*2,A.y+(y-A.y)*2,A.z+(b-A.z)*2);let T=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(E,e),R=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;R.push(r,i,a),R.push(r,a,n)}return x.setIndex(R),x.setAttribute("position",new u.Float32BufferAttribute(E,3)),x.setAttribute("uv",new u.Float32BufferAttribute(M,2)),x.setAttribute("alpha",new u.Float32BufferAttribute(T,1)),x.computeBoundingSphere(),x}(t,r,e,0)},[t,r]);(0,o.useEffect)(()=>()=>{m.dispose()},[m]);let h=(0,o.useMemo)(()=>new u.ShaderMaterial({uniforms:{cloudTexture:{value:f},uvOffset:{value:new u.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:ts,fragmentShader:tu,transparent:!0,depthWrite:!1,side:u.DoubleSide}),[f,s,l]);return(0,o.useEffect)(()=>()=>{h.dispose()},[h]),(0,B.useFrame)(c?(e,t)=>{let r=1e3*t/32;d.current??=new u.Vector2(0,0),d.current.x+=a.x*n*r,d.current.y+=a.y*n*r,d.current.x-=Math.floor(d.current.x),d.current.y-=Math.floor(d.current.y),h.uniforms.uvOffset.value.copy(d.current)}:to),(0,i.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,i.jsx)("primitive",{object:h,attach:"material"})})}function td(e){var t;let r,n,l,s,c,d,f,m,h,p,g,C,b,x,E,M,S,F,T,R=(0,a.c)(37),{object:w}=e;R[0]!==w?(r=(0,y.getProperty)(w,"materialList"),R[0]=w,R[1]=r):r=R[1];let{data:D}=(t=r,(F=(0,a.c)(7))[0]!==t?(E=["detailMapList",t],M=()=>(0,v.loadDetailMapList)(t),F[0]=t,F[1]=E,F[2]=M):(E=F[1],M=F[2]),T=!!t,F[3]!==E||F[4]!==M||F[5]!==T?(S={queryKey:E,queryFn:M,enabled:T},F[3]=E,F[4]=M,F[5]=T,F[6]=S):S=F[6],(0,A.useQuery)(S));R[2]!==w?(n=(0,y.getFloat)(w,"visibleDistance")??500,R[2]=w,R[3]=n):n=R[3];let I=.95*n;R[4]!==w?(l=(0,y.getFloat)(w,"cloudSpeed1")??1e-4,R[4]=w,R[5]=l):l=R[5],R[6]!==w?(s=(0,y.getFloat)(w,"cloudSpeed2")??2e-4,R[6]=w,R[7]=s):s=R[7],R[8]!==w?(c=(0,y.getFloat)(w,"cloudSpeed3")??3e-4,R[8]=w,R[9]=c):c=R[9],R[10]!==l||R[11]!==s||R[12]!==c?(d=[l,s,c],R[10]=l,R[11]=s,R[12]=c,R[13]=d):d=R[13];let G=d;R[14]!==w?(f=(0,y.getFloat)(w,"cloudHeightPer1")??.35,R[14]=w,R[15]=f):f=R[15],R[16]!==w?(m=(0,y.getFloat)(w,"cloudHeightPer2")??.25,R[16]=w,R[17]=m):m=R[17],R[18]!==w?(h=(0,y.getFloat)(w,"cloudHeightPer3")??.2,R[18]=w,R[19]=h):h=R[19],R[20]!==f||R[21]!==m||R[22]!==h?(p=[f,m,h],R[20]=f,R[21]=m,R[22]=h,R[23]=p):p=R[23];let L=p;if(R[24]!==w){e:{let e,t=(0,y.getProperty)(w,"windVelocity");if(t){let[e,r]=t.split(" ").map(tf);if(0!==e||0!==r){g=new u.Vector2(r,-e).normalize();break e}}R[26]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector2(1,0),R[26]=e):e=R[26],g=e}R[24]=w,R[25]=g}else g=R[25];let _=g;t:{let e;if(!D){let e;R[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],R[27]=e):e=R[27],C=e;break t}if(R[28]!==L||R[29]!==G||R[30]!==D){e=[];for(let t=0;t<3;t++){let r=D[7+t];r&&e.push({texture:r,height:L[t],speed:G[t]})}R[28]=L,R[29]=G,R[30]=D,R[31]=e}else e=R[31];C=e}let P=C,O=(0,o.useRef)(null);return(R[32]===Symbol.for("react.memo_cache_sentinel")?(b=e=>{let{camera:t}=e;O.current&&O.current.position.copy(t.position)},R[32]=b):b=R[32],(0,B.useFrame)(b),P&&0!==P.length)?(R[33]!==P||R[34]!==I||R[35]!==_?(x=(0,i.jsx)("group",{ref:O,children:P.map((e,t)=>{let r=(0,v.textureToUrl)(e.texture);return(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(tc,{textureUrl:r,radius:I,heightPercent:e.height,speed:e.speed,windDirection:_,layerIndex:t})},t)})}),R[33]=P,R[34]=I,R[35]=_,R[36]=x):x=R[36],x):null}function tf(e){return parseFloat(e)}let tm=!1;function th(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new u.Color().setRGB(t,r,n),new u.Color().setRGB(t,r,n).convertSRGBToLinear()]}function tp({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:n}=(0,C.useThree)(),a=ta(e,{path:""}),l=!!t,s=(0,o.useMemo)(()=>n.projectionMatrixInverse,[n]),c=(0,o.useMemo)(()=>r?(0,T.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),d=(0,o.useRef)({skybox:{value:a},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:T.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),f=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,o.useEffect)(()=>{d.current.skybox.value=a,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=l,d.current.fogVolumeData.value=c,d.current.horizonFogHeight.value=f},[a,t,l,c,f]),(0,i.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,i.jsxs)("bufferGeometry",{children:[(0,i.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,i.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,i.jsx)("shaderMaterial",{uniforms:d.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 tA(e){let t,r,n,o,l=(0,a.c)(6),{materialList:s,fogColor:u,fogState:c}=e,{data:d}=((o=(0,a.c)(2))[0]!==s?(n={queryKey:["detailMapList",s],queryFn:()=>(0,v.loadDetailMapList)(s)},o[0]=s,o[1]=n):n=o[1],(0,A.useQuery)(n));l[0]!==d?(t=d?[(0,v.textureToUrl)(d[1]),(0,v.textureToUrl)(d[3]),(0,v.textureToUrl)(d[4]),(0,v.textureToUrl)(d[5]),(0,v.textureToUrl)(d[0]),(0,v.textureToUrl)(d[2])]:null,l[0]=d,l[1]=t):t=l[1];let f=t;return f?(l[2]!==u||l[3]!==c||l[4]!==f?(r=(0,i.jsx)(tp,{skyBoxFiles:f,fogColor:u,fogState:c}),l[2]=u,l[3]=c,l[4]=f,l[5]=r):r=l[5],r):null}function tg({skyColor:e,fogColor:t,fogState:r}){let{camera:n}=(0,C.useThree)(),a=!!t,l=(0,o.useMemo)(()=>n.projectionMatrixInverse,[n]),s=(0,o.useMemo)(()=>r?(0,T.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),c=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),d=(0,o.useRef)({skyColor:{value:e},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:a},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:T.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,o.useEffect)(()=>{d.current.skyColor.value=e,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=a,d.current.fogVolumeData.value=s,d.current.horizonFogHeight.value=c},[e,t,a,s,c]),(0,i.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,i.jsxs)("bufferGeometry",{children:[(0,i.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,i.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,i.jsx)("shaderMaterial",{uniforms:d.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 tv(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function tB({fogState:e,enabled:t}){let{scene:r,camera:n}=(0,C.useThree)(),i=(0,o.useRef)(null),a=(0,o.useMemo)(()=>(0,T.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,o.useEffect)(()=>{tm||((0,F.installCustomFogShader)(),tm=!0)},[]),(0,o.useEffect)(()=>{(0,T.resetGlobalFogUniforms)();let[t,o]=tv(e,n.position.y),l=new u.Fog(e.fogColor,t,o);return r.fog=l,i.current=l,(0,T.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,T.resetGlobalFogUniforms)()}},[r,n,e,a]),(0,o.useEffect)(()=>{let r=i.current;if(r)if(t){let[t,i]=tv(e,n.position.y);r.near=t,r.far=i}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,B.useFrame)(()=>{let r=i.current;if(!r)return;let o=n.position.y;if((0,T.updateGlobalFogUniforms)(o,a,t),t){let[t,n]=tv(e,o);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}function tC(e){return parseFloat(e)}function ty(e){return parseFloat(e)}function tb(e){return parseFloat(e)}let tx=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function tE(e){return tx.test(e)}let tM=(0,o.createContext)(null);function tS(){let e=(0,o.useContext)(tM);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function tF(e){let t,r,n,o=(0,a.c)(10),{children:l,object:s,shapeName:u,type:c}=e;o[0]!==u?(t=tE(u),o[0]=u,o[1]=t):t=o[1];let d=t;o[2]!==d||o[3]!==s||o[4]!==u||o[5]!==c?(r={object:s,shapeName:u,type:c,isOrganic:d},o[2]=d,o[3]=s,o[4]=u,o[5]=c,o[6]=r):r=o[6];let f=r;return o[7]!==l||o[8]!==f?(n=(0,i.jsx)(tM.Provider,{value:f,children:l}),o[7]=l,o[8]=f,o[9]=n):n=o[9],n}e.i(47167);var tT=e.i(69230),tR=e.i(69637),tw=e.i(54440),tD=e.i(51475);let tI=new Map;function tG(e){e.onBeforeCompile=t=>{(0,F.injectCustomFog)(t,T.globalFogUniforms),e instanceof u.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 tL(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive");if(r.has("SelfIlluminating")){let e=new u.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,fog:!0,...a&&{blending:u.AdditiveBlending}});return tG(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new u.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new u.MeshLambertMaterial({...e,side:0});return tG(r),tG(n),[r,n]}let o=new u.MeshLambertMaterial({map:t,side:2,reflectivity:0});return tG(o),o}let t_=(0,o.memo)(function(e){let t,r,n,o,l,s,c=(0,a.c)(35),{material:d,shapeName:f,geometry:m,backGeometry:h,castShadow:p,receiveShadow:A}=e,g=void 0!==p&&p,B=void 0!==A&&A,C=d.userData.resource_path;c[0]!==d.userData.flag_names?(t=d.userData.flag_names??[],c[0]=d.userData.flag_names,c[1]=t):t=c[1],c[2]!==t?(r=new Set(t),c[2]=t,c[3]=r):r=c[3];let y=r,b=function(e){var t,r;let n,i,o,l,s=(0,a.c)(14),{animationEnabled:c}=(0,S.useSettings)();s[0]!==e?(n={queryKey:["ifl",e],queryFn:()=>(0,v.loadImageFrameList)(e)},s[0]=e,s[1]=n):n=s[1];let{data:d}=(t=n,(0,tR.useBaseQuery)({...t,enabled:!0,suspense:!0,throwOnError:tw.defaultThrowOnError,placeholderData:void 0},tT.QueryObserver,void 0));if(s[2]!==d||s[3]!==e){let t;s[5]!==e?(t=t=>(0,v.iflTextureToUrl)(t.name,e),s[5]=e,s[6]=t):t=s[6],i=d.map(t),s[2]=d,s[3]=e,s[4]=i}else i=s[4];let f=i,m=(0,x.useTexture)(f);if(s[7]!==d||s[8]!==e||s[9]!==m){let t;if(!(o=tI.get(e))){let t,r,n,i,a,l,s,c,d;r=(t=m[0].image).width,n=t.height,a=Math.ceil(Math.sqrt(i=m.length)),l=Math.ceil(i/a),(s=document.createElement("canvas")).width=r*a,s.height=n*l,c=s.getContext("2d"),m.forEach((e,t)=>{let i=Math.floor(t/a);c.drawImage(e.image,t%a*r,i*n)}),(d=new u.CanvasTexture(s)).colorSpace=u.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=u.NearestFilter,d.magFilter=u.NearestFilter,d.wrapS=u.ClampToEdgeWrapping,d.wrapT=u.ClampToEdgeWrapping,d.repeat.set(1/a,1/l),o={texture:d,columns:a,rows:l,frameCount:i,frameStartTicks:[],totalTicks:0,lastFrame:-1},tI.set(e,o)}t=0,(r=o).frameStartTicks=d.map(e=>{let r=t;return t+=e.frameCount,r}),r.totalTicks=t,s[7]=d,s[8]=e,s[9]=m,s[10]=o}else o=s[10];let h=o;return s[11]!==c||s[12]!==h?(l=e=>{let t=c?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(h,e):0;!function(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)}(h,t)},s[11]=c,s[12]=h,s[13]=l):l=s[13],(0,tD.useTick)(l),h.texture}(`textures/${C}.ifl`);c[4]!==f?(n=f&&tE(f),c[4]=f,c[5]=n):n=c[5];let E=n;c[6]!==y||c[7]!==E||c[8]!==d||c[9]!==b?(o=tL(d,b,y,E),c[6]=y,c[7]=E,c[8]=d,c[9]=b,c[10]=o):o=c[10];let M=o;if(Array.isArray(M)){let e,t,r,n,a,o=h||m;return c[11]!==M[0]?(e=(0,i.jsx)("primitive",{object:M[0],attach:"material"}),c[11]=M[0],c[12]=e):e=c[12],c[13]!==g||c[14]!==B||c[15]!==o||c[16]!==e?(t=(0,i.jsx)("mesh",{geometry:o,castShadow:g,receiveShadow:B,children:e}),c[13]=g,c[14]=B,c[15]=o,c[16]=e,c[17]=t):t=c[17],c[18]!==M[1]?(r=(0,i.jsx)("primitive",{object:M[1],attach:"material"}),c[18]=M[1],c[19]=r):r=c[19],c[20]!==g||c[21]!==m||c[22]!==B||c[23]!==r?(n=(0,i.jsx)("mesh",{geometry:m,castShadow:g,receiveShadow:B,children:r}),c[20]=g,c[21]=m,c[22]=B,c[23]=r,c[24]=n):n=c[24],c[25]!==n||c[26]!==t?(a=(0,i.jsxs)(i.Fragment,{children:[t,n]}),c[25]=n,c[26]=t,c[27]=a):a=c[27],a}return c[28]!==M?(l=(0,i.jsx)("primitive",{object:M,attach:"material"}),c[28]=M,c[29]=l):l=c[29],c[30]!==g||c[31]!==m||c[32]!==B||c[33]!==l?(s=(0,i.jsx)("mesh",{geometry:m,castShadow:g,receiveShadow:B,children:l}),c[30]=g,c[31]=m,c[32]=B,c[33]=l,c[34]=s):s=c[34],s}),tP=(0,o.memo)(function(e){let t,r,n,o,l,s,u,c,d=(0,a.c)(40),{material:f,shapeName:m,geometry:h,backGeometry:p,castShadow:A,receiveShadow:g}=e,B=void 0!==A&&A,C=void 0!==g&&g,y=f.userData.resource_path;d[0]!==f.userData.flag_names?(t=f.userData.flag_names??[],d[0]=f.userData.flag_names,d[1]=t):t=d[1],d[2]!==t?(r=new Set(t),d[2]=t,d[3]=r):r=d[3];let E=r;y||console.warn(`No resource_path was found on "${m}" - rendering fallback.`),d[4]!==y?(n=y?(0,v.textureToUrl)(y):v.FALLBACK_TEXTURE_URL,d[4]=y,d[5]=n):n=d[5];let M=n;d[6]!==m?(o=m&&tE(m),d[6]=m,d[7]=o):o=d[7];let S=o,F=E.has("Translucent");d[8]!==S||d[9]!==F?(l=e=>S||F?(0,b.setupTexture)(e,{disableMipmaps:!0}):(0,b.setupTexture)(e),d[8]=S,d[9]=F,d[10]=l):l=d[10];let T=(0,x.useTexture)(M,l);d[11]!==E||d[12]!==S||d[13]!==f||d[14]!==T?(s=tL(f,T,E,S),d[11]=E,d[12]=S,d[13]=f,d[14]=T,d[15]=s):s=d[15];let R=s;if(Array.isArray(R)){let e,t,r,n,a,o=p||h;return d[16]!==R[0]?(e=(0,i.jsx)("primitive",{object:R[0],attach:"material"}),d[16]=R[0],d[17]=e):e=d[17],d[18]!==B||d[19]!==C||d[20]!==e||d[21]!==o?(t=(0,i.jsx)("mesh",{geometry:o,castShadow:B,receiveShadow:C,children:e}),d[18]=B,d[19]=C,d[20]=e,d[21]=o,d[22]=t):t=d[22],d[23]!==R[1]?(r=(0,i.jsx)("primitive",{object:R[1],attach:"material"}),d[23]=R[1],d[24]=r):r=d[24],d[25]!==B||d[26]!==h||d[27]!==C||d[28]!==r?(n=(0,i.jsx)("mesh",{geometry:h,castShadow:B,receiveShadow:C,children:r}),d[25]=B,d[26]=h,d[27]=C,d[28]=r,d[29]=n):n=d[29],d[30]!==t||d[31]!==n?(a=(0,i.jsxs)(i.Fragment,{children:[t,n]}),d[30]=t,d[31]=n,d[32]=a):a=d[32],a}return d[33]!==R?(u=(0,i.jsx)("primitive",{object:R,attach:"material"}),d[33]=R,d[34]=u):u=d[34],d[35]!==B||d[36]!==h||d[37]!==C||d[38]!==u?(c=(0,i.jsx)("mesh",{geometry:h,castShadow:B,receiveShadow:C,children:u}),d[35]=B,d[36]=h,d[37]=C,d[38]=u,d[39]=c):c=d[39],c}),tO=(0,o.memo)(function(e){let t=(0,a.c)(14),{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:s,receiveShadow:u}=e,c=void 0!==s&&s,d=void 0!==u&&u,f=new Set(r.userData.flag_names??[]).has("IflMaterial"),m=r.userData.resource_path;if(f&&m){let e;return t[0]!==l||t[1]!==c||t[2]!==o||t[3]!==r||t[4]!==d||t[5]!==n?(e=(0,i.jsx)(t_,{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:c,receiveShadow:d}),t[0]=l,t[1]=c,t[2]=o,t[3]=r,t[4]=d,t[5]=n,t[6]=e):e=t[6],e}if(!r.name)return null;{let e;return t[7]!==l||t[8]!==c||t[9]!==o||t[10]!==r||t[11]!==d||t[12]!==n?(e=(0,i.jsx)(tP,{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:c,receiveShadow:d}),t[7]=l,t[8]=c,t[9]=o,t[10]=r,t[11]=d,t[12]=n,t[13]=e):e=t[13],e}});function tk(e){let t,r,n,o,l=(0,a.c)(9),{color:s,label:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(r=(0,i.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=r):r=l[2],l[3]!==s||l[4]!==u?(n=u?(0,i.jsx)(e9.FloatingLabel,{color:s,children:u}):null,l[3]=s,l[4]=u,l[5]=n):n=l[5],l[6]!==r||l[7]!==n?(o=(0,i.jsxs)("mesh",{children:[t,r,n]}),l[6]=r,l[7]=n,l[8]=o):o=l[8],o}function tH(e){let t,r=(0,a.c)(4),{color:n,label:o}=e,{debugMode:l}=(0,S.useDebug)();return r[0]!==n||r[1]!==l||r[2]!==o?(t=l?(0,i.jsx)(tk,{color:n,label:o}):null,r[0]=n,r[1]=l,r[2]=o,r[3]=t):t=r[3],t}function tj(e){let t,r,n,l,s,u=(0,a.c)(13),{loadingColor:c,children:d}=e,f=void 0===c?"yellow":c,{object:m,shapeName:h}=tS();if(!h){let e,t=`${m._id}: `;return u[0]!==t?(e=(0,i.jsx)(tH,{color:"orange",label:t}),u[0]=t,u[1]=e):e=u[1],e}let p=`${m._id}: ${h}`;return u[2]!==p?(t=(0,i.jsx)(tH,{color:"red",label:p}),u[2]=p,u[3]=t):t=u[3],u[4]!==f?(r=(0,i.jsx)(tk,{color:f}),u[4]=f,u[5]=r):r=u[5],u[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,i.jsx)(tU,{}),u[6]=n):n=u[6],u[7]!==d||u[8]!==r?(l=(0,i.jsxs)(o.Suspense,{fallback:r,children:[n,d]}),u[7]=d,u[8]=r,u[9]=l):l=u[9],u[10]!==t||u[11]!==l?(s=(0,i.jsx)(q,{fallback:t,children:l}),u[10]=t,u[11]=l,u[12]=s):s=u[12],s}let tU=(0,o.memo)(function(){var e;let t,r,n,l,s,u,c,d,f=(0,a.c)(19),{object:m,shapeName:h,isOrganic:p}=tS(),{debugMode:A}=(0,S.useDebug)(),{nodes:g}=((d=(0,a.c)(2))[0]!==h?(c=(0,v.shapeToUrl)(h),d[0]=h,d[1]=c):c=d[1],e2(c));if(f[0]!==g){e:{let r,n=Object.values(g).filter(tN);if(n.length>0){let r;e=n[0].skeleton,r=new Set,e.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),t=r;break e}f[2]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,f[2]=r):r=f[2],t=r}f[0]=g,f[1]=t}else t=f[1];let B=t;f[3]!==B||f[4]!==p||f[5]!==g?(r=Object.entries(g).filter(tJ).map(e=>{let[,t]=e,r=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(o)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let i of e)t+=a[3*i],r+=a[3*i+1],n+=a[3*i+2];let i=Math.sqrt(t*t+r*r+n*n);for(let o of(i>0&&(t/=i,r/=i,n/=i),e))a[3*o]=t,a[3*o+1]=r,a[3*o+2]=n}if(t.needsUpdate=!0,p){let e=(n=r.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:t,geometry:r,backGeometry:n}=e;return(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)("mesh",{geometry:r,children:(0,i.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:t.material?Array.isArray(t.material)?t.material.map((e,t)=>(0,i.jsx)(tO,{material:e,shapeName:h,geometry:r,backGeometry:n,castShadow:y,receiveShadow:y},t)):(0,i.jsx)(tO,{material:t.material,shapeName:h,geometry:r,backGeometry:n,castShadow:y,receiveShadow:y}):null},t.id)}),f[8]=y,f[9]=C,f[10]=h,f[11]=l):l=f[11],f[12]!==A||f[13]!==m||f[14]!==h?(s=A?(0,i.jsxs)(e9.FloatingLabel,{children:[m._id,": ",h]}):null,f[12]=A,f[13]=m,f[14]=h,f[15]=s):s=f[15],f[16]!==l||f[17]!==s?(u=(0,i.jsxs)("group",{rotation:n,children:[l,s]}),f[16]=l,f[17]=s,f[18]=u):u=f[18],u});function tN(e){return e.skeleton}function tJ(e){let[,t]=e;return t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)}var tK=e.i(6112);let tQ={1:"Storm",2:"Inferno"},tV=(0,o.createContext)(null);function tX(){let e=(0,o.useContext)(tV);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function tq({children:e}){let{camera:t}=(0,C.useThree)(),[r,n]=(0,o.useState)(-1),[a,l]=(0,o.useState)({}),[s,c]=(0,o.useState)(()=>({initialized:!1,position:null,quarternion:null})),d=(0,o.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),f=(0,o.useCallback)(e=>{l(t=>{let{[e.id]:r,...n}=t;return n})},[]),m=Object.keys(a).length,h=(0,o.useCallback)(e=>{if(e>=0&&e{h(m?(r+1)%m:-1)},[m,r,h]);(0,o.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),i=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new u.Vector3(...n),quarternion:new u.Quaternion(...i)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,o.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,o.useEffect)(()=>{s.initialized&&!s.position&&m>0&&-1===r&&h(0)},[m,h,r,s]);let A=(0,o.useMemo)(()=>({registerCamera:d,unregisterCamera:f,nextCamera:p,setCameraIndex:h,cameraCount:m}),[d,f,p,h,m]);return 0===m&&-1!==r&&n(-1),(0,i.jsx)(tV.Provider,{value:A,children:e})}let tW=(0,o.createContext)(null),tY=tW.Provider,tz=(0,o.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),tZ={AudioEmitter:function(e){let t,r=(0,a.c)(3),{audioEnabled:n}=(0,S.useSettings)();return r[0]!==n||r[1]!==e?(t=n?(0,i.jsx)(tz,{...e}):null,r[0]=n,r[1]=e,r[2]=t):t=r[2],t},Camera:function(e){let t,r,n,i,l,s=(0,a.c)(14),{object:c}=e,{registerCamera:d,unregisterCamera:f}=tX(),m=(0,o.useId)();s[0]!==c?(t=(0,y.getProperty)(c,"dataBlock"),s[0]=c,s[1]=t):t=s[1];let h=t;s[2]!==c?(r=(0,y.getPosition)(c),s[2]=c,s[3]=r):r=s[3];let p=r;s[4]!==c?(n=(0,y.getRotation)(c),s[4]=c,s[5]=n):n=s[5];let A=n;return s[6]!==h||s[7]!==m||s[8]!==p||s[9]!==A||s[10]!==d||s[11]!==f?(i=()=>{if("Observer"===h){let e={id:m,position:new u.Vector3(...p),rotation:A};return d(e),()=>{f(e)}}},l=[m,h,d,f,p,A],s[6]=h,s[7]=m,s[8]=p,s[9]=A,s[10]=d,s[11]=f,s[12]=i,s[13]=l):(i=s[12],l=s[13]),(0,o.useEffect)(i,l),null},ForceFieldBare:(0,o.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:tr,Item:function(e){let t,r,n,o,l,s,u,c,d,f=(0,a.c)(23),{object:m}=e,h=J();f[0]!==m?(t=(0,y.getProperty)(m,"dataBlock")??"",f[0]=m,f[1]=t):t=f[1];let p=t,A=(0,tK.useDatablock)(p);f[2]!==m?(r=(0,y.getPosition)(m),f[2]=m,f[3]=r):r=f[3];let g=r;f[4]!==m?(n=(0,y.getScale)(m),f[4]=m,f[5]=n):n=f[5];let v=n;f[6]!==m?(o=(0,y.getRotation)(m),f[6]=m,f[7]=o):o=f[7];let B=o;f[8]!==A?(l=(0,y.getProperty)(A,"shapeFile"),f[8]=A,f[9]=l):l=f[9];let C=l;C||console.error(` missing shape for datablock: ${p}`);let b=p?.toLowerCase()==="flag",x=h?.team??null,E=x&&x>0?tQ[x]:null,M=b&&E?`${E} Flag`:null;return f[10]!==M?(s=M?(0,i.jsx)(e9.FloatingLabel,{opacity:.6,children:M}):null,f[10]=M,f[11]=s):s=f[11],f[12]!==s?(u=(0,i.jsx)(tj,{loadingColor:"pink",children:s}),f[12]=s,f[13]=u):u=f[13],f[14]!==g||f[15]!==B||f[16]!==v||f[17]!==u?(c=(0,i.jsx)("group",{position:g,quaternion:B,scale:v,children:u}),f[14]=g,f[15]=B,f[16]=v,f[17]=u,f[18]=c):c=f[18],f[19]!==m||f[20]!==C||f[21]!==c?(d=(0,i.jsx)(tF,{type:"Item",object:m,shapeName:C,children:c}),f[19]=m,f[20]=C,f[21]=c,f[22]=d):d=f[22],d},SimGroup:function(e){let t,r,n,o,l=(0,a.c)(17),{object:s}=e,u=J(),c=null,d=!1;if(u&&u.hasTeams){if(d=!0,null!=u.team)c=u.team;else if(s._name){let e;if(l[0]!==s._name){let t;l[2]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,l[2]=t):t=l[2],e=s._name.match(t),l[0]=s._name,l[1]=e}else e=l[1];let t=e;t&&(c=parseInt(t[1],10))}}else if(s._name){let e;l[3]!==s._name?(e=s._name.toLowerCase(),l[3]=s._name,l[4]=e):e=l[4],d="teams"===e}l[5]!==d||l[6]!==s||l[7]!==u||l[8]!==c?(t={object:s,parent:u,hasTeams:d,team:c},l[5]=d,l[6]=s,l[7]=u,l[8]=c,l[9]=t):t=l[9];let f=t;return l[10]!==s._children?(r=s._children??[],l[10]=s._children,l[11]=r):r=l[11],l[12]!==r?(n=r.map(K),l[12]=r,l[13]=n):n=l[13],l[14]!==f||l[15]!==n?(o=(0,i.jsx)(N.Provider,{value:f,children:n}),l[14]=f,l[15]=n,l[16]=o):o=l[16],o},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,S.useSettings)(),n=(0,y.getProperty)(e,"materialList"),a=(0,o.useMemo)(()=>th((0,y.getProperty)(e,"SkySolidColor")),[e]),l=(0,y.getInt)(e,"useSkyTextures")??1,s=(0,o.useMemo)(()=>(function(e,t=!0){let r=(0,y.getFloat)(e,"fogDistance")??0,n=(0,y.getFloat)(e,"visibleDistance")??1e3,i=(0,y.getFloat)(e,"high_fogDistance"),a=(0,y.getFloat)(e,"high_visibleDistance"),o=t&&null!=i&&i>0?i:r,l=t&&null!=a&&a>0?a:n,s=function(e){if(!e)return new u.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new u.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,y.getProperty)(e,"fogColor")),c=[];for(let t=1;t<=3;t++){let r=function(e,t=1){if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[n,i,a]=r;return n<=0||a<=i?null:{visibleDistance:n,minHeight:i,maxHeight:a,percentage:Math.max(0,Math.min(1,t))}}((0,y.getProperty)(e,`fogVolume${t}`),1);r&&c.push(r)}let d=c.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:o,visibleDistance:l,fogColor:s,fogVolumes:c,fogLine:d,enabled:l>o}})(e,r),[e,r]),c=(0,o.useMemo)(()=>th((0,y.getProperty)(e,"fogColor")),[e]),d=a||c,f=s.enabled&&t,m=s.fogColor,{scene:h,gl:p}=(0,C.useThree)();(0,o.useEffect)(()=>{if(f){let e=m.clone();h.background=e,p.setClearColor(e)}else if(d){let e=d[0].clone();h.background=e,p.setClearColor(e)}else h.background=null;return()=>{h.background=null}},[h,p,f,m,d]);let A=a?.[1];return(0,i.jsxs)(i.Fragment,{children:[n&&l?(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(tA,{materialList:n,fogColor:f?m:void 0,fogState:f?s:void 0},n)}):A?(0,i.jsx)(tg,{skyColor:A,fogColor:f?m:void 0,fogState:f?s:void 0}):null,(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(td,{object:e})}),s.enabled?(0,i.jsx)(tB,{fogState:s,enabled:t}):null]})},StaticShape:function(e){let t,r,n,o,l,s,u,c,d=(0,a.c)(19),{object:f}=e;d[0]!==f?(t=(0,y.getProperty)(f,"dataBlock")??"",d[0]=f,d[1]=t):t=d[1];let m=t,h=(0,tK.useDatablock)(m);d[2]!==f?(r=(0,y.getPosition)(f),d[2]=f,d[3]=r):r=d[3];let p=r;d[4]!==f?(n=(0,y.getRotation)(f),d[4]=f,d[5]=n):n=d[5];let A=n;d[6]!==f?(o=(0,y.getScale)(f),d[6]=f,d[7]=o):o=d[7];let g=o;d[8]!==h?(l=(0,y.getProperty)(h,"shapeFile"),d[8]=h,d[9]=l):l=d[9];let v=l;return v||console.error(` missing shape for datablock: ${m}`),d[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,i.jsx)(tj,{}),d[10]=s):s=d[10],d[11]!==p||d[12]!==A||d[13]!==g?(u=(0,i.jsx)("group",{position:p,quaternion:A,scale:g,children:s}),d[11]=p,d[12]=A,d[13]=g,d[14]=u):u=d[14],d[15]!==f||d[16]!==v||d[17]!==u?(c=(0,i.jsx)(tF,{type:"StaticShape",object:f,shapeName:v,children:u}),d[15]=f,d[16]=v,d[17]=u,d[18]=c):c=d[18],c},Sun:function(e){let t,r,n,l,s,c,d,f,m,h,p=(0,a.c)(25),{object:A}=e;p[0]!==A?(t=((0,y.getProperty)(A,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(tb),p[0]=A,p[1]=t):t=p[1];let[g,v,B]=t,C=Math.sqrt(g*g+B*B+v*v),b=g/C,x=B/C,M=v/C;p[2]!==b||p[3]!==x||p[4]!==M?(r=new u.Vector3(b,x,M),p[2]=b,p[3]=x,p[4]=M,p[5]=r):r=p[5];let S=r,F=-(5e3*S.x),T=-(5e3*S.y),R=-(5e3*S.z);p[6]!==F||p[7]!==T||p[8]!==R?(n=new u.Vector3(F,T,R),p[6]=F,p[7]=T,p[8]=R,p[9]=n):n=p[9];let w=n;if(p[10]!==A){let[e,t,r]=((0,y.getProperty)(A,"color")??"0.7 0.7 0.7 1").split(" ").map(ty);l=new u.Color(e,t,r),p[10]=A,p[11]=l}else l=p[11];let D=l;if(p[12]!==A){let[e,t,r]=((0,y.getProperty)(A,"ambient")??"0.5 0.5 0.5 1").split(" ").map(tC);s=new u.Color(e,t,r),p[12]=A,p[13]=s}else s=p[13];let I=s,G=S.y<0;return p[14]!==G?(c=()=>{E.value=G},d=[G],p[14]=G,p[15]=c,p[16]=d):(c=p[15],d=p[16]),(0,o.useEffect)(c,d),p[17]!==D||p[18]!==w?(f=(0,i.jsx)("directionalLight",{position:w,color:D,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}),p[17]=D,p[18]=w,p[19]=f):f=p[19],p[20]!==I?(m=(0,i.jsx)("ambientLight",{color:I,intensity:1}),p[20]=I,p[21]=m):m=p[21],p[22]!==f||p[23]!==m?(h=(0,i.jsxs)(i.Fragment,{children:[f,m]}),p[22]=f,p[23]=m,p[24]=h):h=p[24],h},TerrainBlock:P,TSStatic:function(e){let t,r,n,o,l,s,u,c=(0,a.c)(17),{object:d}=e;c[0]!==d?(t=(0,y.getProperty)(d,"shapeName"),c[0]=d,c[1]=t):t=c[1];let f=t;c[2]!==d?(r=(0,y.getPosition)(d),c[2]=d,c[3]=r):r=c[3];let m=r;c[4]!==d?(n=(0,y.getRotation)(d),c[4]=d,c[5]=n):n=c[5];let h=n;c[6]!==d?(o=(0,y.getScale)(d),c[6]=d,c[7]=o):o=c[7];let p=o;return f||console.error(" missing shapeName for object",d),c[8]===Symbol.for("react.memo_cache_sentinel")?(l=(0,i.jsx)(tj,{}),c[8]=l):l=c[8],c[9]!==m||c[10]!==h||c[11]!==p?(s=(0,i.jsx)("group",{position:m,quaternion:h,scale:p,children:l}),c[9]=m,c[10]=h,c[11]=p,c[12]=s):s=c[12],c[13]!==d||c[14]!==f||c[15]!==s?(u=(0,i.jsx)(tF,{type:"TSStatic",object:d,shapeName:f,children:s}),c[13]=d,c[14]=f,c[15]=s,c[16]=u):u=c[16],u},Turret:function(e){let t,r,n,o,l,s,u,c,d,f,m,h=(0,a.c)(27),{object:p}=e;h[0]!==p?(t=(0,y.getProperty)(p,"dataBlock")??"",h[0]=p,h[1]=t):t=h[1];let A=t;h[2]!==p?(r=(0,y.getProperty)(p,"initialBarrel"),h[2]=p,h[3]=r):r=h[3];let g=r,v=(0,tK.useDatablock)(A),B=(0,tK.useDatablock)(g);h[4]!==p?(n=(0,y.getPosition)(p),h[4]=p,h[5]=n):n=h[5];let C=n;h[6]!==p?(o=(0,y.getRotation)(p),h[6]=p,h[7]=o):o=h[7];let b=o;h[8]!==p?(l=(0,y.getScale)(p),h[8]=p,h[9]=l):l=h[9];let x=l;h[10]!==v?(s=(0,y.getProperty)(v,"shapeFile"),h[10]=v,h[11]=s):s=h[11];let E=s;h[12]!==B?(u=(0,y.getProperty)(B,"shapeFile"),h[12]=B,h[13]=u):u=h[13];let M=u;return E||console.error(` missing shape for datablock: ${A}`),g&&!M&&console.error(` missing shape for barrel datablock: ${g}`),h[14]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)(tj,{}),h[14]=c):c=h[14],h[15]!==M||h[16]!==p?(d=M?(0,i.jsx)(tF,{type:"Turret",object:p,shapeName:M,children:(0,i.jsx)("group",{position:[0,1.5,0],children:(0,i.jsx)(tj,{})})}):null,h[15]=M,h[16]=p,h[17]=d):d=h[17],h[18]!==C||h[19]!==b||h[20]!==x||h[21]!==d?(f=(0,i.jsxs)("group",{position:C,quaternion:b,scale:x,children:[c,d]}),h[18]=C,h[19]=b,h[20]=x,h[21]=d,h[22]=f):f=h[22],h[23]!==p||h[24]!==E||h[25]!==f?(m=(0,i.jsx)(tF,{type:"Turret",object:p,shapeName:E,children:f}),h[23]=p,h[24]=E,h[25]=f,h[26]=m):m=h[26],m},WaterBlock:(0,o.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,r,n,o=(0,a.c)(7),{object:l}=e;o[0]!==l?(t=(0,y.getPosition)(l),o[0]=l,o[1]=t):t=o[1];let s=t;o[2]!==l?(r=(0,y.getProperty)(l,"name"),o[2]=l,o[3]=r):r=o[3];let u=r;return o[4]!==u||o[5]!==s?(n=u?(0,i.jsx)(e9.FloatingLabel,{position:s,opacity:.6,children:u}):null,o[4]=u,o[5]=s,o[6]=n):n=o[6],n}};function t$(e){let t,r,n,l=(0,a.c)(9),{object:s}=e,{missionType:u}=(0,o.useContext)(tW);l[0]!==s?(t=new Set(((0,y.getProperty)(s,"missionTypesList")??"").toLowerCase().split(/s+/).filter(Boolean)),l[0]=s,l[1]=t):t=l[1];let c=t;l[2]!==u||l[3]!==c?(r=!c.size||c.has(u.toLowerCase()),l[2]=u,l[3]=c,l[4]=r):r=l[4];let d=r,f=tZ[s._className];return l[5]!==f||l[6]!==s||l[7]!==d?(n=d&&f?(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(f,{object:s})}):null,l[5]=f,l[6]=s,l[7]=d,l[8]=n):n=l[8],n}var t0=e.i(86608),t1=e.i(38433),t2=e.i(33870),t9=e.i(91996);let t3=async e=>{let t;try{t=(0,v.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let r=await fetch(t);if(!r.ok)return console.error(`Script fetch failed: ${e} (${r.status})`),null;return await r.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}},t5=(0,t2.createScriptCache)(),t8={findFiles:e=>{let t=(0,g.default)(e,{nocase:!0});return(0,t9.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,t9.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,t9.getResourceMap)()[(0,t9.getResourceKey)(e)]},t6=(0,o.memo)(function(e){let t,r,n,l,s,u,c,d,f=(0,a.c)(17),{name:m,missionType:h,onLoadingChange:p}=e,{data:g}=((d=(0,a.c)(2))[0]!==m?(c={queryKey:["parsedMission",m],queryFn:()=>(0,v.loadMission)(m)},d[0]=m,d[1]=c):c=d[1],(0,A.useQuery)(c)),{missionGroup:B,runtime:C,progress:y}=function(e,t,r){let n,i,l,s=(0,a.c)(6);s[0]===Symbol.for("react.memo_cache_sentinel")?(n={missionGroup:void 0,runtime:void 0,progress:0},s[0]=n):n=s[0];let[u,c]=(0,o.useState)(n);return s[1]!==e||s[2]!==t||s[3]!==r?(i=()=>{if(!r)return;let n=new AbortController,i=(0,t1.createProgressTracker)(),a=()=>{c(e=>({...e,progress:i.progress}))};i.on("update",a);let{runtime:o}=(0,t0.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:t3,fileSystem:t8,cache:t5,signal:n.signal,progress:i,ignoreScripts:["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"]},onMissionLoadDone:()=>{c({missionGroup:l.getObjectByName("MissionGroup"),runtime:l,progress:1})}}),l=o;return()=>{i.off("update",a),n.abort(),l.destroy()}},l=[e,t,r],s[1]=e,s[2]=t,s[3]=r,s[4]=i,s[5]=l):(i=s[4],l=s[5]),(0,o.useEffect)(i,l),u}(m,h,g),b=!g||!B||!C;f[0]!==B||f[1]!==h||f[2]!==g?(t={metadata:g,missionType:h,missionGroup:B},f[0]=B,f[1]=h,f[2]=g,f[3]=t):t=f[3];let x=t;return(f[4]!==b||f[5]!==p||f[6]!==y?(r=()=>{p?.(b,y)},n=[b,y,p],f[4]=b,f[5]=p,f[6]=y,f[7]=r,f[8]=n):(r=f[7],n=f[8]),(0,o.useEffect)(r,n),b)?null:(f[9]!==B?(l=(0,i.jsx)(t$,{object:B}),f[9]=B,f[10]=l):l=f[10],f[11]!==C||f[12]!==l?(s=(0,i.jsx)(G.RuntimeProvider,{runtime:C,children:l}),f[11]=C,f[12]=l,f[13]=s):s=f[13],f[14]!==x||f[15]!==s?(u=(0,i.jsx)(tY,{value:x,children:s}),f[14]=x,f[15]=s,f[16]=u):u=f[16],u)});var t4=e.i(19273),t7=e.i(86491),re=e.i(40143),rt=e.i(15823),rr=class extends rt.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let n=t.queryKey,i=t.queryHash??(0,t4.hashQueryKeyByOptions)(n,t),a=this.get(i);return a||(a=new t7.Query({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}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(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,t4.matchQuery)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,t4.matchQuery)(e,t)):t}notify(e){re.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rn=e.i(88587),ri=e.i(36553),ra=class extends rn.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.#a({type:"continue"})},r={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,ri.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({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.#a({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:i})}let a=await this.#i.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#a({type:"success",data:a}),a}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.#a({type:"error",error:t}),t}finally{this.#n.runNext(this)}}#a(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),re.notifyManager.batch(()=>{this.#r.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}},ro=rt,rl=class extends ro.Subscribable{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#l=new Map,this.#s=0}#o;#l;#s;build(e,t,r){let n=new ra({client:e,mutationCache:this,mutationId:++this.#s,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=rs(e);if("string"==typeof t){let r=this.#l.get(t);r?r.push(e):this.#l.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=rs(e);if("string"==typeof t){let r=this.#l.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#l.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=rs(e);if("string"!=typeof t)return!0;{let r=this.#l.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=rs(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#l.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){re.notifyManager.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#l.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,t4.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,t4.matchMutation)(e,t))}notify(e){re.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return re.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(t4.noop))))}};function rs(e){return e.options.scope?.id}var ru=e.i(75555),rc=e.i(14448);function rd(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},s=0,u=async()=>{let r=!1,u=(0,t4.ensureQueryFn)(t.options,t.fetchOptions),c=async(e,n,i)=>{let a;if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let o=(a={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta},(0,t4.addConsumeAwareSignal)(a,()=>t.signal,()=>r=!0),a),l=await u(o),{maxPages:s}=t.options,c=i?t4.addToStart:t4.addToEnd;return{pages:c(e.pages,l,s),pageParams:c(e.pageParams,n,s)}};if(i&&a.length){let e="backward"===i,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:rf)(n,t);l=await c(t,r,e)}else{let t=e??a.length;do{let e=0===s?o[0]??n.initialPageParam:rf(n,l);if(s>0&&null==e)break;l=await c(l,e),s++}while(st.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function rf(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 rm=class{#u;#n;#c;#d;#f;#m;#h;#p;constructor(e={}){this.#u=e.queryCache||new rr,this.#n=e.mutationCache||new rl,this.#c=e.defaultOptions||{},this.#d=new Map,this.#f=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#h=ru.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=rc.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#h?.(),this.#h=void 0,this.#p?.(),this.#p=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 t=this.defaultQueryOptions(e),r=this.#u.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,t4.resolveStaleTime)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=this.#u.get(n.queryHash),a=i?.state.data,o=(0,t4.functionalUpdate)(t,a);if(void 0!==o)return this.#u.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return re.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;re.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return re.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(re.notifyManager.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(t4.noop).catch(t4.noop)}invalidateQueries(e,t={}){return re.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,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(re.notifyManager.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(t4.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(t4.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,t4.resolveStaleTime)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t4.noop).catch(t4.noop)}fetchInfiniteQuery(e){return e.behavior=rd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t4.noop).catch(t4.noop)}ensureInfiniteQueryData(e){return e.behavior=rd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return rc.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,t){this.#d.set((0,t4.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,t4.partialMatchKey)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#f.set((0,t4.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#f.values()],r={};return t.forEach(t=>{(0,t4.partialMatchKey)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,t4.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===t4.skipToken&&(t.enabled=!1),t}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()}},rh=e.i(12598),rp=e.i(8155);let rA=e=>{let t=(0,rp.createStore)(e),r=e=>(function(e,t=e=>e){let r=o.default.useSyncExternalStore(e.subscribe,o.default.useCallback(()=>t(e.getState()),[e,t]),o.default.useCallback(()=>t(e.getInitialState()),[e,t]));return o.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},rg=o.createContext(null);function rv({map:e,children:t,onChange:r,domElement:n}){let i=e.map(e=>e.name+e.keys).join("-"),a=o.useMemo(()=>{let t,r;return t=()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(e,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());a=r=>{let n=e(r);if(!i(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return i(a)},t(e,r,n)})?rA(r):rA},[i]),l=o.useMemo(()=>[a.subscribe,a.getState,a],[i]),s=a.setState;return o.useEffect(()=>{let t=e.map(({name:e,keys:t,up:n})=>({keys:t,up:n,fn:t=>{s({[e]:t}),r&&r(e,t,l[1]())}})).reduce((e,{keys:t,fn:r,up:n=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:n}),e),{}),i=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,pressed:a,up:o}=n;n.pressed=!0,(o||!a)&&i(!0)},a=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,up:a}=n;n.pressed=!1,a&&i(!1)},o=n||window;return o.addEventListener("keydown",i,{passive:!0}),o.addEventListener("keyup",a,{passive:!0}),()=>{o.removeEventListener("keydown",i),o.removeEventListener("keyup",a)}},[n,i]),o.createElement(rg.Provider,{value:l,children:t})}function rB(e){let[t,r,n]=o.useContext(rg);return e?n(e):[t,r]}var rC=Object.defineProperty;class ry{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?rC(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;t{let n;return(n="symbol"!=typeof t?t+"":t)in e?rb(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let rE=new u.Euler(0,0,0,"YXZ"),rM=new u.Vector3,rS={type:"change"},rF={type:"lock"},rT={type:"unlock"},rR=Math.PI/2;class rw extends ry{constructor(e,t){super(),rx(this,"camera"),rx(this,"domElement"),rx(this,"isLocked"),rx(this,"minPolarAngle"),rx(this,"maxPolarAngle"),rx(this,"pointerSpeed"),rx(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(rE.setFromQuaternion(this.camera.quaternion),rE.y-=.002*e.movementX*this.pointerSpeed,rE.x-=.002*e.movementY*this.pointerSpeed,rE.x=Math.max(rR-this.maxPolarAngle,Math.min(rR-this.minPolarAngle,rE.x)),this.camera.quaternion.setFromEuler(rE),this.dispatchEvent(rS))}),rx(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(rF),this.isLocked=!0):(this.dispatchEvent(rT),this.isLocked=!1))}),rx(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),rx(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))}),rx(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))}),rx(this,"dispose",()=>{this.disconnect()}),rx(this,"getObject",()=>this.camera),rx(this,"direction",new u.Vector3(0,0,-1)),rx(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),rx(this,"moveForward",e=>{rM.setFromMatrixColumn(this.camera.matrix,0),rM.crossVectors(this.camera.up,rM),this.camera.position.addScaledVector(rM,e)}),rx(this,"moveRight",e=>{rM.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(rM,e)}),rx(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),rx(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)}}(n={}).forward="forward",n.backward="backward",n.left="left",n.right="right",n.up="up",n.down="down",n.lookUp="lookUp",n.lookDown="lookDown",n.lookLeft="lookLeft",n.lookRight="lookRight",n.camera1="camera1",n.camera2="camera2",n.camera3="camera3",n.camera4="camera4",n.camera5="camera5",n.camera6="camera6",n.camera7="camera7",n.camera8="camera8",n.camera9="camera9";let rD=Math.PI/2-.01;function rI(){let e,t,r,n,i,l,s,c,d,f,m,h,p,A=(0,a.c)(26),{speedMultiplier:g,setSpeedMultiplier:v}=(0,S.useControls)(),[y,b]=rB(),{camera:x,gl:E}=(0,C.useThree)(),{nextCamera:M,setCameraIndex:F,cameraCount:T}=tX(),R=(0,o.useRef)(null);A[0]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3,A[0]=e):e=A[0];let w=(0,o.useRef)(e);A[1]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Vector3,A[1]=t):t=A[1];let D=(0,o.useRef)(t);A[2]===Symbol.for("react.memo_cache_sentinel")?(r=new u.Vector3,A[2]=r):r=A[2];let I=(0,o.useRef)(r);A[3]===Symbol.for("react.memo_cache_sentinel")?(n=new u.Euler(0,0,0,"YXZ"),A[3]=n):n=A[3];let G=(0,o.useRef)(n);return A[4]!==x||A[5]!==E.domElement?(i=()=>{let e=new rw(x,E.domElement);return R.current=e,()=>{e.dispose()}},l=[x,E.domElement],A[4]=x,A[5]=E.domElement,A[6]=i,A[7]=l):(i=A[6],l=A[7]),(0,o.useEffect)(i,l),A[8]!==x||A[9]!==E.domElement||A[10]!==M?(s=()=>{let e=E.domElement,t=new u.Euler(0,0,0,"YXZ"),r=!1,n=!1,i=0,a=0,o=t=>{R.current?.isLocked||t.target===e&&(r=!0,n=!1,i=t.clientX,a=t.clientY)},l=e=>{!r||!n&&3>Math.abs(e.clientX-i)&&3>Math.abs(e.clientY-a)||(n=!0,t.setFromQuaternion(x.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-rD,Math.min(rD,t.x)),x.quaternion.setFromEuler(t))},s=()=>{r=!1},c=t=>{let r=R.current;!r||r.isLocked?M():t.target!==e||n||r.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),document.addEventListener("click",c),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s),document.removeEventListener("click",c)}},c=[x,E.domElement,M],A[8]=x,A[9]=E.domElement,A[10]=M,A[11]=s,A[12]=c):(s=A[11],c=A[12]),(0,o.useEffect)(s,c),A[13]!==T||A[14]!==F||A[15]!==y?(d=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return y(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,r=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;v(e=>Math.max(.1,Math.min(5,Math.round((e+r)*20)/20)))},t=E.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},h=[E.domElement,v],A[18]=E.domElement,A[19]=v,A[20]=m,A[21]=h):(m=A[20],h=A[21]),(0,o.useEffect)(m,h),A[22]!==x||A[23]!==b||A[24]!==g?(p=(e,t)=>{let{forward:r,backward:n,left:i,right:a,up:o,down:l,lookUp:s,lookDown:u,lookLeft:c,lookRight:d}=b();if((s||u||c||d)&&(G.current.setFromQuaternion(x.quaternion,"YXZ"),c&&(G.current.y=G.current.y+ +t),d&&(G.current.y=G.current.y-t),s&&(G.current.x=G.current.x+ +t),u&&(G.current.x=G.current.x-t),G.current.x=Math.max(-rD,Math.min(rD,G.current.x)),x.quaternion.setFromEuler(G.current)),!r&&!n&&!i&&!a&&!o&&!l)return;let f=80*g;x.getWorldDirection(w.current),w.current.normalize(),D.current.crossVectors(x.up,w.current).normalize(),I.current.set(0,0,0),r&&I.current.add(w.current),n&&I.current.sub(w.current),i&&I.current.add(D.current),a&&I.current.sub(D.current),o&&(I.current.y=I.current.y+1),l&&(I.current.y=I.current.y-1),I.current.lengthSq()>0&&(I.current.normalize().multiplyScalar(f*t),x.position.add(I.current))},A[22]=x,A[23]=b,A[24]=g,A[25]=p):p=A[25],(0,B.useFrame)(p),null}let rG=[{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 rL(){let e,t,r=(0,a.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],r[0]=e):e=r[0],(0,o.useEffect)(r_,e),r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)(rI,{}),r[1]=t):t=r[1],t}function r_(){return window.addEventListener("keydown",rP,{capture:!0}),window.addEventListener("keyup",rP,{capture:!0}),()=>{window.removeEventListener("keydown",rP,{capture:!0}),window.removeEventListener("keyup",rP,{capture:!0})}}function rP(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}function rO(){let e,t,r,n,o,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y,b,x,E,M,S=(0,a.c)(51),F=rB(rX),T=rB(rV),R=rB(rQ),w=rB(rK),D=rB(rJ),I=rB(rN),G=rB(rU),L=rB(rj),_=rB(rH),P=rB(rk);return S[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[0]=e):e=S[0],S[1]!==F?(t=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":F,children:"W"}),S[1]=F,S[2]=t):t=S[2],S[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[3]=r):r=S[3],S[4]!==t?(n=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[e,t,r]}),S[4]=t,S[5]=n):n=S[5],S[6]!==R?(o=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":R,children:"A"}),S[6]=R,S[7]=o):o=S[7],S[8]!==T?(l=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":T,children:"S"}),S[8]=T,S[9]=l):l=S[9],S[10]!==w?(s=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":w,children:"D"}),S[10]=w,S[11]=s):s=S[11],S[12]!==o||S[13]!==l||S[14]!==s?(u=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[o,l,s]}),S[12]=o,S[13]=l,S[14]=s,S[15]=u):u=S[15],S[16]!==n||S[17]!==u?(c=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[n,u]}),S[16]=n,S[17]=u,S[18]=c):c=S[18],S[19]===Symbol.for("react.memo_cache_sentinel")?(d=(0,i.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↑"}),S[19]=d):d=S[19],S[20]!==D?(f=(0,i.jsx)("div",{className:"KeyboardOverlay-row",children:(0,i.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":D,children:[d," Space"]})}),S[20]=D,S[21]=f):f=S[21],S[22]===Symbol.for("react.memo_cache_sentinel")?(m=(0,i.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↓"}),S[22]=m):m=S[22],S[23]!==I?(h=(0,i.jsx)("div",{className:"KeyboardOverlay-row",children:(0,i.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":I,children:[m," Shift"]})}),S[23]=I,S[24]=h):h=S[24],S[25]!==f||S[26]!==h?(p=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[f,h]}),S[25]=f,S[26]=h,S[27]=p):p=S[27],S[28]===Symbol.for("react.memo_cache_sentinel")?(A=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[28]=A):A=S[28],S[29]!==G?(g=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":G,children:"↑"}),S[29]=G,S[30]=g):g=S[30],S[31]===Symbol.for("react.memo_cache_sentinel")?(v=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[31]=v):v=S[31],S[32]!==g?(B=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[A,g,v]}),S[32]=g,S[33]=B):B=S[33],S[34]!==_?(C=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":_,children:"←"}),S[34]=_,S[35]=C):C=S[35],S[36]!==L?(y=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":L,children:"↓"}),S[36]=L,S[37]=y):y=S[37],S[38]!==P?(b=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":P,children:"→"}),S[38]=P,S[39]=b):b=S[39],S[40]!==C||S[41]!==y||S[42]!==b?(x=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[C,y,b]}),S[40]=C,S[41]=y,S[42]=b,S[43]=x):x=S[43],S[44]!==B||S[45]!==x?(E=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[B,x]}),S[44]=B,S[45]=x,S[46]=E):E=S[46],S[47]!==p||S[48]!==E||S[49]!==c?(M=(0,i.jsxs)("div",{className:"KeyboardOverlay",children:[c,p,E]}),S[47]=p,S[48]=E,S[49]=c,S[50]=M):M=S[50],M}function rk(e){return e.lookRight}function rH(e){return e.lookLeft}function rj(e){return e.lookDown}function rU(e){return e.lookUp}function rN(e){return e.down}function rJ(e){return e.up}function rK(e){return e.right}function rQ(e){return e.left}function rV(e){return e.backward}function rX(e){return e.forward}let rq=Math.PI/2-.01;function rW({joystickState:t,joystickZone:r,lookJoystickState:n,lookJoystickZone:a}){let{touchMode:l}=(0,S.useControls)();(0,o.useEffect)(()=>{let n=r.current;if(!n)return;let i=null,a=!1;return e.A(84968).then(e=>{a||((i=e.default.create({zone:n,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,r)=>{t.current.angle=r.angle.radian,t.current.force=Math.min(1,r.force)}),i.on("end",()=>{t.current.force=0}))}),()=>{a=!0,i?.destroy()}},[t,r,l]),(0,o.useEffect)(()=>{if("dualStick"!==l)return;let t=a.current;if(!t)return;let r=null,i=!1;return e.A(84968).then(e=>{i||((r=e.default.create({zone:t,mode:"static",position:{right:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,t)=>{n.current.angle=t.angle.radian,n.current.force=Math.min(1,t.force)}),r.on("end",()=>{n.current.force=0}))}),()=>{i=!0,r?.destroy()}},[l,n,a]);let s=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return"dualStick"===l?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:r,className:"TouchJoystick TouchJoystick--left",onContextMenu:e=>e.preventDefault(),onTouchStart:s}),(0,i.jsx)("div",{ref:a,className:"TouchJoystick TouchJoystick--right",onContextMenu:e=>e.preventDefault(),onTouchStart:s})]}):(0,i.jsx)("div",{ref:r,className:"TouchJoystick",onContextMenu:e=>e.preventDefault(),onTouchStart:s})}function rY(e){let t,r,n,i,l,s,c,d,f,m,h=(0,a.c)(25),{joystickState:p,joystickZone:A,lookJoystickState:g}=e,{speedMultiplier:v,touchMode:y}=(0,S.useControls)(),{camera:b,gl:x}=(0,C.useThree)();h[0]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Euler(0,0,0,"YXZ"),h[0]=t):t=h[0];let E=(0,o.useRef)(t),M=(0,o.useRef)(null);h[1]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},h[1]=r):r=h[1];let F=(0,o.useRef)(r);h[2]===Symbol.for("react.memo_cache_sentinel")?(n=new u.Vector3,h[2]=n):n=h[2];let T=(0,o.useRef)(n);h[3]===Symbol.for("react.memo_cache_sentinel")?(i=new u.Vector3,h[3]=i):i=h[3];let R=(0,o.useRef)(i);h[4]===Symbol.for("react.memo_cache_sentinel")?(l=new u.Vector3,h[4]=l):l=h[4];let w=(0,o.useRef)(l);return h[5]!==b.quaternion?(s=()=>{E.current.setFromQuaternion(b.quaternion,"YXZ")},h[5]=b.quaternion,h[6]=s):s=h[6],h[7]!==b?(c=[b],h[7]=b,h[8]=c):c=h[8],(0,o.useEffect)(s,c),h[9]!==b.quaternion||h[10]!==x.domElement||h[11]!==A||h[12]!==y?(d=()=>{if("moveLookStick"!==y)return;let e=x.domElement,t=e=>{let t=A.current;if(!t)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom},r=e=>{if(null===M.current)for(let r=0;r{if(null!==M.current)for(let t=0;t{for(let t=0;t{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",n),e.removeEventListener("touchend",i),e.removeEventListener("touchcancel",i),M.current=null}},h[9]=b.quaternion,h[10]=x.domElement,h[11]=A,h[12]=y,h[13]=d):d=h[13],h[14]!==b||h[15]!==x.domElement||h[16]!==A||h[17]!==y?(f=[b,x.domElement,A,y],h[14]=b,h[15]=x.domElement,h[16]=A,h[17]=y,h[18]=f):f=h[18],(0,o.useEffect)(d,f),h[19]!==b||h[20]!==p.current||h[21]!==g||h[22]!==v||h[23]!==y?(m=(e,t)=>{let{force:r,angle:n}=p.current;if("dualStick"===y){let e=g.current;if(e.force>.15){let r=(e.force-.15)/.85,n=Math.cos(e.angle),i=Math.sin(e.angle);E.current.setFromQuaternion(b.quaternion,"YXZ"),E.current.y=E.current.y-n*r*2.5*t,E.current.x=E.current.x+i*r*2.5*t,E.current.x=Math.max(-rq,Math.min(rq,E.current.x)),b.quaternion.setFromEuler(E.current)}if(r>.08){let e=80*v*((r-.08)/.92),i=Math.cos(n),a=Math.sin(n);b.getWorldDirection(T.current),T.current.normalize(),R.current.crossVectors(b.up,T.current).normalize(),w.current.set(0,0,0).addScaledVector(T.current,a).addScaledVector(R.current,-i),w.current.lengthSq()>0&&(w.current.normalize().multiplyScalar(e*t),b.position.add(w.current))}}else if("moveLookStick"===y&&r>0){let e=80*v*.5;if(b.getWorldDirection(T.current),T.current.normalize(),w.current.copy(T.current).multiplyScalar(e*t),b.position.add(w.current),r>=.15){let e=Math.cos(n),i=Math.sin(n),a=(r-.15)/.85;E.current.setFromQuaternion(b.quaternion,"YXZ"),E.current.y=E.current.y-e*a*1.25*t,E.current.x=E.current.x+i*a*1.25*t,E.current.x=Math.max(-rq,Math.min(rq,E.current.x)),b.quaternion.setFromEuler(E.current)}}},h[19]=b,h[20]=p.current,h[21]=g,h[22]=v,h[23]=y,h[24]=m):m=h[24],(0,B.useFrame)(m),null}var rz="undefined"!=typeof window&&!!(null==(r=window.document)?void 0:r.createElement);function rZ(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function r$(e){return e?"self"in e?e.self:rZ(e).defaultView||window:self}function r0(e,t=!1){let{activeElement:r}=rZ(e);if(!(null==r?void 0:r.nodeName))return null;if(r2(r)&&r.contentDocument)return r0(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=rZ(r).getElementById(e);if(t)return t}}return r}function r1(e,t){return e===t||e.contains(t)}function r2(e){return"IFRAME"===e.tagName}function r9(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==r3.indexOf(e.type)}var r3=["button","color","file","image","reset","submit"];function r5(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function r8(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function r6(e){return e.isContentEditable||r8(e)}function r4(e){let t=0,r=0;if(r8(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=rZ(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&r1(e,n.anchorNode)&&n.focusNode&&r1(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function r7(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function ne(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 ne(e.parentElement)||document.scrollingElement||document.body}function nt(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function nr(e,t){return t&&e.item(t)||null}var nn=Symbol("FOCUS_SILENTLY");function ni(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function na(){}function no(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nl(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function ns(e){return e}function nu(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function nc(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function nd(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function nf(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function nm(...e){for(let t of e)if(void 0!==t)return t}function nh(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function np(){return rz&&!!navigator.maxTouchPoints}function nA(){return!!rz&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function ng(){return rz&&nA()&&/apple/i.test(navigator.vendor)}function nv(e){return!!(e.currentTarget&&!r1(e.currentTarget,e.target))}function nB(e){return e.target===e.currentTarget}function nC(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 ny(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function nb(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!r1(r,n)}function nx(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,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function nE(e,t,r,n=window){let i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(nE(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var nM={...o},nS=nM.useId;nM.useDeferredValue;var nF=nM.useInsertionEffect,nT=rz?o.useLayoutEffect:o.useEffect;function nR(e){let t=(0,o.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return nF?nF(()=>{t.current=e}):t.current=e,(0,o.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function nw(...e){return(0,o.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)nh(r,t)}},e)}function nD(e){if(nS){let t=nS();return e||t}let[t,r]=(0,o.useState)(e);return nT(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function nI(e,t){let r=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,o.useEffect)(()=>()=>{r.current=!1},[])}function nG(){return(0,o.useReducer)(()=>[],[])}function nL(e){return nR("function"==typeof e?e:()=>e)}function n_(e,t,r=[]){let n=(0,o.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function nP(e=!1,t){let[r,n]=(0,o.useState)(null);return{portalRef:nw(n,t),portalNode:r,domReady:!e||r}}var nO=!1,nk=!1,nH=0,nj=0;function nU(e){let t,r;t=e.movementX||e.screenX-nH,r=e.movementY||e.screenY-nj,nH=e.screenX,nj=e.screenY,(t||r||0)&&(nk=!0)}function nN(){nk=!1}function nJ(e){let t=o.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function nK(e,t){return o.memo(e,t)}function nQ(e,t){let r,{wrapElement:n,render:a,...l}=t,s=nw(t.ref,a&&(0,o.isValidElement)(a)&&("ref"in a.props||"ref"in a)?({...a.props}).ref||a.ref:null);if(o.isValidElement(a)){let e={...a.props,ref:s};r=o.cloneElement(a,function(e,t){let r={...e};for(let n in t){if(!no(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}(l,e))}else r=a?a(l):(0,i.jsx)(e,{...l});return n?n(r):r}function nV(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function nX(e=[],t=[]){let r=o.createContext(void 0),n=o.createContext(void 0),a=()=>o.useContext(r),l=t=>e.reduceRight((e,r)=>(0,i.jsx)(r,{...t,children:e}),(0,i.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:a,useScopedContext:(e=!1)=>{let t=o.useContext(n),r=a();return e?t:t||r},useProviderContext:()=>{let e=o.useContext(n),t=a();if(!e||e!==t)return t},ContextProvider:l,ScopedContextProvider:e=>(0,i.jsx)(l,{...e,children:t.reduceRight((t,r)=>(0,i.jsx)(r,{...e,children:t}),(0,i.jsx)(n.Provider,{...e}))})}}var nq=nX(),nW=nq.useContext;nq.useScopedContext,nq.useProviderContext;var nY=nX([nq.ContextProvider],[nq.ScopedContextProvider]),nz=nY.useContext;nY.useScopedContext;var nZ=nY.useProviderContext,n$=nY.ContextProvider,n0=nY.ScopedContextProvider,n1=(0,o.createContext)(void 0),n2=(0,o.createContext)(void 0),n9=(0,o.createContext)(!0),n3="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 n5(e){return!(!e.matches(n3)||!r5(e)||e.closest("[inert]"))}function n8(e){if(!n5(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=r0(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function n6(e,t){let r=Array.from(e.querySelectorAll(n3));t&&r.unshift(e);let n=r.filter(n5);return n.forEach((e,t)=>{if(r2(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...n6(r))}}),n}function n4(e,t,r){let n=Array.from(e.querySelectorAll(n3)),i=n.filter(n8);return(t&&n8(e)&&i.unshift(e),i.forEach((e,t)=>{if(r2(e)&&e.contentDocument){let n=n4(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function n7(e,t){var r;let n,i,a,o;return r=document.body,n=r0(r),a=(i=n6(r,!1)).indexOf(n),(o=i.slice(a+1)).find(n8)||(e?i.find(n8):null)||(t?o[0]:null)||null}function ie(e,t){var r;let n,i,a,o;return r=document.body,n=r0(r),a=(i=n6(r,!1).reverse()).indexOf(n),(o=i.slice(a+1)).find(n8)||(e?i.find(n8):null)||(t?o[0]:null)||null}function it(e){let t=r0(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function ir(e){let t=r0(e);if(!t)return!1;if(r1(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function ii(e){!ir(e)&&n5(e)&&e.focus()}var ia=ng(),io=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],il=Symbol("safariFocusAncestor");function is(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function iu(e,t){return nR(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var ic=!1,id=!0;function im(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(id=!1)}function ih(e){e.metaKey||e.ctrlKey||e.altKey||(id=!0)}var ip=nV(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var a,l,s,u,c;let d=(0,o.useRef)(null);(0,o.useEffect)(()=>{!e||ic||(nE("mousedown",im,!0),nE("keydown",ih,!0),ic=!0)},[e]),ia&&(0,o.useEffect)(()=>{if(!e)return;let t=d.current;if(!t||!is(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&&nd(i),m=!!f&&!t,[h,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{e&&m&&h&&p(!1)},[e,m,h]),(0,o.useEffect)(()=>{if(!e||!h)return;let t=d.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{n5(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,h]);let A=iu(i.onKeyPressCapture,f),g=iu(i.onMouseDownCapture,f),v=iu(i.onClickCapture,f),B=i.onMouseDown,C=nR(t=>{if(null==B||B(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!ia||nv(t)||!r9(r)&&!is(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let a=function(e){for(;e&&!n5(e);)e=e.closest(n3);return e||null}(r.parentElement);a&&(a[il]=!0),nx(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),a&&(a[il]=!1),n||ii(r)})}),y=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&it(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",p(!0)))},b=i.onKeyDownCapture,x=nR(t=>{if(null==b||b(t),t.defaultPrevented||!e||h||t.metaKey||t.altKey||t.ctrlKey||!nB(t))return;let r=t.currentTarget;nx(r,"focusout",()=>y(t,r))}),E=i.onFocusCapture,M=nR(t=>{if(null==E||E(t),t.defaultPrevented||!e)return;if(!nB(t))return void p(!1);let r=t.currentTarget;id||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:io.includes(n))}(t.target)?nx(t.target,"focusout",()=>y(t,r)):p(!1)}),S=i.onBlur,F=nR(t=>{null==S||S(t),!e||nb(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),T=(0,o.useContext)(n9),R=nR(t=>{e&&r&&t&&T&&queueMicrotask(()=>{it(t)||n5(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,o.useState)(()=>r(void 0));return nT(()=>{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),D=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),I=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),G=i.style,L=(0,o.useMemo)(()=>m?{pointerEvents:"none",...G}:G,[m,G]);return i={"data-focus-visible":e&&h||void 0,"data-autofocus":r||void 0,"aria-disabled":f||void 0,...i,ref:nw(d,R,i.ref),style:L,tabIndex:(a=e,l=m,s=D,u=I,c=i.tabIndex,a?l?s&&!u?-1:void 0:s?c:c||0:c),disabled:!!I&&!!m||void 0,contentEditable:f?void 0:i.contentEditable,onKeyPressCapture:A,onClickCapture:v,onMouseDownCapture:g,onMouseDown:C,onKeyDownCapture:x,onFocusCapture:M,onBlur:F},nf(i)});function iA(e){let t=[];for(let r of e)t.push(...r);return t}function ig(e){return e.slice().reverse()}function iv(e,t,r){return nR(n=>{var i;let a,o;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!nB(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(a=n.target)||r8(a))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let l=e.getState(),s=null==(i=nr(e,l.activeId))?void 0:i.element;if(!s)return;let{view:u,...c}=n;s!==(null==r?void 0:r.current)&&s.focus(),o=new KeyboardEvent(n.type,c),s.dispatchEvent(o)||n.preventDefault(),n.currentTarget.contains(s)&&n.stopPropagation()})}nJ(function(e){return nQ("div",ip(e))});var iB=nV(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...a}){let l=nZ();nu(e=e||l,!1);let s=(0,o.useRef)(null),u=(0,o.useRef)(null),c=function(e){let[t,r]=(0,o.useState)(!1),n=(0,o.useCallback)(()=>r(!0),[]),i=e.useState(t=>nr(e,t.activeId));return(0,o.useEffect)(()=>{let e=null==i?void 0:i.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(e),d=e.useState("moves"),[,f]=function(e){let[t,r]=(0,o.useState)(null);return nT(()=>{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,o.useEffect)(()=>{var n;if(!e||!d||!t||!r)return;let{activeId:i}=e.getState(),a=null==(n=nr(e,i))?void 0:n.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[e,d,t,r]),nT(()=>{if(!e||!d||!t)return;let{baseElement:r,activeId:n}=e.getState();if(null!==n||!r)return;let i=u.current;u.current=null,i&&nC(i,{relatedTarget:r}),it(r)||r.focus()},[e,d,t]);let m=e.useState("activeId"),h=e.useState("virtualFocus");nT(()=>{var r;if(!e||!t||!h)return;let n=u.current;if(u.current=null,!n)return;let i=(null==(r=nr(e,m))?void 0:r.element)||r0(n);i!==n&&nC(n,{relatedTarget:i})},[e,m,h,t]);let p=iv(e,a.onKeyDownCapture,u),A=iv(e,a.onKeyUpCapture,u),g=a.onFocusCapture,v=nR(t=>{var r;let n;if(null==g||g(t),t.defaultPrevented||!e)return;let{virtualFocus:i}=e.getState();if(!i)return;let a=t.relatedTarget,o=(n=(r=t.currentTarget)[nn],delete r[nn],n);nB(t)&&o&&(t.stopPropagation(),u.current=a)}),B=a.onFocus,C=nR(r=>{if(null==B||B(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?nB(r)&&!ni(e,n)&&queueMicrotask(c):nB(r)&&e.setActiveId(null)}),y=a.onBlurCapture,b=nR(t=>{var r;if(null==y||y(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:i}=e.getState();if(!n)return;let a=null==(r=nr(e,i))?void 0:r.element,o=t.relatedTarget,l=ni(e,o),s=u.current;u.current=null,nB(t)&&l?(o===a?s&&s!==o&&nC(s,t):a?nC(a,t):s&&nC(s,t),t.stopPropagation()):!ni(e,t.target)&&a&&nC(a,t)}),x=a.onKeyDown,E=nL(n),M=nR(t=>{var r;if(null==x||x(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!nB(t))return;let{orientation:n,renderedItems:i,activeId:a}=e.getState(),o=nr(e,a);if(null==(r=null==o?void 0:o.element)?void 0:r.isConnected)return;let l="horizontal"!==n,s="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&r8(t.currentTarget))return;let c={ArrowUp:(u||l)&&(()=>{if(u){let e=iA(ig(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||s)&&e.first,ArrowDown:(u||l)&&e.first,ArrowLeft:(u||s)&&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(!E(t))return;t.preventDefault(),e.move(r)}}});return a=n_(a,t=>(0,i.jsx)(n$,{value:e,children:t}),[e]),a={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=nr(e,r.activeId))?void 0:n.id}),...a,ref:nw(s,f,a.ref),onKeyDownCapture:p,onKeyUpCapture:A,onFocusCapture:v,onFocus:C,onBlurCapture:b,onKeyDown:M},a=ip({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...a})});nJ(function(e){return nQ("div",iB(e))});var iC=nX();iC.useContext,iC.useScopedContext;var iy=iC.useProviderContext,ib=nX([iC.ContextProvider],[iC.ScopedContextProvider]);ib.useContext,ib.useScopedContext;var ix=ib.useProviderContext,iE=ib.ContextProvider,iM=ib.ScopedContextProvider,iS=(0,o.createContext)(void 0),iF=(0,o.createContext)(void 0),iT=nX([iE],[iM]);iT.useContext,iT.useScopedContext;var iR=iT.useProviderContext,iw=iT.ContextProvider,iD=iT.ScopedContextProvider,iI=nV(function({store:e,...t}){let r=iR();return e=e||r,t={...t,ref:nw(null==e?void 0:e.setAnchorElement,t.ref)}});nJ(function(e){return nQ("div",iI(e))});var iG=(0,o.createContext)(void 0),iL=nX([iw,n$],[iD,n0]),i_=iL.useContext,iP=iL.useScopedContext,iO=iL.useProviderContext,ik=iL.ContextProvider,iH=iL.ScopedContextProvider,ij=(0,o.createContext)(void 0),iU=(0,o.createContext)(!1);function iN(e,t){let r=e.__unstableInternals;return nu(r,"Invalid store"),r[t]}function iJ(e,...t){let r=e,n=r,i=Symbol(),a=na,o=new Set,l=new Set,s=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,m=(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,a,o=!1)=>{var s,m;if(!no(r,e))return;let h=(m=r[e],"function"==typeof a?a("function"==typeof m?m():m):a);if(h===r[e])return;if(!o)for(let r of t)null==(s=null==r?void 0:r.setState)||s.call(r,e,h);let p=r;r={...r,[e]:h};let A=Symbol();i=A,l.add(e);let g=(t,n,i)=>{var a;let o=f.get(t);(!o||o.some(t=>i?i.has(t):t===e))&&(null==(a=d.get(t))||a(),d.set(t,t(r,n)))};for(let e of u)g(e,p);queueMicrotask(()=>{if(i!==A)return;let e=r;for(let e of c)g(e,n,l);n=e,l.clear()})},p={getState:()=>r,setState:h,__unstableInternals:{setup:e=>(s.add(e),()=>s.delete(e)),init:()=>{let e=o.size,n=Symbol();o.add(n);let i=()=>{o.delete(n),o.size||a()};if(e)return i;let l=Object.keys(r).map(e=>nl(...t.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&no(n,e))return iX(t,[e],t=>{h(e,t[e],!0)})}))),u=[];for(let e of s)u.push(e());return a=nl(...l,...u,...t.map(iQ)),i},subscribe:(e,t)=>m(e,t),sync:(e,t)=>(d.set(t,t(r,r)),m(e,t)),batch:(e,t)=>(d.set(t,t(r,n)),m(e,t,c)),pick:e=>iJ(function(e,t){let r={};for(let n of t)no(e,n)&&(r[n]=e[n]);return r}(r,e),p),omit:e=>iJ(function(e,t){let r={...e};for(let e of t)no(r,e)&&delete r[e];return r}(r,e),p)}};return p}function iK(e,...t){if(e)return iN(e,"setup")(...t)}function iQ(e,...t){if(e)return iN(e,"init")(...t)}function iV(e,...t){if(e)return iN(e,"subscribe")(...t)}function iX(e,...t){if(e)return iN(e,"sync")(...t)}function iq(e,...t){if(e)return iN(e,"batch")(...t)}function iW(e,...t){if(e)return iN(e,"omit")(...t)}function iY(...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=iJ(r,...e);return Object.assign({},...e,n)}function iz(e,t){}function iZ(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 i$(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 i0=nV(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:n,setValueOnChange:i,showMinLength:a=0,showOnChange:l,showOnMouseDown:s,showOnClick:u=s,showOnKeyDown:c,showOnKeyPress:d=c,blurActiveItemOnClick:f,setValueOnClick:m=!0,moveOnKeyPress:h=!0,autoComplete:p="list",...A}){var g;let v,B=iO();nu(e=e||B,!1);let C=(0,o.useRef)(null),[y,b]=nG(),x=(0,o.useRef)(!1),E=(0,o.useRef)(!1),M=e.useState(e=>e.virtualFocus&&r),S="inline"===p||"both"===p,[F,T]=(0,o.useState)(S);g=[S],v=(0,o.useRef)(!1),nT(()=>{if(v.current)return(()=>{S&&T(!0)})();v.current=!0},g),nT(()=>()=>{v.current=!1},[]);let R=e.useState("value"),w=(0,o.useRef)();(0,o.useEffect)(()=>iX(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let D=e.useState(e=>{var t;if(S&&F){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=e.useState("renderedItems"),G=e.useState("open"),L=e.useState("contentElement"),_=(0,o.useMemo)(()=>{if(!S||!F)return R;if(iZ(I,D,M)){if(i$(R,D)){let e=(null==D?void 0:D.slice(R.length))||"";return R+e}return R}return D||R},[S,F,I,D,M,R]);(0,o.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>T(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,o.useEffect)(()=>{if(!S||!F||!D||!iZ(I,D,M)||!i$(R,D))return;let e=na;return queueMicrotask(()=>{let t=C.current;if(!t)return;let{start:r,end:n}=r4(t),i=R.length,a=D.length;nt(t,i,a),e=()=>{if(!it(t))return;let{start:e,end:o}=r4(t);e!==i||o===a&&nt(t,r,n)}}),()=>e()},[y,S,F,D,I,M,R]);let P=(0,o.useRef)(null),O=nR(n),k=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!G||!L)return;let t=ne(L);if(!t)return;P.current=t;let r=()=>{x.current=!1},n=()=>{if(!e||!x.current)return;let{activeId:t}=e.getState();null===t||t!==k.current&&(x.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)}},[G,L,e]),nT(()=>{!R||E.current||(x.current=!0)},[R]),nT(()=>{"always"!==M&&G||(x.current=G)},[M,G]);let H=e.useState("resetValueOnSelect");nI(()=>{var t,r;let n=x.current;if(!e||!G||!n&&!H)return;let{baseElement:i,contentElement:a,activeId:o}=e.getState();if(!i||it(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(b);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(M&&n){let r,n=O(I),i=void 0!==n?n:null!=(t=null==(r=I.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();k.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,G,y,R,M,H,O,I]),(0,o.useEffect)(()=>{if(!S)return;let t=C.current;if(!t)return;let r=[t,L].filter(e=>!!e),n=t=>{r.every(e=>nb(t,e))&&(null==e||e.setValue(_))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[S,L,e,_]);let j=e=>e.currentTarget.value.length>=a,U=A.onChange,N=nL(null!=l?l:j),J=nL(null!=i?i:!e.tag),K=nR(t=>{if(null==U||U(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,o=t.nativeEvent;if(x.current=!0,"input"===o.type&&(o.isComposing&&(x.current=!1,E.current=!0),S)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;T(e&&t)}if(J(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{nt(r,i,a)}),S&&M&&t&&b()}N(t)&&e.show(),M&&x.current||e.setActiveId(null)}),Q=A.onCompositionEnd,V=nR(e=>{x.current=!0,E.current=!1,null==Q||Q(e),e.defaultPrevented||M&&b()}),X=A.onMouseDown,q=nL(null!=f?f:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=nL(m),Y=nL(null!=u?u:j),z=nR(t=>{null==X||X(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(q(t)&&e.setActiveId(null),W(t)&&e.setValue(_),Y(t)&&nx(t.currentTarget,"mouseup",e.show))}),Z=A.onKeyDown,$=nL(null!=d?d:j),ee=nR(t=>{if(null==Z||Z(t),t.repeat||(x.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)&&$(t)&&(t.preventDefault(),e.show())}),et=A.onBlur,er=nR(e=>{if(x.current=!1,null==et||et(e),e.defaultPrevented)return}),en=nD(A.id),ei=e.useState(e=>null===e.activeId);return A={id:en,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":r7(L,"listbox"),"aria-expanded":G,"aria-controls":null==L?void 0:L.id,"data-active-item":ei||void 0,value:_,...A,ref:nw(C,A.ref),onChange:K,onCompositionEnd:V,onMouseDown:z,onKeyDown:ee,onBlur:er},A=iB({store:e,focusable:t,...A,moveOnKeyPress:e=>!nc(h,e)&&(S&&T(!0),!0)}),{autoComplete:"off",...A=iI({store:e,...A})}}),i1=nJ(function(e){return nQ("input",i0(e))});function i2(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var i9=Symbol("composite-hover"),i3=nV(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=nz();nu(e=e||i,!1);let a=((0,o.useEffect)(()=>{nO||(nE("mousemove",nU,!0),nE("mousedown",nN,!0),nE("mouseup",nN,!0),nE("keydown",nN,!0),nE("scroll",nN,!0),nO=!0)},[]),nR(()=>nk)),l=n.onMouseMove,s=nL(t),u=nR(t=>{if((null==l||l(t),!t.defaultPrevented&&a())&&s(t)){if(!ir(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!it(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),c=n.onMouseLeave,d=nL(r),f=nR(t=>{var r;let n;null==c||c(t),!t.defaultPrevented&&a()&&((n=i2(t))&&r1(t.currentTarget,n)||function(e){let t=i2(e);if(!t)return!1;do{if(no(t,i9)&&t[i9])return!0;t=t.parentElement}while(t)return!1}(t)||!s(t)||d(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),m=(0,o.useCallback)(e=>{e&&(e[i9]=!0)},[]);return nf(n={...n,ref:nw(m,n.ref),onMouseMove:u,onMouseLeave:f})});nK(nJ(function(e){return nQ("div",i3(e))}));var i5=nV(function({store:e,shouldRegisterItem:t=!0,getItem:r=ns,element:n,...i}){let a=nW();e=e||a;let l=nD(i.id),s=(0,o.useRef)(n);return(0,o.useEffect)(()=>{let n=s.current;if(!l||!n||!t)return;let i=r({id:l,element:n});return null==e?void 0:e.renderItem(i)},[l,t,r,e]),nf(i={...i,ref:nw(s,i.ref)})});function i8(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?r9(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(r9(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}nJ(function(e){return nQ("div",i5(e))});var i6=Symbol("command"),i4=nV(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let n,i,a=(0,o.useRef)(null),[l,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{a.current&&s(r9(a.current))},[]);let[u,c]=(0,o.useState)(!1),d=(0,o.useRef)(!1),f=nd(r),[m,h]=(n=r.onLoadedMetadataCapture,i=(0,o.useMemo)(()=>Object.assign(()=>{},{...n,[i6]:!0}),[n,i6,!0]),[null==n?void 0:n[i6],{onLoadedMetadataCapture:i}]),p=r.onKeyDown,A=nR(r=>{null==p||p(r);let n=r.currentTarget;if(r.defaultPrevented||m||f||!nB(r)||r8(n)||n.isContentEditable)return;let i=e&&"Enter"===r.key,a=t&&" "===r.key,o="Enter"===r.key&&!e,l=" "===r.key&&!t;if(o||l)return void r.preventDefault();if(i||a){let e=i8(r);if(i){if(!e){r.preventDefault();let{view:e,...t}=r,i=()=>ny(n,t);rz&&/firefox\//i.test(navigator.userAgent)?nx(n,"keyup",i):queueMicrotask(i)}}else a&&(d.current=!0,e||(r.preventDefault(),c(!0)))}}),g=r.onKeyUp,v=nR(e=>{if(null==g||g(e),e.defaultPrevented||m||f||e.metaKey)return;let r=t&&" "===e.key;if(d.current&&r&&(d.current=!1,!i8(e))){e.preventDefault(),c(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>ny(t,n))}});return ip(r={"data-active":u||void 0,type:l?"button":void 0,...h,...r,ref:nw(a,r.ref),onKeyDown:A,onKeyUp:v})});nJ(function(e){return nQ("button",i4(e))});var{useSyncExternalStore:i7}=e.i(2239).default,ae=()=>()=>{};function at(e,t=ns){let r=o.useCallback(t=>e?iV(e,null,t):ae(),[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&&no(i,r)?i[r]:void 0};return i7(r,n,n)}function ar(e,t){let r=o.useRef({}),n=o.useCallback(t=>e?iV(e,null,t):ae(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!no(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return i7(n,i,i)}function an(e,t,r,n){var i;let a,l=no(t,r)?t[r]:void 0,s=(i={value:l,setValue:n?t[n]:void 0},a=(0,o.useRef)(i),nT(()=>{a.current=i}),a);nT(()=>iX(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),nT(()=>{if(void 0!==l)return e.setState(r,l),iq(e,[r],()=>{void 0!==l&&e.setState(r,l)})})}function ai(e,t){let[r,n]=o.useState(()=>e(t));nT(()=>iQ(r),[r]);let i=o.useCallback(e=>at(r,e),[r]);return[o.useMemo(()=>({...r,useState:i}),[r,i]),nR(()=>{n(r=>e({...t,...r.getState()}))})]}function aa(e,t,r,n=!1){var i;let a,o;if(!t||!r)return;let{renderedItems:l}=t.getState(),s=ne(e);if(!s)return;let u=function(e,t=!1){let r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(s,n);for(let e=0;e=0){void 0!==o&&ot||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===f,ariaSetSize:e=>null!=s?s:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e||!(null==h?void 0:h.ariaPosInSet)||h.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===A);return h.ariaPosInSet+t.findIndex(e=>e.id===f)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(a)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===f}}),b=(0,o.useCallback)(e=>{var t;let r={...e,id:f||e.id,rowId:A,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return l?l(r):r},[f,A,p,l]),x=c.onFocus,E=(0,o.useRef)(!1),M=nR(t=>{var r,n;if(null==x||x(t),t.defaultPrevented||nv(t)||!f||!e||(r=e,!nB(t)&&ni(r,t.target)))return;let{virtualFocus:i,baseElement:a}=e.getState();e.setActiveId(f),r6(t.currentTarget)&&function(e,t=!1){if(r8(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=rZ(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!i||!nB(t)||!r6(n=t.currentTarget)&&("INPUT"!==n.tagName||r9(n))&&(null==a?void 0:a.isConnected)&&((ng()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,t.relatedTarget===a||ni(e,t.relatedTarget))?(a[nn]=!0,a.focus({preventScroll:!0})):a.focus())}),S=c.onBlurCapture,F=nR(t=>{if(null==S||S(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,t.preventDefault(),t.stopPropagation())}),T=c.onKeyDown,R=nL(r),w=nL(n),D=nR(t=>{if(null==T||T(t),t.defaultPrevented||!nB(t)||!e)return;let{currentTarget:r}=t,n=e.getState(),i=e.item(f),a=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,l="vertical"!==n.orientation,s=()=>!(!a&&!l&&n.baseElement&&r8(n.baseElement)),u={ArrowUp:(a||o)&&e.up,ArrowRight:(a||l)&&e.next,ArrowDown:(a||o)&&e.down,ArrowLeft:(a||l)&&e.previous,Home:()=>{if(s())return!a||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(s())return!a||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>aa(r,e,null==e?void 0:e.up,!0),PageDown:()=>aa(r,e,null==e?void 0:e.down)}[t.key];if(u){if(r6(r)){let e=r4(r),n=l&&"ArrowLeft"===t.key,i=l&&"ArrowRight"===t.key,a=o&&"ArrowUp"===t.key,s=o&&"ArrowDown"===t.key;if(i||s){let{length:t}=function(e){if(r8(e))return e.value;if(e.isContentEditable){let t=rZ(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((n||a)&&0!==e.start)return}let n=u();if(R(t)||void 0!==n){if(!w(t))return;t.preventDefault(),e.move(n)}}}),I=(0,o.useMemo)(()=>({id:f,baseElement:g}),[f,g]);return c={id:f,"data-active-item":v||void 0,...c=n_(c,e=>(0,i.jsx)(n1.Provider,{value:I,children:e}),[I]),ref:nw(m,c.ref),tabIndex:y?c.tabIndex:-1,onFocus:M,onBlurCapture:F,onKeyDown:D},c=i4(c),nf({...c=i5({store:e,...c,getItem:b,shouldRegisterItem:!!f&&c.shouldRegisterItem}),"aria-setsize":B,"aria-posinset":C})});nK(nJ(function(e){return nQ("button",ao(e))}));var al=nV(function({store:e,value:t,hideOnClick:r,setValueOnClick:n,selectValueOnClick:a=!0,resetValueOnSelect:l,focusOnHover:s=!1,moveOnKeyPress:u=!0,getItem:c,...d}){var f,m;let h=iP();nu(e=e||h,!1);let{resetValueOnSelectState:p,multiSelectable:A,selected:g}=ar(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)}),v=(0,o.useCallback)(e=>{let r={...e,value:t};return c?c(r):r},[t,c]);n=null!=n?n:!A,r=null!=r?r:null!=t&&!A;let B=d.onClick,C=nL(n),y=nL(a),b=nL(null!=(f=null!=l?l:p)?f:A),x=nL(r),E=nR(r=>{null==B||B(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=nA();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&&(y(r)&&(b(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),C(r)&&(null==e||e.setValue(t))),x(r)&&(null==e||e.hide()))}),M=d.onKeyDown,S=nR(t=>{if(null==M||M(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||it(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),r8(r)&&(null==e||e.setValue(r.value)))});A&&null!=g&&(d={"aria-selected":g,...d}),d=n_(d,e=>(0,i.jsx)(ij.Provider,{value:t,children:(0,i.jsx)(iU.Provider,{value:null!=g&&g,children:e})}),[t,g]),d={role:null!=(m=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,o.useContext)(iG)])?m:"option",children:t,...d,onClick:E,onKeyDown:S};let F=nL(u);return d=ao({store:e,...d,getItem:v,moveOnKeyPress:t=>{if(!F(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}}),d=i3({store:e,focusOnHover:s,...d})}),as=nK(nJ(function(e){return nQ("div",al(e))})),au=e.i(74080);function ac(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function ad(...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 af(e,t,r){return!r&&!1!==t&&(!e||!!t)}var am=nV(function({store:e,alwaysVisible:t,...r}){let n=iy();nu(e=e||n,!1);let a=(0,o.useRef)(null),l=nD(r.id),[s,u]=(0,o.useState)(null),c=e.useState("open"),d=e.useState("mounted"),f=e.useState("animated"),m=e.useState("contentElement"),h=at(e.disclosure,"contentElement");nT(()=>{a.current&&(null==e||e.setContentElement(a.current))},[e]),nT(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),nT(()=>{if(f){var e;let t;return(null==m?void 0:m.isConnected)?(e=()=>{u(c?"enter":d?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void u(null)}},[f,m,c,d]),nT(()=>{if(!e||!f||!s||!m)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,au.flushSync)(t);if("leave"===s&&c||"enter"===s&&!c)return;if("number"==typeof f)return ac(f,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:o}=getComputedStyle(m),{transitionDuration:l="0",animationDuration:u="0",transitionDelay:d="0",animationDelay:p="0"}=h?getComputedStyle(h):{},A=ad(a,o,d,p)+ad(n,i,l,u);if(!A){"enter"===s&&e.setState("animated",!1),t();return}return ac(Math.max(A-1e3/60,0),r)},[e,f,m,h,c,s]);let p=af(d,(r=n_(r,t=>(0,i.jsx)(iM,{value:e,children:t}),[e])).hidden,t),A=r.style,g=(0,o.useMemo)(()=>p?{...A,display:"none"}:A,[p,A]);return nf(r={id:l,"data-open":c||void 0,"data-enter":"enter"===s||void 0,"data-leave":"leave"===s||void 0,hidden:p,...r,ref:nw(l?e.setContentElement:null,a,r.ref),style:g})}),ah=nJ(function(e){return nQ("div",am(e))});nJ(function({unmountOnHide:e,...t}){let r=iy();return!1===at(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,i.jsx)(ah,{...t})});var ap=nV(function({store:e,alwaysVisible:t,...r}){let n=iP(!0),a=i_(),l=!!(e=e||a)&&e===n;nu(e,!1);let s=(0,o.useRef)(null),u=nD(r.id),c=e.useState("mounted"),d=af(c,r.hidden,t),f=d?{...r.style,display:"none"}:r.style,m=e.useState(e=>Array.isArray(e.selectedValue)),h=function(e,t,r){let n=function(e){let[t]=(0,o.useState)(e);return t}(r),[i,a]=(0,o.useState)(n);return(0,o.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},o=new MutationObserver(i);return o.observe(r,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,n]),i}(s,"role",r.role),p="listbox"===h||"tree"===h||"grid"===h,[A,g]=(0,o.useState)(!1),v=e.useState("contentElement");nT(()=>{if(!c)return;let e=s.current;if(!e||v!==e)return;let t=()=>{g(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[c,v]),A||(r={role:"listbox","aria-multiselectable":p&&m||void 0,...r}),r=n_(r,t=>(0,i.jsx)(iH,{value:e,children:(0,i.jsx)(iG.Provider,{value:h,children:t})}),[e,h]);let B=!u||n&&l?null:e.setContentElement;return nf(r={id:u,hidden:d,...r,ref:nw(B,s,r.ref),style:f})}),aA=nJ(function(e){return nQ("div",ap(e))}),ag=(0,o.createContext)(null),av=nV(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}}});nJ(function(e){return nQ("span",av(e))});var aB=nV(function(e){return av(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),aC=nJ(function(e){return nQ("span",aB(e))});function ay(e){queueMicrotask(()=>{null==e||e.focus()})}var ab=nV(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:n,portal:a=!0,...l}){let s=(0,o.useRef)(null),u=nw(s,l.ref),c=(0,o.useContext)(ag),[d,f]=(0,o.useState)(null),[m,h]=(0,o.useState)(null),p=(0,o.useRef)(null),A=(0,o.useRef)(null),g=(0,o.useRef)(null),v=(0,o.useRef)(null);return nT(()=>{let e=s.current;if(!e||!a)return void f(null);let t=r?"function"==typeof r?r(e):r:rZ(e).createElement("div");if(!t)return void f(null);let i=t.isConnected;if(i||(c||rZ(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)}`}()),f(t),nh(n,t),!i)return()=>{t.remove(),nh(n,null)}},[a,r,c,n]),nT(()=>{if(!a||!e||!t)return;let r=rZ(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),h(r),()=>{r.remove(),h(null)}},[a,e,t]),(0,o.useEffect)(()=>{if(!d||!e)return;let t=0,r=e=>{if(!nb(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=d.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(d.hasAttribute("data-tabindex")&&t(d),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of n4(d,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return d.addEventListener("focusin",r,!0),d.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),d.removeEventListener("focusin",r,!0),d.removeEventListener("focusout",r,!0)}},[d,e]),l={...l=n_(l,t=>{if(t=(0,i.jsx)(ag.Provider,{value:d||c,children:t}),!a)return t;if(!d)return(0,i.jsx)("span",{ref:u,id:l.id,style:{position:"fixed"},hidden:!0});t=(0,i.jsxs)(i.Fragment,{children:[e&&d&&(0,i.jsx)(aC,{ref:A,"data-focus-trap":l.id,className:"__focus-trap-inner-before",onFocus:e=>{nb(e,d)?ay(n7()):ay(p.current)}}),t,e&&d&&(0,i.jsx)(aC,{ref:g,"data-focus-trap":l.id,className:"__focus-trap-inner-after",onFocus:e=>{nb(e,d)?ay(ie()):ay(v.current)}})]}),d&&(t=(0,au.createPortal)(t,d));let r=(0,i.jsxs)(i.Fragment,{children:[e&&d&&(0,i.jsx)(aC,{ref:p,"data-focus-trap":l.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==v.current&&nb(e,d)?ay(A.current):ay(ie())}}),e&&(0,i.jsx)("span",{"aria-owns":null==d?void 0:d.id,style:{position:"fixed"}}),e&&d&&(0,i.jsx)(aC,{ref:v,"data-focus-trap":l.id,className:"__focus-trap-outer-after",onFocus:e=>{if(nb(e,d))ay(g.current);else{let e=n7();if(e===A.current)return void requestAnimationFrame(()=>{var e;return null==(e=n7())?void 0:e.focus()});ay(e)}}})]});return m&&e&&(r=(0,au.createPortal)(r,m)),(0,i.jsxs)(i.Fragment,{children:[r,t]})},[d,c,a,l.id,e,m]),ref:u}});nJ(function(e){return nQ("div",ab(e))});var ax=(0,o.createContext)(0);function aE({level:e,children:t}){let r=(0,o.useContext)(ax),n=Math.max(Math.min(e||r+1,6),1);return(0,i.jsx)(ax.Provider,{value:n,children:t})}var aM=nV(function({autoFocusOnShow:e=!0,...t}){return n_(t,t=>(0,i.jsx)(n9.Provider,{value:e,children:t}),[e])});nJ(function(e){return nQ("div",aM(e))});var aS=new WeakMap;function aF(e,t,r){aS.has(e)||aS.set(e,new Map);let n=aS.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 a=r(),o=()=>{a(),i(),n.delete(t)};return n.set(t,o),()=>{n.get(t)===o&&(a(),n.set(t,i))}}function aT(e,t,r){return aF(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function aR(e,t,r){return aF(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function aw(e,t){return e?aF(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var aD=["SCRIPT","STYLE"];function aI(e){return`__ariakit-dialog-snapshot-${e}`}function aG(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),o=rZ(i),l=i;for(;i.parentElement&&i!==o.body;){if(null==n||n(i.parentElement,l),!a)for(let n of i.parentElement.children)(function(e,t,r){return!aD.includes(t.tagName)&&!!function(e,t){let r=rZ(t),n=aI(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&r1(t,e))})(e,n,t)&&r(n,l);i=i.parentElement}}}function aL(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 a_(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function aP(e,t=""){return nl(aR(e,a_("",!0),!0),aR(e,a_(t,!0),!0))}function aO(e,t){if(e[a_(t,!0)])return!0;let r=a_(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function ak(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return aG(e,t,t=>{aL(t,...n)||r.unshift(function(e,t=""){return nl(aR(e,a_(),!0),aR(e,a_(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(aP(t,e))}),()=>{for(let e of r)e()}}function aH({store:e,type:t,listener:r,capture:n,domReady:i}){let a=nR(r),l=at(e,"open"),s=(0,o.useRef)(!1);nT(()=>{if(!l||!i)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{s.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,l,i]),(0,o.useEffect)(()=>{if(l)return nE(t,t=>{let{contentElement:r,disclosureElement:n}=e.getState(),i=t.target;!r||!i||!(!("HTML"===i.tagName||r1(rZ(i).body,i))||r1(r,i)||function(e,t){if(!e)return!1;if(r1(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=rZ(e).getElementById(r);if(t)return r1(e,t)}return!1}(n,i)||i.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))&&(!s.current||aO(i,r.id))&&(i&&i[il]||a(t))},n)},[l,n])}function aj(e,t){return"function"==typeof e?e(t):!!e}var aU=(0,o.createContext)({});function aN(){return"inert"in HTMLElement.prototype}function aJ(e,t){if(!("style"in e))return na;if(aN())return aR(e,"inert",!0);let r=n4(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&r1(t,e)))return na;let r=aF(e,"focus",()=>(e.focus=na,()=>{delete e.focus}));return nl(aT(e,"tabindex","-1"),r)});return nl(...r,aT(e,"aria-hidden","true"),aw(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function aK(e={}){let t=iY(e.store,iW(e.disclosure,["contentElement","disclosureElement"]));iz(e,t);let r=null==t?void 0:t.getState(),n=nm(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=nm(e.animated,null==r?void 0:r.animated,!1),a=iJ({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:nm(null==r?void 0:r.contentElement,null),disclosureElement:nm(null==r?void 0:r.disclosureElement,null)},t);return iK(a,()=>iX(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),iK(a,()=>iV(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),iK(a,()=>iX(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)}}function aQ(e,t,r){return nI(t,[r.store,r.disclosure]),an(e,r,"open","setOpen"),an(e,r,"mounted","setMounted"),an(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}nV(function(e){return e});var aV=nJ(function(e){return nQ("div",e)});function aX({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let a=(0,o.useRef)(null),l=function(e={}){let[t,r]=ai(aK,e);return aQ(t,r,e)}({disclosure:e}),s=at(e,"contentElement");(0,o.useEffect)(()=>{let e=a.current;!e||s&&(e.style.zIndex=getComputedStyle(s).zIndex)},[s]),nT(()=>{let e=null==s?void 0:s.id;if(!e)return;let t=a.current;if(t)return aP(t,e)},[s]);let u=am({ref:a,store:l,role:"presentation","data-backdrop":(null==s?void 0:s.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,o.isValidElement)(t))return(0,i.jsx)(aV,{...u,render:t});let c="boolean"!=typeof t?t:"div";return(0,i.jsx)(aV,{...u,render:(0,i.jsx)(c,{})})}function aq(e={}){return aK(e)}Object.assign(aV,["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]=nJ(function(e){return nQ(t,e)}),e),{}));var aW=ng();function aY(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?n5(r)?r:null:r:null}var az=nV(function({store:e,open:t,onClose:r,focusable:n=!0,modal:a=!0,portal:l=!!a,backdrop:s=!!a,hideOnEscape:u=!0,hideOnInteractOutside:c=!0,getPersistentElements:d,preventBodyScroll:f=!!a,autoFocusOnShow:m=!0,autoFocusOnHide:h=!0,initialFocus:p,finalFocus:A,unmountOnHide:g,unstable_treeSnapshotKey:v,...B}){var C;let y,b,x,E=ix(),M=(0,o.useRef)(null),S=function(e={}){let[t,r]=ai(aq,e);return aQ(t,r,e)}({store:e||E,open:t,setOpen(e){if(e)return;let t=M.current;if(!t)return;let n=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&S.setOpen(!0)}}),{portalRef:F,domReady:T}=nP(l,B.portalRef),R=B.preserveTabOrder,w=at(S,e=>R&&!a&&e.mounted),D=nD(B.id),I=at(S,"open"),G=at(S,"mounted"),L=at(S,"contentElement"),_=af(G,B.hidden,B.alwaysVisible);y=function({attribute:e,contentId:t,contentElement:r,enabled:n}){let[i,a]=nG(),l=(0,o.useCallback)(()=>{if(!n||!r)return!1;let{body:i}=rZ(r),a=i.getAttribute(e);return!a||a===t},[i,n,r,e,t]);return(0,o.useEffect)(()=>{if(!n||!t||!r)return;let{body:i}=rZ(r);if(l())return i.setAttribute(e,t),()=>i.removeAttribute(e);let o=new MutationObserver(()=>(0,au.flushSync)(a));return o.observe(i,{attributeFilter:[e]}),()=>o.disconnect()},[i,n,t,r,l,e]),l}({attribute:"data-dialog-prevent-body-scroll",contentElement:L,contentId:D,enabled:f&&!_}),(0,o.useEffect)(()=>{var e,t;if(!y()||!L)return;let r=rZ(L),n=r$(L),{documentElement:i,body:a}=r,o=i.style.getPropertyValue("--scrollbar-width"),l=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,s=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=nA()&&!(rz&&navigator.platform.startsWith("Mac")&&!np());return nl((e="--scrollbar-width",t=`${l}px`,i?aF(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:o}=n,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=aw(a,{position:"fixed",overflow:"hidden",top:`${-(i-Math.floor(c))}px`,left:`${-(r-Math.floor(u))}px`,right:"0",[s]:`${l}px`});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():aw(a,{overflow:"hidden",[s]:`${l}px`}))},[y,L]),C=at(S,"open"),b=(0,o.useRef)(),(0,o.useEffect)(()=>{if(!C){b.current=null;return}return nE("mousedown",e=>{b.current=e.target},!0)},[C]),aH({...x={store:S,domReady:T,capture:!0},type:"click",listener:e=>{let{contentElement:t}=S.getState(),r=b.current;r&&r5(r)&&aO(r,null==t?void 0:t.id)&&aj(c,e)&&S.hide()}}),aH({...x,type:"focusin",listener:e=>{let{contentElement:t}=S.getState();!t||e.target===rZ(t)||aj(c,e)&&S.hide()}}),aH({...x,type:"contextmenu",listener:e=>{aj(c,e)&&S.hide()}});let{wrapElement:P,nestedDialogs:O}=function(e){let t=(0,o.useContext)(aU),[r,n]=(0,o.useState)([]),a=(0,o.useCallback)(e=>{var r;return n(t=>[...t,e]),nl(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);nT(()=>iX(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 l=(0,o.useMemo)(()=>({store:e,add:a}),[e,a]);return{wrapElement:(0,o.useCallback)(e=>(0,i.jsx)(aU.Provider,{value:l,children:e}),[l]),nestedDialogs:r}}(S);B=n_(B,P,[P]),nT(()=>{if(!I)return;let e=M.current,t=r0(e,!0);!t||"BODY"===t.tagName||e&&r1(e,t)||S.setDisclosureElement(t)},[S,I]),aW&&(0,o.useEffect)(()=>{if(!G)return;let{disclosureElement:e}=S.getState();if(!e||!r9(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),nx(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||ii(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[S,G]),(0,o.useEffect)(()=>{if(!G||!T)return;let e=M.current;if(!e)return;let t=r$(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)}},[G,T]),(0,o.useEffect)(()=>{if(!a||!G||!T)return;let e=M.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=S.hide,(r=rZ(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()}}},[S,a,G,T]),nT(()=>{if(!aN()||I||!G||!T)return;let e=M.current;if(e)return aJ(e)},[I,G,T]);let k=I&&T;nT(()=>{if(D&&k)return function(e,t){let{body:r}=rZ(t[0]),n=[];return aG(e,t,t=>{n.push(aR(t,aI(e),!0))}),nl(aR(r,aI(e),!0),()=>{for(let e of n)e()})}(D,[M.current])},[D,k,v]);let H=nR(d);nT(()=>{if(!D||!k)return;let{disclosureElement:e}=S.getState(),t=[M.current,...H()||[],...O.map(e=>e.getState().contentElement)];if(a){let e,r;return nl(ak(D,t),(e=[],r=t.map(e=>null==e?void 0:e.id),aG(D,t,n=>{aL(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(aJ(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&r1(e,r))||e.unshift(aT(r,"role","none"))}),()=>{for(let t of e)t()}))}return ak(D,[e,...t])},[D,S,k,H,O,a,v]);let j=!!m,U=nL(m),[N,J]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!I||!j||!T||!(null==L?void 0:L.isConnected))return;let e=aY(p,!0)||L.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=n4(e,t,r);return n||null}(L,!0,l&&w)||L,t=n5(e);U(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!aW||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[I,j,T,L,p,l,w,U]);let K=!!h,Q=nL(h),[V,X]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(I)return X(!0),()=>X(!1)},[I]);let q=(0,o.useCallback)((e,t=!0)=>{let r,{disclosureElement:n}=S.getState();if(!(!(r=r0())||e&&r1(e,r))&&n5(r))return;let i=aY(A)||n;if(null==i?void 0:i.id){let e=rZ(i),t=`[aria-activedescendant="${i.id}"]`,r=e.querySelector(t);r&&(i=r)}if(i&&!n5(i)){let e=i.closest("[data-dialog]");if(null==e?void 0:e.id){let t=rZ(e),r=`[aria-controls~="${e.id}"]`,n=t.querySelector(r);n&&(i=n)}}let a=i&&n5(i);!a&&t?requestAnimationFrame(()=>q(e,!1)):!Q(a?i:null)||a&&(null==i||i.focus({preventScroll:!0}))},[S,A,Q]),W=(0,o.useRef)(!1);nT(()=>{if(I||!V||!K)return;let e=M.current;W.current=!0,q(e)},[I,V,T,K,q]),(0,o.useEffect)(()=>{if(!V||!K)return;let e=M.current;return()=>{if(W.current){W.current=!1;return}q(e)}},[V,K,q]);let Y=nL(u);(0,o.useEffect)(()=>{if(T&&G)return nE("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=M.current;if(!t||aO(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=S.getState();!("BODY"===r.tagName||r1(t,r)||!n||r1(n,r))||Y(e)&&S.hide()},!0)},[S,T,G,Y]);let z=(B=n_(B,e=>(0,i.jsx)(aE,{level:a?1:void 0,children:e}),[a])).hidden,Z=B.alwaysVisible;B=n_(B,e=>s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(aX,{store:S,backdrop:s,hidden:z,alwaysVisible:Z}),e]}):e,[S,s,z,Z]);let[$,ee]=(0,o.useState)(),[et,er]=(0,o.useState)();return B=aM({...B={id:D,"data-dialog":"",role:"dialog",tabIndex:n?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...B=n_(B,e=>(0,i.jsx)(iM,{value:S,children:(0,i.jsx)(iS.Provider,{value:ee,children:(0,i.jsx)(iF.Provider,{value:er,children:e})})}),[S]),ref:nw(M,B.ref)},autoFocusOnShow:N}),B=ab({portal:l,...B=ip({...B=am({store:S,...B}),focusable:n}),portalRef:F,preserveTabOrder:w})});function aZ(e,t=ix){return nJ(function(r){let n=t();return at(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,i.jsx)(e,{...r}):null})}aZ(nJ(function(e){return nQ("div",az(e))}),ix);let a$=Math.min,a0=Math.max,a1=Math.round,a2=Math.floor,a9=e=>({x:e,y:e}),a3={left:"right",right:"left",bottom:"top",top:"bottom"},a5={start:"end",end:"start"};function a8(e,t){return"function"==typeof e?e(t):e}function a6(e){return e.split("-")[0]}function a4(e){return e.split("-")[1]}function a7(e){return"x"===e?"y":"x"}function oe(e){return"y"===e?"height":"width"}let ot=new Set(["top","bottom"]);function or(e){return ot.has(a6(e))?"y":"x"}function on(e){return e.replace(/start|end/g,e=>a5[e])}let oi=["left","right"],oa=["right","left"],oo=["top","bottom"],ol=["bottom","top"];function os(e){return e.replace(/left|right|bottom|top/g,e=>a3[e])}function ou(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oc(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 od(e,t,r){let n,{reference:i,floating:a}=e,o=or(t),l=a7(or(t)),s=oe(l),u=a6(t),c="y"===o,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,m=i[s]/2-a[s]/2;switch(u){case"top":n={x:d,y:i.y-a.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-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(a4(t)){case"start":n[l]-=m*(r&&c?-1:1);break;case"end":n[l]+=m*(r&&c?-1:1)}return n}let of=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,l=a.filter(Boolean),s=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=od(u,n,s),f=n,m={},h=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let oR=["transform","translate","scale","rotate","perspective"],ow=["transform","translate","scale","rotate","perspective","filter"],oD=["paint","layout","strict","content"];function oI(e){let t=oG(),r=oy(e)?oP(e):e;return oR.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||ow.some(e=>(r.willChange||"").includes(e))||oD.some(e=>(r.contain||"").includes(e))}function oG(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let oL=new Set(["html","body","#document"]);function o_(e){return oL.has(og(e))}function oP(e){return ov(e).getComputedStyle(e)}function oO(e){return oy(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ok(e){if("html"===og(e))return e;let t=e.assignedSlot||e.parentNode||ox(e)&&e.host||oB(e);return ox(t)?t.host:t}function oH(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=ok(t);return o_(r)?t.ownerDocument?t.ownerDocument.body:t.body:ob(r)&&oM(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=ov(i);if(a){let e=oj(o);return t.concat(o,o.visualViewport||[],oM(i)?i:[],e&&r?oH(e):[])}return t.concat(i,oH(i,[],r))}function oj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oU(e){let t=oP(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=ob(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,l=a1(r)!==a||a1(n)!==o;return l&&(r=a,n=o),{width:r,height:n,$:l}}function oN(e){return oy(e)?e:e.contextElement}function oJ(e){let t=oN(e);if(!ob(t))return a9(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=oU(t),o=(a?a1(r.width):r.width)/n,l=(a?a1(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),l&&Number.isFinite(l)||(l=1),{x:o,y:l}}let oK=a9(0);function oQ(e){let t=ov(e);return oG()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oK}function oV(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=oN(e),l=a9(1);t&&(n?oy(n)&&(l=oJ(n)):l=oJ(e));let s=(void 0===(i=r)&&(i=!1),n&&(!i||n===ov(o))&&i)?oQ(o):a9(0),u=(a.left+s.x)/l.x,c=(a.top+s.y)/l.y,d=a.width/l.x,f=a.height/l.y;if(o){let e=ov(o),t=n&&oy(n)?ov(n):n,r=e,i=oj(r);for(;i&&n&&t!==r;){let e=oJ(i),t=i.getBoundingClientRect(),n=oP(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=o,i=oj(r=ov(i))}}return oc({width:d,height:f,x:u,y:c})}function oX(e,t){let r=oO(e).scrollLeft;return t?t.left+r:oV(oB(e)).left+r}function oq(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-oX(e,r),y:r.top+t.scrollTop}}let oW=new Set(["absolute","fixed"]);function oY(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=ov(e),n=oB(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,l=0,s=0;if(i){a=i.width,o=i.height;let e=oG();(!e||e&&"fixed"===t)&&(l=i.offsetLeft,s=i.offsetTop)}let u=oX(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:l,y:s}}(e,r);else if("document"===t){let t,r,a,o,l,s,u;n=oB(e),t=oB(n),r=oO(n),a=n.ownerDocument.body,o=a0(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=a0(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+oX(n),u=-r.scrollTop,"rtl"===oP(a).direction&&(s+=a0(t.clientWidth,a.clientWidth)-o),i={width:o,height:l,x:s,y:u}}else if(oy(t)){let e,n,a,o,l,s;n=(e=oV(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=ob(t)?oJ(t):a9(1),l=t.clientWidth*o.x,s=t.clientHeight*o.y,i={width:l,height:s,x:a*o.x,y:n*o.y}}else{let r=oQ(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oc(i)}function oz(e){return"static"===oP(e).position}function oZ(e,t){if(!ob(e)||"fixed"===oP(e).position)return null;if(t)return t(e);let r=e.offsetParent;return oB(e)===r&&(r=r.ownerDocument.body),r}function o$(e,t){var r;let n=ov(e);if(oT(e))return n;if(!ob(e)){let t=ok(e);for(;t&&!o_(t);){if(oy(t)&&!oz(t))return t;t=ok(t)}return n}let i=oZ(e,t);for(;i&&(r=i,oS.has(og(r)))&&oz(i);)i=oZ(i,t);return i&&o_(i)&&oz(i)&&!oI(i)?n:i||function(e){let t=ok(e);for(;ob(t)&&!o_(t);){if(oI(t))return t;if(oT(t))break;t=ok(t)}return null}(e)||n}let o0=async function(e){let t=this.getOffsetParent||o$,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=ob(t),i=oB(t),a="fixed"===r,o=oV(e,!0,a,t),l={scrollLeft:0,scrollTop:0},s=a9(0);if(n||!n&&!a)if(("body"!==og(t)||oM(i))&&(l=oO(t)),n){let e=oV(t,!0,a,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else i&&(s.x=oX(i));a&&!n&&i&&(s.x=oX(i));let u=!i||n||a?a9(0):oq(i,l);return{x:o.left+l.scrollLeft-s.x-u.x,y:o.top+l.scrollTop-s.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},o1={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=oB(n),l=!!t&&oT(t.floating);if(n===o||l&&a)return r;let s={scrollLeft:0,scrollTop:0},u=a9(1),c=a9(0),d=ob(n);if((d||!d&&!a)&&(("body"!==og(n)||oM(o))&&(s=oO(n)),ob(n))){let e=oV(n);u=oJ(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?a9(0):oq(o,s);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-s.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-s.scrollTop*u.y+c.y+f.y}},getDocumentElement:oB,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?oT(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=oH(e,[],!1).filter(e=>oy(e)&&"body"!==og(e)),i=null,a="fixed"===oP(e).position,o=a?ok(e):e;for(;oy(o)&&!o_(o);){let t=oP(o),r=oI(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&oW.has(i.position)||oM(o)&&!r&&function e(t,r){let n=ok(t);return!(n===r||!oy(n)||o_(n))&&("fixed"===oP(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=ok(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],l=a.reduce((e,r)=>{let n=oY(t,r,i);return e.top=a0(n.top,e.top),e.right=a$(n.right,e.right),e.bottom=a$(n.bottom,e.bottom),e.left=a0(n.left,e.left),e},oY(t,o,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:o$,getElementRects:o0,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=oU(e);return{width:t,height:r}},getScale:oJ,isElement:oy,isRTL:function(e){return"rtl"===oP(e).direction}};function o2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o9(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 o3(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function o5(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var o8=nV(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:n=!0,autoFocusOnShow:a=!0,wrapperProps:l,fixed:s=!1,flip:u=!0,shift:c=0,slide:d=!0,overlap:f=!1,sameWidth:m=!1,fitViewport:h=!1,gutter:p,arrowPadding:A=4,overflowPadding:g=8,getAnchorRect:v,updatePosition:B,...C}){let y=iR();nu(e=e||y,!1);let b=e.useState("arrowElement"),x=e.useState("anchorElement"),E=e.useState("disclosureElement"),M=e.useState("popoverElement"),S=e.useState("contentElement"),F=e.useState("placement"),T=e.useState("mounted"),R=e.useState("rendered"),w=(0,o.useRef)(null),[D,I]=(0,o.useState)(!1),{portalRef:G,domReady:L}=nP(r,C.portalRef),_=nR(v),P=nR(B),O=!!B;nT(()=>{if(!(null==M?void 0:M.isConnected))return;M.style.setProperty("--popover-overflow-padding",`${g}px`);let t={contextElement:x||void 0,getBoundingClientRect:()=>{let e=null==_?void 0:_(x);return e||!x?function(e){if(!e)return o9();let{x:t,y:r,width:n,height:i}=e;return o9(t,r,n,i)}(e):x.getBoundingClientRect()}},r=async()=>{var r,n,i,a,o;let l,v,B;if(!T)return;b||(w.current=w.current||document.createElement("div"));let C=b||w.current,y=[(r={gutter:p,shift:c},void 0===(n=({placement:e})=>{var t;let n=((null==C?void 0:C.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:a,placement:o,middlewareData:l}=e,s=await op(e,n);return o===(null==(t=l.offset)?void 0:t.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:i+s.x,y:a+s.y,data:{...s,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return nu(!r||r.every(o3),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,o,l,s,u;let c,d,f,{placement:m,middlewareData:h,rects:p,initialPlacement:A,platform:g,elements:v}=e,{mainAxis:B=!0,crossAxis:C=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:E=!0,...M}=a8(t,e);if(null!=(r=h.arrow)&&r.alignmentOffset)return{};let S=a6(m),F=or(A),T=a6(A)===A,R=await (null==g.isRTL?void 0:g.isRTL(v.floating)),w=y||(T||!E?[os(A)]:(c=os(A),[on(A),c,on(c)])),D="none"!==x;!y&&D&&w.push(...(d=a4(A),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?oa:oi;return t?oi:oa;case"left":case"right":return t?oo:ol;default:return[]}}(a6(A),"start"===x,R),d&&(f=f.map(e=>e+"-"+d),E&&(f=f.concat(f.map(on)))),f));let I=[A,...w],G=await om(e,M),L=[],_=(null==(n=h.flip)?void 0:n.overflows)||[];if(B&&L.push(G[S]),C){let e,t,r,n,i=(l=m,s=p,void 0===(u=R)&&(u=!1),e=a4(l),r=oe(t=a7(or(l))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",s.reference[r]>s.floating[r]&&(n=os(n)),[n,os(n)]);L.push(G[i[0]],G[i[1]])}if(_=[..._,{placement:m,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=h.flip)?void 0:i.index)||0)+1,t=I[e];if(t&&("alignment"!==C||F===or(t)||_.every(e=>or(e.placement)!==F||e.overflows[0]>0)))return{data:{index:e,overflows:_},reset:{placement:t}};let r=null==(a=_.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(b){case"bestFit":{let e=null==(o=_.filter(e=>{if(D){let t=or(e.placement);return t===F||"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:o[0];e&&(r=e);break}case"initialPlacement":r=A}if(m!==r)return{reset:{placement:r}}}return{}}}}({flip:u,overflowPadding:g}),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:a,middlewareData:o}=e,{offset:l=0,mainAxis:s=!0,crossAxis:u=!0}=a8(t,e),c={x:r,y:n},d=or(i),f=a7(d),m=c[f],h=c[d],p=a8(l,e),A="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(s){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+A.mainAxis,r=a.reference[f]+a.reference[e]-A.mainAxis;mr&&(m=r)}if(u){var g,v;let e="y"===f?"width":"height",t=oh.has(a6(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(g=o.offset)?void 0:g[d])||0)+(t?0:A.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[d])||0)-(t?A.crossAxis:0);hn&&(h=n)}return{[f]:m,[d]:h}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...s}=a8(r,e),u={x:t,y:n},c=await om(e,s),d=or(a6(i)),f=a7(d),m=u[f],h=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+c[e],n=m-c[t];m=a0(r,a$(m,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=h+c[e],n=h-c[t];h=a0(r,a$(h,n))}let p=l.fn({...e,[f]:m,[d]:h});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[f]:a,[d]:o}}}}}}}({slide:d,shift:c,overlap:f,overflowPadding:g}),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:a,platform:o,elements:l,middlewareData:s}=e,{element:u,padding:c=0}=a8(r,e)||{};if(null==u)return{};let d=ou(c),f={x:t,y:n},m=a7(or(i)),h=oe(m),p=await o.getDimensions(u),A="y"===m,g=A?"clientHeight":"clientWidth",v=a.reference[h]+a.reference[m]-f[m]-a.floating[h],B=f[m]-a.reference[m],C=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),y=C?C[g]:0;y&&await (null==o.isElement?void 0:o.isElement(C))||(y=l.floating[g]||a.floating[h]);let b=y/2-p[h]/2-1,x=a$(d[A?"top":"left"],b),E=a$(d[A?"bottom":"right"],b),M=y-p[h]-E,S=y/2-p[h]/2+(v/2-B/2),F=a0(x,a$(S,M)),T=!s.arrow&&null!=a4(i)&&S!==F&&a.reference[h]/2-(S{},...d}=a8(a,e),f=await om(e,d),m=a6(o),h=a4(o),p="y"===or(o),{width:A,height:g}=l.floating;"top"===m||"bottom"===m?(n=m,i=h===(await (null==s.isRTL?void 0:s.isRTL(u.floating))?"start":"end")?"left":"right"):(i=m,n="end"===h?"top":"bottom");let v=g-f.top-f.bottom,B=A-f.left-f.right,C=a$(g-f[n],v),y=a$(A-f[i],B),b=!e.middlewareData.shift,x=C,E=y;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(E=B),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=v),b&&!h){let e=a0(f.left,0),t=a0(f.right,0),r=a0(f.top,0),n=a0(f.bottom,0);p?E=A-2*(0!==e||0!==t?e+t:a0(f.left,f.right)):x=g-2*(0!==r||0!==n?r+n:a0(f.top,f.bottom))}await c({...e,availableWidth:E,availableHeight:x});let M=await s.getDimensions(u.floating);return A!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}],x=await (o={placement:F,strategy:s?"fixed":"absolute",middleware:y},l=new Map,B={...(v={platform:o1,...o}).platform,_c:l},of(t,M,{...v,platform:B}));null==e||e.setState("currentPlacement",x.placement),I(!0);let E=o5(x.x),S=o5(x.y);if(Object.assign(M.style,{top:"0",left:"0",transform:`translate3d(${E}px,${S}px,0)`}),C&&x.middlewareData.arrow){let{x:e,y:t}=x.middlewareData.arrow,r=x.placement.split("-")[0],n=C.clientWidth/2,i=C.clientHeight/2,a=null!=e?e+n:-n,o=null!=t?t+i:-i;M.style.setProperty("--popover-transform-origin",{top:`${a}px calc(100% + ${i}px)`,bottom:`${a}px ${-i}px`,left:`calc(100% + ${n}px) ${o}px`,right:`${-n}px ${o}px`}[r]),Object.assign(C.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:a=!0,ancestorResize:o=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=oN(e),d=a||o?[...c?oH(c):[],...oH(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&s?function(e,t){let r,n=null,i=oB(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:m}=u;if(l||t(),!f||!m)return;let h={rootMargin:-a2(d)+"px "+-a2(i.clientWidth-(c+f))+"px "+-a2(i.clientHeight-(d+m))+"px "+-a2(c)+"px",threshold:a0(0,a$(1,s))||1},p=!0;function A(t){let n=t[0].intersectionRatio;if(n!==s){if(!p)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||o2(u,e.getBoundingClientRect())||o(),p=!1}try{n=new IntersectionObserver(A,{...h,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(A,h)}n.observe(e)}(!0),a}(c,r):null,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),r()}),c&&!u&&h.observe(c),h.observe(t));let p=u?oV(e):null;return u&&function t(){let n=oV(e);p&&!o2(p,n)&&r(),p=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,u&&cancelAnimationFrame(i)}}(t,M,async()=>{O?(await P({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[e,R,M,b,x,M,F,T,L,s,u,c,d,f,m,h,p,A,g,_,O,P]),nT(()=>{if(!T||!L||!(null==M?void 0:M.isConnected)||!(null==S?void 0:S.isConnected))return;let e=()=>{M.style.zIndex=getComputedStyle(S).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,M,S]);let k=s?"fixed":"absolute";return C=n_(C,t=>(0,i.jsx)("div",{...l,style:{position:k,top:0,left:0,width:"max-content",...null==l?void 0:l.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,k,l]),C={"data-placing":!D||void 0,...C=n_(C,t=>(0,i.jsx)(iD,{value:e,children:t}),[e]),style:{position:"relative",...C.style}},C=az({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:E||x,autoFocusOnShow:D&&a,...C,portalRef:G})});aZ(nJ(function(e){return nQ("div",o8(e))}),iR);var o6=nV(function({store:e,modal:t,tabIndex:r,alwaysVisible:n,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...l}){let s=iO();nu(e=e||s,!1);let u=e.useState("baseElement"),c=(0,o.useRef)(!1),d=at(e.tag,e=>null==e?void 0:e.renderedItems.length);return l=ap({store:e,alwaysVisible:n,...l}),l=o8({store:e,modal:t,alwaysVisible:n,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...l,getPersistentElements(){var r;let n=(null==(r=l.getPersistentElements)?void 0:r.call(l))||[];if(!t||!e)return n;let{contentElement:i,baseElement:a}=e.getState();if(!a)return n;let o=rZ(a),s=[];if((null==i?void 0:i.id)&&s.push(`[aria-controls~="${i.id}"]`),(null==a?void 0:a.id)&&s.push(`[aria-controls~="${a.id}"]`),!s.length)return[...n,a];let u=s.join(",");return[...n,...o.querySelectorAll(u)]},autoFocusOnHide:e=>!nc(i,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,l=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,l))return!1;let s="function"==typeof a?a(t):a;return s&&(c.current="click"===t.type),s}})}),o4=aZ(nJ(function(e){return nQ("div",o6(e))}),iO);(0,o.createContext)(null),(0,o.createContext)(null);var o7=nX([n$],[n0]),le=o7.useContext;o7.useScopedContext,o7.useProviderContext,o7.ContextProvider,o7.ScopedContextProvider;var lt={id:null};function lr(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function ln(e,t){return e.filter(e=>e.rowId===t)}function li(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 la(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var lo=ng()&&np();function ll({tag:e,...t}={}){let r=iY(t.store,function(e,...t){if(e)return iN(e,"pick")(...t)}(e,["value","rtl"]));iz(t,r);let n=null==e?void 0:e.getState(),i=null==r?void 0:r.getState(),a=nm(t.activeId,null==i?void 0:i.activeId,t.defaultActiveId,null),o=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),n=function(e={}){var t,r;iz(e,e.store);let n=null==(t=e.store)?void 0:t.getState(),i=nm(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:nm(null==n?void 0:n.renderedItems,[])},l=null==(r=e.store)?void 0:r.__unstablePrivateStore,s=iJ({items:i,renderedItems:o.renderedItems},l),u=iJ(o,e.store),c=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,a])=>{var o;let l=t(r),s=t(a);return l!==s&&l&&s?(o=l,s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)?(e>i&&(n=!0),-1):(et):e);s.setState("renderedItems",i),u.setState("renderedItems",i)};iK(u,()=>iQ(s)),iK(s,()=>iq(s,["items"],e=>{u.setState("items",e.items)})),iK(s,()=>iq(s,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return rZ(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=(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})}},f=e=>d(e,e=>s.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>nl(f(e),d(e,e=>s.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=s.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:s}}(e),i=nm(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=iJ({...n.getState(),id:nm(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:nm(null==r?void 0:r.baseElement,null),includesBaseElement:nm(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:nm(null==r?void 0:r.moves,0),orientation:nm(e.orientation,null==r?void 0:r.orientation,"both"),rtl:nm(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:nm(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:nm(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:nm(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:nm(e.focusShift,null==r?void 0:r.focusShift,!1)},n,e.store);iK(a,()=>iX(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=lr(e.renderedItems))?void 0:r.id})}));let o=(e="next",t={})=>{var r,n;let i=a.getState(),{skip:o=0,activeId:l=i.activeId,focusShift:s=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:m=i.rtl}=t,h="up"===e||"down"===e,p="next"===e||"down"===e,A=h?iA(function(e,t,r){let n=la(e);for(let i of e)for(let e=0;ee.id===l);if(!g)return null==(n=lr(A))?void 0:n.id;let v=A.some(e=>e.rowId),B=A.indexOf(g),C=A.slice(B+1),y=ln(C,g.rowId);if(o){let e=y.filter(e=>l?!e.disabled&&e.id!==l:!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),x=v&&c&&(h?"horizontal"!==c:"vertical"!==c),E=p?(!v||h)&&b&&d:!!h&&d;if(b){let e=lr(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[lt]:[],...e.slice(0,n)]}(x&&!E?A:ln(A,g.rowId),l,E),l);return null==e?void 0:e.id}if(x){let e=lr(E?y:C,l);return E?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let M=lr(y,l);return!M&&E?null:null==M?void 0:M.id};return{...n,...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=lr(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=lr(ig(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:a,includesBaseElement:nm(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:nm(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:nm(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:nm(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:nm(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),l=function({popover:e,...t}={}){let r=iY(t.store,iW(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));iz(t,r);let n=null==r?void 0:r.getState(),i=aq({...t,store:r}),a=nm(t.placement,null==n?void 0:n.placement,"bottom"),o=iJ({...i.getState(),placement:a,currentPlacement:a,anchorElement:nm(null==n?void 0:n.anchorElement,null),popoverElement:nm(null==n?void 0:n.popoverElement,null),arrowElement:nm(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:nm(t.placement,null==i?void 0:i.placement,"bottom-start")}),s=nm(t.value,null==i?void 0:i.value,t.defaultValue,""),u=nm(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...l.getState(),value:s,selectedValue:u,resetValueOnSelect:nm(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:nm(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=iJ(d,o,l,r);return lo&&iK(f,()=>iX(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),iK(f,()=>{if(e)return nl(iX(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),iX(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),iK(f,()=>iX(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",s)})),iK(f,()=>iX(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),iK(f,()=>iX(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),iK(f,()=>iq(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=o.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...l,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function ls(e={}){var t,r,n,i,a,o,l,s;let u;t=e,u=le();let[c,d]=ai(ll,e={id:nD((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return nI(d,[(n=e).tag]),an(c,n,"value","setValue"),an(c,n,"selectedValue","setSelectedValue"),an(c,n,"resetValueOnHide"),an(c,n,"resetValueOnSelect"),Object.assign((o=c,nI(l=d,[(s=n).popover]),an(o,s,"placement"),i=aQ(o,l,s),a=i,nI(d,[n.store]),an(a,n,"items","setItems"),an(i=a,n,"activeId","setActiveId"),an(i,n,"includesBaseElement"),an(i,n,"virtualFocus"),an(i,n,"orientation"),an(i,n,"rtl"),an(i,n,"focusLoop"),an(i,n,"focusWrap"),an(i,n,"focusShift"),i),{tag:n.tag})}function lu(e={}){let t=ls(e);return(0,i.jsx)(ik,{value:t,children:e.children})}var lc=(0,o.createContext)(void 0),ld=nV(function(e){let[t,r]=(0,o.useState)();return nf(e={role:"group","aria-labelledby":t,...e=n_(e,e=>(0,i.jsx)(lc.Provider,{value:r,children:e}),[])})});nJ(function(e){return nQ("div",ld(e))});var lf=nV(function({store:e,...t}){return ld(t)});nJ(function(e){return nQ("div",lf(e))});var lm=nV(function({store:e,...t}){let r=iP();return nu(e=e||r,!1),"grid"===r7(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=lf({store:e,...t})}),lh=nJ(function(e){return nQ("div",lm(e))}),lp=nV(function(e){let t=(0,o.useContext)(lc),r=nD(e.id);return nT(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),nf(e={id:r,"aria-hidden":!0,...e})});nJ(function(e){return nQ("div",lp(e))});var lA=nV(function({store:e,...t}){return lp(t)});nJ(function(e){return nQ("div",lA(e))});var lg=nV(function(e){return lA(e)}),lv=nJ(function(e){return nQ("div",lg(e))}),lB=e.i(38360);let lC={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},ly=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function lb(e,t,r={}){let{keys:n,threshold:i=lC.MATCHES,baseSort:a=ly,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return n!==a?n>a?-1:1:i===o?r(e,t):i{let l=lx(i,u,c),s=t,{minRanking:d,maxRanking:f,threshold:m}=a;return l=lC.MATCHES?l=d:l>f&&(l=f),l>e&&(e=l,r=o,n=m,s=i),{rankedValue:s,rank:e,keyIndex:r,keyThreshold:n}},{rankedValue:l,rank:lC.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:l,rank:lx(l,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:m=i}=d;return f>=m&&e.push({...d,item:a,index:o}),e},[])).map(({item:e})=>e)}function lx(e,t,r){if(e=lE(e,r),(t=lE(t,r)).length>e.length)return lC.NO_MATCH;if(e===t)return lC.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(),a=i.value;if(e.length===t.length&&0===a)return lC.EQUAL;if(0===a)return lC.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return lC.WORD_STARTS_WITH;o=n.next()}return a>0?lC.CONTAINS:1===t.length?lC.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return lC.NO_MATCH;return r=a-l,n=i/t.length,lC.MATCHES+1/r*n}(e,t)}function lE(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,lB.default)(e)),e}lb.rankings=lC;let lM={maxRanking:1/0,minRanking:-1/0};var lS=e.i(29402);let lF=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),lT={"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)"},lR={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},lw=(0,t9.getMissionList)().filter(e=>!lF.has(e)).map(e=>{let t,r=(0,t9.getMissionInfo)(e),[n]=(0,t9.getSourceAndPath)(r.resourcePath),i=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",a=lT[n]??lR[i]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:a,missionTypes:r.missionTypes}}),lD=new Map(lw.map(e=>[e.missionName,e])),lI=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,lS.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,lS.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(lw),lG="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function lL(e){let t,r,n,o,l,s=(0,a.c)(12),{mission:u}=e,c=u.displayName||u.missionName;return s[0]!==c?(t=(0,i.jsx)("span",{className:"MissionSelect-itemName",children:c}),s[0]=c,s[1]=t):t=s[1],s[2]!==u.missionTypes?(r=u.missionTypes.length>0&&(0,i.jsx)("span",{className:"MissionSelect-itemTypes",children:u.missionTypes.map(l_)}),s[2]=u.missionTypes,s[3]=r):r=s[3],s[4]!==t||s[5]!==r?(n=(0,i.jsxs)("span",{className:"MissionSelect-itemHeader",children:[t,r]}),s[4]=t,s[5]=r,s[6]=n):n=s[6],s[7]!==u.missionName?(o=(0,i.jsx)("span",{className:"MissionSelect-itemMissionName",children:u.missionName}),s[7]=u.missionName,s[8]=o):o=s[8],s[9]!==n||s[10]!==o?(l=(0,i.jsxs)(i.Fragment,{children:[n,o]}),s[9]=n,s[10]=o,s[11]=l):l=s[11],l}function l_(e){return(0,i.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e)}function lP(e){let t,r,n,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y=(0,a.c)(43),{value:b,missionType:x,onChange:E}=e,[M,S]=(0,o.useState)(""),F=(0,o.useRef)(null),T=(0,o.useRef)(x);y[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,o.startTransition)(()=>S(e))},y[0]=t):t=y[0];let R=ls({resetValueOnHide:!0,selectedValue:b,setSelectedValue:e=>{if(e){let t=T.current,r=(0,t9.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),E({missionName:e,missionType:t}),F.current?.blur()}},setValue:t});y[1]!==R?(r=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),F.current?.focus(),R.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},n=[R],y[1]=R,y[2]=r,y[3]=n):(r=y[2],n=y[3]),(0,o.useEffect)(r,n),y[4]!==b?(l=lD.get(b),y[4]=b,y[5]=l):l=y[5];let w=l;e:{let e,t;if(!M){let e;y[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:lI},y[6]=e):e=y[6],s=e;break e}y[7]!==M?(e=lb(lw,M,{keys:["displayName","missionName","missionTypes","groupName"]}),y[7]=M,y[8]=e):e=y[8];let r=e;y[9]!==r?(t={type:"flat",missions:r},y[9]=r,y[10]=t):t=y[10],s=t}let D=s,I=w?w.displayName||w.missionName:b,G="flat"===D.type?0===D.missions.length:0===D.groups.length,L=e=>(0,i.jsx)(as,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(T.current=r,e.missionName===b&&E({missionName:e.missionName,missionType:r})):T.current=null}else T.current=null},children:(0,i.jsx)(lL,{mission:e})},e.missionName);y[11]!==R?(u=()=>{document.exitPointerLock(),R.show()},c=e=>{"Escape"!==e.key||R.getState().open||F.current?.blur()},y[11]=R,y[12]=u,y[13]=c):(u=y[12],c=y[13]),y[14]!==I||y[15]!==u||y[16]!==c?(d=(0,i.jsx)(i1,{ref:F,autoSelect:!0,placeholder:I,className:"MissionSelect-input",onFocus:u,onKeyDown:c}),y[14]=I,y[15]=u,y[16]=c,y[17]=d):d=y[17],y[18]!==I?(f=(0,i.jsx)("span",{className:"MissionSelect-selectedName",children:I}),y[18]=I,y[19]=f):f=y[19],y[20]!==x?(m=x&&(0,i.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":x,children:x}),y[20]=x,y[21]=m):m=y[21],y[22]!==m||y[23]!==f?(h=(0,i.jsxs)("div",{className:"MissionSelect-selectedValue",children:[f,m]}),y[22]=m,y[23]=f,y[24]=h):h=y[24],y[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,i.jsx)("kbd",{className:"MissionSelect-shortcut",children:lG?"⌘K":"^K"}),y[25]=p):p=y[25],y[26]!==h||y[27]!==d?(A=(0,i.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[d,h,p]}),y[26]=h,y[27]=d,y[28]=A):A=y[28];let _="flat"===D.type?D.missions.map(L):D.groups.map(e=>{let[t,r]=e;return t?(0,i.jsxs)(lh,{className:"MissionSelect-group",children:[(0,i.jsx)(lv,{className:"MissionSelect-groupLabel",children:t}),r.map(L)]},t):(0,i.jsx)(o.Fragment,{children:r.map(L)},"ungrouped")});return y[29]!==G?(g=G&&(0,i.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"}),y[29]=G,y[30]=g):g=y[30],y[31]!==aA||y[32]!==_||y[33]!==g?(v=(0,i.jsxs)(aA,{className:"MissionSelect-list",children:[_,g]}),y[31]=aA,y[32]=_,y[33]=g,y[34]=v):v=y[34],y[35]!==o4||y[36]!==v?(B=(0,i.jsx)(o4,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:"MissionSelect-popover",children:v}),y[35]=o4,y[36]=v,y[37]=B):B=y[37],y[38]!==lu||y[39]!==R||y[40]!==A||y[41]!==B?(C=(0,i.jsxs)(lu,{store:R,children:[A,B]}),y[38]=lu,y[39]=R,y[40]=A,y[41]=B,y[42]=C):C=y[42],C}var lO=e.i(11152),lk=e.i(40141);function lH(e){return(0,lk.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)}function lj(e){let t,r,n,l,s,u=(0,a.c)(11),{cameraRef:c,missionName:d,missionType:f}=e,{fogEnabled:m}=(0,S.useSettings)(),[h,p]=(0,o.useState)(!1),A=(0,o.useRef)(null);u[0]!==c||u[1]!==m||u[2]!==d||u[3]!==f?(t=async()=>{clearTimeout(A.current);let e=c.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,i=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${i}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${f}`),r.set("fog",m.toString());let n=`${window.location.pathname}?${r}${t}`,i=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(i),p(!0),A.current=setTimeout(()=>{p(!1)},1100)}catch(e){console.error(e)}},u[0]=c,u[1]=m,u[2]=d,u[3]=f,u[4]=t):t=u[4];let g=t,v=h?"true":"false";return u[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,i.jsx)(lO.FaMapPin,{className:"MapPin"}),n=(0,i.jsx)(lH,{className:"ClipboardCheck"}),l=(0,i.jsx)("span",{className:"ButtonLabel",children:" Copy coordinates URL"}),u[5]=r,u[6]=n,u[7]=l):(r=u[5],n=u[6],l=u[7]),u[8]!==g||u[9]!==v?(s=(0,i.jsxs)("button",{type:"button",className:"IconButton LabelledButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:g,"data-copied":v,id:"copyCoordinatesButton",children:[r,n,l]}),u[8]=g,u[9]=v,u[10]=s):s=u[10],s}function lU(e){return(0,lk.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 lN(e){return(0,lk.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)}function lJ(e){let t,r,n,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y,b,x,E,M,F,T,R,w,D,I,G,L,_,P,O,k,H,j,U,N,J,K,Q,V,X,q,W=(0,a.c)(99),{missionName:Y,missionType:z,onChangeMission:Z,onOpenMapInfo:$,cameraRef:ee,isTouch:et}=e,{fogEnabled:er,setFogEnabled:en,fov:ei,setFov:ea,audioEnabled:eo,setAudioEnabled:el,animationEnabled:es,setAnimationEnabled:eu}=(0,S.useSettings)(),{speedMultiplier:ec,setSpeedMultiplier:ed,touchMode:ef,setTouchMode:em}=(0,S.useControls)(),{debugMode:eh,setDebugMode:ep}=(0,S.useDebug)(),[eA,eg]=(0,o.useState)(!1),ev=(0,o.useRef)(null),eB=(0,o.useRef)(null),eC=(0,o.useRef)(null);W[0]!==eA?(t=()=>{eA&&ev.current?.focus()},r=[eA],W[0]=eA,W[1]=t,W[2]=r):(t=W[1],r=W[2]),(0,o.useEffect)(t,r),W[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{let t=e.relatedTarget;t&&eC.current?.contains(t)||eg(!1)},W[3]=n):n=W[3];let ey=n;W[4]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{"Escape"===e.key&&(eg(!1),eB.current?.focus())},W[4]=l):l=W[4];let eb=l;return W[5]!==Y||W[6]!==z||W[7]!==Z?(s=(0,i.jsx)(lP,{value:Y,missionType:z,onChange:Z}),W[5]=Y,W[6]=z,W[7]=Z,W[8]=s):s=W[8],W[9]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{eg(lK)},W[9]=u):u=W[9],W[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)(lN,{}),W[10]=c):c=W[10],W[11]!==eA?(d=(0,i.jsx)("button",{ref:eB,className:"IconButton Controls-toggle",onClick:u,"aria-expanded":eA,"aria-controls":"settingsPanel","aria-label":"Settings",children:c}),W[11]=eA,W[12]=d):d=W[12],W[13]!==ee||W[14]!==Y||W[15]!==z?(f=(0,i.jsx)(lj,{cameraRef:ee,missionName:Y,missionType:z}),W[13]=ee,W[14]=Y,W[15]=z,W[16]=f):f=W[16],W[17]===Symbol.for("react.memo_cache_sentinel")?(m=(0,i.jsx)(lU,{}),h=(0,i.jsx)("span",{className:"ButtonLabel",children:"Show map info"}),W[17]=m,W[18]=h):(m=W[17],h=W[18]),W[19]!==$?(p=(0,i.jsxs)("button",{type:"button",className:"IconButton LabelledButton MapInfoButton","aria-label":"Show map info",onClick:$,children:[m,h]}),W[19]=$,W[20]=p):p=W[20],W[21]!==p||W[22]!==f?(A=(0,i.jsxs)("div",{className:"Controls-group",children:[f,p]}),W[21]=p,W[22]=f,W[23]=A):A=W[23],W[24]!==en?(g=e=>{en(e.target.checked)},W[24]=en,W[25]=g):g=W[25],W[26]!==er||W[27]!==g?(v=(0,i.jsx)("input",{id:"fogInput",type:"checkbox",checked:er,onChange:g}),W[26]=er,W[27]=g,W[28]=v):v=W[28],W[29]===Symbol.for("react.memo_cache_sentinel")?(B=(0,i.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),W[29]=B):B=W[29],W[30]!==v?(C=(0,i.jsxs)("div",{className:"CheckboxField",children:[v,B]}),W[30]=v,W[31]=C):C=W[31],W[32]!==el?(y=e=>{el(e.target.checked)},W[32]=el,W[33]=y):y=W[33],W[34]!==eo||W[35]!==y?(b=(0,i.jsx)("input",{id:"audioInput",type:"checkbox",checked:eo,onChange:y}),W[34]=eo,W[35]=y,W[36]=b):b=W[36],W[37]===Symbol.for("react.memo_cache_sentinel")?(x=(0,i.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),W[37]=x):x=W[37],W[38]!==b?(E=(0,i.jsxs)("div",{className:"CheckboxField",children:[b,x]}),W[38]=b,W[39]=E):E=W[39],W[40]!==C||W[41]!==E?(M=(0,i.jsxs)("div",{className:"Controls-group",children:[C,E]}),W[40]=C,W[41]=E,W[42]=M):M=W[42],W[43]!==eu?(F=e=>{eu(e.target.checked)},W[43]=eu,W[44]=F):F=W[44],W[45]!==es||W[46]!==F?(T=(0,i.jsx)("input",{id:"animationInput",type:"checkbox",checked:es,onChange:F}),W[45]=es,W[46]=F,W[47]=T):T=W[47],W[48]===Symbol.for("react.memo_cache_sentinel")?(R=(0,i.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),W[48]=R):R=W[48],W[49]!==T?(w=(0,i.jsxs)("div",{className:"CheckboxField",children:[T,R]}),W[49]=T,W[50]=w):w=W[50],W[51]!==ep?(D=e=>{ep(e.target.checked)},W[51]=ep,W[52]=D):D=W[52],W[53]!==eh||W[54]!==D?(I=(0,i.jsx)("input",{id:"debugInput",type:"checkbox",checked:eh,onChange:D}),W[53]=eh,W[54]=D,W[55]=I):I=W[55],W[56]===Symbol.for("react.memo_cache_sentinel")?(G=(0,i.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),W[56]=G):G=W[56],W[57]!==I?(L=(0,i.jsxs)("div",{className:"CheckboxField",children:[I,G]}),W[57]=I,W[58]=L):L=W[58],W[59]!==w||W[60]!==L?(_=(0,i.jsxs)("div",{className:"Controls-group",children:[w,L]}),W[59]=w,W[60]=L,W[61]=_):_=W[61],W[62]===Symbol.for("react.memo_cache_sentinel")?(P=(0,i.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),W[62]=P):P=W[62],W[63]!==ea?(O=e=>ea(parseInt(e.target.value)),W[63]=ea,W[64]=O):O=W[64],W[65]!==ei||W[66]!==O?(k=(0,i.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:ei,onChange:O}),W[65]=ei,W[66]=O,W[67]=k):k=W[67],W[68]!==ei?(H=(0,i.jsx)("output",{htmlFor:"fovInput",children:ei}),W[68]=ei,W[69]=H):H=W[69],W[70]!==k||W[71]!==H?(j=(0,i.jsxs)("div",{className:"Field",children:[P,k,H]}),W[70]=k,W[71]=H,W[72]=j):j=W[72],W[73]===Symbol.for("react.memo_cache_sentinel")?(U=(0,i.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),W[73]=U):U=W[73],W[74]!==ed?(N=e=>ed(parseFloat(e.target.value)),W[74]=ed,W[75]=N):N=W[75],W[76]!==ec||W[77]!==N?(J=(0,i.jsxs)("div",{className:"Field",children:[U,(0,i.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:ec,onChange:N})]}),W[76]=ec,W[77]=N,W[78]=J):J=W[78],W[79]!==j||W[80]!==J?(K=(0,i.jsxs)("div",{className:"Controls-group",children:[j,J]}),W[79]=j,W[80]=J,W[81]=K):K=W[81],W[82]!==et||W[83]!==em||W[84]!==ef?(Q=et&&(0,i.jsx)("div",{className:"Controls-group",children:(0,i.jsxs)("div",{className:"Field",children:[(0,i.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick:"})," ",(0,i.jsxs)("select",{id:"touchModeInput",value:ef,onChange:e=>em(e.target.value),children:[(0,i.jsx)("option",{value:"dualStick",children:"Dual Stick"}),(0,i.jsx)("option",{value:"moveLookStick",children:"Single Stick"})]})]})}),W[82]=et,W[83]=em,W[84]=ef,W[85]=Q):Q=W[85],W[86]!==eA||W[87]!==A||W[88]!==M||W[89]!==_||W[90]!==K||W[91]!==Q?(V=(0,i.jsxs)("div",{className:"Controls-dropdown",ref:ev,id:"settingsPanel",tabIndex:-1,onKeyDown:eb,onBlur:ey,"data-open":eA,children:[A,M,_,K,Q]}),W[86]=eA,W[87]=A,W[88]=M,W[89]=_,W[90]=K,W[91]=Q,W[92]=V):V=W[92],W[93]!==V||W[94]!==d?(X=(0,i.jsxs)("div",{ref:eC,children:[d,V]}),W[93]=V,W[94]=d,W[95]=X):X=W[95],W[96]!==X||W[97]!==s?(q=(0,i.jsxs)("div",{id:"controls",onKeyDown:lX,onPointerDown:lV,onClick:lQ,children:[s,X]}),W[96]=X,W[97]=s,W[98]=q):q=W[98],q}function lK(e){return!e}function lQ(e){return e.stopPropagation()}function lV(e){return e.stopPropagation()}function lX(e){return e.stopPropagation()}let lq=()=>null,lW=o.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:i,...a},l)=>{let s=(0,C.useThree)(({set:e})=>e),c=(0,C.useThree)(({camera:e})=>e),d=(0,C.useThree)(({size:e})=>e),f=o.useRef(null);o.useImperativeHandle(l,()=>f.current,[]);let m=o.useRef(null),h=function(e,t,r){let n=(0,C.useThree)(e=>e.size),i=(0,C.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,l=n.height*i.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:d,...f}=s,m=null!=d?d:s.depthBuffer,h=o.useMemo(()=>{let e=new u.WebGLRenderTarget(a,l,{minFilter:u.LinearFilter,magFilter:u.LinearFilter,type:u.HalfFloatType,...f});return m&&(e.depthTexture=new u.DepthTexture(a,l,u.FloatType)),e.samples=c,e},[]);return o.useLayoutEffect(()=>{h.setSize(a,l),c&&(h.samples=c)},[c,h,a,l]),o.useEffect(()=>()=>h.dispose(),[]),h}(t);o.useLayoutEffect(()=>{a.manual||(f.current.aspect=d.width/d.height)},[d,a]),o.useLayoutEffect(()=>{f.current.updateProjectionMatrix()});let p=0,A=null,g="function"==typeof i;return(0,B.useFrame)(t=>{g&&(r===1/0||p{if(n)return s(()=>({camera:f.current})),()=>s(()=>({camera:c}))},[f,n,s]),o.createElement(o.Fragment,null,o.createElement("perspectiveCamera",(0,W.default)({ref:f},a),!g&&i),o.createElement("group",{ref:m},g&&i(h.texture)))});function lY(){let e,t,r=(0,a.c)(3),{fov:n}=(0,S.useSettings)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],r[0]=e):e=r[0],r[1]!==n?(t=(0,i.jsx)(lW,{makeDefault:!0,position:e,fov:n}),r[1]=n,r[2]=t):t=r[2],t}var lz=e.i(51434),lZ=e.i(81405);function l$(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function l0({showPanel:e=0,className:t,parent:r}){let n=function(e,t=[],r){let[n,i]=o.useState();return o.useLayoutEffect(()=>{let t=e();return i(t),l$(void 0,t),()=>l$(void 0,null)},t),n}(()=>new lZ.default,[]);return o.useEffect(()=>{if(n){let i=r&&r.current||document.body;n.showPanel(e),null==i||i.appendChild(n.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&n.dom.classList.add(...a);let o=(0,l.j)(()=>n.begin()),s=(0,l.k)(()=>n.end());return()=>{a.length&&n.dom.classList.remove(...a),null==i||i.removeChild(n.dom),o(),s()}}},[r,n,t,e]),null}var l1=e.i(60099);function l2(){let e,t,r=(0,a.c)(3),{debugMode:n}=(0,S.useDebug)(),l=(0,o.useRef)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=l.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},r[0]=e):e=r[0],(0,o.useEffect)(e),r[1]!==n?(t=n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l0,{className:"StatsPanel"}),(0,i.jsx)("axesHelper",{ref:l,args:[70],renderOrder:999,children:(0,i.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,i.jsx)(l1.Html,{position:[80,0,0],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,i.jsx)(l1.Html,{position:[0,80,0],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,i.jsx)(l1.Html,{position:[0,0,80],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null,r[1]=n,r[2]=t):t=r[2],t}var l9=e.i(50361),l3=e.i(24540);function l5(e,t,r){try{return e(t)}catch(e){return(0,l3.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function l8(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),l5(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}}}}l8({parse:e=>e,serialize:String}),l8({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),l8({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),l8({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}}),l8({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let l6=l8({parse:e=>"true"===e.toLowerCase(),serialize:String});function l4(e,t){return e.valueOf()===t.valueOf()}l8({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:l4}),l8({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:l4}),l8({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:l4});let l7=(0,l9.r)(),se={};function st(e,t,r,n,i,a){let o=!1,l=Object.entries(e).reduce((e,[l,s])=>{var u;let c=t?.[l]??l,d=n[c],f="multi"===s.type?[]:null,m=void 0===d?("multi"===s.type?r?.getAll(c):r?.get(c))??f:d;return i&&a&&((u=i[c]??f)===m||null!==u&&null!==m&&"string"!=typeof u&&"string"!=typeof m&&u.length===m.length&&u.every((e,t)=>e===m[t]))?e[l]=a[l]??null:(o=!0,e[l]=((0,l9.i)(m)?null:l5(s.parse,m,c))??null,i&&(i[c]=m)),e},{});if(!o){let t=Object.keys(e),r=Object.keys(a??{});o=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:l,hasChanged:o}}function sr(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function sn(e,t={}){let{parse:r,type:n,serialize:i,eq:a,defaultValue:l,...s}=t,[{[e]:u},c]=function(e,t={}){let r=(0,o.useId)(),n=(0,l3.i)(),i=(0,l3.a)(),{history:a="replace",scroll:l=n?.scroll??!1,shallow:s=n?.shallow??!0,throttleMs:u=l9.s.timeMs,limitUrlUpdates:c=n?.limitUrlUpdates,clearOnDefault:d=n?.clearOnDefault??!0,startTransition:f,urlKeys:m=se}=t,h=Object.keys(e).join(","),p=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,m[e]??e])),[h,JSON.stringify(m)]),A=(0,l3.r)(Object.values(p)),g=A.searchParams,v=(0,o.useRef)({}),B=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),C=l9.t.useQueuedQueries(Object.values(p)),[y,b]=(0,o.useState)(()=>st(e,m,g??new URLSearchParams,C).state),x=(0,o.useRef)(y);if((0,l3.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,h,y,g),Object.keys(v.current).join("&")!==Object.values(p).join("&")){let{state:t,hasChanged:n}=st(e,m,g,C,v.current,x.current);n&&((0,l3.c)("[nuq+ %s `%s`] State changed: %O",r,h,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t)),v.current=Object.fromEntries(Object.entries(p).map(([t,r])=>[r,e[t]?.type==="multi"?g?.getAll(r):g?.get(r)??null]))}(0,o.useEffect)(()=>{let{state:t,hasChanged:n}=st(e,m,g,C,v.current,x.current);n&&((0,l3.c)("[nuq+ %s `%s`] State changed: %O",r,h,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t))},[Object.values(p).map(e=>`${e}=${g?.getAll(e)}`).join("&"),JSON.stringify(C)]),(0,o.useEffect)(()=>{let t=Object.keys(e).reduce((t,n)=>(t[n]=({state:t,query:i})=>{b(a=>{let{defaultValue:o}=e[n],l=p[n],s=t??o??null;return Object.is(a[n]??o??null,s)?((0,l3.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,h,l,t,o,x.current),a):(x.current={...x.current,[n]:s},v.current[l]=i,(0,l3.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,h,l,t,o,x.current),x.current)})},t),{});for(let n of Object.keys(e)){let e=p[n];(0,l3.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,h),l7.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=p[n];(0,l3.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,h),l7.off(e,t[n])}}},[h,p]);let E=(0,o.useCallback)((t,n={})=>{let o,m=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g="function"==typeof t?t(sr(x.current,B))??m:t??m;(0,l3.c)("[nuq+ %s `%s`] setState: %O",r,h,g);let v=0,C=!1,y=[];for(let[t,r]of Object.entries(g)){let m=e[t],h=p[t];if(!m||void 0===r)continue;(n.clearOnDefault??m.clearOnDefault??d)&&null!==r&&void 0!==m.defaultValue&&(m.eq??((e,t)=>e===t))(r,m.defaultValue)&&(r=null);let g=null===r?null:(m.serialize??String)(r);l7.emit(h,{state:r,query:g});let B={key:h,query:g,options:{history:n.history??m.history??a,shallow:n.shallow??m.shallow??s,scroll:n.scroll??m.scroll??l,startTransition:n.startTransition??m.startTransition??f}};if(n?.limitUrlUpdates?.method==="debounce"||c?.method==="debounce"||m.limitUrlUpdates?.method==="debounce"){!0===B.options.shallow&&console.warn((0,l3.s)(422));let e=n?.limitUrlUpdates?.timeMs??c?.timeMs??m.limitUrlUpdates?.timeMs??l9.s.timeMs,t=l9.t.push(B,e,A,i);vt(e),C?l9.n.flush(A,i):l9.n.getPendingPromise(A));return o??b},[h,a,s,l,u,c?.method,c?.timeMs,f,p,A.updateUrl,A.getSearchParamsSnapshot,A.rateLimitFactor,i,B]);return[(0,o.useMemo)(()=>sr(y,B),[y,B]),E]}({[e]:{parse:r??(e=>e),type:n,serialize:i,eq:a,defaultValue:l}},s);return[u,(0,o.useCallback)((t,r={})=>c(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,c])]}let si=(0,o.lazy)(()=>e.A(59197).then(e=>({default:e.MapInfoDialog}))),sa=new rm,so={toneMapping:u.NoToneMapping,outputColorSpace:u.SRGBColorSpace},sl=l8({parse(e){let[t,r]=e.split("~"),n=r,i=(0,t9.getMissionInfo)(t).missionTypes;return r&&i.includes(r)||(n=i[0]),{missionName:t,missionType:n}},serialize:({missionName:e,missionType:t})=>1===(0,t9.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function ss(){let e,t,r,n,l,s,c,d,f,m,h,A,g,v,B,C,y,b,x,E,M,F,T,R,w,D,I,G,L,_,P,O,k,H=(0,a.c)(60),[j,U]=sn("mission",sl),[N,J]=sn("fog",l6);H[0]!==J?(e=()=>{J(null)},H[0]=J,H[1]=e):e=H[1];let K=e;H[2]!==K||H[3]!==U?(t=e=>{window.location.hash="",K(),U(e)},H[2]=K,H[3]=U,H[4]=t):t=H[4];let Q=t,V=(_=(0,a.c)(2),P=(0,o.useRef)(null),_[0]===Symbol.for("react.memo_cache_sentinel")?(G=e=>{let t=window.matchMedia("(pointer: coarse)");return t.addEventListener("change",e),P.current=t,()=>{t.removeEventListener("change",e)}},_[0]=G):G=_[0],O=G,_[1]===Symbol.for("react.memo_cache_sentinel")?(L=()=>P.current?.matches??null,_[1]=L):L=_[1],k=L,(0,o.useSyncExternalStore)(O,k,lq)),{missionName:X,missionType:q}=j,[W,Y]=(0,o.useState)(!1),[z,Z]=(0,o.useState)(0),[$,ee]=(0,o.useState)(!0),et=z<1;H[5]!==et?(r=()=>{if(et)ee(!0);else{let e=setTimeout(()=>ee(!1),500);return()=>clearTimeout(e)}},n=[et],H[5]=et,H[6]=r,H[7]=n):(r=H[6],n=H[7]),(0,o.useEffect)(r,n),H[8]!==Q?(l=()=>(window.setMissionName=e=>{let t=(0,t9.getMissionInfo)(e).missionTypes;Q({missionName:e,missionType:t[0]})},window.getMissionList=t9.getMissionList,window.getMissionInfo=t9.getMissionInfo,su),s=[Q],H[8]=Q,H[9]=l,H[10]=s):(l=H[9],s=H[10]),(0,o.useEffect)(l,s),H[11]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{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||Y(!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},d=[],H[11]=c,H[12]=d):(c=H[11],d=H[12]),(0,o.useEffect)(c,d),H[13]===Symbol.for("react.memo_cache_sentinel")?(f=(e,t)=>{Z(void 0===t?0:t)},H[13]=f):f=H[13];let er=f,en=(0,o.useRef)(null);H[14]===Symbol.for("react.memo_cache_sentinel")?(m={angle:0,force:0},H[14]=m):m=H[14];let ei=(0,o.useRef)(m),ea=(0,o.useRef)(null);H[15]===Symbol.for("react.memo_cache_sentinel")?(h={angle:0,force:0},H[15]=h):h=H[15];let eo=(0,o.useRef)(h),el=(0,o.useRef)(null);H[16]!==et||H[17]!==z||H[18]!==$?(A=$&&(0,i.jsxs)("div",{id:"loadingIndicator","data-complete":!et,children:[(0,i.jsx)("div",{className:"LoadingSpinner"}),(0,i.jsx)("div",{className:"LoadingProgress",children:(0,i.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*z}%`}})}),(0,i.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*z),"%"]})]}),H[16]=et,H[17]=z,H[18]=$,H[19]=A):A=H[19],H[20]===Symbol.for("react.memo_cache_sentinel")?(g={type:u.PCFShadowMap},v=e=>{en.current=e.camera},H[20]=g,H[21]=v):(g=H[20],v=H[21]);let es=`${X}~${q}`;return H[22]!==X||H[23]!==q||H[24]!==es?(B=(0,i.jsx)(t6,{name:X,missionType:q,onLoadingChange:er},es),H[22]=X,H[23]=q,H[24]=es,H[25]=B):B=H[25],H[26]===Symbol.for("react.memo_cache_sentinel")?(C=(0,i.jsx)(lY,{}),y=(0,i.jsx)(l2,{}),H[26]=C,H[27]=y):(C=H[26],y=H[27]),H[28]!==V?(b=null===V?null:V?(0,i.jsx)(rY,{joystickState:ei,joystickZone:ea,lookJoystickState:eo,lookJoystickZone:el}):(0,i.jsx)(rL,{}),H[28]=V,H[29]=b):b=H[29],H[30]!==B||H[31]!==b?(x=(0,i.jsx)(p,{frameloop:"always",gl:so,shadows:g,onCreated:v,children:(0,i.jsx)(tq,{children:(0,i.jsxs)(lz.AudioProvider,{children:[B,C,y,b]})})}),H[30]=B,H[31]=b,H[32]=x):x=H[32],H[33]!==A||H[34]!==x?(E=(0,i.jsxs)("div",{id:"canvasContainer",children:[A,x]}),H[33]=A,H[34]=x,H[35]=E):E=H[35],H[36]!==V?(M=V&&(0,i.jsx)(rW,{joystickState:ei,joystickZone:ea,lookJoystickState:eo,lookJoystickZone:el}),H[36]=V,H[37]=M):M=H[37],H[38]!==V?(F=!1===V&&(0,i.jsx)(rO,{}),H[38]=V,H[39]=F):F=H[39],H[40]===Symbol.for("react.memo_cache_sentinel")?(T=()=>Y(!0),H[40]=T):T=H[40],H[41]!==Q||H[42]!==V||H[43]!==X||H[44]!==q?(R=(0,i.jsx)(lJ,{missionName:X,missionType:q,onChangeMission:Q,onOpenMapInfo:T,cameraRef:en,isTouch:V}),H[41]=Q,H[42]=V,H[43]=X,H[44]=q,H[45]=R):R=H[45],H[46]!==W||H[47]!==X||H[48]!==q?(w=W&&(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(si,{open:W,onClose:()=>Y(!1),missionName:X,missionType:q??""})}),H[46]=W,H[47]=X,H[48]=q,H[49]=w):w=H[49],H[50]!==E||H[51]!==M||H[52]!==F||H[53]!==R||H[54]!==w?(D=(0,i.jsxs)(rv,{map:rG,children:[E,M,F,R,w]}),H[50]=E,H[51]=M,H[52]=F,H[53]=R,H[54]=w,H[55]=D):D=H[55],H[56]!==K||H[57]!==N||H[58]!==D?(I=(0,i.jsx)(rh.QueryClientProvider,{client:sa,children:(0,i.jsx)("main",{children:(0,i.jsx)(S.SettingsProvider,{fogEnabledOverride:N,onClearFogEnabledOverride:K,children:D})})}),H[56]=K,H[57]=N,H[58]=D,H[59]=I):I=H[59],I}function su(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}function sc(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(ss,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>sc],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/5619c5b2b1355f74.js b/docs/_next/static/chunks/5619c5b2b1355f74.js new file mode 100644 index 00000000..93362f87 --- /dev/null +++ b/docs/_next/static/chunks/5619c5b2b1355f74.js @@ -0,0 +1,351 @@ +(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,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,n)=>{let t=n0(e),r=(e,r=n)=>(function(e,n=e=>e,t){let r=n1(e.subscribe,e.getState,e.getInitialState,n,t);return p.default.useDebugValue(r),r})(t,e,r);return Object.assign(r,t),r},n2=[];function n4(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=n2.indexOf(a);-1!==e&&n2.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(n2.push(a),!t)throw a.promise}var n6=e.i(98133),n8=e.i(95087),n9=e.i(43476),n7=p;function te(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=te(r,n,t);if(e)return e;r=n?null:r.sibling}}function tn(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")?n7.useLayoutEffect:n7.useEffect;let tt=tn(n7.createContext(null));class tr extends n7.Component{render(){return n7.createElement(tt.Provider,{value:this._reactInternals},this.props.children)}}function ta(){let e=n7.useContext(tt);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=n7.useId();return n7.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=te(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 ti=Symbol.for("react.context"),to=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ti;function tl(){let e=function(){let e=ta(),[n]=n7.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;to(e)&&e!==tt&&!n.has(e)&&n.set(e,n7.use(tn(e))),t=t.return}return n}();return n7.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>n7.createElement(n,null,n7.createElement(t.Provider,{...r,value:e.get(t)})),e=>n7.createElement(tr,{...e})),[e])}function ts(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>tr,"traverseFiber",()=>te,"useContextBridge",()=>tl,"useFiber",()=>ta],46791),p.act;let tu=e=>e&&e.hasOwnProperty("current"),tc=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),td="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 tf(e){let n=p.useRef(e);return td(()=>void(n.current=e),[e]),n}function tp(){let e=ta(),n=tl();return p.useMemo(()=>({children:t})=>{let r=te(e,!0,e=>e.type===p.StrictMode)?p.StrictMode:p.Fragment;return(0,n9.jsx)(r,{children:(0,n9.jsx)(n,{children:t})})},[e,n])}function tm({set:e}){return td(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let th=((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 tg(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 t_(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tv={obj:e=>e===Object(e)&&!tv.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(tv.str(e)||tv.num(e)||tv.boo(e))return e===n;let o=tv.obj(e);if(o&&"reference"===r)return e===n;let l=tv.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(!tv.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(tv.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}},tS=["children","key","ref"];function tE(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)tS.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tT(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 tb=/-\d+$/;function tM(e,n){if(tv.str(n.props.attach)){if(tb.test(n.props.attach)){let t=n.props.attach.replace(tb,""),{root:r,key:a}=tT(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tT(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tv.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function tx(e,n){if(tv.str(n.props.attach)){let{root:t,key:r}=tT(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 tR=[...tS,"args","dispose","attach","object","onUpdate","dispose"],tC=new Map,ty=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tA=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tP(e,n){var t,r;let a=e.__r3f,i=a&&ts(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tR.includes(t))continue;if(a&&tA.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}=tT(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&&tc(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&&ty.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&&tw(a),e}function tw(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 tL=e=>null==e?void 0:e.isObject3D;function tU(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tD(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tN=e=>!!(null!=e&&e.render),tI=p.createContext(null);function tF(){let e=p.useContext(tI);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tO(e=e=>e,n){return tF()(e,n)}function tB(e,n=0){let t=tF(),r=t.getState().internal.subscribe,a=tf(e);return td(()=>r(a,n,t),[n,r,t]),null}let tG=new WeakMap;function tk(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=tG.get(t))||(i=new t,tG.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;tL(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 tH(e,n,t,r){let a=Array.isArray(n)?n:[n],i=n5(tk(t,r),[e,...a],!1,{equal:tv.equ});return Array.isArray(n)?i:i[0]}tH.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];n5(tk(t),[e,...a],!0,r)},tH.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n2.splice(0,n2.length);else{let e=n2.find(e=>n4(t,e.keys,e.equal));e&&e.remove()}};let tV={},tz=/^three(?=[A-Z])/,tW=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tX=0;function tj(e){if("function"==typeof e){let n=`${tX++}`;return tV[n]=e,n}Object.assign(tV,e)}function tq(e,n){let t=tW(e),r=tV[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 tY(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tM(e.parent,e):tL(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tw(e)}}function tK(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=tV[tW(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tP(n.object,n.props),n.props.attach)tM(e,n);else if(tL(n.object)&&tL(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,n8.unstable_scheduleCallback)(n8.unstable_IdlePriority,n)}}function tJ(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?tx(e,n):tL(n.object)&&tL(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)=>{tD(t.capturedMap,n,e,r)})}(ts(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];tJ(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&tZ(n.object),void 0===t&&tw(n)}let t0=[],t1=()=>{},t3={},t2=0,t4=(f={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return tq(e=tW(e)in tV?e:e.replace(tz,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tE(n.object,t,e,n)},removeChild:tJ,appendChild:t$,appendInitialChild:t$,insertBefore:tQ,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t$(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&tJ(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&tQ(r,n,t)},getRootHostContext:()=>t3,getChildHostContext:()=>t3,commitUpdate(e,n,t,r,a){var i,o,l;tq(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)t0.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tR.includes(r)&&!tv.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(tR.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tT(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tC.get(e.constructor);try{n||(n=new e.constructor,tC.set(e.constructor,n))}catch(e){}return n}(a);tv.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tP(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t0){let n=e.parent;if(n)for(let t of(e.props.attach?tx(n,e):tL(e.object)&&tL(n.object)&&n.object.remove(e.object),e.children))t.props.attach?tx(e,t):tL(t.object)&&tL(e.object)&&e.object.remove(t.object);e.isHidden&&tY(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&tZ(e.object)}for(let[r,a,i]of t0){r.props=a;let o=r.parent;if(o){let a=tV[tW(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(tP(r.object,r.props),r.props.attach?tM(o,r):tL(r.object)&&tL(o.object)&&o.object.add(r.object),r.children))e.props.attach?tM(r,e):tL(e.object)&&tL(r.object)&&r.object.add(e.object);tw(r)}}t0.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tE(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?tx(e.parent,e):tL(e.object)&&(e.object.visible=!1),e.isHidden=!0,tw(e)}},unhideInstance:tY,createTextInstance:t1,hideTextInstance:t1,unhideTextInstance:t1,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){t2=e},getCurrentUpdatePriority:()=>t2,resolveUpdatePriority(){var e;if(0!==t2)return t2;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,n6.default)(f)).injectIntoDevTools(),u),t5=new Map,t6={objects:"shallow",strict:!1};function t8(e){var n,t;let r,a,i,o,l,s,u,c,d,f=t5.get(e),g=null==f?void 0:f.fiber,_=null==f?void 0:f.store;f&&console.warn("R3F.createRoot should only be called once!");let v="function"==typeof reportError?reportError:console.error,S=_||(n=rf,t=rp,u=(s=(l=(i=(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=tg(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))}}}}})?n3(i,o):n3).getState()).size,c=s.viewport.dpr,d=s.camera,l.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=l.getState();if(n.width!==u.width||n.height!==u.height||t.dpr!==c){u=n,c=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!==d&&(d=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),l.subscribe(e=>n(e)),l),E=g||t4.createContainer(S,m.ConcurrentRoot,null,!1,null,"",v,v,v,null);f||t5.set(e,{fiber:E,store:S});let T=!1,b=null;return{async configure(n={}){var t,i;let o;b=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:_=!1,frameloop:v="always",dpr:E=[1,2],performance:M,raycaster:x,camera:R,onPointerMissed:C}=n,y=S.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=tN(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(tv.equ(L,P,t6)||tP(P,{...L}),tv.equ(w,P.params,t6)||tP(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tv.equ(a,R,t6)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:_?new h.OrthographicCamera(0,0,0,0,.1,1e3):new h.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tP(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?tE(e=u,S,"",{}):(tE(e=new h.Scene,S,"",{}),u&&tP(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(S)});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(tv.equ(U,y.size,t6)||y.setSize(U.width,U.height,U.top,U.left),E&&y.viewport.dpr!==tg(E)&&y.setDpr(E),y.frameloop!==v&&y.setFrameloop(v),y.onPointerMissed||y.set({onPointerMissed:C}),M&&!tv.equ(M,y.performance,t6)&&y.set(e=>({performance:{...e.performance,...M}})),!y.xr){let e=(e,n)=>{let t=S.getState();"never"!==t.frameloop&&rp(e,!0,t,n)},n=()=>{let n=S.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rf(n)},r={connect(){let e=S.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=S.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,tv.boo(f))A.shadowMap.type=h.PCFSoftShadowMap;else if(tv.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 tv.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return h.ColorManagement.enabled=!g,T||(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||tv.fun(l)||tN(l)||tv.equ(l,A,t6)||tP(A,l),r=d,T=!0,o(),this},render(n){return T||b||this.configure(),b.then(()=>{t4.updateContainer((0,n9.jsx)(t9,{store:S,children:n,onCreated:r,rootElement:e}),E,null,()=>void 0)}),S},unmount(){t7(e)}}}function t9({store:e,children:n,onCreated:t,rootElement:r}){return td(()=>{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,n9.jsx)(tI.Provider,{value:e,children:n})}function t7(e,n){let t=t5.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),t4.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())}t5.delete(e),n&&n(e)}catch(e){}},500)})}}function re(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let rn=new Set,rt=new Set,rr=new Set,ra=e=>re(e,rn),ri=e=>re(e,rt);function ro(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rl(e,n){switch(e){case"before":return ro(rn,n);case"after":return ro(rt,n);case"tail":return ro(rr,n)}}function rs(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+=rs(e,i))}if(rc=!1,rl("after",e),0===r)return rl("tail",e),ru=!1,cancelAnimationFrame(a)}function rf(e,n=1){var t;if(!e)return t5.forEach(e=>rf(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):rc?e.internal.frames=2:e.internal.frames=1,ru||(ru=!0,requestAnimationFrame(rd)))}function rp(e,n=!0,t,r){if(n&&rl("before",e),t)rs(e,t,r);else for(let n of t5.values())rs(e,n.store.getState());n&&rl("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 rh(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(tU(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=t_(e.object),r=t_(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tU(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(tU(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=t_(o.object);if(l||o.object.traverseAncestors(e=>{let n=t_(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&&tD(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=tU(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",()=>tm,"C",()=>tO,"D",()=>tB,"E",()=>th,"G",()=>tH,"a",()=>tf,"b",()=>td,"c",()=>t8,"d",()=>t7,"e",()=>tj,"f",()=>rh,"i",()=>tu,"j",()=>ra,"k",()=>ri,"u",()=>tp],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/648c99009376fcef.js b/docs/_next/static/chunks/648c99009376fcef.js deleted file mode 100644 index d091bdf3..00000000 --- a/docs/_next/static/chunks/648c99009376fcef.js +++ /dev/null @@ -1,402 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,79474,(e,t,n)=>{"use strict";var i=e.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;n.c=function(e){return i.H.useMemoCache(e)}},932,(e,t,n)=>{"use strict";t.exports=e.r(79474)},24478,(e,t,n)=>{"use strict";n.ConcurrentRoot=1,n.ContinuousEventPriority=8,n.DefaultEventPriority=32,n.DiscreteEventPriority=2,n.IdleEventPriority=0x10000000,n.LegacyRoot=0,n.NoEventPriority=0},39695,(e,t,n)=>{"use strict";t.exports=e.r(24478)},55838,(e,t,n)=>{"use strict";var i=e.r(71645),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,s=i.useEffect,o=i.useLayoutEffect,l=i.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=a({inst:{value:n,getSnapshot:t}}),r=i[0].inst,c=i[1];return o(function(){r.value=n,r.getSnapshot=t,u(r)&&c({inst:r})},[e,n,t]),s(function(){return u(r)&&c({inst:r}),e(function(){u(r)&&c({inst:r})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var i=e.r(71645),r=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useSyncExternalStore,o=i.useRef,l=i.useEffect,u=i.useMemo,c=i.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=i(e),void 0!==r&&d.hasValue){var t=d.value;if(r(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=i(e);return void 0!==r&&r(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,i,r]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},29779,(e,t,n)=>{"use strict";function i(e,t){var n=e.length;for(e.push(t);0>>1,r=e[i];if(0>>1;is(l,n))us(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else if(us(c,n))e[i]=c,e[u]=n,i=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,_=!1,y="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=r(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,i(h,t);else break;t=r(d)}}function M(e){if(_=!1,S(e),!v)if(null!==r(h))v=!0,L();else{var t=r(d);null!==t&&N(M,t.startTime-e)}}var w=!1,T=-1,E=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===r(h)&&a(h),S(e)}else a(h);f=r(h)}if(null!==f)t=!0;else{var u=r(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=i,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){y(R,0)};function L(){w||(w=!0,o())}function N(e,t){T=y(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,i(d,e),null===r(h)&&e===r(d)&&(_?(x(T),T=-1):_=!0,N(M,a-s))):(e.sortIndex=o,i(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},28563,(e,t,n)=>{"use strict";t.exports=e.r(29779)},40336,(e,t,n)=>{"use strict";var i=e.i(47167);t.exports=function(t){function n(e,t,n,i){return new iL(e,t,n,i)}function r(){}function a(e){var t="https://react.dev/errors/"+e;if(1)":-1r||u[i]!==c[r]){var h="\n"+u[i].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=i&&0<=r)break}}}finally{rl=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?l(n):""}function c(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return l(e.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("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 t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do 0!=(4098&(t=e).flags)&&(n=t.return),e=t.return;while(e)}return 3===t.tag?n:null}function d(e){if(h(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(null===(t=h(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(null===r)break;var s=r.alternate;if(null===s){if(null!==(i=r.return)){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return d(r),e;if(s===i)return d(r),t;s=s.sibling}throw Error(a(188))}if(n.return!==i.return)n=r,i=s;else{for(var o=!1,l=r.child;l;){if(l===n){o=!0,n=r,i=s;break}if(l===i){o=!0,i=r,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,i=r;break}if(l===i){o=!0,i=s,n=r;break}l=l.sibling}if(!o)throw Error(a(189))}}if(n.alternate!==i)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){return{current:e}}function m(e){0>a4||(e.current=a3[a4],a3[a4]=null,a4--)}function g(e,t){a3[++a4]=e.current,e.current=t}function v(e){var t=42&e;if(0!==t)return t;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 _(e,t){var n=e.pendingLanes;if(0===n)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes,s=e.warmLanes;e=0!==e.finishedLanes;var o=0x7ffffff&n;return 0!==o?0!=(n=o&~r)?i=v(n):0!=(a&=o)?i=v(a):e||0!=(s=o&~s)&&(i=v(s)):0!=(o=n&~r)?i=v(o):0!==a?i=v(a):e||0!=(s=n&~s)&&(i=v(s)),0===i?0:0!==t&&t!==i&&0==(t&r)&&((r=i&-i)>=(s=t&-t)||32===r&&0!=(4194176&s))?t:i}function y(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function x(){var e=a7;return 0==(4194176&(a7<<=1))&&(a7=128),e}function b(){var e=se;return 0==(0x3c00000&(se<<=1))&&(se=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function M(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-a6(t);e.entangledLanes|=t,e.entanglements[i]=0x40000000|e.entanglements[i]|4194218&n}function T(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-a6(n),r=1<>=s,r-=s,sb=1<<32-a6(t)+r|n<d?(p=h,h=null):p=h.sibling;var v=m(n,h,s[d],o);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&t(n,h),a=l(v,a,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return i(n,h),sR&&C(n,d),u;if(null===h){for(;dp?(v=d,d=null):v=d.sibling;var y=m(n,d,_.value,u);if(null===y){null===d&&(d=v);break}e&&d&&null===y.alternate&&t(n,d),s=l(y,s,p),null===h?c=y:h.sibling=y,h=y,d=v}if(_.done)return i(n,d),sR&&C(n,p),c;if(null===d){for(;!_.done;p++,_=o.next())null!==(_=f(n,_.value,u))&&(s=l(_,s,p),null===h?c=_:h.sibling=_,h=_);return sR&&C(n,p),c}for(d=r(d);!_.done;p++,_=o.next())null!==(_=g(d,n,p,_.value,u))&&(e&&null!==_.alternate&&d.delete(null===_.key?p:_.key),s=l(_,s,p),null===h?c=_:h.sibling=_,h=_);return e&&d.forEach(function(e){return t(n,e)}),sR&&C(n,p),c}(c,h,d=v.call(d),p)}if("function"==typeof d.then)return n(c,h,ev(d),p);if(d.$$typeof===i5)return n(c,h,nl(c,d),p);ey(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d?(d=""+d,null!==h&&6===h.tag?(i(c,h.sibling),(p=o(h,d)).return=c):(i(c,h),(p=ik(d,c.mode,p)).return=c),u(c=p)):i(c,h)}(c,h,d,p);return sQ=null,v}catch(e){if(e===sY)throw e;var _=n(29,e,null,c.mode);return _.lanes=p,_.return=c,_}finally{}}}function eS(e,t){g(s4,e=o1),g(s3,t),o1=e|t.baseLanes}function eM(){g(s4,o1),g(s3,s3.current)}function ew(){o1=s4.current,m(s3),m(s4)}function eT(e){var t=e.alternate;g(s8,1&s8.current),g(s5,e),null===s6&&(null===t||null!==s3.current?s6=e:null!==t.memoizedState&&(s6=e))}function eE(e){if(22===e.tag){if(g(s8,s8.current),g(s5,e),null===s6){var t=e.alternate;null!==t&&null!==t.memoizedState&&(s6=e)}}else eA(e)}function eA(){g(s8,s8.current),g(s5,s5.current)}function eC(e){m(s5),s6===e&&(s6=null),m(s8)}function eR(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ap(n)||af(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function eP(){throw Error(a(321))}function eI(e,t){if(null===t)return!1;for(var n=0;na?a:8);var s=ro.T,o={};ro.T=o,tC(e,!1,t,n);try{var l=r(),u=ro.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c,h,d=(c=[],h={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},l.then(function(){h.status="fulfilled",h.value=i;for(var e=0;e";case oz:return":has("+(n6(e)||"")+")";case oV:return'[role="'+e.value+'"]';case oG:return'"'+e.value+'"';case oH:return'[data-testname="'+e.value+'"]';default:throw Error(a(365))}}function n8(e,t){var n=[];e=[e,0];for(var i=0;iln&&(t.flags|=128,i=!0,nM(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=eR(s))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,nS(t,e),nM(r,!0),null===r.tail&&"hidden"===r.tailMode&&!s.alternate&&!sR)return nw(t),null}else 2*sa()-r.renderingStartTime>ln&&0x20000000!==n&&(t.flags|=128,i=!0,nM(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=r.last)?e.sibling=s:t.child=s,r.last=s)}if(null!==r.tail)return t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=sa(),t.sibling=null,e=s8.current,g(s8,i?1&e|2:1&e),t;return nw(t),null;case 22:case 23:return eC(t),ew(),i=null!==t.memoizedState,null!==e?null!==e.memoizedState!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?0!=(0x20000000&n)&&0==(128&t.flags)&&(nw(t),6&t.subtreeFlags&&(t.flags|=8192)):nw(t),null!==(n=t.updateQueue)&&nS(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),i=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),null!==e&&m(oA),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),nt(oT),nw(t),null;case 25:return null}throw Error(a(156,t.tag))}(t.alternate,t,o1);if(null!==n){oq=n;return}if(null!==(t=t.sibling)){oq=t;return}oq=t=e}while(null!==t)0===o2&&(o2=5)}function ib(e,t){do{var n=function(e,t){switch(I(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nt(oT),N(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return U(t),null;case 13:if(eC(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));z()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return m(s8),null;case 4:return N(),null;case 10:return nt(t.type),null;case 22:case 23:return eC(t),ew(),null!==e&&m(oA),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return nt(oT),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,oq=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling)){oq=e;return}oq=e=n}while(null!==e)o2=6,oq=null}function iS(e,t,n,i,r,s,o,l,u,c){var h=ro.T,d=rN();try{rL(2),ro.T=null,function(e,t,n,i,r,s,o,l){do iw();while(null!==ls)if(0!=(6&o$))throw Error(a(327));var u,c,h=e.finishedWork;if(i=e.finishedLanes,null!==h){if(e.finishedWork=null,e.finishedLanes=0,h===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var d=h.lanes|h.childLanes;!function(e,t,n,i,r,a){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0n?32:n;n=ro.T;var r=rN();try{if(rL(i),ro.T=null,null===ls)var s=!1;else{i=lu,lu=null;var o=ls,l=lo;if(ls=null,lo=0,0!=(6&o$))throw Error(a(331));var u=o$;if(o$|=4,n2(o.current),nJ(o,o.current,l,i),o$=u,Y(0,!1),sh&&"function"==typeof sh.onPostCommitFiberRoot)try{sh.onPostCommitFiberRoot(sc,o)}catch(e){}s=!0}return s}finally{rL(r),ro.T=n,iM(e,t)}}return!1}function iT(e,t,n){t=A(n,t),t=tB(e.stateNode,t,2),null!==(e=ea(e,t,2))&&(M(e,2),q(e))}function iE(e,t,n){if(3===e.tag)iT(e,e,n);else for(;null!==t;){if(3===t.tag){iT(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===lr||!lr.has(i))){e=A(n,e),null!==(i=ea(t,n=tk(2),2))&&(tz(n,i,t,e),M(i,2),q(i));break}}t=t.return}}function iA(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new oj;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(o0=!0,r.add(n),e=iC.bind(null,e,t,n),t.then(e,e))}function iC(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,oX===e&&(oY&n)===n&&(4===o2||3===o2&&(0x3c00000&oY)===oY&&300>sa()-lt?0==(2&o$)&&iu(e,0):o5|=n,o8===oY&&(o8=0)),q(e)}function iR(e,t){0===t&&(t=b()),null!==(e=j(e,t))&&(M(e,t),q(e))}function iP(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),iR(e,n)}function iI(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,r=e.memoizedState;null!==r&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==i&&i.delete(t),iR(e,n)}function iL(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function iN(e){return!(!(e=e.prototype)||!e.isReactComponent)}function iD(e,t){var i=e.alternate;return null===i?((i=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=0x1e00000&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function iU(e,t){e.flags&=0x1e00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function iO(e,t,i,r,s,o){var l=0;if(r=e,"function"==typeof e)iN(e)&&(l=1);else if("string"==typeof e)l=aF&&aZ?aB(e,i,sM.current)?26:a2(e)?27:5:aF?aB(e,i,sM.current)?26:5:aZ&&a2(e)?27:5;else e:switch(e){case i0:return iF(i.children,s,o,t);case i1:l=8,s|=24;break;case i2:return(e=n(12,i,t,2|s)).elementType=i2,e.lanes=o,e;case i8:return(e=n(13,i,t,s)).elementType=i8,e.lanes=o,e;case i9:return(e=n(19,i,t,s)).elementType=i9,e.lanes=o,e;case rt:return iB(i,s,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case i3:case i5:l=10;break e;case i4:l=9;break e;case i6:l=11;break e;case i7:l=14;break e;case re:l=16,r=null;break e}l=29,i=Error(a(130,null===e?"null":typeof e,"")),r=null}return(t=n(l,i,t,s)).elementType=e,t.type=r,t.lanes=o,t}function iF(e,t,i,r){return(e=n(7,e,r,t)).lanes=i,e}function iB(e,t,i,r){(e=n(22,e,r,t)).elementType=rt,e.lanes=i;var s={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0==(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility|=2,it(t,e,2))}},attach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0!=(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility&=-3,it(t,e,2))}}};return e.stateNode=s,e}function ik(e,t,i){return(e=n(6,e,null,t)).lanes=i,e}function iz(e,t,i){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iV(e,t,n,i,r,a,s,o){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=rT,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function iH(e,t,i,r,a,s,o,l,u,c,h,d){return e=new iV(e,t,i,o,l,u,c,d),t=1,!0===s&&(t|=24),s=n(3,null,null,t),e.current=s,s.stateNode=e,t=nc(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:r,isDehydrated:i,cache:t},en(s),e}function iG(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw Error(a(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:rp(e.stateNode)}function iW(e,t,n,i,r,a){r=r?a5:a5,null===i.context?i.context=r:i.pendingContext=r,(i=er(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(i.callback=a),null!==(n=ea(e,i,t))&&(it(n,e,t),es(n,e,t))}function ij(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n>>=0)?32:31-(a8(e)/a9|0)|0},a8=Math.log,a9=Math.LN2,a7=128,se=4194304,st=iY.unstable_scheduleCallback,sn=iY.unstable_cancelCallback,si=iY.unstable_shouldYield,sr=iY.unstable_requestPaint,sa=iY.unstable_now,ss=iY.unstable_ImmediatePriority,so=iY.unstable_UserBlockingPriority,sl=iY.unstable_NormalPriority,su=iY.unstable_IdlePriority,sc=(iY.log,iY.unstable_setDisableYieldValue,null),sh=null,sd="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sp=new WeakMap,sf=[],sm=0,sg=null,sv=0,s_=[],sy=0,sx=null,sb=1,sS="",sM=f(null),sw=f(null),sT=f(null),sE=f(null),sA=null,sC=null,sR=!1,sP=null,sI=!1,sL=Error(a(519)),sN=[],sD=0,sU=0,sO=null,sF=null,sB=!1,sk=!1,sz=!1,sV=0,sH=null,sG=0,sW=0,sj=null,s$=!1,sX=!1,sq=Object.prototype.hasOwnProperty,sY=Error(a(460)),sJ=Error(a(474)),sZ={then:function(){}},sK=null,sQ=null,s0=0,s1=eb(!0),s2=eb(!1),s3=f(null),s4=f(0),s5=f(null),s6=null,s8=f(0),s9=0,s7=null,oe=null,ot=null,on=!1,oi=!1,or=!1,oa=0,os=0,oo=null,ol=0,ou=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},oc={readContext:no,use:eH,useCallback:eP,useContext:eP,useEffect:eP,useImperativeHandle:eP,useLayoutEffect:eP,useInsertionEffect:eP,useMemo:eP,useReducer:eP,useRef:eP,useState:eP,useDebugValue:eP,useDeferredValue:eP,useTransition:eP,useSyncExternalStore:eP,useId:eP};oc.useCacheRefresh=eP,oc.useMemoCache=eP,oc.useHostTransitionStatus=eP,oc.useFormState=eP,oc.useActionState=eP,oc.useOptimistic=eP;var oh={readContext:no,use:eH,useCallback:function(e,t){return ek().memoizedState=[e,void 0===t?null:t],e},useContext:no,useEffect:tl,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ts(4194308,4,td.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=ek();t=void 0===t?null:t;var i=e();return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=ek();if(void 0!==n)var r=n(t);else r=t;return i.memoizedState=i.baseState=r,i.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},e=e.dispatch=tT.bind(null,s7,e),[i.memoizedState,e]},useRef:function(e){return ek().memoizedState={current:e}},useState:function(e){var t=(e=e0(e)).queue,n=tE.bind(null,s7,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tf,useDeferredValue:function(e,t){return tv(ek(),e,t)},useTransition:function(){var e=e0(!1);return e=ty.bind(null,s7,e.queue,!0,!1),ek().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=s7,r=ek();if(sR){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===oX)throw Error(a(349));0!=(60&oY)||eY(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,tl(eZ.bind(null,i,s,e),[e]),i.flags|=2048,tr(9,eJ.bind(null,i,s,n,t),{destroy:void 0},null),n},useId:function(){var e=ek(),t=oX.identifierPrefix;if(sR){var n=sS,i=sb;t=":"+t+"R"+(n=(i&~(1<<32-a6(i)-1)).toString(32)+n),0<(n=oa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ol++).toString(32)+":";return e.memoizedState=t},useCacheRefresh:function(){return ek().memoizedState=tw.bind(null,s7)}};oh.useMemoCache=eG,oh.useHostTransitionStatus=tb,oh.useFormState=e7,oh.useActionState=e7,oh.useOptimistic=function(e){var t=ek();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tC.bind(null,s7,!0,n),n.dispatch=t,[e,t]};var od={readContext:no,use:eH,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:ej,useRef:ta,useState:function(){return ej(eW)},useDebugValue:tf,useDeferredValue:function(e,t){return t_(ez(),oe.memoizedState,e,t)},useTransition:function(){var e=ej(eW)[0],t=ez().memoizedState;return["boolean"==typeof e?e:eV(e),t]},useSyncExternalStore:eq,useId:tS};od.useCacheRefresh=tM,od.useMemoCache=eG,od.useHostTransitionStatus=tb,od.useFormState=te,od.useActionState=te,od.useOptimistic=function(e,t){return e1(ez(),oe,e,t)};var op={readContext:no,use:eH,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:eX,useRef:ta,useState:function(){return eX(eW)},useDebugValue:tf,useDeferredValue:function(e,t){var n=ez();return null===oe?tv(n,e,t):t_(n,oe.memoizedState,e,t)},useTransition:function(){var e=eX(eW)[0],t=ez().memoizedState;return["boolean"==typeof e?e:eV(e),t]},useSyncExternalStore:eq,useId:tS};op.useCacheRefresh=tM,op.useMemoCache=eG,op.useHostTransitionStatus=tb,op.useFormState=ti,op.useActionState=ti,op.useOptimistic=function(e,t){var n=ez();return null!==oe?e1(n,oe,e,t):(n.baseState=e,[e,n.queue.dispatch])};var of={isMounted:function(e){return!!(e=e._reactInternals)&&h(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var i=n7(),r=er(i);r.payload=t,null!=n&&(r.callback=n),null!==(t=ea(e,r,i))&&(it(t,e,i),es(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=n7(),r=er(i);r.tag=1,r.payload=t,null!=n&&(r.callback=n),null!==(t=ea(e,r,i))&&(it(t,e,i),es(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=n7(),i=er(n);i.tag=2,null!=t&&(i.callback=t),null!==(t=ea(e,i,n))&&(it(t,e,n),es(t,e,n))}},om="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=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(t))return}else if("object"==typeof i.default&&"function"==typeof i.default.emit)return void i.default.emit("uncaughtException",e);console.error(e)},og=Error(a(461)),ov=!1,o_={dehydrated:null,treeContext:null,retryLane:0},oy=f(null),ox=null,ob=null,oS="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oM=iY.unstable_scheduleCallback,ow=iY.unstable_NormalPriority,oT={$$typeof:i5,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},oE=ro.S;ro.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===sH){var n=sH=[];sG=0,sW=ee(),sj={status:"pending",value:void 0,then:function(e){n.push(e)}}}sG++,t.then(et,et)}(0,t),null!==oE&&oE(e,t)};var oA=f(null),oC=!1,oR=!1,oP=!1,oI="function"==typeof WeakSet?WeakSet:Set,oL=null,oN=!1,oD=null,oU=!1,oO=null,oF=8192,oB={getCacheForType:function(e){var t=no(oT),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},ok=0,oz=1,oV=2,oH=3,oG=4;if("function"==typeof Symbol&&Symbol.for){var oW=Symbol.for;ok=oW("selector.component"),oz=oW("selector.has_pseudo_class"),oV=oW("selector.role"),oH=oW("selector.test_id"),oG=oW("selector.text")}var oj="function"==typeof WeakMap?WeakMap:Map,o$=0,oX=null,oq=null,oY=0,oJ=0,oZ=null,oK=!1,oQ=!1,o0=!1,o1=0,o2=0,o3=0,o4=0,o5=0,o6=0,o8=0,o9=null,o7=null,le=!1,lt=0,ln=1/0,li=null,lr=null,la=!1,ls=null,lo=0,ll=0,lu=null,lc=0,lh=null;return iX.attemptContinuousHydration=function(e){if(13===e.tag){var t=j(e,0x4000000);null!==t&&it(t,e,0x4000000),i$(e,0x4000000)}},iX.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=n7(),n=j(e,t);null!==n&&it(n,e,t),i$(e,t)}},iX.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=v(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-a6(t);e.entanglements[1]|=n,t&=~n}q(e),0==(6&o$)&&(ln=sa()+500,Y(0,!1))}}break;case 13:null!==(t=j(e,2))&&it(t,e,2),io(),i$(e,2)}},iX.batchedUpdates=function(e,t){return e(t)},iX.createComponentSelector=function(e){return{$$typeof:ok,value:e}},iX.createContainer=function(e,t,n,i,r,a,s,o,l,u){return iH(e,t,!1,null,n,i,a,s,o,l,u,null)},iX.createHasPseudoClassSelector=function(e){return{$$typeof:oz,value:e}},iX.createHydrationContainer=function(e,t,n,i,r,a,s,o,l,u,c,h,d){var p;return(e=iH(n,i,!0,e,r,a,o,l,u,c,h,d)).context=(p=null,a5),n=e.current,(r=er(i=n7())).callback=null!=t?t:null,ea(n,r,i),e.current.lanes=i,M(e,i),q(e),e},iX.createPortal=function(e,t,n){var i=3=c&&s>=d&&r<=h&&o<=p){e.splice(t,1);break}if(i!==c||n.width!==u.width||po){if(!(s!==d||n.height!==u.height||hr)){c>i&&(u.width+=c-i,u.x=i),hs&&(u.height+=d-s,u.y=s),pn&&(n=l)),l ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},iX.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return rp(e.child.stateNode);default:return e.child.stateNode}},iX.injectIntoDevTools=function(){var e={bundleType:0,version:rc,rendererPackageName:rh,currentDispatcherRef:ro,findFiberByHostInstance:rP,reconcilerVersion:"19.0.0"};if(null!==rd&&(e.rendererConfig=rd),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sc=t.inject(e),sh=t}catch(e){}e=!!t.checkDCE}}return e},iX.isAlreadyRendering=function(){return!1},iX.observeVisibleRects=function(e,t,n,i){if(!rX)throw Error(a(363));var r=r0(e=n9(e,t),n,i).disconnect;return{disconnect:function(){r()}}},iX.shouldError=function(){return null},iX.shouldSuspend=function(){return!1},iX.startHostTransition=function(e,t,n,i){if(5!==e.tag)throw Error(a(476));var s=tx(e).queue;ty(e,s,t,rH,null===n?r:function(){var t=tx(e).next.queue;return tA(e,t,{},n7()),n(i)})},iX.updateContainer=function(e,t,n,i){var r=t.current,a=n7();return iW(r,a,e,t,n,i),a},iX.updateContainerSync=function(e,t,n,i){return 0===t.tag&&iw(),iW(t.current,2,e,t,n,i),2},iX},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})},98133,(e,t,n)=>{"use strict";t.exports=e.r(40336)},45015,(e,t,n)=>{"use strict";function i(e,t){var n=e.length;for(e.push(t);0>>1,r=e[i];if(0>>1;is(l,n))us(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else if(us(c,n))e[i]=c,e[u]=n,i=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,_=!1,y="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=r(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,i(h,t);else break;t=r(d)}}function M(e){if(_=!1,S(e),!v)if(null!==r(h))v=!0,L();else{var t=r(d);null!==t&&N(M,t.startTime-e)}}var w=!1,T=-1,E=5,A=-1;function C(){return!(n.unstable_now()-Ae&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===r(h)&&a(h),S(e)}else a(h);f=r(h)}if(null!==f)t=!0;else{var u=r(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=i,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){y(R,0)};function L(){w||(w=!0,o())}function N(e,t){T=y(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,i(d,e),null===r(h)&&e===r(d)&&(_?(x(T),T=-1):_=!0,N(M,a-s))):(e.sortIndex=o,i(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},95087,(e,t,n)=>{"use strict";t.exports=e.r(45015)},91037,90072,8560,8155,46791,e=>{"use strict";let t,n,i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,_;var y,x,b,S=e.i(71645),M=e.i(39695);let w={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},T={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},E="attached",A="detached",C="srgb",R="srgb-linear",P="linear",I="srgb",L="300 es",N={COMPUTE:"compute",RENDER:"render"},D={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},U={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function O(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let F={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function B(e,t){return new F[e](t)}function k(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function z(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function V(){let e=z("canvas");return e.style.display="block",e}let H={},G=null;function W(e){G=e}function j(){return G}function $(...e){let t="THREE."+e.shift();G?G("log",t,...e):console.log(t,...e)}function X(...e){let t="THREE."+e.shift();G?G("warn",t,...e):console.warn(t,...e)}function q(...e){let t="THREE."+e.shift();G?G("error",t,...e):console.error(t,...e)}function Y(...e){let t=e.join(" ");t in H||(H[t]=!0,X(...e))}function J(e,t,n){return new Promise(function(i,r){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}},n)})}class Z{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let i=n[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,i=t.length;n>8&255]+K[e>>16&255]+K[e>>24&255]+"-"+K[255&t]+K[t>>8&255]+"-"+K[t>>16&15|64]+K[t>>24&255]+"-"+K[63&n|128]+K[n>>8&255]+"-"+K[n>>16&255]+K[n>>24&255]+K[255&i]+K[i>>8&255]+K[i>>16&255]+K[i>>24&255]).toLowerCase()}function ei(e,t,n){return Math.max(t,Math.min(n,e))}function er(e,t){return(e%t+t)%t}function ea(e,t,n){return(1-n)*e+n*t}function es(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function eo(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let el={DEG2RAD:ee,RAD2DEG:et,generateUUID:en,clamp:ei,euclideanModulo:er,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:ea,damp:function(e,t,n,i){return ea(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(er(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(Q=e);let t=Q+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*ee},radToDeg:function(e){return e*et},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+i)/2),c=s((t+i)/2),h=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:X("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:eo,denormalize:es};class eu{constructor(e=0,t=0){eu.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ei(this.x,e.x,t.x),this.y=ei(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ei(this.x,e,t),this.y=ei(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ei(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ei(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ec{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(s<=0){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(s>=1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=o*h+l*d+u*p+c*f;e<0&&(h=-h,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let n=Math.acos(e),i=Math.sin(n);o=o*(t=Math.sin(t*n)/i)+h*(s=Math.sin(s*n)/i),l=l*t+d*s,u=u*t+p*s,c=c*t+f*s}else{let e=1/Math.sqrt((o=o*t+h*s)*o+(l=l*t+d*s)*l+(u=u*t+p*s)*u+(c=c*t+f*s)*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,a){let s=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:X("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ei(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+i*l-r*o,this._y=i*u+a*o+r*s-n*l,this._z=r*u+a*l+n*o-i*s,this._w=a*u-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(n=-n,i=-i,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class eh{constructor(e=0,t=0,n=0){eh.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ep.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ep.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),u=2*(s*t-r*i),c=2*(r*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-r*c,this.z=i+o*c+r*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ei(this.x,e.x,t.x),this.y=ei(this.y,e.y,t.y),this.z=ei(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ei(this.x,e,t),this.y=ei(this.y,e,t),this.z=ei(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ei(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ed.copy(this).projectOnVector(e),this.sub(ed)}reflect(e){return this.sub(ed.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ei(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ed=new eh,ep=new ec;class ef{constructor(e,t,n,i,r,a,s,o,l){ef.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],S=i[8];return r[0]=a*f+s*v+o*x,r[3]=a*m+s*_+o*b,r[6]=a*g+s*y+o*S,r[1]=l*f+u*v+c*x,r[4]=l*m+u*_+c*b,r[7]=l*g+u*y+c*S,r[2]=h*f+d*v+p*x,r[5]=h*m+d*_+p*b,r[8]=h*g+d*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*r*u+n*s*o+i*r*l-i*a*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*r,d=l*r-a*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(i*l-u*n)*f,e[2]=(s*n-i*a)*f,e[3]=h*f,e[4]=(u*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(em.makeScale(e,t)),this}rotate(e){return this.premultiply(em.makeRotation(-e)),this}translate(e,t){return this.premultiply(em.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let em=new ef,eg=new ef().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ev=new ef().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),e_=(d=[.64,.33,.3,.6,.15,.06],p=[.2126,.7152,.0722],f=[.3127,.329],(h={enabled:!0,workingColorSpace:R,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===I&&(e.r=ey(e.r),e.g=ey(e.g),e.b=ey(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===I&&(e.r=ex(e.r),e.g=ex(e.g),e.b=ex(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?P:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return Y("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),h.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return Y("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),h.colorSpaceToWorking(e,t)}}).define({[R]:{primaries:d,whitePoint:f,transfer:P,toXYZ:eg,fromXYZ:ev,luminanceCoefficients:p,workingColorSpaceConfig:{unpackColorSpace:C},outputColorSpaceConfig:{drawingBufferColorSpace:C}},[C]:{primaries:d,whitePoint:f,transfer:I,toXYZ:eg,fromXYZ:ev,luminanceCoefficients:p,outputColorSpaceConfig:{drawingBufferColorSpace:C}}}),h);function ey(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ex(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eb{static getDataURL(e,n="image/png"){let i;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=z("canvas")),t.width=e.width,t.height=e.height;let n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=t}return i.toDataURL(n)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=z("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1,this.pmremVersion=0}get width(){return this.source.getSize(eE).x}get height(){return this.source.getSize(eE).y}get depth(){return this.source.getSize(eE).z}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){X(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){X(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}eA.DEFAULT_IMAGE=null,eA.DEFAULT_MAPPING=300,eA.DEFAULT_ANISOTROPY=1;class eC{constructor(e=0,t=0,n=0,i=1){eC.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,_=(h+p)/4;return e>a&&e>m?e<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(e)),r=v/n):a>m?a<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(a)),r=_/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=v/(r=Math.sqrt(m)),i=_/r),this.set(n,i,r,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ei(this.x,e.x,t.x),this.y=ei(this.y,e.y,t.y),this.z=ei(this.z,e.z,t.z),this.w=ei(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ei(this.x,e,t),this.y=ei(this.y,e,t),this.z=ei(this.z,e,t),this.w=ei(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ei(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class eR extends Z{constructor(e=1,t=1,n={}){super(),n=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},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new eC(0,0,e,t),this.scissorTest=!1,this.viewport=new eC(0,0,e,t);const i=new eA({width:e,height:t,depth:n.depth});this.textures=[];const r=n.count;for(let e=0;e1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,eF),eF.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ej),e$.subVectors(this.max,ej),ek.subVectors(e.a,ej),ez.subVectors(e.b,ej),eV.subVectors(e.c,ej),eH.subVectors(ez,ek),eG.subVectors(eV,ez),eW.subVectors(ek,eV);let t=[0,-eH.z,eH.y,0,-eG.z,eG.y,0,-eW.z,eW.y,eH.z,0,-eH.x,eG.z,0,-eG.x,eW.z,0,-eW.x,-eH.y,eH.x,0,-eG.y,eG.x,0,-eW.y,eW.x,0];return!!eY(t,ek,ez,eV,e$)&&!!eY(t=[1,0,0,0,1,0,0,0,1],ek,ez,eV,e$)&&(eX.crossVectors(eH,eG),eY(t=[eX.x,eX.y,eX.z],ek,ez,eV,e$))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,eF).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(eF).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(eO[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),eO[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),eO[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),eO[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),eO[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),eO[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),eO[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),eO[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(eO)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let eO=[new eh,new eh,new eh,new eh,new eh,new eh,new eh,new eh],eF=new eh,eB=new eU,ek=new eh,ez=new eh,eV=new eh,eH=new eh,eG=new eh,eW=new eh,ej=new eh,e$=new eh,eX=new eh,eq=new eh;function eY(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){eq.fromArray(e,a);let s=r.x*Math.abs(eq.x)+r.y*Math.abs(eq.y)+r.z*Math.abs(eq.z),o=t.dot(eq),l=n.dot(eq),u=i.dot(eq);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let eJ=new eU,eZ=new eh,eK=new eh;class eQ{constructor(e=new eh,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):eJ.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;eZ.subVectors(e,this.center);let t=eZ.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(eZ,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(eK.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(eZ.copy(e.center).add(eK)),this.expandByPoint(eZ.copy(e.center).sub(eK)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let e0=new eh,e1=new eh,e2=new eh,e3=new eh,e4=new eh,e5=new eh,e6=new eh;class e8{constructor(e=new eh,t=new eh(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,e0)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=e0.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(e0.copy(this.origin).addScaledVector(this.direction,t),e0.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){let r,a,s,o;e1.copy(e).add(t).multiplyScalar(.5),e2.copy(t).sub(e).normalize(),e3.copy(this.origin).sub(e1);let l=.5*e.distanceTo(t),u=-this.direction.dot(e2),c=e3.dot(this.direction),h=-e3.dot(e2),d=e3.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(r=u*h-c,a=u*c-h,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+u*a+2*c)+a*(u*r+a+2*h)+d}else s=-(r=Math.max(0,-(u*(a=l)+c)))*r+a*(a+2*h)+d;else s=-(r=Math.max(0,-(u*(a=-l)+c)))*r+a*(a+2*h)+d;else a<=-o?(a=(r=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(r=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d);else a=u>0?-l:l,s=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(e1).addScaledVector(e2,a),s}intersectSphere(e,t){e0.subVectors(e.center,this.origin);let n=e0.dot(this.direction),i=e0.dot(e0)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,i,r,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>i||((s>n||n!=n)&&(n=s),(o=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,e0)}intersectTriangle(e,t,n,i,r){let a;e4.subVectors(t,e),e5.subVectors(n,e),e6.crossVectors(e4,e5);let s=this.direction.dot(e6);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}e3.subVectors(this.origin,e);let o=a*this.direction.dot(e5.crossVectors(e3,e5));if(o<0)return null;let l=a*this.direction.dot(e4.cross(e3));if(l<0||o+l>s)return null;let u=-a*e3.dot(e6);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class e9{constructor(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){e9.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 e9().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2)),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,n=e.elements,i=1/e7.setFromMatrixColumn(e,0).length(),r=1/e7.setFromMatrixColumn(e,1).length(),a=1/e7.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*u,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=a*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=s*u,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(tt,e,tn)}lookAt(e,t,n){let i=this.elements;return ta.subVectors(e,t),0===ta.lengthSq()&&(ta.z=1),ta.normalize(),ti.crossVectors(n,ta),0===ti.lengthSq()&&(1===Math.abs(n.z)?ta.x+=1e-4:ta.z+=1e-4,ta.normalize(),ti.crossVectors(n,ta)),ti.normalize(),tr.crossVectors(ta,ti),i[0]=ti.x,i[4]=tr.x,i[8]=ta.x,i[1]=ti.y,i[5]=tr.y,i[9]=ta.y,i[2]=ti.z,i[6]=tr.z,i[10]=ta.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],y=n[11],x=n[15],b=i[0],S=i[4],M=i[8],w=i[12],T=i[1],E=i[5],A=i[9],C=i[13],R=i[2],P=i[6],I=i[10],L=i[14],N=i[3],D=i[7],U=i[11],O=i[15];return r[0]=a*b+s*T+o*R+l*N,r[4]=a*S+s*E+o*P+l*D,r[8]=a*M+s*A+o*I+l*U,r[12]=a*w+s*C+o*L+l*O,r[1]=u*b+c*T+h*R+d*N,r[5]=u*S+c*E+h*P+d*D,r[9]=u*M+c*A+h*I+d*U,r[13]=u*w+c*C+h*L+d*O,r[2]=p*b+f*T+m*R+g*N,r[6]=p*S+f*E+m*P+g*D,r[10]=p*M+f*A+m*I+g*U,r[14]=p*w+f*C+m*L+g*O,r[3]=v*b+_*T+y*R+x*N,r[7]=v*S+_*E+y*P+x*D,r[11]=v*M+_*A+y*I+x*U,r[15]=v*w+_*C+y*L+x*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*d-l*h,_=s*d-l*c,y=s*h-o*c,x=a*d-l*u,b=a*h-o*u,S=a*c-s*u;return t*(f*v-m*_+g*y)-n*(p*v-m*x+g*b)+i*(p*_-f*x+g*S)-r*(p*y-f*b+m*S)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,_=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,y=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,x=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*_+i*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return e[0]=v*S,e[1]=(f*h*r-c*m*r-f*i*d+n*m*d+c*i*g-n*h*g)*S,e[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*S,e[3]=(c*o*r-s*h*r-c*i*l+n*h*l+s*i*d-n*o*d)*S,e[4]=_*S,e[5]=(u*m*r-p*h*r+p*i*d-t*m*d-u*i*g+t*h*g)*S,e[6]=(p*o*r-a*m*r-p*i*l+t*m*l+a*i*g-t*o*g)*S,e[7]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*d+t*o*d)*S,e[8]=y*S,e[9]=(p*c*r-u*f*r-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*r-p*s*r+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*r-a*c*r-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=x*S,e[13]=(u*f*i-p*c*i+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*i-a*f*i-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*i-u*s*i+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,u=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+n,u*o-i*a,0,l*o-i*s,u*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,u=a+a,c=s+s,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,g=s*c,v=o*l,_=o*u,y=o*c,x=n.x,b=n.y,S=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*S,i[9]=(m-v)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],0===this.determinant())return n.set(1,1,1),t.identity(),this;let r=e7.set(i[0],i[1],i[2]).length(),a=e7.set(i[4],i[5],i[6]).length(),s=e7.set(i[8],i[9],i[10]).length();0>this.determinant()&&(r=-r),te.copy(this);let o=1/r,l=1/a,u=1/s;return te.elements[0]*=o,te.elements[1]*=o,te.elements[2]*=o,te.elements[4]*=l,te.elements[5]*=l,te.elements[6]*=l,te.elements[8]*=u,te.elements[9]*=u,te.elements[10]*=u,t.setFromRotationMatrix(te),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=r/(a-r),u=a*r/(a-r);else if(2e3===s)l=-(a+r)/(a-r),u=-2*a*r/(a-r);else if(2001===s)l=-a/(a-r),u=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(n-i),c[9]=(n+i)/(n-i),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=1/(a-r),u=a/(a-r);else if(2e3===s)l=-2/(a-r),u=-(a+r)/(a-r);else if(2001===s)l=-1/(a-r),u=-r/(a-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-i),c[9]=0,c[13]=-(n+i)/(n-i),c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}let e7=new eh,te=new e9,tt=new eh(0,0,0),tn=new eh(1,1,1),ti=new eh,tr=new eh,ta=new eh,ts=new e9,to=new ec;class tl{constructor(e=0,t=0,n=0,i=tl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(ei(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ei(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(ei(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ei(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ei(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-ei(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:X("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ts.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ts,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return to.setFromEuler(this),this.setFromQuaternion(to,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tl.DEFAULT_ORDER="XYZ";class tu{constructor(){this.mask=1}set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function a(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){tE.subVectors(i,t),tA.subVectors(n,t),tC.subVectors(e,t);let a=tE.dot(tE),s=tE.dot(tA),o=tE.dot(tC),l=tA.dot(tA),u=tA.dot(tC),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,tR)&&tR.x>=0&&tR.y>=0&&tR.x+tR.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,tR)?(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,tR.x),o.addScaledVector(a,tR.y),o.addScaledVector(s,tR.z),o)}static getInterpolatedAttribute(e,t,n,i,r,a){return tO.setScalar(0),tF.setScalar(0),tB.setScalar(0),tO.fromBufferAttribute(e,t),tF.fromBufferAttribute(e,n),tB.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(tO,r.x),a.addScaledVector(tF,r.y),a.addScaledVector(tB,r.z),a}static isFrontFacing(e,t,n,i){return tE.subVectors(n,t),tA.subVectors(e,t),0>tE.cross(tA).dot(i)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return tE.subVectors(this.c,this.b),tA.subVectors(this.a,this.b),.5*tE.cross(tA).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tk.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tk.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return tk.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return tk.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tk.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,i,r=this.a,a=this.b,s=this.c;tP.subVectors(a,r),tI.subVectors(s,r),tN.subVectors(e,r);let o=tP.dot(tN),l=tI.dot(tN);if(o<=0&&l<=0)return t.copy(r);tD.subVectors(e,a);let u=tP.dot(tD),c=tI.dot(tD);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(r).addScaledVector(tP,n);tU.subVectors(e,s);let d=tP.dot(tU),p=tI.dot(tU);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(tI,i);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return tL.subVectors(s,a),i=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(tL,i);let g=1/(m+f+h);return n=f*g,i=h*g,t.copy(r).addScaledVector(tP,n).addScaledVector(tI,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let tz={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},tV={h:0,s:0,l:0},tH={h:0,s:0,l:0};function tG(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class tW{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=C){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,e_.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=e_.workingColorSpace){return this.r=e,this.g=t,this.b=n,e_.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=e_.workingColorSpace){if(e=er(e,1),t=ei(t,0,1),n=ei(n,0,1),0===t)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=tG(r,i,e+1/3),this.g=tG(r,i,e),this.b=tG(r,i,e-1/3)}return e_.colorSpaceToWorking(this,i),this}setStyle(e,t=C){let n;function i(t){void 0!==t&&1>parseFloat(t)&&X("Color: Alpha component of "+e+" will be ignored.")}if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(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,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(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,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:X("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(i,16),t);X("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=C){let n=tz[e.toLowerCase()];return void 0!==n?this.setHex(n,t):X("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ey(e.r),this.g=ey(e.g),this.b=ey(e.b),this}copyLinearToSRGB(e){return this.r=ex(e.r),this.g=ex(e.g),this.b=ex(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=C){return e_.workingToColorSpace(tj.copy(this),e),65536*Math.round(ei(255*tj.r,0,255))+256*Math.round(ei(255*tj.g,0,255))+Math.round(ei(255*tj.b,0,255))}getHexString(e=C){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=e_.workingColorSpace){let n,i;e_.workingToColorSpace(tj.copy(this),t);let r=tj.r,a=tj.g,s=tj.b,o=Math.max(r,a,s),l=Math.min(r,a,s),u=(l+o)/2;if(l===o)n=0,i=0;else{let e=o-l;switch(i=u<=.5?e/(o+l):e/(2-o-l),o){case r:n=(a-s)/e+6*(a0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){X(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){X(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),100!==this.blendEquation&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(n.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(n.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class tq extends tX{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tW(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 tl,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let tY=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();function tJ(e){Math.abs(e)>65504&&X("DataUtils.toHalfFloat(): Value out of range."),e=ei(e,-65504,65504),tY.floatView[0]=e;let t=tY.uint32View[0],n=t>>23&511;return tY.baseTable[n]+((8388607&t)>>tY.shiftTable[n])}function tZ(e){let t=e>>10;return tY.uint32View[0]=tY.mantissaTable[tY.offsetTable[t]+(1023&e)]+tY.exponentTable[t],tY.floatView[0]}class tK{static toHalfFloat(e){return tJ(e)}static fromHalfFloat(e){return tZ(e)}}let tQ=new eh,t0=new eu,t1=0;class t2{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:t1++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;it.count&&X("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new eU);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){q("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new eh(-1/0,-1/0,-1/0),new eh(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let i=n[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},r=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let i=e.attributes;for(let e in i){let n=i[e];this.setAttribute(e,n.clone(t))}let r=e.morphAttributes;for(let e in r){let n=[],i=r[e];for(let e=0,r=i.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)||(nc.copy(r).invert(),nh.copy(e.ray).applyMatrix4(nc),(null===n.boundingBox||!1!==nh.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,nh)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=h.length;rn.far?null:{distance:l,point:nx.clone(),object:e}}(e,t,n,i,nf,nm,ng,ny);if(c){let e=new eh;tk.getBarycoord(ny,nf,nm,ng,e),r&&(c.uv=tk.getInterpolatedAttribute(r,o,l,u,e,new eu)),a&&(c.uv1=tk.getInterpolatedAttribute(a,o,l,u,e,new eu)),s&&(c.normal=tk.getInterpolatedAttribute(s,o,l,u,e,new eh),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new eh,materialIndex:0};tk.getNormal(nf,nm,ng,t.normal),c.face=t,c.barycoord=e}return c}class nM extends nu{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){let _=a/m,y=p/g,x=a/2,b=p/2,S=f/2,M=m+1,w=g+1,T=0,E=0,A=new eh;for(let a=0;a0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class nR extends tT{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new e9,this.projectionMatrix=new e9,this.projectionMatrixInverse=new e9,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let nP=new eh,nI=new eu,nL=new eu;class nN extends nR{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*et*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*ee*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*et*Math.atan(Math.tan(.5*ee*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){nP.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(nP.x,nP.y).multiplyScalar(-e/nP.z),nP.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(nP.x,nP.y).multiplyScalar(-e/nP.z)}getViewSize(e,t){return this.getViewBounds(e,nI,nL),t.subVectors(nL,nI)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*ee*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class nD extends tT{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new nN(-90,1,e,t);i.layers=this.layers,this.add(i);const r=new nN(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new nN(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new nN(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new nN(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new nN(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class nU extends eA{constructor(e=[],t=301,n,i,r,a,s,o,l,u){super(e,t,n,i,r,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class nO extends eP{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1};this.texture=new nU([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={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 ); - - } - `},i=new nM(5,5,5),r=new nC({name:"CubemapFromEquirect",uniforms:nw(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new nb(i,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new nD(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}class nF extends tT{constructor(){super(),this.isGroup=!0,this.type="Group"}}let nB={type:"move"};class nk{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nF,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 nF,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new eh,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new eh),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nF,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new eh,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new eh),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let i of(a=!0,e.hand.values())){let e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(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!==s&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(nB)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new nF;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class nz{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new tW(e),this.density=t}clone(){return new nz(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class nV{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new tW(e),this.near=t,this.far=n}clone(){return new nV(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class nH extends tT{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 tl,this.environmentIntensity=1,this.environmentRotation=new tl,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class nG{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=en()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:o,point:nX.clone(),uv:tk.getInterpolation(nX,nQ,n0,n1,n2,n3,n4,new eu),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function n6(e,t,n,i,r,a){nJ.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(nZ.x=a*nJ.x-r*nJ.y,nZ.y=r*nJ.x+a*nJ.y):nZ.copy(nJ),e.copy(t),e.x+=nZ.x,e.y+=nZ.y,e.applyMatrix4(nK)}let n8=new eh,n9=new eh;class n7 extends tT{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){n8.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(n8);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let n,i;n8.setFromMatrixPosition(e.matrixWorld),n9.setFromMatrixPosition(this.matrixWorld);let r=n8.distanceTo(n9)/e.zoom;for(n=1,t[0].object.visible=!0,i=t.length;n=e)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||iC.getNormalMatrix(e),i=this.coplanarPoint(iE).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let iP=new eQ,iI=new eu(.5,.5),iL=new eh;class iN{constructor(e=new iR,t=new iR,n=new iR,i=new iR,r=new iR,a=new iR){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){let i=this.planes,r=e.elements,a=r[0],s=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],v=r[12],_=r[13],y=r[14],x=r[15];if(i[0].setComponents(l-a,d-u,g-p,x-v).normalize(),i[1].setComponents(l+a,d+u,g+p,x+v).normalize(),i[2].setComponents(l+s,d+c,g+f,x+_).normalize(),i[3].setComponents(l-s,d-c,g-f,x-_).normalize(),n)i[4].setComponents(o,h,m,y).normalize(),i[5].setComponents(l-o,d-h,g-m,x-y).normalize();else if(i[4].setComponents(l-o,d-h,g-m,x-y).normalize(),2e3===t)i[5].setComponents(l+o,d+h,g+m,x+y).normalize();else if(2001===t)i[5].setComponents(o,h,m,y).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),iP.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),iP.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(iP)}intersectsSprite(e){return iP.center.set(0,0,0),iP.radius=.7071067811865476+iI.distanceTo(e.center),iP.applyMatrix4(e.matrixWorld),this.intersectsSphere(iP)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,iL.y=i.normal.y>0?e.max.y:e.min.y,iL.z=i.normal.z>0?e.max.z:e.min.z,0>i.distanceToPoint(iL))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}let iD=new e9,iU=new iN;class iO{constructor(){this.coordinateSystem=2e3}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let s=r[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=i}reset(){this.list.length=0,this.index=0}},iJ=new nb,iZ=[];function iK(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let i=0;i65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new t2(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new eU);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(iF),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let i=this._matricesTexture;iz.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;let r=this._colorsTexture;return r&&(iV.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){let i;this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===t?e.getAttribute("position").count:t;let s=e.getIndex();if(null!==s&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===n?s.count:n),-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(iF),a[i=this._availableGeometryIds.shift()]=r):(i=this._geometryCount,this._geometryCount++,a.push(r)),this.setGeometryAt(i,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,i}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(i&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,n.attributes){let i=t.getAttribute(e),r=n.getAttribute(e);!function(e,t,n=0){let i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let r=e.count;for(let a=0;a=t.length||!1===t[e].active)return this;let n=this._instanceInfo;for(let t=0,i=n.length;tt).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),r=this.geometry;for(let a=0,s=n.length;a=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){let e=new eU,t=n.index,r=n.attributes.position;for(let n=i.start,a=i.start+i.count;n=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){let t=new eQ;this.getBoundingBoxAt(e,iW),iW.getCenter(t.center);let r=n.index,a=n.attributes.position,s=0;for(let e=i.start,n=i.start+i.count;ee.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new nu,this._initializeGeometry(i));let r=this.geometry;for(let e in i.index&&iK(i.index.array,r.index.array),i.attributes)iK(i.attributes[e].array,r.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;iJ.material=this.material,iJ.geometry.index=a.index,iJ.geometry.attributes=a.attributes,null===iJ.geometry.boundingBox&&(iJ.geometry.boundingBox=new eU),null===iJ.geometry.boundingSphere&&(iJ.geometry.boundingSphere=new eQ);for(let a=0,s=n.length;a({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._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(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=i.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,c=this._geometryInfo,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,f=n.isArrayCamera?iG:iH;h&&!n.isArrayCamera&&(iz.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),iH.setFromProjectionMatrix(iz,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){iz.copy(this.matrixWorld).invert(),i$.setFromMatrixPosition(n.matrixWorld).applyMatrix4(iz),iX.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(iz);for(let e=0,t=o.length;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei)return;i6.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(i6);if(!(lt.far))return{distance:l,point:i8.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let re=new eh,rt=new eh;class rn extends i9{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class rh extends eA{constructor(e,t,n,i,r=1006,a=1006,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class rd extends rh{constructor(e,t,n,i,r,a,s,o){super({},e,t,n,i,r,a,s,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class rp extends eA{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class rf extends eA{constructor(e,t,n,i,r,a,s,o,l,u,c,h){super(null,a,s,o,l,u,i,r,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class rm extends rf{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class rg extends rf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class rv extends eA{constructor(e,t,n,i,r,a,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class r_ extends eA{constructor(e,t,n=1014,i,r,a,s=1003,o=1003,l,u=1026,c=1){if(1026!==u&&1027!==u)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},i,r,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new eM(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class ry extends r_{constructor(e,t=1014,n=301,i,r,a=1003,s=1003,o,l=1026){const u={width:e,height:e,depth:1};super(e,e,t,n,i,r,a,s,o,l),this.image=[u,u,u,u,u,u],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class rx extends eA{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class rb extends nu{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i));const a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+(r=Math.max(1,Math.floor(r))),f=i+1,m=new eh,g=new eh;for(let v=0;v<=p;v++){let _=0,y=0,x=0,b=0;if(v<=n){const t=v/n,i=t*Math.PI/2;y=-u-e*Math.cos(i),x=e*Math.sin(i),b=-e*Math.cos(i),_=t*c}else if(v<=n+r){const i=(v-n)/r;y=-u+i*t,x=e,b=0,_=c+i*h}else{const t=(v-n-r)/n,i=t*Math.PI/2;y=u+e*Math.sin(i),x=e*Math.cos(i),b=e*Math.sin(i),_=c+h+t*c}const S=Math.max(0,Math.min(1,_/d));let M=0;0===v?M=.5/i:v===p&&(M=-.5/i);for(let e=0;e<=i;e++){const t=e/i,n=t*Math.PI*2,r=Math.sin(n),a=Math.cos(n);g.x=-x*a,g.y=y,g.z=x*r,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*r),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+M,S)}if(v>0){const e=(v-1)*f;for(let t=0;t0||0!==i)&&(u.push(a,s,l),_+=3),(t>0||i!==r-1)&&(u.push(s,o,l),_+=3)}l.addGroup(g,_,0),g+=_})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new nt(c,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rM(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rw extends rM{constructor(e=1,t=1,n=32,i=1,r=!1,a=0,s=2*Math.PI){super(0,e,t,n,i,r,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(e){return new rw(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rT extends nu{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function s(e){r.push(e.x,e.y,e.z)}function o(t,n){let i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function l(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new eh,i=new eh,r=new eh;for(let a=0;a.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new nt(r,3)),this.setAttribute("normal",new nt(r.slice(),3)),this.setAttribute("uv",new nt(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rT(e.vertices,e.indices,e.radius,e.detail)}}class rE extends rT{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rE(e.radius,e.detail)}}let rA=new eh,rC=new eh,rR=new eh,rP=new tk;class rI extends nu{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=Math.cos(ee*t),i=e.getIndex(),r=e.getAttribute("position"),a=i?i.count:r.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},c=[];for(let e=0;e0)o=r-1;else{o=r;break}if(i[r=o]===n)return r/(a-1);let u=i[r],c=i[r+1];return(r+(n-u)/(c-u))/(a-1)}getTangent(e,t){let n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);let r=this.getPoint(n),a=this.getPoint(i),s=t||(r.isVector2?new eu:new eh);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new eh,i=[],r=[],a=[],s=new eh,o=new e9;for(let t=0;t<=e;t++){let n=t/e;i[t]=this.getTangentAt(n,new eh)}r[0]=new eh,a[0]=new eh;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),c=Math.abs(i[0].y),h=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(ei(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(ei(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class rN extends rL{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new eu){let n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,r=Math.abs(i)n;)i-=n;i0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?n=r[(o-1)%a]:(rO.subVectors(r[0],r[1]).add(r[0]),n=rO);let u=r[o%a],c=r[(o+1)%a];if(this.closed||o+2n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return t.set(rV(a,s.x,o.x,l.x,u.x),rV(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){let e=i[r]-n,a=this.curves[r],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class r0 extends rQ{constructor(e){super(e),this.uuid=en(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n0)for(let r=t;r=t;r-=i)a=ar(r/i|0,e[r],e[r+1],a);return a&&r9(a,a.next)&&(aa(a),a=a.next),a}function r2(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(r9(n,n.next)||0===r8(n.prev,n,n.next))){if(aa(n),(n=t=n.prev)===n.next)break;i=!0}else n=n.next;while(i||n!==t)return t}function r3(e,t){let n=e.x-t.x;return 0===n&&0==(n=e.y-t.y)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function r4(e,t,n,i,r){return(e=((e=((e=((e=((e=(e-n)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function r5(e,t,n,i,r,a,s,o){return(r-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(r-s)*(i-o)}function r6(e,t,n,i,r,a,s,o){return(e!==s||t!==o)&&r5(e,t,n,i,r,a,s,o)}function r8(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function r9(e,t){return e.x===t.x&&e.y===t.y}function r7(e,t,n,i){let r=at(r8(e,t,n)),a=at(r8(e,t,i)),s=at(r8(n,i,e)),o=at(r8(n,i,t));return!!(r!==a&&s!==o||0===r&&ae(e,n,t)||0===a&&ae(e,i,t)||0===s&&ae(n,e,i)||0===o&&ae(n,t,i))}function ae(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function at(e){return e>0?1:e<0?-1:0}function an(e,t){return 0>r8(e.prev,e,e.next)?r8(e,t,e.next)>=0&&r8(e,e.prev,t)>=0:0>r8(e,t,e.prev)||0>r8(e,e.next,t)}function ai(e,t){let n=as(e.i,e.x,e.y),i=as(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function ar(e,t,n,i){let r=as(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function aa(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function as(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ao{static triangulate(e,t,n=2){return function(e,t,n=2){let i,r,a,s=t&&t.length,o=s?t[0]*n:e.length,l=r1(e,0,o,n,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,n,i){let r=[];for(let n=0,a=t.length;n=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,n=i.x=i.x&&i.x>=l&&r!==i.x&&r5(an.x||i.x===n.x&&(h=n,d=i,0>r8(h.prev,h,d.prev)&&0>r8(d.next,h,h.next))))&&(n=i,c=t)}i=i.next}while(i!==o)return n}(e,t);if(!n)return t;let i=ai(n,e);return r2(i,i.next),r2(n,n.next)}(r[e],n);return n}(e,t,l,n)),e.length>80*n){i=e[0],r=e[1];let t=i,s=r;for(let a=n;at&&(t=n),o>s&&(s=o)}a=0!==(a=Math.max(t-i,s-r))?32767/a:0}return function e(t,n,i,r,a,s,o){if(!t)return;!o&&s&&function(e,t,n,i){let r=e;do 0===r.z&&(r.z=r4(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e)r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n=1;do{let i,r=e;e=null;let a=null;for(t=0;r;){t++;let s=r,o=0;for(let e=0;e0||l>0&&s;)0!==o&&(0===l||!s||r.z<=s.z)?(i=r,r=r.nextZ,o--):(i=s,s=s.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=s}a.nextZ=null,n*=2}while(t>1)}(r)}(t,r,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,c=t.next;if(s?function(e,t,n,i){let r=e.prev,a=e.next;if(r8(r,e,a)>=0)return!1;let s=r.x,o=e.x,l=a.x,u=r.y,c=e.y,h=a.y,d=Math.min(s,o,l),p=Math.min(u,c,h),f=Math.max(s,o,l),m=Math.max(u,c,h),g=r4(d,p,t,n,i),v=r4(f,m,t,n,i),_=e.prevZ,y=e.nextZ;for(;_&&_.z>=g&&y&&y.z<=v;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==a&&r6(s,u,o,c,l,h,_.x,_.y)&&r8(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==r&&y!==a&&r6(s,u,o,c,l,h,y.x,y.y)&&r8(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=g;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==a&&r6(s,u,o,c,l,h,_.x,_.y)&&r8(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=v;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==r&&y!==a&&r6(s,u,o,c,l,h,y.x,y.y)&&r8(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}(t,r,a,s):function(e){let t=e.prev,n=e.next;if(r8(t,e,n)>=0)return!1;let i=t.x,r=e.x,a=n.x,s=t.y,o=e.y,l=n.y,u=Math.min(i,r,a),c=Math.min(s,o,l),h=Math.max(i,r,a),d=Math.max(s,o,l),p=n.next;for(;p!==t;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&r6(i,s,r,o,a,l,p.x,p.y)&&r8(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(u.i,t.i,c.i),aa(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let n=e;do{let i=n.prev,r=n.next.next;!r9(i,r)&&r7(i,n,n.next,r)&&an(i,r)&&an(r,i)&&(t.push(i.i,n.i,r.i),aa(n),aa(n.next),n=e=r),n=n.next}while(n!==e)return r2(n)}(r2(t),n),n,i,r,a,s,2):2===o&&function(t,n,i,r,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&r7(n,n.next,e,t))return!0;n=n.next}while(n!==e)return!1}(l,u)&&(an(l,u)&&an(u,l)&&function(e,t){let n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e)return i}(l,u)&&(r8(l.prev,l,u.prev)||r8(l,u.prev,u))||r9(l,u)&&r8(l.prev,l,l.next)>0&&r8(u.prev,u,u.next)>0))){let l=ai(o,t);o=r2(o,o.next),l=r2(l,l.next),e(o,n,i,r,a,s,0),e(l,n,i,r,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,i,r,a,s):e(r2(t),n,i,r,a,s,1);break}}}(l,u,n,i,r,a,0),u}(e,t,n)}}class al{static area(e){let t=e.length,n=0;for(let i=t-1,r=0;ral.area(e)}static triangulateShape(e,t){let n=[],i=[],r=[];au(e),ac(n,e);let a=e.length;t.forEach(au);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function ac(e,t){for(let n=0;nNumber.EPSILON){let h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l),g=(i=p+s*m-e.x)*i+(r=f+o*m-e.y)*r;if(g<=2)return new eu(i,r);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,r=s,a=Math.sqrt(c)):(i=s,r=o,a=Math.sqrt(c/2))}return new eu(i/a,r/a)}let L=[];for(let e=0,t=C.length,n=t-1,i=e+1;e=0;e--){let t=e/_,n=m*Math.cos(t*Math.PI/2),i=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=C.length;e=0;){let a=r,s=r-1;s<0&&(s=e.length-1);for(let e=0,r=d+2*_;e0)&&d.push(t,r,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class aI extends tX{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new tW(0xffffff),this.specular=new tW(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tW(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eu(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tl,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aL extends tX{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new tW(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tW(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eu(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class aN extends tX{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eu(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class aD extends tX{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new tW(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tW(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eu(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tl,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aU extends tX{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class aO extends tX{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class aF extends tX{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new tW(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eu(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(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aB extends i0{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ak(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function az(e){let t=e.length,n=Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function aV(e,t,n){let i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){let i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function aH(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[i])&&(t.push(a.time),n.push(...s)),a=e[r++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[i])&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++];while(void 0!==a)else do void 0!==(s=a[i])&&(t.push(a.time),n.push(s)),a=e[r++];while(void 0!==a)}class aG{static convertArray(e,t){return ak(e,t)}static isTypedArray(e){return k(e)}static getKeyframeOrder(e){return az(e)}static sortedArray(e,t,n){return aV(e,t,n)}static flattenJSON(e,t,n,i){aH(e,t,n,i)}static subclip(e,t,n,i,r=30){return function(e,t,n,i,r=30){let a=e.clone();a.name=t;let s=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;na.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e=r.times[d]){let e=d*u+l,t=e+u-l;i=r.values.slice(e,t)}else{let e=r.createInterpolant(),t=l,n=u-l;e.evaluate(a),i=e.resultBuffer.slice(t,n)}"quaternion"===s&&new ec().fromArray(i).normalize().conjugate().toArray(i);let p=o.times.length;for(let e=0;e=r)){let s=t[1];e=(r=t[--n-1]))break i}a=n,n=0;break r}break n}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(q("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;0===r&&(q("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){let i=n[t];if("number"==typeof i&&isNaN(i)){q("KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){q("KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&k(i))for(let t=0,n=i.length;t!==n;++t){let n=i[t];if(isNaN(n)){q("KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}aq.prototype.ValueTypeName="",aq.prototype.TimeBufferType=Float32Array,aq.prototype.ValueBufferType=Float32Array,aq.prototype.DefaultInterpolation=2301;class aY extends aq{constructor(e,t,n){super(e,t,n)}}aY.prototype.ValueTypeName="bool",aY.prototype.ValueBufferType=Array,aY.prototype.DefaultInterpolation=2300,aY.prototype.InterpolantFactoryMethodLinear=void 0,aY.prototype.InterpolantFactoryMethodSmooth=void 0;class aJ extends aq{constructor(e,t,n,i){super(e,t,n,i)}}aJ.prototype.ValueTypeName="color";class aZ extends aq{constructor(e,t,n,i){super(e,t,n,i)}}aZ.prototype.ValueTypeName="number";class aK extends aW{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t),l=e*s;for(let e=l+s;l!==e;l+=4)ec.slerpFlat(r,0,a,l-s,a,l,o);return r}}class aQ extends aq{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new aK(this.times,this.values,this.getValueSize(),e)}}aQ.prototype.ValueTypeName="quaternion",aQ.prototype.InterpolantFactoryMethodSmooth=void 0;class a0 extends aq{constructor(e,t,n){super(e,t,n)}}a0.prototype.ValueTypeName="string",a0.prototype.ValueBufferType=Array,a0.prototype.DefaultInterpolation=2300,a0.prototype.InterpolantFactoryMethodLinear=void 0,a0.prototype.InterpolantFactoryMethodSmooth=void 0;class a1 extends aq{constructor(e,t,n,i){super(e,t,n,i)}}a1.prototype.ValueTypeName="vector";class a2{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=en(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return aZ;case"vector":case"vector2":case"vector3":case"vector4":return a1;case"color":return aJ;case"quaternion":return aQ;case"bool":case"boolean":return aY;case"string":return a0}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],n=[];aH(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(n[e]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,i=n.length;e!==i;++e)t.push(aq.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let e=0;e1){let e=a[1],t=i[e];t||(i[e]=t=[]),t.push(n)}}let a=[];for(let e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(X("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return q("AnimationClip: No animation in JSONLoader data."),null;let n=function(e,t,n,i,r){if(0!==n.length){let a=[],s=[];aH(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==a8[e])return void a8[e].push({onLoad:t,onProgress:n,onError:i});a8[e]=[],a8[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{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}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&X("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let n=a8[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{let i=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=r.byteLength,total:a});for(let e=0,t=n.length;e{e.error(t)})}()}}))}throw new a9(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),n=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{a3.add(`file:${e}`,t);let n=a8[e];delete a8[e];for(let e=0,i=n.length;e{let n=a8[e];if(void 0===n)throw this.manager.itemError(e),t;delete a8[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class se extends a6{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new a7(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):q(t),r.manager.itemError(e)}},n,i)}parse(e){let t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=new tW().setHex(r.value);break;case"v2":i.uniforms[t].value=new eu().fromArray(r.value);break;case"v3":i.uniforms[t].value=new eh().fromArray(r.value);break;case"v4":i.uniforms[t].value=new eC().fromArray(r.value);break;case"m3":i.uniforms[t].value=new ef().fromArray(r.value);break;case"m4":i.uniforms[t].value=new e9().fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=new eu().fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=new eu().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sw.createMaterialFromType(e)}static createMaterialFromType(e){return new({ShadowMaterial:aA,SpriteMaterial:n$,RawShaderMaterial:aC,ShaderMaterial:nC,PointsMaterial:rr,MeshPhysicalMaterial:aP,MeshStandardMaterial:aR,MeshPhongMaterial:aI,MeshToonMaterial:aL,MeshNormalMaterial:aN,MeshLambertMaterial:aD,MeshDepthMaterial:aU,MeshDistanceMaterial:aO,MeshBasicMaterial:tq,MeshMatcapMaterial:aF,LineDashedMaterial:aB,LineBasicMaterial:i0,Material:tX})[e]}}class sT{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class sE extends nu{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class sA extends a6{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new a7(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):q(t),r.manager.itemError(e)}},n,i)}parse(e){let t={},n={};function i(e,i){if(void 0!==t[i])return t[i];let r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];let i=new Uint32Array(e.arrayBuffers[t]).buffer;return n[t]=i,i}(e,r.buffer),s=new nG(B(r.type,a),r.stride);return s.uuid=r.uuid,t[i]=s,s}let r=e.isInstancedBufferGeometry?new sE:new nu,a=e.data.index;if(void 0!==a){let e=B(a.type,a.array);r.setIndex(new t2(e,1))}let s=e.data.attributes;for(let t in s){let n,a=s[t];if(a.isInterleavedBufferAttribute)n=new nj(i(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=B(a.type,a.array);n=new(a.isInstancedBufferAttribute?iv:t2)(e,a.itemSize,a.normalized)}void 0!==a.name&&(n.name=a.name),void 0!==a.usage&&n.setUsage(a.usage),r.setAttribute(t,n)}let o=e.data.morphAttributes;if(o)for(let t in o){let n=o[t],a=[];for(let t=0,r=n.length;t0){(n=new si(new a4(t))).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){(t=new si(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t{let t=null,n=null;return void 0!==e.boundingBox&&(t=new eU().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=new eQ().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new eQ().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(a.boundingBox=new eU().fromJSON(e.boundingBox));break;case"LOD":a=new n7;break;case"Line":a=new i9(l(e.geometry),u(e.material));break;case"LineLoop":a=new ri(l(e.geometry),u(e.material));break;case"LineSegments":a=new rn(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new ru(l(e.geometry),u(e.material));break;case"Sprite":a=new n5(u(e.material));break;case"Group":a=new nF;break;case"Bone":a=new ih;break;default:a=new tT}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){let s=e.children;for(let e=0;e{if(!0!==sL.has(a))return t&&t(n),r.manager.itemEnd(e),n;i&&i(sL.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return a3.add(`image-bitmap:${e}`,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),sL.set(o,t),a3.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});a3.add(`image-bitmap:${e}`,o),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sD{static getContext(){return void 0===i&&(i=new(window.AudioContext||window.webkitAudioContext)),i}static setContext(e){i=e}}class sU extends a6{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new a7(this.manager);function s(t){i?i(t):q(t),r.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let n=e.slice(0);sD.getContext().decodeAudioData(n,function(e){t(e)}).catch(s)}catch(e){s(e)}},n,i)}}let sO=new e9,sF=new e9,sB=new e9;class sk{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new nN,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new nN,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){let n,i;t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,sB.copy(e.projectionMatrix);let r=t.eyeSep/2,a=r*t.near/t.focus,s=t.near*Math.tan(ee*t.fov*.5)/t.zoom;sF.elements[12]=-r,sO.elements[12]=r,n=-s*t.aspect+a,i=s*t.aspect+a,sB.elements[0]=2*t.near/(i-n),sB.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(sB),n=-s*t.aspect-a,i=s*t.aspect-a,sB.elements[0]=2*t.near/(i-n),sB.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(sB)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(sF),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sO)}}class sz extends nN{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class sV{constructor(e=!0){this.autoStart=e,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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}let sH=new eh,sG=new ec,sW=new eh,sj=new eh,s$=new eh;class sX extends tT{constructor(){super(),this.type="AudioListener",this.context=sD.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new sV}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(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(sH,sG,sW),sj.set(0,0,-1).applyQuaternion(sG),s$.set(0,1,0).applyQuaternion(sG),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(sH.x,e),t.positionY.linearRampToValueAtTime(sH.y,e),t.positionZ.linearRampToValueAtTime(sH.z,e),t.forwardX.linearRampToValueAtTime(sj.x,e),t.forwardY.linearRampToValueAtTime(sj.y,e),t.forwardZ.linearRampToValueAtTime(sj.z,e),t.upX.linearRampToValueAtTime(s$.x,e),t.upY.linearRampToValueAtTime(s$.y,e),t.upZ.linearRampToValueAtTime(s$.z,e)}else t.setPosition(sH.x,sH.y,sH.z),t.setOrientation(sj.x,sj.y,sj.z,s$.x,s$.y,s$.z)}}class sq extends tT{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void X("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void X("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void X("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(e=0){return!1===this.hasPlaybackControl?void X("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){s.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n;e!==i;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){ec.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;ec.multiplyQuaternionsFlat(e,a,e,t,e,n),ec.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let s=0;s!==r;++s){let r=t+s;e[r]=e[r]*a+e[n+s]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let r=t+a;e[r]=e[r]+e[n+a]*i}}}let s2="\\[\\]\\.:\\/",s3=RegExp("["+s2+"]","g"),s4="[^"+s2+"]",s5="[^"+s2.replace("\\.","")+"]",s6=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",s4)+/(WCOD+)?/.source.replace("WCOD",s5)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",s4)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",s4)+"$"),s8=["material","materials","bones","map"];class s9{constructor(e,t,n){this.path=t,this.parsedPath=n||s9.parseTrackName(t),this.node=s9.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s9.Composite(e,t,n):new s9(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(s3,"")}static parseTrackName(e){let t=s6.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){let e=n.nodeName.substring(i+1);-1!==s8.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let i=0;i=r){let a=r++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==i;++e){let t=n[e],i=t[a],r=t[l];t[l]=i,t[a]=r}}}this.nCachedObjects_=r}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==i;++e){let t=n[e];t[u]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=Array(l);i=r.length,n[e]=i,a.push(e),s.push(t),r.push(c);for(let n=u,i=o.length;n!==i;++n){let i=o[n];c[n]=new s9(i,e,t)}return c}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){let i=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}class oe{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){const t=r[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),!0===n){let n=this._clip.duration,i=e._clip.duration;e.warp(1,i/n,t),this.warp(n/i,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);let r=this._startTime;if(null!==r){let i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulate(i,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(null!==n){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=2202===n;if(0===e)return -1===r?i:a&&(1&r)==1?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));s:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break s}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){let n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);let s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(a&&(1&r)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(e?i.endingStart=this.zeroSlopeAtStart?2401:2400:i.endingStart=2402,t?i.endingEnd=this.zeroSlopeAtEnd?2401:2400:i.endingEnd=2402)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=t,s[1]=r+e,o[1]=n,this}}let ot=new Float32Array(1);class on extends Z{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==r;++e){let r=i[e],l=r.name,c=u[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let i=t&&t._propertyBindings[e].binding.parsedPath;c=new s1(s9.create(n,l,i),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==n;++s)t[s]._update(i,e,r,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,o_).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let ox=new eh,ob=new eh,oS=new eh,oM=new eh,ow=new eh,oT=new eh,oE=new eh;class oA{constructor(e=new eh,t=new eh){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ox.subVectors(e,this.start),ob.subVectors(this.end,this.start);let n=ob.dot(ob),i=ob.dot(ox)/n;return t&&(i=ei(i,0,1)),i}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=oT,n=oE){let i,r,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;oS.subVectors(l,s),oM.subVectors(u,o),ow.subVectors(s,o);let c=oS.dot(oS),h=oM.dot(oM),d=oM.dot(ow);if(c<=a&&h<=a)return t.copy(s),n.copy(o),t.sub(n),t.dot(t);if(c<=a)i=0,r=ei(r=d/h,0,1);else{let e=oS.dot(ow);if(h<=a)r=0,i=ei(-e/c,0,1);else{let t=oS.dot(oM),n=c*h-t*t;i=0!==n?ei((t*d-e*h)/n,0,1):0,(r=(t*i+d)/h)<0?(r=0,i=ei(-e/c,0,1)):r>1&&(r=1,i=ei((t-e)/c,0,1))}}return t.copy(s).add(oS.multiplyScalar(i)),n.copy(o).add(oM.multiplyScalar(r)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let oC=new eh;class oR extends tT{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new nu,i=[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 e=0,t=1;e<32;e++,t++){const n=e/32*Math.PI*2,r=t/32*Math.PI*2;i.push(Math.cos(n),Math.sin(n),1,Math.cos(r),Math.sin(r),1)}n.setAttribute("position",new nt(i,3));const r=new i0({fog:!1,toneMapped:!1});this.cone=new rn(n,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 e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),oC.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(oC),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let oP=new eh,oI=new e9,oL=new e9;class oN extends rn{constructor(e){const t=function e(t){let n=[];!0===t.isBone&&n.push(t);for(let i=0;i1)for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{oQ.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(oQ,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class o1 extends rn{constructor(e=1){const t=new nu;t.setAttribute("position",new nt([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new nt([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new i0({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){let i=new tW,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class o2{constructor(){this.type="ShapePath",this.color=new tW,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new rQ,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,n,i,r,a,s=al.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];if(1===o.length)return n=o[0],(i=new r0).curves=n.curves,l.push(i),l;let u=!s(o[0].getPoints());u=e?!u:u;let c=[],h=[],d=[],p=0;h[0]=void 0,d[p]=[];for(let i=0,a=o.length;i1){let e=!1,t=0;for(let e=0,t=h.length;eNumber.EPSILON){if(l<0&&(n=t[a],o=-o,s=t[r],l=-l),e.ys.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{let t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return i})(a.p,h[i].p)&&(n!==i&&t++,s?(s=!1,c[i].push(a)):e=!0);s&&c[n].push(a)}}t>0&&!1===e&&(d=c)}for(let e=0,t=h.length;et?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let n;return(n=e.image&&e.image.width?e.image.width/e.image.height:1)>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,n,i){return o4(e,t,n,i)}}function o6(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0===t||null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function o8(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);(!e||e.versione.start-t.start);let t=0;for(let e=1;e4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>sx,"AnimationAction",()=>oe,"AnimationClip",()=>a2,"AnimationLoader",()=>se,"AnimationMixer",()=>on,"AnimationObjectGroup",()=>s7,"AnimationUtils",()=>aG,"ArcCurve",()=>rD,"ArrayCamera",()=>sz,"ArrowHelper",()=>o0,"AttachedBindMode",()=>E,"Audio",()=>sq,"AudioAnalyser",()=>s0,"AudioContext",()=>sD,"AudioListener",()=>sX,"AudioLoader",()=>sU,"AxesHelper",()=>o1,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>iQ,"Bone",()=>ih,"BooleanKeyframeTrack",()=>aY,"Box2",()=>oy,"Box3",()=>eU,"Box3Helper",()=>oZ,"BoxGeometry",()=>nM,"BoxHelper",()=>oJ,"BufferAttribute",()=>t2,"BufferGeometry",()=>nu,"BufferGeometryLoader",()=>sA,"ByteType",()=>1010,"Cache",()=>a3,"Camera",()=>nR,"CameraHelper",()=>oX,"CanvasTexture",()=>rv,"CapsuleGeometry",()=>rb,"CatmullRomCurve3",()=>rz,"CineonToneMapping",()=>3,"CircleGeometry",()=>rS,"ClampToEdgeWrapping",()=>1001,"Clock",()=>sV,"Color",()=>tW,"ColorKeyframeTrack",()=>aJ,"ColorManagement",()=>e_,"CompressedArrayTexture",()=>rm,"CompressedCubeTexture",()=>rg,"CompressedTexture",()=>rf,"CompressedTextureLoader",()=>st,"ConeGeometry",()=>rw,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>o3,"CubeCamera",()=>nD,"CubeDepthTexture",()=>ry,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>nU,"CubeTextureLoader",()=>sr,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rW,"CubicBezierCurve3",()=>rj,"CubicInterpolant",()=>aj,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>rL,"CurvePath",()=>rK,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rM,"Cylindrical",()=>og,"Data3DTexture",()=>eN,"DataArrayTexture",()=>eI,"DataTexture",()=>id,"DataTextureLoader",()=>sa,"DataUtils",()=>tK,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>a5,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>r_,"DetachedBindMode",()=>A,"DirectionalLight",()=>sy,"DirectionalLightHelper",()=>oW,"DiscreteInterpolant",()=>aX,"DodecahedronGeometry",()=>rE,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rI,"EllipseCurve",()=>rN,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>tl,"EventDispatcher",()=>Z,"ExternalTexture",()=>rx,"ExtrudeGeometry",()=>ah,"FileLoader",()=>a7,"Float16BufferAttribute",()=>ne,"Float32BufferAttribute",()=>nt,"FloatType",()=>1015,"Fog",()=>nV,"FogExp2",()=>nz,"FramebufferTexture",()=>rp,"FrontSide",()=>0,"Frustum",()=>iN,"FrustumArray",()=>iO,"GLBufferAttribute",()=>ol,"GLSL1",()=>"100","GLSL3",()=>L,"GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>ok,"Group",()=>nF,"HalfFloatType",()=>1016,"HemisphereLight",()=>sl,"HemisphereLightHelper",()=>oB,"IcosahedronGeometry",()=>ap,"ImageBitmapLoader",()=>sN,"ImageLoader",()=>si,"ImageUtils",()=>eb,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>iv,"InstancedBufferGeometry",()=>sE,"InstancedInterleavedBuffer",()=>oo,"InstancedMesh",()=>iT,"Int16BufferAttribute",()=>t6,"Int32BufferAttribute",()=>t9,"Int8BufferAttribute",()=>t3,"IntType",()=>1013,"InterleavedBuffer",()=>nG,"InterleavedBufferAttribute",()=>nj,"Interpolant",()=>aW,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>U,"InterpolationSamplingType",()=>D,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>aq,"LOD",()=>n7,"LatheGeometry",()=>af,"Layers",()=>tu,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>so,"LightProbe",()=>sM,"Line",()=>i9,"Line3",()=>oA,"LineBasicMaterial",()=>i0,"LineCurve",()=>r$,"LineCurve3",()=>rX,"LineDashedMaterial",()=>aB,"LineLoop",()=>ri,"LineSegments",()=>rn,"LinearFilter",()=>1006,"LinearInterpolant",()=>a$,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>R,"LinearToneMapping",()=>1,"LinearTransfer",()=>P,"Loader",()=>a6,"LoaderUtils",()=>sT,"LoadingManager",()=>a4,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>w,"Material",()=>tX,"MaterialLoader",()=>sw,"MathUtils",()=>el,"Matrix2",()=>ov,"Matrix3",()=>ef,"Matrix4",()=>e9,"MaxEquation",()=>104,"Mesh",()=>nb,"MeshBasicMaterial",()=>tq,"MeshDepthMaterial",()=>aU,"MeshDistanceMaterial",()=>aO,"MeshLambertMaterial",()=>aD,"MeshMatcapMaterial",()=>aF,"MeshNormalMaterial",()=>aN,"MeshPhongMaterial",()=>aI,"MeshPhysicalMaterial",()=>aP,"MeshStandardMaterial",()=>aR,"MeshToonMaterial",()=>aL,"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",()=>aZ,"Object3D",()=>tT,"ObjectLoader",()=>sC,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>am,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>sv,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rQ,"PerspectiveCamera",()=>nN,"Plane",()=>iR,"PlaneGeometry",()=>ag,"PlaneHelper",()=>oK,"PointLight",()=>sg,"PointLightHelper",()=>oD,"Points",()=>ru,"PointsMaterial",()=>rr,"PolarGridHelper",()=>oz,"PolyhedronGeometry",()=>rT,"PositionalAudio",()=>sQ,"PropertyBinding",()=>s9,"PropertyMixer",()=>s1,"QuadraticBezierCurve",()=>rq,"QuadraticBezierCurve3",()=>rY,"Quaternion",()=>ec,"QuaternionKeyframeTrack",()=>aQ,"QuaternionLinearInterpolant",()=>aK,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>et,"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",()=>aC,"Ray",()=>e8,"Raycaster",()=>oc,"RectAreaLight",()=>sb,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>eR,"RenderTarget3D",()=>oi,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>av,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>C,"SRGBTransfer",()=>I,"Scene",()=>nH,"ShaderMaterial",()=>nC,"ShadowMaterial",()=>aA,"Shape",()=>r0,"ShapeGeometry",()=>a_,"ShapePath",()=>o2,"ShapeUtils",()=>al,"ShortType",()=>1011,"Skeleton",()=>ig,"SkeletonHelper",()=>oN,"SkinnedMesh",()=>ic,"Source",()=>eM,"Sphere",()=>eQ,"SphereGeometry",()=>ay,"Spherical",()=>om,"SphericalHarmonics3",()=>sS,"SplineCurve",()=>rJ,"SpotLight",()=>sf,"SpotLightHelper",()=>oR,"Sprite",()=>n5,"SpriteMaterial",()=>n$,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>sk,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>a0,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>T,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>ax,"Texture",()=>eA,"TextureLoader",()=>ss,"TextureUtils",()=>o5,"Timer",()=>op,"TimestampQuery",()=>N,"TorusGeometry",()=>ab,"TorusKnotGeometry",()=>aS,"Triangle",()=>tk,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>aM,"UVMapping",()=>300,"Uint16BufferAttribute",()=>t8,"Uint32BufferAttribute",()=>t7,"Uint8BufferAttribute",()=>t4,"Uint8ClampedBufferAttribute",()=>t5,"Uniform",()=>or,"UniformsGroup",()=>os,"UniformsUtils",()=>nA,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>eu,"Vector3",()=>eh,"Vector4",()=>eC,"VectorKeyframeTrack",()=>a1,"VideoFrameTexture",()=>rd,"VideoTexture",()=>rh,"WebGL3DRenderTarget",()=>eD,"WebGLArrayRenderTarget",()=>eL,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>nO,"WebGLRenderTarget",()=>eP,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>nk,"WireframeGeometry",()=>aw,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>O,"cloneUniforms",()=>nw,"createCanvasElement",()=>V,"createElementNS",()=>z,"error",()=>q,"getByteLength",()=>o4,"getConsoleFunction",()=>j,"getUnlitUniformColorSpace",()=>nE,"log",()=>$,"mergeUniforms",()=>nT,"probeAsync",()=>J,"setConsoleFunction",()=>W,"warn",()=>X,"warnOnce",()=>Y],90072);let o9={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 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}"},o7={common:{diffuse:{value:new tW(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new ef},alphaMap:{value:null},alphaMapTransform:{value:new ef},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ef}},envmap:{envMap:{value:null},envMapRotation:{value:new ef},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 ef}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ef}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ef},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ef},normalScale:{value:new eu(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ef},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ef}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ef}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ef}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tW(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 tW(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ef},alphaTest:{value:0},uvTransform:{value:new ef}},sprite:{diffuse:{value:new tW(0xffffff)},opacity:{value:1},center:{value:new eu(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ef},alphaMap:{value:null},alphaMapTransform:{value:new ef},alphaTest:{value:0}}},le={basic:{uniforms:nT([o7.common,o7.specularmap,o7.envmap,o7.aomap,o7.lightmap,o7.fog]),vertexShader:o9.meshbasic_vert,fragmentShader:o9.meshbasic_frag},lambert:{uniforms:nT([o7.common,o7.specularmap,o7.envmap,o7.aomap,o7.lightmap,o7.emissivemap,o7.bumpmap,o7.normalmap,o7.displacementmap,o7.fog,o7.lights,{emissive:{value:new tW(0)}}]),vertexShader:o9.meshlambert_vert,fragmentShader:o9.meshlambert_frag},phong:{uniforms:nT([o7.common,o7.specularmap,o7.envmap,o7.aomap,o7.lightmap,o7.emissivemap,o7.bumpmap,o7.normalmap,o7.displacementmap,o7.fog,o7.lights,{emissive:{value:new tW(0)},specular:{value:new tW(1118481)},shininess:{value:30}}]),vertexShader:o9.meshphong_vert,fragmentShader:o9.meshphong_frag},standard:{uniforms:nT([o7.common,o7.envmap,o7.aomap,o7.lightmap,o7.emissivemap,o7.bumpmap,o7.normalmap,o7.displacementmap,o7.roughnessmap,o7.metalnessmap,o7.fog,o7.lights,{emissive:{value:new tW(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:o9.meshphysical_vert,fragmentShader:o9.meshphysical_frag},toon:{uniforms:nT([o7.common,o7.aomap,o7.lightmap,o7.emissivemap,o7.bumpmap,o7.normalmap,o7.displacementmap,o7.gradientmap,o7.fog,o7.lights,{emissive:{value:new tW(0)}}]),vertexShader:o9.meshtoon_vert,fragmentShader:o9.meshtoon_frag},matcap:{uniforms:nT([o7.common,o7.bumpmap,o7.normalmap,o7.displacementmap,o7.fog,{matcap:{value:null}}]),vertexShader:o9.meshmatcap_vert,fragmentShader:o9.meshmatcap_frag},points:{uniforms:nT([o7.points,o7.fog]),vertexShader:o9.points_vert,fragmentShader:o9.points_frag},dashed:{uniforms:nT([o7.common,o7.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:o9.linedashed_vert,fragmentShader:o9.linedashed_frag},depth:{uniforms:nT([o7.common,o7.displacementmap]),vertexShader:o9.depth_vert,fragmentShader:o9.depth_frag},normal:{uniforms:nT([o7.common,o7.bumpmap,o7.normalmap,o7.displacementmap,{opacity:{value:1}}]),vertexShader:o9.meshnormal_vert,fragmentShader:o9.meshnormal_frag},sprite:{uniforms:nT([o7.sprite,o7.fog]),vertexShader:o9.sprite_vert,fragmentShader:o9.sprite_frag},background:{uniforms:{uvTransform:{value:new ef},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:o9.background_vert,fragmentShader:o9.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ef}},vertexShader:o9.backgroundCube_vert,fragmentShader:o9.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:o9.cube_vert,fragmentShader:o9.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:o9.equirect_vert,fragmentShader:o9.equirect_frag},distance:{uniforms:nT([o7.common,o7.displacementmap,{referencePosition:{value:new eh},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:o9.distance_vert,fragmentShader:o9.distance_frag},shadow:{uniforms:nT([o7.lights,o7.fog,{color:{value:new tW(0)},opacity:{value:1}}]),vertexShader:o9.shadow_vert,fragmentShader:o9.shadow_frag}};le.physical={uniforms:nT([le.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ef},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ef},clearcoatNormalScale:{value:new eu(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ef},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ef},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ef},sheen:{value:0},sheenColor:{value:new tW(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ef},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ef},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ef},transmissionSamplerSize:{value:new eu},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ef},attenuationDistance:{value:0},attenuationColor:{value:new tW(0)},specularColor:{value:new tW(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ef},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ef},anisotropyVector:{value:new eu},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ef}}]),vertexShader:o9.meshphysical_vert,fragmentShader:o9.meshphysical_frag};let lt={r:0,b:0,g:0},ln=new tl,li=new e9;function lr(e,t,n,i,r,a,s){let o,l,u=new tW(0),c=+(!0!==a),h=null,d=0,p=null;function f(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function m(t,n){t.getRGB(lt,nE(e)),i.buffers.color.setClear(lt.r,lt.g,lt.b,n,s)}return{getClearColor:function(){return u},setClearColor:function(e,t=1){u.set(e),m(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){m(u,c=e)},render:function(t){let n=!1,r=f(t);null===r?m(u,c):r&&r.isColor&&(m(r,1),n=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let i=f(n);i&&(i.isCubeTexture||306===i.mapping)?(void 0===l&&((l=new nb(new nM(1,1,1),new nC({name:"BackgroundCubeMaterial",uniforms:nw(le.backgroundCube.uniforms),vertexShader:le.backgroundCube.vertexShader,fragmentShader:le.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),ln.copy(n.backgroundRotation),ln.x*=-1,ln.y*=-1,ln.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(ln.y*=-1,ln.z*=-1),l.material.uniforms.envMap.value=i,l.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(li.makeRotationFromEuler(ln)),l.material.toneMapped=e_.getTransfer(i.colorSpace)!==I,(h!==i||d!==i.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(void 0===o&&((o=new nb(new ag(2,2),new nC({name:"BackgroundMaterial",uniforms:nw(le.background.uniforms),vertexShader:le.background.vertexShader,fragmentShader:le.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=i,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=e_.getTransfer(i.colorSpace)!==I,!0===i.matrixAutoUpdate&&i.updateMatrix(),o.material.uniforms.uvTransform.value.copy(i.matrix),(h!==i||d!==i.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function la(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=u(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],i=[],r=[];for(let e=0;e=0){let n=r[t],i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n||n.attribute!==i||i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,m,l,g))&&function(e,t,n,i){let r={},s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(M||s)&&(s=!1,function(n,i,r,a){c();let s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(let i in o){let r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){let i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp",o=a(s);return o!==s&&(X("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let r=1016===n&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===n||i.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===n||!!r},precision:s,logarithmicDepthBuffer:!0===n.logarithmicDepthBuffer,reversedDepthBuffer:!0===n.reversedDepthBuffer&&t.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 ll(e){let t=this,n=null,i=0,r=!1,a=!1,s=new iR,o=new ef,l={value:null,needsUpdate:!1};function u(e,n,i,r){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){let t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===u||u.length0),t.numPlanes=i,t.numIntersection=0)}}function lu(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping;if(303===a||304===a)if(t.has(r))return n(t.get(r).texture,r.mapping);else{let a=r.image;if(!a||!(a.height>0))return null;{let s=new nO(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}}}return r},dispose:function(){t=new WeakMap}}}let lc=[.125,.215,.35,.446,.526,.582],lh=new sv,ld=new tW,lp=null,lf=0,lm=0,lg=!1,lv=new eh;class l_{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,t=0,n=.1,i=100,r={}){let{size:a=256,position:s=lv}=r;lp=this._renderer.getRenderTarget(),lf=this._renderer.getActiveCubeFace(),lm=this._renderer.getActiveMipmapLevel(),lg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,i,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lS(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=lb(),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?o=lc[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];d.set(i,18*e),p.set(h,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new nu;m.setAttribute("position",new t2(d,3)),m.setAttribute("uv",new t2(p,2)),m.setAttribute("faceIndex",new t2(f,1)),i.push(new nb(m,null)),r>4&&r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}(i)),this._blurMaterial=(r=i,new nC({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new eh(0,1,0)}},vertexShader:lM(),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:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=i,new nC({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lM(),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:0,depthTest:!1,depthWrite:!1}))}return i}_compileMaterial(e){let t=new nb(new nu,e);this._renderer.compile(t,lh)}_sceneToCubeUV(e,t,n,i,r){let a=new nN(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(ld),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new nb(new nM,new tq({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));let h=this._backgroundBox,d=h.material,p=!1,f=e.background;f?f.isColor&&(d.color.copy(f),e.background=null,p=!0):(d.color.copy(ld),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[t],r.y,r.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[t],r.z)):(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[t]));let u=this._cubeSize;lx(i,n*u,t>2?u:0,u,u),l.setRenderTarget(i),p&&l.render(h,a),l.render(e,a)}l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=lS()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=lb());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r,r.uniforms.envMap.value=e;let s=this._cubeSize;lx(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,lh)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let t=1;th-4?n-h+4:0),f=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=h-t,lx(r,p,f,3*d,2*d),i.setRenderTarget(r),i.render(s,lh),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=h-n,lx(e,p,f,3*d,2*d),i.setRenderTarget(e),i.render(s,lh)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&q("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[i];u.material=l;let c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&X(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ev-4?i-v+4:0),y,3*_,2*_),o.setRenderTarget(t),o.render(u,lh)}}function ly(e,t,n){let i=new eP(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function lx(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function lb(){return new nC({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lM(),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:0,depthTest:!1,depthWrite:!1})}function lS(){return new nC({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lM(),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:0,depthTest:!1,depthWrite:!1})}function lM(){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 lw(e){let t=new WeakMap,n=null;function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(r),l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new l_(e)),(a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a)).texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;{if(void 0!==a)return a.texture;let l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new l_(e)),(a=s?n.fromEquirectangular(r):n.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function lT(e){let t={};function n(n){if(void 0!==t[n])return t[n];let i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&Y("WebGLRenderer: "+e+" extension not supported."),t}}}function lE(e,t,n,i){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],i=e.index,r=e.attributes.position,s=0;if(null!==i){let e=i.array;s=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new eI(m,p,f,c);g.type=1015,g.needsUpdate=!0;let v=4*d;for(let t=0;t - #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 nb(l,u),h=new sv(-1,1,1,-1,0,1),d=null,p=null,f=!1,m=null,g=[],v=!1;this.setSize=function(e,t){s.setSize(e,t),o.setSize(e,t);for(let n=0;n0&&!0===g[0].isRenderPass;let t=s.width,n=s.height;for(let e=0;e0)return e;let r=t*n,a=lB[r];if(void 0===a&&(a=new Float32Array(r),lB[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function lW(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n0&&(this.seq=i.concat(r))}setValue(e,t,n,i){let r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let r=e[i];r.id in t&&n.push(r)}return n}}function uA(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let uC=0,uR=new ef;function uP(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}}let uI={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},uL=new eh;function uN(e){return""!==e}function uD(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function uU(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let uO=/^[ \t]*#include +<([\w\d./]+)>/gm;function uF(e){return e.replace(uO,uk)}let uB=new Map;function uk(e,t){let n=o9[t];if(void 0===n){let e=uB.get(t);if(void 0!==e)n=o9[e],X('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return uF(n)}let uz=/#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 uV(e){return e.replace(uz,uH)}function uH(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(s+="\n"),(o=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(uN).join("\n")).length>0&&(o+="\n");else{let e,t,i,l,u;s=[uG(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.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(uN).join("\n"),o=[uG(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?o9.tonemapping_pars_fragment:"",0!==n.toneMapping?(r="toneMapping",void 0===(e=uI[a=n.toneMapping])?(X("WebGLProgram: Unsupported toneMapping:",a),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",o9.colorspace_pars_fragment,(t=function(e){e_._getMatrix(uR,e_.workingColorSpace,e);let t=`mat3( ${uR.elements.map(e=>e.toFixed(4))} )`;switch(e_.getTransfer(e)){case P:return[t,"LinearTransferOETF"];case I:return[t,"sRGBTransferOETF"];default:return X("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(n.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { - return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) ); -}`),(e_.getLuminanceCoefficients(uL),i=uL.x.toFixed(4),l=uL.y.toFixed(4),u=uL.z.toFixed(4),`float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( ${i}, ${l}, ${u} ); - return dot( weights, rgb ); -}`),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(uN).join("\n")}d=uU(d=uD(d=uF(d),n),n),p=uU(p=uD(p=uF(p),n),n),d=uV(d),p=uV(p),!0!==n.isRawShaderMaterial&&(S="#version 300 es\n",s=[y,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+s,o=["#define varying in",n.glslVersion===L?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===L?"":"#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"+o);let M=S+s+d,w=S+o+p,T=uA(c,c.VERTEX_SHADER,M),E=uA(c,c.FRAGMENT_SHADER,w);function A(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(b)||"",i=c.getShaderInfoLog(T)||"",r=c.getShaderInfoLog(E)||"",a=n.trim(),l=i.trim(),u=r.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(b,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,T,E);else{let e=uP(c,T,"vertex"),n=uP(c,E,"fragment");q("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+n)}else""!==a?X("WebGLProgram: Program Info Log:",a):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:u,prefix:o}})}c.deleteShader(T),c.deleteShader(E),l=new uE(c,b),u=function(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,Y=a.clearcoat>0,J=a.dispersion>0,Z=a.iridescence>0,K=a.sheen>0,Q=a.transmission>0,ee=q&&!!a.anisotropyMap,et=Y&&!!a.clearcoatMap,en=Y&&!!a.clearcoatNormalMap,ei=Y&&!!a.clearcoatRoughnessMap,er=Z&&!!a.iridescenceMap,ea=Z&&!!a.iridescenceThicknessMap,es=K&&!!a.sheenColorMap,eo=K&&!!a.sheenRoughnessMap,el=!!a.specularMap,eu=!!a.specularColorMap,ec=!!a.specularIntensityMap,eh=Q&&!!a.transmissionMap,ed=Q&&!!a.thicknessMap,ep=!!a.gradientMap,ef=!!a.alphaMap,em=a.alphaTest>0,eg=!!a.alphaHash,ev=!!a.extensions,ey=0;a.toneMapped&&(null===L||!0===L.isXRRenderTarget)&&(ey=e.toneMapping);let ex={shaderID:E,shaderType:a.type,shaderName:a.name,vertexShader:v,fragmentShader:_,defines:a.defines,customVertexShaderID:y,customFragmentShaderID:x,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:U,batchingColor:U&&null!==g._colorsTexture,instancing:D,instancingColor:D&&null!==g.instanceColor,instancingMorph:D&&null!==g.morphTexture,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:R,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:F,envMap:B,envMapMode:B&&w.mapping,envMapCubeUVHeight:T,aoMap:k,lightMap:z,bumpMap:V,normalMap:H,displacementMap:G,emissiveMap:W,normalMapObjectSpace:H&&1===a.normalMapType,normalMapTangentSpace:H&&0===a.normalMapType,metalnessMap:j,roughnessMap:$,anisotropy:q,anisotropyMap:ee,clearcoat:Y,clearcoatMap:et,clearcoatNormalMap:en,clearcoatRoughnessMap:ei,dispersion:J,iridescence:Z,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:K,sheenColorMap:es,sheenRoughnessMap:eo,specularMap:el,specularColorMap:eu,specularIntensityMap:ec,transmission:Q,transmissionMap:eh,thicknessMap:ed,gradientMap:ep,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:ef,alphaTest:em,alphaHash:eg,combine:a.combine,mapUv:O&&m(a.map.channel),aoMapUv:k&&m(a.aoMap.channel),lightMapUv:z&&m(a.lightMap.channel),bumpMapUv:V&&m(a.bumpMap.channel),normalMapUv:H&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:W&&m(a.emissiveMap.channel),metalnessMapUv:j&&m(a.metalnessMap.channel),roughnessMapUv:$&&m(a.roughnessMap.channel),anisotropyMapUv:ee&&m(a.anisotropyMap.channel),clearcoatMapUv:et&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:en&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:es&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:eo&&m(a.sheenRoughnessMap.channel),specularMapUv:el&&m(a.specularMap.channel),specularColorMapUv:eu&&m(a.specularColorMap.channel),specularIntensityMapUv:ec&&m(a.specularIntensityMap.channel),transmissionMapUv:eh&&m(a.transmissionMap.channel),thicknessMapUv:ed&&m(a.thicknessMap.channel),alphaMapUv:ef&&m(a.alphaMap.channel),vertexTangents:!!S.attributes.tangent&&(H||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!S.attributes.color&&4===S.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!S.attributes.uv&&(O||ef),fog:!!b,useFog:!0===a.fog,fogExp2:!!b&&b.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,reversedDepthBuffer:N,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==S.morphAttributes.position,morphNormals:void 0!==S.morphAttributes.normal,morphColors:void 0!==S.morphAttributes.color,morphTargetsCount:C,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ey,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&e_.getTransfer(a.map.colorSpace)===I,decodeVideoTextureEmissive:W&&!0===a.emissiveMap.isVideoTexture&&e_.getTransfer(a.emissiveMap.colorSpace)===I,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ev&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ev&&!0===a.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ex.vertexUv1s=u.has(1),ex.vertexUv2s=u.has(2),ex.vertexUv3s=u.has(3),u.clear(),ex},getProgramCacheKey:function(t){var n,i,r,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=s,i=t,n.push(i.precision),n.push(i.outputColorSpace),n.push(i.envMapMode),n.push(i.envMapCubeUVHeight),n.push(i.mapUv),n.push(i.alphaMapUv),n.push(i.lightMapUv),n.push(i.aoMapUv),n.push(i.bumpMapUv),n.push(i.normalMapUv),n.push(i.displacementMapUv),n.push(i.emissiveMapUv),n.push(i.metalnessMapUv),n.push(i.roughnessMapUv),n.push(i.anisotropyMapUv),n.push(i.clearcoatMapUv),n.push(i.clearcoatNormalMapUv),n.push(i.clearcoatRoughnessMapUv),n.push(i.iridescenceMapUv),n.push(i.iridescenceThicknessMapUv),n.push(i.sheenColorMapUv),n.push(i.sheenRoughnessMapUv),n.push(i.specularMapUv),n.push(i.specularColorMapUv),n.push(i.specularIntensityMapUv),n.push(i.transmissionMapUv),n.push(i.thicknessMapUv),n.push(i.combine),n.push(i.fogExp2),n.push(i.sizeAttenuation),n.push(i.morphTargetsCount),n.push(i.morphAttributeCount),n.push(i.numDirLights),n.push(i.numPointLights),n.push(i.numSpotLights),n.push(i.numSpotLightMaps),n.push(i.numHemiLights),n.push(i.numRectAreaLights),n.push(i.numDirLightShadows),n.push(i.numPointLightShadows),n.push(i.numSpotLightShadows),n.push(i.numSpotLightShadowsWithMaps),n.push(i.numLightProbes),n.push(i.shadowMapType),n.push(i.toneMapping),n.push(i.numClippingPlanes),n.push(i.numClipIntersection),n.push(i.depthPacking),r=s,a=t,o.disableAll(),a.instancing&&o.enable(0),a.instancingColor&&o.enable(1),a.instancingMorph&&o.enable(2),a.matcap&&o.enable(3),a.envMap&&o.enable(4),a.normalMapObjectSpace&&o.enable(5),a.normalMapTangentSpace&&o.enable(6),a.clearcoat&&o.enable(7),a.iridescence&&o.enable(8),a.alphaTest&&o.enable(9),a.vertexColors&&o.enable(10),a.vertexAlphas&&o.enable(11),a.vertexUv1s&&o.enable(12),a.vertexUv2s&&o.enable(13),a.vertexUv3s&&o.enable(14),a.vertexTangents&&o.enable(15),a.anisotropy&&o.enable(16),a.alphaHash&&o.enable(17),a.batching&&o.enable(18),a.dispersion&&o.enable(19),a.batchingColor&&o.enable(20),a.gradientMap&&o.enable(21),r.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.reversedDepthBuffer&&o.enable(4),a.skinning&&o.enable(5),a.morphTargets&&o.enable(6),a.morphNormals&&o.enable(7),a.morphColors&&o.enable(8),a.premultipliedAlpha&&o.enable(9),a.shadowMapEnabled&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.decodeVideoTextureEmissive&&o.enable(20),a.alphaToCoverage&&o.enable(21),r.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,n=f[e.type];if(n){let e=le[n];t=nA.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let i=h.get(n);return void 0!==i?++i.usedTimes:(i=new uq(e,n,t,a),c.push(i),h.set(n,i)),i},releaseProgram:function(e){if(0==--e.usedTimes){let t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),h.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function uQ(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function u0(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function u1(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function u2(){let e=[],t=0,n=[],i=[],r=[];function a(n,i,r,a,s,o){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?i.push(c):!0===s.transparent?r.push(c):n.push(c)},unshift:function(e,t,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?i.unshift(c):!0===s.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||u0),i.length>1&&i.sort(t||u1),r.length>1&&r.sort(t||u1)}}}function u3(){let e=new WeakMap;return{get:function(t,n){let i,r=e.get(t);return void 0===r?(i=new u2,e.set(t,[i])):n>=r.length?(i=new u2,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function u4(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new eh,color:new tW};break;case"SpotLight":n={position:new eh,direction:new eh,color:new tW,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new eh,color:new tW,distance:0,decay:0};break;case"HemisphereLight":n={direction:new eh,skyColor:new tW,groundColor:new tW};break;case"RectAreaLight":n={color:new tW,position:new eh,halfWidth:new eh,halfHeight:new eh}}return e[t.id]=n,n}}}let u5=0;function u6(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function u8(e){let t,n=new u4,i=(t={},{get:function(e){let n;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eu};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eu,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}),r={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++)r.probe.push(new eh);let a=new eh,s=new e9,o=new e9;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;t.sort(u6);for(let e=0,y=t.length;e0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=o7.LTC_FLOAT_1,r.rectAreaLTC2=o7.LTC_FLOAT_2):(r.rectAreaLTC1=o7.LTC_HALF_1,r.rectAreaLTC2=o7.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let y=r.hash;(y.directionalLength!==l||y.pointLength!==u||y.spotLength!==c||y.rectAreaLength!==h||y.hemiLength!==d||y.numDirectionalShadows!==p||y.numPointShadows!==f||y.numSpotShadows!==m||y.numSpotMaps!==g||y.numLightProbes!==_)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=_,y.directionalLength=l,y.pointLength=u,y.spotLength=c,y.rectAreaLength=h,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=f,y.numSpotShadows=m,y.numSpotMaps=g,y.numLightProbes=_,r.version=u5++)},setupView:function(e,t){let n=0,i=0,l=0,u=0,c=0,h=t.matrixWorldInverse;for(let t=0,d=e.length;t=a.length?(r=new u9(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}let ce=[new eh(1,0,0),new eh(-1,0,0),new eh(0,1,0),new eh(0,-1,0),new eh(0,0,1),new eh(0,0,-1)],ct=[new eh(0,-1,0),new eh(0,-1,0),new eh(0,0,1),new eh(0,0,-1),new eh(0,-1,0),new eh(0,-1,0)],cn=new e9,ci=new eh,cr=new eh;function ca(e,t,n){let i=new iN,r=new eu,a=new eu,s=new eC,o=new aU,l=new aO,u={},c=n.maxTextureSize,h={0:1,1:0,2:2},d=new nC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new eu},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=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new nu;f.setAttribute("position",new t2(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new nb(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function _(t,n,i,r){let a=null,s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=a.uuid,t=n.uuid,i=u[e];void 0===i&&(i={},u[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",y)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,3===r?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function y(e){for(let t in e.target.removeEventListener("dispose",y),u){let n=u[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(n,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;2===n.type&&(X("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),n.type=1);let u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),y=e.state;y.setBlending(0),!0===y.buffers.depth.getReversed()?y.buffers.color.setClear(0,0,0,0):y.buffers.color.setClear(1,1,1,1),y.buffers.depth.setTest(!0),y.setScissorTest(!1);let x=v!==this.type;x&&o.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,h=n.length;uc||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/g.x),r.x=a.x*g.x,f.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/g.y),r.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===x){if(null!==f.map&&(null!==f.map.depthTexture&&(f.map.depthTexture.dispose(),f.map.depthTexture=null),f.map.dispose()),3===this.type){if(h.isPointLight){X("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}f.map=new eP(r.x,r.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),f.map.texture.name=h.name+".shadowMap",f.map.depthTexture=new r_(r.x,r.y,1015),f.map.depthTexture.name=h.name+".shadowMapDepth",f.map.depthTexture.format=1026,f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003}else{h.isPointLight?(f.map=new nO(r.x),f.map.depthTexture=new ry(r.x,1014)):(f.map=new eP(r.x,r.y),f.map.depthTexture=new r_(r.x,r.y,1014)),f.map.depthTexture.name=h.name+".shadowMap",f.map.depthTexture.format=1026;let t=e.state.buffers.depth.getReversed();1===this.type?(f.map.depthTexture.compareFunction=t?518:515,f.map.depthTexture.minFilter=1006,f.map.depthTexture.magFilter=1006):(f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003)}f.camera.updateProjectionMatrix()}let v=f.map.isWebGLCubeRenderTarget?6:1;for(let n=0;n=1:-1!==P.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(P)[1])>=2);let I=null,L={},N=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),U=new eC().fromArray(N),O=new eC().fromArray(D);function F(t,n,i,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;sn||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<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 n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===o&&(o=f(n,a));let s=t?f(n,a):o;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),X("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}else"data"in e&&X("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function _(n,i,r,a,s=!1){if(null!==n){if(void 0!==e[n])return e[n];X("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGB8UI),r===e.UNSIGNED_SHORT&&(o=e.RGB16UI),r===e.UNSIGNED_INT&&(o=e.RGB32UI),r===e.BYTE&&(o=e.RGB8I),r===e.SHORT&&(o=e.RGB16I),r===e.INT&&(o=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),r===e.UNSIGNED_INT&&(o=e.RGBA32UI),r===e.BYTE&&(o=e.RGBA8I),r===e.SHORT&&(o=e.RGBA16I),r===e.INT&&(o=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),i===e.RGBA){let t=s?P:e_.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===I?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function y(t,n){let i;return t?null===n||1014===n||1020===n?i=e.DEPTH24_STENCIL8:1015===n?i=e.DEPTH32F_STENCIL8:1012===n&&(i=e.DEPTH24_STENCIL8,X("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||1014===n||1020===n?i=e.DEPTH_COMPONENT24:1015===n?i=e.DEPTH_COMPONENT32F:1012===n&&(i=e.DEPTH_COMPONENT16),i}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let n=e.source,r=d.get(n);if(r){let i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&M(e),0===Object.keys(r).length&&d.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function S(t){let n=t.target;n.removeEventListener("dispose",S),function(t){let n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i0&&l.__version!==t.version){let e=t.image;if(null===e)X("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void U(l,t,r);X("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(l.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+r)}let E={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},A={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},C={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function L(n,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&X("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,E[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,E[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,E[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,C[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||i.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}function N(t,n){let i,r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",b));let a=n.source,o=d.get(a);void 0===o&&(o={},d.set(a,o));let l=((i=[]).push(n.wrapS),i.push(n.wrapT),i.push(n.wrapR||0),i.push(n.magFilter),i.push(n.minFilter),i.push(n.anisotropy),i.push(n.internalFormat),i.push(n.format),i.push(n.type),i.push(n.generateMipmaps),i.push(n.premultiplyAlpha),i.push(n.flipY),i.push(n.unpackAlignment),i.push(n.colorSpace),i.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[l].usedTimes++;let i=o[t.__cacheKey];void 0!==i&&(o[t.__cacheKey].usedTimes--,0===i.usedTimes&&M(n)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return r}function D(e,t,n){return Math.floor(Math.floor(e/n)/t)}function U(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=N(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let h=i.get(c);if(c.version!==h.__version||!0===u){let t;n.activeTexture(e.TEXTURE0+o);let i=e_.getPrimaries(e_.workingColorSpace),d=""===s.colorSpace?null:e_.getPrimaries(s.colorSpace),p=""===s.colorSpace||i===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,r.maxTextureSize);f=j(s,f);let b=a.convert(s.format,s.colorSpace),S=a.convert(s.type),M=_(s.internalFormat,b,S,s.colorSpace,s.isVideoTexture);L(l,s);let w=s.mipmaps,T=!0!==s.isVideoTexture,E=void 0===h.__version||!0===u,A=c.dataReady,C=x(s,f);if(s.isDepthTexture)M=y(1027===s.format,s.type),E&&(T?n.texStorage2D(e.TEXTURE_2D,1,M,f.width,f.height):n.texImage2D(e.TEXTURE_2D,0,M,f.width,f.height,0,b,S,null));else if(s.isDataTexture)if(w.length>0){T&&E&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let i=0,r=w.length;ie.start-t.start);let o=0;for(let e=1;e0){let r=o4(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*r/t.data.BYTES_PER_ELEMENT,(a+1)*r/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,t.width,t.height,1,b,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,t.width,t.height,f.depth,b,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,M,t.width,t.height,f.depth,0,t.data,0,0);else X("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,t.width,t.height,f.depth,b,S,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,i,M,t.width,t.height,f.depth,0,b,S,t.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let i=0,r=w.length;i0){let t=o4(f.width,f.height,s.format,s.type);for(let i of s.layerUpdates){let r=f.data.subarray(i*t/f.data.BYTES_PER_ELEMENT,(i+1)*t/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,f.width,f.height,1,b,S,r)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,C,M,f.width,f.height,f.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)):n.texImage3D(e.TEXTURE_3D,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,C,M,f.width,f.height);else{let t=f.width,i=f.height;for(let r=0;r>=1,i>>=1}}else if(w.length>0){if(T&&E){let t=$(w[0]);n.texStorage2D(e.TEXTURE_2D,C,M,t.width,t.height)}for(let i=0,r=w.length;i>c),i=Math.max(1,r.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,i,r.depth,0,h,d,null):n.texImage2D(u,c,p,t,i,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),W(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,G(r)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function F(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=y(n.stencilBuffer,a),o=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;W(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,G(n),s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,G(n),s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=n.textures;for(let r=0;r{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)B(r.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?B(r.__webglFramebuffer[0],t,0):B(r.__webglFramebuffer,t,0)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),F(r.__webglDepthbuffer[i],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let i=t.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),F(r.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let V=[],H=[];function G(e){return Math.min(r.maxSamples,e.samples)}function W(e){let n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,t){let n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==R&&""!==n&&(e_.getTransfer(n)===I?(1023!==i||1009!==r)&&X("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):q("WebGLTextures: Unsupported texture color space:",n)),t}function $(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=w;return e>=r.maxTextures&&X("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?U(a,t,r):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r))},this.setTexture3D=function(t,r){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?U(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=i.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=N(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=i.get(u);if(u.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+o);let i=e_.getPrimaries(e_.workingColorSpace),h=""===s.colorSpace?null:e_.getPrimaries(s.colorSpace),d=""===s.colorSpace||i===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,y=[];for(let e=0;e<6;e++)p||f?y[e]=f?s.image[e].image:s.image[e]:y[e]=m(s.image[e],!0,r.maxCubemapSize),y[e]=j(s,y[e]);let b=y[0],S=a.convert(s.format,s.colorSpace),M=a.convert(s.type),w=_(s.internalFormat,S,M,s.colorSpace),T=!0!==s.isVideoTexture,E=void 0===c.__version||!0===l,A=u.dataReady,C=x(s,b);if(L(e.TEXTURE_CUBE_MAP,s),p){T&&E&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,b.width,b.height);for(let i=0;i<6;i++){t=y[i].mipmaps;for(let r=0;r0&&C++;let i=$(y[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,i.width,i.height)}for(let i=0;i<6;i++)if(f){T?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,y[i].width,y[i].height,S,M,y[i].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,w,y[i].width,y[i].height,0,S,M,y[i].data);for(let r=0;r1;if(!h&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===W(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0){if(!1===W(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=r.length>1;if(h)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n= 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 cd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let n=new rx(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new nC({vertexShader:cc,fragmentShader:ch,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new nb(new ag(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class cp extends Z{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null;const f="undefined"!=typeof XRWebGLBinding,m=new cd,g={},v=t.getContextAttributes();let _=null,y=null;const x=[],b=[],S=new eu;let M=null;const w=new nN;w.viewport=new eC;const T=new nN;T.viewport=new eC;const E=[w,T],A=new sz;let C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",L);for(let e=0;e=0&&(b[i]=null,x[i].disconnect(n))}for(let t=0;t=b.length){b.push(n),i=e;break}else if(null===b[e]){b[e]=n,i=e;break}if(-1===i)break}let r=x[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new nk,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&X("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&X("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(i,t)),c},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(null!==(i=u)){if(_=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",I),i.addEventListener("inputsourceschange",L),!0!==v.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?1027:1026,a=v.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=(c=this.getBinding()).createProjectionLayer(o),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),y=new eP(h.textureWidth,h.textureHeight,{format:1023,type:1009,depthTexture:new r_(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new eP(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}y.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),F.setContext(i),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const N=new eh,D=new eh;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,r;if(null===i)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=T.near=w.near=a,A.far=T.far=w.far=s,(C!==A.near||R!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,R=A.far),A.layers.mask=6|e.layers.mask,w.layers.mask=3&A.layers.mask,T.layers.mask=5&A.layers.mask;let o=e.parent,l=A.cameras;U(A,o);for(let e=0;e0&&(e.alphaTest.value=i.alphaTest);let r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,cf.copy(s),cf.x*=-1,cf.y*=-1,cf.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(cf.y*=-1,cf.z*=-1),e.envMapRotation.value.setFromMatrix4(cm.makeRotationFromEuler(cf)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,nE(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,u,c,h,d,p,f,m,g,v,_,y,x,b,S,M,w,T,E,A,C,R,P;let I;r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),l=e,(u=r).gradientMap&&(l.gradientMap.value=u.gradientMap)):r.isMeshPhongMaterial?(i(e,r),c=e,h=r,c.specular.value.copy(h.specular),c.shininess.value=Math.max(h.shininess,1e-4)):r.isMeshStandardMaterial?(i(e,r),d=e,p=r,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),r.isMeshPhysicalMaterial&&(f=e,m=r,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,f.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(i(e,r),v=e,(_=r).matcap&&(v.matcap.value=_.matcap)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),y=e,x=r,I=t.get(x).light,y.referencePosition.value.setFromMatrixPosition(I.matrixWorld),y.nearDistance.value=I.shadow.camera.near,y.farDistance.value=I.shadow.camera.far):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(b=e,S=r,b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,S.map&&(b.map.value=S.map,n(S.map,b.mapTransform)),r.isLineDashedMaterial&&(M=e,w=r,M.dashSize.value=w.dashSize,M.totalSize.value=w.dashSize+w.gapSize,M.scale.value=w.scale)):r.isPointsMaterial?(T=e,E=r,A=a,C=s,T.diffuse.value.copy(E.color),T.opacity.value=E.opacity,T.size.value=E.size*A,T.scale.value=.5*C,E.map&&(T.map.value=E.map,n(E.map,T.uvTransform)),E.alphaMap&&(T.alphaMap.value=E.alphaMap,n(E.alphaMap,T.alphaMapTransform)),E.alphaTest>0&&(T.alphaTest.value=E.alphaTest)):r.isSpriteMaterial?(R=e,P=r,R.diffuse.value.copy(P.color),R.opacity.value=P.opacity,R.rotation.value=P.rotation,P.map&&(R.map.value=P.map,n(P.map,R.mapTransform)),P.alphaMap&&(R.alphaMap.value=P.alphaMap,n(P.alphaMap,R.alphaMapTransform)),P.alphaTest>0&&(R.alphaTest.value=P.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function cv(e,t,n,i){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?X("WebGLRenderer: Texture samplers can not be part of an uniforms group."):X("WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){let n=t.target;n.removeEventListener("dispose",u);let i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;i.uniformBlockBinding(e,n)},update:function(n,c){var h;let d,p,f,m,g=r[n.id];void 0===g&&(function(e){let t=e.uniforms,n=0;for(let e=0,i=t.length;e0&&(n+=16-i),e.__size=n,e.__cache={}}(n),(h=n).__bindingPointIndex=d=function(){for(let e=0;ep.matrixWorld.determinant(),y=function(e,t,n,a,c){var h,d;!0!==t.isScene&&(t=eI),o.resetTextureUnits();let p=t.fog,m=a.isMeshStandardMaterial?t.environment:null,g=null===ea?et.outputColorSpace:!0===ea.isXRRenderTarget?ea.texture.colorSpace:R,_=(a.isMeshStandardMaterial?u:l).get(a.envMap||m),y=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,b=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!n.morphAttributes.position,M=!!n.morphAttributes.normal,w=!!n.morphAttributes.color,E=0;a.toneMapped&&(null===ea||!0===ea.isXRRenderTarget)&&(E=et.toneMapping);let A=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,C=void 0!==A?A.length:0,P=s.get(a),I=Z.state.lights;if(!0===ew&&(!0===eT||e!==eo)){let t=e===eo&&a.id===es;v.setState(a,e,t)}let L=!1;a.version===P.__version?P.needsLights&&P.lightsStateVersion!==I.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!==_||!0===a.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==v.numPlanes||P.numIntersection!==v.numIntersection)||P.vertexAlphas!==y||P.vertexTangents!==b||P.morphTargets!==S||P.morphNormals!==M||P.morphColors!==w||P.toneMapping!==E?L=!0:P.morphTargetsCount!==C&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=a.version);let N=P.currentProgram;!0===L&&(N=eK(a,t,c));let D=!1,U=!1,O=!1,F=N.getUniforms(),B=P.uniforms;if(r.useProgram(N.program)&&(D=!0,U=!0,O=!0),a.id!==es&&(es=a.id,U=!0),D||eo!==e){r.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),F.setValue(eD,"projectionMatrix",e.projectionMatrix),F.setValue(eD,"viewMatrix",e.matrixWorldInverse);let t=F.map.cameraPosition;void 0!==t&&t.setValue(eD,eA.setFromMatrixPosition(e.matrixWorld)),i.logarithmicDepthBuffer&&F.setValue(eD,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&F.setValue(eD,"isOrthographic",!0===e.isOrthographicCamera),eo!==e&&(eo=e,U=!0,O=!0)}if(P.needsLights&&(I.state.directionalShadowMap.length>0&&F.setValue(eD,"directionalShadowMap",I.state.directionalShadowMap,o),I.state.spotShadowMap.length>0&&F.setValue(eD,"spotShadowMap",I.state.spotShadowMap,o),I.state.pointShadowMap.length>0&&F.setValue(eD,"pointShadowMap",I.state.pointShadowMap,o)),c.isSkinnedMesh){F.setOptional(eD,c,"bindMatrix"),F.setOptional(eD,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),F.setValue(eD,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(F.setOptional(eD,c,"batchingTexture"),F.setValue(eD,"batchingTexture",c._matricesTexture,o),F.setOptional(eD,c,"batchingIdTexture"),F.setValue(eD,"batchingIdTexture",c._indirectTexture,o),F.setOptional(eD,c,"batchingColorTexture"),null!==c._colorsTexture&&F.setValue(eD,"batchingColorTexture",c._colorsTexture,o));let k=n.morphAttributes;if((void 0!==k.position||void 0!==k.normal||void 0!==k.color)&&x.update(c,n,N),(U||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,F.setValue(eD,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(B.envMap.value=_,B.flipEnvMap.value=_.isCubeTexture&&!1===_.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(B.envMapIntensity.value=t.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===cy&&((cy=new id(c_,16,16,1030,1016)).name="DFG_LUT",cy.minFilter=1006,cy.magFilter=1006,cy.wrapS=1001,cy.wrapT=1001,cy.generateMipmaps=!1,cy.needsUpdate=!0),cy)),U&&(F.setValue(eD,"toneMappingExposure",et.toneMappingExposure),P.needsLights&&(h=B,d=O,h.ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&f.refreshFogUniforms(B,p),f.refreshMaterialUniforms(B,a,eg,em,Z.state.transmissionRenderTarget[e.id]),uE.upload(eD,eQ(P),B,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(uE.upload(eD,eQ(P),B,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&F.setValue(eD,"center",c.center),F.setValue(eD,"modelViewMatrix",c.modelViewMatrix),F.setValue(eD,"normalMatrix",c.normalMatrix),F.setValue(eD,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,n=e.length;t{function i(){(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)?t(e):setTimeout(i,10)}null!==n.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)})};let eG=null;function eW(){e$.stop()}function ej(){e$.start()}const e$=new o6;function eX(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)Z.pushLight(e),e.castShadow&&Z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eM.intersectsSprite(e)){i&&eR.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eE);let t=d.update(e),r=e.material;r.visible&&j.push(e,t,r,n,eR.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||eM.intersectsObject(e))){let t=d.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eR.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eR.copy(t.boundingSphere.center)),eR.applyMatrix4(e.matrixWorld).applyMatrix4(eE)),Array.isArray(r)){let i=t.groups;for(let a=0,s=i.length;a0&&eJ(a,t,n),s.length>0&&eJ(s,t,n),o.length>0&&eJ(o,t,n),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eY(e,t,r,a){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;if(void 0===Z.state.transmissionRenderTarget[a.id]){let e=n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float");Z.state.transmissionRenderTarget[a.id]=new eP(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:i.samples,stencilBuffer:I,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:e_.workingColorSpace})}let s=Z.state.transmissionRenderTarget[a.id],l=a.viewport||el;s.setSize(l.z*et.transmissionResolutionScale,l.w*et.transmissionResolutionScale);let u=et.getRenderTarget(),c=et.getActiveCubeFace(),h=et.getActiveMipmapLevel();et.setRenderTarget(s),et.getClearColor(ed),(ep=et.getClearAlpha())<1&&et.setClearColor(0xffffff,.5),et.clear(),eL&&y.render(r);let d=et.toneMapping;et.toneMapping=0;let p=a.viewport;if(void 0!==a.viewport&&(a.viewport=void 0),Z.setupLightsView(a),!0===ew&&v.setGlobalState(et.clippingPlanes,a),eJ(e,r,a),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,i=t.length;n0)for(let t=0,a=r.length;t0&&eY(n,i,e,t),eL&&y.render(e),eq(j,e,t)}null!==ea&&0===er&&(o.updateMultisampleRenderTarget(ea),o.updateRenderTargetMipmap(ea)),i&&ee.end(et),!0===e.isScene&&e.onAfterRender(et,e,t),w.resetDefaultState(),es=-1,eo=null,Q.pop(),Q.length>0?(Z=Q[Q.length-1],!0===ew&&v.setGlobalState(et.clippingPlanes,Z.state.camera)):Z=null,K.pop(),j=K.length>0?K[K.length-1]:null},this.getActiveCubeFace=function(){return ei},this.getActiveMipmapLevel=function(){return er},this.getRenderTarget=function(){return ea},this.setRenderTargetTextures=function(e,t,n){let i=s.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=s.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const e1=eD.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){ea=e,ei=t,er=n;let i=null,a=!1,l=!1;if(e){let u=s.get(e);if(void 0!==u.__useDefaultFramebuffer){r.bindFramebuffer(eD.FRAMEBUFFER,u.__webglFramebuffer),el.copy(e.viewport),eu.copy(e.scissor),ec=e.scissorTest,r.viewport(el),r.scissor(eu),r.setScissorTest(ec),es=-1;return}if(void 0===u.__webglFramebuffer)o.setupRenderTarget(e);else if(u.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(u.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(l=!0);let h=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(h[t])?h[t][n]:h[t],a=!0):i=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(h)?h[n]:h,el.copy(e.viewport),eu.copy(e.scissor),ec=e.scissorTest}else el.copy(ex).multiplyScalar(eg).floor(),eu.copy(eb).multiplyScalar(eg).floor(),ec=eS;if(0!==n&&(i=e1),r.bindFramebuffer(eD.FRAMEBUFFER,i)&&r.drawBuffers(e,i),r.viewport(el),r.scissor(eu),r.setScissorTest(ec),a){let i=s.get(e.texture);eD.framebufferTexture2D(eD.FRAMEBUFFER,eD.COLOR_ATTACHMENT0,eD.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(l)for(let i=0;i=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&(e.textures.length>1&&eD.readBuffer(eD.COLOR_ATTACHMENT0+c),eD.readPixels(t,n,a,o,M.convert(s),M.convert(u),l))}finally{let e=null!==ea?s.get(ea).__webglFramebuffer:null;r.bindFramebuffer(eD.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,a,o,l,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h)if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o){r.bindFramebuffer(eD.FRAMEBUFFER,h);let u=e.textures[c],d=u.format,p=u.type;if(!i.textureFormatReadable(d))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!i.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=eD.createBuffer();eD.bindBuffer(eD.PIXEL_PACK_BUFFER,f),eD.bufferData(eD.PIXEL_PACK_BUFFER,l.byteLength,eD.STREAM_READ),e.textures.length>1&&eD.readBuffer(eD.COLOR_ATTACHMENT0+c),eD.readPixels(t,n,a,o,M.convert(d),M.convert(p),0);let m=null!==ea?s.get(ea).__webglFramebuffer:null;r.bindFramebuffer(eD.FRAMEBUFFER,m);let g=eD.fenceSync(eD.SYNC_GPU_COMMANDS_COMPLETE,0);return eD.flush(),await J(eD,g,4),eD.bindBuffer(eD.PIXEL_PACK_BUFFER,f),eD.getBufferSubData(eD.PIXEL_PACK_BUFFER,0,l),eD.deleteBuffer(f),eD.deleteSync(g),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,n=0){let i=Math.pow(2,-n),a=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eD.copyTexSubImage2D(eD.TEXTURE_2D,n,0,0,l,u,a,s),r.unbindTexture()};const e2=eD.createFramebuffer(),e3=eD.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,a=0,l=null){let u,c,h,d,p,f,m,g,v,_;null===l&&(0!==a?(Y("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),l=a,a=0):l=0);let y=e.isCompressedTexture?e.mipmaps[l]:e.image;if(null!==n)u=n.max.x-n.min.x,c=n.max.y-n.min.y,h=n.isBox3?n.max.z-n.min.z:1,d=n.min.x,p=n.min.y,f=n.isBox3?n.min.z:0;else{let t=Math.pow(2,-a);u=Math.floor(y.width*t),c=Math.floor(y.height*t),h=e.isDataArrayTexture?y.depth:e.isData3DTexture?Math.floor(y.depth*t):1,d=0,p=0,f=0}null!==i?(m=i.x,g=i.y,v=i.z):(m=0,g=0,v=0);let x=M.convert(t.format),b=M.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),_=eD.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),_=eD.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),_=eD.TEXTURE_2D),eD.pixelStorei(eD.UNPACK_FLIP_Y_WEBGL,t.flipY),eD.pixelStorei(eD.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eD.pixelStorei(eD.UNPACK_ALIGNMENT,t.unpackAlignment);let S=eD.getParameter(eD.UNPACK_ROW_LENGTH),w=eD.getParameter(eD.UNPACK_IMAGE_HEIGHT),T=eD.getParameter(eD.UNPACK_SKIP_PIXELS),E=eD.getParameter(eD.UNPACK_SKIP_ROWS),A=eD.getParameter(eD.UNPACK_SKIP_IMAGES);eD.pixelStorei(eD.UNPACK_ROW_LENGTH,y.width),eD.pixelStorei(eD.UNPACK_IMAGE_HEIGHT,y.height),eD.pixelStorei(eD.UNPACK_SKIP_PIXELS,d),eD.pixelStorei(eD.UNPACK_SKIP_ROWS,p),eD.pixelStorei(eD.UNPACK_SKIP_IMAGES,f);let C=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=s.get(e),i=s.get(t),o=s.get(n.__renderTarget),_=s.get(i.__renderTarget);r.bindFramebuffer(eD.READ_FRAMEBUFFER,o.__webglFramebuffer),r.bindFramebuffer(eD.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;nl_,"ShaderChunk",()=>o9,"ShaderLib",()=>le,"UniformsLib",()=>o7,"WebGLRenderer",()=>cx,"WebGLUtils",()=>cu],8560);var cb=e.i(30224);let cS=e=>{let t,n=new Set,i=(e,i)=>{let r="function"==typeof e?e(t):e;if(!Object.is(r,t)){let e=t;t=(null!=i?i:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,a={setState:i,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(i,r,a);return a},cM=e=>e?cS(e):cS;e.s(["createStore",()=>cM],8155);let{useSyncExternalStoreWithSelector:cw}=cb.default,cT=(e,t)=>{let n=cM(e),i=(e,i=t)=>(function(e,t=e=>e,n){let i=cw(e.subscribe,e.getState,e.getInitialState,t,n);return S.default.useDebugValue(i),i})(n,e,i);return Object.assign(i,n),i},cE=[];function cA(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let i=e.length;if(t.length!==i)return!1;for(let r=0;r0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,i.lifespan)),r.response;if(!n)throw r.promise}let r={keys:t,equal:i.equal,remove:()=>{let e=cE.indexOf(r);-1!==e&&cE.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{r.response=e,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(e=>r.error=e)};if(cE.push(r),!n)throw r.promise}var cR=e.i(98133),cP=e.i(95087),cI=e.i(43476),cL=S;function cN(e,t,n){if(!e)return;if(!0===n(e))return e;let i=t?e.return:e.child;for(;i;){let e=cN(i,t,n);if(e)return e;i=t?null:i.sibling}}function cD(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"undefined"!=typeof window&&((null==(y=window.document)?void 0:y.createElement)||(null==(x=window.navigator)?void 0:x.product)==="ReactNative")?cL.useLayoutEffect:cL.useEffect;let cU=cD(cL.createContext(null));class cO extends cL.Component{render(){return cL.createElement(cU.Provider,{value:this._reactInternals},this.props.children)}}function cF(){let e=cL.useContext(cU);if(null===e)throw Error("its-fine: useFiber must be called within a !");let t=cL.useId();return cL.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=cN(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let cB=Symbol.for("react.context"),ck=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===cB;function cz(){let e=function(){let e=cF(),[t]=cL.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;ck(e)&&e!==cU&&!t.has(e)&&t.set(e,cL.use(cD(e))),n=n.return}return t}();return cL.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>cL.createElement(t,null,cL.createElement(n.Provider,{...i,value:e.get(n)})),e=>cL.createElement(cO,{...e})),[e])}function cV(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}e.s(["FiberProvider",()=>cO,"traverseFiber",()=>cN,"useContextBridge",()=>cz,"useFiber",()=>cF],46791),S.act;let cH=e=>e&&e.hasOwnProperty("current"),cG=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),cW="undefined"!=typeof window&&((null==(m=window.document)?void 0:m.createElement)||(null==(g=window.navigator)?void 0:g.product)==="ReactNative")?S.useLayoutEffect:S.useEffect;function cj(e){let t=S.useRef(e);return cW(()=>void(t.current=e),[e]),t}function c$(){let e=cF(),t=cz();return S.useMemo(()=>({children:n})=>{let i=cN(e,!0,e=>e.type===S.StrictMode)?S.StrictMode:S.Fragment;return(0,cI.jsx)(i,{children:(0,cI.jsx)(t,{children:n})})},[e,t])}function cX({set:e}){return cW(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let cq=((v=class extends S.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}),v);function cY(e){var t;let n="undefined"!=typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function cJ(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let cZ={obj:e=>e===Object(e)&&!cZ.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,t,{arrays:n="shallow",objects:i="reference",strict:r=!0}={}){let a;if(typeof e!=typeof t||!!e!=!!t)return!1;if(cZ.str(e)||cZ.num(e)||cZ.boo(e))return e===t;let s=cZ.obj(e);if(s&&"reference"===i)return e===t;let o=cZ.arr(e);if(o&&"reference"===n)return e===t;if((o||s)&&e===t)return!0;for(a in e)if(!(a in t))return!1;if(s&&"shallow"===n&&"shallow"===i){for(a in r?t:e)if(!cZ.equ(e[a],t[a],{strict:r,objects:"reference"}))return!1}else for(a in r?t:e)if(e[a]!==t[a])return!1;if(cZ.und(a)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}},cK=["children","key","ref"];function cQ(e,t,n,i){let r=null==e?void 0:e.__r3f;return!r&&(r={root:t,type:n,parent:null,children:[],props:function(e){let t={};for(let n in e)cK.includes(n)||(t[n]=e[n]);return t}(i),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=r)),r}function c0(e,t){if(!t.includes("-")||t in e)return{root:e,key:t,target:e[t]};let n=e,i=t.split("-");for(let r of i){if("object"!=typeof n||null===n){if(void 0!==n)return{root:n,key:i.slice(i.indexOf(r)).join("-"),target:void 0};return{root:e,key:t,target:void 0}}t=r,e=n,n=n[t]}return{root:e,key:t,target:n}}let c1=/-\d+$/;function c2(e,t){if(cZ.str(t.props.attach)){if(c1.test(t.props.attach)){let n=t.props.attach.replace(c1,""),{root:i,key:r}=c0(e.object,n);Array.isArray(i[r])||(i[r]=[])}let{root:n,key:i}=c0(e.object,t.props.attach);t.previousAttach=n[i],n[i]=t.object}else cZ.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function c3(e,t){if(cZ.str(t.props.attach)){let{root:n,key:i}=c0(e.object,t.props.attach),r=t.previousAttach;void 0===r?delete n[i]:n[i]=r}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let c4=[...cK,"args","dispose","attach","object","onUpdate","dispose"],c5=new Map,c6=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],c8=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function c9(e,t){var n,i;let r=e.__r3f,a=r&&cV(r).getState(),s=null==r?void 0:r.eventCount;for(let n in t){let s=t[n];if(c4.includes(n))continue;if(r&&c8.test(n)){"function"==typeof s?r.handlers[n]=s:delete r.handlers[n],r.eventCount=Object.keys(r.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=c0(e,n);if(void 0===u&&("object"!=typeof o||null===o))throw Error(`R3F: Cannot set "${n}". Ensure it is an object before setting "${l}".`);u instanceof tu&&s instanceof tu?u.mask=s.mask:u instanceof tW&&cG(s)?u.set(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor?u.copy(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s)?"function"==typeof u.fromArray?u.fromArray(s):u.set(...s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s?"function"==typeof u.setScalar?u.setScalar(s):u.set(s):(o[l]=s,a&&!a.linear&&c6.includes(l)&&null!=(i=o[l])&&i.isTexture&&1023===o[l].format&&1009===o[l].type&&(o[l].colorSpace=C))}if(null!=r&&r.parent&&null!=a&&a.internal&&null!=(n=r.object)&&n.isObject3D&&s!==r.eventCount){let e=r.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),r.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return r&&void 0===r.props.attach&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&c7(r),e}function c7(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}let he=e=>null==e?void 0:e.isObject3D;function ht(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function hn(e,t,n,i){let r=n.get(t);r&&(n.delete(t),0===n.size&&(e.delete(i),r.target.releasePointerCapture(i)))}let hi=e=>!!(null!=e&&e.render),hr=S.createContext(null);function ha(){let e=S.useContext(hr);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function hs(e=e=>e,t){return ha()(e,t)}function ho(e,t=0){let n=ha(),i=n.getState().internal.subscribe,r=cj(e);return cW(()=>i(r,t,n),[t,i,n]),null}let hl=new WeakMap;function hu(e,t){return function(n,...i){var r;let a;return"function"==typeof n&&(null==n||null==(r=n.prototype)?void 0:r.constructor)===n?(a=hl.get(n))||(a=new n,hl.set(n,a)):a=n,e&&e(a),Promise.all(i.map(e=>new Promise((n,i)=>a.load(e,e=>{var t;let i;he(null==e?void 0:e.scene)&&Object.assign(e,(t=e.scene,i={nodes:{},materials:{},meshes:{}},t&&t.traverse(e=>{e.name&&(i.nodes[e.name]=e),e.material&&!i.materials[e.material.name]&&(i.materials[e.material.name]=e.material),e.isMesh&&!i.meshes[e.name]&&(i.meshes[e.name]=e)}),i)),n(e)},t,t=>i(Error(`Could not load ${e}: ${null==t?void 0:t.message}`))))))}}function hc(e,t,n,i){let r=Array.isArray(t)?t:[t],a=cC(hu(n,i),[e,...r],!1,{equal:cZ.equ});return Array.isArray(t)?a:a[0]}hc.preload=function(e,t,n){let i,r=Array.isArray(t)?t:[t];cC(hu(n),[e,...r],!0,i)},hc.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)cE.splice(0,cE.length);else{let e=cE.find(e=>cA(n,e.keys,e.equal));e&&e.remove()}};let hh={},hd=/^three(?=[A-Z])/,hp=e=>`${e[0].toUpperCase()}${e.slice(1)}`,hf=0;function hm(e){if("function"==typeof e){let t=`${hf++}`;return hh[t]=e,t}Object.assign(hh,e)}function hg(e,t){let n=hp(e),i=hh[n];if("primitive"!==e&&!i)throw Error(`R3F: ${n} 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&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function hv(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?c2(e.parent,e):he(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,c7(e)}}function h_(e,t,n){let i=t.root.getState();if(e.parent||e.object===i.scene){if(!t.object){var r,a;let e=hh[hp(t.type)];t.object=null!=(r=t.props.object)?r:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(c9(t.object,t.props),t.props.attach)c2(e,t);else if(he(t.object)&&he(e.object)){let i=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==i){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n{try{e.dispose()}catch{}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?t():(0,cP.unstable_scheduleCallback)(cP.unstable_IdlePriority,t)}}function hS(e,t,n){if(!t)return;t.parent=null;let i=e.children.indexOf(t);-1!==i&&e.children.splice(i,1),t.props.attach?c3(e,t):he(t.object)&&he(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,i)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(i)}),n.capturedMap.forEach((e,i)=>{hn(n.capturedMap,t,e,i)})}(cV(t),t.object));let r=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];hS(t,n,r)}t.children.length=0,delete t.object.__r3f,r&&"primitive"!==t.type&&"Scene"!==t.object.type&&hb(t.object),void 0===n&&c7(t)}let hM=[],hw=()=>{},hT={},hE=0,hA=(b={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var i;return hg(e=hp(e)in hh?e:e.replace(hd,""),t),"primitive"===e&&null!=(i=t.object)&&i.__r3f&&delete t.object.__r3f,cQ(t.object,n,e,t)},removeChild:hS,appendChild:hy,appendInitialChild:hy,insertBefore:hx,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&hy(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&hS(n,t)},insertInContainerBefore(e,t,n){let i=e.getState().scene.__r3f;t&&n&&i&&hx(i,t,n)},getRootHostContext:()=>hT,getChildHostContext:()=>hT,commitUpdate(e,t,n,i,r){var a,s,o;hg(t,i);let l=!1;if("primitive"===e.type&&n.object!==i.object||(null==(a=i.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)?l=!0:null!=(o=i.args)&&o.some((e,t)=>{var i;return e!==(null==(i=n.args)?void 0:i[t])})&&(l=!0),l)hM.push([e,{...i},r]);else{let t=function(e,t){let n={};for(let i in t)if(!c4.includes(i)&&!cZ.equ(t[i],e.props[i]))for(let e in n[i]=t[i],t)e.startsWith(`${i}-`)&&(n[e]=t[e]);for(let i in e.props){if(c4.includes(i)||t.hasOwnProperty(i))continue;let{root:r,key:a}=c0(e.object,i);if(r.constructor&&0===r.constructor.length){let e=function(e){let t=c5.get(e.constructor);try{t||(t=new e.constructor,c5.set(e.constructor,t))}catch(e){}return t}(r);cZ.und(e)||(n[a]=e[a])}else n[a]=0}return n}(e,i);Object.keys(t).length&&(Object.assign(e.props,t),c9(e.object,t))}(null===r.sibling||(4&r.flags)==0)&&function(){for(let[e]of hM){let t=e.parent;if(t)for(let n of(e.props.attach?c3(t,e):he(e.object)&&he(t.object)&&t.object.remove(e.object),e.children))n.props.attach?c3(e,n):he(n.object)&&he(e.object)&&e.object.remove(n.object);e.isHidden&&hv(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&hb(e.object)}for(let[i,r,a]of hM){i.props=r;let s=i.parent;if(s){let r=hh[hp(i.type)];i.object=null!=(e=i.props.object)?e:new r(...null!=(t=i.props.args)?t:[]),i.object.__r3f=i;var e,t,n=i.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(c9(i.object,i.props),i.props.attach?c2(s,i):he(i.object)&&he(s.object)&&s.object.add(i.object),i.children))e.props.attach?c2(i,e):he(e.object)&&he(i.object)&&i.object.add(e.object);c7(i)}}hM.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>cQ(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?c3(e.parent,e):he(e.object)&&(e.object.visible=!1),e.isHidden=!0,c7(e)}},unhideInstance:hv,createTextInstance:hw,hideTextInstance:hw,unhideTextInstance:hw,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:S.createContext(null),setCurrentUpdatePriority(e){hE=e},getCurrentUpdatePriority:()=>hE,resolveUpdatePriority(){var e;if(0!==hE)return hE;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"},(_=(0,cR.default)(b)).injectIntoDevTools(),_),hC=new Map,hR={objects:"shallow",strict:!1};function hP(e){var t,n;let i,r,a,s,o,l,u,c,h,d=hC.get(e),p=null==d?void 0:d.fiber,f=null==d?void 0:d.store;d&&console.warn("R3F.createRoot should only be called once!");let m="function"==typeof reportError?reportError:console.error,g=f||(t=hj,n=h$,u=(l=(o=(a=(e,i)=>{let r,a=new eh,s=new eh,o=new eh;function l(e=i().camera,t=s,n=i().size){let{width:r,height:u,top:c,left:h}=n,d=r/u;t.isVector3?o.copy(t):o.set(...t);let p=e.getWorldPosition(a).distanceTo(o);if(e&&e.isOrthographicCamera)return{width:r/e.zoom,height:u/e.zoom,top:c,left:h,factor:1,distance:p,aspect:d};{let t=2*Math.tan(e.fov*Math.PI/180/2)*p,n=r/u*t;return{width:n,height:t,top:c,left:h,factor:r/n,distance:p,aspect:d}}}let u=t=>e(e=>({performance:{...e.performance,current:t}})),c=new eu;return{set:e,get:i,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>t(i(),e),advance:(e,t)=>n(e,t,i()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new sV,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=i();r&&clearTimeout(r),e.performance.current!==e.performance.min&&u(e.performance.min),r=setTimeout(()=>u(i().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:l},setEvents:t=>e(e=>({...e,events:{...e.events,...t}})),setSize:(t,n,r=0,a=0)=>{let o=i().camera,u={width:t,height:n,top:r,left:a};e(e=>({size:u,viewport:{...e.viewport,...l(o,s,u)}}))},setDpr:t=>e(e=>{let n=cY(t);return{viewport:{...e.viewport,dpr:n,initialDpr:e.viewport.initialDpr||n}}}),setFrameloop:(t="always")=>{let n=i().clock;n.stop(),n.elapsedTime=0,"never"!==t&&(n.start(),n.elapsedTime=0),e(()=>({frameloop:t}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:S.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let r=i().internal;return r.priority=r.priority+ +(t>0),r.subscribers.push({ref:e,priority:t,store:n}),r.subscribers=r.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=i().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}})?cT(a,s):cT).getState()).size,c=l.viewport.dpr,h=l.camera,o.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:i,set:r}=o.getState();if(t.width!==u.width||t.height!==u.height||n.dpr!==c){u=t,c=n.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix());n.dpr>0&&i.setPixelRatio(n.dpr);let r="undefined"!=typeof HTMLCanvasElement&&i.domElement instanceof HTMLCanvasElement;i.setSize(t.width,t.height,r)}e!==h&&(h=e,r(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),o.subscribe(e=>t(e)),o),v=p||hA.createContainer(g,M.ConcurrentRoot,null,!1,null,"",m,m,m,null);d||hC.set(e,{fiber:v,store:g});let _=!1,y=null;return{async configure(t={}){var n,a;let s;y=new Promise(e=>s=e);let{gl:o,size:l,scene:u,events:c,onCreated:h,shadows:d=!1,linear:p=!1,flat:f=!1,legacy:m=!1,orthographic:v=!1,frameloop:x="always",dpr:b=[1,2],performance:S,raycaster:M,camera:w,onPointerMissed:T}=t,E=g.getState(),A=E.gl;if(!E.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"==typeof o?await o(t):o;A=hi(n)?n:new cx({...t,...o}),E.set({gl:A})}let P=E.raycaster;P||E.set({raycaster:P=new oc});let{params:I,...L}=M||{};if(cZ.equ(L,P,hR)||c9(P,{...L}),cZ.equ(I,P.params,hR)||c9(P,{params:{...P.params,...I}}),!E.camera||E.camera===r&&!cZ.equ(r,w,hR)){r=w;let e=null==w?void 0:w.isCamera,t=e?w:v?new sv(0,0,0,0,.1,1e3):new nN(75,0,.1,1e3);!e&&(t.position.z=5,w&&(c9(t,w),!t.manual&&("aspect"in w||"left"in w||"right"in w||"bottom"in w||"top"in w)&&(t.manual=!0,t.updateProjectionMatrix())),E.camera||null!=w&&w.rotation||t.lookAt(0,0,0)),E.set({camera:t}),P.camera=t}if(!E.scene){let e;null!=u&&u.isScene?cQ(e=u,g,"",{}):(cQ(e=new nH,g,"",{}),u&&c9(e,u)),E.set({scene:e})}c&&!E.events.handlers&&E.set({events:c(g)});let N=function(e,t){if(!t&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:i,left:r}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:r}}return!t&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,l);if(cZ.equ(N,E.size,hR)||E.setSize(N.width,N.height,N.top,N.left),b&&E.viewport.dpr!==cY(b)&&E.setDpr(b),E.frameloop!==x&&E.setFrameloop(x),E.onPointerMissed||E.set({onPointerMissed:T}),S&&!cZ.equ(S,E.performance,hR)&&E.set(e=>({performance:{...e.performance,...S}})),!E.xr){let e=(e,t)=>{let n=g.getState();"never"!==n.frameloop&&h$(e,!0,n,t)},t=()=>{let t=g.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||hj(t)},i={connect(){let e=g.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=g.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(n=A.xr)?void 0:n.addEventListener)&&i.connect(),E.set({xr:i})}if(A.shadowMap){let e=A.shadowMap.enabled,t=A.shadowMap.type;A.shadowMap.enabled=!!d,cZ.boo(d)?A.shadowMap.type=2:cZ.str(d)?A.shadowMap.type=null!=(a=({basic:0,percentage:1,soft:2,variance:3})[d])?a:2:cZ.obj(d)&&Object.assign(A.shadowMap,d),(e!==A.shadowMap.enabled||t!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return e_.enabled=!m,_||(A.outputColorSpace=p?R:C,A.toneMapping=4*!f),E.legacy!==m&&E.set(()=>({legacy:m})),E.linear!==p&&E.set(()=>({linear:p})),E.flat!==f&&E.set(()=>({flat:f})),!o||cZ.fun(o)||hi(o)||cZ.equ(o,A,hR)||c9(A,o),i=h,_=!0,s(),this},render(t){return _||y||this.configure(),y.then(()=>{hA.updateContainer((0,cI.jsx)(hI,{store:g,children:t,onCreated:i,rootElement:e}),v,null,()=>void 0)}),g},unmount(){hL(e)}}}function hI({store:e,children:t,onCreated:n,rootElement:i}){return cW(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(i)},[]),(0,cI.jsx)(hr.Provider,{value:e,children:t})}function hL(e,t){let n=hC.get(e),i=null==n?void 0:n.fiber;if(i){let r=null==n?void 0:n.store.getState();r&&(r.internal.active=!1),hA.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{null==r.events.disconnect||r.events.disconnect(),null==(n=r.gl)||null==(i=n.renderLists)||null==i.dispose||i.dispose(),null==(a=r.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=r.gl)&&s.xr&&r.xr.disconnect();var n,i,a,s,o=r.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}hC.delete(e),t&&t(e)}catch(e){}},500)})}}function hN(e,t){let n={callback:e};return t.add(n),()=>void t.delete(n)}let hD=new Set,hU=new Set,hO=new Set,hF=e=>hN(e,hD),hB=e=>hN(e,hU);function hk(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function hz(e,t){switch(e){case"before":return hk(hD,t);case"after":return hk(hU,t);case"tail":return hk(hO,t)}}function hV(e,t,n){let i=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(i=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),s=t.internal.subscribers;for(let e=0;e0)&&!(null!=(t=c.gl.xr)&&t.isPresenting)&&(l+=hV(e,c))}if(hG=!1,hz("after",e),0===l)return hz("tail",e),hH=!1,cancelAnimationFrame(u)}function hj(e,t=1){var n;if(!e)return hC.forEach(e=>hj(e.store.getState(),t));(null==(n=e.gl.xr)||!n.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(t>1?e.internal.frames=Math.min(60,e.internal.frames+t):hG?e.internal.frames=2:e.internal.frames=1,hH||(hH=!0,requestAnimationFrame(hW)))}function h$(e,t=!0,n,i){if(t&&hz("before",e),n)hV(e,n,i);else for(let t of hC.values())hV(e,t.store.getState());t&&hz("after",e)}let hX={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 hq(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let i=e.eventObject.__r3f;if(n.hovered.delete(ht(e)),null!=i&&i.eventCount){let n=i.handlers,r={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(r),null==n.onPointerLeave||n.onPointerLeave(r)}}}function i(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{let{internal:i}=e.getState();"pointerId"in t&&i.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{i.capturedMap.has(t.pointerId)&&(i.capturedMap.delete(t.pointerId),n([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===r,u="onClick"===r||"onContextMenu"===r||"onDoubleClick"===r,c=function(t,n){let i=e.getState(),r=new Set,a=[],s=n?n(i.internal.interaction):i.internal.interaction;for(let e=0;e{let n=cJ(e.object),i=cJ(t.object);return n&&i&&i.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=ht(e);return!r.has(t)&&(r.add(t),!0)});for(let e of(i.events.filter&&(o=i.events.filter(o,i)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&i.internal.capturedMap.has(t.pointerId))for(let e of i.internal.capturedMap.get(t.pointerId).values())r.has(ht(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),i=t.offsetX-n.initialClick[0],r=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(i*i+r*r))}(a):0;"onPointerDown"===r&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(i(a,o.interaction),s&&s(a)),l&&n(c),!function(e,t,i,r){if(e.length){let a={stopped:!1};for(let s of e){let o=cJ(s.object);if(o||s.object.traverseAncestors(e=>{let t=cJ(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:c,internal:h}=o,d=new eh(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},f=e=>{let n={intersection:s,target:t.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,n):h.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},m=e=>{let t=h.capturedMap.get(e);t&&hn(h.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:i,unprojectedPoint:d,ray:l.ray,camera:c,stopPropagation(){let i="pointerId"in t&&h.capturedMap.get(t.pointerId);(!i||i.has(s.eventObject))&&(v.stopped=a.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject)&&n([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(r(v),!0===a.stopped)break}}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let s=n.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=ht(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[r];n?(!u||o.initialHits.includes(t))&&(i(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&i(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(hX).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:i}=e.getState();null!=(t=i.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{let{set:n,events:i}=e.getState();if(null==i.disconnect||i.disconnect(),n(e=>({events:{...e.events,connected:t}})),i.handlers)for(let e in i.handlers){let n=i.handlers[e],[r,a]=hX[e];t.addEventListener(r,n,{passive:a})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[i]=hX[e];n.connected.removeEventListener(i,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>cX,"C",()=>hs,"D",()=>ho,"E",()=>cq,"G",()=>hc,"a",()=>cj,"b",()=>cW,"c",()=>hP,"d",()=>hL,"e",()=>hm,"f",()=>hq,"i",()=>cH,"j",()=>hF,"k",()=>hB,"u",()=>c$],91037)},53487,(e,t,n)=>{"use strict";let i="[^\\\\/]",r="[^/]",a="(?:\\/|$)",s="(?:^|\\/)",o=`\\.{1,2}${a}`,l=`(?!${s}${o})`,u=`(?!\\.{0,1}${a})`,c=`(?!${o})`,h=`${r}*?`,d={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:a,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:c,QMARK_NO_DOT:"[^.\\/]",STAR:h,START_ANCHOR:s,SEP:"/"},p={...d,SLASH_LITERAL:"[\\\\/]",QMARK:i,STAR:`${i}*?`,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:"\\"};t.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:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:d}},19241,(e,t,n)=>{"use strict";var i=e.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:o}=e.r(53487);n.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n.hasRegexChars=e=>s.test(e),n.isRegexChar=e=>1===e.length&&n.hasRegexChars(e),n.escapeRegex=e=>e.replace(o,"\\$1"),n.toPosixSlashes=e=>e.replace(r,"/"),n.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return void 0!==i.default&&!!i.default.platform&&"win32"===i.default.platform},n.removeBackslashes=e=>e.replace(a,e=>"\\"===e?"":e),n.escapeLast=(e,t,i)=>{let r=e.lastIndexOf(t,i);return -1===r?e:"\\"===e[r-1]?n.escapeLast(e,t,r-1):`${e.slice(0,r)}\\${e.slice(r)}`},n.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},n.wrapOutput=(e,t={},n={})=>{let i=n.contains?"":"^",r=n.contains?"":"$",a=`${i}(?:${e})${r}`;return!0===t.negated&&(a=`(?:^(?!${a}).*$)`),a},n.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:"/"),i=n[n.length-1];return""===i?n[n.length-2]:i}},26094,(e,t,n)=>{"use strict";let i=e.r(19241),{CHAR_ASTERISK:r,CHAR_AT:a,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:o,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:f,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:_}=e.r(53487),y=e=>e===c||e===s,x=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let n,b,S=t||{},M=e.length-1,w=!0===S.parts||!0===S.scanToEnd,T=[],E=[],A=[],C=e,R=-1,P=0,I=0,L=!1,N=!1,D=!1,U=!1,O=!1,F=!1,B=!1,k=!1,z=!1,V=!1,H=0,G={value:"",depth:0,isGlob:!1},W=()=>R>=M,j=()=>C.charCodeAt(R+1),$=()=>(n=b,C.charCodeAt(++R));for(;R0&&(q=C.slice(0,P),C=C.slice(P),I-=P),X&&!0===D&&I>0?(X=C.slice(0,I),Y=C.slice(I)):!0===D?(X="",Y=C):X=C,X&&""!==X&&"/"!==X&&X!==C&&y(X.charCodeAt(X.length-1))&&(X=X.slice(0,-1)),!0===S.unescape&&(Y&&(Y=i.removeBackslashes(Y)),X&&!0===B&&(X=i.removeBackslashes(X)));let J={prefix:q,input:e,start:P,base:X,glob:Y,isBrace:L,isBracket:N,isGlob:D,isExtglob:U,isGlobstar:O,negated:k,negatedExtglob:z};if(!0===S.tokens&&(J.maxDepth=0,y(b)||E.push(G),J.tokens=E),!0===S.parts||!0===S.tokens){let t;for(let n=0;n{"use strict";let i=e.r(53487),r=e.r(19241),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=i,c=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch(t){return e.map(e=>r.escapeRegex(e)).join("..")}return n},h=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{let n;if("string"!=typeof e)throw TypeError("Expected a string");e=u[e]||e;let p={...t},f="number"==typeof p.maxLength?Math.min(a,p.maxLength):a,m=e.length;if(m>f)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${f}`);let g={type:"bos",value:"",output:p.prepend||""},v=[g],_=p.capture?"":"?:",y=i.globChars(p.windows),x=i.extglobChars(y),{DOT_LITERAL:b,PLUS_LITERAL:S,SLASH_LITERAL:M,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:A,NO_DOTS_SLASH:C,QMARK:R,QMARK_NO_DOT:P,STAR:I,START_ANCHOR:L}=y,N=e=>`(${_}(?:(?!${L}${e.dot?T:b}).)*?)`,D=p.dot?"":E,U=p.dot?R:P,O=!0===p.bash?N(p):I;p.capture&&(O=`(${O})`),"boolean"==typeof p.noext&&(p.noextglob=p.noext);let F={input:e,index:-1,start:0,dot:!0===p.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};m=(e=r.removePrefix(e,F)).length;let B=[],k=[],z=[],V=g,H=()=>F.index===m-1,G=F.peek=(t=1)=>e[F.index+t],W=F.advance=()=>e[++F.index]||"",j=()=>e.slice(F.index+1),$=(e="",t=0)=>{F.consumed+=e,F.index+=t},X=e=>{F.output+=null!=e.output?e.output:e.value,$(e.value)},q=()=>{let e=1;for(;"!"===G()&&("("!==G(2)||"?"===G(3));)W(),F.start++,e++;return e%2!=0&&(F.negated=!0,F.start++,!0)},Y=e=>{F[e]++,z.push(e)},J=e=>{F[e]--,z.pop()},Z=e=>{if("globstar"===V.type){let t=F.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(F.output=F.output.slice(0,-V.output.length),V.type="star",V.value="*",V.output=O,F.output+=V.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),V&&"text"===V.type&&"text"===e.type){V.output=(V.output||V.value)+e.value,V.value+=e.value;return}e.prev=V,v.push(e),V=e},K=(e,t)=>{let n={...x[t],conditions:1,inner:""};n.prev=V,n.parens=F.parens,n.output=F.output;let i=(p.capture?"(":"")+n.open;Y("parens"),Z({type:e,value:t,output:F.output?"":w}),Z({type:"paren",extglob:!0,value:W(),output:i}),B.push(n)},Q=e=>{let i,r=e.close+(p.capture?")":"");if("negate"===e.type){let n=O;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=N(p)),(n!==O||H()||/^\)+$/.test(j()))&&(r=e.close=`)$))${n}`),e.inner.includes("*")&&(i=j())&&/^\.[^\\/.]+$/.test(i)){let a=d(i,{...t,fastpaths:!1}).output;r=e.close=`)${a})${n})`}"bos"===e.prev.type&&(F.negatedExtglob=!0)}Z({type:"paren",extglob:!0,value:n,output:r}),J("parens")};if(!1!==p.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(l,(e,t,i,r,a,s)=>"\\"===r?(n=!0,e):"?"===r?t?t+r+(a?R.repeat(a.length):""):0===s?U+(a?R.repeat(a.length):""):R.repeat(i.length):"."===r?b.repeat(i.length):"*"===r?t?t+r+(a?O:""):O:t?e:`\\${e}`);return(!0===n&&(i=!0===p.unescape?i.replace(/\\/g,""):i.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),i===e&&!0===p.contains)?F.output=e:F.output=r.wrapOutput(i,F,t),F}for(;!H();){if("\0"===(n=W()))continue;if("\\"===n){let e=G();if("/"===e&&!0!==p.bash||"."===e||";"===e)continue;if(!e){Z({type:"text",value:n+="\\"});continue}let t=/^\\+/.exec(j()),i=0;if(t&&t[0].length>2&&(i=t[0].length,F.index+=i,i%2!=0&&(n+="\\")),!0===p.unescape?n=W():n+=W(),0===F.brackets){Z({type:"text",value:n});continue}}if(F.brackets>0&&("]"!==n||"["===V.value||"[^"===V.value)){if(!1!==p.posix&&":"===n){let e=V.value.slice(1);if(e.includes("[")&&(V.posix=!0,e.includes(":"))){let e=V.value.lastIndexOf("["),t=V.value.slice(0,e),n=s[V.value.slice(e+2)];if(n){V.value=t+n,F.backtrack=!0,W(),g.output||1!==v.indexOf(V)||(g.output=w);continue}}}("["===n&&":"!==G()||"-"===n&&"]"===G())&&(n=`\\${n}`),"]"===n&&("["===V.value||"[^"===V.value)&&(n=`\\${n}`),!0===p.posix&&"!"===n&&"["===V.value&&(n="^"),V.value+=n,X({value:n});continue}if(1===F.quotes&&'"'!==n){n=r.escapeRegex(n),V.value+=n,X({value:n});continue}if('"'===n){F.quotes=+(1!==F.quotes),!0===p.keepQuotes&&Z({type:"text",value:n});continue}if("("===n){Y("parens"),Z({type:"paren",value:n});continue}if(")"===n){if(0===F.parens&&!0===p.strictBrackets)throw SyntaxError(h("opening","("));let e=B[B.length-1];if(e&&F.parens===e.parens+1){Q(B.pop());continue}Z({type:"paren",value:n,output:F.parens?")":"\\)"}),J("parens");continue}if("["===n){if(!0!==p.nobracket&&j().includes("]"))Y("brackets");else{if(!0!==p.nobracket&&!0===p.strictBrackets)throw SyntaxError(h("closing","]"));n=`\\${n}`}Z({type:"bracket",value:n});continue}if("]"===n){if(!0===p.nobracket||V&&"bracket"===V.type&&1===V.value.length){Z({type:"text",value:n,output:`\\${n}`});continue}if(0===F.brackets){if(!0===p.strictBrackets)throw SyntaxError(h("opening","["));Z({type:"text",value:n,output:`\\${n}`});continue}J("brackets");let e=V.value.slice(1);if(!0===V.posix||"^"!==e[0]||e.includes("/")||(n=`/${n}`),V.value+=n,X({value:n}),!1===p.literalBrackets||r.hasRegexChars(e))continue;let t=r.escapeRegex(V.value);if(F.output=F.output.slice(0,-V.value.length),!0===p.literalBrackets){F.output+=t,V.value=t;continue}V.value=`(${_}${t}|${V.value})`,F.output+=V.value;continue}if("{"===n&&!0!==p.nobrace){Y("braces");let e={type:"brace",value:n,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};k.push(e),Z(e);continue}if("}"===n){let e=k[k.length-1];if(!0===p.nobrace||!e){Z({type:"text",value:n,output:n});continue}let t=")";if(!0===e.dots){let e=v.slice(),n=[];for(let t=e.length-1;t>=0&&(v.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=c(n,p),F.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){let i=F.output.slice(0,e.outputIndex),r=F.tokens.slice(e.tokensIndex);for(let a of(e.value=e.output="\\{",n=t="\\}",F.output=i,r))F.output+=a.output||a.value}Z({type:"brace",value:n,output:t}),J("braces"),k.pop();continue}if("|"===n){B.length>0&&B[B.length-1].conditions++,Z({type:"text",value:n});continue}if(","===n){let e=n,t=k[k.length-1];t&&"braces"===z[z.length-1]&&(t.comma=!0,e="|"),Z({type:"comma",value:n,output:e});continue}if("/"===n){if("dot"===V.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",v.pop(),V=g;continue}Z({type:"slash",value:n,output:M});continue}if("."===n){if(F.braces>0&&"dot"===V.type){"."===V.value&&(V.output=b);let e=k[k.length-1];V.type="dots",V.output+=n,V.value+=n,e.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==V.type&&"slash"!==V.type){Z({type:"text",value:n,output:b});continue}Z({type:"dot",value:n,output:b});continue}if("?"===n){if(!(V&&"("===V.value)&&!0!==p.noextglob&&"("===G()&&"?"!==G(2)){K("qmark",n);continue}if(V&&"paren"===V.type){let e=G(),t=n;("("!==V.value||/[!=<:]/.test(e))&&("<"!==e||/<([!=]|\w+>)/.test(j()))||(t=`\\${n}`),Z({type:"text",value:n,output:t});continue}if(!0!==p.dot&&("slash"===V.type||"bos"===V.type)){Z({type:"qmark",value:n,output:P});continue}Z({type:"qmark",value:n,output:R});continue}if("!"===n){if(!0!==p.noextglob&&"("===G()&&("?"!==G(2)||!/[!=<:]/.test(G(3)))){K("negate",n);continue}if(!0!==p.nonegate&&0===F.index){q();continue}}if("+"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){K("plus",n);continue}if(V&&"("===V.value||!1===p.regex){Z({type:"plus",value:n,output:S});continue}if(V&&("bracket"===V.type||"paren"===V.type||"brace"===V.type)||F.parens>0){Z({type:"plus",value:n});continue}Z({type:"plus",value:S});continue}if("@"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){Z({type:"at",extglob:!0,value:n,output:""});continue}Z({type:"text",value:n});continue}if("*"!==n){("$"===n||"^"===n)&&(n=`\\${n}`);let e=o.exec(j());e&&(n+=e[0],F.index+=e[0].length),Z({type:"text",value:n});continue}if(V&&("globstar"===V.type||!0===V.star)){V.type="star",V.star=!0,V.value+=n,V.output=O,F.backtrack=!0,F.globstar=!0,$(n);continue}let t=j();if(!0!==p.noextglob&&/^\([^?]/.test(t)){K("star",n);continue}if("star"===V.type){if(!0===p.noglobstar){$(n);continue}let i=V.prev,r=i.prev,a="slash"===i.type||"bos"===i.type,s=r&&("star"===r.type||"globstar"===r.type);if(!0===p.bash&&(!a||t[0]&&"/"!==t[0])){Z({type:"star",value:n,output:""});continue}let o=F.braces>0&&("comma"===i.type||"brace"===i.type),l=B.length&&("pipe"===i.type||"paren"===i.type);if(!a&&"paren"!==i.type&&!o&&!l){Z({type:"star",value:n,output:""});continue}for(;"/**"===t.slice(0,3);){let n=e[F.index+4];if(n&&"/"!==n)break;t=t.slice(3),$("/**",3)}if("bos"===i.type&&H()){V.type="globstar",V.value+=n,V.output=N(p),F.output=V.output,F.globstar=!0,$(n);continue}if("slash"===i.type&&"bos"!==i.prev.type&&!s&&H()){F.output=F.output.slice(0,-(i.output+V.output).length),i.output=`(?:${i.output}`,V.type="globstar",V.output=N(p)+(p.strictSlashes?")":"|$)"),V.value+=n,F.globstar=!0,F.output+=i.output+V.output,$(n);continue}if("slash"===i.type&&"bos"!==i.prev.type&&"/"===t[0]){let e=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(i.output+V.output).length),i.output=`(?:${i.output}`,V.type="globstar",V.output=`${N(p)}${M}|${M}${e})`,V.value+=n,F.output+=i.output+V.output,F.globstar=!0,$(n+W()),Z({type:"slash",value:"/",output:""});continue}if("bos"===i.type&&"/"===t[0]){V.type="globstar",V.value+=n,V.output=`(?:^|${M}|${N(p)}${M})`,F.output=V.output,F.globstar=!0,$(n+W()),Z({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-V.output.length),V.type="globstar",V.output=N(p),V.value+=n,F.output+=V.output,F.globstar=!0,$(n);continue}let i={type:"star",value:n,output:O};if(!0===p.bash){i.output=".*?",("bos"===V.type||"slash"===V.type)&&(i.output=D+i.output),Z(i);continue}if(V&&("bracket"===V.type||"paren"===V.type)&&!0===p.regex){i.output=n,Z(i);continue}(F.index===F.start||"slash"===V.type||"dot"===V.type)&&("dot"===V.type?(F.output+=A,V.output+=A):!0===p.dot?(F.output+=C,V.output+=C):(F.output+=D,V.output+=D),"*"!==G()&&(F.output+=w,V.output+=w)),Z(i)}for(;F.brackets>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","]"));F.output=r.escapeLast(F.output,"["),J("brackets")}for(;F.parens>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing",")"));F.output=r.escapeLast(F.output,"("),J("parens")}for(;F.braces>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","}"));F.output=r.escapeLast(F.output,"{"),J("braces")}if(!0!==p.strictSlashes&&("star"===V.type||"bracket"===V.type)&&Z({type:"maybe_slash",value:"",output:`${M}?`}),!0===F.backtrack)for(let e of(F.output="",F.tokens))F.output+=null!=e.output?e.output:e.value,e.suffix&&(F.output+=e.suffix);return F};d.fastpaths=(e,t)=>{let n={...t},s="number"==typeof n.maxLength?Math.min(a,n.maxLength):a,o=e.length;if(o>s)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${s}`);e=u[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:p,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:g,START_ANCHOR:v}=i.globChars(n.windows),_=n.dot?f:p,y=n.dot?m:p,x=n.capture?"":"?:",b=!0===n.bash?".*?":g;n.capture&&(b=`(${b})`);let S=e=>!0===e.noglobstar?b:`(${x}(?:(?!${v}${e.dot?d:l}).)*?)`,M=e=>{switch(e){case"*":return`${_}${h}${b}`;case".*":return`${l}${h}${b}`;case"*.*":return`${_}${b}${l}${h}${b}`;case"*/*":return`${_}${b}${c}${h}${y}${b}`;case"**":return _+S(n);case"**/*":return`(?:${_}${S(n)}${c})?${y}${h}${b}`;case"**/*.*":return`(?:${_}${S(n)}${c})?${y}${b}${l}${h}${b}`;case"**/.*":return`(?:${_}${S(n)}${c})?${l}${h}${b}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=M(t[1]);if(!n)return;return n+l+t[2]}}},w=M(r.removePrefix(e,{negated:!1,prefix:""}));return w&&!0!==n.strictSlashes&&(w+=`${c}?`),w},t.exports=d},53174,(e,t,n)=>{"use strict";let i=e.r(26094),r=e.r(17932),a=e.r(19241),s=e.r(53487),o=(e,t,n=!1)=>{if(Array.isArray(e)){let i=e.map(e=>o(e,t,n));return e=>{for(let t of i){let n=t(e);if(n)return n}return!1}}let i=e&&"object"==typeof e&&!Array.isArray(e)&&e.tokens&&e.input;if(""===e||"string"!=typeof e&&!i)throw TypeError("Expected pattern to be a non-empty string");let r=t||{},a=r.windows,s=i?o.compileRe(e,t):o.makeRe(e,t,!1,!0),l=s.state;delete s.state;let u=()=>!1;if(r.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=o(r.ignore,e,n)}let c=(n,i=!1)=>{let{isMatch:c,match:h,output:d}=o.test(n,s,t,{glob:e,posix:a}),p={glob:e,state:l,regex:s,posix:a,input:n,output:d,match:h,isMatch:c};return("function"==typeof r.onResult&&r.onResult(p),!1===c)?(p.isMatch=!1,!!i&&p):u(n)?("function"==typeof r.onIgnore&&r.onIgnore(p),p.isMatch=!1,!!i&&p):("function"==typeof r.onMatch&&r.onMatch(p),!i||p)};return n&&(c.state=l),c};o.test=(e,t,n,{glob:i,posix:r}={})=>{if("string"!=typeof e)throw TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};let s=n||{},l=s.format||(r?a.toPosixSlashes:null),u=e===i,c=u&&l?l(e):e;return!1===u&&(u=(c=l?l(e):e)===i),(!1===u||!0===s.capture)&&(u=!0===s.matchBase||!0===s.basename?o.matchBase(e,t,n,r):t.exec(c)),{isMatch:!!u,match:u,output:c}},o.matchBase=(e,t,n)=>(t instanceof RegExp?t:o.makeRe(t,n)).test(a.basename(e)),o.isMatch=(e,t,n)=>o(t,n)(e),o.parse=(e,t)=>Array.isArray(e)?e.map(e=>o.parse(e,t)):r(e,{...t,fastpaths:!1}),o.scan=(e,t)=>i(e,t),o.compileRe=(e,t,n=!1,i=!1)=>{if(!0===n)return e.output;let r=t||{},a=r.contains?"":"^",s=r.contains?"":"$",l=`${a}(?:${e.output})${s}`;e&&!0===e.negated&&(l=`^(?!${l}).*$`);let u=o.toRegex(l,t);return!0===i&&(u.state=e),u},o.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||"string"!=typeof e)throw TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1!==t.fastpaths&&("."===e[0]||"*"===e[0])&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),o.compileRe(a,t,n,i)},o.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},o.constants=s,t.exports=o},54970,(e,t,n)=>{"use strict";let i=e.r(53174),r=e.r(19241);function a(e,t,n=!1){return t&&(null===t.windows||void 0===t.windows)&&(t={...t,windows:r.isWindows()}),i(e,t,n)}Object.assign(a,i),t.exports=a},98223,71726,91996,e=>{"use strict";function t(e){return e.split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["parseImageFileList",()=>t],98223);var n=e.i(87447);function i(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>i],71726);let r=n.default;function a(e){return i(e).toLowerCase()}function s(){return r.resources}function o(e){let[t,...n]=r.resources[e],[i,a]=n[n.length-1];return[i,a??t]}function l(e){let t=a(e);if(r.resources[t])return t;let n=t.replace(/\d+(\.(png))$/i,"$1");if(r.resources[n])return n;throw Error(`Resource not found in manifest: ${e}`)}function u(){return Object.keys(r.resources)}let c=["",".jpg",".png",".gif",".bmp"];function h(e){let t=a(e);for(let e of c){let n=`${t}${e}`;if(r.resources[n])return n}return t}function d(e){let t=r.missions[e];if(!t)throw Error(`Mission not found: ${e}`);return t}function p(){return Object.keys(r.missions)}e.s(["getActualResourceKey",()=>l,"getMissionInfo",()=>d,"getMissionList",()=>p,"getResourceKey",()=>a,"getResourceList",()=>u,"getResourceMap",()=>s,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>h],91996)},92552,(e,t,n)=>{"use strict";let i,r;function a(e,t){return t.reduce((e,[t,n])=>({type:"BinaryExpression",operator:t,left:e,right:n}),e)}function s(e,t){return{type:"UnaryExpression",operator:e,argument:t}}class o extends SyntaxError{constructor(e,t,n,i){super(e),this.expected=t,this.found=n,this.location=i,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let n=null,i=e.find(e=>e.source===this.location.source);i&&(n=i.text.split(/\r\n|\n|\r/g));let r=this.location.start,a=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,s=this.location.source+":"+a.line+":"+a.column;if(n){let e=this.location.end,i="".padEnd(a.line.toString().length," "),o=n[r.line-1],l=(r.line===e.line?e.column:o.length+1)-r.column||1;t+="\n --> "+s+"\n"+i+" |\n"+a.line+" | "+o+"\n"+i+" | "+"".padEnd(r.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+s}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let i=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(e){return i?e.replace(i,e=>"\\u{"+n(e)+"}"):e}function a(e){return r(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}function s(e){return r(e.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,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}let o={literal:e=>'"'+a(e.text)+'"',class(e){let t=e.parts.map(e=>Array.isArray(e)?s(e[0])+"-"+s(e[1]):s(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){let t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let n=1;n]/,C=/^[+\-]/,R=/^[%*\/]/,P=/^[!\-~]/,I=/^[a-zA-Z_]/,L=/^[a-zA-Z0-9_]/,N=/^[ \t]/,D=/^[^"\\\n\r]/,U=/^[^'\\\n\r]/,O=/^[0-9a-fA-F]/,F=/^[0-9]/,B=/^[xX]/,k=/^[^\n\r]/,z=/^[\n\r]/,V=/^[ \t\n\r]/,H=tE(";",!1),G=tE("package",!1),W=tE("{",!1),j=tE("}",!1),$=tE("function",!1),X=tE("(",!1),q=tE(")",!1),Y=tE("::",!1),J=tE(",",!1),Z=tE("datablock",!1),K=tE(":",!1),Q=tE("new",!1),ee=tE("[",!1),et=tE("]",!1),en=tE("=",!1),ei=tE(".",!1),er=tE("if",!1),ea=tE("else",!1),es=tE("for",!1),eo=tE("while",!1),el=tE("do",!1),eu=tE("switch$",!1),ec=tE("switch",!1),eh=tE("case",!1),ed=tE("default",!1),ep=tE("or",!1),ef=tE("return",!1),em=tE("break",!1),eg=tE("continue",!1),ev=tE("+=",!1),e_=tE("-=",!1),ey=tE("*=",!1),ex=tE("/=",!1),eb=tE("%=",!1),eS=tE("<<=",!1),eM=tE(">>=",!1),ew=tE("&=",!1),eT=tE("|=",!1),eE=tE("^=",!1),eA=tE("?",!1),eC=tE("||",!1),eR=tE("&&",!1),eP=tE("|",!1),eI=tE("^",!1),eL=tE("&",!1),eN=tE("==",!1),eD=tE("!=",!1),eU=tE("<=",!1),eO=tE(">=",!1),eF=tA(["<",">"],!1,!1,!1),eB=tE("$=",!1),ek=tE("!$=",!1),ez=tE("@",!1),eV=tE("NL",!1),eH=tE("TAB",!1),eG=tE("SPC",!1),eW=tE("<<",!1),ej=tE(">>",!1),e$=tA(["+","-"],!1,!1,!1),eX=tA(["%","*","/"],!1,!1,!1),eq=tA(["!","-","~"],!1,!1,!1),eY=tE("++",!1),eJ=tE("--",!1),eZ=tE("*",!1),eK=tE("%",!1),eQ=tA([["a","z"],["A","Z"],"_"],!1,!1,!1),e0=tA([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),e1=tE("$",!1),e2=tE("parent",!1),e3=tA([" "," "],!1,!1,!1),e4=tE('"',!1),e5=tE("'",!1),e6=tE("\\",!1),e8=tA(['"',"\\","\n","\r"],!0,!1,!1),e9=tA(["'","\\","\n","\r"],!0,!1,!1),e7=tE("n",!1),te=tE("r",!1),tt=tE("t",!1),tn=tE("x",!1),ti=tA([["0","9"],["a","f"],["A","F"]],!1,!1,!1),tr=tE("cr",!1),ta=tE("cp",!1),ts=tE("co",!1),to=tE("c",!1),tl=tA([["0","9"]],!1,!1,!1),tu={type:"any"},tc=tE("0",!1),th=tA(["x","X"],!1,!1,!1),td=tE("-",!1),tp=tE("true",!1),tf=tE("false",!1),tm=tE("//",!1),tg=tA(["\n","\r"],!0,!1,!1),tv=tA(["\n","\r"],!1,!1,!1),t_=tE("/*",!1),ty=tE("*/",!1),tx=tA([" "," ","\n","\r"],!1,!1,!1),tb=0|t.peg$currPos,tS=[{line:1,column:1}],tM=tb,tw=t.peg$maxFailExpected||[],tT=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in c))throw Error("Can't start parsing from rule \""+t.startRule+'".');h=c[t.startRule]}function tE(e,t){return{type:"literal",text:e,ignoreCase:t}}function tA(e,t,n,i){return{type:"class",parts:e,inverted:t,ignoreCase:n,unicode:i}}function tC(t){let n,i=tS[t];if(i)return i;if(t>=tS.length)n=tS.length-1;else for(n=t;!tS[--n];);for(i={line:(i=tS[n]).line,column:i.column};ntM&&(tM=tb,tw=[]),tw.push(e))}function tI(){let e,t,n;for(nh(),e=[],t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);t!==l;)e.push(t),t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);return{type:"Program",body:e.map(([e])=>e).filter(Boolean),execScriptPaths:Array.from(i),hasDynamicExec:r}}function tL(){let t,n,i,r,a,s,o,u,c,h,f,y,x,w,T,E,A;return(t=function(){let t,n,i,r,a,s,o,u;if(t=tb,e.substr(tb,7)===d?(n=d,tb+=7):(n=l,0===tT&&tP(G)),n!==l)if(nc()!==l)if((i=ni())!==l)if(nu(),123===e.charCodeAt(tb)?(r="{",tb++):(r=l,0===tT&&tP(W)),r!==l){for(nh(),a=[],s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);s!==l;)a.push(s),s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);(125===e.charCodeAt(tb)?(s="}",tb++):(s=l,0===tT&&tP(j)),s!==l)?(o=nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tT&&tP(H)),u===l&&(u=null),t={type:"PackageDeclaration",name:i,body:a.map(([e])=>e).filter(Boolean)}):(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s,o;if(t=tb,e.substr(tb,8)===p?(n=p,tb+=8):(n=l,0===tT&&tP($)),n!==l)if(nc()!==l)if((i=function(){let t,n,i,r;if(t=tb,(n=ni())!==l)if("::"===e.substr(tb,2)?(i="::",tb+=2):(i=l,0===tT&&tP(Y)),i!==l)if((r=ni())!==l)t={type:"MethodName",namespace:n,method:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=ni()),t}())!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tT&&tP(X)),r!==l)if(nu(),(a=function(){let t,n,i,r,a,s,o,u;if(t=tb,(n=ni())!==l){for(i=[],r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=ni())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=ni())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);t=[n,...i.map(([,,,e])=>e)]}else tb=t,t=l;return t}())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tT&&tP(q)),s!==l)if(nu(),(o=tV())!==l)t={type:"FunctionDeclaration",name:i,params:a||[],body:o};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&((i=tb,(r=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tT&&tP(H)),a===l&&(a=null),nu(),i=r):(tb=i,i=l),(t=i)===l&&((s=tb,(o=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tT&&tP(H)),u===l&&(u=null),nu(),s=o):(tb=s,s=l),(t=s)===l&&(t=function(){let t,n,i,r,a,s,o,u,c,h,d;if(t=tb,"if"===e.substr(tb,2)?(n="if",tb+=2):(n=l,0===tT&&tP(er)),n!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tT&&tP(X)),i!==l)if(nu(),(r=tH())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tT&&tP(q)),a!==l)if(nu(),(s=tL())!==l){var p;o=tb,u=nu(),e.substr(tb,4)===m?(c=m,tb+=4):(c=l,0===tT&&tP(ea)),c!==l?(h=nu(),(d=tL())!==l?o=u=[u,c,h,d]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),t={type:"IfStatement",test:r,consequent:s,alternate:(p=o)?p[3]:null}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s,o,u,c,h;if(t=tb,"for"===e.substr(tb,3)?(n="for",tb+=3):(n=l,0===tT&&tP(es)),n!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tT&&tP(X)),i!==l)if(nu(),(r=tH())===l&&(r=null),nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tT&&tP(H)),a!==l)if(nu(),(s=tH())===l&&(s=null),nu(),59===e.charCodeAt(tb)?(o=";",tb++):(o=l,0===tT&&tP(H)),o!==l)if(nu(),(u=tH())===l&&(u=null),nu(),41===e.charCodeAt(tb)?(c=")",tb++):(c=l,0===tT&&tP(q)),c!==l)if(nu(),(h=tL())!==l){var d,p;d=r,p=s,t={type:"ForStatement",init:d,test:p,update:u,body:h}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s,o,u;if(t=tb,"do"===e.substr(tb,2)?(n="do",tb+=2):(n=l,0===tT&&tP(el)),n!==l)if(nu(),(i=tL())!==l)if(nu(),e.substr(tb,5)===g?(r=g,tb+=5):(r=l,0===tT&&tP(eo)),r!==l)if(nu(),40===e.charCodeAt(tb)?(a="(",tb++):(a=l,0===tT&&tP(X)),a!==l)if(nu(),(s=tH())!==l)if(nu(),41===e.charCodeAt(tb)?(o=")",tb++):(o=l,0===tT&&tP(q)),o!==l)nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tT&&tP(H)),u===l&&(u=null),t={type:"DoWhileStatement",test:s,body:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s;if(t=tb,e.substr(tb,5)===g?(n=g,tb+=5):(n=l,0===tT&&tP(eo)),n!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tT&&tP(X)),i!==l)if(nu(),(r=tH())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tT&&tP(q)),a!==l)if(nu(),(s=tL())!==l)t={type:"WhileStatement",test:r,body:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s,o,u,c,h;if(t=tb,e.substr(tb,7)===v?(n=v,tb+=7):(n=l,0===tT&&tP(eu)),n!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tT&&tP(X)),i!==l)if(nu(),(r=tH())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tT&&tP(q)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tT&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tz()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tz()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tT&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([e])=>e).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,6)===_?(n=_,tb+=6):(n=l,0===tT&&tP(ec)),n!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tT&&tP(X)),i!==l)if(nu(),(r=tH())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tT&&tP(q)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tT&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tz()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tz()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tT&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([e])=>e).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a;if(t=tb,e.substr(tb,6)===b?(n=b,tb+=6):(n=l,0===tT&&tP(ef)),n!==l)if(i=tb,(r=nc())!==l&&(a=tH())!==l?i=r=[r,a]:(tb=i,i=l),i===l&&(i=null),r=nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tT&&tP(H)),a!==l){var s;t={type:"ReturnStatement",value:(s=i)?s[1]:null}}else tb=t,t=l;else tb=t,t=l;return t}())===l&&(c=tb,e.substr(tb,5)===S?(h=S,tb+=5):(h=l,0===tT&&tP(em)),h!==l?(nu(),59===e.charCodeAt(tb)?(f=";",tb++):(f=l,0===tT&&tP(H)),f!==l?c={type:"BreakStatement"}:(tb=c,c=l)):(tb=c,c=l),(t=c)===l&&(y=tb,e.substr(tb,8)===M?(x=M,tb+=8):(x=l,0===tT&&tP(eg)),x!==l?(nu(),59===e.charCodeAt(tb)?(w=";",tb++):(w=l,0===tT&&tP(H)),w!==l?y={type:"ContinueStatement"}:(tb=y,y=l)):(tb=y,y=l),(t=y)===l&&((T=tb,(E=tH())!==l&&(nu(),59===e.charCodeAt(tb)?(A=";",tb++):(A=l,0===tT&&tP(H)),A!==l))?T={type:"ExpressionStatement",expression:E}:(tb=T,T=l),(t=T)===l&&(t=tV())===l&&(t=nl())===l)))))&&(t=tb,nu(),59===e.charCodeAt(tb)?(n=";",tb++):(n=l,0===tT&&tP(H)),n!==l?(nu(),t=null):(tb=t,t=l)),t}function tN(){let t,n,i,r,a,s,o,u,c,h,d,p,m,g;if(t=tb,e.substr(tb,9)===f?(n=f,tb+=9):(n=l,0===tT&&tP(Z)),n!==l)if(nc()!==l)if((i=ni())!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tT&&tP(X)),r!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tT&&tP(q)),s!==l){var v,_,y;if(nu(),o=tb,58===e.charCodeAt(tb)?(u=":",tb++):(u=l,0===tT&&tP(K)),u!==l?(c=nu(),(h=ni())!==l?o=u=[u,c,h]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),u=nu(),c=tb,123===e.charCodeAt(tb)?(h="{",tb++):(h=l,0===tT&&tP(W)),h!==l){for(d=nu(),p=[],m=tU();m!==l;)p.push(m),m=tU();m=nu(),125===e.charCodeAt(tb)?(g="}",tb++):(g=l,0===tT&&tP(j)),g!==l?c=h=[h,d,p,m,g,nu()]:(tb=c,c=l)}else tb=c,c=l;c===l&&(c=null),v=a,_=o,y=c,t={type:"DatablockDeclaration",className:i,instanceName:v,parent:_?_[2]:null,body:y?y[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tD(){let t,n,i,r,a,s,o,u,c,h,d,p;if(t=tb,"new"===e.substr(tb,3)?(n="new",tb+=3):(n=l,0===tT&&tP(Q)),n!==l)if(nc()!==l)if((i=function(){let t,n,i,r,a,s,o,u,c,h;if((t=tb,40===e.charCodeAt(tb)?(n="(",tb++):(n=l,0===tT&&tP(X)),n!==l&&(i=nu(),(r=tH())!==l&&(a=nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tT&&tP(q)),s!==l)))?t=r:(tb=t,t=l),t===l)if(t=tb,(n=ni())!==l){var d;for(i=[],r=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tT&&tP(ee)),s!==l?(o=nu(),(u=tk())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tT&&tP(et)),h!==l?r=a=[a,s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tT&&tP(ee)),s!==l?(o=nu(),(u=tk())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tT&&tP(et)),h!==l?r=a=[a,s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);d=n,t=i.reduce((e,[,,,t])=>({type:"IndexExpression",object:e,index:t}),d)}else tb=t,t=l;return t}())!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tT&&tP(X)),r!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tT&&tP(q)),s!==l){var f;if(nu(),o=tb,123===e.charCodeAt(tb)?(u="{",tb++):(u=l,0===tT&&tP(W)),u!==l){for(c=nu(),h=[],d=tU();d!==l;)h.push(d),d=tU();d=nu(),125===e.charCodeAt(tb)?(p="}",tb++):(p=l,0===tT&&tP(j)),p!==l?o=u=[u,c,h,d,p,nu()]:(tb=o,o=l)}else tb=o,o=l;o===l&&(o=null),t={type:"ObjectDeclaration",className:i,instanceName:a,body:(f=o)?f[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tU(){let t,n,i;return(t=tb,(n=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(i=";",tb++):(i=l,0===tT&&tP(H)),i===l&&(i=null),nu(),t=n):(tb=t,t=l),t===l&&((t=tb,(n=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(i=";",tb++):(i=l,0===tT&&tP(H)),i===l&&(i=null),nu(),t=n):(tb=t,t=l),t===l&&(t=function(){let t,n,i,r,a;if(t=tb,nu(),(n=tF())!==l)if(nu(),61===e.charCodeAt(tb)?(i="=",tb++):(i=l,0===tT&&tP(en)),i!==l)if(nu(),(r=tH())!==l)nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tT&&tP(H)),a===l&&(a=null),nu(),t={type:"Assignment",target:n,value:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=nl())===l&&(t=function(){let t,n;if(t=[],n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx)),n!==l)for(;n!==l;)t.push(n),n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx));else t=l;return t!==l&&(t=null),t}())),t}function tO(){let e;return(e=tQ())===l&&(e=ni())===l&&(e=no()),e}function tF(){let e,t,n,i;if(e=tb,(t=t9())!==l){for(n=[],i=tB();i!==l;)n.push(i),i=tB();e=n.reduce((e,t)=>"property"===t.type?{type:"MemberExpression",object:e,property:t.value}:{type:"IndexExpression",object:e,index:t.value},t)}else tb=e,e=l;return e}function tB(){let t,n,i,r;return(t=tb,46===e.charCodeAt(tb)?(n=".",tb++):(n=l,0===tT&&tP(ei)),n!==l&&(nu(),(i=ni())!==l))?t={type:"property",value:i}:(tb=t,t=l),t===l&&((t=tb,91===e.charCodeAt(tb)?(n="[",tb++):(n=l,0===tT&&tP(ee)),n!==l&&(nu(),(i=tk())!==l&&(nu(),93===e.charCodeAt(tb)?(r="]",tb++):(r=l,0===tT&&tP(et)),r!==l)))?t={type:"index",value:i}:(tb=t,t=l)),t}function tk(){let t,n,i,r,a,s,o,u;if(t=tb,(n=tH())!==l){for(i=[],r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=tH())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=tH())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);t=i.length>0?[n,...i.map(([,,,e])=>e)]:n}else tb=t,t=l;return t}function tz(){let t,n,i,r,a,s,o,u,c;if(t=tb,e.substr(tb,4)===y?(n=y,tb+=4):(n=l,0===tT&&tP(eh)),n!==l)if(nc()!==l)if((i=function(){let t,n,i,r,a,s,o,u;if(t=tb,(n=t4())!==l){for(i=[],r=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tT&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?r=a=[a,s,o,u]:(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tT&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?r=a=[a,s,o,u]:(tb=r,r=l);t=i.length>0?[n,...i.map(([,,,e])=>e)]:n}else tb=t,t=l;return t}())!==l)if(nu(),58===e.charCodeAt(tb)?(r=":",tb++):(r=l,0===tT&&tP(K)),r!==l){for(a=nh(),s=[],o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);o!==l;)s.push(o),o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);t={type:"SwitchCase",test:i,consequent:s.map(([e])=>e).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,7)===x?(n=x,tb+=7):(n=l,0===tT&&tP(ed)),n!==l)if(nu(),58===e.charCodeAt(tb)?(i=":",tb++):(i=l,0===tT&&tP(K)),i!==l){for(nh(),r=[],a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);a!==l;)r.push(a),a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);t={type:"SwitchCase",test:null,consequent:r.map(([e])=>e).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;return t}function tV(){let t,n,i,r,a,s;if(t=tb,123===e.charCodeAt(tb)?(n="{",tb++):(n=l,0===tT&&tP(W)),n!==l){for(nh(),i=[],r=tb,(a=nl())===l&&(a=tL()),a!==l?r=a=[a,s=nh()]:(tb=r,r=l);r!==l;)i.push(r),r=tb,(a=nl())===l&&(a=tL()),a!==l?r=a=[a,s=nh()]:(tb=r,r=l);(125===e.charCodeAt(tb)?(r="}",tb++):(r=l,0===tT&&tP(j)),r!==l)?t={type:"BlockStatement",body:i.map(([e])=>e).filter(Boolean)}:(tb=t,t=l)}else tb=t,t=l;return t}function tH(){let t,n,i,r;if(t=tb,(n=tF())!==l)if(nu(),(i=tG())!==l)if(nu(),(r=tH())!==l)t={type:"AssignmentExpression",operator:i,target:n,value:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=function(){let t,n,i,r,a,s;if(t=tb,(n=tW())!==l)if(nu(),63===e.charCodeAt(tb)?(i="?",tb++):(i=l,0===tT&&tP(eA)),i!==l)if(nu(),(r=tH())!==l)if(nu(),58===e.charCodeAt(tb)?(a=":",tb++):(a=l,0===tT&&tP(K)),a!==l)if(nu(),(s=tH())!==l)t={type:"ConditionalExpression",test:n,consequent:r,alternate:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=tW()),t}()),t}function tG(){let t;return 61===e.charCodeAt(tb)?(t="=",tb++):(t=l,0===tT&&tP(en)),t===l&&("+="===e.substr(tb,2)?(t="+=",tb+=2):(t=l,0===tT&&tP(ev)),t===l&&("-="===e.substr(tb,2)?(t="-=",tb+=2):(t=l,0===tT&&tP(e_)),t===l&&("*="===e.substr(tb,2)?(t="*=",tb+=2):(t=l,0===tT&&tP(ey)),t===l&&("/="===e.substr(tb,2)?(t="/=",tb+=2):(t=l,0===tT&&tP(ex)),t===l&&("%="===e.substr(tb,2)?(t="%=",tb+=2):(t=l,0===tT&&tP(eb)),t===l&&("<<="===e.substr(tb,3)?(t="<<=",tb+=3):(t=l,0===tT&&tP(eS)),t===l&&(">>="===e.substr(tb,3)?(t=">>=",tb+=3):(t=l,0===tT&&tP(eM)),t===l&&("&="===e.substr(tb,2)?(t="&=",tb+=2):(t=l,0===tT&&tP(ew)),t===l&&("|="===e.substr(tb,2)?(t="|=",tb+=2):(t=l,0===tT&&tP(eT)),t===l&&("^="===e.substr(tb,2)?(t="^=",tb+=2):(t=l,0===tT&&tP(eE)))))))))))),t}function tW(){let t,n,i,r,s,o,u,c;if(t=tb,(n=tj())!==l){for(i=[],r=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tT&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tT&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,t])=>[e,t]))}else tb=t,t=l;return t}function tj(){let t,n,i,r,s,o,u,c;if(t=tb,(n=t$())!==l){for(i=[],r=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tT&&tP(eR)),o!==l?(u=nu(),(c=t$())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tT&&tP(eR)),o!==l?(u=nu(),(c=t$())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,t])=>[e,t]))}else tb=t,t=l;return t}function t$(){let t,n,i,r,s,o,u,c,h;if(t=tb,(n=tX())!==l){for(i=[],r=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tT&&tP(eP)),o!==l?(u=tb,tT++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tT&&tP(eP)),tT--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tX())!==l?r=s=[s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tT&&tP(eP)),o!==l?(u=tb,tT++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tT&&tP(eP)),tT--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tX())!==l?r=s=[s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,,t])=>[e,t]))}else tb=t,t=l;return t}function tX(){let t,n,i,r,s,o,u,c;if(t=tb,(n=tq())!==l){for(i=[],r=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tT&&tP(eI)),o!==l?(u=nu(),(c=tq())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tT&&tP(eI)),o!==l?(u=nu(),(c=tq())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,t])=>[e,t]))}else tb=t,t=l;return t}function tq(){let t,n,i,r,s,o,u,c,h;if(t=tb,(n=tY())!==l){for(i=[],r=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tT&&tP(eL)),o!==l?(u=tb,tT++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tT&&tP(eL)),tT--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tY())!==l?r=s=[s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tT&&tP(eL)),o!==l?(u=tb,tT++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tT&&tP(eL)),tT--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tY())!==l?r=s=[s,o,u,c,h]:(tb=r,r=l)):(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,,t])=>[e,t]))}else tb=t,t=l;return t}function tY(){let e,t,n,i,r,s,o,u;if(e=tb,(t=tZ())!==l){for(n=[],i=tb,r=nu(),(s=tJ())!==l?(o=nu(),(u=tZ())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)n.push(i),i=tb,r=nu(),(s=tJ())!==l?(o=nu(),(u=tZ())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);e=a(t,n.map(([,e,,t])=>[e,t]))}else tb=e,e=l;return e}function tJ(){let t;return"=="===e.substr(tb,2)?(t="==",tb+=2):(t=l,0===tT&&tP(eN)),t===l&&("!="===e.substr(tb,2)?(t="!=",tb+=2):(t=l,0===tT&&tP(eD))),t}function tZ(){let e,t,n,i,r,s,o,u;if(e=tb,(t=tQ())!==l){for(n=[],i=tb,r=nu(),(s=tK())!==l?(o=nu(),(u=tQ())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)n.push(i),i=tb,r=nu(),(s=tK())!==l?(o=nu(),(u=tQ())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);e=a(t,n.map(([,e,,t])=>[e,t]))}else tb=e,e=l;return e}function tK(){let t;return"<="===e.substr(tb,2)?(t="<=",tb+=2):(t=l,0===tT&&tP(eU)),t===l&&(">="===e.substr(tb,2)?(t=">=",tb+=2):(t=l,0===tT&&tP(eO)),t===l&&(t=e.charAt(tb),A.test(t)?tb++:(t=l,0===tT&&tP(eF)))),t}function tQ(){let e,t,n,i,r,s,o,u;if(e=tb,(t=t2())!==l){for(n=[],i=tb,r=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)n.push(i),i=tb,r=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);e=a(t,n.map(([,e,,t])=>[e,t]))}else tb=e,e=l;return e}function t0(){let e,t,n,i;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(i=tH())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:i};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t2()),e}function t1(){let t;return"$="===e.substr(tb,2)?(t="$=",tb+=2):(t=l,0===tT&&tP(eB)),t===l&&("!$="===e.substr(tb,3)?(t="!$=",tb+=3):(t=l,0===tT&&tP(ek)),t===l&&(64===e.charCodeAt(tb)?(t="@",tb++):(t=l,0===tT&&tP(ez)),t===l&&("NL"===e.substr(tb,2)?(t="NL",tb+=2):(t=l,0===tT&&tP(eV)),t===l&&("TAB"===e.substr(tb,3)?(t="TAB",tb+=3):(t=l,0===tT&&tP(eH)),t===l&&("SPC"===e.substr(tb,3)?(t="SPC",tb+=3):(t=l,0===tT&&tP(eG))))))),t}function t2(){let e,t,n,i,r,s,o,u;if(e=tb,(t=t4())!==l){for(n=[],i=tb,r=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)n.push(i),i=tb,r=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?i=r=[r,s,o,u]:(tb=i,i=l)):(tb=i,i=l);e=a(t,n.map(([,e,,t])=>[e,t]))}else tb=e,e=l;return e}function t3(){let t;return"<<"===e.substr(tb,2)?(t="<<",tb+=2):(t=l,0===tT&&tP(eW)),t===l&&(">>"===e.substr(tb,2)?(t=">>",tb+=2):(t=l,0===tT&&tP(ej))),t}function t4(){let t,n,i,r,s,o,u,c;if(t=tb,(n=t5())!==l){for(i=[],r=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tT&&tP(e$)),o!==l?(u=nu(),(c=t5())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tT&&tP(e$)),o!==l?(u=nu(),(c=t5())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,t])=>[e,t]))}else tb=t,t=l;return t}function t5(){let t,n,i,r,s,o,u,c;if(t=tb,(n=t6())!==l){for(i=[],r=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tT&&tP(eX)),o!==l?(u=nu(),(c=t6())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tT&&tP(eX)),o!==l?(u=nu(),(c=t6())!==l?r=s=[s,o,u,c]:(tb=r,r=l)):(tb=r,r=l);t=a(n,i.map(([,e,,t])=>[e,t]))}else tb=t,t=l;return t}function t6(){let t,n,i;return(t=tb,n=e.charAt(tb),P.test(n)?tb++:(n=l,0===tT&&tP(eq)),n!==l&&(nu(),(i=t8())!==l))?t=s(n,i):(tb=t,t=l),t===l&&((t=tb,"++"===e.substr(tb,2)?(n="++",tb+=2):(n=l,0===tT&&tP(eY)),n===l&&("--"===e.substr(tb,2)?(n="--",tb+=2):(n=l,0===tT&&tP(eJ))),n!==l&&(nu(),(i=t8())!==l))?t=s(n,i):(tb=t,t=l),t===l&&((t=tb,42===e.charCodeAt(tb)?(n="*",tb++):(n=l,0===tT&&tP(eZ)),n!==l&&(nu(),(i=t8())!==l))?t={type:"TagDereferenceExpression",argument:i}:(tb=t,t=l),t===l&&(t=function(){let t,n,i;if(t=tb,(n=t9())!==l)if(nu(),"++"===e.substr(tb,2)?(i="++",tb+=2):(i=l,0===tT&&tP(eY)),i===l&&("--"===e.substr(tb,2)?(i="--",tb+=2):(i=l,0===tT&&tP(eJ))),i!==l)t={type:"PostfixExpression",operator:i,argument:n};else tb=t,t=l;else tb=t,t=l;return t===l&&(t=t9()),t}()))),t}function t8(){let e,t,n,i;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(i=tH())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:i};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t6()),e}function t9(){let t,n,a,s,o,u,c,h,d,p;if(t=tb,(n=function(){let t,n,i,r,a,s,o,u,c,h,d,p,f,m,g,v;if(t=tb,(o=tD())===l&&(o=tN())===l&&(o=function(){let t,n,i,r;if(t=tb,34===e.charCodeAt(tb)?(n='"',tb++):(n=l,0===tT&&tP(e4)),n!==l){for(i=[],r=nr();r!==l;)i.push(r),r=nr();(34===e.charCodeAt(tb)?(r='"',tb++):(r=l,0===tT&&tP(e4)),r!==l)?t={type:"StringLiteral",value:i.join("")}:(tb=t,t=l)}else tb=t,t=l;if(t===l)if(t=tb,39===e.charCodeAt(tb)?(n="'",tb++):(n=l,0===tT&&tP(e5)),n!==l){for(i=[],r=na();r!==l;)i.push(r),r=na();(39===e.charCodeAt(tb)?(r="'",tb++):(r=l,0===tT&&tP(e5)),r!==l)?t={type:"StringLiteral",value:i.join(""),tagged:!0}:(tb=t,t=l)}else tb=t,t=l;return t}())===l&&(o=no())===l&&((u=tb,e.substr(tb,4)===T?(c=T,tb+=4):(c=l,0===tT&&tP(tp)),c===l&&(e.substr(tb,5)===E?(c=E,tb+=5):(c=l,0===tT&&tP(tf))),c!==l&&(h=tb,tT++,d=np(),tT--,d===l?h=void 0:(tb=h,h=l),h!==l))?u={type:"BooleanLiteral",value:"true"===c}:(tb=u,u=l),(o=u)===l&&((p=ne())===l&&(p=nt())===l&&(p=nn()),(o=p)===l))&&((f=tb,40===e.charCodeAt(tb)?(m="(",tb++):(m=l,0===tT&&tP(X)),m!==l&&(nu(),(g=tH())!==l&&(nu(),41===e.charCodeAt(tb)?(v=")",tb++):(v=l,0===tT&&tP(q)),v!==l)))?f=g:(tb=f,f=l),o=f),(n=o)!==l){for(i=[],r=tb,a=nu(),(s=tB())!==l?r=a=[a,s]:(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),(s=tB())!==l?r=a=[a,s]:(tb=r,r=l);t=i.reduce((e,[,t])=>"property"===t.type?{type:"MemberExpression",object:e,property:t.value}:{type:"IndexExpression",object:e,index:t.value},n)}else tb=t,t=l;return t}())!==l){for(a=[],s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tT&&tP(X)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tT&&tP(q)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tB())!==l?s=o=[o,u]:(tb=s,s=l));s!==l;)a.push(s),s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tT&&tP(X)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tT&&tP(q)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tB())!==l?s=o=[o,u]:(tb=s,s=l));t=a.reduce((e,t)=>{if("("===t[1]){var n;let[,,,a]=t;return n=a||[],"Identifier"===e.type&&"exec"===e.name.toLowerCase()&&(n.length>0&&"StringLiteral"===n[0].type?i.add(n[0].value):r=!0),{type:"CallExpression",callee:e,arguments:n}}let a=t[1];return"property"===a.type?{type:"MemberExpression",object:e,property:a.value}:{type:"IndexExpression",object:e,index:a.value}},n)}else tb=t,t=l;return t}function t7(){let t,n,i,r,a,s,o,u;if(t=tb,(n=tH())!==l){for(i=[],r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=tH())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tT&&tP(J)),s!==l?(o=nu(),(u=tH())!==l?r=a=[a,s,o,u]:(tb=r,r=l)):(tb=r,r=l);t=[n,...i.map(([,,,e])=>e)]}else tb=t,t=l;return t}function ne(){let t,n,i,r,a,s,o;if(t=tb,37===e.charCodeAt(tb)?(n="%",tb++):(n=l,0===tT&&tP(eK)),n!==l){if(i=tb,r=tb,a=e.charAt(tb),I.test(a)?tb++:(a=l,0===tT&&tP(eQ)),a!==l){for(s=[],o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tT&&tP(e0));o!==l;)s.push(o),o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tT&&tP(e0));r=a=[a,s]}else tb=r,r=l;(i=r!==l?e.substring(i,tb):r)!==l?t={type:"Variable",scope:"local",name:i}:(tb=t,t=l)}else tb=t,t=l;return t}function nt(){let t,n,i,r,a,s,o,u,c,h,d,p,f;if(t=tb,36===e.charCodeAt(tb)?(n="$",tb++):(n=l,0===tT&&tP(e1)),n!==l){if(i=tb,r=tb,"::"===e.substr(tb,2)?(a="::",tb+=2):(a=l,0===tT&&tP(Y)),a===l&&(a=null),s=e.charAt(tb),I.test(s)?tb++:(s=l,0===tT&&tP(eQ)),s!==l){for(o=[],u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tT&&tP(e0));u!==l;)o.push(u),u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tT&&tP(e0));if(u=[],c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tT&&tP(Y)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tT&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tT&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tT&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;for(;c!==l;)if(u.push(c),c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tT&&tP(Y)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tT&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tT&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tT&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;r=a=[a,s,o,u]}else tb=r,r=l;(i=r!==l?e.substring(i,tb):r)!==l?t={type:"Variable",scope:"global",name:i}:(tb=t,t=l)}else tb=t,t=l;return t}function nn(){let t,n,i,r,a,s,o,u,c,h,d;if(t=tb,n=tb,i=tb,e.substr(tb,6)===w?(r=w,tb+=6):(r=l,0===tT&&tP(e2)),r!==l){for(a=[],s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tT&&tP(e3));s!==l;)a.push(s),s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tT&&tP(e3));if("::"===e.substr(tb,2)?(s="::",tb+=2):(s=l,0===tT&&tP(Y)),s!==l){for(o=[],u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tT&&tP(e3));u!==l;)o.push(u),u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tT&&tP(e3));if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tT&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));i=r=[r,a,s,o,u,c]}else tb=i,i=l}else tb=i,i=l}else tb=i,i=l;if((n=i!==l?e.substring(n,tb):i)!==l&&(n={type:"Identifier",name:n.replace(/\s+/g,"")}),(t=n)===l){if(t=tb,n=tb,i=tb,e.substr(tb,6)===w?(r=w,tb+=6):(r=l,0===tT&&tP(e2)),r!==l){if(a=[],s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tT&&tP(Y)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tT&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;if(s!==l)for(;s!==l;)if(a.push(s),s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tT&&tP(Y)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tT&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tT&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;else a=l;a!==l?i=r=[r,a]:(tb=i,i=l)}else tb=i,i=l;if((n=i!==l?e.substring(n,tb):i)!==l&&(n={type:"Identifier",name:n}),(t=n)===l){if(t=tb,n=tb,i=tb,r=e.charAt(tb),I.test(r)?tb++:(r=l,0===tT&&tP(eQ)),r!==l){for(a=[],s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tT&&tP(e0));s!==l;)a.push(s),s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tT&&tP(e0));if(s=[],o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tT&&tP(Y)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tT&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tT&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tT&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;for(;o!==l;)if(s.push(o),o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tT&&tP(Y)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tT&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tT&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tT&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;i=r=[r,a,s]}else tb=i,i=l;(n=i!==l?e.substring(n,tb):i)!==l&&(n={type:"Identifier",name:n}),t=n}}return t}function ni(){let e;return(e=ne())===l&&(e=nt())===l&&(e=nn()),e}function nr(){let t,n,i;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tT&&tP(e6)),n!==l&&(i=ns())!==l)?t=i:(tb=t,t=l),t===l&&(t=e.charAt(tb),D.test(t)?tb++:(t=l,0===tT&&tP(e8))),t}function na(){let t,n,i;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tT&&tP(e6)),n!==l&&(i=ns())!==l)?t=i:(tb=t,t=l),t===l&&(t=e.charAt(tb),U.test(t)?tb++:(t=l,0===tT&&tP(e9))),t}function ns(){let t,n,i,r,a,s;return t=tb,110===e.charCodeAt(tb)?(n="n",tb++):(n=l,0===tT&&tP(e7)),n!==l&&(n="\n"),(t=n)===l&&(t=tb,114===e.charCodeAt(tb)?(n="r",tb++):(n=l,0===tT&&tP(te)),n!==l&&(n="\r"),(t=n)===l)&&(t=tb,116===e.charCodeAt(tb)?(n="t",tb++):(n=l,0===tT&&tP(tt)),n!==l&&(n=" "),(t=n)===l)&&((t=tb,120===e.charCodeAt(tb)?(n="x",tb++):(n=l,0===tT&&tP(tn)),n!==l&&(i=tb,r=tb,a=e.charAt(tb),O.test(a)?tb++:(a=l,0===tT&&tP(ti)),a!==l?(s=e.charAt(tb),O.test(s)?tb++:(s=l,0===tT&&tP(ti)),s!==l?r=a=[a,s]:(tb=r,r=l)):(tb=r,r=l),(i=r!==l?e.substring(i,tb):r)!==l))?t=String.fromCharCode(parseInt(i,16)):(tb=t,t=l),t===l&&(t=tb,"cr"===e.substr(tb,2)?(n="cr",tb+=2):(n=l,0===tT&&tP(tr)),n!==l&&(n="\x0f"),(t=n)===l&&(t=tb,"cp"===e.substr(tb,2)?(n="cp",tb+=2):(n=l,0===tT&&tP(ta)),n!==l&&(n="\x10"),(t=n)===l))&&(t=tb,"co"===e.substr(tb,2)?(n="co",tb+=2):(n=l,0===tT&&tP(ts)),n!==l&&(n="\x11"),(t=n)===l)&&((t=tb,99===e.charCodeAt(tb)?(n="c",tb++):(n=l,0===tT&&tP(to)),n!==l&&(i=e.charAt(tb),F.test(i)?tb++:(i=l,0===tT&&tP(tl)),i!==l))?t=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(i,10)]):(tb=t,t=l),t===l&&(t=tb,e.length>tb?(n=e.charAt(tb),tb++):(n=l,0===tT&&tP(tu)),t=n))),t}function no(){let t,n,i,r,a,s,o,u,c;if(t=tb,n=tb,i=tb,48===e.charCodeAt(tb)?(r="0",tb++):(r=l,0===tT&&tP(tc)),r!==l)if(a=e.charAt(tb),B.test(a)?tb++:(a=l,0===tT&&tP(th)),a!==l){if(s=[],o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tT&&tP(ti)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tT&&tP(ti));else s=l;s!==l?i=r=[r,a,s]:(tb=i,i=l)}else tb=i,i=l;else tb=i,i=l;if((n=i!==l?e.substring(n,tb):i)!==l&&(i=tb,tT++,r=np(),tT--,r===l?i=void 0:(tb=i,i=l),i!==l)?t={type:"NumberLiteral",value:parseInt(n,16)}:(tb=t,t=l),t===l){if(t=tb,n=tb,i=tb,45===e.charCodeAt(tb)?(r="-",tb++):(r=l,0===tT&&tP(td)),r===l&&(r=null),a=[],s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tT&&tP(tl)),s!==l)for(;s!==l;)a.push(s),s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tT&&tP(tl));else a=l;if(a!==l){if(s=tb,46===e.charCodeAt(tb)?(o=".",tb++):(o=l,0===tT&&tP(ei)),o!==l){if(u=[],c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tT&&tP(tl)),c!==l)for(;c!==l;)u.push(c),c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tT&&tP(tl));else u=l;u!==l?s=o=[o,u]:(tb=s,s=l)}else tb=s,s=l;s===l&&(s=null),i=r=[r,a,s]}else tb=i,i=l;if(i===l)if(i=tb,45===e.charCodeAt(tb)?(r="-",tb++):(r=l,0===tT&&tP(td)),r===l&&(r=null),46===e.charCodeAt(tb)?(a=".",tb++):(a=l,0===tT&&tP(ei)),a!==l){if(s=[],o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tT&&tP(tl)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tT&&tP(tl));else s=l;s!==l?i=r=[r,a,s]:(tb=i,i=l)}else tb=i,i=l;(n=i!==l?e.substring(n,tb):i)!==l&&(i=tb,tT++,r=np(),tT--,r===l?i=void 0:(tb=i,i=l),i!==l)?t={type:"NumberLiteral",value:parseFloat(n)}:(tb=t,t=l)}return t}function nl(){let t;return(t=function(){let t,n,i,r,a;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tT&&tP(tm)),n!==l){for(i=tb,r=[],a=e.charAt(tb),k.test(a)?tb++:(a=l,0===tT&&tP(tg));a!==l;)r.push(a),a=e.charAt(tb),k.test(a)?tb++:(a=l,0===tT&&tP(tg));i=e.substring(i,tb),r=e.charAt(tb),z.test(r)?tb++:(r=l,0===tT&&tP(tv)),r===l&&(r=null),t={type:"Comment",value:i}}else tb=t,t=l;return t}())===l&&(t=function(){let t,n,i,r,a,s,o;if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tT&&tP(t_)),n!==l){for(i=tb,r=[],a=tb,s=tb,tT++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tT&&tP(ty)),tT--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tT&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);a!==l;)r.push(a),a=tb,s=tb,tT++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tT&&tP(ty)),tT--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tT&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);(i=e.substring(i,tb),"*/"===e.substr(tb,2)?(r="*/",tb+=2):(r=l,0===tT&&tP(ty)),r!==l)?t={type:"Comment",value:i}:(tb=t,t=l)}else tb=t,t=l;return t}()),t}function nu(){let t,n;for(t=[],n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx)),n===l&&(n=nd());n!==l;)t.push(n),n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx)),n===l&&(n=nd());return t}function nc(){let t,n,i,r;if(t=tb,n=[],i=e.charAt(tb),V.test(i)?tb++:(i=l,0===tT&&tP(tx)),i!==l)for(;i!==l;)n.push(i),i=e.charAt(tb),V.test(i)?tb++:(i=l,0===tT&&tP(tx));else n=l;if(n!==l){for(i=[],r=e.charAt(tb),V.test(r)?tb++:(r=l,0===tT&&tP(tx)),r===l&&(r=nd());r!==l;)i.push(r),r=e.charAt(tb),V.test(r)?tb++:(r=l,0===tT&&tP(tx)),r===l&&(r=nd());t=n=[n,i]}else tb=t,t=l;return t}function nh(){let t,n;for(t=[],n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx));n!==l;)t.push(n),n=e.charAt(tb),V.test(n)?tb++:(n=l,0===tT&&tP(tx));return t}function nd(){let t,n,i,r,a,s;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tT&&tP(tm)),n!==l){for(i=[],r=e.charAt(tb),k.test(r)?tb++:(r=l,0===tT&&tP(tg));r!==l;)i.push(r),r=e.charAt(tb),k.test(r)?tb++:(r=l,0===tT&&tP(tg));r=e.charAt(tb),z.test(r)?tb++:(r=l,0===tT&&tP(tv)),r===l&&(r=null),t=n=[n,i,r]}else tb=t,t=l;if(t===l)if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tT&&tP(t_)),n!==l){for(i=[],r=tb,a=tb,tT++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tT&&tP(ty)),tT--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tT&&tP(tu)),s!==l?r=a=[a,s]:(tb=r,r=l)):(tb=r,r=l);r!==l;)i.push(r),r=tb,a=tb,tT++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tT&&tP(ty)),tT--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tT&&tP(tu)),s!==l?r=a=[a,s]:(tb=r,r=l)):(tb=r,r=l);"*/"===e.substr(tb,2)?(r="*/",tb+=2):(r=l,0===tT&&tP(ty)),r!==l?t=n=[n,i,r]:(tb=t,t=l)}else tb=t,t=l;return t}function np(){let t;return t=e.charAt(tb),L.test(t)?tb++:(t=l,0===tT&&tP(e0)),t}i=new Set,r=!1;let nf=(n=h())!==l&&tb===e.length;function nm(){var t,i,r;throw n!==l&&tb{"use strict";var t=e.i(90072);e.s(["parse",()=>E,"runServer",()=>A],86608);var n=e.i(92552);function i(e){let t=e.indexOf("::");return -1===t?null:{namespace:e.slice(0,t),method:e.slice(t+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class a{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(e={}){this.indent=e.indent??" ",this.runtime=e.runtime??"$",this.functions=e.functions??"$f",this.globals=e.globals??"$g",this.locals=e.locals??"$l"}getAccessInfo(e){if("Variable"===e.type){let t=JSON.stringify(e.name),n="global"===e.scope?this.globals:this.locals;return{getter:`${n}.get(${t})`,setter:e=>`${n}.set(${t}, ${e})`,postIncHelper:`${n}.postInc(${t})`,postDecHelper:`${n}.postDec(${t})`}}if("MemberExpression"===e.type){let t=this.expression(e.object),n="Identifier"===e.property.type?JSON.stringify(e.property.name):this.expression(e.property);return{getter:`${this.runtime}.prop(${t}, ${n})`,setter:e=>`${this.runtime}.setProp(${t}, ${n}, ${e})`,postIncHelper:`${this.runtime}.propPostInc(${t}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${t}, ${n})`}}if("IndexExpression"===e.type){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),i="global"===e.object.scope?this.globals:this.locals,r=t.join(", ");return{getter:`${i}.get(${n}, ${r})`,setter:e=>`${i}.set(${n}, ${r}, ${e})`,postIncHelper:`${i}.postInc(${n}, ${r})`,postDecHelper:`${i}.postDec(${n}, ${r})`}}if("MemberExpression"===e.object.type){let n=e.object,i=this.expression(n.object),r="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a=`${this.runtime}.key(${r}, ${t.join(", ")})`;return{getter:`${this.runtime}.prop(${i}, ${a})`,setter:e=>`${this.runtime}.setProp(${i}, ${a}, ${e})`,postIncHelper:`${this.runtime}.propPostInc(${i}, ${a})`,postDecHelper:`${this.runtime}.propPostDec(${i}, ${a})`}}let n=this.expression(e.object),i=1===t.length?t[0]:`${this.runtime}.key(${t.join(", ")})`;return{getter:`${this.runtime}.getIndex(${n}, ${i})`,setter:e=>`${this.runtime}.setIndex(${n}, ${i}, ${e})`,postIncHelper:`${this.runtime}.indexPostInc(${n}, ${i})`,postDecHelper:`${this.runtime}.indexPostDec(${n}, ${i})`}}return null}generate(e){let t=[];for(let n of e.body){let e=this.statement(n);e&&t.push(e)}return t.join("\n\n")}statement(e){switch(e.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(e.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(e);case"PackageDeclaration":return this.packageDeclaration(e);case"DatablockDeclaration":return this.datablockDeclaration(e);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(e)};`);case"IfStatement":return this.ifStatement(e);case"ForStatement":return this.forStatement(e);case"WhileStatement":return this.whileStatement(e);case"DoWhileStatement":return this.doWhileStatement(e);case"SwitchStatement":return this.switchStatement(e);case"ReturnStatement":return this.returnStatement(e);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(e);default:throw Error(`Unknown statement type: ${e.type}`)}}functionDeclaration(e){let t=i(e.name.name);if(t){let n=t.namespace,i=t.method;this.currentClass=n.toLowerCase(),this.currentFunction=i.toLowerCase();let r=this.functionBody(e.body,e.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(n)}, ${JSON.stringify(i)}, function() {`)} -${r} -${this.line("});")}`}{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(t)}, function() {`)} -${n} -${this.line("});")}`}}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let e=0;ethis.statement(e)).join("\n\n");return this.indentLevel--,`${this.line(`${this.runtime}.package(${t}, function() {`)} -${n} -${this.line("});")}`}datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):"null",i=e.parent?JSON.stringify(e.parent.name):"null",r=this.objectBody(e.body);return this.line(`${this.runtime}.datablock(${t}, ${n}, ${i}, ${r});`)}objectDeclaration(e){let t="Identifier"===e.className.type?JSON.stringify(e.className.name):this.expression(e.className),n=null===e.instanceName?"null":"Identifier"===e.instanceName.type?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),i=[],r=[];for(let t of e.body)"Assignment"===t.type?i.push(t):r.push(t);let a=this.objectBody(i);if(r.length>0){let e=r.map(e=>this.objectDeclaration(e)).join(",\n");return`${this.runtime}.create(${t}, ${n}, ${a}, [ -${e} -])`}return`${this.runtime}.create(${t}, ${n}, ${a})`}objectBody(e){if(0===e.length)return"{}";let t=[];for(let n of e)if("Assignment"===n.type){let e=this.expression(n.value);if("Identifier"===n.target.type){let i=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?t.push(`${i}: ${e}`):t.push(`[${JSON.stringify(i)}]: ${e}`)}else if("IndexExpression"===n.target.type){let i=this.objectPropertyKey(n.target);t.push(`[${i}]: ${e}`)}else{let i=this.expression(n.target);t.push(`[${i}]: ${e}`)}}if(t.length<=1)return`{ ${t.join(", ")} }`;let n=this.indent.repeat(this.indentLevel+1),i=this.indent.repeat(this.indentLevel);return`{ -${n}${t.join(",\n"+n)} -${i}}`}objectPropertyKey(e){let t="Identifier"===e.object.type?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(", "):this.expression(e.index);return`${this.runtime}.key(${t}, ${n})`}ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if("IfStatement"===e.alternate.type){let i=this.ifStatement(e.alternate).replace(/^\s*/,"");return this.line(`if (${t}) ${n} else ${i}`)}else{let i=this.statementAsBlock(e.alternate);return this.line(`if (${t}) ${n} else ${i}`)}return this.line(`if (${t}) ${n}`)}forStatement(e){let t=e.init?this.expression(e.init):"",n=e.test?this.expression(e.test):"",i=e.update?this.expression(e.update):"",r=this.statementAsBlock(e.body);return this.line(`for (${t}; ${n}; ${i}) ${r}`)}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line(`while (${t}) ${n}`)}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line(`do ${t} while (${n});`)}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--,`${this.line(`switch (${t}) {`)} -${n.join("\n")} -${this.line("}")}`}switchCase(e){let t=[];if(null===e.test)t.push(this.line("default:"));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line(`case ${this.expression(n)}:`));else t.push(this.line(`case ${this.expression(e.test)}:`));for(let n of(this.indentLevel++,e.consequent))t.push(this.statement(n));return t.push(this.line("break;")),this.indentLevel--,t.join("\n")}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(null===t.test)n.push(`default: () => { ${this.blockContent(t.consequent)} }`);else if(Array.isArray(t.test))for(let e of t.test)n.push(`${this.expression(e)}: () => { ${this.blockContent(t.consequent)} }`);else n.push(`${this.expression(t.test)}: () => { ${this.blockContent(t.consequent)} }`);return this.line(`${this.runtime}.switchStr(${t}, { ${n.join(", ")} });`)}returnStatement(e){return e.value?this.line(`return ${this.expression(e.value)};`):this.line("return;")}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join("\n");return this.indentLevel--,`{ -${t} -${this.line("}")}`}statementAsBlock(e){if("BlockStatement"===e.type)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--,`{ -${t} -${this.line("}")}`}blockContent(e){return e.map(e=>this.statement(e).trim()).join(" ")}expression(e){switch(e.type){case"Identifier":return this.identifier(e);case"Variable":return this.variable(e);case"NumberLiteral":case"BooleanLiteral":return String(e.value);case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":return this.binaryExpression(e);case"UnaryExpression":return this.unaryExpression(e);case"PostfixExpression":return this.postfixExpression(e);case"AssignmentExpression":return this.assignmentExpression(e);case"ConditionalExpression":return`(${this.expression(e.test)} ? ${this.expression(e.consequent)} : ${this.expression(e.alternate)})`;case"CallExpression":return this.callExpression(e);case"MemberExpression":return this.memberExpression(e);case"IndexExpression":return this.indexExpression(e);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(e.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(e);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(e.className.name)}, ${e.instanceName?JSON.stringify(e.instanceName.name):"null"}, ${e.parent?JSON.stringify(e.parent.name):"null"}, ${this.objectBody(e.body)})`;default:throw Error(`Unknown expression type: ${e.type}`)}}identifier(e){let t=i(e.name);return t&&"parent"===t.namespace.toLowerCase()?e.name:t?`${this.runtime}.nsRef(${JSON.stringify(t.namespace)}, ${JSON.stringify(t.method)})`:JSON.stringify(e.name)}variable(e){return"global"===e.scope?`${this.globals}.get(${JSON.stringify(e.name)})`:`${this.locals}.get(${JSON.stringify(e.name)})`}binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),i=e.operator,a=this.concatExpression(t,i,n);if(a)return a;if("$="===i)return`${this.runtime}.streq(${t}, ${n})`;if("!$="===i)return`!${this.runtime}.streq(${t}, ${n})`;if("&&"===i||"||"===i)return`(${t} ${i} ${n})`;let s=r[i];return s?`${s}(${t}, ${n})`:`(${t} ${i} ${n})`}unaryExpression(e){if("++"===e.operator||"--"===e.operator){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?1:-1;return t.setter(`${this.runtime}.add(${t.getter}, ${n})`)}}let t=this.expression(e.argument);return"~"===e.operator?`${this.runtime}.bitnot(${t})`:"-"===e.operator?`${this.runtime}.neg(${t})`:`${e.operator}${t}`}postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?t.postIncHelper:t.postDecHelper;if(n)return n}return`${this.expression(e.argument)}${e.operator}`}assignmentExpression(e){let t=this.expression(e.value),n=e.operator,i=this.getAccessInfo(e.target);if(!i)throw Error(`Unhandled assignment target type: ${e.target.type}`);if("="===n)return i.setter(t);{let e=n.slice(0,-1),r=this.compoundAssignmentValue(i.getter,e,t);return i.setter(r)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(", ");if("Identifier"===e.callee.type){let n=e.callee.name,r=i(n);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${t?", "+t:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${t?", "+t:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${t?", "+t:""})`:`${this.functions}.call(${JSON.stringify(n)}${t?", "+t:""})`}if("MemberExpression"===e.callee.type){let n=this.expression(e.callee.object),i="Identifier"===e.callee.property.type?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return`${this.runtime}.call(${n}, ${i}${t?", "+t:""})`}let n=this.expression(e.callee);return`${n}(${t})`}memberExpression(e){let t=this.expression(e.object);return e.computed||"Identifier"!==e.property.type?`${this.runtime}.prop(${t}, ${this.expression(e.property)})`:`${this.runtime}.prop(${t}, ${JSON.stringify(e.property.name)})`}indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),i="global"===e.object.scope?this.globals:this.locals;return`${i}.get(${n}, ${t.join(", ")})`}if("MemberExpression"===e.object.type){let n=e.object,i=this.expression(n.object),r="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a=`${this.runtime}.key(${r}, ${t.join(", ")})`;return`${this.runtime}.prop(${i}, ${a})`}let n=this.expression(e.object);return 1===t.length?`${this.runtime}.getIndex(${n}, ${t[0]})`:`${this.runtime}.getIndex(${n}, ${this.runtime}.key(${t.join(", ")}))`}line(e){return this.indent.repeat(this.indentLevel)+e}concatExpression(e,t,n){switch(t){case"@":return`${this.runtime}.concat(${e}, ${n})`;case"SPC":return`${this.runtime}.concat(${e}, " ", ${n})`;case"TAB":return`${this.runtime}.concat(${e}, "\\t", ${n})`;case"NL":return`${this.runtime}.concat(${e}, "\\n", ${n})`;default:return null}}compoundAssignmentValue(e,t,n){let i=this.concatExpression(e,t,n);if(i)return i;let a=r[t];return a?`${a}(${e}, ${n})`:`(${e} ${t} ${n})`}}e.s(["createRuntime",()=>w,"createScriptCache",()=>x],33870);var s=e.i(54970);class o{map=new Map;keyLookup=new Map;constructor(e){if(e)for(const[t,n]of e)this.set(t,n)}get size(){return this.map.size}get(e){let t=this.keyLookup.get(e.toLowerCase());return void 0!==t?this.map.get(t):void 0}set(e,t){let n=e.toLowerCase(),i=this.keyLookup.get(n);return void 0!==i?this.map.set(i,t):(this.keyLookup.set(n,e),this.map.set(e,t)),this}has(e){return this.keyLookup.has(e.toLowerCase())}delete(e){let t=e.toLowerCase(),n=this.keyLookup.get(t);return void 0!==n&&(this.keyLookup.delete(t),this.map.delete(n))}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(e){for(let[t,n]of this.map)e(n,t,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(e){return this.keyLookup.get(e.toLowerCase())}}class l{set=new Set;constructor(e){if(e)for(const t of e)this.add(t)}get size(){return this.set.size}add(e){return this.set.add(e.toLowerCase()),this}has(e){return this.set.has(e.toLowerCase())}delete(e){return this.set.delete(e.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function u(e){return e.replace(/\\/g,"/").toLowerCase()}function c(e){return String(e??"")}function h(e){return Number(e)||0}function d(e){let t=c(e||"0 0 0").split(" ").map(Number);return[t[0]||0,t[1]||0,t[2]||0]}function p(e,t,n){let i=0;for(;t+i0;){if(i>=e.length)return"";let r=p(e,i,n);if(i+r>=e.length)return"";i+=r+1,t--}let r=p(e,i,n);return 0===r?"":e.substring(i,i+r)}function m(e,t,n,i){let r=0,a=t;for(;a>0;){if(r>=e.length)return"";let t=p(e,r,i);if(r+t>=e.length)return"";r+=t+1,a--}let s=r,o=n-t+1;for(;o>0;){let t=p(e,r,i);if((r+=t)>=e.length)break;r++,o--}let l=r;return l>s&&i.includes(e[l-1])&&l--,e.substring(s,l)}function g(e,t){if(""===e)return 0;let n=0;for(let i=0;it&&s>=e.length)break}return a.join(r)}function _(e,t,n,i){let r=[],a=0,s=0;for(;at().$f.call(c(e),...n),eval(e){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:e=>c(e).replace(/\\([ntr\\])/g,(e,t)=>"n"===t?"\n":"t"===t?" ":"r"===t?"\r":"\\"),expandescape:e=>c(e).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(e,t,n){console.warn(`export(${e}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(e){},isobject:e=>t().$.isObject(e),nametoid:e=>t().$.nameToId(e),strlen:e=>c(e).length,strchr(e,t){let n=c(e),i=c(t)[0]??"",r=n.indexOf(i);return r>=0?n.substring(r):""},strpos:(e,t,n)=>c(e).indexOf(c(t),h(n)),strcmp(e,t){let n=c(e),i=c(t);return ni)},stricmp(e,t){let n=c(e).toLowerCase(),i=c(t).toLowerCase();return ni)},strstr:(e,t)=>c(e).indexOf(c(t)),getsubstr(e,t,n){let i=c(e),r=h(t);return void 0===n?i.substring(r):i.substring(r,r+h(n))},getword:(e,t)=>f(c(e),h(t)," \n"),getwordcount:e=>g(c(e)," \n"),getfield:(e,t)=>f(c(e),h(t)," \n"),getfieldcount:e=>g(c(e)," \n"),setword:(e,t,n)=>v(c(e),h(t),c(n)," \n"," "),setfield:(e,t,n)=>v(c(e),h(t),c(n)," \n"," "),firstword:e=>f(c(e),0," \n"),restwords:e=>m(c(e),1,1e6," \n"),trim:e=>c(e).trim(),ltrim:e=>c(e).replace(/^\s+/,""),rtrim:e=>c(e).replace(/\s+$/,""),strupr:e=>c(e).toUpperCase(),strlwr:e=>c(e).toLowerCase(),strreplace:(e,t,n)=>c(e).split(c(t)).join(c(n)),filterstring:(e,t)=>c(e),stripchars(e,t){let n=c(e),i=new Set(c(t).split(""));return n.split("").filter(e=>!i.has(e)).join("")},getfields(e,t,n){let i=void 0!==n?Number(n):1e6;return m(c(e),h(t),i," \n")},getwords(e,t,n){let i=void 0!==n?Number(n):1e6;return m(c(e),h(t),i," \n")},removeword:(e,t)=>_(c(e),h(t)," \n"," "),removefield:(e,t)=>_(c(e),h(t)," \n"," "),getrecord:(e,t)=>f(c(e),h(t),"\n"),getrecordcount:e=>g(c(e),"\n"),setrecord:(e,t,n)=>v(c(e),h(t),c(n),"\n","\n"),removerecord:(e,t)=>_(c(e),h(t),"\n","\n"),nexttoken(e,t,n){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:e=>c(e).replace(/[^\w\s-]/g,"").trim(),mabs:e=>Math.abs(h(e)),mfloor:e=>Math.floor(h(e)),mceil:e=>Math.ceil(h(e)),msqrt:e=>Math.sqrt(h(e)),mpow:(e,t)=>Math.pow(h(e),h(t)),msin:e=>Math.sin(h(e)),mcos:e=>Math.cos(h(e)),mtan:e=>Math.tan(h(e)),masin:e=>Math.asin(h(e)),macos:e=>Math.acos(h(e)),matan:(e,t)=>Math.atan2(h(e),h(t)),mlog:e=>Math.log(h(e)),getrandom(e,t){if(void 0===e)return Math.random();if(void 0===t)return Math.floor(Math.random()*(h(e)+1));let n=h(e);return Math.floor(Math.random()*(h(t)-n+1))+n},mdegtorad:e=>h(e)*(Math.PI/180),mradtodeg:e=>h(e)*(180/Math.PI),mfloatlength:(e,t)=>h(e).toFixed(h(t)),getboxcenter(e){let t=c(e).split(" ").map(Number),n=t[0]||0,i=t[1]||0,r=t[2]||0,a=t[3]||0,s=t[4]||0,o=t[5]||0;return`${(n+a)/2} ${(i+s)/2} ${(r+o)/2}`},vectoradd(e,t){let[n,i,r]=d(e),[a,s,o]=d(t);return`${n+a} ${i+s} ${r+o}`},vectorsub(e,t){let[n,i,r]=d(e),[a,s,o]=d(t);return`${n-a} ${i-s} ${r-o}`},vectorscale(e,t){let[n,i,r]=d(e),a=h(t);return`${n*a} ${i*a} ${r*a}`},vectordot(e,t){let[n,i,r]=d(e),[a,s,o]=d(t);return n*a+i*s+r*o},vectorcross(e,t){let[n,i,r]=d(e),[a,s,o]=d(t);return`${i*o-r*s} ${r*a-n*o} ${n*s-i*a}`},vectorlen(e){let[t,n,i]=d(e);return Math.sqrt(t*t+n*n+i*i)},vectornormalize(e){let[t,n,i]=d(e),r=Math.sqrt(t*t+n*n+i*i);return 0===r?"0 0 0":`${t/r} ${n/r} ${i/r}`},vectordist(e,t){let[n,i,r]=d(e),[a,s,o]=d(t),l=n-a,u=i-s,c=r-o;return Math.sqrt(l*l+u*u+c*c)},matrixcreate(e,t){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(e){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(e,t){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(e,t){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(e,t){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-t().state.startTime,getrealtime:()=>Date.now(),schedule(e,n,i,...r){let a=Number(e)||0,s=t(),o=setTimeout(()=>{s.state.pendingTimeouts.delete(o);try{s.$f.call(String(i),...r)}catch(e){throw console.error(`schedule: error calling ${i}:`,e),e}},a);return s.state.pendingTimeouts.add(o),o},cancel(e){clearTimeout(e),t().state.pendingTimeouts.delete(e)},iseventpending:e=>t().state.pendingTimeouts.has(e),exec(e){let n=String(e??"");if(console.debug(`exec(${JSON.stringify(n)}): preparing to execute…`),!n.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(n)}.`),!1;let i=u(n),r=t(),{executedScripts:a,scripts:s}=r.state;if(a.has(i))return console.debug(`exec(${JSON.stringify(n)}): skipping (already executed)`),!0;let o=s.get(i);return null==o?(console.warn(`exec(${JSON.stringify(n)}): script not found`),!1):(a.add(i),console.debug(`exec(${JSON.stringify(n)}): executing!`),r.executeAST(o),!0)},compile(e){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:e=>n?n.isFile(c(e)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(e){let t=c(e),n=t.lastIndexOf(".");return n>=0?t.substring(n):""},filebase(e){let t=c(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),i=t.lastIndexOf("."),r=n>=0?n+1:0,a=i>r?i:t.length;return t.substring(r,a)},filepath(e){let t=c(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n>=0?t.substring(0,n):""},expandfilename(e){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:e=>n?(a=c(e),i=n.findFiles(a),r=0,i[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(e){let t=c(e);if(t!==a){if(!n)return"";a=t,i=n.findFiles(t)}return i[r++]??""},getfilecrc:e=>c(e),iswriteablefilename:e=>!1,activatepackage(e){t().$.activatePackage(c(e))},deactivatepackage(e){t().$.deactivatePackage(c(e))},ispackage:e=>t().$.isPackage(c(e)),isactivepackage:e=>t().$.isActivePackage(c(e)),getpackagelist:()=>t().$.getPackageList(),addmessagecallback(e,t){},alxcreatesource:(...e)=>0,alxgetwavelen:e=>0,alxlistenerf(e,t){},alxplay:(...e)=>0,alxsetchannelvolume(e,t){},alxsourcef(e,t,n){},alxstop(e){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(e){},isjoystickdetected:()=>!1,lockmouse(e){},addmaterialmapping(e,t){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:e=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:e=>!1,isfullscreen:()=>!1,screenshot(e){},setdisplaydevice:e=>!0,setfov(e){},setinteriorrendermode(e){},setopenglanisotropy(e){},setopenglmipreduction(e){},setopenglskymipreduction(e){},setopengltexturecompressionhint(e){},setscreenmode(e,t,n,i){},setverticalsync(e){},setzoomspeed(e){},togglefullscreen(){},videosetgammacorrection(e){},snaptoggle(){},addtaggedstring:e=>0,buildtaggedstring:(e,...t)=>"",detag:e=>c(e),gettag:e=>0,gettaggedstring:e=>"",removetaggedstring(e){},commandtoclient(e,t){},commandtoserver(e){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:e=>!0,allowconnections(e){},startheartbeat(){},stopheartbeat(){},gotowebpage(e){},deletedatablocks(){},preloaddatablock:e=>!0,containerboxempty:(...e)=>!0,containerraycast:(...e)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...e)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:e=>0,lightscene(){},pathonmissionloaddone(){}}}function x(){return{scripts:new Map,generatedCode:new WeakMap}}function b(e){return e.toLowerCase()}function S(e){return Number(e)>>>0}function M(e){if(null==e)return null;if("string"==typeof e)return e||null;if("number"==typeof e)return String(e);throw Error(`Invalid instance name type: ${typeof e}`)}function w(e={}){let t=new o,n=new o,i=new o,r=[],c=new l,h=3,d=1027,p=new Map,f=new o,m=new o,g=new o,v=new o,_=new o;if(e.globals)for(let[t,n]of Object.entries(e.globals)){if(!t.startsWith("$"))throw Error(`Global variable "${t}" must start with $, e.g. "$${t}"`);g.set(t.slice(1),n)}let T=new Set,A=new Set,C=e.ignoreScripts&&e.ignoreScripts.length>0?(0,s.default)(e.ignoreScripts,{nocase:!0}):null,R=e.cache??x(),P=R.scripts,I=R.generatedCode,L=new Map;function N(e){let t=L.get(e);return t&&t.length>0?t[t.length-1]:void 0}function D(e,t,n){let i;(i=L.get(e))||(i=[],L.set(e,i)),i.push(t);try{return n()}finally{let t;(t=L.get(e))&&t.pop()}}function U(e,t){return`${e.toLowerCase()}::${t.toLowerCase()}`}function O(e,n){return t.get(e)?.get(n)??null}let F=new Set,B=null,k=null,z=(e.builtins??y)({runtime:()=>k,fileSystem:e.fileSystem??null});function V(e){let a=i.get(e);if(!a)return void c.add(e);if(!a.active){for(let[e,n]of(a.active=!0,r.push(a.name),a.methods)){t.has(e)||t.set(e,new o);let i=t.get(e);for(let[e,t]of n)i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let[e,t]of a.functions)n.has(e)||n.set(e,[]),n.get(e).push(t)}}function H(e){return null==e||""===e?null:"object"==typeof e&&null!=e._id?e:"string"==typeof e?f.get(e)??null:"number"==typeof e?p.get(e)??null:null}function G(e,t,n){let i=H(e);if(null==i)return 0;let r=X(i[t]);return i[t]=r+n,r}function W(e,t){let n=O(e,t);return n&&n.length>0?n[n.length-1]:null}function j(e,t,n,i){let r=O(e,t);return r&&0!==r.length?{found:!0,result:D(U(e,t),r.length-1,()=>r[r.length-1](n,...i))}:{found:!1}}function $(e,t,n,i){let r=v.get(e);if(r){let e=r.get(t);if(e)for(let t of e)t(n,...i)}}function X(e){if(null==e||""===e)return 0;let t=Number(e);return isNaN(t)?0:t}function q(e){if(!e||""===e)return null;e.startsWith("/")&&(e=e.slice(1));let t=e.split("/"),n=null;for(let e=0;et._name?.toLowerCase()===e)??null}if(!n)return null}}return n}function Y(e){return null==e||""===e?null:q(String(e))}function J(e){function t(e,t){return e+t.join("_")}return{get:(n,...i)=>e.get(t(n,i))??"",set(n,...i){if(0===i.length)throw Error("set() requires at least a value argument");if(1===i.length)return e.set(n,i[0]),i[0];let r=i[i.length-1],a=i.slice(0,-1);return e.set(t(n,a),r),r},postInc(n,...i){let r=t(n,i),a=X(e.get(r));return e.set(r,a+1),a},postDec(n,...i){let r=t(n,i),a=X(e.get(r));return e.set(r,a-1),a}}}function Z(){return J(new o)}let K={registerMethod:function(e,n,i){if(B)B.methods.has(e)||B.methods.set(e,new o),B.methods.get(e).set(n,i);else{t.has(e)||t.set(e,new o);let r=t.get(e);r.has(n)||r.set(n,[]),r.get(n).push(i)}},registerFunction:function(e,t){B?B.functions.set(e,t):(n.has(e)||n.set(e,[]),n.get(e).push(t))},package:function(e,t){let n=i.get(e);n||(n={name:e,active:!1,methods:new o,functions:new o},i.set(e,n));let r=B;B=n,t(),B=r,c.has(e)&&(c.delete(e),V(e))},activatePackage:V,deactivatePackage:function(e){let a=i.get(e);if(!a||!a.active)return;a.active=!1;let s=r.findIndex(t=>t.toLowerCase()===e.toLowerCase());for(let[e,n]of(-1!==s&&r.splice(s,1),a.methods)){let i=t.get(e);if(i)for(let[e,t]of n){let n=i.get(e);if(n){let e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}for(let[e,t]of a.functions){let i=n.get(e);if(i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},create:function(e,t,n,i){let r=b(e),a=d++,s={_class:r,_className:e,_id:a};for(let[e,t]of Object.entries(n))s[b(e)]=t;s.superclass&&(s._superClass=b(String(s.superclass)),s.class&&_.set(b(String(s.class)),s._superClass)),p.set(a,s);let o=M(t);if(o&&(s._name=o,f.set(o,s)),i){for(let e of i)e._parent=s;s._children=i}let l=W(e,"onAdd");return l&&l(s),s},datablock:function(e,t,n,i){let r=b(e),a=h++,s={_class:r,_className:e,_id:a,_isDatablock:!0},o=M(n);if(o){let e=m.get(o);if(e){for(let[t,n]of Object.entries(e))t.startsWith("_")||(s[t]=n);s._parent=e}}for(let[e,t]of Object.entries(i))s[b(e)]=t;p.set(a,s);let l=M(t);return l&&(s._name=l,f.set(l,s),m.set(l,s)),s},deleteObject:function e(t){let n;if(null==t||("number"==typeof t?n=p.get(t):"string"==typeof t?n=f.get(t):"object"==typeof t&&t._id&&(n=t),!n))return!1;let i=W(n._className,"onRemove");if(i&&i(n),p.delete(n._id),n._name&&f.delete(n._name),n._isDatablock&&n._name&&m.delete(n._name),n._parent&&n._parent._children){let e=n._parent._children.indexOf(n);-1!==e&&n._parent._children.splice(e,1)}if(n._children)for(let t of[...n._children])e(t);return!0},prop:function(e,t){let n=H(e);return null==n?"":n[b(t)]??""},setProp:function(e,t,n){let i=H(e);return null==i||(i[b(t)]=n),n},getIndex:function(e,t){let n=H(e);return null==n?"":n[String(t)]??""},setIndex:function(e,t,n){let i=H(e);return null==i||(i[String(t)]=n),n},propPostInc:function(e,t){return G(e,b(t),1)},propPostDec:function(e,t){return G(e,b(t),-1)},indexPostInc:function(e,t){return G(e,String(t),1)},indexPostDec:function(e,t){return G(e,String(t),-1)},key:function(e,...t){return e+t.join("_")},call:function(e,t,...n){if(null==e||("string"==typeof e||"number"==typeof e)&&null==(e=Y(e)))return"";let i=e.class||e._className||e._class;if(i){let r=j(i,t,e,n);if(r.found)return $(i,t,e,n),r.result}let r=e._superClass||_.get(i);for(;r;){let i=j(r,t,e,n);if(i.found)return $(r,t,e,n),i.result;r=_.get(r)}return""},nsCall:function(e,t,...n){let i=O(e,t);if(!i||0===i.length)return"";let r=U(e,t),a=i[i.length-1],s=D(r,i.length-1,()=>a(...n)),o=n[0];return o&&"object"==typeof o&&$(e,t,o,n.slice(1)),s},nsRef:function(e,t){let n=O(e,t);if(!n||0===n.length)return null;let i=U(e,t),r=n[n.length-1];return(...e)=>D(i,n.length-1,()=>r(...e))},parent:function(e,t,n,...i){let r=O(e,t),a=U(e,t),s=N(a);if(r&&void 0!==s&&s>=1){let o=s-1,l=D(a,o,()=>r[o](n,...i));return n&&"object"==typeof n&&$(e,t,n,i),l}let o=_.get(e);for(;o;){let e=O(o,t);if(e&&e.length>0){let r=D(U(o,t),e.length-1,()=>e[e.length-1](n,...i));return n&&"object"==typeof n&&$(o,t,n,i),r}o=_.get(o)}return""},parentFunc:function(e,...t){let i=n.get(e);if(!i)return"";let r=e.toLowerCase(),a=N(r);if(void 0===a||a<1)return"";let s=a-1;return D(r,s,()=>i[s](...t))},add:function(e,t){return X(e)+X(t)},sub:function(e,t){return X(e)-X(t)},mul:function(e,t){return X(e)*X(t)},div:function(e,t){return X(e)/X(t)},neg:function(e){return-X(e)},lt:function(e,t){return X(e)X(t)},ge:function(e,t){return X(e)>=X(t)},eq:function(e,t){return X(e)===X(t)},ne:function(e,t){return X(e)!==X(t)},mod:function(e,t){let n=0|Number(t);return 0===n?0:(0|Number(e))%n},bitand:function(e,t){return S(e)&S(t)},bitor:function(e,t){return S(e)|S(t)},bitxor:function(e,t){return S(e)^S(t)},shl:function(e,t){return S(S(e)<<(31&S(t)))},shr:function(e,t){return S(e)>>>(31&S(t))},bitnot:function(e){return~S(e)>>>0},concat:function(...e){return e.map(e=>String(e??"")).join("")},streq:function(e,t){return String(e??"").toLowerCase()===String(t??"").toLowerCase()},switchStr:function(e,t){let n=String(e??"").toLowerCase();for(let[e,i]of Object.entries(t))if("default"!==e&&b(e)===n)return void i();t.default&&t.default()},deref:Y,nameToId:function(e){let t=q(e);return t?t._id:-1},isObject:function(e){return null!=e&&("object"==typeof e&&!!e._id||("number"==typeof e?p.has(e):"string"==typeof e&&f.has(e)))},isFunction:function(e){return n.has(e)||e.toLowerCase()in z},isPackage:function(e){return i.has(e)},isActivePackage:function(e){let t=i.get(e);return t?.active??!1},getPackageList:function(){return r.join(" ")},locals:Z,onMethodCalled(e,t,n){let i=v.get(e);i||(i=new o,v.set(e,i));let r=i.get(t);r||(r=[],i.set(t,r)),r.push(n)}},Q={call(e,...t){let i=n.get(e);if(i&&i.length>0)return D(e.toLowerCase(),i.length-1,()=>i[i.length-1](...t));let r=z[e.toLowerCase()];return r?r(...t):(console.warn(`Unknown function: ${e}(${t.map(e=>JSON.stringify(e)).join(", ")})`),"")}},ee=J(g),et={methods:t,functions:n,packages:i,activePackages:r,objectsById:p,objectsByName:f,datablocks:m,globals:g,executedScripts:T,failedScripts:A,scripts:P,generatedCode:I,pendingTimeouts:F,startTime:Date.now()};function en(e){let t=function(e){let t=I.get(e);null==t&&(t=new a(void 0).generate(e),I.set(e,t));return t}(e),n=Z();Function("$","$f","$g","$l",t)(K,Q,ee,n)}function ei(e,t){return{execute(){if(t){let e=u(t);et.executedScripts.add(e)}en(e)}}}async function er(t,n,i){let r=e.loadScript;if(!r){t.length>0&&console.warn("Script has exec() calls but no loadScript provided:",t);return}async function a(t){e.signal?.throwIfAborted();let a=u(t);if(et.scripts.has(a)||et.failedScripts.has(a))return;if(C&&C(a)){console.warn(`Ignoring script: ${t}`),et.failedScripts.add(a);return}if(i.has(a))return;let s=n.get(a);if(s)return void await s;e.progress?.addItem(t);let o=(async()=>{let s,o=await r(t);if(null==o){console.warn(`Script not found: ${t}`),et.failedScripts.add(a),e.progress?.completeItem();return}try{s=E(o,{filename:t})}catch(n){console.warn(`Failed to parse script: ${t}`,n),et.failedScripts.add(a),e.progress?.completeItem();return}let l=new Set(i);l.add(a),await er(s.execScriptPaths,n,l),et.scripts.set(a,s),e.progress?.completeItem()})();n.set(a,o),await o}await Promise.all(t.map(a))}async function ea(t){let n=e.loadScript;if(!n)throw Error("loadFromPath requires loadScript option to be set");let i=u(t);if(et.scripts.has(i))return ei(et.scripts.get(i),t);e.progress?.addItem(t);let r=await n(t);if(null==r)throw e.progress?.completeItem(),Error(`Script not found: ${t}`);let a=await es(r,{path:t});return e.progress?.completeItem(),a}async function es(e,t){if(t?.path){let e=u(t.path);if(et.scripts.has(e))return ei(et.scripts.get(e),t.path)}return eo(E(e,{filename:t?.path}),t)}async function eo(t,n){let i=new Map,r=new Set;if(n?.path){let e=u(n.path);et.scripts.set(e,t),r.add(e)}let a=[...t.execScriptPaths,...e.preloadScripts??[]];return await er(a,i,r),ei(t,n?.path)}return k={$:K,$f:Q,$g:ee,state:et,destroy:function(){for(let e of et.pendingTimeouts)clearTimeout(e);et.pendingTimeouts.clear()},executeAST:en,loadFromPath:ea,loadFromSource:es,loadFromAST:eo,call:(e,...t)=>Q.call(e,...t),getObjectByName:e=>f.get(e)}}function T(){let e=new Set,t=0,n=0,i=null;function r(){for(let t of e)t()}return{get total(){return t},get loaded(){return n},get current(){return i},get progress(){return 0===t?0:n/t},on(t,n){e.add(n)},off(t,n){e.delete(n)},addItem(e){t++,i=e,r()},completeItem(){n++,i=null,r()},setCurrent(e){i=e,r()}}}function E(e,t){try{return n.default.parse(e)}catch(e){if(t?.filename&&e.location)throw Error(`${t.filename}:${e.location.start.line}:${e.location.start.column}: ${e.message}`,{cause:e});throw e}}function A(e){let{missionName:t,missionType:n,runtimeOptions:i,onMissionLoadDone:r}=e,{signal:a,fileSystem:s,globals:o={},preloadScripts:l=[]}=i??{},u=s.findFiles("scripts/*Game.cs"),c=w({...i,globals:{...o,"$Host::Map":t,"$Host::MissionType":n},preloadScripts:[...l,...u]}),h=async function(){try{let e=await c.loadFromPath("scripts/server.cs");a?.throwIfAborted(),await c.loadFromPath(`missions/${t}.mis`),a?.throwIfAborted(),e.execute(),r&&c.$.onMethodCalled("DefaultGame","missionLoadDone",r);let n=await c.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");a?.throwIfAborted(),n.execute()}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}}();return{runtime:c,ready:h}}e.s(["createProgressTracker",()=>T],38433);let C=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,R=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,P=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,I={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 L(e){let t=E(e),{pragma:n,sections:i}=function(e){let t={},n=[],i={name:null,comments:[]};for(let r of e.body)if("Comment"===r.type){let e=function(e){let t;return(t=e.match(R))?{type:"sectionBegin",name:t[1]}:(t=e.match(P))?{type:"sectionEnd",name:t[1]}:(t=e.match(C))?{type:"definition",identifier:t[1],value:t[2]}:null}(r.value);if(e)switch(e.type){case"definition":null===i.name?t[e.identifier.toLowerCase()]=e.value:i.comments.push(r.value);break;case"sectionBegin":(null!==i.name||i.comments.length>0)&&n.push(i),i={name:e.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==i.name&&n.push(i),i={name:null,comments:[]}}else i.comments.push(r.value)}return(null!==i.name||i.comments.length>0)&&n.push(i),{pragma:t,sections:n}}(t);function r(e){return i.find(t=>t.name===e)?.comments.map(e=>e.trimStart()).join("\n")??null}return{displayName:n.displayname??null,missionTypes:n.missiontypes?.split(/\s+/).filter(Boolean).map(e=>I[e.toLowerCase()]??e)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:n.briefingwav??null,bitmap:n.bitmap??null,planetName:n.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:t.execScriptPaths,hasDynamicExec:t.hasDynamicExec,ast:t}}function N(e,t){if(e)return e[t.toLowerCase()]}function D(e,t){let n=e[t.toLowerCase()];return null==n?n:parseFloat(n)}function U(e,t){let n=e[t.toLowerCase()];return null==n?n:parseInt(n,10)}function O(e){let[t,n,i]=(e.position??"0 0 0").split(" ").map(e=>parseFloat(e));return[n||0,i||0,t||0]}function F(e){let[t,n,i]=(e.scale??"1 1 1").split(" ").map(e=>parseFloat(e));return[n||0,i||0,t||0]}function B(e){let[n,i,r,a]=(e.rotation??"1 0 0 0").split(" ").map(e=>parseFloat(e)),s=new t.Vector3(i,r,n).normalize(),o=-(Math.PI/180*a);return new t.Quaternion().setFromAxisAngle(s,o)}e.s(["getFloat",()=>D,"getInt",()=>U,"getPosition",()=>O,"getProperty",()=>N,"getRotation",()=>B,"getScale",()=>F,"parseMissionScript",()=>L],62395)},12979,e=>{"use strict";var t=e.i(98223),n=e.i(91996),i=e.i(62395),r=e.i(71726);let a="/t2-mapper",s=`${a}/base/`,o=`${a}/magenta.png`;function l(e,t){let i;try{i=(0,n.getActualResourceKey)(e)}catch(n){if(t)return console.warn(`Resource "${e}" not found - rendering fallback.`),t;throw n}let[r,a]=(0,n.getSourceAndPath)(i);return r?`${s}@vl2/${r}/${a}`:`${s}${a}`}function u(e){return l(`interiors/${e}`).replace(/\.dif$/i,".glb")}function c(e){return l(`shapes/${e}`).replace(/\.dts$/i,".glb")}function h(e){return e=e.replace(/^terrain\./,""),l((0,n.getStandardTextureResourceKey)(`textures/terrain/${e}`),o)}function d(e,t){let i=(0,r.normalizePath)(t).split("/"),a=i.length>1?i.slice(0,-1).join("/")+"/":"",s=`${a}${e}`;return l((0,n.getStandardTextureResourceKey)(s),o)}function p(e){return l((0,n.getStandardTextureResourceKey)(`textures/${e}`),o)}function f(e){return l(`audio/${e}`)}async function m(e){let t=l(`textures/${e}`),n=await fetch(t);return(await n.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function g(e){let t=(0,n.getMissionInfo)(e),r=await fetch(l(t.resourcePath)),a=await r.text();return(0,i.parseMissionScript)(a)}async function v(e){let t=await fetch(l(`terrains/${e}`));return function(e){let t=new DataView(e),n=0,i=t.getUint8(n++),r=new Uint16Array(65536),a=[],s=e=>{let i="";for(let r=0;r0&&a.push(r)}let o=[];for(let e of a){let e=new Uint8Array(65536);for(let i=0;i<65536;i++){let r=t.getUint8(n++);e[i]=r}o.push(e)}return{version:i,textureNames:a,heightMap:r,alphaMaps:o}}(await t.arrayBuffer())}async function _(e){let n=l(e),i=await fetch(n),r=await i.text();return(0,t.parseImageFileList)(r)}e.s(["FALLBACK_TEXTURE_URL",0,o,"audioToUrl",()=>f,"getUrlForPath",()=>l,"iflTextureToUrl",()=>d,"interiorToUrl",()=>u,"loadDetailMapList",()=>m,"loadImageFrameList",()=>_,"loadMission",()=>g,"loadTerrain",()=>v,"shapeToUrl",()=>c,"terrainTextureToUrl",()=>h,"textureToUrl",()=>p],12979)},49774,e=>{"use strict";var t=e.i(91037);e.s(["useFrame",()=>t.D])},73949,e=>{"use strict";var t=e.i(91037);e.s(["useThree",()=>t.C])},79123,e=>{"use strict";var t=e.i(43476),n=e.i(71645);let i=(0,n.createContext)(null),r=(0,n.createContext)(null),a=(0,n.createContext)(null);function s(){return(0,n.useContext)(i)}function o(){return(0,n.useContext)(r)}function l(){return(0,n.useContext)(a)}function u({children:e,fogEnabledOverride:s,onClearFogEnabledOverride:o}){let[l,u]=(0,n.useState)(!0),[c,h]=(0,n.useState)(!1),[d,p]=(0,n.useState)(1),[f,m]=(0,n.useState)(90),[g,v]=(0,n.useState)(!1),[_,y]=(0,n.useState)(!0),[x,b]=(0,n.useState)(!1),[S,M]=(0,n.useState)("moveLookStick"),w=(0,n.useCallback)(e=>{u(e),o()},[o]),T=(0,n.useMemo)(()=>({fogEnabled:s??l,setFogEnabled:w,highQualityFog:c,setHighQualityFog:h,fov:f,setFov:m,audioEnabled:g,setAudioEnabled:v,animationEnabled:_,setAnimationEnabled:y}),[l,s,w,c,f,g,_]),E=(0,n.useMemo)(()=>({debugMode:x,setDebugMode:b}),[x,b]),A=(0,n.useMemo)(()=>({speedMultiplier:d,setSpeedMultiplier:p,touchMode:S,setTouchMode:M}),[d,p,S,M]);(0,n.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&b(e.debugMode),null!=e.audioEnabled&&v(e.audioEnabled),null!=e.animationEnabled&&y(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&h(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&m(e.fov),null!=e.touchMode&&M(e.touchMode)},[]);let C=(0,n.useRef)(null);return(0,n.useEffect)(()=>(C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:l,highQualityFog:c,speedMultiplier:d,fov:f,audioEnabled:g,animationEnabled:_,debugMode:x,touchMode:S}))}catch(e){}},500),()=>{C.current&&clearTimeout(C.current)}),[l,c,d,f,g,_,x,S]),(0,t.jsx)(i.Provider,{value:T,children:(0,t.jsx)(r.Provider,{value:E,children:(0,t.jsx)(a.Provider,{value:A,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>l,"useDebug",()=>o,"useSettings",()=>s])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/748c06086372a1f2.css b/docs/_next/static/chunks/748c06086372a1f2.css new file mode 100644 index 00000000..6ba9b92b --- /dev/null +++ b/docs/_next/static/chunks/748c06086372a1f2.css @@ -0,0 +1 @@ +html{box-sizing:border-box;background:#000;margin:0;padding:0;overflow:hidden}*,:before,:after{box-sizing:inherit}body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:100%}body{margin:0;padding:0;overflow:hidden}main{width:100dvw;height:100dvh}#canvasContainer{z-index:0;position:absolute;inset:0}#controls{color:#fff;z-index:2;background:#00000080;border-radius:0 0 4px;padding:8px 12px 8px 8px;font-size:13px;position:fixed;top:0;left:0}input[type=range]{max-width:80px}.CheckboxField,.LabelledButton,.Field{align-items:center;gap:6px;display:flex}#controls,.Controls-dropdown,.Controls-group{justify-content:center;align-items:center;gap:20px;display:flex}@media (max-width:1279px){.Controls-dropdown[data-open=false]{display:none}.Controls-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}.Controls-group{flex-wrap:wrap;gap:12px 20px}}@media (max-width:639px){#controls{border-radius:0;right:0}#controls>.MissionSelect-inputWrapper{flex:1 1 0;min-width:0}#controls>.MissionSelect-inputWrapper .MissionSelect-input{width:100%}.Controls-toggle{flex:none}}.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}.ButtonLabel{font-size:12px}.IconButton svg{pointer-events:none}@media (hover:hover){.IconButton:hover{background:#0062b3cc;border-color:#fff6}}.IconButton:active,.IconButton[aria-expanded=true]{background:#0062b3b3;border-color:#ffffff4d;transform:translateY(1px)}.Controls-toggle{margin:0}@media (max-width:1279px){.LabelledButton{width:auto;padding:0 10px}}@media (min-width:1280px){.Controls-toggle,.LabelledButton .ButtonLabel,.MapInfoButton{display:none}}.CopyCoordinatesButton[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton .ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton[data-copied=true] .ClipboardCheck{animation:.22s linear infinite showClipboardCheck;display:block}.CopyCoordinatesButton[data-copied=true] .MapPin{display:none}.StaticShapeLabel{color:#fff;white-space:nowrap;text-align:center;background:#00000080;border-radius:1px;padding:1px 3px;font-size:11px}.StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.AxisLabel{pointer-events:none;font-size:12px}.AxisLabel[data-axis=x]{color:#f90}.AxisLabel[data-axis=y]{color:#9f0}.AxisLabel[data-axis=z]{color:#09f}.MissionSelect-inputWrapper{align-items:center;display:flex;position:relative}.MissionSelect-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-input[aria-expanded=true]~.MissionSelect-shortcut{display:none}.MissionSelect-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-input[aria-expanded=true]{padding-right:8px}.MissionSelect-input:focus{border-color:#fff9}.MissionSelect-input::placeholder{color:#0000}.MissionSelect-selectedValue{pointer-events:none;align-items:center;gap:6px;display:flex;position:absolute;left:8px;right:36px;overflow:hidden}.MissionSelect-input[aria-expanded=true]~.MissionSelect-selectedValue{display:none}.MissionSelect-selectedName{color:#fff;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.MissionSelect-selectedValue>.MissionSelect-itemType{flex-shrink:0}.MissionSelect-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-list{padding:4px 0}.MissionSelect-list:has(>.MissionSelect-group:first-child){padding-top:0}.MissionSelect-group{padding-bottom:4px}.MissionSelect-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-group:not(:last-child){border-bottom:1px solid #ffffff4d}.MissionSelect-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-list>.MissionSelect-item:first-child{margin-top:0}.MissionSelect-item[data-active-item]{background:#ffffff26}.MissionSelect-item[aria-selected=true]{background:#6496ff4d}.MissionSelect-itemHeader{align-items:center;gap:6px;display:flex}.MissionSelect-itemName{color:#fff;font-size:14px;font-weight:600}.MissionSelect-itemTypes{gap:3px;display:flex}.MissionSelect-itemType{color:#fff;background:#ff9d0066;border-radius:3px;padding:2px 5px;font-size:10px;font-weight:600}.MissionSelect-itemType:hover{background:#ff9d00b3}.MissionSelect-itemMissionName{color:#ffffff80;font-size:12px}.MissionSelect-noResults{color:#ffffff80;text-align:center;padding:12px 8px;font-size:13px}.LoadingSpinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite LoadingSpinner-spin}@keyframes LoadingSpinner-spin{to{transform:rotate(360deg)}}#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%)}#loadingIndicator[data-complete=true]{animation:.3s ease-out forwards loadingComplete}@keyframes loadingComplete{0%{opacity:1}to{opacity:0}}.LoadingProgress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.LoadingProgress-bar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.LoadingProgress-text{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes showClipboardCheck{0%{opacity:1}to{opacity:.2}}.KeyboardOverlay{pointer-events:none;z-index:1;align-items:flex-end;gap:10px;display:flex;position:fixed;bottom:16px;left:50%;transform:translate(-50%)}.KeyboardOverlay-column{flex-direction:column;justify-content:center;gap:4px;display:flex}.KeyboardOverlay-row{justify-content:stretch;gap:4px;display:flex}.KeyboardOverlay-spacer{width:32px}.KeyboardOverlay-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-key[data-pressed=true]{color:#fff;background:#34bbab99;border-color:#23fddc80}.KeyboardOverlay-arrow{margin-right:3px}.MapInfoDialog-overlay{z-index:10;background:#000000b3;justify-content:center;align-items:center;padding:20px;display:flex;position:fixed;inset:0}.MapInfoDialog{color:#bccec3;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default;background:#142526cc;border:1px solid #41838b99;border-radius:3px;outline:none;grid-template-rows:1fr auto;grid-template-columns:100%;width:800px;max-width:calc(100dvw - 40px);height:600px;max-height:calc(100dvh - 40px);font-size:14px;line-height:1.5;display:grid;position:relative;box-shadow:0 0 0 1px #00bedc1f,0 0 60px #008cb41f,inset 0 0 60px #01070d99}.MapInfoDialog-inner{grid-template-rows:100%;grid-template-columns:1fr auto;min-height:0;display:grid;overflow:hidden}.MapInfoDialog-left{width:100%;padding:24px 28px;overflow-y:auto}.MapInfoDialog-right{border-left:1px solid #00bedc4d;width:auto;height:100%;margin-left:auto;margin-right:0}.MapInfoDialog-preview{width:auto;height:100%;display:block;overflow:hidden}.MapInfoDialog-preview--floated{float:right;clear:right;width:auto;max-width:30%;max-height:260px;margin:0 0 16px 20px;display:block}.MapInfoDialog-title{color:#7dffff;text-shadow:0 1px 6px #0006;margin:0;font-size:26px;font-weight:500}.MapInfoDialog-meta{flex-wrap:wrap;gap:8px 16px;margin-bottom:4px;font-size:15px;font-weight:400;display:flex}.MapInfoDialog-planet{color:#dbcaa8b3}.MapInfoDialog-quote{border-left:2px solid #00bedc59;margin:16px 0;padding:0 0 0 14px;font-style:italic}.MapInfoDialog-quote p{margin:0 0 4px}.MapInfoDialog-quote cite{color:#ffffff73;font-size:12px;font-style:normal;display:block}.MapInfoDialog-blurb{margin:0 0 16px;font-size:13px}.MapInfoDialog-section{margin-top:20px}.MapInfoDialog-sectionTitle{color:#7dffff;letter-spacing:.04em;text-transform:uppercase;text-shadow:0 0 16px #00d2f040;margin:0 0 8px;font-size:16px;font-weight:500}.MapInfoDialog-musicTrack{color:#cad0ac80;align-items:center;gap:6px;margin-top:16px;font-size:14px;font-style:italic;display:flex}.MapInfoDialog-musicTrack[data-playing=true]{color:#f7fdd8b3}.MapInfoDialog-musicBtn{cursor:pointer;color:#557663;opacity:.5;background:0 0;border:0;border-radius:20px;flex-shrink:0;place-content:center;width:32px;height:32px;padding:0;font-size:20px;font-style:normal;line-height:1;display:grid}.MapInfoDialog-musicTrack[data-playing=true] .MapInfoDialog-musicBtn{color:#6dffaa;opacity:1}.MapInfoDialog-musicTrack[data-playing=true] .MapInfoDialog-musicBtn:hover{opacity:.7}.MapInfoDialog-footer{background:#021415b3;border-top:1px solid #00bedc40;flex-shrink:0;align-items:center;gap:16px;padding:10px 12px;display:flex}.MapInfoDialog-closeBtn{color:#9aefe1e6;text-shadow:0 -1px #00000080;cursor:pointer;background:linear-gradient(#29ac9cb3,#005041b3);border:1px solid #29615499;border-top-color:#65b9b080;border-radius:3px;padding:4px 18px;font-size:14px;font-weight:500;box-shadow:inset 0 1px #78dcc333,inset 0 -1px #0000004d,0 2px 4px #0006}.MapInfoDialog-closeBtn:active{transform:translateY(1px)}.MapInfoDialog-hint{color:#c9dcd84d;margin-left:auto;font-size:12px}@media (max-width:719px){.MapInfoDialog-inner{display:block;overflow:auto}.MapInfoDialog-hint{display:none}.MapInfoDialog-left{width:100%;height:auto;margin:0;padding:16px 20px;overflow:auto}.MapInfoDialog-right{border-left:0;width:100%;height:auto;margin:0;overflow:auto}.MapInfoDialog-preview{width:auto;height:auto;margin:16px auto}.MapInfoDialog-closeBtn{width:220px;height:36px;margin:0 auto}}.GuiMarkup-line{margin-bottom:1px}.GuiMarkup-spacer{height:.6em}.GuiMarkup-bulletLine{align-items:baseline;gap:5px;margin-bottom:3px;display:flex}.GuiMarkup-bulletIcon{flex-shrink:0;align-items:center;display:flex}.GuiMarkup-bulletText{flex:1;min-width:0}.GuiMarkup-bitmap{vertical-align:middle;max-height:1em}.GuiMarkup-bullet{opacity:.8}.TouchJoystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchJoystick--left{left:20px;transform:none}.TouchJoystick--right{left:auto;right:20px;transform:none}.TouchJoystick .back{background:#034f4c99!important;border:1px solid #00dbdf80!important;box-shadow:inset 0 0 10px #000000b3!important}.TouchJoystick .front{background:radial-gradient(circle,#17f7c6e6 0%,#09b8aaf2 100%)!important;border:2px solid #fff6!important;box-shadow:0 2px 4px #00000080,0 1px 1px #0000004d,inset 0 1px #ffffff26,inset 0 -1px 2px #0000004d!important}.MusicTrackName{text-transform:capitalize} diff --git a/docs/_next/static/chunks/aa3c97b2da210ead.js b/docs/_next/static/chunks/aa3c97b2da210ead.js new file mode 100644 index 00000000..3454e2a5 --- /dev/null +++ b/docs/_next/static/chunks/aa3c97b2da210ead.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,94247,e=>{"use strict";var t=e.i(43476),n=e.i(932),a=e.i(71645),i=e.i(11152),s=e.i(66027),l=e.i(12979),r=e.i(91996);let o=new Map;function c(e){let a,i=(0,n.c)(5),{name:s}=e;i[0]!==s?(a=function(e){let t;if(o.has(e))return o.get(e);try{t=(0,l.getUrlForPath)((0,r.getStandardTextureResourceKey)(`textures/gui/${e}`))}catch{t=null}return o.set(e,t),t}(s),i[0]=s,i[1]=a):a=i[1];let c=a;if(c){let e;return i[2]!==c?(e=(0,t.jsx)("img",{src:c,alt:"",className:"GuiMarkup-bitmap"}),i[2]=c,i[3]=e):e=i[3],e}if(/bullet/i.test(s)){let e;return i[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"GuiMarkup-bullet",children:"•"}),i[4]=e):e=i[4],e}return null}function u(e){let a,i,s=(0,n.c)(8),{span:l}=e,{color:r,fontSize:o}=l.style;if(!r&&!o){let e;return s[0]!==l.text?(e=(0,t.jsx)(t.Fragment,{children:l.text}),s[0]=l.text,s[1]=e):e=s[1],e}let c=null!=o?`${o}px`:void 0;return s[2]!==r||s[3]!==c?(a={color:r,fontSize:c},s[2]=r,s[3]=c,s[4]=a):a=s[4],s[5]!==l.text||s[6]!==a?(i=(0,t.jsx)("span",{style:a,children:l.text}),s[5]=l.text,s[6]=a,s[7]=i):i=s[7],i}function p(e){let a,i,s,l=(0,n.c)(6),{markup:r}=e;l[0]!==r?(a=function(e){let t=function(e){let t,n=[],a=/<([^>]*)>/g,i=0,s=e=>{let t=e.split("\n");t.forEach((e,a)=>{e&&n.push({type:"text",value:e}),ai&&s(e.slice(i,t.index)),i=t.index+t[0].length;let a=t[1].trim(),l=a.indexOf(":"),r=(-1===l?a:a.slice(0,l)).toLowerCase(),o=-1===l?"":a.slice(l+1);n.push({type:"tag",name:r,arg:o})}return i{p.push({align:r,lmargin:o,textIndent:u,items:l}),l=[],r=i,o=s,c=!1,u=0},m=e=>{if(!e)return;let t=l[l.length-1];t?.type==="span"&&t.style.color===a.color&&t.style.fontSize===a.fontSize?t.text+=e:l.push({type:"span",text:e,style:{...a}})};for(let e of t){if("newline"===e.type){f();continue}if("text"===e.type){m(e.value.replace(/\t/g," "));continue}let{name:t,arg:p}=e;switch(t){case"spush":n.push({...a});break;case"spop":n.length>0&&(a=n.pop());break;case"color":a={...a,color:`#${p.trim()}`};break;case"font":a={...a,fontSize:function(e){let t=e.lastIndexOf(":");return Math.min(parseInt(-1===t?e:e.slice(t+1),10)||14,16)}(p)};break;case"lmargin":{let e=parseInt(p,10)||0;s=e,c&&e>0?u=e:0===l.length&&(o=e);break}case"just":{let e=p.trim().toLowerCase();("left"===e||"center"===e||"right"===e)&&(i=e,0===l.length&&(r=e));break}case"bitmap":c=!0,l.push({type:"bitmap",name:p.trim()});break;case"br":f();break;case"sbreak":l.length>0&&f(),f()}}return l.length>0&&f(),p}(r),l[0]=r,l[1]=a):a=l[1];let o=a;return l[2]!==o?(i=o.map(f),l[2]=o,l[3]=i):i=l[3],l[4]!==i?(s=(0,t.jsx)("div",{className:"GuiMarkup",children:i}),l[4]=i,l[5]=s):s=l[5],s}function f(e,n){let{align:a,lmargin:i,textIndent:s,items:l}=e,r=l.filter(y),o=l.filter(x),c=o.some(g);return r.length>0&&s>0&&c?(0,t.jsxs)("div",{className:"GuiMarkup-bulletLine",children:[(0,t.jsx)("div",{className:"GuiMarkup-bulletIcon",children:r.map(h)}),(0,t.jsx)("div",{className:"GuiMarkup-bulletText",children:o.map(d)})]},n):c||0!==r.length?(0,t.jsx)("div",{className:"GuiMarkup-line",style:{textAlign:"left"!==a?a:void 0,paddingLeft:i>0?`${i}px`:void 0},children:l.map(m)},n):(0,t.jsx)("div",{className:"GuiMarkup-spacer"},n)}function m(e,n){return"bitmap"===e.type?(0,t.jsx)(c,{name:e.name},n):(0,t.jsx)(u,{span:e},n)}function d(e,n){return(0,t.jsx)(u,{span:e},n)}function h(e,n){return(0,t.jsx)(c,{name:e.name},n)}function g(e){return e.text.trim().length>0}function x(e){return"span"===e.type}function y(e){return"bitmap"===e.type}function j(e){let i,s,l,r,o=(0,n.c)(9),{src:c,alt:u,className:p}=e,f=void 0===p?"MapInfoDialog-preview":p,m=(0,a.useRef)(null),[d,h]=(0,a.useState)(!1);o[0]!==c?(i=()=>{let e=!1;return fetch(c).then(M).then(v).then(t=>{if(e)return void t.close();let n=m.current;n?(n.width=t.width,n.height=t.height,n.getContext("2d")?.drawImage(t,0,0),t.close(),h(!0)):t.close()}).catch(b),()=>{e=!0}},s=[c],o[0]=c,o[1]=i,o[2]=s):(i=o[1],s=o[2]),(0,a.useEffect)(i,s);let g=d?"block":"none";return o[3]!==g?(l={display:g},o[3]=g,o[4]=l):l=o[4],o[5]!==u||o[6]!==f||o[7]!==l?(r=(0,t.jsx)("canvas",{ref:m,className:f,"aria-label":u,style:l}),o[5]=u,o[6]=f,o[7]=l,o[8]=r):r=o[8],r}function b(){}function v(e){return createImageBitmap(e,{colorSpaceConversion:"none"})}function M(e){return e.blob()}function k(e){let s,r,o,c,u,p,f,m,d,h,g,x=(0,n.c)(22),{track:y}=e,[j,b]=(0,a.useState)(!1),[v,M]=(0,a.useState)(!0),k=(0,a.useRef)(null);x[0]!==y?(s=y.toLowerCase(),x[0]=y,x[1]=s):s=x[1];let I=`${l.RESOURCE_ROOT_URL}music/${s}.mp3`;x[2]===Symbol.for("react.memo_cache_sentinel")?(r=()=>()=>{k.current?.pause()},o=[],x[2]=r,x[3]=o):(r=x[2],o=x[3]),(0,a.useEffect)(r,o),x[4]!==j?(c=()=>{let e=k.current;e&&(j?e.pause():e.play().catch(()=>M(!1)))},x[4]=j,x[5]=c):c=x[5];let N=c;return x[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>b(!0),p=()=>b(!1),f=()=>M(!1),x[6]=u,x[7]=p,x[8]=f):(u=x[6],p=x[7],f=x[8]),x[9]!==I?(m=(0,t.jsx)("audio",{ref:k,src:I,loop:!0,onPlay:u,onPause:p,onError:f}),x[9]=I,x[10]=m):m=x[10],x[11]!==y?(d=(0,t.jsx)("span",{className:"MusicTrackName",children:y}),x[11]=y,x[12]=d):d=x[12],x[13]!==v||x[14]!==j||x[15]!==N?(h=v&&(0,t.jsx)("button",{className:"MapInfoDialog-musicBtn",onClick:N,"aria-label":j?"Pause music":"Play music",children:j?(0,t.jsx)(i.FaVolumeUp,{}):(0,t.jsx)(i.FaVolumeMute,{})}),x[13]=v,x[14]=j,x[15]=N,x[16]=h):h=x[16],x[17]!==j||x[18]!==h||x[19]!==m||x[20]!==d?(g=(0,t.jsxs)("div",{className:"MapInfoDialog-musicTrack","data-playing":j,children:[m,d,h]}),x[17]=j,x[18]=h,x[19]=m,x[20]=d,x[21]=g):g=x[21],g}function I(e){var i;let o,c,u,f,m,d,h,g,x,y,b,v,M,I,S,C,L,E,P,R,T,_,B,K,U,$,G,O,F,q,z,A,Q,V,H,J,W,X=(0,n.c)(98),{open:Y,onClose:Z,missionName:ee,missionType:et}=e,{data:en}=((W=(0,n.c)(2))[0]!==ee?(J={queryKey:["parsedMission",ee],queryFn:()=>(0,l.loadMission)(ee)},W[0]=ee,W[1]=J):J=W[1],(0,s.useQuery)(J)),ea=(0,a.useRef)(null);if(X[0]!==Y?(o=()=>{Y&&(ea.current?.focus(),document.exitPointerLock())},c=[Y],X[0]=Y,X[1]=o,X[2]=c):(o=X[1],c=X[2]),(0,a.useEffect)(o,c),X[3]!==Z||X[4]!==Y?(u=()=>{if(!Y)return;let e=e=>{if("KeyI"===e.code||"Escape"===e.key)Z();else if("k"===e.key&&(e.metaKey||e.ctrlKey))return void Z();e.stopImmediatePropagation()};return window.addEventListener("keydown",e,{capture:!0}),window.addEventListener("keyup",D,{capture:!0}),()=>{window.removeEventListener("keydown",e,{capture:!0}),window.removeEventListener("keyup",D,{capture:!0})}},f=[Y,Z],X[3]=Z,X[4]=Y,X[5]=u,X[6]=f):(u=X[5],f=X[6]),(0,a.useEffect)(u,f),!Y)return null;X[7]!==en?(m=en?function(e){for(let t of e.body){if("ObjectDeclaration"!==t.type)continue;let{instanceName:e,body:n}=t;if(e&&"Identifier"===e.type&&"missiongroup"===e.name.toLowerCase()){let e={};for(let t of n){if("Assignment"!==t.type)continue;let{target:n,value:a}=t;"Identifier"===n.type&&"StringLiteral"===a.type&&(e[n.name.toLowerCase()]=a.value)}return e}}return{}}(en.ast):{},X[7]=en,X[8]=m):m=X[8];let ei=m;X[9]!==ee||X[10]!==en?(d=en?function(e,t){if(e)try{let t=(0,r.getStandardTextureResourceKey)(`textures/gui/${e}`);return(0,l.getUrlForPath)(t)}catch{}try{let e=(0,r.getStandardTextureResourceKey)(`textures/gui/Load_${t}`);return(0,l.getUrlForPath)(e)}catch{}return null}(en.bitmap,ee):null,X[9]=ee,X[10]=en,X[11]=d):d=X[11];let es=d,el=en?.displayName??ee;X[12]!==et?(h=et.toLowerCase(),X[12]=et,X[13]=h):h=X[13];let er="singleplayer"===h,eo=ei.musictrack;if(X[14]!==es||X[15]!==el||X[16]!==er||X[17]!==et||X[18]!==Z||X[19]!==en){let e,n,a,s,l=en?.missionString?(i=en.missionString,s=et.toUpperCase(),i.split("\n").flatMap(e=>{let t=e.match(/^\[([^\]]+)\]/);return t&&!t[1].toUpperCase().split(/\s+/).includes(s)?[]:[e.replace(/^\[[^\]]+\]/,"")]}).join("\n")):null;if(X[38]!==en?.missionQuote){for(let t of(n="",e="",en?.missionQuote?.trim().split("\n")??[])){let a=t.trim();a.match(/^-+\s/)?e=a.replace(/^-+\s*/,"").trim():a&&(n+=(n?" ":"")+a)}X[38]=en?.missionQuote,X[39]=e,X[40]=n}else e=X[39],n=X[40];_="MapInfoDialog-overlay",B=Z,I=ea,S="MapInfoDialog",C=w,L=N,E="dialog",P="true",R="Map Information",T=-1,M="MapInfoDialog-inner",K="MapInfoDialog-left",X[41]!==es||X[42]!==el||X[43]!==er?(U=es&&er&&(0,t.jsx)(j,{className:"MapInfoDialog-preview--floated",src:es,alt:`${el} preview`},es),X[41]=es,X[42]=el,X[43]=er,X[44]=U):U=X[44],X[45]!==el?(g=(0,t.jsx)("h1",{className:"MapInfoDialog-title",children:el}),X[45]=el,X[46]=g):g=X[46],X[47]!==en?(a=en?.planetName&&(0,t.jsx)("span",{className:"MapInfoDialog-planet",children:en.planetName}),X[47]=en,X[48]=a):a=X[48],X[49]!==a?(x=(0,t.jsx)("div",{className:"MapInfoDialog-meta",children:a}),X[49]=a,X[50]=x):x=X[50],X[51]!==e||X[52]!==n?(y=n&&(0,t.jsxs)("blockquote",{className:"MapInfoDialog-quote",children:[(0,t.jsx)("p",{children:n}),e&&(0,t.jsxs)("cite",{children:["— ",e]})]}),X[51]=e,X[52]=n,X[53]=y):y=X[53],X[54]!==en?(b=en?.missionBlurb&&(0,t.jsx)("p",{className:"MapInfoDialog-blurb",children:en.missionBlurb.trim()}),X[54]=en,X[55]=b):b=X[55],v=l&&l.trim()&&(0,t.jsx)("div",{className:"MapInfoDialog-section",children:(0,t.jsx)(p,{markup:l})}),X[14]=es,X[15]=el,X[16]=er,X[17]=et,X[18]=Z,X[19]=en,X[20]=g,X[21]=x,X[22]=y,X[23]=b,X[24]=v,X[25]=M,X[26]=I,X[27]=S,X[28]=C,X[29]=L,X[30]=E,X[31]=P,X[32]=R,X[33]=T,X[34]=_,X[35]=B,X[36]=K,X[37]=U}else g=X[20],x=X[21],y=X[22],b=X[23],v=X[24],M=X[25],I=X[26],S=X[27],C=X[28],L=X[29],E=X[30],P=X[31],R=X[32],T=X[33],_=X[34],B=X[35],K=X[36],U=X[37];return X[56]!==en?($=en?.missionBriefing&&(0,t.jsxs)("div",{className:"MapInfoDialog-section",children:[(0,t.jsx)("h2",{className:"MapInfoDialog-sectionTitle",children:"Mission Briefing"}),(0,t.jsx)(p,{markup:en.missionBriefing})]}),X[56]=en,X[57]=$):$=X[57],X[58]!==eo?(G=eo&&(0,t.jsx)(k,{track:eo}),X[58]=eo,X[59]=G):G=X[59],X[60]!==g||X[61]!==x||X[62]!==y||X[63]!==b||X[64]!==v||X[65]!==$||X[66]!==G||X[67]!==K||X[68]!==U?(O=(0,t.jsxs)("div",{className:K,children:[U,g,x,y,b,v,$,G]}),X[60]=g,X[61]=x,X[62]=y,X[63]=b,X[64]=v,X[65]=$,X[66]=G,X[67]=K,X[68]=U,X[69]=O):O=X[69],X[70]!==es||X[71]!==el||X[72]!==er?(F=es&&!er&&(0,t.jsx)("div",{className:"MapInfoDialog-right",children:(0,t.jsx)(j,{src:es,alt:`${el} preview`},es)}),X[70]=es,X[71]=el,X[72]=er,X[73]=F):F=X[73],X[74]!==M||X[75]!==O||X[76]!==F?(q=(0,t.jsxs)("div",{className:M,children:[O,F]}),X[74]=M,X[75]=O,X[76]=F,X[77]=q):q=X[77],X[78]!==Z?(z=(0,t.jsx)("button",{className:"MapInfoDialog-closeBtn",onClick:Z,children:"Close"}),X[78]=Z,X[79]=z):z=X[79],X[80]===Symbol.for("react.memo_cache_sentinel")?(A=(0,t.jsx)("span",{className:"MapInfoDialog-hint",children:"I or Esc to close"}),X[80]=A):A=X[80],X[81]!==z?(Q=(0,t.jsxs)("div",{className:"MapInfoDialog-footer",children:[z,A]}),X[81]=z,X[82]=Q):Q=X[82],X[83]!==I||X[84]!==S||X[85]!==C||X[86]!==L||X[87]!==E||X[88]!==P||X[89]!==R||X[90]!==T||X[91]!==q||X[92]!==Q?(V=(0,t.jsxs)("div",{ref:I,className:S,onClick:C,onKeyDown:L,role:E,"aria-modal":P,"aria-label":R,tabIndex:T,children:[q,Q]}),X[83]=I,X[84]=S,X[85]=C,X[86]=L,X[87]=E,X[88]=P,X[89]=R,X[90]=T,X[91]=q,X[92]=Q,X[93]=V):V=X[93],X[94]!==_||X[95]!==B||X[96]!==V?(H=(0,t.jsx)("div",{className:_,onClick:B,children:V}),X[94]=_,X[95]=B,X[96]=V,X[97]=H):H=X[97],H}function N(e){return e.stopPropagation()}function w(e){return e.stopPropagation()}function D(e){e.stopImmediatePropagation()}e.s(["MapInfoDialog",()=>I],94247)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/bb0aa1c978feffed.js b/docs/_next/static/chunks/bb0aa1c978feffed.js new file mode 100644 index 00000000..8a402e03 --- /dev/null +++ b/docs/_next/static/chunks/bb0aa1c978feffed.js @@ -0,0 +1 @@ +(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/e830bdf778a42251.css b/docs/_next/static/chunks/e830bdf778a42251.css deleted file mode 100644 index 1b2646ec..00000000 --- a/docs/_next/static/chunks/e830bdf778a42251.css +++ /dev/null @@ -1 +0,0 @@ -html{box-sizing:border-box;background:#000;margin:0;padding:0;overflow:hidden}*,:before,:after{box-sizing:inherit;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:100%}body{margin:0;padding:0;overflow:hidden}main{width:100dvw;height:100dvh}#canvasContainer{z-index:0;position:absolute;inset:0}#controls{color:#fff;z-index:2;background:#00000080;border-radius:0 0 4px;padding:8px 12px 8px 8px;font-size:13px;position:fixed;top:0;left:0}input[type=range]{max-width:80px}.CheckboxField,.LabelledButton,.Field{align-items:center;gap:6px;display:flex}#controls,.Controls-dropdown,.Controls-group{justify-content:center;align-items:center;gap:20px;display:flex}@media (max-width:1279px){.Controls-dropdown[data-open=false]{display:none}.Controls-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}.Controls-group{flex-wrap:wrap;gap:12px 20px}}@media (max-width:639px){#controls{border-radius:0;right:0}#controls>.MissionSelect-inputWrapper{flex:1 1 0;min-width:0}#controls>.MissionSelect-inputWrapper .MissionSelect-input{width:100%}.Controls-toggle{flex:none}}.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}.ButtonLabel{font-size:12px}.IconButton svg{pointer-events:none}@media (hover:hover){.IconButton:hover{background:#0062b3cc;border-color:#fff6}}.IconButton:active,.IconButton[aria-expanded=true]{background:#0062b3b3;border-color:#ffffff4d;transform:translateY(1px)}.Controls-toggle{margin:0}@media (max-width:1279px){.LabelledButton{width:auto;padding:0 10px}}@media (min-width:1280px){.Controls-toggle,.LabelledButton .ButtonLabel{display:none}}.CopyCoordinatesButton[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton .ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton[data-copied=true] .ClipboardCheck{animation:.22s linear infinite showClipboardCheck;display:block}.CopyCoordinatesButton[data-copied=true] .MapPin{display:none}.StaticShapeLabel{color:#fff;white-space:nowrap;text-align:center;background:#00000080;border-radius:1px;padding:1px 3px;font-size:11px}.StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.AxisLabel{pointer-events:none;font-size:12px}.AxisLabel[data-axis=x]{color:#f90}.AxisLabel[data-axis=y]{color:#9f0}.AxisLabel[data-axis=z]{color:#09f}.MissionSelect-inputWrapper{align-items:center;display:flex;position:relative}.MissionSelect-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-input[aria-expanded=true]~.MissionSelect-shortcut{display:none}.MissionSelect-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-input[aria-expanded=true]{padding-right:8px}.MissionSelect-input:focus{border-color:#fff9}.MissionSelect-input::placeholder{color:#0000}.MissionSelect-selectedValue{pointer-events:none;align-items:center;gap:6px;display:flex;position:absolute;left:8px;right:36px;overflow:hidden}.MissionSelect-input[aria-expanded=true]~.MissionSelect-selectedValue{display:none}.MissionSelect-selectedName{color:#fff;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.MissionSelect-selectedValue>.MissionSelect-itemType{flex-shrink:0}.MissionSelect-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-list{padding:4px 0}.MissionSelect-list:has(>.MissionSelect-group:first-child){padding-top:0}.MissionSelect-group{padding-bottom:4px}.MissionSelect-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-group:not(:last-child){border-bottom:1px solid #ffffff4d}.MissionSelect-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-list>.MissionSelect-item:first-child{margin-top:0}.MissionSelect-item[data-active-item]{background:#ffffff26}.MissionSelect-item[aria-selected=true]{background:#6496ff4d}.MissionSelect-itemHeader{align-items:center;gap:6px;display:flex}.MissionSelect-itemName{color:#fff;font-size:14px;font-weight:600}.MissionSelect-itemTypes{gap:3px;display:flex}.MissionSelect-itemType{color:#fff;background:#ff9d0066;border-radius:3px;padding:2px 5px;font-size:10px;font-weight:600}.MissionSelect-itemType:hover{background:#ff9d00b3}.MissionSelect-itemMissionName{color:#ffffff80;font-size:12px}.MissionSelect-noResults{color:#ffffff80;text-align:center;padding:12px 8px;font-size:13px}.LoadingSpinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite LoadingSpinner-spin}@keyframes LoadingSpinner-spin{to{transform:rotate(360deg)}}#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%)}#loadingIndicator[data-complete=true]{animation:.3s ease-out forwards loadingComplete}@keyframes loadingComplete{0%{opacity:1}to{opacity:0}}.LoadingProgress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.LoadingProgress-bar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.LoadingProgress-text{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes showClipboardCheck{0%{opacity:1}to{opacity:.2}}.KeyboardOverlay{pointer-events:none;z-index:1;align-items:flex-end;gap:10px;display:flex;position:fixed;bottom:16px;left:50%;transform:translate(-50%)}.KeyboardOverlay-column{flex-direction:column;justify-content:center;gap:4px;display:flex}.KeyboardOverlay-row{justify-content:stretch;gap:4px;display:flex}.KeyboardOverlay-spacer{width:32px}.KeyboardOverlay-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-key[data-pressed=true]{color:#fff;background:#34bbab99;border-color:#23fddc80}.KeyboardOverlay-arrow{margin-right:3px}.TouchJoystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchJoystick--left{left:20px;transform:none}.TouchJoystick--right{left:auto;right:20px;transform:none}.TouchJoystick .back{background:#034f4c99!important;border:1px solid #00dbdf80!important;box-shadow:inset 0 0 10px #000000b3!important}.TouchJoystick .front{background:radial-gradient(circle,#17f7c6e6 0%,#09b8aaf2 100%)!important;border:2px solid #fff6!important;box-shadow:0 2px 4px #00000080,0 1px 1px #0000004d,inset 0 1px #ffffff26,inset 0 -1px 2px #0000004d!important} diff --git a/docs/_next/static/chunks/fcdc907286f09d63.js b/docs/_next/static/chunks/fcdc907286f09d63.js new file mode 100644 index 00000000..bf200306 --- /dev/null +++ b/docs/_next/static/chunks/fcdc907286f09d63.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)||"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)}t.s(["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",()=>C,"runServer",()=>T],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",()=>A,"createScriptCache",()=>v],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(){return{scripts:new Map,generatedCode:new WeakMap}}function w(t){return t.toLowerCase()}function M(t){return Number(t)>>>0}function S(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 A(t={}){let e=new o,i=new o,s=new o,r=[],u=new h,c=3,p=1027,d=new Map,m=new o,f=new o,g=new o,y=new o,x=new o;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}"`);g.set(e.slice(1),i)}let _=new Set,T=new Set,I=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,z=t.cache??v(),k=z.scripts,B=z.generatedCode,R=new Map;function O(t){let e=R.get(t);return e&&e.length>0?e[e.length-1]:void 0}function E(t,e,i){let s;(s=R.get(t))||(s=[],R.set(t,s)),s.push(e);try{return i()}finally{let e;(e=R.get(t))&&e.pop()}}function P(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function L(t,i){return e.get(t)?.get(i)??null}let N=new Set,F=null,$=null,V=(t.builtins??b)({runtime:()=>$,fileSystem:t.fileSystem??null});function D(t){let n=s.get(t);if(!n)return void u.add(t);if(!n.active){for(let[t,i]of(n.active=!0,r.push(n.name),n.methods)){e.has(t)||e.set(t,new o);let s=e.get(t);for(let[t,e]of i)s.has(t)||s.set(t,[]),s.get(t).push(e)}for(let[t,e]of n.functions)i.has(t)||i.set(t,[]),i.get(t).push(e)}}function j(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?m.get(t)??null:"number"==typeof t?d.get(t)??null:null}function U(t,e,i){let s=j(t);if(null==s)return 0;let r=H(s[e]);return s[e]=r+i,r}function W(t,e){let i=L(t,e);return i&&i.length>0?i[i.length-1]:null}function G(t,e,i,s){let r=L(t,e);return r&&0!==r.length?{found:!0,result:E(P(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function q(t,e,i,s){let r=y.get(t);if(r){let t=r.get(e);if(t)for(let e of t)e(i,...s)}}function H(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function J(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 X(t){return null==t||""===t?null:J(String(t))}function Z(t){function e(t,e){return t+e.join("_")}return{get:(i,...s)=>t.get(e(i,s))??"",set(i,...s){if(0===s.length)throw Error("set() requires at least a value argument");if(1===s.length)return t.set(i,s[0]),s[0];let r=s[s.length-1],n=s.slice(0,-1);return t.set(e(i,n),r),r},postInc(i,...s){let r=e(i,s),n=H(t.get(r));return t.set(r,n+1),n},postDec(i,...s){let r=e(i,s),n=H(t.get(r));return t.set(r,n-1),n}}}function Y(){return Z(new o)}let Q={registerMethod:function(t,i,s){if(F)F.methods.has(t)||F.methods.set(t,new o),F.methods.get(t).set(i,s);else{e.has(t)||e.set(t,new o);let r=e.get(t);r.has(i)||r.set(i,[]),r.get(i).push(s)}},registerFunction:function(t,e){F?F.functions.set(t,e):(i.has(t)||i.set(t,[]),i.get(t).push(e))},package:function(t,e){let i=s.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},s.set(t,i));let r=F;F=i,e(),F=r,u.has(t)&&(u.delete(t),D(t))},activatePackage:D,deactivatePackage:function(t){let n=s.get(t);if(!n||!n.active)return;n.active=!1;let a=r.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,i]of(-1!==a&&r.splice(a,1),n.methods)){let s=e.get(t);if(s)for(let[t,e]of i){let i=s.get(t);if(i){let t=i.indexOf(e);-1!==t&&i.splice(t,1)}}}for(let[t,e]of n.functions){let s=i.get(t);if(s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}},create:function(t,e,i,s){let r=w(t),n=p++,a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[w(t)]=e;a.superclass&&(a._superClass=w(String(a.superclass)),a.class&&x.set(w(String(a.class)),a._superClass)),d.set(n,a);let o=S(e);if(o&&(a._name=o,m.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=W(t,"onAdd");return h&&h(a),a},datablock:function(t,e,i,s){let r=w(t),n=c++,a={_class:r,_className:t,_id:n,_isDatablock:!0},o=S(i);if(o){let t=f.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[w(t)]=e;d.set(n,a);let h=S(e);return h&&(a._name=h,m.set(h,a),f.set(h,a)),a},deleteObject:function t(e){let i;if(null==e||("number"==typeof e?i=d.get(e):"string"==typeof e?i=m.get(e):"object"==typeof e&&e._id&&(i=e),!i))return!1;let s=W(i._className,"onRemove");if(s&&s(i),d.delete(i._id),i._name&&m.delete(i._name),i._isDatablock&&i._name&&f.delete(i._name),i._parent&&i._parent._children){let t=i._parent._children.indexOf(i);-1!==t&&i._parent._children.splice(t,1)}if(i._children)for(let e of[...i._children])t(e);return!0},prop:function(t,e){let i=j(t);return null==i?"":i[w(e)]??""},setProp:function(t,e,i){let s=j(t);return null==s||(s[w(e)]=i),i},getIndex:function(t,e){let i=j(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=j(t);return null==s||(s[String(e)]=i),i},propPostInc:function(t,e){return U(t,w(e),1)},propPostDec:function(t,e){return U(t,w(e),-1)},indexPostInc:function(t,e){return U(t,String(e),1)},indexPostDec:function(t,e){return U(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=X(t)))return"";let s=t.class||t._className||t._class;if(s){let r=G(s,e,t,i);if(r.found)return q(s,e,t,i),r.result}let r=t._superClass||x.get(s);for(;r;){let s=G(r,e,t,i);if(s.found)return q(r,e,t,i),s.result;r=x.get(r)}return""},nsCall:function(t,e,...i){let s=L(t,e);if(!s||0===s.length)return"";let r=P(t,e),n=s[s.length-1],a=E(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&q(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=L(t,e);if(!i||0===i.length)return null;let s=P(t,e),r=i[i.length-1];return(...t)=>E(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=L(t,e),n=P(t,e),a=O(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=E(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&q(t,e,i,s),h}let o=x.get(t);for(;o;){let t=L(o,e);if(t&&t.length>0){let r=E(P(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&q(o,e,i,s),r}o=x.get(o)}return""},parentFunc:function(t,...e){let s=i.get(t);if(!s)return"";let r=t.toLowerCase(),n=O(r);if(void 0===n||n<1)return"";let a=n-1;return E(r,a,()=>s[a](...e))},add:function(t,e){return H(t)+H(e)},sub:function(t,e){return H(t)-H(e)},mul:function(t,e){return H(t)*H(e)},div:function(t,e){return H(t)/H(e)},neg:function(t){return-H(t)},lt:function(t,e){return H(t)H(e)},ge:function(t,e){return H(t)>=H(e)},eq:function(t,e){return H(t)===H(e)},ne:function(t,e){return H(t)!==H(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return M(t)&M(e)},bitor:function(t,e){return M(t)|M(e)},bitxor:function(t,e){return M(t)^M(e)},shl:function(t,e){return M(M(t)<<(31&M(e)))},shr:function(t,e){return M(t)>>>(31&M(e))},bitnot:function(t){return~M(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&&w(t)===i)return void s();e.default&&e.default()},deref:X,nameToId:function(t){let e=J(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?d.has(t):"string"==typeof t&&m.has(t)))},isFunction:function(t){return i.has(t)||t.toLowerCase()in V},isPackage:function(t){return s.has(t)},isActivePackage:function(t){let e=s.get(t);return e?.active??!1},getPackageList:function(){return r.join(" ")},locals:Y,onMethodCalled(t,e,i){let s=y.get(t);s||(s=new o,y.set(t,s));let r=s.get(e);r||(r=[],s.set(e,r)),r.push(i)}},K={call(t,...e){let s=i.get(t);if(s&&s.length>0)return E(t.toLowerCase(),s.length-1,()=>s[s.length-1](...e));let r=V[t.toLowerCase()];return r?r(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tt=Z(g),te={methods:e,functions:i,packages:s,activePackages:r,objectsById:d,objectsByName:m,datablocks:f,globals:g,executedScripts:_,failedScripts:T,scripts:k,generatedCode:B,pendingTimeouts:N,startTime:Date.now()};function ti(t){let e=function(t){let e=B.get(t);null==e&&(e=new n(void 0).generate(t),B.set(t,e));return e}(t),i=Y();Function("$","$f","$g","$l",e)(Q,K,tt,i)}function ts(t,e){return{execute(){if(e){let t=l(e);te.executedScripts.add(t)}ti(t)}}}async function tr(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(te.scripts.has(n)||te.failedScripts.has(n))return;if(I&&I(n)){console.warn(`Ignoring script: ${e}`),te.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}`),te.failedScripts.add(n),t.progress?.completeItem();return}try{a=C(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),te.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tr(a.execScriptPaths,i,h),te.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tn(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(te.scripts.has(s))return ts(te.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 ta(r,{path:e});return t.progress?.completeItem(),n}async function ta(t,e){if(e?.path){let t=l(e.path);if(te.scripts.has(t))return ts(te.scripts.get(t),e.path)}return to(C(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);te.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tr(n,s,r),ts(e,i?.path)}return $={$:Q,$f:K,$g:tt,state:te,destroy:function(){for(let t of te.pendingTimeouts)clearTimeout(t);te.pendingTimeouts.clear()},executeAST:ti,loadFromPath:tn,loadFromSource:ta,loadFromAST:to,call:(t,...e)=>K.call(t,...e),getObjectByName:t=>m.get(t)}}function _(){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 C(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 T(t){let{missionName:e,missionType:i,runtimeOptions:s,onMissionLoadDone:r}=t,{signal:n,fileSystem:a,globals:o={},preloadScripts:h=[]}=s??{},l=a.findFiles("scripts/*Game.cs"),u=A({...s,globals:{...o,"$Host::Map":e,"$Host::MissionType":i},preloadScripts:[...h,...l]}),c=async function(){try{let t=await u.loadFromPath("scripts/server.cs");n?.throwIfAborted(),await u.loadFromPath(`missions/${e}.mis`),n?.throwIfAborted(),t.execute(),r&&u.$.onMethodCalled("DefaultGame","missionLoadDone",r);let i=await u.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");n?.throwIfAborted(),i.execute()}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:u,ready:c}}t.s(["createProgressTracker",()=>_],38433);let I=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,z=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,k=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,B={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 R(t){let e=C(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(z))?{type:"sectionBegin",name:e[1]}:(e=t.match(k))?{type:"sectionEnd",name:e[1]}:(e=t.match(I))?{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=>B[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 O(t,e){if(t)return t[e.toLowerCase()]}function E(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function P(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function L(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function N(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function F(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",()=>E,"getInt",()=>P,"getPosition",()=>L,"getProperty",()=>O,"getRotation",()=>F,"getScale",()=>N,"parseMissionScript",()=>R],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/69160059bd4715b0.js b/docs/_next/static/chunks/fd5173b60870d6fb.js similarity index 99% rename from docs/_next/static/chunks/69160059bd4715b0.js rename to docs/_next/static/chunks/fd5173b60870d6fb.js index 373481fc..246d3e36 100644 --- a/docs/_next/static/chunks/69160059bd4715b0.js +++ b/docs/_next/static/chunks/fd5173b60870d6fb.js @@ -208,4 +208,4 @@ void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } - `}),[P]);return a.createElement("group",(0,c.default)({},L,{ref:q}),E&&!et&&a.createElement("mesh",{castShadow:T,receiveShadow:w,ref:Q},D||a.createElement("planeGeometry",null),O||a.createElement("shaderMaterial",{side:s.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",()=>b],60099);let F=[0,0,0],S=(0,a.memo)(function(e){let t,r,c,u,f,d=(0,o.c)(19),{children:m,color:g,position:h,opacity:v}=e,p=void 0===g?"white":g,x=void 0===h?F:h,y=void 0===v?"fadeWithDistance":v,S="fadeWithDistance"===y,M=(0,a.useRef)(null),P=function(e){let t,r,i=(0,o.c)(3),{camera:c}=(0,l.useThree)(),u=(0,a.useRef)(null),f=(r=(0,a.useRef)(null),(0,n.useFrame)(()=>{e.current&&(r.current??=new s.Vector3,e.current.getWorldPosition(r.current))}),r);return i[0]!==c||i[1]!==f?(t=()=>{f.current?u.current=c.position.distanceTo(f.current):u.current=null},i[0]=c,i[1]=f,i[2]=t):t=i[2],(0,n.useFrame)(t),u}(M),[E,_]=(0,a.useState)(0!==y),T=(0,a.useRef)(null);return d[0]!==P||d[1]!==S?(t=()=>{if(S&&T.current&&null!=P.current){let e=Math.max(0,Math.min(1,1-P.current/200));T.current.style.opacity=e.toString()}},d[0]=P,d[1]=S,d[2]=t):t=d[2],d[3]!==P||d[4]!==S||d[5]!==E?(r=[E,S,P],d[3]=P,d[4]=S,d[5]=E,d[6]=r):r=d[6],(0,a.useEffect)(t,r),d[7]!==P||d[8]!==S||d[9]!==E||d[10]!==y?(c=()=>{if(S){let e=P.current,t=null!=e&&e<200;if(E!==t&&_(t),T.current&&t){let t=Math.max(0,Math.min(1,1-e/200));T.current.style.opacity=t.toString()}}else _(0!==y),T.current&&(T.current.style.opacity=y.toString())},d[7]=P,d[8]=S,d[9]=E,d[10]=y,d[11]=c):c=d[11],(0,n.useFrame)(c),d[12]!==m||d[13]!==p||d[14]!==E||d[15]!==x?(u=E?(0,i.jsx)(b,{position:x,center:!0,children:(0,i.jsx)("div",{ref:T,className:"StaticShapeLabel",style:{color:p},children:m})}):null,d[12]=m,d[13]=p,d[14]=E,d[15]=x,d[16]=u):u=d[16],d[17]!==u?(f=(0,i.jsx)("group",{ref:M,children:u}),d[17]=u,d[18]=f):f=d[18],f});e.s(["FloatingLabel",0,S],89887)},51434,e=>{"use strict";var t=e.i(43476),r=e.i(932),i=e.i(71645),o=e.i(73949),a=e.i(90072);let n=(0,i.createContext)(void 0);function l(e){let l,c,u,f,d=(0,r.c)(7),{children:m}=e,{camera:g}=(0,o.useThree)();d[0]===Symbol.for("react.memo_cache_sentinel")?(l={audioLoader:null,audioListener:null},d[0]=l):l=d[0];let[h,v]=(0,i.useState)(l);return d[1]!==g?(c=()=>{let e=new a.AudioLoader,t=g.children.find(s);t||(t=new a.AudioListener,g.add(t)),v({audioLoader:e,audioListener:t})},u=[g],d[1]=g,d[2]=c,d[3]=u):(c=d[2],u=d[3]),(0,i.useEffect)(c,u),d[4]!==h||d[5]!==m?(f=(0,t.jsx)(n.Provider,{value:h,children:m}),d[4]=h,d[5]=m,d[6]=f):f=d[6],f}function s(e){return e instanceof a.AudioListener}function c(){let e=(0,i.useContext)(n);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>l,"useAudio",()=>c])},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/4e5626f3eeee0985.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)))}]); \ No newline at end of file + `}),[P]);return a.createElement("group",(0,c.default)({},L,{ref:q}),E&&!et&&a.createElement("mesh",{castShadow:T,receiveShadow:w,ref:Q},D||a.createElement("planeGeometry",null),O||a.createElement("shaderMaterial",{side:s.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",()=>b],60099);let F=[0,0,0],S=(0,a.memo)(function(e){let t,r,c,u,f,d=(0,o.c)(19),{children:m,color:g,position:h,opacity:v}=e,p=void 0===g?"white":g,x=void 0===h?F:h,y=void 0===v?"fadeWithDistance":v,S="fadeWithDistance"===y,M=(0,a.useRef)(null),P=function(e){let t,r,i=(0,o.c)(3),{camera:c}=(0,l.useThree)(),u=(0,a.useRef)(null),f=(r=(0,a.useRef)(null),(0,n.useFrame)(()=>{e.current&&(r.current??=new s.Vector3,e.current.getWorldPosition(r.current))}),r);return i[0]!==c||i[1]!==f?(t=()=>{f.current?u.current=c.position.distanceTo(f.current):u.current=null},i[0]=c,i[1]=f,i[2]=t):t=i[2],(0,n.useFrame)(t),u}(M),[E,_]=(0,a.useState)(0!==y),T=(0,a.useRef)(null);return d[0]!==P||d[1]!==S?(t=()=>{if(S&&T.current&&null!=P.current){let e=Math.max(0,Math.min(1,1-P.current/200));T.current.style.opacity=e.toString()}},d[0]=P,d[1]=S,d[2]=t):t=d[2],d[3]!==P||d[4]!==S||d[5]!==E?(r=[E,S,P],d[3]=P,d[4]=S,d[5]=E,d[6]=r):r=d[6],(0,a.useEffect)(t,r),d[7]!==P||d[8]!==S||d[9]!==E||d[10]!==y?(c=()=>{if(S){let e=P.current,t=null!=e&&e<200;if(E!==t&&_(t),T.current&&t){let t=Math.max(0,Math.min(1,1-e/200));T.current.style.opacity=t.toString()}}else _(0!==y),T.current&&(T.current.style.opacity=y.toString())},d[7]=P,d[8]=S,d[9]=E,d[10]=y,d[11]=c):c=d[11],(0,n.useFrame)(c),d[12]!==m||d[13]!==p||d[14]!==E||d[15]!==x?(u=E?(0,i.jsx)(b,{position:x,center:!0,children:(0,i.jsx)("div",{ref:T,className:"StaticShapeLabel",style:{color:p},children:m})}):null,d[12]=m,d[13]=p,d[14]=E,d[15]=x,d[16]=u):u=d[16],d[17]!==u?(f=(0,i.jsx)("group",{ref:M,children:u}),d[17]=u,d[18]=f):f=d[18],f});e.s(["FloatingLabel",0,S],89887)},51434,e=>{"use strict";var t=e.i(43476),r=e.i(932),i=e.i(71645),o=e.i(73949),a=e.i(90072);let n=(0,i.createContext)(void 0);function l(e){let l,c,u,f,d=(0,r.c)(7),{children:m}=e,{camera:g}=(0,o.useThree)();d[0]===Symbol.for("react.memo_cache_sentinel")?(l={audioLoader:null,audioListener:null},d[0]=l):l=d[0];let[h,v]=(0,i.useState)(l);return d[1]!==g?(c=()=>{let e=new a.AudioLoader,t=g.children.find(s);t||(t=new a.AudioListener,g.add(t)),v({audioLoader:e,audioListener:t})},u=[g],d[1]=g,d[2]=c,d[3]=u):(c=d[2],u=d[3]),(0,i.useEffect)(c,u),d[4]!==h||d[5]!==m?(f=(0,t.jsx)(n.Provider,{value:h,children:m}),d[4]=h,d[5]=m,d[6]=f):f=d[6],f}function s(e){return e instanceof a.AudioListener}function c(){let e=(0,i.useContext)(n);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>l,"useAudio",()=>c])},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/4e5626f3eeee0985.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/aa3c97b2da210ead.js"].map(t=>e.l(t))).then(()=>t(94247)))}]); \ No newline at end of file diff --git a/docs/_not-found/__next._full.txt b/docs/_not-found/__next._full.txt index 6312f5c9..f1b9cb84 100644 --- a/docs/_not-found/__next._full.txt +++ b/docs/_not-found/__next._full.txt @@ -7,8 +7,8 @@ 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"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"P":null,"b":"h-5uE8DkCRlEiwNbWUb1K","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/e830bdf778a42251.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} +:HL["/t2-mapper/_next/static/chunks/748c06086372a1f2.css","style"] +0:{"P":null,"b":"8Gyh12L4dTN96synIylXt","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/748c06086372a1f2.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} 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"] 7:null diff --git a/docs/_not-found/__next._head.txt b/docs/_not-found/__next._head.txt index 08f34a86..66a9c801 100644 --- a/docs/_not-found/__next._head.txt +++ b/docs/_not-found/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$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} +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$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/_not-found/__next._index.txt b/docs/_not-found/__next._index.txt index 76a674b1..cd08d784 100644 --- a/docs/_not-found/__next._index.txt +++ b/docs/_not-found/__next._index.txt @@ -2,5 +2,5 @@ 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"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e830bdf778a42251.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} +:HL["/t2-mapper/_next/static/chunks/748c06086372a1f2.css","style"] +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/748c06086372a1f2.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} diff --git a/docs/_not-found/__next._not-found.__PAGE__.txt b/docs/_not-found/__next._not-found.__PAGE__.txt index a2c7a2f5..6f317107 100644 --- a/docs/_not-found/__next._not-found.__PAGE__.txt +++ b/docs/_not-found/__next._not-found.__PAGE__.txt @@ -1,5 +1,5 @@ 1:"$Sreact.fragment" 2:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] 3:"$Sreact.suspense" -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","c",{"children":[[["$","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."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","c",{"children":[[["$","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."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false} 4:null diff --git a/docs/_not-found/__next._not-found.txt b/docs/_not-found/__next._not-found.txt index 5a3103fe..449fbfff 100644 --- a/docs/_not-found/__next._not-found.txt +++ b/docs/_not-found/__next._not-found.txt @@ -1,4 +1,4 @@ 1:"$Sreact.fragment" 2:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 3:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"8Gyh12L4dTN96synIylXt","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/_not-found/__next._tree.txt b/docs/_not-found/__next._tree.txt index d89d902f..81b38975 100644 --- a/docs/_not-found/__next._tree.txt +++ b/docs/_not-found/__next._tree.txt @@ -1,2 +1,2 @@ -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"buildId":"h-5uE8DkCRlEiwNbWUb1K","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +:HL["/t2-mapper/_next/static/chunks/748c06086372a1f2.css","style"] +0:{"buildId":"8Gyh12L4dTN96synIylXt","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","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/_not-found/index.html b/docs/_not-found/index.html index 5d37cd20..4a374c3a 100644 --- a/docs/_not-found/index.html +++ b/docs/_not-found/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/_not-found/index.txt b/docs/_not-found/index.txt index 6312f5c9..f1b9cb84 100644 --- a/docs/_not-found/index.txt +++ b/docs/_not-found/index.txt @@ -7,8 +7,8 @@ 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"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"P":null,"b":"h-5uE8DkCRlEiwNbWUb1K","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/e830bdf778a42251.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} +:HL["/t2-mapper/_next/static/chunks/748c06086372a1f2.css","style"] +0:{"P":null,"b":"8Gyh12L4dTN96synIylXt","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/748c06086372a1f2.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} 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"] 7:null diff --git a/docs/index.html b/docs/index.html index 649dc92a..92a4534a 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 4da93e34..a0f400a5 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -3,14 +3,14 @@ 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/69160059bd4715b0.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/05a33d80986f6f4c.js","/t2-mapper/_next/static/chunks/648c99009376fcef.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/fd5173b60870d6fb.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.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"] 10:I[68027,[],"default"] -:HL["/t2-mapper/_next/static/chunks/e830bdf778a42251.css","style"] -0:{"P":null,"b":"h-5uE8DkCRlEiwNbWUb1K","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/e830bdf778a42251.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/69160059bd4715b0.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/05a33d80986f6f4c.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/648c99009376fcef.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/748c06086372a1f2.css","style"] +0:{"P":null,"b":"8Gyh12L4dTN96synIylXt","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/748c06086372a1f2.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/fd5173b60870d6fb.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/5619c5b2b1355f74.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/143bcebca21d60e5.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.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} 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"}]] diff --git a/src/components/InspectorControls.tsx b/src/components/InspectorControls.tsx index f30939c0..c55f8eb8 100644 --- a/src/components/InspectorControls.tsx +++ b/src/components/InspectorControls.tsx @@ -8,12 +8,13 @@ import { MissionSelect } from "./MissionSelect"; import { RefObject, useEffect, useState, useRef } from "react"; import { Camera } from "three"; import { CopyCoordinatesButton } from "./CopyCoordinatesButton"; -import { FiSettings } from "react-icons/fi"; +import { FiInfo, FiSettings } from "react-icons/fi"; export function InspectorControls({ missionName, missionType, onChangeMission, + onOpenMapInfo, cameraRef, isTouch, }: { @@ -26,6 +27,7 @@ export function InspectorControls({ missionName: string; missionType: string; }) => void; + onOpenMapInfo: () => void; cameraRef: RefObject; isTouch: boolean | null; }) { @@ -70,110 +72,6 @@ export function InspectorControls({ } }; - const settingsFields = ( - <> -
- -
-
-
- { - setFogEnabled(event.target.checked); - }} - /> - -
-
- { - setAudioEnabled(event.target.checked); - }} - /> - -
-
-
-
- { - setAnimationEnabled(event.target.checked); - }} - /> - -
-
- { - setDebugMode(event.target.checked); - }} - /> - -
-
-
-
- - setFov(parseInt(event.target.value))} - /> - {fov} -
-
- - - setSpeedMultiplier(parseFloat(event.target.value)) - } - /> -
-
- {isTouch && ( -
-
- {" "} - -
-
- )} - - ); - return (
- {settingsFields} +
+ + +
+
+
+ { + setFogEnabled(event.target.checked); + }} + /> + +
+
+ { + setAudioEnabled(event.target.checked); + }} + /> + +
+
+
+
+ { + setAnimationEnabled(event.target.checked); + }} + /> + +
+
+ { + setDebugMode(event.target.checked); + }} + /> + +
+
+
+
+ + setFov(parseInt(event.target.value))} + /> + {fov} +
+
+ + + setSpeedMultiplier(parseFloat(event.target.value)) + } + /> +
+
+ {isTouch && ( +
+
+ {" "} + +
+
+ )}
diff --git a/src/components/MapInfoDialog.tsx b/src/components/MapInfoDialog.tsx new file mode 100644 index 00000000..e0954edc --- /dev/null +++ b/src/components/MapInfoDialog.tsx @@ -0,0 +1,317 @@ +import { useEffect, useRef, useState } from "react"; +import { FaVolumeUp, FaVolumeMute } from "react-icons/fa"; +import { useQuery } from "@tanstack/react-query"; +import { loadMission, getUrlForPath, RESOURCE_ROOT_URL } from "../loaders"; +import { getStandardTextureResourceKey } from "../manifest"; +import { GuiMarkup, filterMissionStringByMode } from "../torqueGuiMarkup"; +import type * as AST from "../torqueScript/ast"; + +function useParsedMission(name: string) { + return useQuery({ + queryKey: ["parsedMission", name], + queryFn: () => loadMission(name), + }); +} + +function getMissionGroupProps(ast: AST.Program): Record { + for (const node of ast.body) { + if (node.type !== "ObjectDeclaration") continue; + const { instanceName, body } = node; + if ( + instanceName && + instanceName.type === "Identifier" && + instanceName.name.toLowerCase() === "missiongroup" + ) { + const props: Record = {}; + for (const item of body) { + if (item.type !== "Assignment") continue; + const { target, value } = item; + if (target.type === "Identifier" && value.type === "StringLiteral") { + props[target.name.toLowerCase()] = value.value; + } + } + return props; + } + } + return {}; +} + +function getBitmapUrl( + bitmap: string | null, + missionName: string, +): string | null { + // Try bitmap from pragma comment first (single-player missions use this) + if (bitmap) { + try { + const key = getStandardTextureResourceKey(`textures/gui/${bitmap}`); + return getUrlForPath(key); + } catch {} + } + // Fall back to Load_.png convention (multiplayer missions) + try { + const key = getStandardTextureResourceKey( + `textures/gui/Load_${missionName}`, + ); + return getUrlForPath(key); + } catch {} + return null; +} + +/** + * Renders a preview image bypassing browser color management, matching how + * Tribes 2 displayed these textures (raw pixel values, no gamma conversion). + * Many T2 preview PNGs embed an incorrect gAMA chunk (22727 = gamma 4.4 + * instead of the correct 45455 = gamma 2.2), which causes browsers to + * over-darken them. `colorSpaceConversion: "none"` ignores gAMA/ICC data. + */ +function RawPreviewImage({ + src, + alt, + className = "MapInfoDialog-preview", +}: { + src: string; + alt: string; + className?: string; +}) { + const canvasRef = useRef(null); + const [isLoaded, setLoaded] = useState(false); + + useEffect(() => { + let cancelled = false; + fetch(src) + .then((r) => r.blob()) + .then((blob) => createImageBitmap(blob, { colorSpaceConversion: "none" })) + .then((bitmap) => { + if (cancelled) { + bitmap.close(); + return; + } + const canvas = canvasRef.current; + if (!canvas) { + bitmap.close(); + return; + } + canvas.width = bitmap.width; + canvas.height = bitmap.height; + canvas.getContext("2d")?.drawImage(bitmap, 0, 0); + bitmap.close(); + setLoaded(true); + }) + .catch(() => {}); + return () => { + cancelled = true; + }; + }, [src]); + + return ( + + ); +} + +function MusicPlayer({ track }: { track: string }) { + const [playing, setPlaying] = useState(false); + const [available, setAvailable] = useState(true); + const audioRef = useRef(null); + const url = `${RESOURCE_ROOT_URL}music/${track.toLowerCase()}.mp3`; + + useEffect(() => { + return () => { + audioRef.current?.pause(); + }; + }, []); + + const toggle = () => { + const audio = audioRef.current; + if (!audio) return; + if (playing) { + audio.pause(); + } else { + audio.play().catch(() => setAvailable(false)); + } + }; + + return ( +
+
+ ); +} + +export function MapInfoDialog({ + open, + onClose, + missionName, + missionType, +}: { + open: boolean; + onClose: () => void; + missionName: string; + missionType: string; +}) { + const { data: parsedMission } = useParsedMission(missionName); + const dialogRef = useRef(null); + + useEffect(() => { + if (open) { + dialogRef.current?.focus(); + document.exitPointerLock(); + } + }, [open]); + + // While open: block keyboard events from reaching drei, and handle close keys. + useEffect(() => { + if (!open) return; + const handleKeyDown = (e: KeyboardEvent) => { + if (e.code === "KeyI" || e.key === "Escape") { + onClose(); + } else if (e.key === "k" && (e.metaKey || e.ctrlKey)) { + onClose(); + return; // let Cmd-K propagate to open the mission search + } + e.stopImmediatePropagation(); + }; + const handleKeyUp = (e: KeyboardEvent) => { + e.stopImmediatePropagation(); + }; + window.addEventListener("keydown", handleKeyDown, { capture: true }); + window.addEventListener("keyup", handleKeyUp, { capture: true }); + return () => { + window.removeEventListener("keydown", handleKeyDown, { capture: true }); + window.removeEventListener("keyup", handleKeyUp, { capture: true }); + }; + }, [open, onClose]); + + if (!open) return null; + + const missionGroupProps = parsedMission + ? getMissionGroupProps(parsedMission.ast) + : {}; + const bitmapUrl = parsedMission + ? getBitmapUrl(parsedMission.bitmap, missionName) + : null; + const displayName = parsedMission?.displayName ?? missionName; + const typeKey = missionType.toLowerCase(); + const isSinglePlayer = typeKey === "singleplayer"; + + const musicTrack = missionGroupProps["musictrack"]; + + const missionString = parsedMission?.missionString + ? filterMissionStringByMode(parsedMission.missionString, missionType) + : null; + + // Split quote into body text and attribution line + const quoteLines = parsedMission?.missionQuote?.trim().split("\n") ?? []; + let quoteText = ""; + let quoteAttrib = ""; + for (const line of quoteLines) { + const trimmed = line.trim(); + if (trimmed.match(/^-+\s/)) { + quoteAttrib = trimmed.replace(/^-+\s*/, "").trim(); + } else if (trimmed) { + quoteText += (quoteText ? " " : "") + trimmed; + } + } + + return ( +
+
e.stopPropagation()} + onKeyDown={(e) => e.stopPropagation()} + role="dialog" + aria-modal="true" + aria-label="Map Information" + tabIndex={-1} + > +
+
+ {bitmapUrl && isSinglePlayer && ( + + )} +

{displayName}

+
+ {parsedMission?.planetName && ( + + {parsedMission.planetName} + + )} +
+ + {quoteText && ( +
+

{quoteText}

+ {quoteAttrib && — {quoteAttrib}} +
+ )} + + {parsedMission?.missionBlurb && ( +

+ {parsedMission.missionBlurb.trim()} +

+ )} + + {missionString && missionString.trim() && ( +
+ +
+ )} + + {parsedMission?.missionBriefing && ( +
+

Mission Briefing

+ +
+ )} + + {musicTrack && } +
+ + {bitmapUrl && !isSinglePlayer && ( +
+ +
+ )} +
+ +
+ + I or Esc to close +
+
+
+ ); +} diff --git a/src/loaders.ts b/src/loaders.ts index a18ff7cc..2dbe9b3d 100644 --- a/src/loaders.ts +++ b/src/loaders.ts @@ -91,7 +91,18 @@ export async function loadDetailMapList(name: string) { export async function loadMission(name: string) { const missionInfo = getMissionInfo(name); const res = await fetch(getUrlForPath(missionInfo.resourcePath)); - const missionScript = await res.text(); + const buffer = await res.arrayBuffer(); + // Most mission files are Windows-1252 (common circa 2001), but some were + // later re-saved as UTF-8. Try strict UTF-8 first; fall back to Windows-1252. + let missionScript: string; + try { + missionScript = new TextDecoder("utf-8", { fatal: true }).decode(buffer); + } catch { + missionScript = new TextDecoder("windows-1252").decode(buffer); + } + // Some files were saved as UTF-8 with corrupted Windows-1252 characters + // (e.g. smart quotes became U+FFFD replacement characters). Fix these. + missionScript = missionScript.replaceAll("\uFFFD", "'"); return parseMissionScript(missionScript); } diff --git a/src/torqueGuiMarkup.tsx b/src/torqueGuiMarkup.tsx new file mode 100644 index 00000000..7ecf377f --- /dev/null +++ b/src/torqueGuiMarkup.tsx @@ -0,0 +1,305 @@ +import { useMemo } from "react"; +import { getUrlForPath } from "./loaders"; +import { getStandardTextureResourceKey } from "./manifest"; + +// Types + +interface Style { + color?: string; + fontSize?: number; +} + +interface Span { + type: "span"; + text: string; + style: Style; +} + +interface Bitmap { + type: "bitmap"; + name: string; +} + +type Inline = Span | Bitmap; + +interface Line { + align: "left" | "center" | "right"; + /** Container padding-left for non-bullet lines. */ + lmargin: number; + /** When > 0, a bitmap precedes indented text — render as bullet layout. */ + textIndent: number; + items: Inline[]; +} + +// Tokenizer + +type Token = + | { type: "text"; value: string } + | { type: "newline" } + | { type: "tag"; name: string; arg: string }; + +function tokenize(input: string): Token[] { + const tokens: Token[] = []; + const re = /<([^>]*)>/g; + let last = 0; + + const pushText = (text: string) => { + const parts = text.split("\n"); + parts.forEach((part, i) => { + if (part) tokens.push({ type: "text", value: part }); + if (i < parts.length - 1) tokens.push({ type: "newline" }); + }); + }; + + let m: RegExpExecArray | null; + while ((m = re.exec(input))) { + if (m.index > last) pushText(input.slice(last, m.index)); + last = m.index + m[0].length; + const raw = m[1].trim(); + const sep = raw.indexOf(":"); + const name = (sep === -1 ? raw : raw.slice(0, sep)).toLowerCase(); + const arg = sep === -1 ? "" : raw.slice(sep + 1); + tokens.push({ type: "tag", name, arg }); + } + + if (last < input.length) pushText(input.slice(last)); + return tokens; +} + +// Parser + +function parseFontSize(arg: string): number { + // arg is "FontName:size" — size is after the last colon + const last = arg.lastIndexOf(":"); + const size = parseInt(last === -1 ? arg : arg.slice(last + 1), 10) || 14; + return Math.min(size, 16); +} + +function parseMarkup(input: string): Line[] { + const tokens = tokenize(input); + + // Style state (affected by spush/spop) + const styleStack: Style[] = []; + let style: Style = {}; + + // Layout state (persistent, not stack-based) + let align: Line["align"] = "left"; + let lmargin = 0; + + // Current line being accumulated + let items: Inline[] = []; + let lineAlign: Line["align"] = "left"; + let lineLmargin = 0; + let hasBitmap = false; + let textIndent = 0; + + const lines: Line[] = []; + + const flushLine = () => { + lines.push({ align: lineAlign, lmargin: lineLmargin, textIndent, items }); + items = []; + lineAlign = align; + lineLmargin = lmargin; + hasBitmap = false; + textIndent = 0; + }; + + const addSpan = (text: string) => { + if (!text) return; + // Merge adjacent spans with identical style + const prev = items[items.length - 1]; + if ( + prev?.type === "span" && + prev.style.color === style.color && + prev.style.fontSize === style.fontSize + ) { + prev.text += text; + } else { + items.push({ type: "span", text, style: { ...style } }); + } + }; + + for (const tok of tokens) { + if (tok.type === "newline") { + flushLine(); + continue; + } + if (tok.type === "text") { + addSpan(tok.value.replace(/\t/g, " ")); + continue; + } + + const { name, arg } = tok; + switch (name) { + case "spush": + styleStack.push({ ...style }); + break; + case "spop": + if (styleStack.length > 0) style = styleStack.pop()!; + break; + case "color": + style = { ...style, color: `#${arg.trim()}` }; + break; + case "font": + style = { ...style, fontSize: parseFontSize(arg) }; + break; + case "lmargin": { + const px = parseInt(arg, 10) || 0; + lmargin = px; + if (hasBitmap && px > 0) { + // lmargin after a bitmap → bullet indent for this line's text + textIndent = px; + } else if (items.length === 0) { + lineLmargin = px; + } + break; + } + case "just": { + const v = arg.trim().toLowerCase(); + if (v === "left" || v === "center" || v === "right") { + align = v; + if (items.length === 0) lineAlign = v; + } + break; + } + case "bitmap": + hasBitmap = true; + items.push({ type: "bitmap", name: arg.trim() }); + break; + case "br": + flushLine(); + break; + case "sbreak": + if (items.length > 0) flushLine(); + flushLine(); // empty spacer line + break; + // Intentionally ignored: tab, rmargin, clip, /clip, a, /a + } + } + + if (items.length > 0) flushLine(); + return lines; +} + +// Bitmap rendering + +const bitmapUrlCache = new Map(); + +function getBitmapUrl(name: string): string | null { + if (bitmapUrlCache.has(name)) return bitmapUrlCache.get(name)!; + let url: string | null; + try { + url = getUrlForPath(getStandardTextureResourceKey(`textures/gui/${name}`)); + } catch { + url = null; + } + bitmapUrlCache.set(name, url); + return url; +} + +function GuiBitmapEl({ name }: { name: string }) { + const url = getBitmapUrl(name); + if (url) { + return ; + } + if (/bullet/i.test(name)) { + return ; + } + return null; +} + +function SpanEl({ span }: { span: Span }) { + const { color, fontSize } = span.style; + if (!color && !fontSize) return <>{span.text}; + return ( + + {span.text} + + ); +} + +// Public API + +/** + * Filter a mission string by game mode prefix, e.g. `[CTF]`, `[DM Bounty]`. + * Lines without a prefix are shown for all modes. + */ +export function filterMissionStringByMode( + str: string, + missionType: string, +): string { + const type = missionType.toUpperCase(); + return str + .split("\n") + .flatMap((line) => { + const m = line.match(/^\[([^\]]+)\]/); + if (m && !m[1].toUpperCase().split(/\s+/).includes(type)) return []; + return [line.replace(/^\[[^\]]+\]/, "")]; + }) + .join("\n"); +} + +/** Renders Torque `GuiMLTextCtrl` markup as React elements. */ +export function GuiMarkup({ markup }: { markup: string }) { + const lines = useMemo(() => parseMarkup(markup), [markup]); + + return ( +
+ {lines.map((line, i) => { + const { align, lmargin, textIndent, items } = line; + const bitmaps = items.filter( + (it): it is Bitmap => it.type === "bitmap", + ); + const spans = items.filter((it): it is Span => it.type === "span"); + const hasText = spans.some((s) => s.text.trim().length > 0); + + // Bullet layout: bitmap + lmargin indent + text on the same line + if (bitmaps.length > 0 && textIndent > 0 && hasText) { + return ( +
+
+ {bitmaps.map((b, j) => ( + + ))} +
+
+ {spans.map((s, j) => ( + + ))} +
+
+ ); + } + + // Empty line → vertical spacer + if (!hasText && bitmaps.length === 0) { + return
; + } + + return ( +
0 ? `${lmargin}px` : undefined, + }} + > + {items.map((item, j) => + item.type === "bitmap" ? ( + + ) : ( + + ), + )} +
+ ); + })} +
+ ); +}