t2-mapper/docs/_next/static/chunks/634517795b833f16.js
2026-03-12 17:57:22 -07:00

521 lines
No EOL
125 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65883,e=>{e.v({ButtonGroup:"InspectorControls-module__gNRB6W__ButtonGroup",ButtonHint:"InspectorControls-module__gNRB6W__ButtonHint",ButtonLabel:"InspectorControls-module__gNRB6W__ButtonLabel",CheckboxField:"InspectorControls-module__gNRB6W__CheckboxField",Control:"InspectorControls-module__gNRB6W__Control",Description:"InspectorControls-module__gNRB6W__Description",Dropdown:"InspectorControls-module__gNRB6W__Dropdown",Field:"InspectorControls-module__gNRB6W__Field",ForceRenderButton:"InspectorControls-module__gNRB6W__ForceRenderButton",Group:"InspectorControls-module__gNRB6W__Group",IconButton:"InspectorControls-module__gNRB6W__IconButton",InspectorControls:"InspectorControls-module__gNRB6W__InspectorControls",Label:"InspectorControls-module__gNRB6W__Label",LabelledButton:"InspectorControls-module__gNRB6W__LabelledButton",MapInfoButton:"InspectorControls-module__gNRB6W__MapInfoButton InspectorControls-module__gNRB6W__IconButton InspectorControls-module__gNRB6W__LabelledButton",Toggle:"InspectorControls-module__gNRB6W__Toggle InspectorControls-module__gNRB6W__IconButton",Tools:"InspectorControls-module__gNRB6W__Tools"})},36679,e=>{e.v({ButtonLabel:"CopyCoordinatesButton-module__BxovtG__ButtonLabel "+e.i(65883).ButtonLabel,ClipboardCheck:"CopyCoordinatesButton-module__BxovtG__ClipboardCheck",MapPin:"CopyCoordinatesButton-module__BxovtG__MapPin",Root:"CopyCoordinatesButton-module__BxovtG__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,showClipboardCheck:"CopyCoordinatesButton-module__BxovtG__showClipboardCheck"})},28903,e=>{e.v({ButtonHint:"LoadDemoButton-module__kGZaoW__ButtonHint "+e.i(65883).ButtonHint,ButtonLabel:"LoadDemoButton-module__kGZaoW__ButtonLabel "+e.i(65883).ButtonLabel,Root:"LoadDemoButton-module__kGZaoW__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton})},9607,e=>{e.v({ButtonHint:"JoinServerButton-module__DIR70a__ButtonHint "+e.i(65883).ButtonHint,PingLabel:"JoinServerButton-module__DIR70a__PingLabel "+e.i(65883).ButtonLabel,Pulsing:"JoinServerButton-module__DIR70a__Pulsing",Root:"JoinServerButton-module__DIR70a__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,TextLabel:"JoinServerButton-module__DIR70a__TextLabel "+e.i(65883).ButtonLabel,blink:"JoinServerButton-module__DIR70a__blink"})},81323,e=>{e.v({AccordionGroup:"Accordion-module__rN-DYq__AccordionGroup",Body:"Accordion-module__rN-DYq__Body",Content:"Accordion-module__rN-DYq__Content",Trigger:"Accordion-module__rN-DYq__Trigger",TriggerIcon:"Accordion-module__rN-DYq__TriggerIcon",slideDown:"Accordion-module__rN-DYq__slideDown",slideUp:"Accordion-module__rN-DYq__slideUp"})},16964,e=>{e.v({ActionButton:"StreamingMissionInfo-module__hEaQnW__ActionButton "+e.i(65883).IconButton,Attribution:"StreamingMissionInfo-module__hEaQnW__Attribution",EjectIcon:"StreamingMissionInfo-module__hEaQnW__EjectIcon",Header:"StreamingMissionInfo-module__hEaQnW__Header",Metadata:"StreamingMissionInfo-module__hEaQnW__Metadata",MissionInfo:"StreamingMissionInfo-module__hEaQnW__MissionInfo",MissionName:"StreamingMissionInfo-module__hEaQnW__MissionName "+e.i(97442).SelectedName,MissionType:"StreamingMissionInfo-module__hEaQnW__MissionType "+e.i(97442).ItemType,MissionTypeDisplayName:"StreamingMissionInfo-module__hEaQnW__MissionTypeDisplayName",PlayerName:"StreamingMissionInfo-module__hEaQnW__PlayerName",RecordingDate:"StreamingMissionInfo-module__hEaQnW__RecordingDate",ServerInfo:"StreamingMissionInfo-module__hEaQnW__ServerInfo",ServerName:"StreamingMissionInfo-module__hEaQnW__ServerName"})},29418,e=>{e.v({Bottom:"PlayerNameplate-module__zYDm0a__Bottom PlayerNameplate-module__zYDm0a__Root",HealthBar:"PlayerNameplate-module__zYDm0a__HealthBar",HealthFill:"PlayerNameplate-module__zYDm0a__HealthFill",IffArrow:"PlayerNameplate-module__zYDm0a__IffArrow",Name:"PlayerNameplate-module__zYDm0a__Name",Root:"PlayerNameplate-module__zYDm0a__Root",Top:"PlayerNameplate-module__zYDm0a__Top PlayerNameplate-module__zYDm0a__Root"})},78779,e=>{e.v({Distance:"FlagMarker-module__INpLba__Distance",Icon:"FlagMarker-module__INpLba__Icon",Root:"FlagMarker-module__INpLba__Root"})},89271,e=>{e.v({LoadingIndicator:"LoadingIndicator-module__F20Nda__LoadingIndicator",Progress:"LoadingIndicator-module__F20Nda__Progress",ProgressBar:"LoadingIndicator-module__F20Nda__ProgressBar",ProgressText:"LoadingIndicator-module__F20Nda__ProgressText",Spinner:"LoadingIndicator-module__F20Nda__Spinner",loadingComplete:"LoadingIndicator-module__F20Nda__loadingComplete",spin:"LoadingIndicator-module__F20Nda__spin"})},82156,e=>{e.v({Backdrop:"MapInspector-module__nU0WNq__Backdrop",CancelButton:"MapInspector-module__nU0WNq__CancelButton",Content:"MapInspector-module__nU0WNq__Content",Frame:"MapInspector-module__nU0WNq__Frame",PlayerBar:"MapInspector-module__nU0WNq__PlayerBar",Sidebar:"MapInspector-module__nU0WNq__Sidebar",ThreeView:"MapInspector-module__nU0WNq__ThreeView",ToggleSidebarButton:"MapInspector-module__nU0WNq__ToggleSidebarButton",Toolbar:"MapInspector-module__nU0WNq__Toolbar",layout:"MapInspector-module__nU0WNq__layout"})},31713,e=>{"use strict";var t=e.i(43476),r=e.i(932),a=e.i(71645),n=e.i(17751),o=e.i(12598),i=e.i(38847);let l=(0,a.createContext)({live:!1});function s(e){let n,o,s=(0,r.c)(5),{children:u}=e,[d]=(0,i.useQueryState)("features",i.parseAsString);s[0]!==d?(n=()=>({live:new Set((d??"").split(",").map(c).filter(Boolean)).has("live")}),s[0]=d,s[1]=n):n=s[1];let[m]=(0,a.useState)(n);return s[2]!==u||s[3]!==m?(o=(0,t.jsx)(l.Provider,{value:m,children:u}),s[2]=u,s[3]=m,s[4]=o):o=s[4],o}function c(e){return e.trim().toLowerCase()}var u=e.i(40141);function d(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 21L11.2381 12.2698L15 6L23 21H16ZM8 10L14 21H2L8 10ZM5.5 8C4.11929 8 3 6.88071 3 5.5C3 4.11929 4.11929 3 5.5 3C6.88071 3 8 4.11929 8 5.5C8 6.88071 6.88071 8 5.5 8Z"},child:[]}]})(e)}function m(e){return(0,u.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 f(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"},child:[]}]})(e)}function h(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8V2h6"},child:[]},{tag:"path",attr:{d:"m2 2 10 10"},child:[]},{tag:"path",attr:{d:"M12 2A10 10 0 1 1 2 12"},child:[]}]})(e)}function p(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},child:[]},{tag:"path",attr:{d:"M12 11h4"},child:[]},{tag:"path",attr:{d:"M12 16h4"},child:[]},{tag:"path",attr:{d:"M8 11h.01"},child:[]},{tag:"path",attr:{d:"M8 16h.01"},child:[]}]})(e)}function g(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m16 15-3-3 3-3"},child:[]}]})(e)}function v(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m14 9 3 3-3 3"},child:[]}]})(e)}function x(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m9 16 3-3 3 3"},child:[]}]})(e)}function y(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m15 14-3 3-3-3"},child:[]}]})(e)}var b=e.i(79123),_=e.i(11152),S=e.i(36679);function j(e){let n,o,i,l,s,c=(0,r.c)(12),{cameraRef:u,missionName:d,missionType:f,disabled:h}=e,{fogEnabled:p}=(0,b.useSettings)(),[g,v]=(0,a.useState)(!1),x=(0,a.useRef)(null);c[0]!==u||c[1]!==p||c[2]!==d||c[3]!==f?(n=async()=>{clearTimeout(x.current);let e=u.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),a=`${r(e.x)},${r(e.y)},${r(e.z)}`,n=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${a}~${n}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${f}`),r.set("fog",p.toString());let a=`${window.location.pathname}?${r}${t}`,n=`${window.location.origin}${a}`;window.history.replaceState(null,"",a);try{await navigator.clipboard.writeText(n),v(!0),x.current=setTimeout(()=>{v(!1)},1100)}catch(e){console.error(e)}},c[0]=u,c[1]=p,c[2]=d,c[3]=f,c[4]=n):n=c[4];let y=n,j=g?"true":"false";return c[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(_.FaMapPin,{className:S.default.MapPin}),i=(0,t.jsx)(m,{className:S.default.ClipboardCheck}),l=(0,t.jsx)("span",{className:S.default.ButtonLabel,children:" Link to coordinates"}),c[5]=o,c[6]=i,c[7]=l):(o=c[5],i=c[6],l=c[7]),c[8]!==h||c[9]!==y||c[10]!==j?(s=(0,t.jsxs)("button",{type:"button",className:S.default.Root,"aria-label":"Link to coordinates",title:"Copy the current coordinates to URL",onClick:y,disabled:h,"data-copied":j,id:"copyCoordinatesButton",children:[o,i,l]}),c[8]=h,c[9]=y,c[10]=j,c[11]=s):s=c[11],s}function C(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 0 0-2-2zm0 14H3V5h18v12zm-5-6-7 4V7z"},child:[]}]})(e)}var w=e.i(25645),M=e.i(98755),N=e.i(32865),T=e.i(28903);let k=(0,w.createLogger)("LoadDemoButton");function F({isActive:r=!1,choosingMap:n=!1,onCancelChoosingMap:o}){let i=(0,N.useRecording)(),l=i?.source==="demo",{setRecording:s}=(0,N.usePlaybackActions)(),c=(0,a.useRef)(null),u=(0,a.useRef)(0),d=(0,a.useCallback)(()=>{if(n&&l)return void o?.();if(l){u.current+=1,s(null);return}c.current?.click()},[l,n,o,s]),m=(0,a.useCallback)(async t=>{let r=t.target.files?.[0];if(r){t.target.value="";try{let t=await r.arrayBuffer(),a=u.current+1;u.current=a;let{createDemoStreamingRecording:n}=await e.A(60946),o=await n(t);if(u.current!==a)return;let i=M.liveConnectionStore.getState();i.disconnectServer(),i.disconnectRelay(),s(o)}catch(e){k.error("Failed to load demo: %o",e)}}},[s]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:c,type:"file",accept:".rec",style:{display:"none"},onChange:m}),(0,t.jsxs)("button",{type:"button",className:T.default.Root,"aria-label":l?"Unload demo":"Load demo (.rec)",title:l?"Unload demo":"Load demo (.rec)",onClick:d,"data-active":r,children:[(0,t.jsx)(C,{className:T.default.DemoIcon}),(0,t.jsx)("span",{className:T.default.ButtonLabel,children:"Demo"}),(0,t.jsx)("span",{className:T.default.ButtonHint,children:n&&l?"Return to demo":l?"Click to unload":"Load a .rec file"})]})]})}function R(e){return(0,u.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"},child:[]}]})(e)}var D=e.i(9607);function L(e){let a,n,o,i,l,s,c=(0,r.c)(19),{isActive:u,onOpenServerBrowser:d}=e,m=(0,M.useLiveSelector)(I),f=(0,M.useLiveSelector)(M.selectPing),h=(0,M.useLiveSelector)(B),p="connected"===m,g="connecting"===m||"challenging"===m||"authenticating"===m,v=p?"Connected  click to disconnect":"Join server",x=p?"Connected  click to disconnect":"Join server";c[0]!==h||c[1]!==p||c[2]!==d?(a=()=>{p?h():d()},c[0]=h,c[1]=p,c[2]=d,c[3]=a):a=c[3];let y=`${D.default.LiveIcon} ${p?D.default.Pulsing:""}`;if(c[4]!==y?(n=(0,t.jsx)(R,{className:y}),c[4]=y,c[5]=n):n=c[5],c[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("span",{className:D.default.TextLabel,children:"Live"}),c[6]=o):o=c[6],c[7]!==g||c[8]!==f)i=g?"Connecting…":null!=f?`${f.toLocaleString()} ms`:"Join a game",c[7]=g,c[8]=f,c[9]=i;else i=c[9];return c[10]!==i?(l=(0,t.jsxs)(t.Fragment,{children:[o,(0,t.jsx)("span",{className:D.default.ButtonHint,children:i})]}),c[10]=i,c[11]=l):l=c[11],c[12]!==u||c[13]!==v||c[14]!==x||c[15]!==a||c[16]!==n||c[17]!==l?(s=(0,t.jsxs)("button",{type:"button",className:D.default.Root,"aria-label":v,title:x,onClick:a,"data-active":u,children:[n,l]}),c[12]=u,c[13]=v,c[14]=x,c[15]=a,c[16]=n,c[17]=l,c[18]=s):s=c[18],s}function B(e){return e.disconnectServer}function I(e){return e.gameStatus}function A(e,r=[]){let n=[],o=()=>{let t=n.map(e=>a.createContext(e));return function(r){let n=r?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return o.scopeName=e,[function(r,o){let i=a.createContext(o),l=n.length;n=[...n,o];let s=r=>{let{scope:n,children:o,...s}=r,c=n?.[e]?.[l]||i,u=a.useMemo(()=>s,Object.values(s));return(0,t.jsx)(c.Provider,{value:u,children:o})};return s.displayName=r+"Provider",[s,function(t,n){let s=n?.[e]?.[l]||i,c=a.useContext(s);if(c)return c;if(void 0!==o)return o;throw Error(`\`${t}\` must be used within \`${r}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:a})=>{let n=r(e)[`__scope${a}`];return{...t,...n}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(o,...r)]}function P(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function E(...e){return t=>{let r=!1,a=e.map(e=>{let a=P(e,t);return r||"function"!=typeof a||(r=!0),a});if(r)return()=>{for(let t=0;t<a.length;t++){let r=a[t];"function"==typeof r?r():P(e[t],null)}}}}function z(...e){return a.useCallback(E(...e),e)}function G(e){var r;let n,o=(r=e,(n=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(a.isValidElement(r)){var o;let e,i,l=(o=r,(i=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(i=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let a in t){let n=e[a],o=t[a];/^on[A-Z]/.test(a)?n&&o?r[a]=(...e)=>{let t=o(...e);return n(...e),t}:n&&(r[a]=n):"style"===a?r[a]={...n,...o}:"className"===a&&(r[a]=[n,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?E(t,l):l),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null})).displayName=`${r}.SlotClone`,n),i=a.forwardRef((e,r)=>{let{children:n,...i}=e,l=a.Children.toArray(n),s=l.find(W);if(s){let e=s.props.children,n=l.map(t=>t!==s?t:a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null);return(0,t.jsx)(o,{...i,ref:r,children:a.isValidElement(e)?a.cloneElement(e,void 0,n):null})}return(0,t.jsx)(o,{...i,ref:r,children:n})});return i.displayName=`${e}.Slot`,i}var U=Symbol("radix.slottable");function W(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===U}var H=new WeakMap;function O(e,t){var r,a;let n,o,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,a=t,n=r.length,(i=(o=$(a))>=0?o:n+o)<0||i>=n?-1:i);return -1===l?void 0:e[l]}function $(e){return e!=e||0===e?0:Math.trunc(e)}function V(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),!1===r||!a.defaultPrevented)return t?.(a)}}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],H.set(this,!0)}set(e,t){return H.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let a,n=this.has(t),o=this.#e.length,i=$(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||n&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!n;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let o=u[e];u[e]===t&&(o=u[e+1]),n&&this.delete(t),a=this.get(o),this.set(t,r)}else{d||u[e-1]!==t||(d=!0);let r=u[d?e:e-1],n=a;a=this.get(r),this.delete(r),this.set(r,n)}return this}with(t,r,a){let n=new e(this);return n.insert(t,r,a),n}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let a=this.#e.indexOf(e);return -1===a?this:this.insert(a,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let a=this.#e.indexOf(e);return -1===a?this:this.insert(a+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=O(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=O(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return O(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let a=r+t;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.at(a)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let a=r+t;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.keyAt(a)}find(e,t){let r=0;for(let a of this){if(Reflect.apply(e,t,[a,r,this]))return a;r++}}findIndex(e,t){let r=0;for(let a of this){if(Reflect.apply(e,t,[a,r,this]))return r;r++}return -1}filter(t,r){let a=[],n=0;for(let e of this)Reflect.apply(t,r,[e,n,this])&&a.push(e),n++;return new e(a)}map(t,r){let a=[],n=0;for(let e of this)a.push([e[0],Reflect.apply(t,r,[e,n,this])]),n++;return new e(a)}reduce(...e){let[t,r]=e,a=0,n=r??this.at(0);for(let r of this)n=0===a&&1===e.length?r:Reflect.apply(t,this,[n,r,a,this]),a++;return n}reduceRight(...e){let[t,r]=e,a=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let n=this.at(r);a=r===this.size-1&&1===e.length?n:Reflect.apply(t,this,[a,n,r,this])}return a}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),a=this.get(r);t.set(r,a)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let a=new e,n=this.size-1;if(void 0===t)return a;t<0&&(t+=this.size),void 0!==r&&r>0&&(n=r-1);for(let e=t;e<=n;e++){let t=this.keyAt(e),r=this.get(t);a.set(t,r)}return a}every(e,t){let r=0;for(let a of this){if(!Reflect.apply(e,t,[a,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let a of this){if(Reflect.apply(e,t,[a,r,this]))return!0;r++}return!1}}),"u">typeof window&&window.document&&window.document.createElement;var q=globalThis?.document?a.useLayoutEffect:()=>{};a[" useEffectEvent ".trim().toString()],a[" useInsertionEffect ".trim().toString()];var Q=a[" useInsertionEffect ".trim().toString()]||q;function K({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[o,i,l]=function({defaultProp:e,onChange:t}){let[r,n]=a.useState(e),o=a.useRef(r),i=a.useRef(t);return Q(()=>{i.current=t},[t]),a.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}({defaultProp:t,onChange:r}),s=void 0!==e,c=s?e:o;{let t=a.useRef(void 0!==e);a.useEffect(()=>{let e=t.current;if(e!==s){let t=s?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,n])}return[c,a.useCallback(t=>{if(s){let r="function"==typeof t?t(e):t;r!==e&&l.current?.(r)}else i(t)},[s,e,i,l])]}Symbol("RADIX:SYNC_STATE"),e.i(74080);var Y=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let n=G(`Primitive.${r}`),o=a.forwardRef((e,a)=>{let{asChild:o,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,t.jsx)(o?n:r,{...i,ref:a})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),J=e=>{var t;let r,n,{present:o,children:i}=e,l=function(e){var t,r;let[n,o]=a.useState(),i=a.useRef(null),l=a.useRef(e),s=a.useRef("none"),[c,u]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},a.useReducer((e,t)=>r[e][t]??e,t));return a.useEffect(()=>{let e=Z(i.current);s.current="mounted"===c?e:"none"},[c]),q(()=>{let t=i.current,r=l.current;if(r!==e){let a=s.current,n=Z(t);e?u("MOUNT"):"none"===n||t?.display==="none"?u("UNMOUNT"):r&&a!==n?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),q(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let a=Z(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&a&&(u("ANIMATION_END"),!l.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=Z(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{i.current=e?getComputedStyle(e):null,o(e)},[])}}(o),s="function"==typeof i?i({present:l.isPresent}):a.Children.only(i),c=z(l.ref,(t=s,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof i||l.isPresent?a.cloneElement(s,{ref:c}):null};function Z(e){return e?.animationName||"none"}J.displayName="Presence";var X=a[" useId ".trim().toString()]||(()=>void 0),ee=0;function et(e){let[t,r]=a.useState(X());return q(()=>{e||r(e=>e??String(ee++))},[e]),e||(t?`radix-${t}`:"")}var er="Collapsible",[ea,en]=A(er),[eo,ei]=ea(er),el=a.forwardRef((e,r)=>{let{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:l,onOpenChange:s,...c}=e,[u,d]=K({prop:o,defaultProp:i??!1,onChange:s,caller:er});return(0,t.jsx)(eo,{scope:n,disabled:l,contentId:et(),open:u,onOpenToggle:a.useCallback(()=>d(e=>!e),[d]),children:(0,t.jsx)(Y.div,{"data-state":ef(u),"data-disabled":l?"":void 0,...c,ref:r})})});el.displayName=er;var es="CollapsibleTrigger",ec=a.forwardRef((e,r)=>{let{__scopeCollapsible:a,...n}=e,o=ei(es,a);return(0,t.jsx)(Y.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ef(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:r,onClick:V(e.onClick,o.onOpenToggle)})});ec.displayName=es;var eu="CollapsibleContent",ed=a.forwardRef((e,r)=>{let{forceMount:a,...n}=e,o=ei(eu,e.__scopeCollapsible);return(0,t.jsx)(J,{present:a||o.open,children:({present:e})=>(0,t.jsx)(em,{...n,ref:r,present:e})})});ed.displayName=eu;var em=a.forwardRef((e,r)=>{let{__scopeCollapsible:n,present:o,children:i,...l}=e,s=ei(eu,n),[c,u]=a.useState(o),d=a.useRef(null),m=z(r,d),f=a.useRef(0),h=f.current,p=a.useRef(0),g=p.current,v=s.open||c,x=a.useRef(v),y=a.useRef(void 0);return a.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),q(()=>{let e=d.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();f.current=t.height,p.current=t.width,x.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),u(o)}},[s.open,o]),(0,t.jsx)(Y.div,{"data-state":ef(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...l,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&i})});function ef(e){return e?"open":"closed"}var eh=a.createContext(void 0),ep="Accordion",eg=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ev,ex,ey]=function(e){let r=e+"CollectionProvider",[n,o]=A(r),[i,l]=n(r,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:r,children:n}=e,o=a.default.useRef(null),l=a.default.useRef(new Map).current;return(0,t.jsx)(i,{scope:r,itemMap:l,collectionRef:o,children:n})};s.displayName=r;let c=e+"CollectionSlot",u=G(c),d=a.default.forwardRef((e,r)=>{let{scope:a,children:n}=e,o=z(r,l(c,a).collectionRef);return(0,t.jsx)(u,{ref:o,children:n})});d.displayName=c;let m=e+"CollectionItemSlot",f="data-radix-collection-item",h=G(m),p=a.default.forwardRef((e,r)=>{let{scope:n,children:o,...i}=e,s=a.default.useRef(null),c=z(r,s),u=l(m,n);return a.default.useEffect(()=>(u.itemMap.set(s,{ref:s,...i}),()=>void u.itemMap.delete(s))),(0,t.jsx)(h,{...{[f]:""},ref:c,children:o})});return p.displayName=m,[{Provider:s,Slot:d,ItemSlot:p},function(t){let r=l(e+"CollectionConsumer",t);return a.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},o]}(ep),[eb,e_]=A(ep,[ey,en]),eS=en(),ej=a.default.forwardRef((e,r)=>{let{type:a,...n}=e;return(0,t.jsx)(ev.Provider,{scope:e.__scopeAccordion,children:"multiple"===a?(0,t.jsx)(ek,{...n,ref:r}):(0,t.jsx)(eT,{...n,ref:r})})});ej.displayName=ep;var[eC,ew]=eb(ep),[eM,eN]=eb(ep,{collapsible:!1}),eT=a.default.forwardRef((e,r)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:l=!1,...s}=e,[c,u]=K({prop:n,defaultProp:o??"",onChange:i,caller:ep});return(0,t.jsx)(eC,{scope:e.__scopeAccordion,value:a.default.useMemo(()=>c?[c]:[],[c]),onItemOpen:u,onItemClose:a.default.useCallback(()=>l&&u(""),[l,u]),children:(0,t.jsx)(eM,{scope:e.__scopeAccordion,collapsible:l,children:(0,t.jsx)(eD,{...s,ref:r})})})}),ek=a.default.forwardRef((e,r)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},...l}=e,[s,c]=K({prop:n,defaultProp:o??[],onChange:i,caller:ep}),u=a.default.useCallback(e=>c((t=[])=>[...t,e]),[c]),d=a.default.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,t.jsx)(eC,{scope:e.__scopeAccordion,value:s,onItemOpen:u,onItemClose:d,children:(0,t.jsx)(eM,{scope:e.__scopeAccordion,collapsible:!0,children:(0,t.jsx)(eD,{...l,ref:r})})})}),[eF,eR]=eb(ep),eD=a.default.forwardRef((e,r)=>{let n,{__scopeAccordion:o,disabled:i,dir:l,orientation:s="vertical",...c}=e,u=z(a.default.useRef(null),r),d=ex(o),m="ltr"===(n=a.useContext(eh),l||n||"ltr"),f=V(e.onKeyDown,e=>{if(!eg.includes(e.key))return;let t=e.target,r=d().filter(e=>!e.ref.current?.disabled),a=r.findIndex(e=>e.ref.current===t),n=r.length;if(-1===a)return;e.preventDefault();let o=a,i=n-1,l=()=>{(o=a+1)>i&&(o=0)},c=()=>{(o=a-1)<0&&(o=i)};switch(e.key){case"Home":o=0;break;case"End":o=i;break;case"ArrowRight":"horizontal"===s&&(m?l():c());break;case"ArrowDown":"vertical"===s&&l();break;case"ArrowLeft":"horizontal"===s&&(m?c():l());break;case"ArrowUp":"vertical"===s&&c()}let u=o%n;r[u].ref.current?.focus()});return(0,t.jsx)(eF,{scope:o,disabled:i,direction:l,orientation:s,children:(0,t.jsx)(ev.Slot,{scope:o,children:(0,t.jsx)(Y.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:f})})})}),eL="AccordionItem",[eB,eI]=eb(eL),eA=a.default.forwardRef((e,r)=>{let{__scopeAccordion:a,value:n,...o}=e,i=eR(eL,a),l=ew(eL,a),s=eS(a),c=et(),u=n&&l.value.includes(n)||!1,d=i.disabled||e.disabled;return(0,t.jsx)(eB,{scope:a,open:u,disabled:d,triggerId:c,children:(0,t.jsx)(el,{"data-orientation":i.orientation,"data-state":eW(u),...s,...o,ref:r,disabled:d,open:u,onOpenChange:e=>{e?l.onItemOpen(n):l.onItemClose(n)}})})});eA.displayName=eL;var eP="AccordionHeader";a.default.forwardRef((e,r)=>{let{__scopeAccordion:a,...n}=e,o=eR(ep,a),i=eI(eP,a);return(0,t.jsx)(Y.h3,{"data-orientation":o.orientation,"data-state":eW(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:r})}).displayName=eP;var eE="AccordionTrigger",ez=a.default.forwardRef((e,r)=>{let{__scopeAccordion:a,...n}=e,o=eR(ep,a),i=eI(eE,a),l=eN(eE,a),s=eS(a);return(0,t.jsx)(ev.ItemSlot,{scope:a,children:(0,t.jsx)(ec,{"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...s,...n,ref:r})})});ez.displayName=eE;var eG="AccordionContent",eU=a.default.forwardRef((e,r)=>{let{__scopeAccordion:a,...n}=e,o=eR(ep,a),i=eI(eG,a),l=eS(a);return(0,t.jsx)(ed,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...l,...n,ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function eW(e){return e?"open":"closed"}function eH(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"m190.06 414 163.12-139.78a24 24 0 0 0 0-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z"},child:[]}]})(e)}eU.displayName=eG;var eO=e.i(81323);function e$(e){let a,n=(0,r.c)(2);return n[0]!==e?(a=(0,t.jsx)(ej,{className:eO.default.AccordionGroup,...e}),n[0]=e,n[1]=a):a=n[1],a}function eV(e){let a,n,o,i,l=(0,r.c)(9),{value:s,label:c,children:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(eH,{className:eO.default.TriggerIcon}),l[0]=a):a=l[0],l[1]!==c?(n=(0,t.jsxs)(ez,{className:eO.default.Trigger,children:[a," ",c]}),l[1]=c,l[2]=n):n=l[2],l[3]!==u?(o=(0,t.jsx)(eU,{className:eO.default.Content,children:(0,t.jsx)("div",{className:eO.default.Body,children:u})}),l[3]=u,l[4]=o):o=l[4],l[5]!==n||l[6]!==o||l[7]!==s?(i=(0,t.jsxs)(eA,{value:s,children:[n,o]}),l[5]=n,l[6]=o,l[7]=s,l[8]=i):i=l[8],i}var eq=e.i(65883);let eQ="(pointer: coarse)",eK=()=>null;function eY(e){let t=window.matchMedia(eQ);return t.addEventListener("change",e),()=>{t.removeEventListener("change",e)}}function eJ(){return window.matchMedia(eQ).matches}function eZ(){return(0,a.useSyncExternalStore)(eY,eJ,eK)}var eX=e.i(92224),e0=e.i(91996);let e1=["controls","preferences","audio"];function e2(e){let n,o,i,l,s,c,u,m,h,g,v,x,y,_,S,C,w,T,k,R,D,B,I,A,P,E,z,G,U,W,H,O,$,V,q,Q,K,Y,J,Z,X,ee,et,er,ea,en,eo,ei,el,es,ec,eu,ed,em,ef,eh,ep,eg,ev,ex,ey,eb,e_,eS,ej,eC,ew,eM,eN,eT,ek,eF=(0,r.c)(167),{missionName:eR,missionType:eD,onOpenMapInfo:eL,onOpenServerBrowser:eB,onChooseMap:eI,onCancelChoosingMap:eA,choosingMap:eP,cameraRef:eE,invalidateRef:ez}=e,eG=eZ(),eU=(0,eX.useDataSource)(),eW=(0,N.useRecording)(),eH=(0,eX.useMissionName)(),eO="demo"===eU||"live"===eU?eH:eR;eF[0]!==eO?(n=!!eO&&(0,e0.hasMission)(eO),eF[0]=eO,eF[1]=n):n=eF[1];let eQ=n,eK=(0,M.useLiveSelector)(e3),{fogEnabled:eY,setFogEnabled:eJ,fov:e2,setFov:e5,audioEnabled:e4,setAudioEnabled:e6,audioVolume:e8,setAudioVolume:e7,animationEnabled:e9,setAnimationEnabled:te}=(0,b.useSettings)(),{speedMultiplier:tt,setSpeedMultiplier:tr,touchMode:ta,setTouchMode:tn,invertScroll:to,setInvertScroll:ti,invertDrag:tl,setInvertDrag:ts,invertJoystick:tc,setInvertJoystick:tu}=(0,b.useControls)(),{debugMode:td,setDebugMode:tm,renderOnDemand:tf,setRenderOnDemand:th}=(0,b.useDebug)(),[tp,tg]=(0,a.useState)(!1),tv=(0,a.useRef)(null),tx=(0,a.useRef)(null),ty=(0,a.useRef)(null);eF[2]!==tp?(o=()=>{tp&&tv.current?.focus()},i=[tp],eF[2]=tp,eF[3]=o,eF[4]=i):(o=eF[3],i=eF[4]),(0,a.useEffect)(o,i),eF[5]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let t=e.relatedTarget;t&&ty.current?.contains(t)||tg(!1)},eF[5]=l):l=eF[5];let tb=l;eF[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(tg(!1),tx.current?.focus())},eF[6]=s):s=eF[6];let t_=s,tS="map"===eU&&!eW||eP;eF[7]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(d,{}),u=(0,t.jsx)("span",{className:eq.default.ButtonLabel,children:"Explore"}),m=(0,t.jsx)("span",{className:eq.default.ButtonHint,children:"Browse maps"}),eF[7]=c,eF[8]=u,eF[9]=m):(c=eF[7],u=eF[8],m=eF[9]),eF[10]!==eI||eF[11]!==tS?(h=(0,t.jsxs)("button",{type:"button",className:eq.default.IconButton,"data-active":tS,onClick:eI,children:[c,u,m]}),eF[10]=eI,eF[11]=tS,eF[12]=h):h=eF[12];let tj=!eP&&eW?.source==="demo";eF[13]!==eP||eF[14]!==eA||eF[15]!==tj?(g=(0,t.jsx)(F,{isActive:tj,choosingMap:eP,onCancelChoosingMap:eA}),eF[13]=eP,eF[14]=eA,eF[15]=tj,eF[16]=g):g=eF[16],eF[17]!==eP||eF[18]!==eK||eF[19]!==eB?(v=eB&&(0,t.jsx)(L,{isActive:!eP&&eK,onOpenServerBrowser:eB}),eF[17]=eP,eF[18]=eK,eF[19]=eB,eF[20]=v):v=eF[20],eF[21]!==h||eF[22]!==g||eF[23]!==v?(x=(0,t.jsxs)("div",{className:eq.default.ButtonGroup,children:[h,g,v]}),eF[21]=h,eF[22]=g,eF[23]=v,eF[24]=x):x=eF[24];let tC=!eQ;eF[25]!==eE||eF[26]!==eR||eF[27]!==eD||eF[28]!==tC?(y=(0,t.jsx)(j,{missionName:eR,missionType:eD,cameraRef:eE,disabled:tC}),eF[25]=eE,eF[26]=eR,eF[27]=eD,eF[28]=tC,eF[29]=y):y=eF[29];let tw=!eQ;eF[30]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(p,{}),S=(0,t.jsx)("span",{className:eq.default.ButtonLabel,children:"Show map info"}),eF[30]=_,eF[31]=S):(_=eF[30],S=eF[31]),eF[32]!==eL||eF[33]!==tw?(C=(0,t.jsxs)("button",{type:"button",className:eq.default.MapInfoButton,"aria-label":"Show map info",onClick:eL,disabled:tw,children:[_,S]}),eF[32]=eL,eF[33]=tw,eF[34]=C):C=eF[34],eF[35]!==x||eF[36]!==y||eF[37]!==C?(w=(0,t.jsxs)("div",{className:eq.default.Tools,children:[x,y,C]}),eF[35]=x,eF[36]=y,eF[37]=C,eF[38]=w):w=eF[38],eF[39]===Symbol.for("react.memo_cache_sentinel")?(T=(0,t.jsx)("label",{htmlFor:"speedInput",children:"Fly speed"}),eF[39]=T):T=eF[39],eF[40]!==tr?(k=e=>tr(parseFloat(e.target.value)),eF[40]=tr,eF[41]=k):k=eF[41],eF[42]!==tt||eF[43]!==k?(R=(0,t.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:tt,onChange:k}),eF[42]=tt,eF[43]=k,eF[44]=R):R=eF[44];let tM=!1===eG?" Use your scroll wheel or trackpad to adjust while flying.":"";return eF[45]!==tM?(D=(0,t.jsxs)("p",{className:eq.default.Description,children:["How fast you move in free-flying mode.",tM]}),eF[45]=tM,eF[46]=D):D=eF[46],eF[47]!==R||eF[48]!==D?(B=(0,t.jsxs)("div",{className:eq.default.Field,children:[T,R,D]}),eF[47]=R,eF[48]=D,eF[49]=B):B=eF[49],eF[50]!==eG||eF[51]!==tn||eF[52]!==ta?(I=eG?(0,t.jsxs)("div",{className:eq.default.Field,children:[(0,t.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick"})," ",(0,t.jsxs)("select",{id:"touchModeInput",value:ta,onChange:e=>tn(e.target.value),children:[(0,t.jsx)("option",{value:"dualStick",children:"Dual stick"}),(0,t.jsx)("option",{value:"moveLookStick",children:"Single stick"})]}),(0,t.jsx)("p",{className:eq.default.Description,children:"Single stick has a unified move + look control. Dual stick has independent move + look."})]}):null,eF[50]=eG,eF[51]=tn,eF[52]=ta,eF[53]=I):I=eF[53],eF[54]!==to||eF[55]!==eG||eF[56]!==ti?(A=!1===eG?(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[(0,t.jsx)("input",{id:"invertScroll",type:"checkbox",checked:to,onChange:e=>{ti(e.target.checked)}}),(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"invertScroll",children:"Invert scroll direction"}),(0,t.jsx)("p",{className:eq.default.Description,children:"Reverse which scroll direction increases and decreases fly speed."})]}):null,eF[54]=to,eF[55]=eG,eF[56]=ti,eF[57]=A):A=eF[57],eF[58]!==tc||eF[59]!==eG||eF[60]!==tu?(P=eG?(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[(0,t.jsx)("input",{id:"invertJoystick",type:"checkbox",checked:tc,onChange:e=>{tu(e.target.checked)}}),(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"invertJoystick",children:"Invert joystick direction"}),(0,t.jsx)("p",{className:eq.default.Description,children:"Reverse joystick look direction."})]}):null,eF[58]=tc,eF[59]=eG,eF[60]=tu,eF[61]=P):P=eF[61],eF[62]!==ts?(E=e=>{ts(e.target.checked)},eF[62]=ts,eF[63]=E):E=eF[63],eF[64]!==tl||eF[65]!==E?(z=(0,t.jsx)("input",{id:"invertDrag",type:"checkbox",checked:tl,onChange:E}),eF[64]=tl,eF[65]=E,eF[66]=z):z=eF[66],eF[67]===Symbol.for("react.memo_cache_sentinel")?(G=(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"invertDrag",children:"Invert drag direction"}),U=(0,t.jsx)("p",{className:eq.default.Description,children:"Reverse how dragging the viewport aims the camera."}),eF[67]=G,eF[68]=U):(G=eF[67],U=eF[68]),eF[69]!==z?(W=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[z,G,U]}),eF[69]=z,eF[70]=W):W=eF[70],eF[71]!==B||eF[72]!==I||eF[73]!==A||eF[74]!==P||eF[75]!==W?(H=(0,t.jsxs)(eV,{value:"controls",label:"Controls",children:[B,I,A,P,W]}),eF[71]=B,eF[72]=I,eF[73]=A,eF[74]=P,eF[75]=W,eF[76]=H):H=eF[76],eF[77]===Symbol.for("react.memo_cache_sentinel")?(O=(0,t.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),eF[77]=O):O=eF[77],eF[78]!==e2?($=(0,t.jsxs)("output",{htmlFor:"fovInput",children:[e2,"°"]}),eF[78]=e2,eF[79]=$):$=eF[79],eF[80]!==e5?(V=e=>e5(parseInt(e.target.value)),eF[80]=e5,eF[81]=V):V=eF[81],eF[82]!==e2||eF[83]!==V?(q=(0,t.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:e2,onChange:V}),eF[82]=e2,eF[83]=V,eF[84]=q):q=eF[84],eF[85]!==$||eF[86]!==q?(Q=(0,t.jsx)(eV,{value:"preferences",label:"Preferences",children:(0,t.jsxs)("div",{className:eq.default.Field,children:[O,(0,t.jsxs)("div",{className:eq.default.Control,children:[$,q]})]})}),eF[85]=$,eF[86]=q,eF[87]=Q):Q=eF[87],eF[88]!==e6?(K=e=>{e6(e.target.checked)},eF[88]=e6,eF[89]=K):K=eF[89],eF[90]!==e4||eF[91]!==K?(Y=(0,t.jsx)("input",{id:"audioInput",type:"checkbox",checked:e4,onChange:K}),eF[90]=e4,eF[91]=K,eF[92]=Y):Y=eF[92],eF[93]===Symbol.for("react.memo_cache_sentinel")?(J=(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"audioInput",children:"Enable audio"}),eF[93]=J):J=eF[93],eF[94]!==Y?(Z=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[Y,J]}),eF[94]=Y,eF[95]=Z):Z=eF[95],eF[96]===Symbol.for("react.memo_cache_sentinel")?(X=(0,t.jsx)("label",{htmlFor:"volumeInput",children:"Master volume"}),eF[96]=X):X=eF[96],eF[97]!==e8?(ee=Math.round(100*e8),eF[97]=e8,eF[98]=ee):ee=eF[98],eF[99]!==ee?(et=(0,t.jsxs)("output",{htmlFor:"volumeInput",children:[ee,"%"]}),eF[99]=ee,eF[100]=et):et=eF[100],eF[101]!==e7?(er=e=>e7(parseFloat(e.target.value)),eF[101]=e7,eF[102]=er):er=eF[102],eF[103]!==e8||eF[104]!==er?(ea=(0,t.jsx)("input",{id:"volumeInput",type:"range",min:0,max:1,step:.05,value:e8,onChange:er}),eF[103]=e8,eF[104]=er,eF[105]=ea):ea=eF[105],eF[106]!==et||eF[107]!==ea?(en=(0,t.jsxs)("div",{className:eq.default.Field,children:[X,(0,t.jsxs)("div",{className:eq.default.Control,children:[et,ea]})]}),eF[106]=et,eF[107]=ea,eF[108]=en):en=eF[108],eF[109]!==Z||eF[110]!==en?(eo=(0,t.jsxs)(eV,{value:"audio",label:"Audio",children:[Z,en]}),eF[109]=Z,eF[110]=en,eF[111]=eo):eo=eF[111],eF[112]!==eJ?(ei=e=>{eJ(e.target.checked)},eF[112]=eJ,eF[113]=ei):ei=eF[113],eF[114]!==eY||eF[115]!==ei?(el=(0,t.jsx)("input",{id:"fogInput",type:"checkbox",checked:eY,onChange:ei}),eF[114]=eY,eF[115]=ei,eF[116]=el):el=eF[116],eF[117]===Symbol.for("react.memo_cache_sentinel")?(es=(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"fogInput",children:"Enable fog"}),eF[117]=es):es=eF[117],eF[118]!==el?(ec=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[el,es]}),eF[118]=el,eF[119]=ec):ec=eF[119],eF[120]!==te?(eu=e=>{te(e.target.checked)},eF[120]=te,eF[121]=eu):eu=eF[121],eF[122]!==e9||eF[123]!==eu?(ed=(0,t.jsx)("input",{id:"animationInput",type:"checkbox",checked:e9,onChange:eu}),eF[122]=e9,eF[123]=eu,eF[124]=ed):ed=eF[124],eF[125]===Symbol.for("react.memo_cache_sentinel")?(em=(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"animationInput",children:"Enable animations"}),eF[125]=em):em=eF[125],eF[126]!==ed?(ef=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[ed,em]}),eF[126]=ed,eF[127]=ef):ef=eF[127],eF[128]!==ec||eF[129]!==ef?(eh=(0,t.jsxs)(eV,{value:"graphics",label:"Graphics",children:[ec,ef]}),eF[128]=ec,eF[129]=ef,eF[130]=eh):eh=eF[130],eF[131]!==tm?(ep=e=>{tm(e.target.checked)},eF[131]=tm,eF[132]=ep):ep=eF[132],eF[133]!==td||eF[134]!==ep?(eg=(0,t.jsx)("input",{id:"debugInput",type:"checkbox",checked:td,onChange:ep}),eF[133]=td,eF[134]=ep,eF[135]=eg):eg=eF[135],eF[136]===Symbol.for("react.memo_cache_sentinel")?(ev=(0,t.jsx)("label",{className:eq.default.Label,htmlFor:"debugInput",children:"Render debug visuals"}),eF[136]=ev):ev=eF[136],eF[137]!==eg?(ex=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[eg,ev]}),eF[137]=eg,eF[138]=ex):ex=eF[138],eF[139]!==th?(ey=e=>{th(e.target.checked)},eF[139]=th,eF[140]=ey):ey=eF[140],eF[141]!==tf||eF[142]!==ey?(eb=(0,t.jsx)("input",{id:"onDemandInput",type:"checkbox",checked:tf,onChange:ey}),eF[141]=tf,eF[142]=ey,eF[143]=eb):eb=eF[143],eF[144]===Symbol.for("react.memo_cache_sentinel")?(e_=(0,t.jsx)("label",{htmlFor:"onDemandInput",children:"Render on demand "}),eF[144]=e_):e_=eF[144],eF[145]!==ez?(eS=()=>ez.current?.(),eF[145]=ez,eF[146]=eS):eS=eF[146],eF[147]===Symbol.for("react.memo_cache_sentinel")?(ej=(0,t.jsx)(f,{}),eF[147]=ej):ej=eF[147],eF[148]!==eS?(eC=(0,t.jsxs)("div",{className:eq.default.Label,children:[e_,(0,t.jsx)("button",{type:"button",className:eq.default.ForceRenderButton,title:"Force render","aria-label":"Force render",onClick:eS,children:ej})]}),eF[148]=eS,eF[149]=eC):eC=eF[149],eF[150]===Symbol.for("react.memo_cache_sentinel")?(ew=(0,t.jsx)("p",{className:eq.default.Description,children:"Significantly decreases CPU and GPU usage by only rendering frames when requested. Helpful when developing parts of the app unrelated to rendering."}),eF[150]=ew):ew=eF[150],eF[151]!==eb||eF[152]!==eC?(eM=(0,t.jsxs)("div",{className:eq.default.CheckboxField,children:[eb,eC,ew]}),eF[151]=eb,eF[152]=eC,eF[153]=eM):eM=eF[153],eF[154]!==ex||eF[155]!==eM?(eN=(0,t.jsxs)(eV,{value:"debug",label:"Debug",children:[ex,eM]}),eF[154]=ex,eF[155]=eM,eF[156]=eN):eN=eF[156],eF[157]!==H||eF[158]!==Q||eF[159]!==eo||eF[160]!==eh||eF[161]!==eN?(eT=(0,t.jsx)("div",{className:eq.default.Accordions,children:(0,t.jsxs)(e$,{type:"multiple",defaultValue:e1,children:[H,Q,eo,eh,eN]})}),eF[157]=H,eF[158]=Q,eF[159]=eo,eF[160]=eh,eF[161]=eN,eF[162]=eT):eT=eF[162],eF[163]!==tp||eF[164]!==w||eF[165]!==eT?(ek=(0,t.jsx)("div",{className:eq.default.InspectorControls,children:(0,t.jsx)("div",{ref:ty,children:(0,t.jsxs)("div",{className:eq.default.Dropdown,ref:tv,id:"settingsPanel",tabIndex:-1,onKeyDown:t_,onBlur:tb,"data-open":tp,children:[w,eT]})})}),eF[163]=tp,eF[164]=w,eF[165]=eT,eF[166]=ek):ek=eF[166],ek}function e3(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var e5=e.i(11889),e4=e.i(56373),e6=e.i(86447),e8=e.i(1559),e7=e.i(78440),e9=e.i(59129),te=e.i(25998),tt=e.i(18364),tr=e.i(68754),ta=e.i(70238),tn=e.i(29402),to=e.i(97442);let ti=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),tl={"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)"},ts={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},tc=(0,e0.getMissionList)().filter(e=>!ti.has(e)).map(e=>{let t,r=(0,e0.getMissionInfo)(e),[a]=(0,e0.getSourceAndPath)(r.resourcePath),n=(t=a.match(/^(.*)(\/[^/]+)$/))?t[1]:"",o=tl[a]??ts[n]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:a,groupName:o,missionTypes:r.missionTypes}}),tu=new Map(tc.map(e=>[e.missionName,e])),td=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,tn.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,tn.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(tc),tm="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function tf(e){let a,n,o,i,l,s=(0,r.c)(12),{mission:c}=e,u=c.displayName||c.missionName;return s[0]!==u?(a=(0,t.jsx)("span",{className:to.default.ItemName,children:u}),s[0]=u,s[1]=a):a=s[1],s[2]!==c.missionTypes?(n=c.missionTypes.length>0&&(0,t.jsx)("span",{className:to.default.ItemTypes,children:c.missionTypes.map(th)}),s[2]=c.missionTypes,s[3]=n):n=s[3],s[4]!==a||s[5]!==n?(o=(0,t.jsxs)("span",{className:to.default.ItemHeader,children:[a,n]}),s[4]=a,s[5]=n,s[6]=o):o=s[6],s[7]!==c.missionName?(i=(0,t.jsx)("span",{className:to.default.ItemMissionName,children:c.missionName}),s[7]=c.missionName,s[8]=i):i=s[8],s[9]!==o||s[10]!==i?(l=(0,t.jsxs)(t.Fragment,{children:[o,i]}),s[9]=o,s[10]=i,s[11]=l):l=s[11],l}function th(e){return(0,t.jsx)("span",{className:to.default.ItemType,"data-mission-type":e,children:e},e)}function tp(e){let n,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_=(0,r.c)(48),{value:S,missionType:j,onChange:C,disabled:w,autoFocus:M}=e,[N,T]=(0,a.useState)(""),k=(0,a.useRef)(null),F=(0,a.useRef)(j);_[0]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{(0,a.startTransition)(()=>T(e))},_[0]=n):n=_[0];let R=(0,tt.useComboboxStore)({resetValueOnHide:!0,selectedValue:S,setSelectedValue:e=>{if(e){let t=F.current,r=(0,e0.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),C({missionName:e,missionType:t}),k.current?.blur()}},setValue:n}),D=(0,tr.useStoreState)(R,"open");_[1]!==R?(o=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k.current?.focus(),R.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},i=[R],_[1]=R,_[2]=o,_[3]=i):(o=_[2],i=_[3]),(0,a.useEffect)(o,i),_[4]!==S?(l=tu.get(S),_[4]=S,_[5]=l):l=_[5];let L=l;e:{let e,t;if(!N){let e;_[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:td},_[6]=e):e=_[6],s=e;break e}_[7]!==N?(e=(0,ta.matchSorter)(tc,N,{keys:["displayName","missionName","missionTypes","groupName"]}),_[7]=N,_[8]=e):e=_[8];let r=e;_[9]!==r?(t={type:"flat",missions:r},_[9]=r,_[10]=t):t=_[10],s=t}let B=s,I=L?L.displayName||L.missionName:S,A="flat"===B.type?0===B.missions.length:0===B.groups.length,P=e=>(0,t.jsx)(e4.ComboboxItem,{value:e.missionName,className:to.default.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(F.current=r,e.missionName===S&&C({missionName:e.missionName,missionType:r})):F.current=null}else F.current=null},children:(0,t.jsx)(tf,{mission:e})},e.missionName),E=e7.ComboboxProvider,z=D?"visible":"hidden";_[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("div",{className:to.default.Backdrop}),_[11]=c):c=_[11],_[12]!==z?(u=(0,t.jsx)(a.Activity,{mode:z,children:c}),_[12]=z,_[13]=u):u=_[13];let G=L?void 0:"Choose a map…";_[14]!==R?(d=()=>{try{document.exitPointerLock()}catch{}R.show()},m=e=>{"Escape"!==e.key||R.getState().open||k.current?.blur()},_[14]=R,_[15]=d,_[16]=m):(d=_[15],m=_[16]),_[17]!==M||_[18]!==w||_[19]!==d||_[20]!==m||_[21]!==G?(f=(0,t.jsx)(e5.Combobox,{ref:k,autoSelect:!0,autoFocus:M,disabled:w,placeholder:G,className:to.default.Input,onFocus:d,onKeyDown:m}),_[17]=M,_[18]=w,_[19]=d,_[20]=m,_[21]=G,_[22]=f):f=_[22],_[23]!==I||_[24]!==j||_[25]!==L?(h=L&&(0,t.jsxs)("div",{className:to.default.SelectedValue,children:[(0,t.jsx)("span",{className:to.default.SelectedName,children:I}),j&&(0,t.jsx)("span",{className:to.default.ItemType,"data-mission-type":j,children:j})]}),_[23]=I,_[24]=j,_[25]=L,_[26]=h):h=_[26],_[27]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)("kbd",{className:to.default.Shortcut,children:tm?"⌘K":"^K"}),_[27]=p):p=_[27],_[28]!==f||_[29]!==h?(g=(0,t.jsxs)("div",{className:to.default.InputWrapper,children:[f,h,p]}),_[28]=f,_[29]=h,_[30]=g):g=_[30];let U=e8.ComboboxPopover,W=to.default,H=e6.ComboboxList,O=to.default,$="flat"===B.type?B.missions.map(P):B.groups.map(e=>{let[r,n]=e;return r?(0,t.jsxs)(e9.ComboboxGroup,{className:to.default.Group,children:[(0,t.jsx)(te.ComboboxGroupLabel,{className:to.default.GroupLabel,children:r}),n.map(P)]},r):(0,t.jsx)(a.Fragment,{children:n.map(P)},"ungrouped")});return _[31]!==A?(v=A&&(0,t.jsx)("div",{className:to.default.NoResults,children:"No missions found"}),_[31]=A,_[32]=v):v=_[32],_[33]!==H||_[34]!==O.List||_[35]!==$||_[36]!==v?(x=(0,t.jsxs)(H,{className:O.List,children:[$,v]}),_[33]=H,_[34]=O.List,_[35]=$,_[36]=v,_[37]=x):x=_[37],_[38]!==U||_[39]!==W.Popover||_[40]!==x?(y=(0,t.jsx)(U,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:W.Popover,children:x}),_[38]=U,_[39]=W.Popover,_[40]=x,_[41]=y):y=_[41],_[42]!==E||_[43]!==R||_[44]!==g||_[45]!==y||_[46]!==u?(b=(0,t.jsxs)(E,{store:R,children:[u,g,y]}),_[42]=E,_[43]=R,_[44]=g,_[45]=y,_[46]=u,_[47]=b):b=_[47],b}var tg=e.i(58647);function tv(e){return(0,u.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 6-6 8h12zM6 16h12v2H6z"},child:[]}]})(e)}var tx=e.i(16964);function ty(){let e,a,n,o,i,l,s=(0,r.c)(24),c=(0,eX.useDataSource)(),u=(0,eX.useMissionDisplayName)(),d=(0,eX.useMissionType)(),m=(0,eX.useMissionTypeDisplayName)(),f=(0,eX.useServerDisplayName)(),p=(0,eX.useRecorderName)(),g=(0,eX.useRecordingDate)(),[v,x]=g?g.split(" "):[null,null],y="live"===c,b=(0,N.useRecording)(),_=(0,M.useLiveSelector)(tS),S=tx.default;s[0]!==u||s[1]!==d||s[2]!==m?(e=u&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:tx.default.MissionName,children:u}),d&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("span",{className:tx.default.MissionType,"data-mission-type":d,children:"LCTF"===m?"LCTF":d})]})]}):null,s[0]=u,s[1]=d,s[2]=m,s[3]=e):e=s[3],s[4]!==e?(a=(0,t.jsx)("div",{className:tx.default.MissionInfo,children:e}),s[4]=e,s[5]=a):a=s[5];let j=tx.default,C=y?p?(0,t.jsxs)("div",{className:tx.default.Attribution,children:["Connected as"," ",(0,t.jsx)("span",{className:tx.default.PlayerName,children:p})]}):null:p&&g?(0,t.jsxs)("div",{className:tx.default.Attribution,children:["Recorded by ",(0,t.jsx)("span",{className:tx.default.PlayerName,children:p})," ","on"," ",(0,t.jsx)("span",{className:tx.default.RecordingDate,children:v.replace(/-/g," ")})," ","at ",(0,t.jsx)("span",{className:tx.default.RecordingDate,children:x})]}):null;return s[6]!==f?(n=f?(0,t.jsxs)("div",{className:tx.default.ServerInfo,children:["Server: ",(0,t.jsx)("span",{className:tx.default.ServerName,children:f})]}):null,s[6]=f,s[7]=n):n=s[7],s[8]!==j.Metadata||s[9]!==C||s[10]!==n?(o=(0,t.jsxs)("div",{className:j.Metadata,children:[C,n]}),s[8]=j.Metadata,s[9]=C,s[10]=n,s[11]=o):o=s[11],s[12]!==c||s[13]!==tb||s[14]!==t_||s[15]!==y||s[16]!==_||s[17]!==b?(i="demo"===c?(0,t.jsx)("button",{type:"button",className:tx.default.ActionButton,title:"Unload demo","aria-label":"Unload demo",onClick:t_,disabled:!b,children:(0,t.jsx)(tv,{className:tx.default.EjectIcon})}):y?(0,t.jsx)("button",{type:"button",className:tx.default.ActionButton,title:"Disconnect","aria-label":"Disconnect",onClick:tb,disabled:!_,children:(0,t.jsx)(h,{})}):null,s[12]=c,s[13]=tb,s[14]=t_,s[15]=y,s[16]=_,s[17]=b,s[18]=i):i=s[18],s[19]!==S.Header||s[20]!==a||s[21]!==o||s[22]!==i?(l=(0,t.jsxs)("div",{className:S.Header,children:[a,o,i]}),s[19]=S.Header,s[20]=a,s[21]=o,s[22]=i,s[23]=l):l=s[23],l}function tb(){let e=M.liveConnectionStore.getState();e.disconnectServer(),e.disconnectRelay(),tg.engineStore.getState().setRecording(null)}function t_(){tg.engineStore.getState().setRecording(null)}function tS(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var tj=e.i(31067),tC=e.i(15080),tw=e.i(71753),tM=e.i(90072);let tN=a.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:o,...i},l)=>{let s=(0,tC.useThree)(({set:e})=>e),c=(0,tC.useThree)(({camera:e})=>e),u=(0,tC.useThree)(({size:e})=>e),d=a.useRef(null);a.useImperativeHandle(l,()=>d.current,[]);let m=a.useRef(null),f=function(e,t,r){let n=(0,tC.useThree)(e=>e.size),o=(0,tC.useThree)(e=>e.viewport),i="number"==typeof e?e:n.width*o.dpr,l=n.height*o.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:u,...d}=s,m=null!=u?u:s.depthBuffer,f=a.useMemo(()=>{let e=new tM.WebGLRenderTarget(i,l,{minFilter:tM.LinearFilter,magFilter:tM.LinearFilter,type:tM.HalfFloatType,...d});return m&&(e.depthTexture=new tM.DepthTexture(i,l,tM.FloatType)),e.samples=c,e},[]);return a.useLayoutEffect(()=>{f.setSize(i,l),c&&(f.samples=c)},[c,f,i,l]),a.useEffect(()=>()=>f.dispose(),[]),f}(t);a.useLayoutEffect(()=>{i.manual||(d.current.aspect=u.width/u.height)},[u,i]),a.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let h=0,p=null,g="function"==typeof o;return(0,tw.useFrame)(t=>{g&&(r===1/0||h<r)&&(m.current.visible=!1,t.gl.setRenderTarget(f),p=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,d.current),t.scene.background=p,t.gl.setRenderTarget(null),m.current.visible=!0,h++)}),a.useLayoutEffect(()=>{if(n)return s(()=>({camera:d.current})),()=>s(()=>({camera:c}))},[d,n,s]),a.createElement(a.Fragment,null,a.createElement("perspectiveCamera",(0,tj.default)({ref:d},i),!g&&o),a.createElement("group",{ref:m},g&&o(f.texture)))});function tT(){let e,a,n=(0,r.c)(3),{fov:o}=(0,b.useSettings)();return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],n[0]=e):e=n[0],n[1]!==o?(a=(0,t.jsx)(tN,{makeDefault:!0,position:e,fov:o}),n[1]=o,n[2]=a):a=n[2],a}var tk=e.i(51434),tF=e.i(68294),tR=e.i(77964),tD=e.i(93784),tL=e.i(91907),tB=e.i(25947),tI=e.i(46325),tA=e.i(31999),tP=e.i(89887);function tE(e){let t,n,o,i,l=(0,r.c)(12),{entity:s}=e,{registerCamera:c,unregisterCamera:u}=(0,tF.useCameras)(),d=(0,a.useId)(),m=s.cameraDataBlock;l[0]!==s.position?(t=s.position?new tM.Vector3(...s.position):new tM.Vector3,l[0]=s.position,l[1]=t):t=l[1];let f=t;l[2]!==s.rotation?(n=s.rotation?new tM.Quaternion(...s.rotation):new tM.Quaternion,l[2]=s.rotation,l[3]=n):n=l[3];let h=n;return l[4]!==m||l[5]!==d||l[6]!==f||l[7]!==c||l[8]!==h||l[9]!==u?(o=()=>{if("Observer"===m){let e={id:d,position:f,rotation:h};return c(e),()=>{u(e)}}},i=[d,m,c,u,f,h],l[4]=m,l[5]=d,l[6]=f,l[7]=c,l[8]=h,l[9]=u,l[10]=o,l[11]=i):(o=l[10],i=l[11]),(0,a.useEffect)(o,i),null}function tz(e){let a,n=(0,r.c)(3),{entity:o}=e;return n[0]!==o.label||n[1]!==o.position?(a=o.label?(0,t.jsx)(tP.FloatingLabel,{position:o.position,opacity:.6,children:o.label}):null,n[0]=o.label,n[1]=o.position,n[2]=a):a=n[2],a}var tG=e.i(66027),tU=e.i(63318),tW=e.i(12979),tH=e.i(75567),tO=e.i(47071);let t$={value:!0},tV=`
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 tq=e.i(47021),tQ=e.i(48066);let tK={0:32,1:32,2:32,3:32,4:32,5:32},tY=(0,a.memo)(function({displacementMap:e,visibilityMask:r,textureNames:n,alphaTextures:o,detailTextureName:i,lightmap:l}){let{debugMode:s}=(0,b.useDebug)(),c=(0,tO.useTexture)(n.map(e=>(0,tW.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,tH.setupTexture)(e))}),u=i?(0,tW.textureToUrl)(i):null,d=(0,tO.useTexture)(u??tW.FALLBACK_TEXTURE_URL,e=>{(0,tH.setupTexture)(e)}),m=(0,a.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:a,tiling:n,detailTexture:o=null,lightmap:i=null}){e.uniforms.sunLightPointsDown=t$;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}}),a&&(e.uniforms.visibilityMask={value:a}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:n[r]??32}}),i&&(e.uniforms.terrainLightmap={value:i}),o&&(e.uniforms.detailTexture={value:o},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include <common>",`#include <common>
varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include <worldpos_vertex>",`#include <worldpos_vertex>
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;
${a?"uniform sampler2D visibilityMask;":""}
${i?"uniform sampler2D terrainLightmap;":""}
uniform bool sunLightPointsDown;
${o?`uniform sampler2D detailTexture;
uniform float detailTiling;
uniform float detailFadeDistance;
varying vec3 vTerrainWorldPos;`:""}
${tV}
// Global variable to store shadow factor from RE_Direct for use in output calculation
float terrainShadowFactor = 1.0;
`+e.fragmentShader,a){let t="#include <clipping_planes_fragment>";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 <map_fragment>",`
// 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;
${o?`// 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;
`),i&&(e.fragmentShader=e.fragmentShader.replace("#include <lights_lambert_pars_fragment>",`#include <lights_lambert_pars_fragment>
// 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 <lights_fragment_begin>",`#include <lights_fragment_begin>
// 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 <lights_fragment_end>",`#include <lights_fragment_end>
// 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 <opaque_fragment>",`// 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);
${i?`
// 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 <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`#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 <tonemapping_fragment>`)}({shader:e,baseTextures:c,alphaTextures:o,visibilityMask:r,tiling:tK,detailTexture:u?d:null,lightmap:l}),(0,tq.injectCustomFog)(e,tQ.globalFogUniforms)},[c,o,r,d,u,l]),f=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let h=`${u?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,t.jsx)("meshLambertMaterial",{ref:f,map:e,depthWrite:!0,side:tM.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:m},h)}),tJ=(0,a.memo)(function(e){let n,o,i=(0,r.c)(8),{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),i[0]=n):n=i[0],i[1]!==u||i[2]!==d||i[3]!==l||i[4]!==m||i[5]!==c||i[6]!==s?(o=(0,t.jsx)(a.Suspense,{fallback:n,children:(0,t.jsx)(tY,{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m})}),i[1]=u,i[2]=d,i[3]=l,i[4]=m,i[5]=c,i[6]=s,i[7]=o):o=i[7],o}),tZ=(0,a.memo)(function(e){let a,n,o,i=(0,r.c)(15),{tileX:l,tileZ:s,blockSize:c,basePosition:u,textureNames:d,geometry:m,displacementMap:f,visibilityMask:h,alphaTextures:p,detailTextureName:g,lightmap:v,visible:x}=e,y=void 0===x||x,b=c/2,_=u.x+l*c+b,S=u.z+s*c+b;i[0]!==_||i[1]!==S?(a=[_,0,S],i[0]=_,i[1]=S,i[2]=a):a=i[2];let j=a;return i[3]!==p||i[4]!==g||i[5]!==f||i[6]!==v||i[7]!==d||i[8]!==h?(n=(0,t.jsx)(tJ,{displacementMap:f,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:g,lightmap:v}),i[3]=p,i[4]=g,i[5]=f,i[6]=v,i[7]=d,i[8]=h,i[9]=n):n=i[9],i[10]!==m||i[11]!==j||i[12]!==n||i[13]!==y?(o=(0,t.jsx)("mesh",{position:j,geometry:m,castShadow:!0,receiveShadow:!0,visible:y,children:n}),i[10]=m,i[11]=j,i[12]=n,i[13]=y,i[14]=o):o=i[14],o});function tX(e){}let t0=(0,w.createLogger)("TerrainBlock");function t1(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,a=r>>8&255,n=r>>16,o=256*a;for(let r=0;r<n;r++){let a=o+e+r;a<t.length&&(t[a]=0)}}let r=new tM.DataTexture(t,256,256,tM.RedFormat,tM.UnsignedByteType);return r.colorSpace=tM.NoColorSpace,r.wrapS=r.wrapT=tM.ClampToEdgeWrapping,r.magFilter=tM.NearestFilter,r.minFilter=tM.NearestFilter,r.needsUpdate=!0,r}let t2=(0,a.memo)(function(e){let n,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S,j,C,w,M,N,T=(0,r.c)(67),{scene:k}=e,F=k.terrFileName,R=k.squareSize||8,D=k.detailTextureName||void 0,L=256*R,B=(S=(0,eX.useSceneSky)())&&S.visibleDistance>0?S.visibleDistance:600,I=(0,tC.useThree)(t3),A=-(128*R);T[0]!==A?(n={x:A,z:A},T[0]=A,T[1]=n):n=T[1];let P=n;T[2]!==k.emptySquareRuns?(o=k.emptySquareRuns??[],T[2]=k.emptySquareRuns,T[3]=o):o=T[3];let E=o,{data:z}=((M=(0,r.c)(8))[0]!==F?(j={queryKey:["terrain",F],queryFn:()=>(t0.debug("Loading terrain: %s",F),(0,tW.loadTerrain)(F))},M[0]=F,M[1]=j):j=M[1],N=(0,tG.useQuery)(j),M[2]!==N.data||M[3]!==N.error||M[4]!==N.status||M[5]!==F?(C=()=>{t0.debug("Query status: %s%s%s file=%s",N.status,N.error?` error=${N.error.message}`:"",N.data?" (data ready)":" (no data)",F)},w=[N.status,N.error,N.data,F],M[2]=N.data,M[3]=N.error,M[4]=N.status,M[5]=F,M[6]=C,M[7]=w):(C=M[6],w=M[7]),(0,a.useEffect)(C,w),N);e:{let e;if(!z){i=null;break e}let t=256*R;T[4]!==t||T[5]!==R||T[6]!==z.heightMap?(!function(e,t,r){let a=e.attributes.position,n=e.attributes.uv,o=e.attributes.normal,i=a.array,l=n.array,s=o.array,c=a.count,u=(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 a=Math.floor(e=Math.max(0,Math.min(255,e))),n=Math.floor(r=Math.max(0,Math.min(255,r))),o=Math.min(a+1,255),i=Math.min(n+1,255),l=e-a,s=r-n;return(t[256*n+a]/65535*2048*(1-l)+t[256*n+o]/65535*2048*l)*(1-s)+(t[256*i+a]/65535*2048*(1-l)+t[256*i+o]/65535*2048*l)*s};for(let e=0;e<c;e++){let t=l[2*e],a=l[2*e+1],n=u(255&Math.floor(256*t),255&Math.floor(256*a));i[3*e+1]=n;let o=255*t,c=255*a,m=d(o-1,c),f=d(o+1,c),h=(d(o,c+1)-d(o,c-1))/2,p=r,g=(f-m)/2,v=Math.sqrt(h*h+p*p+g*g);v>0?(h/=v,p/=v,g/=v):(h=0,p=1,g=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=g}a.needsUpdate=!0,o.needsUpdate=!0}(e=function(e,t){let r=new tM.BufferGeometry,a=new Float32Array(198147),n=new Float32Array(198147),o=new Float32Array(132098),i=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let i=257*t+r;a[3*i]=r*s-e/2,a[3*i+1]=e/2-t*s,a[3*i+2]=0,n[3*i]=0,n[3*i+1]=0,n[3*i+2]=1,o[2*i]=r/256,o[2*i+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,a=r+1,n=(e+1)*257+t,o=n+1;((t^e)&1)==0?(i[l++]=r,i[l++]=n,i[l++]=o,i[l++]=r,i[l++]=o,i[l++]=a):(i[l++]=r,i[l++]=n,i[l++]=a,i[l++]=a,i[l++]=n,i[l++]=o)}return r.setIndex(new tM.BufferAttribute(i,1)),r.setAttribute("position",new tM.Float32BufferAttribute(a,3)),r.setAttribute("normal",new tM.Float32BufferAttribute(n,3)),r.setAttribute("uv",new tM.Float32BufferAttribute(o,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),z.heightMap,R),T[4]=t,T[5]=R,T[6]=z.heightMap,T[7]=e):e=T[7],i=e}let G=i;T[8]!==R||T[9]!==z?(l=()=>{if(z){var e;return tX((e=z.heightMap,(t,r)=>{let a=Math.max(0,Math.min(255,t/R+128)),n=Math.max(0,Math.min(255,r/R+128)),o=Math.floor(a),i=Math.floor(n),l=Math.min(o+1,255),s=Math.min(i+1,255),c=a-o,u=n-i;return((e[256*i+o]*(1-c)+e[256*i+l]*c)*(1-u)+(e[256*s+o]*(1-c)+e[256*s+l]*c)*u)/65535*2048})),t5}},s=[z,R],T[8]=R,T[9]=z,T[10]=l,T[11]=s):(l=T[10],s=T[11]),(0,a.useEffect)(l,s);let U=(0,eX.useSceneSun)();t:{let e,t;if(!U){let e;T[12]===Symbol.for("react.memo_cache_sentinel")?(e=new tM.Vector3(.57735,-.57735,.57735),T[12]=e):e=T[12],c=e;break t}T[13]!==U.direction?(e=(0,tU.torqueToThree)(U.direction),T[13]=U.direction,T[14]=e):e=T[14];let[r,a,n]=e,o=Math.sqrt(r*r+a*a+n*n),i=r/o,l=a/o,s=n/o;T[15]!==s||T[16]!==i||T[17]!==l?(t=new tM.Vector3(i,l,s),T[15]=s,T[16]=i,T[17]=l,T[18]=t):t=T[18],c=t}let W=c;r:{let e;if(!z){u=null;break r}T[19]!==R||T[20]!==W||T[21]!==z.heightMap?(e=function(e,t,r){let a=(t,r)=>{let a=Math.max(0,Math.min(255,t)),n=Math.max(0,Math.min(255,r)),o=Math.floor(a),i=Math.floor(n),l=Math.min(o+1,255),s=Math.min(i+1,255),c=a-o,u=n-i;return((e[256*i+o]/65535*(1-c)+e[256*i+l]/65535*c)*(1-u)+(e[256*s+o]/65535*(1-c)+e[256*s+l]/65535*c)*u)*2048},n=new tM.Vector3(-t.x,-t.y,-t.z).normalize(),o=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=t/2+.25,l=e/2+.25,s=a(i,l),c=a(i-.5,l),u=a(i+.5,l),d=a(i,l-.5),m=-((a(i,l+.5)-d)/1),f=-((u-c)/1),h=Math.sqrt(m*m+r*r+f*f),p=Math.max(0,m/h*n.x+r/h*n.y+f/h*n.z),g=1;p>0&&(g=function(e,t,r,a,n,o){let i=a.z/n,l=a.x/n,s=a.y,c=Math.sqrt(i*i+l*l);if(c<1e-4)return 1;let u=.5/c,d=i*u,m=l*u,f=s*u,h=e,p=t,g=r+.1;for(let e=0;e<768&&(h+=d,p+=m,g+=f,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(g>2048));e++)if(g<o(h,p))return 0;return 1}(i,l,s,n,r,a)),o[512*e+t]=Math.floor(p*g*255)}let i=new tM.DataTexture(o,512,512,tM.RedFormat,tM.UnsignedByteType);return i.colorSpace=tM.NoColorSpace,i.generateMipmaps=!0,i.wrapS=tM.ClampToEdgeWrapping,i.wrapT=tM.ClampToEdgeWrapping,i.magFilter=tM.LinearFilter,i.minFilter=tM.LinearFilter,i.needsUpdate=!0,i}(z.heightMap,W,R),T[19]=R,T[20]=W,T[21]=z.heightMap,T[22]=e):e=T[22],u=e}let H=u;a:{let e;if(!z){d=null;break a}if(T[23]!==z.heightMap){let t=function(e){let t=new Float32Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(z.heightMap);(e=new tM.DataTexture(t,256,256,tM.RedFormat,tM.FloatType)).colorSpace=tM.NoColorSpace,e.generateMipmaps=!1,e.wrapS=tM.RepeatWrapping,e.wrapT=tM.RepeatWrapping,e.needsUpdate=!0,T[23]=z.heightMap,T[24]=e}else e=T[24];d=e}let O=d;T[25]!==E?(m=t1(E),T[25]=E,T[26]=m):m=T[26];let $=m;T[27]===Symbol.for("react.memo_cache_sentinel")?(f=t1([]),T[27]=f):f=T[27];let V=f;n:{let e;if(!z){h=null;break n}T[28]!==z.alphaMaps?(e=z.alphaMaps.map(t4),T[28]=z.alphaMaps,T[29]=e):e=T[29],h=e}let q=h,Q=2*Math.ceil(B/L)+1,K=Q*Q-1;T[30]!==K?(p=Array.from({length:K},t6),T[30]=K,T[31]=p):p=T[31];let Y=p;T[32]!==K?(g=()=>Array(K).fill(null),T[32]=K,T[33]=g):g=T[33];let[J,Z]=(0,a.useState)(g);T[34]===Symbol.for("react.memo_cache_sentinel")?(v={xStart:0,xEnd:0,zStart:0,zEnd:0},T[34]=v):v=T[34];let X=(0,a.useRef)(v);return(T[35]!==P.x||T[36]!==P.z||T[37]!==L||T[38]!==I.position.x||T[39]!==I.position.z||T[40]!==K||T[41]!==B?(x=()=>{let e=I.position.x-P.x,t=I.position.z-P.z,r=Math.floor((e-B)/L),a=Math.ceil((e+B)/L),n=Math.floor((t-B)/L),o=Math.ceil((t+B)/L),i=X.current;if(r===i.xStart&&a===i.xEnd&&n===i.zStart&&o===i.zEnd)return;i.xStart=r,i.xEnd=a,i.zStart=n,i.zEnd=o;let l=[];for(let e=r;e<a;e++)for(let t=n;t<o;t++)(0!==e||0!==t)&&l.push({tileX:e,tileZ:t});for(;l.length<K;)l.push(null);Z(l)},T[35]=P.x,T[36]=P.z,T[37]=L,T[38]=I.position.x,T[39]=I.position.z,T[40]=K,T[41]=B,T[42]=x):x=T[42],(0,tw.useFrame)(x),z&&G&&O&&q)?(T[43]!==P||T[44]!==L||T[45]!==D||T[46]!==$||T[47]!==q||T[48]!==O||T[49]!==G||T[50]!==z.textureNames||T[51]!==H?(y=(0,t.jsx)(tZ,{tileX:0,tileZ:0,blockSize:L,basePosition:P,textureNames:z.textureNames,geometry:G,displacementMap:O,visibilityMask:$,alphaTextures:q,detailTextureName:D,lightmap:H}),T[43]=P,T[44]=L,T[45]=D,T[46]=$,T[47]=q,T[48]=O,T[49]=G,T[50]=z.textureNames,T[51]=H,T[52]=y):y=T[52],T[53]!==P||T[54]!==L||T[55]!==D||T[56]!==Y||T[57]!==q||T[58]!==O||T[59]!==G||T[60]!==z.textureNames||T[61]!==H||T[62]!==J?(b=Y.map(e=>{let r=J[e];return(0,t.jsx)(tZ,{tileX:r?.tileX??0,tileZ:r?.tileZ??0,blockSize:L,basePosition:P,textureNames:z.textureNames,geometry:G,displacementMap:O,visibilityMask:V,alphaTextures:q,detailTextureName:D,lightmap:H,visible:null!==r},e)}),T[53]=P,T[54]=L,T[55]=D,T[56]=Y,T[57]=q,T[58]=O,T[59]=G,T[60]=z.textureNames,T[61]=H,T[62]=J,T[63]=b):b=T[63],T[64]!==y||T[65]!==b?(_=(0,t.jsxs)(t.Fragment,{children:[y,b]}),T[64]=y,T[65]=b,T[66]=_):_=T[66],_):(t0.debug("Not ready: terrain=%s geometry=%s displacement=%s alpha=%s",!!z,!!G,!!O,!!q),null)});function t3(e){return e.camera}function t5(){return tX(null)}function t4(e){return(0,tH.setupMask)(e)}function t6(e,t){return t}var t8=e.i(8597),t7=e.i(78140);let t9=`
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);
}
`,re=(0,w.createLogger)("InteriorInstance");function rt({materialName:e,material:r,lightMap:n}){let o=(0,b.useDebug)(),i=o?.debugMode??!1,l=(0,tW.textureToUrl)(e),s=(0,tO.useTexture)(l,e=>(0,tH.setupTexture)(e)),c=new Set(r?.userData?.flag_names??[]).has("SelfIlluminating"),u=new Set(r?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),d=(0,a.useCallback)(e=>{let t;(0,tq.injectCustomFog)(e,tQ.globalFogUniforms),t=u??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new tM.Vector3(0,.4,1):new tM.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include <common>",`#include <common>
${t9}
uniform bool useSceneLighting;
uniform vec3 interiorDebugColor;
`),e.fragmentShader=e.fragmentShader.replace("#include <lights_fragment_maps>",`// Lightmap handled in custom output calculation
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
#endif`),e.fragmentShader=e.fragmentShader.replace("#include <opaque_fragment>",`// 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 <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`// 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 <tonemapping_fragment>`)},[u]),m=(0,a.useRef)(null),f=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=m.current??f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let h={DEBUG_MODE:+!!i},p=`${u}`;return c?(0,t.jsx)("meshBasicMaterial",{ref:m,map:s,toneMapped:!1,defines:h,onBeforeCompile:d},p):(0,t.jsx)("meshLambertMaterial",{ref:f,map:s,lightMap:n,toneMapped:!1,defines:h,onBeforeCompile:d},p)}function rr(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=tM.SRGBColorSpace),t??null}function ra(e){let a,n,o,i=(0,r.c)(13),{node:l}=e;e:{let e,t;if(!l.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],a=e;break e}if(Array.isArray(l.material)){let e;i[1]!==l.material?(e=l.material.map(rn),i[1]=l.material,i[2]=e):e=i[2],a=e;break e}i[3]!==l.material?(e=rr(l.material),i[3]=l.material,i[4]=e):e=i[4],i[5]!==e?(t=[e],i[5]=e,i[6]=t):t=i[6],a=t}let s=a;return i[7]!==s||i[8]!==l.material?(n=l.material?(0,t.jsx)(tI.DebugSuspense,{name:`InteriorTexture:${Array.isArray(l.material)?l.material[0]?.userData?.resource_path:l.material?.userData?.resource_path??"?"}`,fallback:(0,t.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,r)=>(0,t.jsx)(rt,{materialName:e.userData.resource_path,material:e,lightMap:s[r]},r)):(0,t.jsx)(rt,{materialName:l.material.userData.resource_path,material:l.material,lightMap:s[0]})}):null,i[7]=s,i[8]=l.material,i[9]=n):n=i[9],i[10]!==l.geometry||i[11]!==n?(o=(0,t.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:n}),i[10]=l.geometry,i[11]=n,i[12]=o):o=i[12],o}function rn(e){return rr(e)}let ro=(0,a.memo)(function(e){let a,n,o,i,l,s,c,u=(0,r.c)(10),{interiorFile:d,ghostIndex:m}=e,{nodes:f}=((s=(0,r.c)(2))[0]!==d?(l=(0,tW.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],c=l,(0,t7.useGLTF)(c)),h=(0,b.useDebug)(),p=h?.debugMode??!1;return u[0]===Symbol.for("react.memo_cache_sentinel")?(a=[0,-Math.PI/2,0],u[0]=a):a=u[0],u[1]!==f?(n=Object.entries(f).filter(rc).map(ru),u[1]=f,u[2]=n):n=u[2],u[3]!==p||u[4]!==m||u[5]!==d?(o=p?(0,t.jsxs)(tP.FloatingLabel,{children:[m,": ",d]}):null,u[3]=p,u[4]=m,u[5]=d,u[6]=o):o=u[6],u[7]!==n||u[8]!==o?(i=(0,t.jsxs)("group",{rotation:a,children:[n,o]}),u[7]=n,u[8]=o,u[9]=i):i=u[9],i});function ri(e){let a,n,o,i,l=(0,r.c)(9),{color:s,label:c}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=a):a=l[0],l[1]!==s?(n=(0,t.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=n):n=l[2],l[3]!==s||l[4]!==c?(o=c?(0,t.jsx)(tP.FloatingLabel,{color:s,children:c}):null,l[3]=s,l[4]=c,l[5]=o):o=l[5],l[6]!==n||l[7]!==o?(i=(0,t.jsxs)("mesh",{children:[a,n,o]}),l[6]=n,l[7]=o,l[8]=i):i=l[8],i}function rl(e){let a,n=(0,r.c)(3),{label:o}=e,i=(0,b.useDebug)(),l=i?.debugMode??!1;return n[0]!==l||n[1]!==o?(a=l?(0,t.jsx)(ri,{color:"red",label:o}):null,n[0]=l,n[1]=o,n[2]=a):a=n[2],a}let rs=(0,a.memo)(function(e){let a,n,o,i,l,s,c,u,d,m,f=(0,r.c)(26),{scene:h}=e;f[0]!==h.transform.position?(a=(0,tU.torqueToThree)(h.transform.position),f[0]=h.transform.position,f[1]=a):a=f[1];let p=a;f[2]!==h.transform?(n=(0,tU.matrixFToQuaternion)(h.transform),f[2]=h.transform,f[3]=n):n=f[3];let g=n;f[4]!==h.scale?(o=(0,tU.torqueScaleToThree)(h.scale),f[4]=h.scale,f[5]=o):o=f[5];let v=o,x=`${h.ghostIndex}: ${h.interiorFile}`;f[6]!==x?(i=(0,t.jsx)(rl,{label:x}),f[6]=x,f[7]=i):i=f[7],f[8]!==h.interiorFile?(l=e=>{re.error("Failed to load %s: %s",h.interiorFile,e.message)},f[8]=h.interiorFile,f[9]=l):l=f[9];let y=`InteriorModel:${h.interiorFile}`;return f[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ri,{color:"orange"}),f[10]=s):s=f[10],f[11]!==h.ghostIndex||f[12]!==h.interiorFile?(c=(0,t.jsx)(ro,{interiorFile:h.interiorFile,ghostIndex:h.ghostIndex}),f[11]=h.ghostIndex,f[12]=h.interiorFile,f[13]=c):c=f[13],f[14]!==y||f[15]!==c?(u=(0,t.jsx)(tI.DebugSuspense,{name:y,fallback:s,children:c}),f[14]=y,f[15]=c,f[16]=u):u=f[16],f[17]!==u||f[18]!==i||f[19]!==l?(d=(0,t.jsx)(t8.ErrorBoundary,{fallback:i,onError:l,children:u}),f[17]=u,f[18]=i,f[19]=l,f[20]=d):d=f[20],f[21]!==p||f[22]!==g||f[23]!==v||f[24]!==d?(m=(0,t.jsx)("group",{position:p,quaternion:g,scale:v,children:d}),f[21]=p,f[22]=g,f[23]=v,f[24]=d,f[25]=m):m=f[25],m});function rc(e){let[,t]=e;return t.isMesh}function ru(e){let[r,a]=e;return(0,t.jsx)(ra,{node:a},r)}var rd=e.i(99143);function rm(e,{path:t}){let[r]=(0,rd.useLoader)(tM.CubeTextureLoader,[e],e=>e.setPath(t));return r}rm.preload=(e,{path:t})=>rd.useLoader.preload(tM.CubeTextureLoader,[e],e=>e.setPath(t));let rf=()=>{};function rh(e){return e.wrapS=tM.RepeatWrapping,e.wrapT=tM.RepeatWrapping,e.minFilter=tM.LinearFilter,e.magFilter=tM.LinearFilter,e.colorSpace=tM.NoColorSpace,e.needsUpdate=!0,e}let rp=`
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;
}
`,rg=`
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 rv({textureUrl:e,radius:r,heightPercent:n,speed:o,windDirection:i,layerIndex:l}){let{debugMode:s}=(0,b.useDebug)(),{animationEnabled:c}=(0,b.useSettings)(),u=(0,a.useRef)(null),d=(0,tO.useTexture)(e,rh),m=(0,a.useMemo)(()=>{let e=n-.05;return function(e,t,r,a){var n;let o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S=new tM.BufferGeometry,j=new Float32Array(75),C=new Float32Array(50),w=[.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],M=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let a=5*t+r,n=-e+r*M,o=e-t*M,i=e*w[a];j[3*a]=n,j[3*a+1]=i,j[3*a+2]=o,C[2*a]=r,C[2*a+1]=t}n=j,o=e=>({x:n[3*e],y:n[3*e+1],z:n[3*e+2]}),i=(e,t,r,a)=>{n[3*e]=t,n[3*e+1]=r,n[3*e+2]=a},l=o(1),s=o(3),c=o(5),u=o(6),d=o(8),m=o(9),f=o(15),h=o(16),p=o(18),g=o(19),v=o(21),x=o(23),y=c.x+(l.x-c.x)*.5,b=c.y+(l.y-c.y)*.5,_=c.z+(l.z-c.z)*.5,i(0,u.x+(y-u.x)*2,u.y+(b-u.y)*2,u.z+(_-u.z)*2),y=m.x+(s.x-m.x)*.5,b=m.y+(s.y-m.y)*.5,_=m.z+(s.z-m.z)*.5,i(4,d.x+(y-d.x)*2,d.y+(b-d.y)*2,d.z+(_-d.z)*2),y=v.x+(f.x-v.x)*.5,b=v.y+(f.y-v.y)*.5,_=v.z+(f.z-v.z)*.5,i(20,h.x+(y-h.x)*2,h.y+(b-h.y)*2,h.z+(_-h.z)*2),y=x.x+(g.x-x.x)*.5,b=x.y+(g.y-x.y)*.5,_=x.z+(g.z-x.z)*.5,i(24,p.x+(y-p.x)*2,p.y+(b-p.y)*2,p.z+(_-p.z)*2);let N=function(e,t){let r=new Float32Array(25);for(let a=0;a<25;a++){let n=e[3*a],o=e[3*a+2],i=1.3-Math.sqrt(n*n+o*o)/t;i<.4?i=0:i>.8&&(i=1),r[a]=i}return r}(j,e),T=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,a=r+1,n=r+5,o=n+1;T.push(r,n,o),T.push(r,o,a)}return S.setIndex(T),S.setAttribute("position",new tM.Float32BufferAttribute(j,3)),S.setAttribute("uv",new tM.Float32BufferAttribute(C,2)),S.setAttribute("alpha",new tM.Float32BufferAttribute(N,1)),S.computeBoundingSphere(),S}(r,n,e,0)},[r,n]);(0,a.useEffect)(()=>()=>{m.dispose()},[m]);let f=(0,a.useMemo)(()=>new tM.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new tM.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:rp,fragmentShader:rg,transparent:!0,depthWrite:!1,side:tM.DoubleSide}),[d,s,l]);return(0,a.useEffect)(()=>()=>{f.dispose()},[f]),(0,tw.useFrame)(c?(e,t)=>{let r=1e3*t/32;u.current??=new tM.Vector2(0,0),u.current.x+=i.x*o*r,u.current.y+=i.y*o*r,u.current.x-=Math.floor(u.current.x),u.current.y-=Math.floor(u.current.y),f.uniforms.uvOffset.value.copy(u.current)}:rf),(0,t.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,t.jsx)("primitive",{object:f,attach:"material"})})}function rx(e){var n;let o,i,l,s,c,u,d,m,f,h,p,g=(0,r.c)(18),{scene:v}=e,{data:x}=(n=v.materialList||void 0,(h=(0,r.c)(7))[0]!==n?(d=["detailMapList",n],m=()=>(0,tW.loadDetailMapList)(n),h[0]=n,h[1]=d,h[2]=m):(d=h[1],m=h[2]),p=!!n,h[3]!==d||h[4]!==m||h[5]!==p?(f={queryKey:d,queryFn:m,enabled:p},h[3]=d,h[4]=m,h[5]=p,h[6]=f):f=h[6],(0,tG.useQuery)(f)),y=.95*(v.visibleDistance>0?v.visibleDistance:500);g[0]!==v.cloudLayers?(o=v.cloudLayers.map(rb),g[0]=v.cloudLayers,g[1]=o):o=g[1];let b=o;g[2]!==v.cloudLayers?(i=v.cloudLayers.map(ry),g[2]=v.cloudLayers,g[3]=i):i=g[3];let _=i;e:{let e,{x:t,y:r}=v.windVelocity;if(0!==t||0!==r){let e;g[4]!==t||g[5]!==r?(e=new tM.Vector2(r,-t).normalize(),g[4]=t,g[5]=r,g[6]=e):e=g[6],l=e;break e}g[7]===Symbol.for("react.memo_cache_sentinel")?(e=new tM.Vector2(1,0),g[7]=e):e=g[7],l=e}let S=l;t:{let e;if(!x){let e;g[8]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[8]=e):e=g[8],s=e;break t}if(g[9]!==_||g[10]!==b||g[11]!==x){e=[];for(let t=0;t<3;t++){let r=x[7+t];r&&e.push({texture:r,height:_[t],speed:b[t]})}g[9]=_,g[10]=b,g[11]=x,g[12]=e}else e=g[12];s=e}let j=s,C=(0,a.useRef)(null);return(g[13]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{let{camera:t}=e;C.current&&C.current.position.copy(t.position)},g[13]=c):c=g[13],(0,tw.useFrame)(c),j&&0!==j.length)?(g[14]!==j||g[15]!==y||g[16]!==S?(u=(0,t.jsx)("group",{ref:C,children:j.map((e,r)=>{let n=(0,tW.textureToUrl)(e.texture);return(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(rv,{textureUrl:n,radius:y,heightPercent:e.height,speed:e.speed,windDirection:S,layerIndex:r})},r)})}),g[14]=j,g[15]=y,g[16]=S,g[17]=u):u=g[17],u):null}function ry(e,t){return e.heightPercent||[.35,.25,.2][t]}function rb(e,t){return e.speed||[1e-4,2e-4,3e-4][t]}e.i(62395);let r_=(0,w.createLogger)("Sky"),rS=!1;function rj(e){return[new tM.Color().setRGB(e.r,e.g,e.b),new tM.Color().setRGB(e.r,e.g,e.b).convertSRGBToLinear()]}function rC({skyBoxFiles:e,fogColor:r,fogState:n}){let o=(0,tC.useThree)(e=>e.camera),i=rm(e,{path:""}),l=!!r,s=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),c=(0,a.useMemo)(()=>n?(0,tQ.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),u=(0,a.useRef)({skybox:{value:i},fogColor:{value:r??new tM.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:tQ.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),d=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]);return(0,a.useEffect)(()=>{u.current.skybox.value=i,u.current.fogColor.value=r??new tM.Color(0,0,0),u.current.enableFog.value=l,u.current.fogVolumeData.value=c,u.current.horizonFogHeight.value=d},[i,r,l,c,d]),(0,t.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,t.jsxs)("bufferGeometry",{children:[(0,t.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,t.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,t.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position.xy, 0.9999, 1.0);
}
`,fragmentShader:`
uniform samplerCube skybox;
uniform vec3 fogColor;
uniform bool enableFog;
uniform mat4 inverseProjectionMatrix;
uniform mat4 cameraMatrixWorld;
uniform float cameraHeight;
uniform float fogVolumeData[12];
uniform float horizonFogHeight;
varying vec2 vUv;
// Convert linear to sRGB for display
// shaderMaterial does NOT get automatic linear->sRGB output conversion
// Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js
vec3 linearToSRGB(vec3 linear) {
vec3 low = linear * 12.92;
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
return mix(low, high, step(vec3(0.0031308), linear));
}
void main() {
vec2 ndc = vUv * 2.0 - 1.0;
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
viewPos.xyz /= viewPos.w;
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
direction = vec3(direction.z, direction.y, -direction.x);
// Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear
vec4 skyColor = textureCube(skybox, direction);
vec3 finalColor;
if (enableFog) {
vec3 effectiveFogColor = fogColor;
// Calculate how much fog volume the ray passes through
// For skybox at "infinite" distance, the relevant height is how much
// of the volume is above/below camera depending on view direction
float volumeFogInfluence = 0.0;
for (int i = 0; i < 3; i++) {
int offset = i * 4;
float volVisDist = fogVolumeData[offset + 0];
float volMinH = fogVolumeData[offset + 1];
float volMaxH = fogVolumeData[offset + 2];
float volPct = fogVolumeData[offset + 3];
if (volVisDist <= 0.0) continue;
// Check if camera is inside this volume
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
// Camera is inside the fog volume
// Looking horizontally or up at shallow angles means ray travels
// through more fog before exiting the volume
float heightAboveCamera = volMaxH - cameraHeight;
float heightBelowCamera = cameraHeight - volMinH;
float volumeHeight = volMaxH - volMinH;
// For horizontal rays (direction.y ≈ 0), maximum fog influence
// For rays going up steeply, less fog (exits volume quickly)
// For rays going down, more fog (travels through volume below)
float rayInfluence;
if (direction.y >= 0.0) {
// Looking up: influence based on how steep we're looking
// Shallow angles = long path through fog = high influence
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
} else {
// Looking down: always high fog (into the volume)
rayInfluence = 1.0;
}
// Scale by percentage and volume depth factor
volumeFogInfluence += rayInfluence * volPct;
}
}
// Base fog factor from view direction (for haze at horizon)
// In Torque, the fog "bans" (bands) are rendered as geometry from
// height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox.
// The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3).
//
// horizonFogHeight is the direction.y value where the fog band ends:
// horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2)
//
// For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18
//
// Torque renders the fog bands as geometry with linear vertex alpha
// interpolation. We use a squared curve (t^2) to create a gentler
// falloff at the top of the gradient, matching Tribes 2's appearance.
float baseFogFactor;
if (direction.y <= 0.0) {
// Looking at or below horizon: full fog
baseFogFactor = 1.0;
} else if (direction.y >= horizonFogHeight) {
// Above fog band: no fog
baseFogFactor = 0.0;
} else {
// Within fog band: squared curve for gentler falloff at top
float t = direction.y / horizonFogHeight;
baseFogFactor = (1.0 - t) * (1.0 - t);
}
// Combine base fog with volume fog influence
// When inside a volume, increase fog intensity
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor);
} else {
finalColor = skyColor.rgb;
}
// Convert linear result to sRGB for display
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
}
`,depthWrite:!1,depthTest:!1})]})}function rw(e){let n,o,i,l,s,c,u,d=(0,r.c)(6),{materialList:m,fogColor:f,fogState:h}=e,{data:p}=((c=(0,r.c)(8))[0]!==m?(i={queryKey:["detailMapList",m],queryFn:()=>(r_.debug("Loading detail map list: %s",m),(0,tW.loadDetailMapList)(m))},c[0]=m,c[1]=i):i=c[1],u=(0,tG.useQuery)(i),c[2]!==m||c[3]!==u.data||c[4]!==u.error||c[5]!==u.status?(l=()=>{r_.debug("DML query status: %s%s%s file=%s",u.status,u.error?` error=${u.error.message}`:"",u.data?` (${u.data.length} entries)`:" (no data)",m)},s=[u.status,u.error,u.data,m],c[2]=m,c[3]=u.data,c[4]=u.error,c[5]=u.status,c[6]=l,c[7]=s):(l=c[6],s=c[7]),(0,a.useEffect)(l,s),u);d[0]!==p?(n=p?[(0,tW.textureToUrl)(p[1]),(0,tW.textureToUrl)(p[3]),(0,tW.textureToUrl)(p[4]),(0,tW.textureToUrl)(p[5]),(0,tW.textureToUrl)(p[0]),(0,tW.textureToUrl)(p[2])]:null,d[0]=p,d[1]=n):n=d[1];let g=n;return g?(d[2]!==f||d[3]!==h||d[4]!==g?(o=(0,t.jsx)(rC,{skyBoxFiles:g,fogColor:f,fogState:h}),d[2]=f,d[3]=h,d[4]=g,d[5]=o):o=d[5],o):null}function rM({skyColor:e,fogColor:r,fogState:n}){let o=(0,tC.useThree)(e=>e.camera),i=!!r,l=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),s=(0,a.useMemo)(()=>n?(0,tQ.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),c=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]),u=(0,a.useRef)({skyColor:{value:e},fogColor:{value:r??new tM.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:tQ.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,a.useEffect)(()=>{u.current.skyColor.value=e,u.current.fogColor.value=r??new tM.Color(0,0,0),u.current.enableFog.value=i,u.current.fogVolumeData.value=s,u.current.horizonFogHeight.value=c},[e,r,i,s,c]),(0,t.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,t.jsxs)("bufferGeometry",{children:[(0,t.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,t.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,t.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position.xy, 0.9999, 1.0);
}
`,fragmentShader:`
uniform vec3 skyColor;
uniform vec3 fogColor;
uniform bool enableFog;
uniform mat4 inverseProjectionMatrix;
uniform mat4 cameraMatrixWorld;
uniform float cameraHeight;
uniform float fogVolumeData[12];
uniform float horizonFogHeight;
varying vec2 vUv;
// Convert linear to sRGB for display
vec3 linearToSRGB(vec3 linear) {
vec3 low = linear * 12.92;
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
return mix(low, high, step(vec3(0.0031308), linear));
}
void main() {
vec2 ndc = vUv * 2.0 - 1.0;
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
viewPos.xyz /= viewPos.w;
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
direction = vec3(direction.z, direction.y, -direction.x);
vec3 finalColor;
if (enableFog) {
// Calculate volume fog influence (same logic as SkyBoxTexture)
float volumeFogInfluence = 0.0;
for (int i = 0; i < 3; i++) {
int offset = i * 4;
float volVisDist = fogVolumeData[offset + 0];
float volMinH = fogVolumeData[offset + 1];
float volMaxH = fogVolumeData[offset + 2];
float volPct = fogVolumeData[offset + 3];
if (volVisDist <= 0.0) continue;
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
float rayInfluence;
if (direction.y >= 0.0) {
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
} else {
rayInfluence = 1.0;
}
volumeFogInfluence += rayInfluence * volPct;
}
}
// Base fog factor from view direction
float baseFogFactor;
if (direction.y <= 0.0) {
baseFogFactor = 1.0;
} else if (direction.y >= horizonFogHeight) {
baseFogFactor = 0.0;
} else {
float t = direction.y / horizonFogHeight;
baseFogFactor = (1.0 - t) * (1.0 - t);
}
// Combine base fog with volume fog influence
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
finalColor = mix(skyColor, fogColor, finalFogFactor);
} else {
finalColor = skyColor;
}
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
}
`,depthWrite:!1,depthTest:!1})]})}function rN(e,t){let{fogDistance:r,visibleDistance:a}=e;return[r,a]}function rT({fogState:e,enabled:t}){let r=(0,tC.useThree)(e=>e.scene),n=(0,tC.useThree)(e=>e.camera),o=(0,a.useRef)(null),i=(0,a.useMemo)(()=>(0,tQ.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,a.useEffect)(()=>{rS||((0,tq.installCustomFogShader)(),rS=!0)},[]),(0,a.useEffect)(()=>{(0,tQ.resetGlobalFogUniforms)();let[t,a]=rN(e,n.position.y),l=new tM.Fog(e.fogColor,t,a);return r.fog=l,o.current=l,(0,tQ.updateGlobalFogUniforms)(n.position.y,i),()=>{r.fog=null,o.current=null,(0,tQ.resetGlobalFogUniforms)()}},[r,n,e,i]),(0,a.useEffect)(()=>{let r=o.current;if(r)if(t){let[t,a]=rN(e,n.position.y);r.near=t,r.far=a}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,tw.useFrame)(()=>{let r=o.current;if(!r)return;let a=n.position.y;if((0,tQ.updateGlobalFogUniforms)(a,i,t),t){let[t,n]=rN(e,a);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}let rk=(0,a.memo)(function({entity:e}){let{skyData:r}=e;r_.debug("Rendering: materialList=%s, useSkyTextures=%s",r.materialList,r.useSkyTextures);let{fogEnabled:n}=(0,b.useSettings)(),o=r.materialList||void 0,i=(0,a.useMemo)(()=>rj(r.skySolidColor),[r.skySolidColor]),l=r.useSkyTextures,s=(0,a.useMemo)(()=>(function(e){let t=e.fogDistance,r=e.visibleDistance>0?e.visibleDistance:1e3,{r:a,g:n,b:o}=e.fogColor,i=new tM.Color().setRGB(a,n,o).convertSRGBToLinear(),l=[];for(let t of e.fogVolumes)t.visibleDistance<=0||t.maxHeight<=t.minHeight||l.push({visibleDistance:t.visibleDistance,minHeight:t.minHeight,maxHeight:t.maxHeight,percentage:1});let s=l.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:t,visibleDistance:r,fogColor:i,fogVolumes:l,fogLine:s,enabled:r>t}})(r),[r]);r_.debug("fogState: fogColor=(%s, %s, %s) visibleDistance=%d fogDistance=%d enabled=%s volumes=%d",r.fogColor.r.toFixed(3),r.fogColor.g.toFixed(3),r.fogColor.b.toFixed(3),r.visibleDistance,r.fogDistance,s.enabled,s.fogVolumes.length);let c=(0,a.useMemo)(()=>rj(r.fogColor),[r.fogColor]),u=i||c,d=s.enabled&&n,m=s.fogColor,f=(0,tC.useThree)(e=>e.scene),h=(0,tC.useThree)(e=>e.gl);(0,a.useEffect)(()=>{if(d){let e=m.clone();f.background=e,h.setClearColor(e)}else if(u){let e=u[0].clone();f.background=e,h.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,h,d,m,u]);let p=i?.[1];return(0,t.jsxs)(t.Fragment,{children:[o&&l&&o.length>0?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(rw,{materialList:o,fogColor:d?m:void 0,fogState:d?s:void 0},o)}):p?(0,t.jsx)(rM,{skyColor:p,fogColor:d?m:void 0,fogState:d?s:void 0}):null,(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(rx,{scene:r})}),s.enabled?(0,t.jsx)(rT,{fogState:s,enabled:n}):null]})});function rF(e){let n,o=(0,r.c)(3),{children:i}=e,{audioEnabled:l}=(0,b.useSettings)();return o[0]!==l||o[1]!==i?(n=l?(0,t.jsx)(a.Suspense,{children:i}):null,o[0]=l,o[1]=i,o[2]=n):n=o[2],n}function rR(e,n){let o=(0,a.lazy)(()=>n().then(t=>({default:t[e]}))),i=a=>{let n,i,l=(0,r.c)(5),{entity:s}=a,c=`${e}:${s.id}`;return l[0]!==s?(n=(0,t.jsx)(o,{entity:s}),l[0]=s,l[1]=n):n=l[1],l[2]!==c||l[3]!==n?(i=(0,t.jsx)(tI.DebugSuspense,{name:c,children:n}),l[2]=c,l[3]=n,l[4]=i):i=l[4],i};return i.displayName=`createLazy(${e})`,i}let rD=rR("PlayerModel",()=>e.A(30814)),rL=rR("ExplosionShape",()=>e.A(44325)),rB=rR("TracerProjectile",()=>e.A(62125)),rI=rR("SpriteProjectile",()=>e.A(62125)),rA=rR("ForceFieldBare",()=>e.A(25147)),rP=rR("AudioEmitter",()=>e.A(61921)),rE=rR("WaterBlock",()=>e.A(18599)),rz=rR("WeaponModel",()=>e.A(44325)),rG={1:"Storm",2:"Inferno"},rU=(0,a.memo)(function(e){let a=(0,r.c)(26),{entity:n}=e;switch(n.renderType){case"Shape":{let e;return a[0]!==n?(e=(0,t.jsx)(rW,{entity:n}),a[0]=n,a[1]=e):e=a[1],e}case"ForceFieldBare":{let e;return a[2]!==n?(e=(0,t.jsx)(rA,{entity:n}),a[2]=n,a[3]=e):e=a[3],e}case"Player":{let e;return a[4]!==n?(e=(0,t.jsx)(rD,{entity:n}),a[4]=n,a[5]=e):e=a[5],e}case"Explosion":{let e;return a[6]!==n?(e=(0,t.jsx)(rL,{entity:n}),a[6]=n,a[7]=e):e=a[7],e}case"Tracer":{let e;return a[8]!==n?(e=(0,t.jsx)(rB,{entity:n}),a[8]=n,a[9]=e):e=a[9],e}case"Sprite":{let e;return a[10]!==n?(e=(0,t.jsx)(rI,{entity:n}),a[10]=n,a[11]=e):e=a[11],e}case"AudioEmitter":{let e;return a[12]!==n?(e=(0,t.jsx)(rF,{children:(0,t.jsx)(rP,{entity:n})}),a[12]=n,a[13]=e):e=a[13],e}case"Camera":{let e;return a[14]!==n?(e=(0,t.jsx)(tE,{entity:n}),a[14]=n,a[15]=e):e=a[15],e}case"WayPoint":{let e;return a[16]!==n?(e=(0,t.jsx)(tz,{entity:n}),a[16]=n,a[17]=e):e=a[17],e}case"TerrainBlock":{let e;return a[18]!==n.terrainData?(e=(0,t.jsx)(t2,{scene:n.terrainData}),a[18]=n.terrainData,a[19]=e):e=a[19],e}case"InteriorInstance":{let e;return a[20]!==n.interiorData?(e=(0,t.jsx)(rs,{scene:n.interiorData}),a[20]=n.interiorData,a[21]=e):e=a[21],e}case"Sky":{let e;return a[22]!==n?(e=(0,t.jsx)(rk,{entity:n}),a[22]=n,a[23]=e):e=a[23],e}case"Sun":case"MissionArea":case"None":default:return null;case"WaterBlock":{let e;return a[24]!==n?(e=(0,t.jsx)(rE,{entity:n}),a[24]=n,a[25]=e):e=a[25],e}}});function rW(e){let n,o,i,l,s,c,u,d=(0,r.c)(24),{entity:m}=e,{animationEnabled:f}=(0,b.useSettings)(),h=(0,a.useRef)(null);if(d[0]!==f||d[1]!==m.rotate?(n=()=>{if(!h.current||!m.rotate||!f)return;let e=performance.now()/1e3;h.current.rotation.y=e/3*Math.PI*2},d[0]=f,d[1]=m.rotate,d[2]=n):n=d[2],(0,tw.useFrame)(n),!m.shapeName)throw Error(`Shape entity missing shapeName: ${m.id}`);let p=m.runtimeObject,g=m.shapeType??"StaticShape",v=m.dataBlock?.toLowerCase()==="flag",x=m.teamId&&m.teamId>0?rG[m.teamId]:null,y=v&&x?`${x} Flag`:null,_="Item"===m.shapeType?"pink":m.threads?"#00ff88":"yellow",S=m.rotate?h:void 0,j=p?void 0:m;return d[3]!==y?(o=y?(0,t.jsx)(tP.FloatingLabel,{opacity:.6,children:y}):null,d[3]=y,d[4]=o):o=d[4],d[5]!==_||d[6]!==j||d[7]!==o?(i=(0,t.jsx)(tL.ShapeRenderer,{loadingColor:_,streamEntity:j,children:o}),d[5]=_,d[6]=j,d[7]=o,d[8]=i):i=d[8],d[9]!==m.barrelShapeName||d[10]!==p?(l=m.barrelShapeName&&(0,t.jsx)(tB.ShapeInfoProvider,{object:p,shapeName:m.barrelShapeName,type:"Turret",children:(0,t.jsx)("group",{position:[0,1.5,0],children:(0,t.jsx)(tL.ShapeRenderer,{})})}),d[9]=m.barrelShapeName,d[10]=p,d[11]=l):l=d[11],d[12]!==m?(s=m.weaponShape&&(0,t.jsx)(tA.ShapeErrorBoundary,{fallback:(0,t.jsx)(tL.ShapePlaceholder,{color:"red",label:m.weaponShape}),children:(0,t.jsx)(tI.DebugSuspense,{name:`Weapon:${m.id}/${m.weaponShape}`,fallback:(0,t.jsx)(tL.ShapePlaceholder,{color:"cyan",label:m.weaponShape}),children:(0,t.jsx)(rz,{entity:m})})}),d[12]=m,d[13]=s):s=d[13],d[14]!==S||d[15]!==i||d[16]!==l||d[17]!==s?(c=(0,t.jsxs)("group",{ref:S,children:[i,l,s]}),d[14]=S,d[15]=i,d[16]=l,d[17]=s,d[18]=c):c=d[18],d[19]!==m.shapeName||d[20]!==g||d[21]!==c||d[22]!==p?(u=(0,t.jsx)(tB.ShapeInfoProvider,{object:p,shapeName:m.shapeName,type:g,children:c}),d[19]=m.shapeName,d[20]=g,d[21]=c,d[22]=p,d[23]=u):u=d[23],u}var rH=e.i(60099),rO=e.i(85557),r$=e.i(29418);let rV=(0,tW.textureToUrl)("gui/hud_alliedtriangle"),rq=(0,tW.textureToUrl)("gui/hud_enemytriangle"),rQ=new tM.Vector3;function rK(e){let n,o,i,l,s,c,u=(0,r.c)(23),{entity:d}=e,m=(0,tL.useStaticShape)(d.shapeName??d.dataBlock),f=(0,tC.useThree)(rJ),h=(0,a.useRef)(null),p=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(null),x=(0,a.useRef)(null),[y,b]=(0,a.useState)(!0),_=(0,a.useRef)(null);u[0]!==m.scene?(n=new tM.Box3().setFromObject(m.scene),u[0]=m.scene,u[1]=n):n=u[1];let S=n.max.y+.1;u[2]!==d.keyframes?(o=d.keyframes??[],u[2]=d.keyframes,u[3]=o):o=u[3];let j=o;u[4]!==j?(i=j.some(rY),u[4]=j,u[5]=i):i=u[5];let C=i;u[6]!==f||u[7]!==d.id||u[8]!==d.iffColor||u[9]!==d.playerName||u[10]!==C||u[11]!==y||u[12]!==j?(l=()=>{let e=h.current;if(!e)return;e.getWorldPosition(rQ);let t=f.position.distanceTo(rQ),r=f.matrixWorld.elements,a=!(-((rQ.x-r[12])*r[8])+-((rQ.y-r[13])*r[9])+-((rQ.z-r[14])*r[10])<0)&&t<150;if(y!==a&&b(a),!a)return;let n=(0,rO.getKeyframeAtTime)(j,tD.streamPlaybackStore.getState().time),o=n?.health??1;if(n?.damageState!=null&&n.damageState>=1){p.current&&(p.current.style.opacity="0"),g.current&&(g.current.style.opacity="0");return}let i=Math.max(0,Math.min(1,1-t/150)).toString();if(p.current&&(p.current.style.opacity=i),g.current&&(g.current.style.opacity=i),_.current){let e=d.playerName??d.id;_.current.textContent!==e&&(_.current.textContent=e)}if(x.current&&d.iffColor){let e=d.iffColor.r>d.iffColor.g?rq:rV;x.current.getAttribute("src")!==e&&(x.current.src=e)}v.current&&C&&(v.current.style.width=`${Math.max(0,Math.min(100,100*o))}%`,v.current.style.background=d.iffColor?`rgb(${d.iffColor.r}, ${d.iffColor.g}, ${d.iffColor.b})`:"")},u[6]=f,u[7]=d.id,u[8]=d.iffColor,u[9]=d.playerName,u[10]=C,u[11]=y,u[12]=j,u[13]=l):l=u[13],(0,tw.useFrame)(l);let w=d.iffColor&&d.iffColor.r>d.iffColor.g?rq:rV;return u[14]!==d.id||u[15]!==d.playerName||u[16]!==C||u[17]!==S||u[18]!==w||u[19]!==y?(s=y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(rH.Html,{position:[0,S,0],center:!0,children:(0,t.jsx)("div",{ref:p,className:r$.default.Top,children:(0,t.jsx)("img",{ref:x,className:r$.default.IffArrow,src:w,alt:""})})}),(0,t.jsx)(rH.Html,{position:[0,-.2,0],center:!0,children:(0,t.jsxs)("div",{ref:g,className:r$.default.Bottom,children:[(0,t.jsx)("div",{ref:_,className:r$.default.Name,children:d.playerName??d.id}),C&&(0,t.jsx)("div",{className:r$.default.HealthBar,children:(0,t.jsx)("div",{ref:v,className:r$.default.HealthFill})})]})})]}),u[14]=d.id,u[15]=d.playerName,u[16]=C,u[17]=S,u[18]=w,u[19]=y,u[20]=s):s=u[20],u[21]!==s?(c=(0,t.jsx)("group",{ref:h,children:s}),u[21]=s,u[22]=c):c=u[22],c}function rY(e){return null!=e.health}function rJ(e){return e.camera}var rZ=e.i(78779);let rX=(0,tW.textureToUrl)("commander/MiniIcons/com_flag_grey"),r0=new tM.Vector3;function r1(e){let n,o,i,l,s,c=(0,r.c)(9),{entity:u}=e,d=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),h=(0,tC.useThree)(r2);c[0]!==h||c[1]!==u.iffColor?(n=()=>{if(m.current&&u.iffColor){let{r:e,g:t,b:r}=u.iffColor;m.current.style.backgroundColor=`rgb(${e},${t},${r})`}if(f.current&&d.current){d.current.getWorldPosition(r0);let e=h.position.distanceTo(r0);f.current.textContent=e.toFixed(1)}},c[0]=h,c[1]=u.iffColor,c[2]=n):n=c[2],(0,tw.useFrame)(n);let p=u.iffColor?`rgb(${u.iffColor.r},${u.iffColor.g},${u.iffColor.b})`:"rgb(200,200,200)";c[3]===Symbol.for("react.memo_cache_sentinel")?(o=[0,1.5,0],c[3]=o):o=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("span",{ref:f,className:rZ.default.Distance}),c[4]=i):i=c[4],c[5]!==p?(l={backgroundColor:p,"--flag-icon-url":`url(${rX})`},c[5]=p,c[6]=l):l=c[6];let g=l;return c[7]!==g?(s=(0,t.jsx)("group",{ref:d,children:(0,t.jsx)(rH.Html,{position:o,center:!0,children:(0,t.jsxs)("div",{className:rZ.default.Root,children:[i,(0,t.jsx)("div",{ref:m,className:rZ.default.Icon,style:g})]})})}),c[7]=g,c[8]=s):s=c[8],s}function r2(e){return e.camera}function r3(){let e,a=(0,r.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("group",{ref:r5,children:(0,t.jsx)(r4,{})}),a[0]=e):e=a[0],e}function r5(e){tD.streamPlaybackStore.setState({root:e})}let r4=(0,a.memo)(function(){let e=(0,eX.useAllGameEntities)(),r=(0,a.useRef)(new Map).current,n=new Set;for(let t of e)n.add(t.id),r.set(t.id,t);for(let e of r.keys())n.has(e)||r.delete(e);return(0,t.jsx)(t.Fragment,{children:[...r.values()].map(e=>(0,t.jsx)(r6,{entity:e},e.id))})}),r6=(0,a.memo)(function(e){let a,n=(0,r.c)(7),{entity:o}=e;if((0,tR.isSceneEntity)(o)){let e,r;return n[0]!==o?(e=(0,t.jsx)(rU,{entity:o}),n[0]=o,n[1]=e):e=n[1],n[2]!==o.id||n[3]!==e?(r=(0,t.jsx)("group",{name:o.id,children:e}),n[2]=o.id,n[3]=e,n[4]=r):r=n[4],r}return"None"===o.renderType?null:(n[5]!==o?(a=(0,t.jsx)(ae,{entity:o}),n[5]=o,n[6]=a):a=n[6],a)});function r8(e){let a,n=(0,r.c)(2),{entity:o}=e,i=(0,tg.useEngineSelector)(r7);return o.id===i?null:(n[0]!==o?(a=(0,t.jsx)(rK,{entity:o}),n[0]=o,n[1]=a):a=n[1],a)}function r7(e){return e.playback.streamSnapshot?.controlPlayerGhostId}function r9({entity:e}){let r=(0,a.useRef)(!1),[n,o]=(0,a.useState)(()=>((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0);return(r.current=n,(0,tw.useFrame)(()=>{let t=((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0;t!==r.current&&(r.current=t,o(t))}),n)?(0,t.jsx)(r1,{entity:e}):null}function ae(e){let a,n,o,i,l,s,c,u,d=(0,r.c)(39),{entity:m}=e,f=m.position,h=m.scale;e:{let e;if(!m.rotation){a=void 0;break e}d[0]!==m.rotation?(e=new tM.Quaternion(...m.rotation),d[0]=m.rotation,d[1]=e):e=d[1],a=e}let p=a,g="Player"===m.renderType;if("Shape"===m.renderType&&!m.shapeName){let e,r,a,n,o,i=m.id;return d[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("sphereGeometry",{args:[.3,6,4]}),d[2]=e):e=d[2],d[3]!==m.className?(r=(0,rO.entityTypeColor)(m.className),d[3]=m.className,d[4]=r):r=d[4],d[5]!==r?(a=(0,t.jsxs)("mesh",{children:[e,(0,t.jsx)("meshBasicMaterial",{color:r,wireframe:!0})]}),d[5]=r,d[6]=a):a=d[6],d[7]!==m?(n=(0,t.jsx)(r9,{entity:m}),d[7]=m,d[8]=n):n=d[8],d[9]!==m.id||d[10]!==f||d[11]!==p||d[12]!==h||d[13]!==a||d[14]!==n?(o=(0,t.jsxs)("group",{name:i,position:f,quaternion:p,scale:h,children:[a,n]}),d[9]=m.id,d[10]=f,d[11]=p,d[12]=h,d[13]=a,d[14]=n,d[15]=o):o=d[15],o}d[16]!==m.className||d[17]!==m.renderType?(n="Explosion"===m.renderType?null:(0,t.jsxs)("mesh",{children:[(0,t.jsx)("sphereGeometry",{args:[.5,8,6]}),(0,t.jsx)("meshBasicMaterial",{color:(0,rO.entityTypeColor)(m.className),wireframe:!0})]}),d[16]=m.className,d[17]=m.renderType,d[18]=n):n=d[18];let v=n;return d[19]!==m?(o=(0,t.jsx)(rU,{entity:m}),d[19]=m,d[20]=o):o=d[20],d[21]!==v||d[22]!==o?(i=(0,t.jsx)(tA.ShapeErrorBoundary,{fallback:v,children:o}),d[21]=v,d[22]=o,d[23]=i):i=d[23],d[24]!==m||d[25]!==g?(l=g&&(0,t.jsx)(r8,{entity:m}),d[24]=m,d[25]=g,d[26]=l):l=d[26],d[27]!==m?(s=(0,t.jsx)(r9,{entity:m}),d[27]=m,d[28]=s):s=d[28],d[29]!==i||d[30]!==l||d[31]!==s?(c=(0,t.jsxs)("group",{name:"model",children:[i,l,s]}),d[29]=i,d[30]=l,d[31]=s,d[32]=c):c=d[32],d[33]!==m.id||d[34]!==f||d[35]!==p||d[36]!==h||d[37]!==c?(u=(0,t.jsx)("group",{name:m.id,position:f,quaternion:p,scale:h,children:c}),d[33]=m.id,d[34]=f,d[35]=p,d[36]=h,d[37]=c,d[38]=u):u=d[38],u}var at=e.i(51475);let ar=(0,w.createLogger)("SceneLighting");function aa(){let e,n,o,i=(0,r.c)(6),l=(0,eX.useSceneSun)();if(i[0]!==l?(e=()=>{l?ar.debug("sunData: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",l.direction.x.toFixed(3),l.direction.y.toFixed(3),l.direction.z.toFixed(3),l.color.r.toFixed(3),l.color.g.toFixed(3),l.color.b.toFixed(3),l.ambient.r.toFixed(3),l.ambient.g.toFixed(3),l.ambient.b.toFixed(3)):ar.debug("No sunData — using fallback ambient #888")},n=[l],i[0]=l,i[1]=e,i[2]=n):(e=i[1],n=i[2]),(0,a.useEffect)(e,n),!l){let e;return i[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("ambientLight",{color:"#888888",intensity:1}),i[3]=e):e=i[3],e}return i[4]!==l?(o=(0,t.jsx)(an,{sunData:l}),i[4]=l,i[5]=o):o=i[5],o}function an(e){let n,o,i,l,s,c,u,d,m,f,h=(0,r.c)(29),{sunData:p}=e;h[0]!==p.direction?(n=(0,tU.torqueToThree)(p.direction),h[0]=p.direction,h[1]=n):n=h[1];let[g,v,x]=n,y=Math.sqrt(g*g+v*v+x*x),b=g/y,_=v/y,S=x/y;h[2]!==b||h[3]!==_||h[4]!==S?(o=new tM.Vector3(b,_,S),h[2]=b,h[3]=_,h[4]=S,h[5]=o):o=h[5];let j=o,C=-(5e3*j.x),w=-(5e3*j.y),M=-(5e3*j.z);h[6]!==C||h[7]!==w||h[8]!==M?(i=new tM.Vector3(C,w,M),h[6]=C,h[7]=w,h[8]=M,h[9]=i):i=h[9];let N=i;h[10]!==p.color.b||h[11]!==p.color.g||h[12]!==p.color.r?(l=new tM.Color(p.color.r,p.color.g,p.color.b),h[10]=p.color.b,h[11]=p.color.g,h[12]=p.color.r,h[13]=l):l=h[13];let T=l;h[14]!==p.ambient.b||h[15]!==p.ambient.g||h[16]!==p.ambient.r?(s=new tM.Color(p.ambient.r,p.ambient.g,p.ambient.b),h[14]=p.ambient.b,h[15]=p.ambient.g,h[16]=p.ambient.r,h[17]=s):s=h[17];let k=s,F=j.y<0;return h[18]!==F?(c=()=>{t$.value=F},u=[F],h[18]=F,h[19]=c,h[20]=u):(c=h[19],u=h[20]),(0,a.useEffect)(c,u),h[21]!==T||h[22]!==N?(d=(0,t.jsx)("directionalLight",{position:N,color:T,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),h[21]=T,h[22]=N,h[23]=d):d=h[23],h[24]!==k?(m=(0,t.jsx)("ambientLight",{color:k,intensity:1}),h[24]=k,h[25]=m):m=h[25],h[26]!==d||h[27]!==m?(f=(0,t.jsxs)(t.Fragment,{children:[d,m]}),h[26]=d,h[27]=m,h[28]=f):f=h[28],f}function ao(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo,delete window.loadDemoRecording}let ai=(0,i.createParser)({parse(e){let[t,r]=e.split("~"),a=r,n=(0,e0.getMissionInfo)(t).missionTypes;return r&&n.includes(r)||(a=n[0]),{missionName:t,missionType:a}},serialize({missionName:e,missionType:t}){let r=(0,e0.getMissionInfo)(e).missionTypes;return t&&1!==r.length?`${e}~${t}`:e},eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});var al=e.i(75056);let as={toneMapping:tM.NoToneMapping,outputColorSpace:tM.SRGBColorSpace};function ac(e){let a,n,o=(0,r.c)(6),{children:i,renderOnDemand:l,dpr:s,onCreated:c}=e,{renderOnDemand:u}=(0,b.useDebug)(),d=void 0!==l&&l||u?"demand":"always";return o[0]===Symbol.for("react.memo_cache_sentinel")?(a={type:tM.PCFShadowMap},o[0]=a):a=o[0],o[1]!==i||o[2]!==s||o[3]!==c||o[4]!==d?(n=(0,t.jsx)(al.Canvas,{frameloop:d,dpr:s,gl:as,shadows:a,onCreated:c,children:i}),o[1]=i,o[2]=s,o[3]=c,o[4]=d,o[5]=n):n=o[5],n}var au=e.i(12631),ad=e.i(66093),am=e.i(205);let af=(0,a.lazy)(()=>e.A(34019).then(e=>({default:e.TouchHandler})));function ah(e){let a,n=(0,r.c)(2),{children:o}=e;return n[0]!==o?(a=(0,t.jsx)(au.KeyboardControls,{map:am.KEYBOARD_CONTROLS,children:(0,t.jsx)(ad.JoystickProvider,{children:o})}),n[0]=o,n[1]=a):a=n[1],a}function ap(){let e,n,o,i=(0,r.c)(5),l=eZ();return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(am.KeyboardAndMouseHandler,{}),i[0]=e):e=i[0],i[1]!==l?(n=l?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(af,{})}):null,i[1]=l,i[2]=n):n=i[2],i[3]!==n?(o=(0,t.jsxs)(t.Fragment,{children:[e,n]}),i[3]=n,i[4]=o):o=i[4],o}let ag=(0,a.lazy)(()=>e.A(553).then(e=>({default:e.TouchJoystick}))),av=(0,a.lazy)(()=>e.A(33487).then(e=>({default:e.KeyboardOverlay})));function ax(){let e,n,o,i=(0,r.c)(7),l=eZ();return i[0]!==l?(e=l?(0,t.jsx)(ag,{}):null,i[0]=l,i[1]=e):e=i[1],i[2]!==l?(n=!1===l?(0,t.jsx)(av,{}):null,i[2]=l,i[3]=n):n=i[3],i[4]!==e||i[5]!==n?(o=(0,t.jsxs)(a.Suspense,{children:[e,n]}),i[4]=e,i[5]=n,i[6]=o):o=i[6],o}var ay=e.i(89271);function ab(e){let a,n,o,i,l,s=(0,r.c)(11),{isLoading:c,progress:u}=e,d=!c;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("div",{className:ay.default.Spinner}),s[0]=a):a=s[0];let m=`${100*u}%`;return s[1]!==m?(n=(0,t.jsx)("div",{className:ay.default.Progress,children:(0,t.jsx)("div",{className:ay.default.ProgressBar,style:{width:m}})}),s[1]=m,s[2]=n):n=s[2],s[3]!==u?(o=Math.round(100*u),s[3]=u,s[4]=o):o=s[4],s[5]!==o?(i=(0,t.jsxs)("div",{className:ay.default.ProgressText,children:[o,"%"]}),s[5]=o,s[6]=i):i=s[6],s[7]!==d||s[8]!==n||s[9]!==i?(l=(0,t.jsxs)("div",{className:ay.default.LoadingIndicator,"data-complete":d,children:[a,n,i]}),s[7]=d,s[8]=n,s[9]=i,s[10]=l):l=s[10],l}function a_(e){let n,o=(0,r.c)(3),{children:i}=e,{debugMode:l}=(0,b.useDebug)();return o[0]!==i||o[1]!==l?(n=l?(0,t.jsx)(a.Suspense,{children:i}):null,o[0]=i,o[1]=l,o[2]=n):n=o[2],n}var aS=e.i(82156);function aj(e,t){return(0,a.lazy)(()=>t().then(t=>({default:t[e]})))}let aC=aj("StreamingController",()=>e.A(25483)),aw=aj("DemoPlaybackControls",()=>e.A(93884)),aM=aj("DebugElements",()=>e.A(88487)),aN=aj("Mission",()=>e.A(21683)),aT=aj("LiveObserver",()=>e.A(96145)),ak=aj("ChatSoundPlayer",()=>e.A(38496)),aF=aj("PlayerHUD",()=>e.A(57567)),aR=aj("MapInfoDialog",()=>e.A(59197)),aD=aj("ServerBrowser",()=>e.A(70012));function aL(){let[e,n]=function(){let e,t=(0,r.c)(3),[a,n]=(0,i.useQueryState)("mission",ai);return t[0]!==a||t[1]!==n?(e=[a,n],t[0]=a,t[1]=n,t[2]=e):e=t[2],e}(),[o,s]=function(){let e,t=(0,r.c)(3),[a,n]=(0,i.useQueryState)("fog",i.parseAsBoolean);return t[0]!==a||t[1]!==n?(e=[a,n],t[0]=a,t[1]=n,t[2]=e):e=t[2],e}(),c=(0,a.useCallback)(()=>{s(null)},[s]),u=(0,a.useContext)(l),{missionName:d,missionType:m}=e,[f,h]=(0,a.useState)(!1),[p,_]=(0,a.useState)(!1),[S,j]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1),[T,k]=(0,a.useState)(0),[F,R]=(0,a.useState)(!0),D=eZ(),L=(0,a.useCallback)(e=>{window.location.hash="",c(),w(!1);let t=M.liveConnectionStore.getState();t.disconnectServer(),t.disconnectRelay(),tg.engineStore.getState().setRecording(null),eX.gameEntityStore.getState().endStreaming(),n(e),D&&j(!1)},[c,n,D]);!function(e){let t,n,o=(0,r.c)(5),{onChangeMission:i}=e,{setRecording:l}=(0,N.usePlaybackActions)(),s=(0,a.useEffectEvent)(i);o[0]!==s||o[1]!==l?(t=()=>(window.setMissionName=e=>{let t=(0,e0.getMissionInfo)(e).missionTypes;s({missionName:e,missionType:t[0]})},window.getMissionList=e0.getMissionList,window.getMissionInfo=e0.getMissionInfo,window.loadDemoRecording=l,ao),o[0]=s,o[1]=l,o[2]=t):t=o[2],o[3]!==l?(n=[l],o[3]=l,o[4]=n):n=o[4],(0,a.useEffect)(t,n)}({onChangeMission:L});let B=(0,N.useRecording)(),I=(0,eX.useDataSource)(),A="demo"===I||"live"===I,P=(0,M.useLiveSelector)(e=>null!=e.adapter),E=(0,eX.useMissionName)(),z=(0,eX.useMissionType)();(0,a.useEffect)(()=>{if(A&&E)try{let e=(0,e0.getMissionInfo)(E),t=z&&e.missionTypes.includes(z)?z:void 0;n({missionName:E,missionType:t})}catch{n(null)}},[A,E,z,n]),(0,a.useEffect)(()=>{B&&w(!1)},[B]);let G=(0,M.useLiveSelector)(e=>e.gameStatus);(0,a.useEffect)(()=>{"connected"===G&&D&&j(!1)},[G,D]),(0,a.useEffect)(()=>{B&&D&&j(!1)},[D,B]);let U=T<1;(0,a.useEffect)(()=>{if(U)R(!0);else{let e=setTimeout(()=>R(!1),500);return()=>clearTimeout(e)}},[U]);let W=(0,a.useCallback)((e,t=0)=>{k(t)},[]),H=(0,a.useRef)(null),O=(0,a.useRef)(null);return(0,t.jsx)("main",{className:aS.default.Frame,children:(0,t.jsx)(N.RecordingProvider,{children:(0,t.jsxs)(b.SettingsProvider,{fogEnabledOverride:o,onClearFogEnabledOverride:c,children:[(0,t.jsxs)("header",{className:aS.default.Toolbar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("button",{type:"button",className:aS.default.ToggleSidebarButton,"data-orientation":"top","aria-label":S?"Close sidebar":"Open sidebar",title:S?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>j(e=>!e))},children:S?(0,t.jsx)(x,{}):(0,t.jsx)(y,{})}),(0,t.jsx)("button",{type:"button",className:aS.default.ToggleSidebarButton,"data-orientation":"left","aria-label":S?"Close sidebar":"Open sidebar",title:S?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>j(e=>!e))},children:S?(0,t.jsx)(g,{}):(0,t.jsx)(v,{})}),(0,t.jsx)(a.Activity,{mode:A&&!C?"visible":"hidden",children:(0,t.jsx)(ty,{})}),(0,t.jsxs)(a.Activity,{mode:!A||C?"visible":"hidden",children:[(0,t.jsx)(tp,{value:C?"":d,missionType:C?"":m,onChange:L,autoFocus:C}),C&&(0,t.jsx)("button",{type:"button",className:aS.default.CancelButton,onClick:()=>{w(!1)},children:"Cancel"})]})]}),S?(0,t.jsx)("div",{className:aS.default.Backdrop}):null,(0,t.jsx)(a.Activity,{mode:S?"visible":"hidden",children:(0,t.jsx)(a.ViewTransition,{children:(0,t.jsx)("div",{className:aS.default.Sidebar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-open":S,children:(0,t.jsx)(e2,{missionName:d,missionType:m,onOpenMapInfo:()=>h(!0),onOpenServerBrowser:u.live?()=>_(!0):void 0,onChooseMap:A?()=>{w(!0)}:void 0,onCancelChoosingMap:()=>{w(!1)},choosingMap:C,cameraRef:H,invalidateRef:O})})})}),(0,t.jsx)(ah,{children:(0,t.jsxs)("div",{className:aS.default.Content,children:[(0,t.jsx)("div",{className:aS.default.ThreeView,children:(0,t.jsx)(ac,{dpr:f||p?.25:void 0,onCreated:e=>{H.current=e.camera,O.current=e.invalidate},children:(0,t.jsx)(at.TickProvider,{children:(0,t.jsxs)(tF.CamerasProvider,{children:[(0,t.jsx)(ap,{}),(0,t.jsxs)(tk.AudioProvider,{children:[(0,t.jsx)(aa,{}),(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(r3,{})}),(0,t.jsx)(tT,{}),(0,t.jsx)(rF,{children:(0,t.jsx)(ak,{})}),(0,t.jsx)(a_,{children:(0,t.jsx)(aM,{})}),B?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aC,{recording:B})}):null,A?null:(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aN,{name:d,missionType:m,onLoadingChange:W},`${d}~${m}`)}),P?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aT,{})}):null]})]})})})}),A?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aF,{})}):null,(0,t.jsx)(ax,{}),F&&(0,t.jsx)(ab,{isLoading:U,progress:T})]})}),(0,t.jsx)("footer",{className:aS.default.PlayerBar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:B?.source==="demo"?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aw,{})}):null}),f?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aR,{onClose:()=>h(!1),missionName:d,missionType:m??""})}):null,p?(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(aD,{onClose:()=>_(!1)})}):null]})})})}let aB=new n.QueryClient;function aI(){let e,n=(0,r.c)(1);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(a.Suspense,{children:(0,t.jsx)(s,{children:(0,t.jsx)(o.QueryClientProvider,{client:aB,children:(0,t.jsx)(aL,{})})})}),n[0]=e):e=n[0],e}e.s(["default",()=>aI],31713)}]);