@seatlayer/core 0.96.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-Q44JP5JY.js +1 -0
- package/dist/be-CGFFSIQL.js +1 -0
- package/dist/bg-WOYK6OLH.js +1 -0
- package/dist/ca-77ZVI3X5.js +1 -0
- package/dist/chunk-2P72QUJR.js +1 -0
- package/dist/chunk-5N4H3KMR.js +1 -0
- package/dist/chunk-ASIIXY5M.js +1 -0
- package/dist/{chunk-O3DGXAIC.js → chunk-CUACREZL.js} +1 -1
- package/dist/{chunk-CEIVHWRB.js → chunk-FLMKHAUT.js} +1 -1
- package/dist/{chunk-TKYTTEJ2.js → chunk-IW7QZIMF.js} +1 -1
- package/dist/chunk-M5VINTGE.js +1 -0
- package/dist/chunk-NGZXKXOY.js +1 -0
- package/dist/{chunk-U7CVRE4P.js → chunk-OLGPAFXW.js} +1 -1
- package/dist/{chunk-M5X6G7FD.js → chunk-P4C24CIZ.js} +1 -1
- package/dist/{chunk-A3ZL3R75.js → chunk-QEPYNCBJ.js} +1 -1
- package/dist/chunk-VAI2VDQR.js +1 -0
- package/dist/{chunk-Q3MSDG4S.js → chunk-YPESNMTC.js} +1 -1
- package/dist/chunk-Z43H6AWN.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +40 -18
- package/dist/core/chart-ops/index.d.ts +40 -18
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.js +1 -1
- package/dist/core/render-assets/index.js +1 -1
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-OSBZYCSR.js +1 -0
- package/dist/cy-ZCOJW2WH.js +1 -0
- package/dist/da-2PDK6JTR.js +1 -0
- package/dist/de-R5LLVFUU.js +1 -0
- package/dist/el-ZPFVDCWA.js +1 -0
- package/dist/es-7YASJP32.js +1 -0
- package/dist/et-J4TV6KQL.js +1 -0
- package/dist/fa-4TEO7UGM.js +1 -0
- package/dist/fi-GIUDDKMH.js +1 -0
- package/dist/fr-J5J2XJLA.js +1 -0
- package/dist/he-OCEHSVUJ.js +1 -0
- package/dist/hi-EK5CTBW5.js +1 -0
- package/dist/hr-SLDTQOYC.js +1 -0
- package/dist/hu-2QNE77NO.js +1 -0
- package/dist/id-LGDAFQJK.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -16
- package/dist/index.d.ts +8 -16
- package/dist/index.js +1 -1
- package/dist/it-DT4Y3IYB.js +1 -0
- package/dist/ja-D5EY2XCQ.js +1 -0
- package/dist/ko-DD2NV45Q.js +1 -0
- package/dist/ku-KZCMVLBE.js +1 -0
- package/dist/localeLoaders-GGAKX22E.js +1 -0
- package/dist/lt-QWGTJ47Y.js +1 -0
- package/dist/lv-LYAIG3VK.js +1 -0
- package/dist/ms-XTF4KNGD.js +1 -0
- package/dist/nl-QEXY6XHS.js +1 -0
- package/dist/no-HCOXN2CN.js +1 -0
- package/dist/pl-BWY53TSD.js +1 -0
- package/dist/pt-2UJUBCPL.js +1 -0
- package/dist/ro-GGXOLTED.js +1 -0
- package/dist/ru-ZTFK3WCU.js +1 -0
- package/dist/sk-KU543Y2U.js +1 -0
- package/dist/sl-FT576R7A.js +1 -0
- package/dist/sr-WE3J46JE.js +1 -0
- package/dist/stage-CKb7aNoH.d.cts +18 -0
- package/dist/stage-CKb7aNoH.d.ts +18 -0
- package/dist/sv-YEAOPSEB.js +1 -0
- package/dist/th-BEBRDHJA.js +1 -0
- package/dist/tr-LOAHUPSH.js +1 -0
- package/dist/uk-2GMICSHN.js +1 -0
- package/dist/vi-TC5B6AUR.js +1 -0
- package/dist/view3d/index.cjs +241 -78
- package/dist/view3d/index.d.cts +146 -78
- package/dist/view3d/index.d.ts +146 -78
- package/dist/view3d/index.js +239 -76
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-TSZWTZQY.js +1 -0
- package/dist/zh-Hant-TLB4FZYM.js +1 -0
- package/package.json +1 -1
- package/dist/ar-3S65PDDG.js +0 -1
- package/dist/be-WJKGEBTI.js +0 -1
- package/dist/bg-TZUF36MP.js +0 -1
- package/dist/ca-WLW64J7W.js +0 -1
- package/dist/chunk-F2EXXZSZ.js +0 -1
- package/dist/chunk-F7TP67LK.js +0 -1
- package/dist/chunk-LAX7F5ML.js +0 -1
- package/dist/chunk-LFJUXTIO.js +0 -1
- package/dist/chunk-M7JA4BGP.js +0 -1
- package/dist/cs-HQXANWJA.js +0 -1
- package/dist/cy-EG5BJOG7.js +0 -1
- package/dist/da-5XEBRUEE.js +0 -1
- package/dist/de-SCVAU32D.js +0 -1
- package/dist/el-KBW7YAF5.js +0 -1
- package/dist/es-IFLC65KX.js +0 -1
- package/dist/et-OXB22VMP.js +0 -1
- package/dist/fa-GFAZXHP6.js +0 -1
- package/dist/fi-AI67VYYH.js +0 -1
- package/dist/fr-V3RG2KYP.js +0 -1
- package/dist/he-J3I6MRUR.js +0 -1
- package/dist/hr-SA4WZ3AG.js +0 -1
- package/dist/hu-TM35NZ4U.js +0 -1
- package/dist/it-E4QYIYC4.js +0 -1
- package/dist/ja-S5M7EINH.js +0 -1
- package/dist/ku-DNZQIUUG.js +0 -1
- package/dist/localeLoaders-JTNNRDK2.js +0 -1
- package/dist/lt-ETQDX2HL.js +0 -1
- package/dist/lv-FYFIWI4F.js +0 -1
- package/dist/nl-XOG5SBZQ.js +0 -1
- package/dist/no-7UGUTFXW.js +0 -1
- package/dist/pl-5HR7DQIK.js +0 -1
- package/dist/pt-L4CCONDZ.js +0 -1
- package/dist/ro-KZVPOCZ6.js +0 -1
- package/dist/ru-CD7HYORB.js +0 -1
- package/dist/sk-AQZOHJYW.js +0 -1
- package/dist/sl-XYRITXI6.js +0 -1
- package/dist/sr-6VTXFVHT.js +0 -1
- package/dist/sv-EJWP7WJV.js +0 -1
- package/dist/tr-VKVADTIZ.js +0 -1
- package/dist/uk-QSJV3LDS.js +0 -1
- package/dist/zh-Hans-2FN4LFAW.js +0 -1
- package/dist/zh-Hant-5T2AB4FR.js +0 -1
package/dist/view3d/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as me,b as $t,c as Zt,d as qe,e as Me,f as gt,g as yt,h as Jt,i as eo,j as _e,k as to,l as xt,m as oo,n as no,o as ro,p as io,q as fe,r as ao,s as so,t as lo,u as co,v as St,w as uo,x as Ve}from"../chunk-LFJUXTIO.js";import"../chunk-U7CVRE4P.js";import"../chunk-QJXSZT3H.js";import"../chunk-M5X6G7FD.js";import"../chunk-F2EXXZSZ.js";import"../chunk-4N5CHKHD.js";import{Sa as jt}from"../chunk-F7TP67LK.js";import"../chunk-5ITK5236.js";import{d as Kt,l as Qt}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";import{Renderer as Hn}from"ogl";function Un(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,o=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,o)}var je=class{constructor(e,o){this.clearRgb=[0,0,0];this.container=e,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Hn({canvas:this.canvas,dpr:Un(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[qe.top[0],qe.top[1],qe.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),o.onContextLost()},this.restoredHandler=()=>o.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),o=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,o),{width:e,height:o}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as Wn,Vec3 as wt}from"ogl";var ie=Math.PI/180,Mt=15*ie,Pt=80*ie,Pe=.12,mo=35,po=1.25,ho=.006,Yn=4,Ce=.82,Le=1/Ce,Xn=.12,qn=2;function jn(t,e){return{azimuth:t*ho,polar:-e*ho}}function Kn(t,e,o){let r=Math.max(qn,Math.max(1,e)*Xn),n=o*Yn;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,n):n}}var Ke=class{constructor(e,o,r,n){this.fovY=mo;this.target=new wt;this.azimuth=-30*ie;this.polar=55*ie;this.distance=10;this.azT=-30*ie;this.polT=55*ie;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new wt;this.panAnchor=new wt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Wn(e,{fov:mo,near:.1,far:5e3,aspect:1}),this.canvas=o,this.requestRender=r,this.onGesture=n,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let s=i.button===2||i.button===1,a=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=s||a,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let s=this.pinchCentroid();this.pinchCx=s.x,this.pinchCy=s.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let d=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-d)*.005)),this.fireGesture()),this.pinchDist=d;let p=this.pinchCentroid();this.panBy(p.x-this.pinchCx,p.y-this.pinchCy),this.pinchCx=p.x,this.pinchCy=p.y;return}let s=i.clientX-this.lastX,a=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&(this.panBy(s,a),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&this.fireGesture();let l=jn(s,a);this.azT+=l.azimuth,this.polT=Math.max(Mt,Math.min(Pt,this.polT+l.polar)),this.requestRender()},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let s=i.deltaMode===1?16:i.deltaMode===2?100:1,a=Math.max(-2,Math.min(2,i.deltaY*s/100));this.dollyBy(Math.exp(a*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let s=7*ie;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-s:s;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Mt,Math.min(Pt,this.polT+(i.key==="ArrowUp"?-s:s)));else if(i.key==="+"||i.key==="=")this.dollyBy(Ce);else if(i.key==="-"||i.key==="_")this.dollyBy(Le);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},o.addEventListener("pointerdown",this.onPointerDown),o.addEventListener("pointermove",this.onPointerMove),o.addEventListener("pointerup",this.onPointerUp),o.addEventListener("pointercancel",this.onPointerUp),o.addEventListener("wheel",this.onWheel,{passive:!1}),o.addEventListener("keydown",this.onKeyDown),o.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let o=0,r=0;for(let n of e)o+=n.x,r+=n.y;return{x:o/e.length,y:r/e.length}}panBy(e,o){let r=this.canvas.clientHeight||1,n=2*this.distance*Math.tan(this.fovY*ie/2)/r,i=Math.sin(this.azimuth),s=Math.cos(this.azimuth),a=s,l=-i,d=Math.cos(this.polar),p=Math.sin(this.polar),h=-i*d,b=-s*d;this.targetT.x+=(-e*a+o*h)*n,this.targetT.z+=(-e*l+o*b)*n,this.targetT.y+=o*p*n,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,o=this.panAnchor.x,r=this.panAnchor.y,n=this.panAnchor.z;this.targetT.x=Math.max(o-e,Math.min(o+e,this.targetT.x)),this.targetT.z=Math.max(n-e,Math.min(n+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,o=!1,r,n=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5;let s=Math.max(1,e.radius),a=this.fovY*ie/2,l=n?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,d=Math.atan(Math.tan(a)*l);this.azT=r??-30*ie,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ie;let p=this.fitDistance(e,a,d,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,i?.margin??po)),this.envelope=Kn(this.envelope,s,p),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,o?(this.azimuth=this.azT,this.polar=12*ie,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){this.camera.perspective({aspect:e})}frameSoft(e,o,r=!1,n){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*ie/2,s=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,a=Math.atan(Math.tan(i)*s);this.azT=o??this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*ie;let l=this.fitDistance(e,i,a,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,n?.margin??po))}fitDistance(e,o,r,n,i){let s=Math.max(1,e.radius),a=Math.max(s/Math.tan(o),s/Math.tan(r)),l=e.box;if(!l)return a;let d=Math.sin(i),p=-d*Math.sin(n),h=-Math.cos(i),b=-d*Math.cos(n);if(Math.abs(h)>.999)return a;let c=-b,u=p,P=Math.hypot(c,u);c/=P,u/=P;let F=-u*h,A=u*p-c*b,k=c*h,f=Math.tan(r),M=Math.tan(o),C=1;for(let O=0;O<8;O++){let x=(O&1?l.max[0]:l.min[0])-e.center[0],w=(O&2?l.max[1]:l.min[1])-e.center[1],D=(O&4?l.max[2]:l.min[2])-e.center[2],L=x*p+w*h+D*b,R=Math.abs(x*c+D*u),K=Math.abs(x*F+w*A+D*k);C=Math.max(C,R/f-L,K/M-L)}return Math.min(a,Math.max(C,s*.35))}updateClipping(e){let o=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],n=this.camera.position.z-e.center[2],i=Math.hypot(o,r,n),s=Math.max(1,e.radius)*1.18,a=Math.max(.05,i-s),l=Math.max(a+10,i+s);this.camera.perspective({near:a,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,o=this.polT-this.polar,r=this.distT-this.distance,n=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,s=this.targetT.z-this.target.z,a=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(o)>1e-4||Math.abs(r)>1e-4||Math.abs(n)>a||Math.abs(i)>a||Math.abs(s)>a;return this.azimuth+=e*Pe,this.polar+=o*Pe,this.distance+=r*Pe,this.target.x+=n*Pe,this.target.y+=i*Pe,this.target.z+=s*Pe,l&&this.applyPosition(),l}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,o=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,n=Math.hypot(e,o,r)||1,i=Math.max(Mt,Math.min(Pt,Math.acos(Math.max(-1,Math.min(1,o/n)))));this.distance=this.distT=n,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),o=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),n=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(o,r,n),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Qe=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let o=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,o>0){let n=1/o;this.fpsEma=this.fpsEma?this.fpsEma*.9+n*.1:n}this.rendered++,this.frame(o)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Ae=2.5,Qn=1.15,ke=6,Ee=10,fo=6,vo=9.5,bo=.9,go=2.2,Ct=30,At=4,$e=8192;var Ti=Ee+At;function yo(t,e){let o=e*1.4,r=e*3.2;if(t<=o)return{scale:1,fade:0,minPixels:Ae};let n=Math.min(1,(t-o)/Math.max(.001,r-o));return{scale:1-n*.4,fade:n*.55,minPixels:Ae+n*(Qn-Ae)}}function xo(t,e,o){return!(t>0)||!(e>0)||!(o>0)?!1:e*o/t>=64}function So(t,e,o,r,n){if(!(t>0)||!(e>0)||!(o>0)||!(r>0)||!(n>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let s=e/(o*i)*(n/2);return Math.PI*s*s/t>=64}var $n=88,Zn=20,wo={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Jn=640,er=.8,tr=11,or="3px 7px",nr="2px 5px",Mo="rgba(10,14,22,.62)",rr="#f4f7fb",Po=5,Co=2,ir=6,Oe=new Set(["row","seat"]),Ao={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ze={row:{x:66,y:20},seat:{x:52,y:22}},Rt=Kt,Et=t=>Qt(t);function Dt(t,e){let o=Et(t),r=Et(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function Ft(t,e){let o=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!o)return e;let r=Math.max(0,Math.min(1,Number(o[4])));return[1,2,3].map(n=>Number(o[n])/255*r+e[n-1]*(1-r))}function ar(t,e=[.04,.06,.1],o=!0){let r=Et(e)<.42,n=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",s=o?Ft(i,e):e,a=Rt(t),l=o?7:4.5,d=a&&Dt(a,s)>=l?t:n;return r?{ink:d,backing:i,border:"rgba(210,222,245,.24)"}:{ink:d,backing:i,border:"rgba(11,18,32,.22)"}}function sr(t,e=[.04,.06,.1]){let o=Ft(Mo,e),r=Rt(t);return{ink:r&&Dt(r,o)>=4.5?t:rr,backing:Mo}}var lr='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Je=class{constructor(e,o={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=o,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=o.fontFamily||lr,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[o,r]of this.nodes)e.some(n=>n.id===o)||(r.remove(),this.nodes.delete(o))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,o=>`seat:${o}`))}sizeFor(e){let o=wo[e].size;return!this.narrowStage||Oe.has(e)?o:Math.max(tr,o*er)}qualityEvidence(){let e=this.root.getBoundingClientRect(),o=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let n=this.nodes.get(r.id),i=n?.getBoundingClientRect(),s=!!(o&&n&&n.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:s,renderedFontPx:n&&Number.parseFloat(n.style.fontSize)||0,contrast:n?Number(n.dataset.qualityContrast??0):0,...s&&i?{screenBox:{x:i.x-e.x,y:i.y-e.y,width:i.width,height:i.height}}:{}}})}update(e,o,r,n,i,s){if(!this.labels.length)return;this.narrowStage=o>0&&o<Jn;let a=ro(n,i,{hasZoneLabels:this.labels.some(f=>f.kind==="zone")});this.forcedDense&&(a.add("row"),a.add("seat"));let l=[];for(let f of this.labels){if(!a.has(f.kind))continue;let M=fe(e,f.anchor,o,r);if(!M.visible)continue;let C=Oe.has(f.kind),O=this.sizeFor(f.kind),x=so(f.text,O,!C)+(C?Po*2:0),w=io(M,x/2,O/2+(C?Co:4),o,r),D=s?Math.hypot(f.anchor[0]-s[0],f.anchor[1]-s[1],f.anchor[2]-s[2]):1;l.push({label:f,screen:w,focus:co(w,D,o,r),halfWidth:x/2,...this.selectedSeatLabelIds.has(f.id)?{priority:1}:{}})}let d=no(l.filter(f=>f.label.kind==="floor"),o),p=[...l.filter(f=>!Oe.has(f.label.kind)&&f.label.kind!=="floor"),...d],h=ao(p,$n,Zn),b=lo(o),c=St(l.filter(f=>f.label.kind==="row"),Ze.row.x,Ze.row.y,b.row,h),u=St(l.filter(f=>f.label.kind==="seat"),Ze.seat.x,Ze.seat.y,b.seat,[...h,...c]),P=[...h,...c,...u],F=new Set(P.map(f=>f.label.id));for(let{label:f,screen:M}of P){let O=this.nodeFor(f).style;O.display="",O.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let A=P.filter(({label:f})=>!Oe.has(f.kind)).sort((f,M)=>Ao[M.label.kind]-Ao[f.label.kind]||f.screen.depth-M.screen.depth||f.focus-M.focus),k=[];for(let{label:f}of A){let M=this.nodes.get(f.id);if(!M||M.style.display==="none")continue;let C=M.getBoundingClientRect();k.some(x=>C.left<x.right+3&&C.right+3>x.left&&C.top<x.bottom+3&&C.bottom+3>x.top)?M.style.display="none":k.push(C)}for(let[f,M]of this.nodes)F.has(f)||(M.style.display="none")}nodeFor(e){let o=this.nodes.get(e.id);if(!o){o=document.createElement("div");let u=o.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(o),this.nodes.set(e.id,o)}o.textContent=e.text,o.setAttribute("data-label-kind",e.kind);let r=this.selectedSeatLabelIds.has(e.id);o.toggleAttribute("data-selected-seat",r);let n=wo[e.kind],i=o.style;i.fontSize=`${this.sizeFor(e.kind)}px`,i.fontWeight=r?"800":n.weight,i.opacity=r?"1":String(n.opacity);let s=Oe.has(e.kind),a=!s,l=ar(e.color??this.opts.ink,this.opts.backgroundRgb,!0),d=s?sr(e.color??this.opts.ink,this.opts.backgroundRgb):l;i.color=r?"#ecf8ff":d.ink,i.background=r?"rgba(10,28,45,.9)":d.backing,i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${l.border}`:"",i.borderRadius=r||a?"999px":`${ir}px`;let p=this.narrowStage?nr:or;i.padding=r||a?p:`${Co}px ${Po}px`,i.lineHeight=s?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],b=Rt(r?"#ecf8ff":d.ink)??[1,1,1],c=Ft(r?"rgba(10,28,45,.9)":d.backing,h);return o.dataset.qualityContrast=Dt(b,c).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),o}dispose(){this.root.remove(),this.nodes.clear()}};var cr=1;var ur=new Set(["floor","zone","section","ga","booth","annotation"]);function dr(t){return t.every(e=>Number.isFinite(e))}function mr(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Eo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function xe(t){return Math.round(t*1e4)/1e4}function pr(t){if(t)return{box:{x:xe(t.box.x),y:xe(t.box.y),width:xe(t.box.width),height:xe(t.box.height)},horizontalFillRatio:xe(t.horizontalFillRatio),verticalFillRatio:xe(t.verticalFillRatio),visibleAreaRatio:xe(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function de(t,e,o){return o.length?{code:t,message:e,count:o.length,samples:o.slice(0,20)}:null}function Tt(t){let e=t.labels.filter(a=>a.visible&&a.screenBox),o=e.filter(a=>ur.has(a.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,n=[];for(let a=0;a<o.length;a+=1)for(let l=0;l<a;l+=1)mr(o[a].screenBox,o[l].screenBox)&&n.push({primaryId:o[a].id,primaryLabel:o[a].text,secondaryId:o[l].id});let i=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],s=[de("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),de("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),de("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),de("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),de("camera-invalid","The capture camera must have a finite physical pose",dr(i)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),de("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),de("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||o.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),de("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",o.filter(a=>a.renderedFontPx<11).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.renderedFontPx,minimum:11}))),de("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",o.filter(a=>a.contrast<4.5).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.contrast,minimum:4.5}))),de("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",n)].filter(a=>!!a);return{version:1,state:"venue3d",passed:s.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:a,kind:l,text:d})=>({id:a,kind:l,text:d})).sort((a,l)=>a.kind.localeCompare(l.kind)||a.id.localeCompare(l.id)),framing:pr(t.framing)},metrics:{minimumHierarchyFontPx:Eo(o.map(a=>a.renderedFontPx)),minimumHierarchyContrast:Eo(o.map(a=>a.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as ze,Mesh as Ne,Program as Tr,Texture as Ir,Transform as No}from"ogl";import{Program as Se}from"ogl";var et=`
|
|
1
|
+
import{A as Mn,B as Cn,C as He,D as Ft,E as An,F as Pn,a as Be,b as Ae,c as nt,d as Pt,e as cn,f as un,g as be,h as dn,i as mn,j as ot,k as Re,l as Ge,m as hn,n as Et,o as hr,p as pn,q as fn,r as vn,s as bn,t as xe,u as gn,v as yn,w as xn,x as Sn,y as wn,z as rt}from"../chunk-NGZXKXOY.js";import"../chunk-2P72QUJR.js";import"../chunk-OLGPAFXW.js";import"../chunk-QJXSZT3H.js";import"../chunk-ASIIXY5M.js";import"../chunk-M5VINTGE.js";import"../chunk-P4C24CIZ.js";import"../chunk-IW7QZIMF.js";import"../chunk-Z43H6AWN.js";import"../chunk-4N5CHKHD.js";import"../chunk-TQN2VWQO.js";import"../chunk-5BMXWOE7.js";import"../chunk-FLMKHAUT.js";import{Va as an}from"../chunk-VAI2VDQR.js";import"../chunk-5ITK5236.js";import{d as sn,l as ln}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function En(t,e,n){let r=Math.floor(e.length/3),a=n.center[0],o=n.center[2];if(r>0){let l=Math.max(1,Math.floor(r/4e3)),u=0,p=0,h=0;for(let v=0;v<r;v+=l)u+=e[v*3],p+=e[v*3+2],h++;a=u/h,o=p/h}let i=t[0]-a,s=t[2]-o;return Math.hypot(i,s)>n.radius*.12?Math.atan2(i,s):void 0}var Rt=78,Fn=18;function Rn(){let t=[],e=[],n=[],r=[],a=[],o=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,Ae,-1],max:[1,nt,-.72]}])for(let l of o){let u=t.length/3,p=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-Pt)/(nt-Ae):0),h=Math.hypot(l.n[0],p,l.n[2]),v=[l.n[0]/h,p/h,l.n[2]/h];for(let[f,c]of l.c.entries()){let b=c.map((E,P)=>s.min[P]+E*(s.max[P]-s.min[P]));s.part===2&&(b[0]*=1-c[1]*(1-Pt)),t.push(...b),e.push(...v),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}a.push(u,u+1,u+2,u,u+2,u+3)}let i=t.length/3;for(let[s,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])t.push(s,l,0),e.push(0,1,0),n.push(0),r.push(s,l);return a.push(i,i+1,i+2,i,i+2,i+3),a.push(...a.slice(12,18),...a.slice(60,66),...a.slice(72,78)),{position:new Float32Array(t),normal:new Float32Array(e),surface:new Float32Array(n),uv:new Float32Array(r),index:new Uint16Array(a)}}import{Renderer as pr}from"ogl";function fr(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,n=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,n)}var at=class{constructor(e,n){this.clearRgb=[0,0,0];this.container=e,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new pr({canvas:this.canvas,dpr:fr(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[ot.top[0],ot.top[1],ot.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as vr,Vec3 as Dt}from"ogl";var de=Math.PI/180,Tt=15*de,It=80*de,De=.12,Dn=35,Tn=1.25,In=.006,br=4,Te=.82,We=1/Te,gr=.12,yr=2;function xr(t,e){return{azimuth:t*In,polar:-e*In}}function Sr(t,e,n){let r=Math.max(yr,Math.max(1,e)*gr),a=n*br;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,a):a}}var wr=1.5;function Mr(t,e,n){let r=Math.max(1,n)*wr;if(!t)return{anchor:[e[0],e[1],e[2]],limit:r};let[a,o,i]=t.anchor,s=e[1]-o,l=Math.max(Math.abs(e[0]-a),Math.abs(e[2]-i),s>=0?s:-s*2);return{anchor:t.anchor,limit:Math.max(t.limit,l+r)}}var it=class{constructor(e,n,r,a){this.fovY=Dn;this.target=new Dt;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new Dt;this.panAnchor=new Dt;this.panLimit=0;this.panBox=null;this.primaryDragMode="orbit";this.camera=new vr(e,{fov:Dn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=a,this.onPointerDown=o=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(o.pointerId)}catch{}if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size===1){let i=o.button===2||o.button===1,s=o.button===0&&(o.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=i||s,this.dragging=!this.panning,this.lastX=o.clientX,this.lastY=o.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let i=this.pinchCentroid();this.pinchCx=i.x,this.pinchCy=i.y}}},this.onPointerMove=o=>{if(!this.interactionEnabled||!this.activePointers.has(o.pointerId))return;if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let p=this.pinchCentroid();this.panBy(p.x-this.pinchCx,p.y-this.pinchCy),this.pinchCx=p.x,this.pinchCy=p.y;return}let i=o.clientX-this.lastX,s=o.clientY-this.lastY;if(this.panning){this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&(this.panBy(i,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&this.fireGesture();let l=xr(i,s);this.azT+=l.azimuth,this.polT=Math.max(Tt,Math.min(It,this.polT+l.polar)),this.requestRender()},this.onPointerUp=o=>{this.activePointers.delete(o.pointerId);try{this.canvas.releasePointerCapture?.(o.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=o=>{o.preventDefault()},this.onWheel=o=>{if(o.preventDefault(),!this.interactionEnabled)return;let i=o.deltaMode===1?16:o.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,o.deltaY*i/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=o=>{if(!this.interactionEnabled)return;let i=7*de;if(o.shiftKey&&(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown"))this.panBy(o.key==="ArrowLeft"?-32:o.key==="ArrowRight"?32:0,o.key==="ArrowUp"?-32:o.key==="ArrowDown"?32:0);else if(o.key==="ArrowLeft"||o.key==="ArrowRight")this.azT+=o.key==="ArrowLeft"?-i:i;else if(o.key==="ArrowUp"||o.key==="ArrowDown")this.polT=Math.max(Tt,Math.min(It,this.polT+(o.key==="ArrowUp"?-i:i)));else if(o.key==="+"||o.key==="=")this.dollyBy(Te);else if(o.key==="-"||o.key==="_")this.dollyBy(We);else return;o.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,r=0;for(let a of e)n+=a.x,r+=a.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,a=2*this.distance*Math.tan(this.fovY*de/2)/r,o=Math.sin(this.azimuth),i=Math.cos(this.azimuth),s=i,l=-o,u=Math.cos(this.polar),p=Math.sin(this.polar),h=-o*u,v=-i*u;this.targetT.x+=(-e*s+n*h)*a,this.targetT.z+=(-e*l+n*v)*a,this.targetT.y+=n*p*a,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=Mr(this.panBox,e.center,e.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,a=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(a-e,Math.min(a+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,a=!1,o){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e);let i=Math.max(1,e.radius),s=this.fovY*de/2,l=a?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*l);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let p=this.fitDistance(e,s,u,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,o?.margin??Tn)),this.envelope=Sr(this.envelope,i,p),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){if(!(e>0)||!Number.isFinite(e))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let r=Math.min(n,1)/Math.min(e,1);this.distance*=r,this.distT*=r,this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:e})}frameSoft(e,n,r=!1,a){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let o=this.fovY*de/2,i=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(o)*i);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,a?.polarDeg??55))*de;let l=this.fitDistance(e,o,s,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,a?.margin??Tn))}fitDistance(e,n,r,a,o){let i=Math.max(1,e.radius),s=Math.max(i/Math.tan(n),i/Math.tan(r)),l=e.box;if(!l)return s;let u=Math.sin(o),p=-u*Math.sin(a),h=-Math.cos(o),v=-u*Math.cos(a);if(Math.abs(h)>.999)return s;let f=-v,c=p,b=Math.hypot(f,c);f/=b,c/=b;let E=-c*h,P=c*p-f*v,L=f*h,C=Math.tan(r),F=Math.tan(n),g=1;for(let A=0;A<8;A++){let S=(A&1?l.max[0]:l.min[0])-e.center[0],w=(A&2?l.max[1]:l.min[1])-e.center[1],R=(A&4?l.max[2]:l.min[2])-e.center[2],T=S*p+w*h+R*v,I=Math.abs(S*f+R*c),Y=Math.abs(S*E+w*P+R*L);g=Math.max(g,I/C-T,Y/F-T)}return Math.min(s,Math.max(g,i*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],a=this.camera.position.z-e.center[2],o=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),i=this.interactionEnabled&&Math.abs(o-this.distance)<=this.distance*.01,{near:s,far:l}=Pr(Math.hypot(n,r,a),e.radius,i?this.distance:null);this.camera.perspective({near:s,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,a=this.targetT.x-this.target.x,o=this.targetT.y-this.target.y,i=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(a)>s||Math.abs(o)>s||Math.abs(i)>s;return this.azimuth+=e*De,this.polar+=n*De,this.distance+=r*De,this.target.x+=a*De,this.target.y+=o*De,this.target.z+=i*De,l&&this.applyPosition(),l}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,a=Math.hypot(e,n,r)||1,o=Math.max(Tt,Math.min(It,Math.acos(Math.max(-1,Math.min(1,n/a)))));this.distance=this.distT=a,this.polar=this.polT=o,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),a=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,a),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}},Cr=.1,Ar=.25;function Pr(t,e,n){let r=Math.max(1,e)*1.18,a=n==null?Ar:Math.max(.05,n*Cr),o=Math.max(a,t-r),i=Math.max(o+10,t+r);return{near:o,far:i}}var st=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let a=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+a*.1:a}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Ie=2.5,Er=1.15,Ue=12,_e=22,_n=6,Vn=9.5,Ln=.9,kn=2.2,_t=30,Vt=4,lt=8192;var pi=_e+Vt;function On(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Ie};let a=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-a*.4,fade:a*.55,minPixels:Ie+a*(Er-Ie)}}function zn(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function Nn(t,e,n,r,a){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(a>0))return!1;let o=Math.tan(r/2*Math.PI/180);if(!(o>0))return!1;let i=e/(n*o)*(a/2);return Math.PI*i*i/t>=64}var Bn=88,Gn=20,Hn={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Fr=640,Rr=.8,Dr=11,Tr="3px 7px",Ir="2px 5px",Wn="rgba(10,14,22,.62)",_r="#f4f7fb",Un=5,Yn=2,Vr=6,Ye=new Set(["row","seat"]),Xn={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ve={row:{x:66,y:20},seat:{x:52,y:22}},kt=sn,Lt=t=>ln(t);function Ot(t,e){let n=Lt(t),r=Lt(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function zt(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(a=>Number(n[a])/255*r+e[a-1]*(1-r))}function Lr(t,e=[.04,.06,.1],n=!0){let r=Lt(e)<.42,a=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",i=n?zt(o,e):e,s=kt(t),l=n?7:4.5,u=s&&Ot(s,i)>=l?t:a;return r?{ink:u,backing:o,border:"rgba(210,222,245,.24)"}:{ink:u,backing:o,border:"rgba(11,18,32,.22)"}}function kr(t,e=[.04,.06,.1]){let n=zt(Wn,e),r=kt(t);return{ink:r&&Ot(r,n)>=4.5?t:_r,backing:Wn}}var Or='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',ct=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Or,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;let n=new Set(e.map(r=>r.id));for(let[r,a]of this.nodes)n.has(r)||(a.remove(),this.nodes.delete(r))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=Hn[e].size;return!this.narrowStage||Ye.has(e)?n:Math.max(Dr,n*Rr)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let a=this.nodes.get(r.id),o=a?.getBoundingClientRect(),i=!!(n&&a&&a.style.display!=="none"&&o&&o.width>0&&o.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:i,renderedFontPx:a&&Number.parseFloat(a.style.fontSize)||0,contrast:a?Number(a.dataset.qualityContrast??0):0,...i&&o?{screenBox:{x:o.x-e.x,y:o.y-e.y,width:o.width,height:o.height}}:{}}})}update(e,n,r,a,o,i){if(!this.labels.length)return;this.narrowStage=n>0&&n<Fr;let s=vn(a,o,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let l=[];for(let g of this.labels){if(!s.has(g.kind)&&!(g.kind==="seat"&&this.selectedSeatLabelIds.has(g.id)))continue;let A=xe(e,g.anchor,n,r);if(!A.visible)continue;let S=Ye.has(g.kind),w=this.sizeFor(g.kind),R=xn(g.text,w,!S)+(S?Un*2:0);if(g.kind==="seat"&&g.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(g.id)&&Mn(e,g.anchor,g.seatWidthM,n)<Math.max(22,R))continue;let T=bn(A,R/2,w/2+(S?Yn:4),n,r),I=i?Math.hypot(g.anchor[0]-i[0],g.anchor[1]-i[1],g.anchor[2]-i[2]):1;l.push({label:g,screen:T,focus:wn(T,I,n,r),halfWidth:R/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=fn(l.filter(g=>g.label.kind==="floor"),n),p=[...l.filter(g=>!Ye.has(g.label.kind)&&g.label.kind!=="floor"),...u],h=Sn(n),v=rt(l.filter(g=>g.label.kind==="seat"&&this.selectedSeatLabelIds.has(g.label.id)),Ve.seat.x,Ve.seat.y,h.seat),f=gn(p,Bn,Gn).filter(g=>!v.some(A=>yn(g,A,Bn,Gn))),c=rt(l.filter(g=>g.label.kind==="row"),Ve.row.x,Ve.row.y,h.row,[...f,...v]),b=rt(l.filter(g=>g.label.kind==="seat"&&!this.selectedSeatLabelIds.has(g.label.id)),Ve.seat.x,Ve.seat.y,h.seat-v.length,[...f,...v,...c]),E=[...f,...c,...v,...b],P=new Set(E.map(g=>g.label.id));for(let{label:g,screen:A}of E){let w=this.nodeFor(g).style;w.display="",w.transform=`translate(-50%, -50%) translate(${A.x.toFixed(1)}px, ${A.y.toFixed(1)}px)`}let C=E.filter(({label:g})=>!Ye.has(g.kind)).sort((g,A)=>Xn[A.label.kind]-Xn[g.label.kind]||g.screen.depth-A.screen.depth||g.focus-A.focus).flatMap(({label:g})=>{let A=this.nodes.get(g.id);return A&&A.style.display!=="none"?[{node:A,box:A.getBoundingClientRect()}]:[]}),F=[];for(let{node:g,box:A}of C)F.some(w=>A.left<w.right+3&&A.right+3>w.left&&A.top<w.bottom+3&&A.bottom+3>w.top)?g.style.display="none":F.push(A);for(let[g,A]of this.nodes)P.has(g)||(A.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let b=n.style;b.position="absolute",b.left="0",b.top="0",b.whiteSpace="nowrap",b.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",b.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let r=this.selectedSeatLabelIds.has(e.id),a=this.nodeAppearance.get(n);if(a&&a.text===e.text&&a.kind===e.kind&&a.color===e.color&&a.selected===r&&a.narrow===this.narrowStage)return n;this.nodeAppearance.set(n,{text:e.text,kind:e.kind,color:e.color,selected:r,narrow:this.narrowStage}),n.textContent=e.text,n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let o=Hn[e.kind],i=n.style;i.fontSize=`${this.sizeFor(e.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let s=Ye.has(e.kind),l=!s,u=Lr(e.color??this.opts.ink,this.opts.backgroundRgb,!0),p=s?kr(e.color??this.opts.ink,this.opts.backgroundRgb):u;i.color=r?"#ecf8ff":p.ink,i.background=r?"rgba(10,28,45,.9)":p.backing,i.border=r?"1px solid rgba(89,199,255,.92)":l?`1px solid ${u.border}`:"",i.borderRadius=r||l?"999px":`${Vr}px`;let h=this.narrowStage?Ir:Tr;i.padding=r||l?h:`${Yn}px ${Un}px`,i.lineHeight=s?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":l?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let v=this.opts.backgroundRgb??[.04,.06,.1],f=kt(r?"#ecf8ff":p.ink)??[1,1,1],c=zt(r?"rgba(10,28,45,.9)":p.backing,v);return n.dataset.qualityContrast=Ot(f,c).toFixed(3),i.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",n}dispose(){this.root.remove(),this.nodes.clear()}};var zr=1;var Nr=new Set(["floor","zone","section","ga","booth","annotation"]);function Br(t){return t.every(e=>Number.isFinite(e))}function Gr(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function qn(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function Pe(t){return Math.round(t*1e4)/1e4}function Hr(t){if(t)return{box:{x:Pe(t.box.x),y:Pe(t.box.y),width:Pe(t.box.width),height:Pe(t.box.height)},horizontalFillRatio:Pe(t.horizontalFillRatio),verticalFillRatio:Pe(t.verticalFillRatio),visibleAreaRatio:Pe(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function fe(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Nt(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>Nr.has(s.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,a=[];for(let s=0;s<n.length;s+=1)for(let l=0;l<s;l+=1)Gr(n[s].screenBox,n[l].screenBox)&&a.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let o=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],i=[fe("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),fe("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),fe("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),fe("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),fe("camera-invalid","The capture camera must have a finite physical pose",Br(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),fe("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),fe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),fe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),fe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),fe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",a)].filter(s=>!!s);return{version:1,state:"venue3d",passed:i.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:l,text:u})=>({id:s,kind:l,text:u})).sort((s,l)=>s.kind.localeCompare(l.kind)||s.id.localeCompare(l.id)),framing:Hr(t.framing)},metrics:{minimumHierarchyFontPx:qn(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:qn(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:i}}function jn(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as Xe,Mesh as qe,Program as ma,Texture as ha,Transform as lo}from"ogl";import{Program as Ee}from"ogl";var ut=`
|
|
2
2
|
float chairWeight(float depth) {
|
|
3
3
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
4
|
-
}`,
|
|
4
|
+
}`,Kn=`
|
|
5
5
|
float occupantWeight(float depth) {
|
|
6
|
-
float nearWeight = smoothstep(${
|
|
7
|
-
float farWeight = 1.0 - smoothstep(${
|
|
6
|
+
float nearWeight = smoothstep(${Ln.toFixed(1)}, ${kn.toFixed(1)}, depth);
|
|
7
|
+
float farWeight = 1.0 - smoothstep(${_n.toFixed(1)}, ${Vn.toFixed(1)}, depth);
|
|
8
8
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
9
|
+
}`,Bt=`
|
|
10
10
|
float glyphEq(float glyph, float expected) {
|
|
11
11
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
12
12
|
}
|
|
@@ -55,7 +55,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
|
|
|
55
55
|
p.y += 0.16;
|
|
56
56
|
}
|
|
57
57
|
return p;
|
|
58
|
-
}`,
|
|
58
|
+
}`,Wr=`#version 300 es
|
|
59
59
|
precision highp float;
|
|
60
60
|
in vec3 position;
|
|
61
61
|
in vec3 normal;
|
|
@@ -93,7 +93,7 @@ void main() {
|
|
|
93
93
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
94
94
|
vColor = color;
|
|
95
95
|
gl_Position = projectionMatrix * mv;
|
|
96
|
-
}`,
|
|
96
|
+
}`,Ur=`#version 300 es
|
|
97
97
|
precision highp float;
|
|
98
98
|
in vec3 vColor;
|
|
99
99
|
in vec3 vNormalWorld;
|
|
@@ -105,7 +105,48 @@ in float vMaterial;
|
|
|
105
105
|
uniform vec3 uKeyDir; // WORLD space, unit, points at the light
|
|
106
106
|
uniform float uStructureDetail;
|
|
107
107
|
uniform float uRoughness;
|
|
108
|
+
uniform vec3 uDeckColor;
|
|
109
|
+
uniform float uSectionFilter;
|
|
110
|
+
uniform float uFocusFloor;
|
|
111
|
+
uniform sampler2D tVenueShadow;
|
|
112
|
+
uniform mat4 uShadowMatrix;
|
|
108
113
|
out vec4 fragColor;
|
|
114
|
+
// Stable world-space variation; no textures or per-frame random grain.
|
|
115
|
+
float turfHash(vec2 p) {
|
|
116
|
+
vec3 q = fract(vec3(p.xyx) * 0.1031);
|
|
117
|
+
q += dot(q, q.yzx + 33.33);
|
|
118
|
+
return fract((q.x + q.y) * q.z);
|
|
119
|
+
}
|
|
120
|
+
float turfNoise(vec2 p) {
|
|
121
|
+
vec2 cell = floor(p), f = fract(p);
|
|
122
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
123
|
+
return mix(mix(turfHash(cell), turfHash(cell + vec2(1.0, 0.0)), f.x),
|
|
124
|
+
mix(turfHash(cell + vec2(0.0, 1.0)), turfHash(cell + vec2(1.0)), f.x), f.y);
|
|
125
|
+
}
|
|
126
|
+
float architecturalLight(vec3 normal) {
|
|
127
|
+
// Whole-venue static bake only: hidden floors must never leave ghost shadows.
|
|
128
|
+
if (uFocusFloor >= -0.5) return 1.0;
|
|
129
|
+
vec4 clip = uShadowMatrix * vec4(vPosWorld, 1.0);
|
|
130
|
+
vec3 p = clip.xyz / clip.w * 0.5 + 0.5;
|
|
131
|
+
if (any(lessThan(p, vec3(0.0))) || any(greaterThan(p, vec3(1.0)))) return 1.0;
|
|
132
|
+
float bias = max(0.001, 0.003 * (1.0 - max(dot(normal, uKeyDir), 0.0)));
|
|
133
|
+
// Interpolate depth comparisons, not depth values. Fixed nearest samples
|
|
134
|
+
// produced four visible shade bands as an edge crossed a shadow texel.
|
|
135
|
+
// A small tent filter softens those edges with continuous coverage.
|
|
136
|
+
// Sixteen depth reads; no extra shadow render pass or larger texture.
|
|
137
|
+
vec2 size = vec2(textureSize(tVenueShadow, 0));
|
|
138
|
+
vec2 texel = p.xy * size - 0.5;
|
|
139
|
+
vec2 cell = floor(texel);
|
|
140
|
+
vec2 fraction = fract(texel);
|
|
141
|
+
float lit = 0.0;
|
|
142
|
+
for (int x = -1; x < 3; x++) for (int y = -1; y < 3; y++) {
|
|
143
|
+
vec2 corner = vec2(float(x), float(y));
|
|
144
|
+
vec2 weight = max(vec2(0.0), vec2(2.0) - abs(corner - fraction));
|
|
145
|
+
float depth = texture(tVenueShadow, (cell + corner + 0.5) / size).r;
|
|
146
|
+
lit += step(p.z - bias, depth) * weight.x * weight.y;
|
|
147
|
+
}
|
|
148
|
+
return mix(0.65, 1.0, lit / 16.0);
|
|
149
|
+
}
|
|
109
150
|
void main() {
|
|
110
151
|
if (vDim > 0.5) discard;
|
|
111
152
|
// Row treads (material 3) and risers (material 2) are chart truth: the
|
|
@@ -125,22 +166,48 @@ void main() {
|
|
|
125
166
|
// Risers are baked at 0.72 of their tread (see tiers.ts bandColors); lift
|
|
126
167
|
// them back to the tread colour as detail fades out.
|
|
127
168
|
vec3 vColorRung = vColor * mix(mix(1.0 / 0.72, 1.0, uStructureDetail), 1.0, 1.0 - riser);
|
|
128
|
-
|
|
169
|
+
// Concrete remains visible at overview instead of painting the entire
|
|
170
|
+
// seating deck like upholstery. Keep a category tint for navigation;
|
|
171
|
+
// filtering retains its existing shell color cues.
|
|
172
|
+
float tread = 1.0 - step(0.5, abs(vMaterial - 3.0));
|
|
173
|
+
float concreteWeight = max(tread, riser) * mix(0.38, 1.0, uStructureDetail) * (1.0 - uSectionFilter);
|
|
174
|
+
vec3 concrete = uDeckColor * mix(1.0, 0.72, riser * uStructureDetail);
|
|
175
|
+
vColorRung = mix(vColorRung, concrete, concreteWeight * 0.82);
|
|
176
|
+
if (abs(vMaterial - 4.5) < 1.0) {
|
|
177
|
+
// Turf and generated concrete share the same two noise evaluations. Fine
|
|
178
|
+
// fibres/aggregate fade as they become sub-pixel, avoiding distant grain.
|
|
179
|
+
float concreteSurface = step(4.5, vMaterial);
|
|
180
|
+
vec2 surface = vPosWorld.xz + concreteSurface * vPosWorld.y * vec2(0.73, 0.41);
|
|
181
|
+
float pixelSize = max(length(dFdx(surface)), length(dFdy(surface)));
|
|
182
|
+
float fine = 1.0 - smoothstep(mix(0.04, 0.015, concreteSurface),
|
|
183
|
+
mix(0.16, 0.065, concreteSurface), pixelSize);
|
|
184
|
+
float variation = (turfNoise(surface * mix(0.32, 0.65, concreteSurface)) - 0.5)
|
|
185
|
+
* mix(0.13, 0.075, concreteSurface)
|
|
186
|
+
+ (turfNoise(surface * mix(9.0, 23.0, concreteSurface)) - 0.5)
|
|
187
|
+
* mix(0.10, 0.055, concreteSurface) * fine;
|
|
188
|
+
vColorRung *= 1.0 + variation;
|
|
189
|
+
}
|
|
190
|
+
// Unresolved row faces need the same lighting, not merely the same paint:
|
|
191
|
+
// alternating vertical/horizontal normals otherwise recreate a moire comb.
|
|
192
|
+
float rowOverview = max(tread, riser) * (1.0 - uStructureDetail);
|
|
193
|
+
vec3 N = normalize(mix(vNormalWorld, vec3(0.0, 1.0, 0.0), rowOverview));
|
|
129
194
|
vec3 V = normalize(-vPosView);
|
|
130
195
|
float hemi = 0.5 + 0.5 * N.y; // sky/ground gradient about WORLD up
|
|
131
|
-
float
|
|
196
|
+
float visibility = architecturalLight(N);
|
|
197
|
+
float key = max(dot(N, uKeyDir), 0.0) * visibility; // fixed key \u2014 does not orbit with you
|
|
132
198
|
// Low opposite fill so faces turned away from the key keep their form instead
|
|
133
199
|
// of crushing to a single flat value.
|
|
134
200
|
vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
|
|
135
201
|
float fill = max(dot(N, fillDir), 0.0);
|
|
136
|
-
vec3 base = vColorRung * (0.
|
|
202
|
+
vec3 base = vColorRung * (0.40 + 0.28 * hemi) * mix(0.76, 1.0, visibility) + vColorRung * key * 0.46 + vColorRung * fill * 0.12;
|
|
137
203
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
138
204
|
// Material 1 is a powered display and keeps its authored emission treatment.
|
|
139
205
|
// Every architectural material uses the venue roughness token; 0.78 maps to
|
|
140
206
|
// exactly the historical rim strength so an unthemed chart does not shift.
|
|
141
207
|
float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
|
|
142
208
|
float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
|
|
143
|
-
|
|
209
|
+
float concreteSheen = abs(vMaterial - 5.0) < 0.5 ? 0.45 : 1.0;
|
|
210
|
+
base += vec3(0.26, 0.31, 0.38) * fres * 0.16 * sheen * (1.0 - rowOverview) * concreteSheen; // cool rim, restrained
|
|
144
211
|
// Bright, saturated authored screen faces should read as powered displays,
|
|
145
212
|
// not painted slabs. Vertex colour is deliberately the material signal here:
|
|
146
213
|
// muted tiers and structure never cross these thresholds. The broad waves
|
|
@@ -166,15 +233,43 @@ void main() {
|
|
|
166
233
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
167
234
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
168
235
|
fragColor = vec4(base, 1.0);
|
|
169
|
-
}`,
|
|
236
|
+
}`,Qn=`
|
|
237
|
+
${Bt}
|
|
238
|
+
vec4 seatSurface(vec3 source, float radius) {
|
|
239
|
+
vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
|
|
240
|
+
if (iPhysicalSeat < 0.5) {
|
|
241
|
+
if (surface > 0.5) return origin;
|
|
242
|
+
// Empty bays are markings on the deck, not upright camera-facing panels.
|
|
243
|
+
float c = cos(iYaw), s = sin(iYaw);
|
|
244
|
+
vec3 bay = vec3(source.x * c + source.y * s, 0.0, -source.x * s + source.y * c) * radius;
|
|
245
|
+
bay.y = 0.015;
|
|
246
|
+
return modelViewMatrix * vec4(iOffset + bay, 1.0);
|
|
247
|
+
}
|
|
248
|
+
if (surface < 0.5) return origin;
|
|
249
|
+
vec3 p = glyphChairPosition(source, surface, iGlyph);
|
|
250
|
+
p.xz *= iChairWidth;
|
|
251
|
+
if (surface > 1.5) p.z -= max(p.y - ${Ae.toFixed(2)}, 0.0) * ${Be.toFixed(2)} * glyphBackRake(iGlyph);
|
|
252
|
+
float c = cos(iYaw), s = sin(iYaw);
|
|
253
|
+
vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
254
|
+
return modelViewMatrix * vec4(iOffset + rotated, 1.0);
|
|
255
|
+
}
|
|
256
|
+
`,Yr=`#version 300 es
|
|
170
257
|
precision highp float;
|
|
171
|
-
in
|
|
258
|
+
in float surface;
|
|
259
|
+
in float iYaw;
|
|
260
|
+
in float iChairWidth;
|
|
261
|
+
in float iGlyph;
|
|
262
|
+
in vec3 position;
|
|
263
|
+
in vec3 normal;
|
|
264
|
+
in vec2 uv; // quad corner in [-1,1]
|
|
172
265
|
in vec3 iOffset; // per-instance world position
|
|
173
266
|
in vec3 iColor; // per-instance state colour (resolved CPU-side)
|
|
174
267
|
in float iMaxRadius; // per-instance world-radius ceiling (seat pitch derived)
|
|
268
|
+
in float iHasChair;
|
|
175
269
|
in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
|
|
176
270
|
in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
|
|
177
271
|
in float iFloor; // owning floor index
|
|
272
|
+
in float iSection; // owning section index, -1 = none
|
|
178
273
|
uniform mat4 modelViewMatrix;
|
|
179
274
|
uniform mat4 projectionMatrix;
|
|
180
275
|
uniform float uSeatRadius;
|
|
@@ -182,25 +277,31 @@ uniform float uSeatScale;
|
|
|
182
277
|
uniform float uMinPixels;
|
|
183
278
|
uniform float uPixelToWorld; // (2*tan(fovY/2)) / viewportHeightPx
|
|
184
279
|
uniform float uFocusFloor; // -1 = show every floor
|
|
280
|
+
uniform float uFocusSection; // -1 = no section entered
|
|
185
281
|
uniform float uChairFull; // view depth at which the chair mesh is full size
|
|
186
282
|
uniform float uChairNone; // ...and at which it has scaled away entirely
|
|
283
|
+
out vec3 vSeatNormal;
|
|
284
|
+
out float vSeatHeight;
|
|
285
|
+
out float vSeatSurface;
|
|
187
286
|
out vec2 vUv;
|
|
188
287
|
out vec3 vColor;
|
|
189
288
|
out float vBudget; // 1 = dot holds its minimum pixel size, <1 = it cannot
|
|
190
289
|
out vec3 vRing;
|
|
191
290
|
out float vDim;
|
|
291
|
+
out float vSectionFade;
|
|
192
292
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
193
293
|
out float vPhysicalSeat;
|
|
194
294
|
out float vPixelRadius;
|
|
195
|
-
${
|
|
295
|
+
${ut}
|
|
296
|
+
${Qn}
|
|
196
297
|
void main() {
|
|
197
298
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
198
299
|
float depth = max(-mv.z, 0.001);
|
|
199
300
|
// Hand the seat over to the chair mesh as it comes into range. Derived from
|
|
200
|
-
// this instance's
|
|
301
|
+
// this instance's spherical distance rather than from a global uniform, so a row two
|
|
201
302
|
// metres away and the far side of the bowl resolve differently in the same
|
|
202
303
|
// frame \u2014 which is the entire point of a ladder over a switch.
|
|
203
|
-
vDotWeight = 1.0 - chairWeight(
|
|
304
|
+
vDotWeight = 1.0 - iPhysicalSeat * iHasChair * chairWeight(length(mv.xyz));
|
|
204
305
|
float minR = uMinPixels * depth * uPixelToWorld; // screen-space floor
|
|
205
306
|
// Grow to hold the pixel floor, but never past this seat's own pitch ceiling:
|
|
206
307
|
// unbounded growth is what merges neighbouring rows into one mass at range.
|
|
@@ -210,28 +311,39 @@ void main() {
|
|
|
210
311
|
// it is losing legibility to distance, and the fragment stage dissolves it
|
|
211
312
|
// toward the tier top rather than letting a sub-pixel dot alias and shimmer.
|
|
212
313
|
vBudget = minR > 0.0 ? clamp(r / minR, 0.0, 1.0) : 1.0;
|
|
213
|
-
mv
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
vUv = position;
|
|
314
|
+
mv = seatSurface(position, r);
|
|
315
|
+
// Match the shell's non-uniform width/depth scale before its back rake.
|
|
316
|
+
vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
|
|
317
|
+
if (surface > 1.5) n.y += n.z * ${Be.toFixed(2)} * glyphBackRake(iGlyph);
|
|
318
|
+
n = normalize(n);
|
|
319
|
+
vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
|
|
320
|
+
vSeatHeight = position.y;
|
|
321
|
+
vSeatSurface = step(1.5, surface);
|
|
322
|
+
vUv = uv;
|
|
223
323
|
vColor = iColor;
|
|
224
324
|
vRing = iRing;
|
|
225
325
|
vPhysicalSeat = iPhysicalSeat;
|
|
226
326
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
327
|
+
vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
|
|
227
328
|
gl_Position = projectionMatrix * mv;
|
|
228
|
-
}
|
|
329
|
+
}`,$n=`
|
|
330
|
+
float seatSilhouette(vec2 uv, float physical) {
|
|
331
|
+
// Solid furniture owns its silhouette in geometry. Only empty bays need
|
|
332
|
+
// a fragment mask; cutting physical faces would open holes in the volume.
|
|
333
|
+
return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
|
|
334
|
+
}
|
|
335
|
+
`,Xr=`#version 300 es
|
|
229
336
|
precision highp float;
|
|
337
|
+
in vec3 vSeatNormal;
|
|
338
|
+
in float vSeatHeight;
|
|
339
|
+
in float vSeatSurface;
|
|
340
|
+
uniform vec3 uKeyDir;
|
|
230
341
|
in vec2 vUv;
|
|
231
342
|
in vec3 vColor;
|
|
232
343
|
in float vBudget;
|
|
233
344
|
in vec3 vRing;
|
|
234
345
|
in float vDim;
|
|
346
|
+
in float vSectionFade;
|
|
235
347
|
in float vDotWeight;
|
|
236
348
|
in float vPhysicalSeat;
|
|
237
349
|
in float vPixelRadius;
|
|
@@ -240,25 +352,36 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
|
|
|
240
352
|
uniform vec3 uFadeColor;
|
|
241
353
|
uniform float uRoughness;
|
|
242
354
|
out vec4 fragColor;
|
|
355
|
+
${$n}
|
|
243
356
|
void main() {
|
|
244
357
|
if (vDim > 0.5) discard;
|
|
245
358
|
// Same screen-door dissolve as the structure rung (uStructureDetail): the
|
|
246
359
|
// dot layer develops over ~a quarter second instead of appearing at once.
|
|
247
360
|
float stipple = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
248
|
-
|
|
361
|
+
// At overview, faint physical-seat grain supplies scale without exposing
|
|
362
|
+
// inventory states. It dissolves before subpixel seats can alias.
|
|
363
|
+
float overviewGrain = (1.0 - uSeatDetail) * vPhysicalSeat * smoothstep(0.55, 1.15, vPixelRadius);
|
|
364
|
+
if (stipple >= uSeatDetail && overviewGrain <= 0.0) discard;
|
|
249
365
|
// Empty wheelchair provision is a square bay, never a round chair marker.
|
|
250
|
-
float d =
|
|
366
|
+
float d = seatSilhouette(vUv, vPhysicalSeat);
|
|
251
367
|
if (d > 1.0) discard;
|
|
252
368
|
float alpha = smoothstep(1.0, 0.72, d);
|
|
253
|
-
|
|
254
|
-
|
|
369
|
+
vec3 N = normalize(vSeatNormal);
|
|
370
|
+
if (vSeatSurface > 0.5 && !gl_FrontFacing) N = -N;
|
|
371
|
+
float hemi = 0.5 + 0.5 * N.y;
|
|
372
|
+
float key = max(dot(N, uKeyDir), 0.0);
|
|
373
|
+
float fill = max(dot(N, normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z))), 0.0);
|
|
374
|
+
float ao = mix(0.58, 1.0, clamp(vSeatHeight / 0.92, 0.0, 1.0));
|
|
375
|
+
float partShade = mix(1.10, 0.80, vSeatSurface);
|
|
376
|
+
vec3 c = vColor * (partShade * ao * (0.60 + 0.30 * hemi) + key * 0.28 + fill * 0.16);
|
|
255
377
|
c = mix(c, uFadeColor, uSeatFade);
|
|
256
378
|
// Accommodation ring \u2014 the 3D echo of the coloured ring 2D draws around every
|
|
257
379
|
// accessible seat. Painted INSIDE the dot's own radius rather than outside it,
|
|
258
380
|
// so an accessible seat still respects the row-pitch ceiling and cannot grow
|
|
259
381
|
// into its neighbour just for carrying a ring.
|
|
260
382
|
float ringMask = step(0.001, dot(vRing, vRing));
|
|
261
|
-
float
|
|
383
|
+
float ringDistance = max(abs(vUv.x), abs(vUv.y));
|
|
384
|
+
float ring = smoothstep(0.58, 0.70, ringDistance) * (1.0 - smoothstep(0.90, 1.0, ringDistance));
|
|
262
385
|
c = mix(c, vRing, ring * ringMask * 0.95);
|
|
263
386
|
// A dot that can no longer afford its pixel floor dissolves instead of
|
|
264
387
|
// aliasing; the tier cap underneath already carries the section's category
|
|
@@ -268,7 +391,10 @@ void main() {
|
|
|
268
391
|
// seat rather than a sample in a dense screen-space pattern. This is based on
|
|
269
392
|
// actual projected pixels, so it remains correct for unusually large or small
|
|
270
393
|
// venues where a radius-normalised camera distance is misleading.
|
|
271
|
-
alpha
|
|
394
|
+
float detailedAlpha = alpha * smoothstep(2.4, 3.2, vPixelRadius) * uSeatDetail;
|
|
395
|
+
float grainAlpha = smoothstep(1.0, 0.55, d) * overviewGrain * 0.42;
|
|
396
|
+
c = mix(vec3(0.27, 0.31, 0.32), c, uSeatDetail);
|
|
397
|
+
alpha = max(detailedAlpha, grainAlpha);
|
|
272
398
|
// Inventory states are a section-level decision aid. At whole-venue/area
|
|
273
399
|
// scale the category-tinted structural surface is the honest, stable signal;
|
|
274
400
|
// thousands of enlarged status dots only form a moir\xE9 pattern. The journey
|
|
@@ -278,13 +404,17 @@ void main() {
|
|
|
278
404
|
// while zooming. uSeatFade already measures this exact LOD transition: let
|
|
279
405
|
// the category-tinted tier carry the overview, then reveal individual live
|
|
280
406
|
// availability as the buyer approaches a section.
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
// never thins out to nothing in between.
|
|
284
|
-
alpha *= vDotWeight;
|
|
407
|
+
// Exactly one representation owns this seat at the detail boundary.
|
|
408
|
+
if (vDotWeight <= 0.99) discard;
|
|
285
409
|
if (alpha <= 0.0) discard;
|
|
410
|
+
// Outside the entered section: quieter, still visible and pickable. Not the
|
|
411
|
+
// strong grey of a filtered seat, which means nothing to buy there.
|
|
412
|
+
if (vSectionFade > 0.5) {
|
|
413
|
+
float lum = dot(c, vec3(0.299, 0.587, 0.114));
|
|
414
|
+
c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
|
|
415
|
+
}
|
|
286
416
|
fragColor = vec4(c, alpha);
|
|
287
|
-
}`,
|
|
417
|
+
}`,qr=`#version 300 es
|
|
288
418
|
precision highp float;
|
|
289
419
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
290
420
|
in vec3 normal;
|
|
@@ -295,6 +425,7 @@ in float iRadius; // per-instance horizontal half-width, world metres
|
|
|
295
425
|
in float iYaw; // per-instance facing, radians (local +Z -> facing dir)
|
|
296
426
|
in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
|
|
297
427
|
in float iFloor;
|
|
428
|
+
in float iSection; // owning section index, -1 = none
|
|
298
429
|
in float iSeed; // <0 = seat is empty; else per-person hash in [0,1)
|
|
299
430
|
in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
|
|
300
431
|
in float iGlyph; // stable SEAT_GLYPH_ORDER index
|
|
@@ -303,21 +434,24 @@ uniform mat4 projectionMatrix;
|
|
|
303
434
|
uniform float uChairFull;
|
|
304
435
|
uniform float uChairNone;
|
|
305
436
|
uniform float uFocusFloor;
|
|
437
|
+
uniform float uFocusSection; // -1 = no section entered
|
|
306
438
|
uniform float uBackRake; // metres of z per metre of rise, above uBackBase
|
|
307
439
|
uniform float uBackBase; // local height at which the back starts
|
|
308
440
|
out vec3 vColor;
|
|
309
441
|
out vec3 vNormalWorld;
|
|
310
442
|
out vec3 vNormalView;
|
|
311
443
|
out vec3 vPosView;
|
|
444
|
+
out float vChairWeight;
|
|
312
445
|
out float vPart;
|
|
313
446
|
out float vHeight; // local height in metres, for the vertical occlusion ramp
|
|
314
447
|
out vec3 vRing;
|
|
315
448
|
out float vDim;
|
|
449
|
+
out float vSectionFade;
|
|
316
450
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
317
451
|
out vec3 vOccupantTint;
|
|
318
|
-
${
|
|
319
|
-
${
|
|
320
|
-
${
|
|
452
|
+
${ut}
|
|
453
|
+
${Kn}
|
|
454
|
+
${Bt}
|
|
321
455
|
void main() {
|
|
322
456
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
323
457
|
float viewDepth = -anchor.z;
|
|
@@ -325,7 +459,7 @@ void main() {
|
|
|
325
459
|
// A stale near-field gather can contain seats now behind the camera after a
|
|
326
460
|
// row\u2192overview move. Treating negative depth as 0.001 made those chairs full
|
|
327
461
|
// size across the near plane, producing the long black zoom streaks.
|
|
328
|
-
float w = viewDepth > 0.05 ? chairWeight(
|
|
462
|
+
float w = viewDepth > 0.05 ? chairWeight(length(anchor.xyz)) : 0.0;
|
|
329
463
|
// 1. Local units -> world metres. Only x/z scale: narrow rows get narrow
|
|
330
464
|
// chairs, but nobody gets a short one (people are the same height at every
|
|
331
465
|
// seat pitch).
|
|
@@ -369,11 +503,9 @@ void main() {
|
|
|
369
503
|
float resolvedRake = uBackRake * glyphBackRake(iGlyph);
|
|
370
504
|
float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * resolvedRake : 0.0;
|
|
371
505
|
p.z -= rake;
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// half there; see chairScale() in lod.ts.
|
|
376
|
-
p *= sqrt(w);
|
|
506
|
+
// Fixed-size detail swap: no miniature chair inside a larger fallback.
|
|
507
|
+
p *= step(0.01, w);
|
|
508
|
+
vChairWeight = w;
|
|
377
509
|
float c = cos(iYaw), s = sin(iYaw);
|
|
378
510
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
379
511
|
// Normals under the same two transforms, in reverse and inverted-transposed.
|
|
@@ -402,8 +534,9 @@ void main() {
|
|
|
402
534
|
vHeight = localHeight;
|
|
403
535
|
vRing = iRing;
|
|
404
536
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
537
|
+
vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
|
|
405
538
|
gl_Position = projectionMatrix * mv;
|
|
406
|
-
}`,
|
|
539
|
+
}`,jr=`#version 300 es
|
|
407
540
|
precision highp float;
|
|
408
541
|
in vec3 vColor;
|
|
409
542
|
in vec3 vNormalWorld;
|
|
@@ -413,14 +546,17 @@ in float vPart;
|
|
|
413
546
|
in float vHeight;
|
|
414
547
|
in vec3 vRing;
|
|
415
548
|
in float vDim;
|
|
549
|
+
in float vSectionFade;
|
|
416
550
|
in float vOccupant;
|
|
417
551
|
in vec3 vOccupantTint;
|
|
418
552
|
uniform vec3 uKeyDir;
|
|
419
553
|
uniform vec3 uFadeColor;
|
|
420
554
|
uniform float uRoughness;
|
|
555
|
+
in float vChairWeight;
|
|
421
556
|
out vec4 fragColor;
|
|
422
557
|
void main() {
|
|
423
558
|
if (vDim > 0.5) discard;
|
|
559
|
+
if (vChairWeight < 0.01) discard;
|
|
424
560
|
vec3 N = normalize(vNormalWorld);
|
|
425
561
|
vec3 V = normalize(-vPosView);
|
|
426
562
|
// The solids' rig, unchanged, so the chairs sit in the venue's light.
|
|
@@ -453,21 +589,27 @@ void main() {
|
|
|
453
589
|
// Occupants rise above the 0.92 m chair back, so their ramp uses their own
|
|
454
590
|
// height or every head would clamp to full brightness and float.
|
|
455
591
|
float ao = mix(0.58, 1.0, clamp(vHeight / (vOccupant > 0.5 ? 1.30 : 0.92), 0.0, 1.0));
|
|
456
|
-
vec3 base = tint * partShade * ao * (0.
|
|
592
|
+
vec3 base = tint * partShade * ao * (0.60 + 0.30 * hemi) + tint * key * 0.28 + tint * fill * 0.16;
|
|
457
593
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
458
|
-
// A
|
|
459
|
-
//
|
|
594
|
+
// A restrained furniture rim keeps the low-poly edges from looking outlined.
|
|
595
|
+
// Occupant silhouettes retain their existing stronger separation.
|
|
460
596
|
float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
|
|
461
|
-
base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
|
|
597
|
+
base += vec3(0.26, 0.31, 0.38) * fres * mix(0.24, 0.55, vOccupant) * mix(sheen, 1.0, vOccupant);
|
|
598
|
+
// Outside the entered section: quieter, still visible and pickable. Not the
|
|
599
|
+
// strong grey of a filtered seat, which means nothing to buy there.
|
|
600
|
+
if (vSectionFade > 0.5) {
|
|
601
|
+
float lum = dot(base, vec3(0.299, 0.587, 0.114));
|
|
602
|
+
base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
|
|
603
|
+
}
|
|
462
604
|
fragColor = vec4(base, 1.0);
|
|
463
|
-
}`,
|
|
605
|
+
}`,Kr=`#version 300 es
|
|
464
606
|
precision highp float;
|
|
465
607
|
in vec2 position;
|
|
466
608
|
out vec2 vUv;
|
|
467
609
|
void main() {
|
|
468
610
|
vUv = position * 0.5 + 0.5;
|
|
469
611
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
470
|
-
}`,
|
|
612
|
+
}`,Qr=`#version 300 es
|
|
471
613
|
precision highp float;
|
|
472
614
|
in vec2 vUv;
|
|
473
615
|
uniform vec3 uTop;
|
|
@@ -476,13 +618,20 @@ out vec4 fragColor;
|
|
|
476
618
|
void main() {
|
|
477
619
|
vec3 col = mix(uBottom, uTop, vUv.y);
|
|
478
620
|
vec2 c = vUv - 0.5;
|
|
479
|
-
float vig = 1.0 - dot(c, c) * 0.
|
|
621
|
+
float vig = 1.0 - dot(c, c) * 0.16; // soft vignette
|
|
480
622
|
fragColor = vec4(col * vig, 1.0);
|
|
481
|
-
}
|
|
623
|
+
}`,$r=`#version 300 es
|
|
482
624
|
precision highp float;
|
|
483
|
-
in
|
|
625
|
+
in float surface;
|
|
626
|
+
in float iYaw;
|
|
627
|
+
in float iChairWidth;
|
|
628
|
+
in float iGlyph;
|
|
629
|
+
in vec3 position;
|
|
630
|
+
in vec3 normal;
|
|
631
|
+
in vec2 uv;
|
|
484
632
|
in vec3 iOffset;
|
|
485
633
|
in float iMaxRadius;
|
|
634
|
+
in float iHasChair;
|
|
486
635
|
in float iPhysicalSeat;
|
|
487
636
|
in float iFloor;
|
|
488
637
|
uniform mat4 modelViewMatrix;
|
|
@@ -499,23 +648,22 @@ out float vPhysicalSeat;
|
|
|
499
648
|
out float vDotWeight;
|
|
500
649
|
out float vHidden;
|
|
501
650
|
flat out vec3 vPick;
|
|
502
|
-
${
|
|
651
|
+
${ut}
|
|
652
|
+
${Qn}
|
|
503
653
|
void main() {
|
|
504
654
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
505
655
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
506
656
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
507
657
|
float depth = max(-mv.z, 0.001);
|
|
508
|
-
vDotWeight = 1.0 - chairWeight(
|
|
658
|
+
vDotWeight = 1.0 - iPhysicalSeat * iHasChair * chairWeight(length(mv.xyz));
|
|
509
659
|
float minR = uMinPixels * depth * uPixelToWorld;
|
|
510
660
|
float r = min(max(uSeatRadius * uSeatScale, minR), iMaxRadius);
|
|
511
|
-
mv
|
|
512
|
-
|
|
513
|
-
mv.xy += normalize(vec3(modelViewMatrix * vec4(0.0, 1.0, 0.0, 0.0))).xy * r;
|
|
514
|
-
vUv = position;
|
|
661
|
+
mv = seatSurface(position, r);
|
|
662
|
+
vUv = uv;
|
|
515
663
|
vPhysicalSeat = iPhysicalSeat;
|
|
516
664
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
517
665
|
gl_Position = projectionMatrix * mv;
|
|
518
|
-
}`,
|
|
666
|
+
}`,Zr=`#version 300 es
|
|
519
667
|
precision highp float;
|
|
520
668
|
in vec2 vUv;
|
|
521
669
|
in float vPhysicalSeat;
|
|
@@ -523,13 +671,15 @@ in float vDotWeight;
|
|
|
523
671
|
in float vHidden;
|
|
524
672
|
flat in vec3 vPick;
|
|
525
673
|
out vec4 fragColor;
|
|
674
|
+
${$n}
|
|
526
675
|
void main() {
|
|
527
676
|
if (vHidden > 0.5) discard;
|
|
677
|
+
if (vDotWeight <= 0.99) discard;
|
|
528
678
|
if (vDotWeight <= 0.02) discard; // invisible dot cannot steal a chair tap
|
|
529
|
-
float d =
|
|
679
|
+
float d = seatSilhouette(vUv, vPhysicalSeat);
|
|
530
680
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
531
681
|
fragColor = vec4(vPick, 1.0);
|
|
532
|
-
}`,
|
|
682
|
+
}`,Jr=`#version 300 es
|
|
533
683
|
precision highp float;
|
|
534
684
|
in vec3 position;
|
|
535
685
|
in float part;
|
|
@@ -549,10 +699,11 @@ uniform float uBackRake;
|
|
|
549
699
|
uniform float uBackBase;
|
|
550
700
|
uniform float uFocusFloor;
|
|
551
701
|
flat out vec3 vPick;
|
|
702
|
+
out float vChairWeight;
|
|
552
703
|
out float vHidden;
|
|
553
|
-
${
|
|
554
|
-
${
|
|
555
|
-
${
|
|
704
|
+
${ut}
|
|
705
|
+
${Kn}
|
|
706
|
+
${Bt}
|
|
556
707
|
void main() {
|
|
557
708
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
558
709
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -560,7 +711,7 @@ void main() {
|
|
|
560
711
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
561
712
|
float viewDepth = -anchor.z;
|
|
562
713
|
float depth = max(viewDepth, 0.001);
|
|
563
|
-
float w = viewDepth > 0.05 ? chairWeight(
|
|
714
|
+
float w = viewDepth > 0.05 ? chairWeight(length(anchor.xyz)) : 0.0;
|
|
564
715
|
vec3 p = position;
|
|
565
716
|
float occupant = step(9.5, part);
|
|
566
717
|
float taken = step(0.0, iSeed);
|
|
@@ -581,19 +732,22 @@ void main() {
|
|
|
581
732
|
? max(p.y - uBackBase, 0.0) * uBackRake * glyphBackRake(iGlyph)
|
|
582
733
|
: 0.0;
|
|
583
734
|
p.z -= rake;
|
|
584
|
-
p *=
|
|
735
|
+
p *= step(0.01, w);
|
|
736
|
+
vChairWeight = w;
|
|
585
737
|
float c = cos(iYaw), s = sin(iYaw);
|
|
586
738
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
587
739
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
588
|
-
}`,
|
|
740
|
+
}`,ea=`#version 300 es
|
|
589
741
|
precision highp float;
|
|
590
742
|
flat in vec3 vPick;
|
|
591
743
|
in float vHidden;
|
|
744
|
+
in float vChairWeight;
|
|
592
745
|
out vec4 fragColor;
|
|
593
746
|
void main() {
|
|
594
747
|
if (vHidden > 0.5) discard;
|
|
748
|
+
if (vChairWeight < 0.01) discard;
|
|
595
749
|
fragColor = vec4(vPick, 1.0);
|
|
596
|
-
}`,
|
|
750
|
+
}`,ta=`#version 300 es
|
|
597
751
|
precision highp float;
|
|
598
752
|
in vec3 position;
|
|
599
753
|
in float floorIndex;
|
|
@@ -604,14 +758,23 @@ out float vHidden;
|
|
|
604
758
|
void main() {
|
|
605
759
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
606
760
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
607
|
-
}`,
|
|
761
|
+
}`,na=`#version 300 es
|
|
608
762
|
precision highp float;
|
|
609
763
|
in float vHidden;
|
|
610
764
|
out vec4 fragColor;
|
|
611
765
|
void main() {
|
|
612
766
|
if (vHidden > 0.5) discard;
|
|
613
767
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
614
|
-
}`;function
|
|
768
|
+
}`;function Zn(t){return new Ee(t,{vertex:$r,fragment:Zr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ge},uSeatScale:{value:1},uMinPixels:{value:Ie},uPixelToWorld:{value:.002},uChairFull:{value:Ue},uChairNone:{value:_e},uFocusFloor:{value:-1}}})}function Jn(t){return new Ee(t,{vertex:Jr,fragment:ea,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:Ue},uChairNone:{value:_e},uBackRake:{value:Be},uBackBase:{value:Ae},uFocusFloor:{value:-1}}})}function eo(t){return new Ee(t,{vertex:ta,fragment:na,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function to(t,e=.78,n=[.63,.66,.65]){return new Ee(t,{vertex:Wr,fragment:Ur,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e}}})}function no(t){return new Ee(t,{vertex:Yr,fragment:Xr,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:Ge},uSeatScale:{value:1},uMinPixels:{value:Ie},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ue},uChairNone:{value:_e}}})}function oo(t,e=.78){return new Ee(t,{vertex:qr,fragment:jr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ue},uChairNone:{value:_e},uBackRake:{value:Be},uBackBase:{value:Ae},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function ro(t,e,n){return new Ee(t,{vertex:Kr,fragment:Qr,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}import{Camera as oa,Mat4 as ra,Mesh as aa,Program as ia,RenderTarget as sa,Transform as la}from"ogl";function ao(t,e,n){let a=Math.max(3,n.radius*1.04),[o,i,s]=n.center,l=new oa(t,{left:-a,right:a,bottom:-a,top:a,near:.1,far:a*6});l.position.set(o-a*1.44,i+a*2.34,s+a*1.2),l.lookAt([o,i,s]);let u=new sa(t,{width:1024,height:1024,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),p=new ia(t,{cullFace:!1,vertex:`#version 300 es
|
|
769
|
+
in vec3 position;
|
|
770
|
+
uniform mat4 modelViewMatrix;
|
|
771
|
+
uniform mat4 projectionMatrix;
|
|
772
|
+
void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,fragment:`#version 300 es
|
|
773
|
+
precision highp float;
|
|
774
|
+
out vec4 fragColor;
|
|
775
|
+
void main() {
|
|
776
|
+
fragColor = vec4(1.0);
|
|
777
|
+
}`}),h=new la,v=new aa(t,{geometry:e,program:p});v.frustumCulled=!1,v.setParent(h);let f=t.getParameter(t.COLOR_CLEAR_VALUE),c=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:h,camera:l,target:u})}finally{c&&t.enable(t.DITHER),t.clearColor(f[0],f[1],f[2],f[3]),p.remove()}let b=new ra().multiply(l.projectionMatrix,l.viewMatrix);return{texture:u.depthTexture,matrix:b,dispose(){for(let E of u.textures)t.deleteTexture(E.texture);t.deleteTexture(u.depthTexture.texture),t.deleteFramebuffer(u.buffer),u.depthBuffer&&t.deleteRenderbuffer(u.depthBuffer)}}}var ca=.65,ua=new Set(["dimmed","sold"]),da=new Set(["dimmed","sold","held"]);function io(t,e,n){let r=new Set,a=!1,o=be.indexOf("dimmed"),i=!1;for(let l=0;l<n.length;l+=1)if(n[l]===o){i=!0;break}let s=i?da:ua;for(let l of t){let u=e.get(l.sectionId);if(!u||!u.length){r.add(l.sectionId);continue}let p=!1;for(let h of u){let v=be[n[h]]??"available";if(!s.has(v)){p=!0;break}}p?r.add(l.sectionId):a=!0}return{lit:r,anyUnlit:a}}function so(t,e,n,r,a,o){let i=[];for(let s of t){let l=a===null||a.has(s.sectionId);if(r.get(s.sectionId)===l)continue;r.set(s.sectionId,l);let u=(s.start+s.count)*3;for(let p=s.start*3;p<u;p++)e[p]=l?n[p]:n[p]+(o[p%3]-n[p])*ca;i.push(s)}return i}function co(t,e,n,r,a,o){for(let i=n;i<n+r;i++){let l=o&&e[i]===0?null:a[e[i]]??a[0];t[i*3]=l?l[0]:o[i*3],t[i*3+1]=l?l[1]:o[i*3+1],t[i*3+2]=l?l[2]:o[i*3+2]}}var pa=new Float32Array([-1,-1,3,-1,-1,3]);function uo(t,e){let n=new lo,r=new lo,a=new Xe(t,{position:{size:2,data:pa}}),o=ro(t,e.theme.background.top,e.theme.background.bottom),i=new qe(t,{geometry:a,program:o});i.frustumCulled=!1,i.setParent(r);let s=new Xe(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),l=ao(t,s,e.renderBounds),u=to(t,e.theme.materials.roughness,e.theme.structure.tierTop);u.uniforms.tVenueShadow={value:l.texture},u.uniforms.uShadowMatrix={value:l.matrix};let p=new qe(t,{geometry:s,program:u});p.frustumCulled=!1,p.setParent(n);let h=no(t),v=new Float32Array(e.seats.count*3),f=be.map(k=>e.theme.seatStates[k]),c=e.seats.iCategory.slice();for(let k=0;k<e.seats.count;k++){if(e.seats.iPhysicalSeat[k]<.5)continue;let X=e.theme.materials.seat??mn([c[k*3],c[k*3+1],c[k*3+2]]);c.set(X,k*3)}co(v,e.seats.iState,0,e.seats.count,f,c);let b=Rn(),E=new Uint8Array(e.seats.count),P=new Xe(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},uv:{size:2,data:b.uv},index:{size:1,data:b.index},surface:{size:1,data:b.surface},iYaw:{size:1,data:e.seats.iYaw,instanced:1},iChairWidth:{size:1,data:e.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:e.seats.iGlyph,instanced:1},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:v,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:E,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1},iSection:{size:1,data:e.seats.iSection,instanced:1}}),L=new qe(t,{geometry:P,program:h});L.frustumCulled=!1,e.seats.count>0&&L.setParent(n);let C=P.attributes.iColor,F=e.solids.color.slice(),g=e.theme.structure.ground,A=new Map(e.sectionSolidRanges.map(k=>[k.sectionId,!0])),S=un(),w=oo(t,e.theme.materials.roughness),R=lt,T=new Float32Array(R*3),I=new Float32Array(R*3),Y=new Float32Array(R),B=new Float32Array(R),U=new Float32Array(R),V=new Float32Array(R*3),H=new Float32Array(R),D=new Float32Array(R),x=new Float32Array(R),y=new Float32Array(R),G=new Float32Array(R),N=new Xe(t,{position:{size:3,data:S.position},normal:{size:3,data:S.normal},part:{size:1,data:S.part},index:{data:S.index},iOffset:{size:3,data:T,instanced:1},iColor:{size:3,data:I,instanced:1},iRadius:{size:1,data:Y,instanced:1},iYaw:{size:1,data:B,instanced:1},iGlyph:{size:1,data:U,instanced:1},iRing:{size:3,data:V,instanced:1},iFloor:{size:1,data:H,instanced:1},iSection:{size:1,data:D,instanced:1},iPhysicalSeat:{size:1,data:x,instanced:1},iSeed:{size:1,data:G,instanced:1},iPickIndex:{size:1,data:y,instanced:1}}),q=new qe(t,{geometry:N,program:w});q.frustumCulled=!1;let Z=0,ee=!1,he=!1,Q=null,ie=null,te=null,se=new Int32Array(0),ve=()=>{let k=e.seats;for(let X=0;X<Z;X++){let j=se[X];G[X]=hn(k.iState[j],j),I[X*3]=v[j*3],I[X*3+1]=v[j*3+1],I[X*3+2]=v[j*3+2]}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},re={main:n,background:r,seatProgram:h,solidProgram:u,chairProgram:w,seatGeometry:P,chairGeometry:N,solidGeometry:s,drawCalls:3,setNearSeats(k,X){let j=Math.min(X,R,k.length);if(jn(E,k,j),P.attributes.iHasChair.needsUpdate=!0,se=k,Z=j,j===0){q.parent&&q.setParent(null),N.instancedCount=0,re.drawCalls=3+(ee?1:0);return}let J=e.seats;for(let O=0;O<j;O++){let ne=k[O];T[O*3]=J.iPosition[ne*3],T[O*3+1]=J.iPosition[ne*3+1],T[O*3+2]=J.iPosition[ne*3+2],Y[O]=J.iChairWidth[ne],B[O]=J.iYaw[ne],U[O]=J.iGlyph[ne],V[O*3]=J.iRing[ne*3],V[O*3+1]=J.iRing[ne*3+1],V[O*3+2]=J.iRing[ne*3+2],H[O]=J.iFloor[ne],D[O]=J.iSection[ne],x[O]=J.iPhysicalSeat[ne],y[O]=ne+1}ve(),N.attributes.iOffset.needsUpdate=!0,N.attributes.iRadius.needsUpdate=!0,N.attributes.iYaw.needsUpdate=!0,N.attributes.iGlyph.needsUpdate=!0,N.attributes.iRing.needsUpdate=!0,N.attributes.iFloor.needsUpdate=!0,N.attributes.iSection.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=j,q.parent||q.setParent(n),re.drawCalls=4+(ee?1:0)},nearSeatCount(){return Z},setSectionShellLit(k){u.uniforms.uSectionFilter.value=k===null?0:1;let X=so(e.sectionSolidRanges,e.solids.color,F,A,k,g);if(!X.length)return;let j=s.attributes.color,J=j.buffer;if(!J){j.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,J);for(let O of X){let ne=e.solids.color.subarray(O.start*3,(O.start+O.count)*3);t.bufferSubData(t.ARRAY_BUFFER,O.start*3*Float32Array.BYTES_PER_ELEMENT,ne)}},uploadSeatStateRuns(k){if(!k.length)return;Z&&ve();for(let j of k)co(v,e.seats.iState,j.start,j.length,f,c);let X=C.buffer;if(!X){C.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,X);for(let j of k){let J=v.subarray(j.start*3,(j.start+j.length)*3);t.bufferSubData(t.ARRAY_BUFFER,j.start*3*Float32Array.BYTES_PER_ELEMENT,J)}},dispose(){he=!0,l.dispose(),a.remove(),o.remove(),s.remove(),u.remove(),P.remove(),h.remove(),N.remove(),w.remove(),Q?.remove(),ie?.remove(),te?.texture&&t.deleteTexture(te.texture)}},le=e.productionElements.find(k=>k.contentImageUrl&&k.contentPlane);if(le?.contentImageUrl&&le.contentPlane?.length===4&&typeof Image<"u"){let k=new Image;k.crossOrigin="anonymous",k.onload=()=>{if(he)return;let X=le.contentPlane;Q=new Xe(t,{position:{size:3,data:new Float32Array(X.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(le.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),te=new ha(t,{image:k,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),ie=new ma(t,{vertex:`#version 300 es
|
|
615
778
|
precision highp float;
|
|
616
779
|
in vec3 position; in vec2 uv; in float floorIndex;
|
|
617
780
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
@@ -619,4 +782,4 @@ void main() {
|
|
|
619
782
|
void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
|
|
620
783
|
precision highp float;
|
|
621
784
|
in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
|
|
622
|
-
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:ee},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let B=new Ne(t,{geometry:$,program:U});B.frustumCulled=!1,B.setParent(o),oe.screenProgram=U,g=!0,oe.drawCalls=3+(X?1:0)+1},I.src=J.contentImageUrl}return oe}import{Mesh as It,RenderTarget as kr,Transform as _t}from"ogl";function Lr(t,e,o){let r=t+(e<<8)+(o<<16);return r===0?-1:r-1}function Ho(t,e,o,r,n,i){let s=-1,a=1/0;for(let l=0;l<o;l++)for(let d=0;d<e;d++){let p=(l*e+d)*4,h=Lr(t[p],t[p+1],t[p+2]);if(h<0||h>=i)continue;let b=d-r,c=l-n,u=b*b+c*c;u<a&&(a=u,s=h)}return s}function Uo(t,e,o,r,n,i){let s=t-o.left,a=e-o.top,l=Math.round(s*r),d=Math.round((o.height-a)*r);return{x:Math.max(0,Math.min(n-1,l)),y:Math.max(0,Math.min(i-1,d))}}var Or=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],tt=class{constructor(e,o,r,n,i){this.seatScene=new _t;this.chairScene=new _t;this.solidScene=new _t;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=Fo(this.gl),this.chairProg=To(this.gl),this.depthProg=Io(this.gl);let s=new It(this.gl,{geometry:o,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let a=new It(this.gl,{geometry:r,program:this.chairProg});a.frustumCulled=!1,a.setParent(this.chairScene);let l=new It(this.gl,{geometry:n,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of Or)this.seatProg.uniforms[r].value=e.uniforms[r].value;let o=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=o,this.chairProg.uniforms.uFocusFloor.value=o,this.depthProg.uniforms.uFocusFloor.value=o}ensureTarget(){let e=this.gl.drawingBufferWidth,o=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==o)&&this.destroyTarget(),this.target||(this.target=new kr(this.gl,{width:e,height:o,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let o of this.target.textures??[])o.texture&&e.deleteTexture(o.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,o,r,n){let i=this.gl,s=this.ensureTarget(),a=i.drawingBufferWidth,l=i.drawingBufferHeight,d=Math.max(0,o-n),p=Math.max(0,r-n),h=Math.max(1,Math.min(a,o+n+1)-d),b=Math.max(1,Math.min(l,r+n+1)-p);i.enable(i.SCISSOR_TEST),i.scissor(d,p,h,b);let[c,u,P]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:s,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:s,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:s,clear:!1}),i.clearColor(c,u,P,1),i.disable(i.SCISSOR_TEST);let F=new Uint8Array(h*b*4);return this.renderer.bindFramebuffer(s),i.readPixels(d,p,h,b,i.RGBA,i.UNSIGNED_BYTE,F),this.renderer.bindFramebuffer(),Ho(F,h,b,o-d,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Wo(t,e){let o=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,$t(r.state)):o.push(r);return o}function Yo(t,e,o){let r=new Set;for(let s of e)(t.has(s)||o(s)!==void 0)&&r.add(s);let n=new Map(t),i=[];for(let[s,a]of t)r.has(s)||(i.push({seatId:s,state:me[a]??"available"}),n.delete(s));for(let s of r){if(n.has(s))continue;let a=o(s);a!==void 0&&(n.set(s,a),i.push({seatId:s,state:"selected"}))}return{updates:i,next:n}}import{Quat as Be,Vec3 as Br}from"ogl";function zr(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Xo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Nr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qo(t){let e=Math.hypot(t[0],t[1],t[2]);return e>1e-6?[t[0]/e,t[1]/e,t[2]/e]:[0,0,0]}function Vt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Lt(t,e){return Math.max(0,Math.min(1,t+e))}function jo(t,e){let o=t.length;if(o===0)return[0,0,0];if(o===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),n=o-1,i=Math.floor(r*n);i>=n&&(i=n-1);let s=r*n-i,a=t[Math.max(0,i-1)],l=t[i],d=t[i+1],p=t[Math.min(o-1,i+2)],h=s*s,b=h*s,c=[0,0,0];for(let u=0;u<3;u++)c[u]=.5*(2*l[u]+(-a[u]+d[u])*s+(2*a[u]-5*l[u]+4*d[u]-p[u])*h+(-a[u]+3*l[u]-3*d[u]+p[u])*b);return c}function kt(t,e,o,r,n){let i=qo(zr(e,o));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let s=Xo(Xo(e,Nr(i,2.5)),[0,1.5,0]),a=[e[0]-r[0],0,e[2]-r[2]],l=qo(a);l[0]===0&&l[2]===0&&(l=[i[0],0,i[2]]);let d=Math.max(1,n),p=[r[0]+l[0]*d*1.3,r[1]+d*.75,r[2]+l[2]*d*1.3];return{waypoints:[t,p,s],finalPos:s}}function Ot(t,e,o=35,r=28){let n=Vt(e),i=jo(t,n),s=Vt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:o+(r-o)*s,eased:n}}function Zo(t,e,o){let r=t.position.clone(),n=new Be().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Br(o[0],o[1],o[2]));let i=new Be().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(n),i}var ot=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Be;this.endQuat=new Be;this.outQuat=new Be;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,o,r,n=2500,i=28){return this.settle(),this.waypoints=e,this.startQuat.copy(o),this.endQuat.copy(r),this.duration=n,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(s=>{this.resolveFn=s})}update(e){if(!this.active)return!1;let o=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:n,eased:i}=Ot(this.waypoints,o,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Lt(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=n,this.camera.updateProjectionMatrix(),o>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Jo=Jt,Gr=.12,Hr=.25,Ur=1.5;function en(t,e,o=0,r,n){let i=[e.x*Me,o+Ur,e.y*Me],s=n?[n[0],n[1],n[2]]:i,a=t[1],l=Number.isFinite(a)?a+Jo:Number.isFinite(r)?o+r:o+Jo,d=i[0]-t[0],p=i[2]-t[2],h=Math.hypot(d,p),b=h>.001?Math.min(Gr,h*Hr):0,c=h>.001?d/h:0,u=h>.001?p/h:0;return{eye:[t[0]+c*b,l,t[2]+u*b],focal:s}}var we=Math.PI/180,Wr=45,tn=80,nt=70,Yr=1,Xr=.99;function qr(t,e){if(!(t<Yr))return tn;if(!(Number.isFinite(e)&&e>0))return nt;let o=2*Math.atan(e/(2*rt*Xr)/Math.max(.05,t))/we;return Math.max(nt,Math.min(tn,o))}var jr=.25,rt=1,Kr=.25,Qr=12*we,$r=.2,Zr=1.5,on=.8,nn=6,ln=1.9,Jr=2/3,ei=.12,ti=.9,oi=1.2,ni=2,cn=.05,ri=6;function un(t,e,o=0){if(!t.length)return{min:[e[0]-6,o,e[2]-6],max:[e[0]+6,Math.max(o+on,e[1]),e[2]+6]};let r=1/0,n=-1/0,i=1/0,s=-1/0,a=o;for(let u of t)r=Math.min(r,u.cx-u.halfX),n=Math.max(n,u.cx+u.halfX),i=Math.min(i,u.cz-u.halfZ),s=Math.max(s,u.cz+u.halfZ),a=Math.max(a,u.y);let l=n-r,d=s-i,p=Math.max(l,Math.min(d,nn))/2,h=Math.max(d,Math.min(l,nn))/2,b=(r+n)/2,c=(i+s)/2;return{min:[b-p,o,c-h],max:[b+p,Math.max(o+on,a),c+h]}}function ii(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+ln,t.max[2]]}}function zt(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Zr,e+$r,e+ln*Jr),(t.min[2]+t.max[2])/2]}function dn(t,e){let o=t[0]-e[0],r=t[2]-e[2],n=Math.hypot(o,r);return n<.001?{x:0,z:1}:{x:o/n,z:r/n}}function rn(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],s=Math.hypot(r,n,i)||1;r/=s,n/=s,i/=s;let a=-i,l=r,d=Math.hypot(a,l);if(d<1e-6)return 1/0;a/=d,l/=d;let p=1/0,h=-1/0;for(let b=0;b<8;b++){let c=(b&1?o.max[0]:o.min[0])-t[0],u=(b&2?o.max[1]:o.min[1])-t[1],P=(b&4?o.max[2]:o.min[2])-t[2],F=Math.max(cn,c*r+u*n+P*i),A=(c*a+P*l)/F;A<p&&(p=A),A>h&&(h=A)}return h-p}function an(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],s=Math.hypot(r,n,i)||1;r/=s,n/=s,i/=s;let a=-i,l=r,d=Math.hypot(a,l);if(d<1e-6)return 1/0;a/=d,l/=d;let p=-l*n,h=l*r-a*i,b=a*n,c=1/0,u=-1/0;for(let P=0;P<8;P++){let F=(P&1?o.max[0]:o.min[0])-t[0],A=(P&2?o.max[1]:o.min[1])-t[1],k=(P&4?o.max[2]:o.min[2])-t[2],f=Math.max(cn,F*r+A*n+k*i),M=(F*p+A*h+k*b)/f;M<c&&(c=M),M>u&&(u=M)}return u-c}function it(t,e){return Math.tan(t*we/2)*Math.max(.05,e)}function sn(t,e,o){let r=qr(o,t),n=l=>Math.max(Wr,Math.min(r,l)),i=l=>2*Math.atan(l)/we,s=Number.isFinite(t)&&t>0?n(i(t/(2*jr)/Math.max(.05,o))):r;if(!(Number.isFinite(e)&&e>0))return s;let a=Math.min(s,n(i(e/(2*ei))));return t/(2*it(a,o))>rt?s:a}function mn(t,e,o){let r=zt(e),n=[t[0],t[1],t[2]],i=0,s=0,a=c=>{if(!(c>0))return;let u=dn(n,r);n[0]+=u.x*c,n[2]+=u.z*c,s+=c},l=e.max[1]+Kr-n[1];l>0&&(n[1]+=l,i=l,a(l/Math.tan(Qr)));let d=ii(e),p=rn(n,r,e),h=sn(p,an(n,r,d),o),b=p/(2*it(h,o));for(let c=0;c<ri&&b>rt;c++){let u=Math.max(1,Math.hypot(n[0]-r[0],n[2]-r[2])),P=Number.isFinite(b)?b/rt:2;a(Math.min(60,u*(Math.min(4,P)-1)+.5)),p=rn(n,r,e),h=sn(p,an(n,r,d),o),b=p/(2*it(h,o))}return{eye:n,focal:r,fov:h,raisedM:i,pulledBackM:s,stageFrameWidth:b}}function ai(t,e,o){let r=Math.tan(e*we/2),n=it(e,o);return Math.max(1,t/Math.max(.05,Math.min(r,n)))}function pn(t,e){let{aspect:o,venue:r}=e,n=t.focal,i=dn(t.eye,n),s=b=>(b[0]-n[0])*i.x+(b[2]-n[2])*i.z,a=[{name:"seat",eye:t.eye,focal:n,fov:t.fov}],l=ni*(e.rowDepthM??ti);a.push({name:"row",eye:[t.eye[0]+i.x*l,t.eye[1]+oi,t.eye[2]+i.z*l],focal:n,fov:t.fov});let d=(b,c,u,P)=>{let F=ai(u,t.fov,o)*1.08,A=F*Math.sin(P*we),k=F*Math.cos(P*we);return{name:b,eye:[c[0]+i.x*k,c[1]+A,c[2]+i.z*k],focal:c,fov:t.fov}};e.section&&e.section.radius>0&&a.push(d("section",e.section.center,e.section.radius,14)),a.push(d("venue",r.center,Math.max(1,r.radius),26));let p=[],h=-1/0;for(let b of a){let c=s(b.eye);p.length&&c<=h+.5||(p.push(b),h=c)}return p}import{Vec3 as si}from"ogl";var He=Math.PI/180,hn=320,fn=70*He,li=32*He,ci=24*He,vn=.0026,ui=.22,di=.006,mi=180,pi=4,se=(t,e,o)=>Math.max(e,Math.min(o,t)),bn=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function gn(t){let{canvas:e,camera:o}=t,r=[],n=!1,i=0,s=0,a=0,l=0,d=0,p=0,h=!1,b=[0,0],c=0,u=!1,P=null,F=null,A=new Map,k=!1,f=0,M=0,C=0,O=0,x=()=>n&&r.length?r[se(Math.round(i),0,r.length-1)].name:null,w=()=>{let g=x();g!==P&&(P=g,t.onStopChange?.(g))},D=()=>{if(!n||!r.length)return;let g=r[se(Math.floor(i),0,r.length-1)],z=r[se(Math.ceil(i),0,r.length-1)],$=se(i-Math.floor(i),0,1),U=(ve,ct)=>ve+(ct-ve)*$,ee=[U(g.eye[0],z.eye[0]),U(g.eye[1],z.eye[1]),U(g.eye[2],z.eye[2])],Z=[U(g.focal[0],z.focal[0]),U(g.focal[1],z.focal[1]),U(g.focal[2],z.focal[2])],le=Z[0]-ee[0],oe=Z[1]-ee[1],J=Z[2]-ee[2],I=Math.hypot(le,oe,J)||1,N=Math.atan2(le,J),B=Math.asin(se(oe/I,-1,1)),_=N+s,G=se(B+a,-80*He,80*He),Q=Math.cos(G)*I;le=Math.sin(_)*Q,oe=Math.sin(G)*I,J=Math.cos(_)*Q,o.position.set(ee[0],ee[1],ee[2]),o.fov=U(g.fov,z.fov),o.updateProjectionMatrix(),o.lookAt(new si(ee[0]+le,ee[1]+oe,ee[2]+J)),t.onApplied?.()},L=()=>{if(!n||!r.length)return;let g=se(Math.round(i),0,r.length-1);if(t.reducedMotion()){h=!1,i=g,D(),w(),t.requestRender();return}if(Math.abs(g-i)<.001){h=!1,w();return}l=i,d=g,p=performance.now(),h=!0,t.requestRender()},R=g=>{!n||r.length<2||(h=!1,i=se(i+g,0,r.length-1),D(),w(),t.requestRender())},K=(g,z)=>{n&&(h=!1,u=!1,s=se(s-g*vn,-fn,fn),a=se(a-z*vn,-ci,li),D(),t.requestRender())},H=g=>{n&&(A.set(g.pointerId,{x:g.clientX,y:g.clientY}),A.size===1?(k=!0,O=0,f=g.clientX,M=g.clientY):A.size===2&&(k=!1,C=V()))},V=()=>{let g=[...A.values()];return g.length<2?0:Math.hypot(g[0].x-g[1].x,g[0].y-g[1].y)},Y=g=>{if(!n||!A.has(g.pointerId))return;if(A.set(g.pointerId,{x:g.clientX,y:g.clientY}),A.size>=2){let U=V();C>0&&R((C-U)*di),C=U;return}if(!k)return;let z=g.clientX-f,$=g.clientY-M;f=g.clientX,M=g.clientY,O+=Math.abs(z)+Math.abs($),!(O<=pi)&&K(z,$)},y=g=>{A.delete(g.pointerId)&&(A.size<2&&(C=0),A.size===0&&(k=!1,L()))},S=g=>{if(!n)return;g.preventDefault();let z=g.deltaMode===1?16:g.deltaMode===2?100:1,$=se(g.deltaY*z/100,-2,2);R($*ui),F&&clearTimeout(F),F=setTimeout(()=>{F=null,L()},mi)},X=()=>{n&&(n=!1,h=!1,u=!1,r=[],A.clear(),k=!1,F&&(clearTimeout(F),F=null),P!==null&&(P=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",H),e.addEventListener("pointermove",Y),e.addEventListener("pointerup",y),e.addEventListener("pointercancel",y),e.addEventListener("wheel",S,{passive:!1}),{get active(){return n},enter(g){if(g.length<2){X();return}r=g,n=!0,i=0,s=0,a=0,h=!1,u=!1,P=null,D(),w(),t.requestRender()},exit:X,recentre(){return n?Math.abs(s)<1e-4&&Math.abs(a)<1e-4?!0:t.reducedMotion()?(u=!1,s=0,a=0,D(),t.requestRender(),!0):(b=[s,a],c=performance.now(),u=!0,t.requestRender(),!0):!1},update(g){if(!n)return!1;let z=!1;if(u){let $=se((g-c)/hn,0,1),U=1-bn($);s=b[0]*U,a=b[1]*U,$>=1?(u=!1,s=0,a=0):z=!0}if(h){let $=se((g-p)/hn,0,1);i=l+(d-l)*bn($),$>=1?(h=!1,i=d,w()):z=!0}return D(),z},currentStop:x,dispose(){X(),e.removeEventListener("pointerdown",H),e.removeEventListener("pointermove",Y),e.removeEventListener("pointerup",y),e.removeEventListener("pointercancel",y),e.removeEventListener("wheel",S)}}}function yn(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var Nt=null;function xn(){return Nt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw Nt=null,t}),Nt}var Sn=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),at=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,o){if(this.cb)try{this.cb(e,o)}catch{}}opened(e,o,r,n){this.emit("3d_opened",{seats:e,hasHeights:o,...r===void 0?{}:{buildMs:Math.round(r)},...n===void 0?{}:{prepSource:n}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,o){this.emit("3d_seat_picked",{seatId:e,sectionId:o})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Sn(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Sn()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,o){this.emit("3d_panorama_failed",{seatId:e,phase:o})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function wn(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Mn(t){let{container:e,model:o,opts:r,expandedSeatById:n,seatIdsByRow:i,isNarrow:s}=t,a=null,l=()=>{if(!a)return;let h=s();Object.assign(a.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},d=()=>{a?.remove(),a=null};return{show:(h,b,c=!1)=>{if(d(),t.isDisposed())return null;let u=document.createElement("div");u.setAttribute("role","group"),Object.assign(u.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let P=r.chrome?.caption!==!1,F=r.chrome?.seatStepper!==!1;if(!P&&!F)return null;let A=n.get(h),k=A?.sectionId?o.sections.find(L=>L.id===A.sectionId):void 0,f=A?.label??h;u.setAttribute("aria-label",`Explore views near ${k?.label?`${k.label}, `:""}seat ${f}`);let M=document.createElement("span");M.textContent=r.seatViewCaption?.(h)??["Live 3D seat view",k?.label,f].filter(Boolean).join(" \xB7 "),Object.assign(M.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),P&&u.appendChild(M);let C=document.createElement("div");Object.assign(C.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),u.appendChild(C);let O=A?.rowId?i.get(A.rowId):void 0,x=O?.indexOf(h)??-1,w=x>=0?[O?.[x-1],O?.[x+1]]:[void 0,void 0],D=(L,R,K,H=!1)=>{let V=document.createElement("button");V.type="button",V.textContent=L,V.setAttribute("aria-label",R),Object.assign(V.style,{minHeight:"44px",padding:H?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),H||(V.style.minWidth="44px"),H&&(V.dataset.panoramaTrigger=""),V.addEventListener("click",K),C.appendChild(V)};if(F&&w[0]){let L=n.get(w[0])?.label??w[0];D("\u2039",`View previous seat ${L}`,()=>{t.flyToSeat(w[0])})}if(F&&r.getSeatView){let L=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";D(c?`\u21BB Retry ${L}`:`\u25C9 ${L}`,`${c?"Retry":L} from seat ${f}`,()=>{if(t.isDisposed()||b!==t.flightGen()){d();return}d(),t.openPanorama(h,400,b)},!0)}if(F&&w[1]){let L=n.get(w[1])?.label??w[1];D("\u203A",`View next seat ${L}`,()=>{t.flyToSeat(w[1])})}return!C.childElementCount&&!P?null:(e.appendChild(u),a=u,l(),u)},remove:d,layout:l}}var hi={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Pn(t){let{container:e,orbit:o,isNarrow:r}=t,n={...hi,...t.labels??{}},i=(f,M)=>{f.setAttribute("aria-label",M),f.title=M},s=document.createElement("div"),a=!1;s.className="sl-3d-navigation-controls",Object.assign(s.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let d=document.createElement("div");d.setAttribute("role","group"),d.setAttribute("aria-label","3D view controls"),Object.assign(d.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let p=document.createElement("button");p.type="button",p.textContent="\u21BB",i(p,n.rotate);let h=document.createElement("button");h.type="button",h.textContent="\u2725",i(h,n.move);let b=document.createElement("button");b.type="button",b.textContent="\u2212",i(b,n.zoomOut);let c=document.createElement("button");c.type="button",c.textContent="+",i(c,n.zoomIn);for(let f of[p,h,b,c])f.className="sl-3d-icon-control",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(p,h),d.append(c,b);let u=f=>{o.setPrimaryDragMode(f);let M=f==="orbit";p.setAttribute("aria-pressed",String(M)),h.setAttribute("aria-pressed",String(!M)),p.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",h.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",s.title=M?`${n.rotate} \xB7 ${n.move} with Shift`:`${n.move} \xB7 ${n.rotate} with Shift`};p.addEventListener("click",()=>u("orbit")),h.addEventListener("click",()=>u("pan"));let P=()=>{let{atMin:f,atMax:M}=o.dollyLimitState();c.disabled!==f&&(c.disabled=f),b.disabled!==M&&(b.disabled=M)};b.addEventListener("click",()=>{o.zoomBy(Le),P()}),c.addEventListener("click",()=>{o.zoomBy(Ce),P()}),s.append(l,d),u("orbit"),e.appendChild(s);let F=t.enabled!==!1,A=()=>{let f=r();s.style.display=a||!F?"none":"flex",s.style.right=f?"12px":"14px",s.style.bottom=f?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=f?"none":"flex",c.style.display=f?"none":"",b.style.display=f?"none":""};return A(),{element:s,utilityControls:d,setNavigationMode:u,syncZoomLimits:P,setSeatViewLocked:f=>{a=f,o.setInteractionEnabled(!f),A()},seatViewLocked:()=>a,layout:A}}var fi=12;function vi(t,e){if(!t)return!1;let o=t.x-e[0],r=t.y-e[1],n=t.z-e[2];return Math.hypot(o,r,n)>fi}function Cn(t){let{glctx:e,orbit:o,model:r,seats:n,opts:i,cinematic:s,analytics:a,seatIdByIndex:l,sectionIdBySeatId:d,tapSlop:p,tapMs:h,cancelFlight:b,focusSectionCamera:c,setSelection:u,ensureSeatView:P}=t,F=0,A=0,k=0,f=-1,M=!1,C=!1,O=R=>{t.seatViewLocked()||f===-1&&(f=R.pointerId,F=R.clientX,A=R.clientY,k=performance.now(),M=!1,C=s.active,s.active&&(a.cinematicCancelled(),b(),i.onViewTargetChange?.(null)))},x=R=>{R.pointerId===f&&Math.hypot(R.clientX-F,R.clientY-A)>p&&(M=!0)},w=(R,K,H,V,Y)=>{let y=e.canvas.getBoundingClientRect(),S=e.canvas.clientWidth||y.width||1,X=e.canvas.clientHeight||y.height||1,g=R-y.left,z=K-y.top,$=V*V,U=-1,ee=$,Z=1/0;for(let le of n){if(H&&le.sectionId!==H)continue;let oe=r.seats.idToIndex.get(le.id);if(oe===void 0)continue;if(Y){let G=Math.round(r.seats.iState[oe]??0);if(G!==0&&G!==3)continue}let J=oe*3,I=fe(o.camera.projectionViewMatrix,[r.seats.iPosition[J],r.seats.iPosition[J+1]+.55,r.seats.iPosition[J+2]],S,X);if(!I.visible)continue;let N=I.x-g,B=I.y-z,_=N*N+B*B;(_<ee||Math.abs(_-ee)<1&&I.depth<Z)&&(U=oe,ee=_,Z=I.depth)}return U},D=(R,K)=>{let H=t.gpu(),V=t.pick();if(!H||!V)return-1;V.syncFromSeatProgram(H.seatProgram);let Y=e.canvas.getBoundingClientRect(),y=e.renderer.dpr,{x:S,y:X}=Uo(R,K,Y,y,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),g=Math.max(2,Math.round(8*y));return V.pick(o.camera,S,X,g)};return{onDown:O,onMove:x,onUp:R=>{if(R.pointerId!==f)return;let K=!M&&performance.now()-k<h;if(f=-1,C){C=!1;return}let H=t.gpu(),V=t.pick();if(!K||!H||!V)return;let Y=D(R.clientX,R.clientY);if(t.focusedSectionId()&&Y>=0){let X=l[Y],g=X?d.get(X):void 0;if(g&&g!==t.focusedSectionId()&&c(g))return}if(t.focusedSectionId()&&Y<0&&(Y=w(R.clientX,R.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&Y<0){let X=w(R.clientX,R.clientY,null,72,!1),g=X>=0?l[X]:void 0,z=g?d.get(g):void 0;if(z&&z!==t.focusedSectionId()&&c(z))return}if(!t.focusedSectionId()){Y<0&&(Y=w(R.clientX,R.clientY,null,42,!1));let X=Y>=0?l[Y]:void 0,g=X?d.get(X):void 0;if(g&&c(g))return}if(Y<0||Y>=l.length){t.selection().size&&(u([]),i.onViewTargetChange?.(null));return}let y=l[Y],S=me[Math.round(r.seats.iState[Y]??0)]??"available";if(S!=="available"&&S!=="selected"){i.onSeatInspect?.(y,S);return}if(t.selection().has(y)&&t.selection().size===1){u([]),i.onViewTargetChange?.(null),i.onSeatPick?.(y);return}if(u([y]),P(y),a.seatPicked(y,d.get(y)),i.onSeatPick?.(y),t.focusedSectionId()){let X=Y*3,g=[r.seats.iPosition[X],r.seats.iPosition[X+1],r.seats.iPosition[X+2]];vi(o.camera?.position,g)&&t.focusSeatCamera(y)}}}}var st=class{constructor(e,o){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=o}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,o=1/0,r=1/0,n=-1/0,i=-1/0;for(let c=0;c<this.count;c++){let u=e[c*3],P=e[c*3+2];u<o&&(o=u),u>n&&(n=u),P<r&&(r=P),P>i&&(i=P)}let s=Math.max(n-o,.001),a=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(s*a*4/this.count),.25),this.cols=Math.max(1,Math.ceil(s/this.cell)+1),this.rows=Math.max(1,Math.ceil(a/this.cell)+1),this.minX=o,this.minZ=r;let l=this.cols*this.rows,d=new Int32Array(l+1),p=c=>{let u=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-o)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-r)/this.cell)))*this.cols+u};for(let c=0;c<this.count;c++)d[p(c)+1]++;for(let c=0;c<l;c++)d[c+1]+=d[c];let h=new Int32Array(this.count),b=d.slice(0,l);for(let c=0;c<this.count;c++)h[b[p(c)]++]=c;this.cellStart=d,this.cellItems=h}gather(e,o,r,n){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let a=n.length,l=r*r,d=Math.floor((e-this.minX)/this.cell),p=Math.floor((o-this.minZ)/this.cell),h=Math.ceil(r/this.cell)+1,b=this.iPosition,c=0;for(let u=0;u<=h&&c<a;u++){let P=p-u,F=p+u,A=d-u,k=d+u;for(let f=P;f<=F&&c<a;f++){if(f<0||f>=this.rows)continue;let M=f===P||f===F;for(let C=A;C<=k&&c<a;C++){if(!M&&C!==A&&C!==k){C=k-1;continue}if(C<0||C>=this.cols)continue;let O=f*this.cols+C;for(let x=i[O],w=i[O+1];x<w&&c<a;x++){let D=s[x],L=b[D*3]-e,R=b[D*3+2]-o;L*L+R*R<=l&&(n[c++]=D)}}}}return c}};var lt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array($e);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new st(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let o=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&o?.nearSeatCount()&&o.setNearSeats(this.nearBuf,0)}update(e){let{model:o}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let n=this.ctx.orbit().camera.position;if(Math.hypot(n.x-this.lastGatherX,n.z-this.lastGatherZ)<At)return;if(this.lastGatherX=n.x,this.lastGatherZ=n.z,Math.hypot(n.x-o.bounds.center[0],n.z-o.bounds.center[2])-o.bounds.radius>Ct){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.nearIndex.gather(n.x,n.z,Ct,this.nearBuf);a===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,a)}ease(e,o,r){let n=1-Math.exp(-e*9),i=1-Math.exp(-e*20);this.seatDetailMix+=(o-this.seatDetailMix)*(o>this.seatDetailMix?n:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?n:i),Math.abs(o-this.seatDetailMix)<.01&&(this.seatDetailMix=o),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};import{Quat as bi,Vec3 as gi}from"ogl";function An(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let o=document.createElementNS(t,"path");return o.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(o),e}function Dn(t){let{container:e,model:o,opts:r,orbit:n,cinematic:i,analytics:s,loop:a,labelOverlay:l,stageAzimuth:d,overviewFraming:p}=t,h=0,b=-1,c=(x,w,D=28)=>{n.camera.position.set(x[0],x[1],x[2]),n.camera.lookAt(new gi(w[0],w[1],w[2])),n.camera.fov=D,n.camera.updateProjectionMatrix()},u=document.createElement("button");u.className="sl-3d-overview-control sl-3d-icon-control",u.type="button",u.replaceChildren(An());let P=r.navLabels?.fitView??"Show whole venue";u.setAttribute("aria-label",P),u.title=P,Object.assign(u.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let F=()=>{u.firstElementChild||u.replaceChildren(An())};F();let A=x=>{b=x;let w=t.gpu();w&&(w.seatProgram.uniforms.uFocusFloor.value=x,w.solidProgram.uniforms.uFocusFloor.value=x,w.chairProgram.uniforms.uFocusFloor.value=x),t.showSectionSeatLabels(null)},k=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),s.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),u.style.display="",l.setVisible(!0),t.setFrozen(!1);let x=b>=0?o.floors[b]:null;if(t.setNearFieldDetailEnabled(!!x),t.setSeatViewLocked(!1),f(),t.removeArriveChip(),t.setNavigationMode("orbit"),x){let w=x.focalWorld[0]-x.center[0],D=x.focalWorld[2]-x.center[2],L=Math.hypot(w,D)>x.radius*.12?Math.atan2(w,D):d,R={center:x.center,radius:x.radius,box:x.box},K={polarDeg:58,margin:1.12};t.reducedMotion()?n.frame(R,!1,L,!1,K):n.frameSoft(R,L,!1,K)}else t.reducedMotion()?n.frame(o.bounds,!1,d,r.portraitOverviewCrop===!0,p):n.frameSoft(o.bounds,d,r.portraitOverviewCrop===!0,p);t.showSectionSeatLabels(null),a.requestRender()},f=()=>{h++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),n.resumeAfterFlight(o.focalWorld))},M=x=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let w=o.seats.idToIndex.get(x);if(w===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(x),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),u.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let D=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(D),t.setSeatViewLocked(!1);let L=++h;D?t.showArriveChip(x,L):t.removeArriveChip();let{eye:R,focal:K}=t.resolvedSeatViewPose(x,w),H=r.arriveAtSeatEye?t.seatViewArrival(x,w):null,V=H?H.focal:K,Y=[n.camera.position.x,n.camera.position.y,n.camera.position.z],y=kt(Y,H?.eye??R,V,o.bounds.center,o.bounds.radius),S=H?H.eye:r.arriveAtSeatEye?R:y.finalPos,X=H?H.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?nt:65:28,g=[y.waypoints[0],y.waypoints[1],S];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),c(S,V,X),a.requestRender(),s.cinematicSkipped(),t.isDisposed()||n.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),H&&t.enterSeatView(H.stops),t.showArriveChip(x,L),Promise.resolve();let z=new bi().copy(n.camera.quaternion),$=Zo(n.camera,S,V);a.requestRender();let U=D?700:2500;return i.start(g,z,$,U,X).then(()=>{t.isDisposed()||L!==h||(t.setSeatStepping(!1),s.cinematicPlayed(U),n.resumeAfterFlight(V),t.setSeatViewLocked(r.arriveAtSeatEye===!0),H&&t.enterSeatView(H.stops),a.requestRender(),t.showArriveChip(x,L))})},C=x=>{let w=o.sections.find(K=>K.id===x);if(!w||w.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),o.floors.length>1&&b!==w.floorIndex&&A(w.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(x);let D=w.focalWorld[0]-w.center[0],L=w.focalWorld[2]-w.center[2],R=Math.hypot(D,L)>w.radius*.12?Math.atan2(D,L):void 0;return n.frame({center:w.center,radius:Math.max(5,w.radius*.5)},!1,R),r.onSectionFocusChange?.(x),a.requestRender(),!0},O=x=>{if(t.isDisposed()||!t.gpu())return!1;let w=o.seats.idToIndex.get(x);if(w===void 0)return!1;let D=w*3,L=[o.seats.iPosition[D],o.seats.iPosition[D+1]+.55,o.seats.iPosition[D+2]];return t.reducedMotion()?n.frame({center:L,radius:En},!1,void 0,!1,Rn):n.frameSoft({center:L,radius:En},void 0,!1,Rn),a.requestRender(),!0};return u.addEventListener("click",k),{overviewChip:u,layoutOverviewChip:F,flightGen:()=>h,focusedFloor:()=>b,applyFloorFocus:A,placeCameraFinal:c,cancelFlight:f,focusOverview:k,flyToSeat:M,focusSectionCamera:C,focusSeatCamera:O}}var En=4.5,Rn={polarDeg:48,margin:1.25};function Fn(t){let e=performance.now();return{model:Ve(t),buildMs:performance.now()-e,source:"main"}}function yi(t){let e=jt(t.doc);return{...Fn({...t,seats:e}),seats:e}}function Tn(t,e,o){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(n=>{let i=!1,s=d=>{i||(i=!0,clearTimeout(l),r.terminate(),n(d))},a=()=>s(e()),l=window.setTimeout(a,15e3);r.onerror=a,r.onmessage=d=>{let p=o(d.data);p?s(p):a()},r.postMessage(t)})}function xi(t){return Tn(t,()=>Fn(t),({model:e,buildMs:o})=>({model:e,buildMs:o,source:"worker"}))}function Si(t){return Tn(t,()=>yi(t),({model:e,buildMs:o,seats:r})=>r?{model:e,buildMs:o,seats:r,source:"worker"}:null)}var wi=Math.PI/180,Mi=6,Pi=500;function Ss(t,e,o={}){let r=performance.now(),n=e.prepared?.model??Ve(e),i=new at(o.onAnalytics),s=new Array(n.seats.count);for(let[m,v]of n.seats.idToIndex)s[v]=m;let a=new Map(e.seats.map(m=>[m.id,m])),l=new Map;for(let m of e.seats){if(!m.rowId)continue;let v=l.get(m.rowId);v?v.push(m.id):l.set(m.rowId,[m.id])}let d=new Map;for(let m of e.seats)d.set(m.id,m.sectionId);let p=new Map;for(let[m,v]of n.seats.idToIndex){let E=d.get(m);if(!E)continue;let W=p.get(E);W?W.push(v):p.set(E,[v])}let h=()=>{if(!c||!n.sectionSolidRanges.length)return;let{lit:m,anyUnlit:v}=Oo(n.sectionSolidRanges,p,n.seats.iState);c.setSectionShellLit(v?m:null)},b=e.doc.floors?.some(v=>(v.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(v=>v.objects)??e.doc.objects).some(v=>v.type==="section"&&((v.height??0)>0||(v.rake??0)>0)),c=null,u=null,P=!1,F=!1,A=!1,k=new Map,f=null,M=null,C=null,O=new Map,x=null,w=()=>{C===null&&(C=t.style.zIndex,t.style.zIndex="20")},D=()=>{C!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=C),C=null)},L=!1,R=()=>L?re.focusedFloor():-1,K=()=>{c=Go(y.gl,n),h(),u=new tt(y.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,n.seats.count),y.setClearColor(n.theme.background.top),u.setRestoreClear(n.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=_e*n.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=R(),c.solidProgram.uniforms.uFocusFloor.value=R(),c.chairProgram.uniforms.uFocusFloor.value=R(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=R()),V.forceRegather()},H=!1,V=new lt({model:n,orbit:()=>S,gpu:()=>c}),Y=m=>V.setDetailEnabled(m),y=new je(t,{onContextLost:()=>{A||i.contextLost(),P=!0,_.stop(),c=null,u=null},onContextRestored:()=>{K(),P=!1,A||i.contextRestored(),_.requestRender()}}),S=new Ke(y.gl,y.canvas,()=>_.requestRender(),()=>i.orbitEngaged());S.setAspect(y.aspect);let X=(e.doc.floors?.flatMap(m=>m.objects)??e.doc.objects).some(m=>m.type==="section"&&m.physical3dProvenance?.surfaceKind?.status==="inferred"),g=(()=>{if(X&&n.stages.length===0)return;let m=n.focalWorld[0]-n.bounds.center[0],v=n.focalWorld[2]-n.bounds.center[2];return Math.hypot(m,v)>n.bounds.radius*.12?Math.atan2(m,v):void 0})(),z=n.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},$=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;S.frame(n.bounds,!$&&o.skipInitialOverviewAnimation!==!0,g,o.portraitOverviewCrop===!0,z);let U=new ot(S.camera),ee=wn(t),Z=new Je(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:n.theme.background.top}),le=n.labels,oe=()=>oo(le,n.floors.length,R());Z.setLabels(oe());let J=null,I=m=>{if(J=m,Z.setForcedDense(!!m),!m){Z.setLabels(oe());return}let v=e.seats.filter(T=>T.sectionId===m),E=new Set(v.map(T=>T.id)),W=new Set(v.map(T=>T.rowId)),q=new Set(k.keys()),j=new Set(v.filter(T=>q.has(T.id)).map(T=>T.id)),te=oe().filter(T=>T.kind!=="row"&&T.kind!=="seat"||(T.kind==="row"?W.has(T.id.slice(4)):E.has(T.id.slice(5))&&(j.size===0||j.has(T.id.slice(5)))));if(n.seatCount<=6e3&&j.size===0){Z.setLabels(te);return}let ne=j.size?v.filter(T=>j.has(T.id)):v,ge=new Set(ne.map(T=>`seat:${T.id}`)),he=ne.flatMap(T=>{let ae=n.seats.idToIndex.get(T.id);if(ae===void 0)return[];let ce=ae*3;return[{id:`seat:${T.id}`,kind:"seat",text:q.has(T.id)?T.displayLabel||T.label:uo(T.displayLabel||T.label),anchor:[n.seats.iPosition[ce],n.seats.iPosition[ce+1]+(q.has(T.id)?1.05:.55),n.seats.iPosition[ce+2]]}]});Z.setLabels([...te.filter(T=>!ge.has(T.id)),...he])};K();let N=null,B=null,_=new Qe(m=>{if(P||!c||F)return!1;let v=yn({flying:U.active,panoramaMounted:f!==null,seatViewActive:N?.active===!0}),E=v==="cinematic"?U.update(performance.now()):v==="seatView"?N.update(performance.now()):v==="orbit"?S.update():!1;B?.syncZoomLimits();let W=R()>=0?n.floors[R()]:null,q=W?.radius??n.bounds.radius,j=yo(S.currentDistance,q),te=H?{center:[S.camera.position.x,S.camera.position.y,S.camera.position.z],radius:520}:n.renderBounds;S.updateClipping(te);let ne=W?.center??n.renderBounds.center,ge=W?.radius??n.renderBounds.radius,he=(ue,Ie)=>Math.hypot(S.camera.position.x-ue[0],S.camera.position.y-ue[1],S.camera.position.z-ue[2])<=Ie*(V.detailVisible?1.8:1.55),T=he(ne,ge);if(!T&&J){let ue=n.sections.find(Ie=>Ie.id===J);ue&&(T=he(ue.center,Math.max(12,ue.radius*2)))}V.detailVisible=T;let ae=c.seatProgram.uniforms;ae.uSeatScale.value=j.scale,ae.uSeatFade.value=j.fade;let ce=!!W&&xo(W.seatCount,y.canvas.clientWidth||1,y.canvas.clientHeight||1),We=So(n.seats.count,q,S.currentDistance,S.camera.fov,y.canvas.clientHeight||1),Te=V.detailVisible||ce||We?1:0,Ye=V.detailVisible||R()>=0||n.floors.length>1?1:0;return V.ease(m,Te,Ye),ae.uSeatDetail.value=V.seatDetailMix,c.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,ae.uMinPixels.value=j.minPixels,ae.uPixelToWorld.value=2*Math.tan(S.camera.fov*wi/2)/Math.max(1,y.pixelHeight),V.update(V.detailVisible),y.renderer.render({scene:c.background,clear:!0}),y.renderer.render({scene:c.main,camera:S.camera,clear:!1}),Z.update(S.camera.projectionViewMatrix,y.canvas.clientWidth||1,y.canvas.clientHeight||1,S.currentDistance,q,[S.camera.position.x,S.camera.position.y,S.camera.position.z]),E||V.seatDetailMix!==Te||V.structureDetailMix!==Ye}),G=typeof ResizeObserver<"u"?new ResizeObserver(()=>vt.resize()):null;G?.observe(t);let Q=m=>{let v=q=>{let j=n.seats.idToIndex.get(q);return j===void 0?void 0:n.seats.iState[j]},{updates:E,next:W}=Yo(k,m,v);if(k=W,Z.setSelectedSeatIds(k.keys()),J&&I(J),E.length){let q=xt(n.seats,E);c&&c.uploadSeatStateRuns(q),h(),_.requestRender()}},ve=()=>x!==null?x:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ct=8,Bt=m=>{if(!o.getSeatView)return null;let v=O.get(m);if(!v)for(v=Promise.resolve(o.getSeatView(m)),O.set(m,v),v.catch(()=>{O.get(m)===v&&O.delete(m)});O.size>ct;){let E=O.keys().next().value;if(E===void 0)break;O.delete(E)}return v},Gt=un(n.stages,n.focalWorld,n.bounds.groundY??0),In=zt(Gt),ut=(m,v)=>{let E=a.get(m),W=Math.max(0,Math.round(n.seats.iFloor[v]??0)),q=e.doc.floors?.[W],j=n.floors[W],te=q?.focalPoint??e.doc.focalPoint,ne=j?{x:j.focalWorld[0]/Me,y:j.focalWorld[2]/Me}:te,ge=E?.focalPoint?{x:E.focalPoint.x+ne.x-te.x,y:E.focalPoint.y+ne.y-te.y}:ne,he=[n.seats.iPosition[v*3],n.seats.iPosition[v*3+1],n.seats.iPosition[v*3+2]];return en(he,ge,q?.baseHeightM??0,E?.eyeHeightM,In)},Ht=()=>(t.clientWidth||y.canvas.clientWidth)<=520,dt=null,Ut=null,_n=async(m,v,E)=>{if(!o.getSeatView||A||E!==re.flightGen())return;let W;try{W=await xn()}catch{if(i.panoramaFailed(m,"mount"),!A&&E===re.flightGen()){let q=pt(m,E,!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(A||E!==re.flightGen()||!dt))return Ut??=W.createOpenPanorama(dt),Ut(m,v,E)},mt=Mn({container:t,model:n,opts:o,expandedSeatById:a,seatIdsByRow:l,isNarrow:Ht,isDisposed:()=>A,flightGen:()=>re.flightGen(),flyToSeat:m=>Xt(m),openPanorama:(m,v,E)=>_n(m,v,E)}),pt=mt.show,ht=mt.remove,Vn=mt.layout,be=Pn({container:t,orbit:S,isNarrow:Ht,enabled:o.chrome?.controlDock!==!1,...o.navLabels?{labels:o.navLabels}:{}});B=be;let Ln=be.element,De=be.setNavigationMode,kn=be.layout,On=be.utilityControls,Fe=null,Wt=!1,Ue=m=>{be.setSeatViewLocked(m),m||N?.exit()};N=gn({canvas:y.canvas,camera:S.camera,requestRender:()=>_.requestRender(),reducedMotion:ve,onStopChange:m=>{let v=m??(Wt?"seat":null);Fe=v;try{o.onSeatViewStopChange?.(v)}catch{}},onApplied:()=>{A||S.syncFromCamera()}});let zn=(m,v)=>{let{eye:E}=ut(m,v),W=(t.clientWidth||y.canvas.clientWidth||1)/Math.max(1,t.clientHeight||y.canvas.clientHeight||1),q=mn(E,Gt,W);if(o.seatViewStops===!1)return{...q,stops:[]};let j=d.get(m),te=j?n.sections.find(ne=>ne.id===j):void 0;return{...q,stops:pn(q,{aspect:W,section:te&&te.seatCount>0?{center:te.center,radius:te.radius}:null,venue:{center:n.bounds.center,radius:n.bounds.radius}})}},re=Dn({container:t,model:n,opts:o,orbit:S,cinematic:U,analytics:i,loop:_,labelOverlay:Z,stageAzimuth:g,overviewFraming:z,gpu:()=>c,isDisposed:()=>A,panorama:()=>f,setPanorama:m=>{f=m},setPanoramaSphereVisible:m=>{H=m},panoramaLoadAbort:()=>M,setPanoramaLoadAbort:m=>{M=m},setFrozen:m=>{F=m},restorePanoramaLayer:D,reducedMotion:ve,resolvedSeatViewPose:ut,showSectionSeatLabels:I,setNearFieldDetailEnabled:Y,setSeatViewLocked:Ue,setNavigationMode:De,showArriveChip:pt,removeArriveChip:ht,inSeatView:()=>Fe!==null,setSeatStepping:m=>{Wt=m},seatViewArrival:(m,v)=>o.arriveAtSeatEye?zn(m,v):null,enterSeatView:m=>N?.enter(m)});L=!0;let ft=re.overviewChip,Nn=re.layoutOverviewChip,Bn=re.applyFloorFocus,Gn=re.focusOverview,Yt=re.cancelFlight,Xt=re.flyToSeat,qt=re.focusSectionCamera;On.appendChild(ft),dt={container:t,model:n,opts:o,analytics:i,orbit:S,loop:_,seatsById:a,ensureSeatView:Bt,resolvedSeatViewPose:ut,gpu:()=>c,gl:y.gl,isContextLost:()=>P,isDisposed:()=>A,flightGen:()=>re.flightGen(),setPanorama:m=>{f=m},getLoadAbort:()=>M,setLoadAbort:m=>{M=m},setPanoramaSphereVisible:m=>{H=m,m&&N?.exit()},setFrozen:m=>{F=m},raisePanoramaLayer:w,restorePanoramaLayer:D,getOverviewChip:()=>ft,labelOverlay:Z,reducedMotion:ve,removeArriveChip:ht,showArriveChip:pt};let pe=Cn({glctx:y,orbit:S,model:n,seats:e.seats,opts:o,cinematic:U,analytics:i,seatIdByIndex:s,sectionIdBySeatId:d,tapSlop:Mi,tapMs:Pi,gpu:()=>c,pick:()=>u,seatViewLocked:()=>be.seatViewLocked(),focusedSectionId:()=>J,selection:()=>k,cancelFlight:Yt,focusSectionCamera:qt,focusSeatCamera:re.focusSeatCamera,setSelection:Q,ensureSeatView:Bt});y.canvas.addEventListener("pointerdown",pe.onDown),y.canvas.addEventListener("pointermove",pe.onMove),y.canvas.addEventListener("pointerup",pe.onUp),y.canvas.addEventListener("pointercancel",pe.onUp),_.requestRender();let vt={setAvailability(m){let v=Wo(k,m),E=xt(n.seats,v);E.length&&c&&c.uploadSeatStateRuns(E),h(),_.requestRender()},setSelection:Q,setNavigationMode:De,zoomIn(){S.zoomBy(Ce),_.requestRender()},zoomOut(){S.zoomBy(Le),_.requestRender()},flyToSeat:Xt,focusOverview:Gn,seatViewStop:()=>Fe,recentreSeatView:()=>N?.recentre()??!1,resize(){let{width:m,height:v}=y.resize();S.setAspect(m/Math.max(1,v)),Vn(),kn(),Nn(),_.requestRender()},stats(){return{..._.stats(),drawCalls:c?c.drawCalls:0,seatCount:n.seatCount}},getQualityEvidence(){let m=_.stats(),v=y.canvas.clientWidth||1,E=y.canvas.clientHeight||1,W=n.bounds.center,q=fe(S.camera.projectionViewMatrix,[W[0],n.bounds.box.min[1],W[2]],v,E),j=fe(S.camera.projectionViewMatrix,[W[0],n.bounds.box.max[1],W[2]],v,E),te=n.bounds.box,ne=[te.min[0],te.max[0]].flatMap(T=>[te.min[1],te.max[1]].flatMap(ae=>[te.min[2],te.max[2]].map(ce=>fe(S.camera.projectionViewMatrix,[T,ae,ce],v,E)))).filter(T=>Number.isFinite(T.x)&&Number.isFinite(T.y)&&Number.isFinite(T.depth)),ge=ne.length?(()=>{let T=Math.min(...ne.map(ye=>ye.x)),ae=Math.max(...ne.map(ye=>ye.x)),ce=Math.min(...ne.map(ye=>ye.y)),We=Math.max(...ne.map(ye=>ye.y)),Te=Math.max(0,T),Ye=Math.min(v,ae),ue=Math.max(0,ce),Ie=Math.min(E,We),Xe=Math.max(0,Ye-Te),bt=Math.max(0,Ie-ue);return{box:{x:Te,y:ue,width:Xe,height:bt},horizontalFillRatio:Xe/v,verticalFillRatio:bt/E,visibleAreaRatio:Xe*bt/(v*E),clippedEdges:[...ce<0?["top"]:[],...ae>v?["right"]:[],...We>E?["bottom"]:[],...T<0?["left"]:[]]}})():void 0,he=String(y.gl.getParameter(y.gl.VERSION)??"");return{viewport:{width:v,height:E},context:{webgl2:/webgl\s*2/i.test(he),lost:P},frame:{rendered:m.rendered,idle:m.idle},camera:{position:[S.camera.position.x,S.camera.position.y,S.camera.position.z],distance:S.currentDistance,verticalFovDeg:S.fovY},scene:{seatCount:n.seatCount,floorCount:n.floors.length,zoneCount:n.zones.length,sectionCount:n.sections.length,authoredRelief:b,renderedVerticalSpanM:Math.max(0,n.bounds.box.max[1]-n.bounds.box.min[1]),projectedReliefPx:q.visible&&j.visible?Math.abs(q.y-j.y):0},labels:Z.qualityEvidence(),framing:ge,...Fe?{seatView:{fovDeg:S.camera.fov,stop:Fe}}:{}}},getQualityReport(){return Tt(vt.getQualityEvidence())},loseContextForTest(){y.simulateContextLossCycle()},floors(){return n.floors},focusFloor(m){if(m!==null&&!n.floors.some(E=>E.index===m))return!1;let v=m??-1;if(Y(m!==null),Ue(!1),Bn(v),De("orbit"),m===null)U.cancel(),ve()?S.frame(n.bounds,!1,g,o.portraitOverviewCrop===!0,z):S.frameSoft(n.bounds,g,o.portraitOverviewCrop===!0,z);else{let E=n.floors[m];if(E.seatCount>0){U.cancel();let W=E.focalWorld[0]-E.center[0],q=E.focalWorld[2]-E.center[2],j=Math.hypot(W,q)>E.radius*.12?Math.atan2(W,q):g;S.frame({center:E.center,radius:E.radius,box:E.box},!1,j,!1,{polarDeg:58,margin:1.12})}}return _.requestRender(),!0},zones(){return n.zones},focusZone(m){let v=n.zones.find(j=>j.id===m);if(!v||v.seatCount===0)return!1;Y(!1),Ue(!1),U.cancel(),De("orbit"),I(null),o.onSectionFocusChange?.(null);let E=v.focalWorld[0]-v.center[0],W=v.focalWorld[2]-v.center[2],q=Math.hypot(E,W)>v.radius*.12?Math.atan2(E,W):void 0;return S.frame({center:v.center,radius:v.radius*1.25},!1,q),_.requestRender(),!0},sections(){return n.sections},focusSection(m){return qt(m)},rows(m){return m?n.rows.filter(v=>v.sectionId===m):n.rows},seatsInRow(m){return e.seats.filter(v=>v.rowId===m).map(v=>({id:v.id,label:v.displayLabel||v.label}))},focusRow(m){let v=n.rows.find(E=>E.id===m);return!v||v.seatCount===0?!1:(Y(!0),Ue(!1),U.cancel(),De("pan"),v.sectionId&&(I(v.sectionId),o.onSectionFocusChange?.(v.sectionId)),S.frame({center:v.center,radius:Math.max(2.5,v.radius*.65)}),_.requestRender(),!0)},setReducedMotionForTest(m){x=m},dispose(){A=!0,ht(),ft.remove(),Ln.remove(),Yt(),N?.dispose(),_.stop(),Z.dispose(),G?.disconnect(),f&&(f.dispose(),f=null),D(),ee(),y.canvas.removeEventListener("pointerdown",pe.onDown),y.canvas.removeEventListener("pointermove",pe.onMove),y.canvas.removeEventListener("pointerup",pe.onUp),y.canvas.removeEventListener("pointercancel",pe.onUp),S.dispose(),u&&u.dispose(),c&&c.dispose(),c=null,u=null,y.dispose()}};return i.opened(n.seatCount,b,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),vt}export{cr as VENUE3D_QUALITY_REPORT_VERSION,Ve as buildSceneModel,Tt as inspectVenue3DQualityEvidence,Ss as mountVenue3D,xi as prepareVenue3D,Si as prepareVenue3DFromChart};
|
|
785
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:te},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let j=new qe(t,{geometry:Q,program:ie});j.frustumCulled=!1,j.setParent(n),re.screenProgram=ie,ee=!0,re.drawCalls=3+(Z?1:0)+1},k.src=le.contentImageUrl}return re}import{Mesh as Gt,RenderTarget as va,Transform as Ht}from"ogl";function fa(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function mo(t,e,n,r,a,o){let i=-1,s=1/0;for(let l=0;l<n;l++)for(let u=0;u<e;u++){let p=(l*e+u)*4,h=fa(t[p],t[p+1],t[p+2]);if(h<0||h>=o)continue;let v=u-r,f=l-a,c=v*v+f*f;c<s&&(s=c,i=h)}return i}function ho(t,e,n,r,a,o){let i=t-n.left,s=e-n.top,l=Math.round(i*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(a-1,l)),y:Math.max(0,Math.min(o-1,u))}}var ba=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],dt=class{constructor(e,n,r,a,o){this.seatScene=new Ht;this.chairScene=new Ht;this.solidScene=new Ht;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=Zn(this.gl),this.chairProg=Jn(this.gl),this.depthProg=eo(this.gl);let i=new Gt(this.gl,{geometry:n,program:this.seatProg});i.frustumCulled=!1,i.setParent(this.seatScene);let s=new Gt(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new Gt(this.gl,{geometry:a,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of ba)this.seatProg.uniforms[r].value=e.uniforms[r].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new va(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,r,a){let o=this.gl,i=this.ensureTarget(),s=o.drawingBufferWidth,l=o.drawingBufferHeight,u=Math.max(0,n-a),p=Math.max(0,r-a),h=Math.max(1,Math.min(s,n+a+1)-u),v=Math.max(1,Math.min(l,r+a+1)-p);o.enable(o.SCISSOR_TEST),o.scissor(u,p,h,v);let[f,c,b]=this.restoreClear;o.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:i,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:i,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:i,clear:!1}),o.clearColor(f,c,b,1),o.disable(o.SCISSOR_TEST);let E=new Uint8Array(h*v*4);return this.renderer.bindFramebuffer(i),o.readPixels(u,p,h,v,o.RGBA,o.UNSIGNED_BYTE,E),this.renderer.bindFramebuffer(),mo(E,h,v,n-u,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function po(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,dn(r.state)):n.push(r);return n}function fo(t,e,n){let r=new Set;for(let i of e)(t.has(i)||n(i)!==void 0)&&r.add(i);let a=new Map(t),o=[];for(let[i,s]of t)r.has(i)||(o.push({seatId:i,state:be[s]??"available"}),a.delete(i));for(let i of r){if(a.has(i))continue;let s=n(i);s!==void 0&&(a.set(i,s),o.push({seatId:i,state:"selected"}))}return{updates:o,next:a}}import{Quat as je,Vec3 as xa}from"ogl";function ga(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function vo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function ya(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function bo(t){let e=Math.hypot(t[0],t[1],t[2]);return e>1e-6?[t[0]/e,t[1]/e,t[2]/e]:[0,0,0]}function Wt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Ut(t,e){return Math.max(0,Math.min(1,t+e))}function go(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),a=n-1,o=Math.floor(r*a);o>=a&&(o=a-1);let i=r*a-o,s=t[Math.max(0,o-1)],l=t[o],u=t[o+1],p=t[Math.min(n-1,o+2)],h=i*i,v=h*i,f=[0,0,0];for(let c=0;c<3;c++)f[c]=.5*(2*l[c]+(-s[c]+u[c])*i+(2*s[c]-5*l[c]+4*u[c]-p[c])*h+(-s[c]+3*l[c]-3*u[c]+p[c])*v);return f}function Yt(t,e,n,r,a){let o=bo(ga(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let i=vo(vo(e,ya(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=bo(s);l[0]===0&&l[2]===0&&(l=[o[0],0,o[2]]);let u=Math.max(1,a),p=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,p,i],finalPos:i}}function Xt(t,e,n=35,r=28){let a=Wt(e),o=go(t,a),i=Wt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*i,eased:a}}function wo(t,e,n){let r=t.position.clone(),a=new je().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new xa(n[0],n[1],n[2]));let o=new je().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(a),o}var mt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new je;this.endQuat=new je;this.outQuat=new je;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,a=2500,o=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=a,this.endFov=o,this.startTime=performance.now(),this.active=!0,new Promise(i=>{this.resolveFn=i})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:a,eased:o}=Xt(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Ut(o,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=a,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Mo=cn,Sa=.12,wa=.25,Ma=1.5;function Co(t,e,n=0,r,a){let o=[e.x*Re,n+Ma,e.y*Re],i=a?[a[0],a[1],a[2]]:o,s=t[1],l=Number.isFinite(s)?s+Mo:Number.isFinite(r)?n+r:n+Mo,u=o[0]-t[0],p=o[2]-t[2],h=Math.hypot(u,p),v=h>.001?Math.min(Sa,h*wa):0,f=h>.001?u/h:0,c=h>.001?p/h:0;return{eye:[t[0]+f*v,l,t[2]+c*v],focal:i}}var Fe=Math.PI/180,Ca=45,Ao=80,ht=70,Aa=1,Pa=.99;function Ea(t,e){if(!(t<Aa))return Ao;if(!(Number.isFinite(e)&&e>0))return ht;let n=2*Math.atan(e/(2*pt*Pa)/Math.max(.05,t))/Fe;return Math.max(ht,Math.min(Ao,n))}var Fa=.25,pt=1,Ra=.25,Da=12*Fe,Ta=.2,Ia=1.5,Po=.8,Eo=6,To=1.9,_a=2/3,Va=.12,La=.9,ka=1.2,Oa=2,Io=.05,za=6;function _o(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Po,e[1]),e[2]+6]};let r=1/0,a=-1/0,o=1/0,i=-1/0,s=n;for(let c of t)r=Math.min(r,c.cx-c.halfX),a=Math.max(a,c.cx+c.halfX),o=Math.min(o,c.cz-c.halfZ),i=Math.max(i,c.cz+c.halfZ),s=Math.max(s,c.y);let l=a-r,u=i-o,p=Math.max(l,Math.min(u,Eo))/2,h=Math.max(u,Math.min(l,Eo))/2,v=(r+a)/2,f=(o+i)/2;return{min:[v-p,n,f-h],max:[v+p,Math.max(n+Po,s),f+h]}}function Na(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+To,t.max[2]]}}function qt(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Ia,e+Ta,e+To*_a),(t.min[2]+t.max[2])/2]}function Vo(t,e){let n=t[0]-e[0],r=t[2]-e[2],a=Math.hypot(n,r);return a<.001?{x:0,z:1}:{x:n/a,z:r/a}}function Fo(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let p=1/0,h=-1/0;for(let v=0;v<8;v++){let f=(v&1?n.max[0]:n.min[0])-t[0],c=(v&2?n.max[1]:n.min[1])-t[1],b=(v&4?n.max[2]:n.min[2])-t[2],E=Math.max(Io,f*r+c*a+b*o),P=(f*s+b*l)/E;P<p&&(p=P),P>h&&(h=P)}return h-p}function Ro(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let p=-l*a,h=l*r-s*o,v=s*a,f=1/0,c=-1/0;for(let b=0;b<8;b++){let E=(b&1?n.max[0]:n.min[0])-t[0],P=(b&2?n.max[1]:n.min[1])-t[1],L=(b&4?n.max[2]:n.min[2])-t[2],C=Math.max(Io,E*r+P*a+L*o),F=(E*p+P*h+L*v)/C;F<f&&(f=F),F>c&&(c=F)}return c-f}function ft(t,e){return Math.tan(t*Fe/2)*Math.max(.05,e)}function Do(t,e,n){let r=Ea(n,t),a=l=>Math.max(Ca,Math.min(r,l)),o=l=>2*Math.atan(l)/Fe,i=Number.isFinite(t)&&t>0?a(o(t/(2*Fa)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return i;let s=Math.min(i,a(o(e/(2*Va))));return t/(2*ft(s,n))>pt?i:s}function Lo(t,e,n,r={}){let a=qt(e),o=[t[0],t[1],t[2]],i=0,s=0,l=c=>{if(!(c>0))return;let b=Vo(o,a);o[0]+=b.x*c,o[2]+=b.z*c,s+=c},u=r.preserveEye?0:e.max[1]+Ra-o[1];u>0&&(o[1]+=u,i=u,l(u/Math.tan(Da)));let p=Na(e),h=Fo(o,a,e),v=Do(h,Ro(o,a,p),n),f=h/(2*ft(v,n));for(let c=0;!r.preserveEye&&c<za&&f>pt;c++){let b=Math.max(1,Math.hypot(o[0]-a[0],o[2]-a[2])),E=Number.isFinite(f)?f/pt:2;l(Math.min(60,b*(Math.min(4,E)-1)+.5)),h=Fo(o,a,e),v=Do(h,Ro(o,a,p),n),f=h/(2*ft(v,n))}return{eye:o,focal:a,fov:v,raisedM:i,pulledBackM:s,stageFrameWidth:f}}function Ba(t,e,n){let r=Math.tan(e*Fe/2),a=ft(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,a)))}function ko(t,e){let{aspect:n,venue:r}=e,a=t.focal,o=Vo(t.eye,a),i=v=>(v[0]-a[0])*o.x+(v[2]-a[2])*o.z,s=[{name:"seat",eye:t.eye,focal:a,fov:t.fov}],l=Oa*(e.rowDepthM??La);s.push({name:"row",eye:[t.eye[0]+o.x*l,t.eye[1]+ka,t.eye[2]+o.z*l],focal:a,fov:t.fov});let u=(v,f,c,b)=>{let E=Ba(c,t.fov,n)*1.08,P=E*Math.sin(b*Fe),L=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,C=Math.max(P,L-f[1]),F=E*Math.cos(b*Fe);return{name:v,eye:[f[0]+o.x*F,f[1]+C,f[2]+o.z*F],focal:f,fov:t.fov}};e.section&&e.section.radius>0&&s.push(u("section",e.section.center,e.section.radius,35)),s.push(u("venue",r.center,Math.max(1,r.radius),40));let p=[],h=-1/0;for(let v of s){let f=i(v.eye);p.length&&f<=h+.5||(p.push(v),h=f)}return p}import{Vec3 as Ga}from"ogl";var Qe=Math.PI/180,Oo=320,zo=70*Qe,Ha=32*Qe,Wa=24*Qe,No=.0026,Ua=.22,Ya=.006,Xa=180,qa=4,me=(t,e,n)=>Math.max(e,Math.min(n,t)),Bo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function Go(t){let{canvas:e,camera:n}=t,r=[],a=!1,o=0,i=0,s=0,l=0,u=0,p=0,h=!1,v=[0,0],f=0,c=!1,b=null,E=null,P=new Map,L=!1,C=0,F=0,g=0,A=0,S=()=>a&&r.length?r[me(Math.round(o),0,r.length-1)].name:null,w=()=>{let y=S();y!==b&&(b=y,t.onStopChange?.(y))},R=()=>{if(!a||!r.length)return;let y=r[me(Math.floor(o),0,r.length-1)],G=r[me(Math.ceil(o),0,r.length-1)],N=me(o-Math.floor(o),0,1),q=(X,j)=>X+(j-X)*N,Z=[q(y.eye[0],G.eye[0]),q(y.eye[1],G.eye[1]),q(y.eye[2],G.eye[2])],ee=[q(y.focal[0],G.focal[0]),q(y.focal[1],G.focal[1]),q(y.focal[2],G.focal[2])],he=ee[0]-Z[0],Q=ee[1]-Z[1],ie=ee[2]-Z[2],te=Math.hypot(he,Q,ie)||1,se=Math.atan2(he,ie),ve=Math.asin(me(Q/te,-1,1)),re=se+i,le=me(ve+s,-80*Qe,80*Qe),k=Math.cos(le)*te;he=Math.sin(re)*k,Q=Math.sin(le)*te,ie=Math.cos(re)*k,n.position.set(Z[0],Z[1],Z[2]),n.fov=q(y.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new Ga(Z[0]+he,Z[1]+Q,Z[2]+ie)),t.onApplied?.()},T=()=>{if(!a||!r.length)return;let y=me(Math.round(o),0,r.length-1);if(t.reducedMotion()){h=!1,o=y,R(),w(),t.requestRender();return}if(Math.abs(y-o)<.001){h=!1,w();return}l=o,u=y,p=performance.now(),h=!0,t.requestRender()},I=y=>{!a||r.length<2||(h=!1,o=me(o+y,0,r.length-1),R(),w(),t.requestRender())},Y=(y,G)=>{a&&(h=!1,c=!1,i=me(i-y*No,-zo,zo),s=me(s-G*No,-Wa,Ha),R(),t.requestRender())},B=y=>{a&&(P.set(y.pointerId,{x:y.clientX,y:y.clientY}),P.size===1?(L=!0,A=0,C=y.clientX,F=y.clientY):P.size===2&&(L=!1,g=U()))},U=()=>{let y=[...P.values()];return y.length<2?0:Math.hypot(y[0].x-y[1].x,y[0].y-y[1].y)},V=y=>{if(!a||!P.has(y.pointerId))return;if(P.set(y.pointerId,{x:y.clientX,y:y.clientY}),P.size>=2){let q=U();g>0&&I((g-q)*Ya),g=q;return}if(!L)return;let G=y.clientX-C,N=y.clientY-F;C=y.clientX,F=y.clientY,A+=Math.abs(G)+Math.abs(N),!(A<=qa)&&Y(G,N)},H=y=>{P.delete(y.pointerId)&&(P.size<2&&(g=0),P.size===0&&(L=!1,T()))},D=y=>{if(!a)return;y.preventDefault();let G=y.deltaMode===1?16:y.deltaMode===2?100:1,N=me(y.deltaY*G/100,-2,2);I(N*Ua),E&&clearTimeout(E),E=setTimeout(()=>{E=null,T()},Xa)},x=()=>{a&&(a=!1,h=!1,c=!1,r=[],P.clear(),L=!1,E&&(clearTimeout(E),E=null),b!==null&&(b=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",B),e.addEventListener("pointermove",V),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",H),e.addEventListener("wheel",D,{passive:!1}),{get active(){return a},enter(y){if(y.length<2){x();return}r=y,a=!0,o=0,i=0,s=0,h=!1,c=!1,b=null,R(),w(),t.requestRender()},exit:x,recentre(){return a?Math.abs(i)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(c=!1,i=0,s=0,R(),t.requestRender(),!0):(v=[i,s],f=performance.now(),c=!0,t.requestRender(),!0):!1},update(y){if(!a)return!1;let G=!1;if(c){let N=me((y-f)/Oo,0,1),q=1-Bo(N);i=v[0]*q,s=v[1]*q,N>=1?(c=!1,i=0,s=0):G=!0}if(h){let N=me((y-p)/Oo,0,1);o=l+(u-l)*Bo(N),N>=1?(h=!1,o=u,w()):G=!0}return R(),G},currentStop:S,dispose(){x(),e.removeEventListener("pointerdown",B),e.removeEventListener("pointermove",V),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",H),e.removeEventListener("wheel",D)}}}function Ho(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var jt=null;function Wo(){return jt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw jt=null,t}),jt}var Uo=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),vt=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,r,a){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...a===void 0?{}:{prepSource:a}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Uo(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Uo()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,n){this.emit("3d_panorama_failed",{seatId:e,phase:n})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function Yo(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Xo(t){let{container:e,model:n,opts:r,expandedSeatById:a,seatIdsByRow:o,isNarrow:i}=t,s=null,l=()=>{if(!s)return;let h=i();Object.assign(s.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(h,v,f=!1)=>{if(u(),t.isDisposed())return null;let c=document.createElement("div");c.setAttribute("role","group"),Object.assign(c.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let b=r.chrome?.caption!==!1,E=r.chrome?.seatStepper!==!1;if(!b&&!E)return null;let P=a.get(h),L=P?.sectionId?n.sections.find(T=>T.id===P.sectionId):void 0,C=P?.label??h;c.setAttribute("aria-label",`Explore views near ${L?.label?`${L.label}, `:""}seat ${C}`);let F=document.createElement("span");F.textContent=r.seatViewCaption?.(h)??["Live 3D seat view",L?.label,C].filter(Boolean).join(" \xB7 "),Object.assign(F.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&c.appendChild(F);let g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),c.appendChild(g);let A=P?.rowId?o.get(P.rowId):void 0,S=A?.indexOf(h)??-1,w=S>=0?[A?.[S-1],A?.[S+1]]:[void 0,void 0],R=(T,I,Y,B=!1)=>{let U=document.createElement("button");U.type="button",U.textContent=T,U.setAttribute("aria-label",I),Object.assign(U.style,{minHeight:"44px",padding:B?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),B||(U.style.minWidth="44px"),B&&(U.dataset.panoramaTrigger=""),U.addEventListener("click",Y),g.appendChild(U)};if(E&&w[0]){let T=a.get(w[0])?.label??w[0];R("\u2039",`View previous seat ${T}`,()=>{t.flyToSeat(w[0])})}if(E&&r.getSeatView){let T=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";R(f?`\u21BB Retry ${T}`:`\u25C9 ${T}`,`${f?"Retry":T} from seat ${C}`,()=>{if(t.isDisposed()||v!==t.flightGen()){u();return}u(),t.openPanorama(h,400,v)},!0)}if(E&&w[1]){let T=a.get(w[1])?.label??w[1];R("\u203A",`View next seat ${T}`,()=>{t.flyToSeat(w[1])})}return!g.childElementCount&&!b?null:(e.appendChild(c),s=c,l(),c)},remove:u,layout:l}}var ja={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function qo(t){let{container:e,orbit:n,isNarrow:r}=t,a={...ja,...t.labels??{}},o=(C,F)=>{C.setAttribute("aria-label",F),C.title=F},i=document.createElement("div"),s=!1;i.className="sl-3d-navigation-controls",Object.assign(i.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let p=document.createElement("button");p.type="button",p.textContent="\u21BB",o(p,a.rotate);let h=document.createElement("button");h.type="button",h.textContent="\u2725",o(h,a.move);let v=document.createElement("button");v.type="button",v.textContent="\u2212",o(v,a.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",o(f,a.zoomIn);for(let C of[p,h,v,f])C.className="sl-3d-icon-control",Object.assign(C.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(p,h),u.append(f,v);let c=C=>{n.setPrimaryDragMode(C);let F=C==="orbit";p.setAttribute("aria-pressed",String(F)),h.setAttribute("aria-pressed",String(!F)),p.style.background=F?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",h.style.background=F?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",i.title=F?`${a.rotate} \xB7 ${a.move} with Shift`:`${a.move} \xB7 ${a.rotate} with Shift`};p.addEventListener("click",()=>c("orbit")),h.addEventListener("click",()=>c("pan"));let b=()=>{let{atMin:C,atMax:F}=n.dollyLimitState();f.disabled!==C&&(f.disabled=C),v.disabled!==F&&(v.disabled=F)};v.addEventListener("click",()=>{n.zoomBy(We),b()}),f.addEventListener("click",()=>{n.zoomBy(Te),b()}),i.append(l,u),c("orbit"),e.appendChild(i);let E=t.enabled!==!1,P=()=>{let C=r();i.style.display=s||!E?"none":"flex",i.style.right=C?"12px":"14px",i.style.bottom=C?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=C?"none":"flex",f.style.display=C?"none":"",v.style.display=C?"none":""};return P(),{element:i,utilityControls:u,setNavigationMode:c,syncZoomLimits:b,setSeatViewLocked:C=>{s=C,n.setInteractionEnabled(!C),P()},seatViewLocked:()=>s,layout:P}}var Ka=12;function Qa(t,e){if(!t)return!1;let n=t.x-e[0],r=t.y-e[1],a=t.z-e[2];return Math.hypot(n,r,a)>Ka}function jo(t){let{glctx:e,orbit:n,model:r,seats:a,opts:o,cinematic:i,analytics:s,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:p,tapMs:h,cancelFlight:v,focusSectionCamera:f,setSelection:c,ensureSeatView:b}=t,E=0,P=0,L=0,C=-1,F=!1,g=!1,A=I=>{t.seatViewLocked()||C===-1&&(C=I.pointerId,E=I.clientX,P=I.clientY,L=performance.now(),F=!1,g=i.active,i.active&&(s.cinematicCancelled(),v(),o.onViewTargetChange?.(null)))},S=I=>{I.pointerId===C&&Math.hypot(I.clientX-E,I.clientY-P)>p&&(F=!0)},w=(I,Y,B,U,V)=>{let H=e.canvas.getBoundingClientRect(),D=e.canvas.clientWidth||H.width||1,x=e.canvas.clientHeight||H.height||1,y=I-H.left,G=Y-H.top,N=U*U,q=-1,Z=N,ee=1/0;for(let he of a){if(B&&he.sectionId!==B)continue;let Q=r.seats.idToIndex.get(he.id);if(Q===void 0)continue;if(V){let le=Math.round(r.seats.iState[Q]??0);if(le!==0&&le!==3)continue}let ie=Q*3,te=xe(n.camera.projectionViewMatrix,[r.seats.iPosition[ie],r.seats.iPosition[ie+1]+.55,r.seats.iPosition[ie+2]],D,x);if(!te.visible)continue;let se=te.x-y,ve=te.y-G,re=se*se+ve*ve;(re<Z||Math.abs(re-Z)<1&&te.depth<ee)&&(q=Q,Z=re,ee=te.depth)}return q},R=(I,Y)=>{let B=t.gpu(),U=t.pick();if(!B||!U)return-1;U.syncFromSeatProgram(B.seatProgram);let V=e.canvas.getBoundingClientRect(),H=e.renderer.dpr,{x:D,y:x}=ho(I,Y,V,H,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),y=Math.max(2,Math.round(8*H));return U.pick(n.camera,D,x,y)};return{onDown:A,onMove:S,onUp:I=>{if(I.pointerId!==C)return;let Y=!F&&performance.now()-L<h;if(C=-1,g){g=!1;return}let B=t.gpu(),U=t.pick();if(!Y||!B||!U)return;let V=R(I.clientX,I.clientY);if(t.focusedSectionId()&&V>=0){let x=l[V],y=x?u.get(x):void 0;if(y&&y!==t.focusedSectionId()&&f(y))return}if(t.focusedSectionId()&&V<0&&(V=w(I.clientX,I.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&V<0){let x=w(I.clientX,I.clientY,null,72,!1),y=x>=0?l[x]:void 0,G=y?u.get(y):void 0;if(G&&G!==t.focusedSectionId()&&f(G))return}if(!t.focusedSectionId()){V<0&&(V=w(I.clientX,I.clientY,null,42,!1));let x=V>=0?l[V]:void 0,y=x?u.get(x):void 0;if(y&&f(y))return}if(V<0||V>=l.length){t.selection().size&&(c([]),o.onViewTargetChange?.(null));return}let H=l[V],D=be[Math.round(r.seats.iState[V]??0)]??"available";if(D!=="available"&&D!=="selected"){o.onSeatInspect?.(H,D);return}if(t.selection().has(H)&&t.selection().size===1){c([]),o.onViewTargetChange?.(null),o.onSeatPick?.(H);return}if(c([H]),b(H),s.seatPicked(H,u.get(H)),o.onSeatPick?.(H),t.focusedSectionId()){let x=V*3,y=[r.seats.iPosition[x],r.seats.iPosition[x+1],r.seats.iPosition[x+2]];Qa(n.camera?.position,y)&&t.focusSeatCamera(H)}}}}var bt=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,r=1/0,a=-1/0,o=-1/0;for(let f=0;f<this.count;f++){let c=e[f*3],b=e[f*3+2];c<n&&(n=c),c>a&&(a=c),b<r&&(r=b),b>o&&(o=b)}let i=Math.max(a-n,.001),s=Math.max(o-r,.001);this.cell=Math.max(Math.sqrt(i*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(i/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let l=this.cols*this.rows,u=new Int32Array(l+1),p=f=>{let c=Math.min(this.cols-1,Math.max(0,Math.floor((e[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[f*3+2]-r)/this.cell)))*this.cols+c};for(let f=0;f<this.count;f++)u[p(f)+1]++;for(let f=0;f<l;f++)u[f+1]+=u[f];let h=new Int32Array(this.count),v=u.slice(0,l);for(let f=0;f<this.count;f++)h[v[p(f)]++]=f;this.cellStart=u,this.cellItems=h}gather(e,n,r,a,o){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let l=a.length,u=r*r,p=Math.floor((e-this.minX)/this.cell),h=Math.floor((n-this.minZ)/this.cell),v=Math.ceil(r/this.cell)+1,f=this.iPosition,c=0;for(let b=0;b<=v&&c<l;b++){let E=h-b,P=h+b,L=p-b,C=p+b;for(let F=E;F<=P&&c<l;F++){if(F<0||F>=this.rows)continue;let g=F===E||F===P;for(let A=L;A<=C&&c<l;A++){if(!g&&A!==L&&A!==C){A=C-1;continue}if(A<0||A>=this.cols)continue;let S=F*this.cols+A;for(let w=i[S],R=i[S+1];w<R&&c<l;w++){let T=s[w],I=f[T*3]-e,Y=f[T*3+2]-n,B=o===void 0?0:f[T*3+1]-o;I*I+B*B+Y*Y<=u&&(a[c++]=T)}}}}return c}};var gt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new bt(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.ctx.orbit().camera.position;if(Math.hypot(a.x-this.lastGatherX,a.y-this.lastGatherY,a.z-this.lastGatherZ)<Vt)return;if(this.lastGatherX=a.x,this.lastGatherY=a.y,this.lastGatherZ=a.z,Math.hypot(a.x-n.bounds.center[0],a.y-n.bounds.center[1],a.z-n.bounds.center[2])-n.bounds.radius>_t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(a.x,a.z,_t,this.nearBuf,a.y);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let a=1-Math.exp(-e*9),o=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?a:o),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?a:o),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};function Ko(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],r=t.focalWorld[2]-t.center[2],a=Math.hypot(n,r);if(a<e*.12)return{center:t.center,radius:e,polarDeg:48};let o=Math.min(a*.25,e*1.2);return{center:[t.center[0]+n/a*o,t.center[1],t.center[2]+r/a*o],radius:e+o*.4,azimuth:Math.atan2(-n,-r),polarDeg:50}}import{Quat as $a,Vec3 as Za}from"ogl";function Qo(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let n=document.createElementNS(t,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(n),e}function Jo(t){let{container:e,model:n,opts:r,orbit:a,cinematic:o,analytics:i,loop:s,labelOverlay:l,stageAzimuth:u,overviewFraming:p}=t,h=0,v=-1,f=(S,w,R=28)=>{a.camera.position.set(S[0],S[1],S[2]),a.camera.lookAt(new Za(w[0],w[1],w[2])),a.camera.fov=R,a.camera.updateProjectionMatrix()},c=document.createElement("button");c.className="sl-3d-overview-control sl-3d-icon-control",c.type="button",c.replaceChildren(Qo());let b=r.navLabels?.fitView??"Show whole venue";c.setAttribute("aria-label",b),c.title=b,Object.assign(c.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let E=()=>{c.firstElementChild||c.replaceChildren(Qo())};E();let P=S=>{v=S;let w=t.gpu();w&&(w.seatProgram.uniforms.uFocusFloor.value=S,w.solidProgram.uniforms.uFocusFloor.value=S,w.chairProgram.uniforms.uFocusFloor.value=S),t.showSectionSeatLabels(null)},L=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),i.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),c.style.display="",l.setVisible(!0),t.setFrozen(!1);let S=v>=0?n.floors[v]:null;if(t.setNearFieldDetailEnabled(!!S),t.setSeatViewLocked(!1),C(),t.removeArriveChip(),t.setNavigationMode("orbit"),S){let w=S.focalWorld[0]-S.center[0],R=S.focalWorld[2]-S.center[2],T=Math.hypot(w,R)>S.radius*.12?Math.atan2(w,R):u,I={center:S.center,radius:S.radius,box:S.box},Y={polarDeg:58,margin:1.12};t.reducedMotion()?a.frame(I,!1,T,!1,Y):a.frameSoft(I,T,!1,Y)}else t.reducedMotion()?a.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,p):a.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,p);t.showSectionSeatLabels(null),s.requestRender()},C=()=>{h++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),a.resumeAfterFlight(n.focalWorld))},F=S=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let w=n.seats.idToIndex.get(S);if(w===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(S),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),c.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let R=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(R),t.setSeatViewLocked(!1);let T=++h;R?t.showArriveChip(S,T):t.removeArriveChip();let{eye:I,focal:Y}=t.resolvedSeatViewPose(S,w),B=r.arriveAtSeatEye?t.seatViewArrival(S,w):null,U=B?B.focal:Y,V=[a.camera.position.x,a.camera.position.y,a.camera.position.z],H=Yt(V,B?.eye??I,U,n.bounds.center,n.bounds.radius),D=B?B.eye:r.arriveAtSeatEye?I:H.finalPos,x=B?B.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?ht:65:28,y=[H.waypoints[0],H.waypoints[1],D];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),f(D,U,x),s.requestRender(),i.cinematicSkipped(),t.isDisposed()||a.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops),t.showArriveChip(S,T),Promise.resolve();let G=new $a().copy(a.camera.quaternion),N=wo(a.camera,D,U);s.requestRender();let q=R?700:2500;return o.start(y,G,N,q,x).then(()=>{t.isDisposed()||T!==h||(t.setSeatStepping(!1),i.cinematicPlayed(q),a.resumeAfterFlight(U),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops),s.requestRender(),t.showArriveChip(S,T))})},g=S=>{let w=n.sections.find(T=>T.id===S);if(!w||w.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&v!==w.floorIndex&&P(w.floorIndex),t.setNavigationMode("pan"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(S);let R=Ko(w);return a.frame({center:R.center,radius:R.radius},!1,R.azimuth,!1,{polarDeg:R.polarDeg,margin:1.12}),r.onSectionFocusChange?.(S),s.requestRender(),!0},A=S=>{if(t.isDisposed()||!t.gpu())return!1;let w=n.seats.idToIndex.get(S);if(w===void 0)return!1;let R=w*3,T=[n.seats.iPosition[R],n.seats.iPosition[R+1]+.55,n.seats.iPosition[R+2]];return t.reducedMotion()?a.frame({center:T,radius:$o},!1,void 0,!1,Zo):a.frameSoft({center:T,radius:$o},void 0,!1,Zo),s.requestRender(),!0};return c.addEventListener("click",L),{overviewChip:c,layoutOverviewChip:E,flightGen:()=>h,focusedFloor:()=>v,applyFloorFocus:P,placeCameraFinal:f,cancelFlight:C,focusOverview:L,flyToSeat:F,focusSectionCamera:g,focusSeatCamera:A}}var $o=4.5,Zo={polarDeg:48,margin:1.25};function er(t){let e=performance.now(),{input:n,estimate:r}=Pn(t);return{model:He(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function Ja(t){let e=an(t.doc);return{...er({...t,seats:e}),seats:e}}function tr(t,e,n){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(a=>{let o=!1,i=u=>{o||(o=!0,clearTimeout(l),r.terminate(),a(u))},s=()=>i(e()),l=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let p=n(u.data);p?i(p):s()},r.postMessage(t)})}function ei(t){return tr(t,()=>er(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function ti(t){return tr(t,()=>Ja(t),({model:e,buildMs:n,seats:r,estimate:a})=>r?{model:e,buildMs:n,seats:r,source:"worker",...a?{estimate:a}:{}}:null)}var ni=Math.PI/180,oi=6,ri=500;function fl(t,e,n={}){let r=performance.now(),a=e.prepared?e.prepared.estimate:e.estimate===!1?null:Ft(e.doc,e.seats);a&&(e={...e,doc:a.doc,seats:An(e.seats,a)});let o=e.prepared?.model??He(e),i=new vt(n.onAnalytics),s=new Array(o.seats.count);for(let[d,m]of o.seats.idToIndex)s[m]=d;let l=new Map(e.seats.map(d=>[d.id,d])),u=new Map;for(let d of e.seats){if(!d.rowId)continue;let m=u.get(d.rowId);m?m.push(d.id):u.set(d.rowId,[d.id])}let p=new Map;e.seats.forEach((d,m)=>{p.set(d.id,o.seatSectionIds?.[m]??d.sectionId)});let h=new Map;for(let[d,m]of o.seats.idToIndex){let M=p.get(d);if(!M)continue;let z=h.get(M);z?z.push(m):h.set(M,[m])}let v=()=>{if(!c||!o.sectionSolidRanges.length)return;let{lit:d,anyUnlit:m}=io(o.sectionSolidRanges,h,o.seats.iState);c.setSectionShellLit(m?d:null)},f=e.doc.floors?.some(m=>(m.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(m=>m.objects)??e.doc.objects).some(m=>m.type==="section"&&((m.height??0)>0||(m.rake??0)>0)),c=null,b=null,E=!1,P=!1,L=!1,C=new Map,F=null,g=null,A=null,S=new Map,w=null,R=()=>{A===null&&(A=t.style.zIndex,t.style.zIndex="20")},T=()=>{A!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=A),A=null)},I=!1,Y=()=>I?ce.focusedFloor():-1,B=()=>{c=uo(D.gl,o),v(),le(),b=new dt(D.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,o.seats.count),D.setClearColor(o.theme.background.top),b.setRestoreClear(o.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ge*o.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=Y(),c.solidProgram.uniforms.uFocusFloor.value=Y(),c.chairProgram.uniforms.uFocusFloor.value=Y(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=Y()),V.forceRegather()},U=!1,V=new gt({model:o,orbit:()=>x,gpu:()=>c}),H=d=>V.setDetailEnabled(d),D=new at(t,{onContextLost:()=>{L||i.contextLost(),E=!0,O.stop(),c=null,b=null},onContextRestored:()=>{B(),E=!1,L||i.contextRestored(),O.requestRender()}}),x=new it(D.gl,D.canvas,()=>O.requestRender(),()=>i.orbitEngaged());x.setAspect(D.aspect);let y=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="section"&&d.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(y&&o.stages.length===0))return En(o.focalWorld,o.seats.iPosition,o.bounds)})(),N=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="shape"&&d.stageKind?.startsWith("pitch-")),q=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:N?36:48,margin:1.05},Z=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;x.frame(o.bounds,!Z&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,q);let ee=new mt(x.camera),he=Yo(t),Q=new ct(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),ie=o.labels,te=()=>pn(ie,o.floors.length,Y());Q.setLabels(te());let se=null,ve=()=>[...C.keys()].flatMap(d=>{let m=o.seats.idToIndex.get(d),M=m===void 0?void 0:e.seats[m];if(m===void 0||M?.id!==d)return[];let z=m*3;return[{id:`seat:${d}`,kind:"seat",seatWidthM:o.seats.iChairWidth[m]*2,text:M.displayLabel||M.label,anchor:[o.seats.iPosition[z],o.seats.iPosition[z+1]+1.05,o.seats.iPosition[z+2]]}]}),re=-1,le=()=>{c&&(re=se?o.sections.findIndex(d=>d.id===se):-1,c.seatProgram.uniforms.uFocusSection.value=re,c.chairProgram.uniforms.uFocusSection.value=re)},k=d=>{if(se=d,le(),Q.setForcedDense(!!d),!d){let _=ve(),ue=new Set(_.map(oe=>oe.id));Q.setLabels([...te().filter(oe=>!ue.has(oe.id)),..._]);return}let m=e.seats.filter(_=>p.get(_.id)===d),M=new Set(m.map(_=>_.id)),z=new Set(m.map(_=>_.rowId)),W=new Set(C.keys()),K=new Set(m.filter(_=>W.has(_.id)).map(_=>_.id)),$=te().filter(_=>_.kind!=="row"&&_.kind!=="seat"||(_.kind==="row"?z.has(_.id.slice(4)):M.has(_.id.slice(5))&&(K.size===0||K.has(_.id.slice(5)))));if(o.seatCount<=6e3&&K.size===0){Q.setLabels($);return}let ae=K.size?m.filter(_=>K.has(_.id)):m,we=new Set(ae.map(_=>`seat:${_.id}`)),Me=ae.flatMap(_=>{let ue=o.seats.idToIndex.get(_.id);if(ue===void 0)return[];let oe=ue*3;return[{id:`seat:${_.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[ue]*2,text:W.has(_.id)?_.displayLabel||_.label:Cn(_.displayLabel||_.label),anchor:[o.seats.iPosition[oe],o.seats.iPosition[oe+1]+(W.has(_.id)?1.05:.55),o.seats.iPosition[oe+2]]}]});Q.setLabels([...$.filter(_=>!we.has(_.id)),...Me])};B();let X=null,j=null,J=d=>{if(E||!c||P)return!1;let m=Ho({flying:ee.active,panoramaMounted:F!==null,seatViewActive:X?.active===!0}),M=m==="orbit"?re:-1;c.seatProgram.uniforms.uFocusSection.value=M,c.chairProgram.uniforms.uFocusSection.value=M;let z=m==="cinematic"?ee.update(performance.now()):m==="seatView"?X.update(performance.now()):m==="orbit"?x.update():!1;j?.syncZoomLimits();let W=Y()>=0?o.floors[Y()]:null,K=W?.radius??o.bounds.radius,$=On(x.currentDistance,K),ae=U?{center:[x.camera.position.x,x.camera.position.y,x.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;x.updateClipping(ae);let we=W?.center??o.renderBounds.center,Me=W?.radius??o.renderBounds.radius,_=(pe,Ce)=>Math.hypot(x.camera.position.x-pe[0],x.camera.position.y-pe[1],x.camera.position.z-pe[2])<=Ce*(V.detailVisible?1.8:1.55),ue=_(we,Me);if(!ue&&se){let pe=o.sections.find(Ce=>Ce.id===se);pe&&(ue=_(pe.center,Math.max(12,pe.radius*2)))}V.detailVisible=ue;let oe=c.seatProgram.uniforms;oe.uSeatScale.value=$.scale,oe.uSeatFade.value=$.fade;let Je=!!W&&zn(W.seatCount,D.canvas.clientWidth||1,D.canvas.clientHeight||1),et=Nn(o.seats.count,K,x.currentDistance,x.camera.fov,D.canvas.clientHeight||1),ze=V.detailVisible||Je||et?1:0,Ne=V.detailVisible||Y()>=0||o.floors.length>1?1:0;V.ease(d,ze,Ne),oe.uSeatDetail.value=V.seatDetailMix;let tt=ze===0&&V.seatDetailMix<.01;return c.seatGeometry.setDrawRange(tt?Rt:0,tt?Fn:Rt),c.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,oe.uMinPixels.value=$.minPixels,oe.uPixelToWorld.value=2*Math.tan(x.camera.fov*ni/2)/Math.max(1,D.pixelHeight),V.update(V.detailVisible),D.renderer.render({scene:c.background,clear:!0}),D.renderer.render({scene:c.main,camera:x.camera,clear:!1}),Q.update(x.camera.projectionViewMatrix,D.canvas.clientWidth||1,D.canvas.clientHeight||1,x.currentDistance,K,[x.camera.position.x,x.camera.position.y,x.camera.position.z]),z||V.seatDetailMix!==ze||V.structureDetailMix!==Ne},O=new st(J),ne=typeof ResizeObserver<"u"?new ResizeObserver(()=>At.resize()):null;ne?.observe(t);let Kt=d=>{let m=W=>{let K=o.seats.idToIndex.get(W);return K===void 0?void 0:o.seats.iState[K]},{updates:M,next:z}=fo(C,d,m);if(C=z,Q.setSelectedSeatIds(C.keys()),k(se),M.length){let W=Et(o.seats,M);c&&c.uploadSeatStateRuns(W),v(),O.requestRender()}},$e=()=>w!==null?w:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,nr=8,Qt=d=>{if(!n.getSeatView)return null;let m=S.get(d);if(!m)for(m=Promise.resolve(n.getSeatView(d)),S.set(d,m),m.catch(()=>{S.get(d)===m&&S.delete(d)});S.size>nr;){let M=S.keys().next().value;if(M===void 0)break;S.delete(M)}return m},$t=_o(o.stages,o.focalWorld,o.bounds.groundY??0),or=qt($t),yt=(d,m)=>{let M=l.get(d),z=Math.max(0,Math.round(o.seats.iFloor[m]??0)),W=e.doc.floors?.[z],K=o.floors[z],$=W?.focalPoint??e.doc.focalPoint,ae=K?{x:K.focalWorld[0]/Re,y:K.focalWorld[2]/Re}:$,we=M?.focalPoint?{x:M.focalPoint.x+ae.x-$.x,y:M.focalPoint.y+ae.y-$.y}:ae,Me=[o.seats.iPosition[m*3],o.seats.iPosition[m*3+1],o.seats.iPosition[m*3+2]];return Co(Me,we,W?.baseHeightM??0,M?.eyeHeightM,or)},Zt=()=>(t.clientWidth||D.canvas.clientWidth)<=520,xt=null,Jt=null,rr=async(d,m,M)=>{if(!n.getSeatView||L||M!==ce.flightGen())return;let z;try{z=await Wo()}catch{if(i.panoramaFailed(d,"mount"),!L&&M===ce.flightGen()){let W=wt(d,M,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(L||M!==ce.flightGen()||!xt))return Jt??=z.createOpenPanorama(xt),Jt(d,m,M)},St=Xo({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:u,isNarrow:Zt,isDisposed:()=>L,flightGen:()=>ce.flightGen(),flyToSeat:d=>on(d),openPanorama:(d,m,M)=>rr(d,m,M)}),wt=St.show,Mt=St.remove,ar=St.layout,Se=qo({container:t,orbit:x,isNarrow:Zt,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});j=Se;let ir=Se.element,ke=Se.setNavigationMode,sr=Se.layout,lr=Se.utilityControls,Oe=null,en=!1,Ze=d=>{Se.setSeatViewLocked(d),d||X?.exit()};X=Go({canvas:D.canvas,camera:x.camera,requestRender:()=>O.requestRender(),reducedMotion:$e,onStopChange:d=>{let m=d??(en?"seat":null);Oe=m;try{n.onSeatViewStopChange?.(m)}catch{}},onApplied:()=>{L||x.syncFromCamera()}});let tn=o.sections.reduce((d,m)=>m.seatCount>0&&m.box?Math.max(d,m.box.max[1]):d,-1/0),cr=(d,m)=>{let{eye:M}=yt(d,m),z=(t.clientWidth||D.canvas.clientWidth||1)/Math.max(1,t.clientHeight||D.canvas.clientHeight||1),W=Lo(M,$t,z,{preserveEye:!0});if(n.seatViewStops===!1)return{...W,stops:[]};let K=p.get(d),$=K?o.sections.find(ae=>ae.id===K):void 0;return{...W,stops:ko(W,{aspect:z,seatingTopY:Number.isFinite(tn)?tn:o.bounds.box.max[1],section:$&&$.seatCount>0?{center:$.center,radius:$.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},ce=Jo({container:t,model:o,opts:n,orbit:x,cinematic:ee,analytics:i,loop:O,labelOverlay:Q,stageAzimuth:G,overviewFraming:q,gpu:()=>c,isDisposed:()=>L,panorama:()=>F,setPanorama:d=>{F=d},setPanoramaSphereVisible:d=>{U=d},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:d=>{g=d},setFrozen:d=>{P=d},restorePanoramaLayer:T,reducedMotion:$e,resolvedSeatViewPose:yt,showSectionSeatLabels:k,setNearFieldDetailEnabled:H,setSeatViewLocked:Ze,setNavigationMode:ke,showArriveChip:wt,removeArriveChip:Mt,inSeatView:()=>Oe!==null,setSeatStepping:d=>{en=d},seatViewArrival:(d,m)=>n.arriveAtSeatEye?cr(d,m):null,enterSeatView:d=>X?.enter(d)});I=!0;let Ct=ce.overviewChip,ur=ce.layoutOverviewChip,dr=ce.applyFloorFocus,mr=ce.focusOverview,nn=ce.cancelFlight,on=ce.flyToSeat,rn=ce.focusSectionCamera;lr.appendChild(Ct),xt={container:t,model:o,opts:n,analytics:i,orbit:x,loop:O,seatsById:l,ensureSeatView:Qt,resolvedSeatViewPose:yt,gpu:()=>c,gl:D.gl,isContextLost:()=>E,isDisposed:()=>L,flightGen:()=>ce.flightGen(),setPanorama:d=>{F=d},getLoadAbort:()=>g,setLoadAbort:d=>{g=d},setPanoramaSphereVisible:d=>{U=d,d&&X?.exit()},setFrozen:d=>{P=d},raisePanoramaLayer:R,restorePanoramaLayer:T,getOverviewChip:()=>Ct,labelOverlay:Q,reducedMotion:$e,removeArriveChip:Mt,showArriveChip:wt};let ge=jo({glctx:D,orbit:x,model:o,seats:e.seats,opts:n,cinematic:ee,analytics:i,seatIdByIndex:s,sectionIdBySeatId:p,tapSlop:oi,tapMs:ri,gpu:()=>c,pick:()=>b,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>se,selection:()=>C,cancelFlight:nn,focusSectionCamera:rn,focusSeatCamera:ce.focusSeatCamera,setSelection:Kt,ensureSeatView:Qt});D.canvas.addEventListener("pointerdown",ge.onDown),D.canvas.addEventListener("pointermove",ge.onMove),D.canvas.addEventListener("pointerup",ge.onUp),D.canvas.addEventListener("pointercancel",ge.onUp),O.requestRender();let At={setAvailability(d){let m=po(C,d),M=Et(o.seats,m);M.length&&c&&c.uploadSeatStateRuns(M),v(),O.requestRender()},setSelection:Kt,setNavigationMode:ke,zoomIn(){x.zoomBy(Te),O.requestRender()},zoomOut(){x.zoomBy(We),O.requestRender()},flyToSeat:on,focusOverview:mr,seatViewStop:()=>Oe,recentreSeatView:()=>X?.recentre()??!1,resize(){let{width:d,height:m}=D.resize();x.setAspect(d/Math.max(1,m)),ar(),sr(),ur(),O.requestRender()},stats(){return{...O.stats(),drawCalls:c?c.drawCalls:0,fallbackTriangles:c?c.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(d=1280){if(E||!c||typeof document>"u")return null;J(0);let m=D.canvas,M=Math.min(1,d/Math.max(m.width,m.height,1)),z=document.createElement("canvas");z.width=Math.max(1,Math.round(m.width*M)),z.height=Math.max(1,Math.round(m.height*M));let W=z.getContext("2d");return W?(W.drawImage(m,0,0,z.width,z.height),z.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let d=O.stats(),m=D.canvas.clientWidth||1,M=D.canvas.clientHeight||1,z=o.bounds.center,W=xe(x.camera.projectionViewMatrix,[z[0],o.bounds.box.min[1],z[2]],m,M),K=xe(x.camera.projectionViewMatrix,[z[0],o.bounds.box.max[1],z[2]],m,M),$=o.bounds.box,ae=[$.min[0],$.max[0]].flatMap(_=>[$.min[1],$.max[1]].flatMap(ue=>[$.min[2],$.max[2]].map(oe=>xe(x.camera.projectionViewMatrix,[_,ue,oe],m,M)))).filter(_=>Number.isFinite(_.x)&&Number.isFinite(_.y)&&Number.isFinite(_.depth)),we=ae.length?(()=>{let _=Math.min(...ae.map(ye=>ye.x)),ue=Math.max(...ae.map(ye=>ye.x)),oe=Math.min(...ae.map(ye=>ye.y)),Je=Math.max(...ae.map(ye=>ye.y)),et=Math.max(0,_),ze=Math.min(m,ue),Ne=Math.max(0,oe),tt=Math.min(M,Je),pe=Math.max(0,ze-et),Ce=Math.max(0,tt-Ne);return{box:{x:et,y:Ne,width:pe,height:Ce},horizontalFillRatio:pe/m,verticalFillRatio:Ce/M,visibleAreaRatio:pe*Ce/(m*M),clippedEdges:[...oe<0?["top"]:[],...ue>m?["right"]:[],...Je>M?["bottom"]:[],..._<0?["left"]:[]]}})():void 0,Me=String(D.gl.getParameter(D.gl.VERSION)??"");return{viewport:{width:m,height:M},context:{webgl2:/webgl\s*2/i.test(Me),lost:E},frame:{rendered:d.rendered,idle:d.idle},camera:{position:[x.camera.position.x,x.camera.position.y,x.camera.position.z],distance:x.currentDistance,verticalFovDeg:x.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:f,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:W.visible&&K.visible?Math.abs(W.y-K.y):0},labels:Q.qualityEvidence(),framing:we,...Oe?{seatView:{fovDeg:x.camera.fov,stop:Oe}}:{}}},getQualityReport(){return Nt(At.getQualityEvidence())},loseContextForTest(){D.simulateContextLossCycle()},floors(){return o.floors},focusFloor(d){if(d!==null&&!o.floors.some(M=>M.index===d))return!1;let m=d??-1;if(H(d!==null),Ze(!1),dr(m),ke("orbit"),d===null)ee.cancel(),$e()?x.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,q):x.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,q);else{let M=o.floors[d];if(M.seatCount>0){ee.cancel();let z=M.focalWorld[0]-M.center[0],W=M.focalWorld[2]-M.center[2],K=Math.hypot(z,W)>M.radius*.12?Math.atan2(z,W):G;x.frame({center:M.center,radius:M.radius,box:M.box},!1,K,!1,{polarDeg:58,margin:1.12})}}return O.requestRender(),!0},zones(){return o.zones},focusZone(d){let m=o.zones.find(K=>K.id===d);if(!m||m.seatCount===0)return!1;H(!1),Ze(!1),ee.cancel(),ke("orbit"),k(null),n.onSectionFocusChange?.(null);let M=m.focalWorld[0]-m.center[0],z=m.focalWorld[2]-m.center[2],W=Math.hypot(M,z)>m.radius*.12?Math.atan2(M,z):void 0;return x.frame({center:m.center,radius:m.radius*1.25},!1,W),O.requestRender(),!0},sections(){return o.sections},focusSection(d){return rn(d)},rows(d){return d?o.rows.filter(m=>m.sectionId===d):o.rows},seatsInRow(d){return e.seats.filter(m=>m.rowId===d).map(m=>({id:m.id,label:m.displayLabel||m.label}))},focusRow(d){let m=o.rows.find(M=>M.id===d);return!m||m.seatCount===0?!1:(H(!0),Ze(!1),ee.cancel(),ke("pan"),m.sectionId&&(k(m.sectionId),n.onSectionFocusChange?.(m.sectionId)),x.frame({center:m.center,radius:Math.max(2.5,m.radius*.65)}),O.requestRender(),!0)},setReducedMotionForTest(d){w=d},dispose(){L=!0,Mt(),Ct.remove(),ir.remove(),nn(),X?.dispose(),O.stop(),Q.dispose(),ne?.disconnect(),F&&(F.dispose(),F=null),T(),he(),D.canvas.removeEventListener("pointerdown",ge.onDown),D.canvas.removeEventListener("pointermove",ge.onMove),D.canvas.removeEventListener("pointerup",ge.onUp),D.canvas.removeEventListener("pointercancel",ge.onUp),x.dispose(),b&&b.dispose(),c&&c.dispose(),c=null,b=null,D.dispose()}};return i.opened(o.seatCount,f,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),At}export{zr as VENUE3D_QUALITY_REPORT_VERSION,hr as autoVenue3d,He as buildSceneModel,Ft as estimateVenue3D,Nt as inspectVenue3DQualityEvidence,fl as mountVenue3D,ei as prepareVenue3D,ti as prepareVenue3DFromChart};
|